Browse Source

微信端新建事件

seimin 1 year ago
parent
commit
7b6ad32960
2 changed files with 290 additions and 419 deletions
  1. 280 381
      src/views/newIncident.vue
  2. 10 38
      src/views/searchDept.vue

+ 280 - 381
src/views/newIncident.vue

@@ -26,20 +26,9 @@
26 26
       @submit="submitHandler"
27 27
     >
28 28
       <cube-form-group>
29
-        <cube-form-item
30
-          :field="fields[20]"
31
-          v-if="valConfig == 2"
32
-          class="btn_plcaeholde btn_local"
33
-        >
34
-          <!-- <cube-button @click="showPlacePicker()">{{selectedPlaceTxt?selectedPlaceTxt:'请输入故障地点'}}</cube-button> -->
35
-          <input
36
-            type="text"
37
-            class="inp_local"
38
-            placeholder="请输入报修科室"
39
-            v-model="deptInpVal"
40
-            @input="changeDeptList()"
41
-            @click="showDeptPicker()"
42
-          />
29
+        <cube-form-item :field="fields[24]" class="btn_plcaeholde" v-if="valConfig == 2"></cube-form-item>
30
+        <cube-form-item :field="fields[20]" v-if="valConfig == 2" class="btn_plcaeholde btn_local">
31
+          <input type="text" class="inp_local" placeholder="请选择报修科室" v-model="model.requester" @click="toSearchDept()" />
43 32
         </cube-form-item>
44 33
         <cube-form-item
45 34
           v-if="valConfig == 1"
@@ -56,18 +45,6 @@
56 45
           }}</cube-button>
57 46
         </cube-form-item>
58 47
         <cube-form-item :field="fields[23]" v-if="ifRoom == 1"></cube-form-item>
59
-        <!-- 故障地点: -->
60
-        <!-- <cube-form-item :field="fields[19]" class="btn_plcaeholde btn_local"> -->
61
-        <!-- <cube-button @click="showPlacePicker()">{{selectedPlaceTxt?selectedPlaceTxt:'请输入故障地点'}}</cube-button> -->
62
-        <!-- <input
63
-            type="text"
64
-            class="inp_local"
65
-            placeholder="请输入故障地点"
66
-            v-model="inpLocalVal"
67
-            @input="changeLocalList()"
68
-            @click="showPlacePicker()"
69
-          />
70
-        </cube-form-item> -->
71 48
         <cube-form-item :field="fields[3]"></cube-form-item>
72 49
         <cube-form-item :field="fields[4]" class="btn_plcaeholde">
73 50
           <cube-button @click="showCategoryPicker()">{{
@@ -78,17 +55,6 @@
78 55
           :field="fields[5]"
79 56
           class="btn_plcaeholde"
80 57
         ></cube-form-item>
81
-        <!-- <cube-form-item :field="fields[6]" class="btn_plcaeholde incidentTitle">
82
-          <div class="titleRefer">
83
-            <textarea
84
-              class="titleTxtArea fl"
85
-              placeholder="请输入事件主题"
86
-              v-model="incidentTitle"
87
-              @input="inpTitle()"
88
-            ></textarea>
89
-            <span class="abtn fl" @click="referKnowledge()">引入知识库</span>
90
-          </div>
91
-        </cube-form-item>-->
92 58
         <cube-form-item :field="fields[7]"></cube-form-item>
93 59
         <div class="label formLabel">
94 60
           报修图片
@@ -347,21 +313,24 @@ export default {
347 313
       }, //上传的model
348 314
       timer: null,
349 315
       incidentTitle: "", //事件主题
350
-      referenceInfo: {}, //引用信息
351 316
       placeSelectData: [], //区域地点下拉框选项
352 317
       inpLocalVal: "", //故障地点输入框
353 318
       faultLocationList: [], //区域地点拼接下拉框选项
354
-      deptInpVal: "", //报修科室输入框
355 319
       deptList: [], //报修科室下拉选项
356 320
       deptRes: "", //下拉框科室信息
321
+
322
+      branchList: [], //院区下拉列表
323
+      // branchRes: [], //院区下拉列表(完整)
324
+
357 325
       model: {
326
+        duty: null,
327
+        branch: "",
358 328
         contactsInformation: "",
359 329
         placeValue: [],
360 330
         address: "", //故障地点
361 331
         requester: "", //报修科室
362 332
         houseNumber: "", //详细地址
363 333
         description: "", //故障描述
364
-        // bxcode: "",
365 334
         assetId: "", //资产
366 335
         category: [],
367 336
         source: "", //事件来源
@@ -381,7 +350,6 @@ export default {
381 350
       },
382 351
       selectedCategoryTxt: "", //故障现象选中展示
383 352
       selectedPlaceTxt: "", //区域地点选中展示
384
-      // showPrompting:false,
385 353
       promptingConent: "",
386 354
       promptingStatus: "",
387 355
       order: 1, //处理方式  1:直接处理,2:派单
@@ -457,10 +425,10 @@ export default {
457 425
           label: "故障现象:",
458 426
           rules: {
459 427
             required: true
428
+          },
429
+          messages: {
430
+            required: "请选择故障现象"
460 431
           }
461
-          // messages: {
462
-          //   required: "请选择故障现象"
463
-          // }
464 432
         },
465 433
         {
466 434
           type: "select",
@@ -736,40 +704,30 @@ export default {
736 704
           rules: {
737 705
             required: false
738 706
           }
739
-        }
707
+        },
708
+        {
709
+          type: "select",
710
+          modelKey: "branch",
711
+          label: "院区:",
712
+          props: {
713
+            options: this.branchList,
714
+            title: "请选择院区",
715
+            placeholder: "请选择院区"
716
+          },
717
+          rules: {
718
+            required: true
719
+          }
720
+        },
740 721
       ]
741 722
     };
742 723
   },
743
-  watch: {
744
-    // "model.category": {
745
-    //   deep: true,
746
-    //   handler: function(n, o) {
747
-    //     this.model.houseNumber = houseNumber;
748
-    //     console.log(this.model.houseNumber);
749
-    //   }
750
-    // }
751
-    "model.room": {
752
-      handler(newV) {
753
-        if (newV) {
754
-          this.fields.forEach(item => {
755
-            if (item.modelKey == "room") {
756
-              this.model.houseNumber = item.props.options.find(
757
-                v => v.value == newV
758
-              ).text;
759
-            }
760
-          });
761
-        } else {
762
-          this.model.houseNumber = "";
763
-        }
764
-      }
765
-    }
766
-  },
724
+
767 725
   methods: {
768 726
     // 切换处理方式
769 727
     changeHandleTypes() {
770 728
       let reverseArr = this.model.category.filter(Boolean).reverse(); //数组翻转,取第一项不为空的
771 729
       let sjId = reverseArr[0]; //事件Id baba
772
-      let sj = this.initSjList.filter(v => v.id == sjId)[0];
730
+      let sj = this.initSjList ? this.initSjList.filter(v => v.id == sjId)[0] : null;
773 731
       console.log(this.order, sj);
774 732
       this.isShowDes = !(this.order == 1 && sj && sj.hasSimple == 1);
775 733
     },
@@ -918,15 +876,22 @@ export default {
918 876
     // 获取处理人
919 877
     getHandlerUser() {
920 878
       var that = this;
879
+      let postData = {
880
+        idx: 0,
881
+        sum: 1000,
882
+        user: {
883
+          roledata: { rolecode: "first-line support" },
884
+          selectType: "1"
885
+        }
886
+      };
887
+      // 当前所属院区或责任科室
888
+      if(this.loginUser.duty){
889
+        postData.user = { duty: this.loginUser.duty };
890
+      }else if(this.loginUser.branch){
891
+        postData.user = { branch: this.loginUser.branch }
892
+      }
921 893
       this.$http
922
-        .post("service/user/data/fetchDataList/user", {
923
-          idx: 0,
924
-          sum: 1000,
925
-          user: {
926
-            roledata: { rolecode: "first-line support" },
927
-            selectType: "1"
928
-          }
929
-        })
894
+        .post("service/user/data/fetchDataList/user", postData)
930 895
         .then(function(res) {
931 896
           res.data.list.forEach(function(v, i) {
932 897
             that.handlerUserArr.push({
@@ -993,7 +958,10 @@ export default {
993 958
         // that.modelData.incident.account = that.loginUser.account;
994 959
         // that.modelData.requestershow = that.loginUser;
995 960
       } else if (that.valConfig == 2) {
996
-        that.modelData.incident.department = that.model.requester;
961
+        that.modelData.incident.branch = that.model.branch;
962
+        if(that.$route.query.id){
963
+          that.modelData.incident.department = {id: +that.$route.query.id};
964
+        }
997 965
       }
998 966
       if (that.wxIncidentWithCmdb == 1) {
999 967
         that.modelData.incident.assetId = that.model.assetId;
@@ -1014,7 +982,7 @@ export default {
1014 982
         that.modelData.incident.room = { id: that.model.room };
1015 983
       }
1016 984
       that.modelData.incident.acceptUser = that.loginUser;
1017
-      that.modelData.incident.requester = {};
985
+      // that.modelData.incident.requester = {};
1018 986
       that.modelData.incident.handlingPersonnelUser = { id: that.loginUser.id };
1019 987
       that.modelData.incident.source = { id: that.model.source };
1020 988
       that.modelData.incident.title = that.model.title;
@@ -1084,20 +1052,6 @@ export default {
1084 1052
       that.model.fileUrl = "url";
1085 1053
       that.loadShow = true;
1086 1054
     },
1087
-    // 事件主题引入知识库
1088
-    referKnowledge() {
1089
-      var that = this;
1090
-      if (!that.model.title) return;
1091
-      that.setLocalStroageData();
1092
-      localStorage.setItem("modelData", JSON.stringify(that.modelData));
1093
-      localStorage.setItem("model", JSON.stringify(that.model));
1094
-      localStorage.setItem("order", that.order);
1095
-
1096
-      this.$router.push({
1097
-        name: "ReferenceList",
1098
-        params: { data: that.model.title }
1099
-      });
1100
-    },
1101 1055
     // 获取页面数据
1102 1056
     getMessage() {
1103 1057
       var that = this;
@@ -1129,19 +1083,19 @@ export default {
1129 1083
             that.$route.params.abnormal;
1130 1084
         }
1131 1085
       } else {
1132
-        that.name = that.loginUser.name;
1133
-        that.model.contactsInformation = that.loginUser.phone;
1134
-        that.model.contacts = that.loginUser.name;
1135
-        that.model.houseNumber = that.loginUser.houseNumber;
1136
-      }
1137
-      if (that.loginUser.place && that.loginUser.place.length) {
1138
-        if (that.loginUser.place.id) {
1139
-          if (that.loginUser.place.area) {
1140
-            that.model.placeValue[0] = that.loginUser.place.area.id;
1141
-          }
1142
-          that.model.placeValue[1] = that.loginUser.place.id;
1143
-        }
1086
+        // that.name = that.loginUser.name;
1087
+        // that.model.contactsInformation = that.loginUser.phone;
1088
+        // that.model.contacts = that.loginUser.name;
1089
+        // that.model.houseNumber = that.loginUser.houseNumber;
1144 1090
       }
1091
+      // if (that.loginUser.place && that.loginUser.place.length) {
1092
+      //   if (that.loginUser.place.id) {
1093
+      //     if (that.loginUser.place.area) {
1094
+      //       that.model.placeValue[0] = that.loginUser.place.area.id;
1095
+      //     }
1096
+      //     that.model.placeValue[1] = that.loginUser.place.id;
1097
+      //   }
1098
+      // }
1145 1099
 
1146 1100
       if (localStorage.getItem("model")) {
1147 1101
         that.model = JSON.parse(localStorage.getItem("model"));
@@ -1150,30 +1104,29 @@ export default {
1150 1104
       if (localStorage.getItem("modelData")) {
1151 1105
         that.modelData = JSON.parse(localStorage.getItem("modelData"));
1152 1106
       }
1153
-      if (localStorage.getItem("referenceInfo")) {
1154
-        that.referenceInfo = JSON.parse(localStorage.getItem("referenceInfo"));
1155
-        that.incidentTitle = that.model.title = that.referenceInfo.title;
1156
-        that.model.handleDescription = that.referenceInfo.content;
1157
-      }
1158 1107
       if (localStorage.getItem("order")) {
1159 1108
         that.order = localStorage.getItem("order") - 0;
1160 1109
       }
1161
-
1162
-      // if (localStorage.getItem("category")) {
1163
-      //   that.selectedCategoryTxt = JSON.parse(
1164
-      //     localStorage.getItem("category")
1165
-      //   ).txt;
1166
-      //   console.log(that.selectedCategoryTxt);
1167
-      // }
1168
-      // if (localStorage.getItem("place")) {
1169
-      //   that.selectedPlaceTxt = JSON.parse(localStorage.getItem("place")).txt;
1170
-      //   console.log(that.selectedPlaceTxt);
1171
-      // }
1172 1110
     },
1173 1111
     // 提交
1174 1112
     submitHandler() {
1175 1113
       $("#fade").fadeOut();
1176 1114
       var that = this;
1115
+      if (that.valConfig == 2) {
1116
+        if(that.model.duty){
1117
+          that.modelData.incident.duty = that.model.duty
1118
+        }else{
1119
+          let categoryId = this.model.category.slice(-1)[0];
1120
+          let category = this.initSjList.find(v => v.id == categoryId);
1121
+          this.$createDialog({
1122
+            type: "alert",
1123
+            title: "校验失败",
1124
+            content: "故障现象【"+ category.category +"】没有设置责任科室!",
1125
+            icon: "cubeic-wrong"
1126
+          }).show();
1127
+          return;
1128
+        }
1129
+      }
1177 1130
       that.setLocalStroageData();
1178 1131
       if (that.selectHouseNumber && that.selectHouseNumber.place) {
1179 1132
         that.modelData.incident.place = that.selectHouseNumber;
@@ -1251,11 +1204,8 @@ export default {
1251 1204
           }
1252 1205
         })
1253 1206
         .show();
1254
-      // localStorage.removeItem("category");
1255 1207
       localStorage.removeItem("model");
1256 1208
       localStorage.removeItem("modelData");
1257
-      // localStorage.removeItem("placeIndex");
1258
-      localStorage.removeItem("referenceInfo");
1259 1209
       localStorage.removeItem("solution");
1260 1210
       localStorage.removeItem("order");
1261 1211
       setTimeout(function() {
@@ -1343,22 +1293,12 @@ export default {
1343 1293
         });
1344 1294
     },
1345 1295
     validateHandler(result) {
1346
-      // this.submitHandler()
1347 1296
       console.log(result);
1348 1297
       this.resule = result;
1349 1298
       var that = this;
1350 1299
 
1351 1300
       that.validity = result.validity;
1352 1301
       that.valid = result.valid;
1353
-      // if (that.vali == true) {
1354
-      //   $("#fade").fadeIn();
1355
-      //   that.promptingConent = "提交失败,请填写必填信息!";
1356
-      //   that.promptingStatus = false;
1357
-      //   setTimeout(function() {
1358
-      //     $("#fade").fadeOut();
1359
-      //   }, 2000);
1360
-      // }
1361
-      // that.vali = false;
1362 1302
     },
1363 1303
 
1364 1304
     dateSelectHandler(selectedVal) {
@@ -1425,98 +1365,112 @@ export default {
1425 1365
       this.selectedCategoryTxt = this.model.title = this.model.description = this.incidentTitle =
1426 1366
         selected[selected.length - 1];
1427 1367
       this.model.category = selectedVal;
1428
-      // var category = {
1429
-      //   index: selectedIndex,
1430
-      //   txt: this.selectedCategoryTxt
1431
-      // };
1432
-      // localStorage.setItem("category", JSON.stringify(category));
1433
-      // ----------------------回显其他数据---------------------
1434
-      console.log(selectedVal, "seimin");
1435
-      let reverseArr = selectedVal.filter(Boolean).reverse(); //数组翻转,取第一项不为空的
1436
-      let sjId = reverseArr[0]; //事件Id baba
1437
-      let sj = this.initSjList.filter(v => v.id == sjId)[0];
1438
-      console.log(sj);
1439
-      this.model.priority = sj.priority?sj.priority.id:null;
1440
-      if (sj.branchType == 0) {
1441
-        if (sj.userOrGroupType === 1) {
1442
-          //派人
1443
-          this.order = 2;
1444
-          this.model.handleUserOrGroup = true;
1445
-          this.model.handlerUser = sj.handleUser ? sj.handleUser.id : "";
1446
-        } else if (sj.userOrGroupType === 2) {
1447
-          //派组
1448
-          this.order = 2;
1449
-          this.model.handleUserOrGroup = false;
1450
-          this.model.candidateGroups = sj.group ? sj.group.id : "";
1451
-        } else {
1452
-          this.order = 1;
1453
-          this.model.handleUserOrGroup = false;
1454
-          this.model.handlerUser = "";
1455
-          this.model.candidateGroups = "";
1456
-        }
1457
-      } else if (sj.branchType == 1) {
1458
-        // 分院区
1459
-        // liaomingming
1460
-        let areaId = this.model.placeValue[0]; //区域id
1461
-        console.log(this.initAreaList);
1462
-        if (areaId) {
1463
-          // 选择了区域
1464
-          let areaObj = this.initAreaList.find(v => v.id == areaId);
1465
-          if (areaObj) {
1466
-            let branchId = areaObj.branch;
1467
-            let branchUserGroup =
1468
-              sj.branchUserGroups.find(v => v.branchId == branchId) || {};
1469
-            if (branchUserGroup.branchUserOrGroupType == 1) {
1470
-              //派人
1471
-              this.order = 2;
1472
-              this.model.handleUserOrGroup = true;
1473
-              this.model.handlerUser = branchUserGroup.userId
1474
-                ? branchUserGroup.userId
1475
-                : undefined;
1476
-            } else if (branchUserGroup.branchUserOrGroupType === 2) {
1477
-              //派组
1478
-              this.order = 2;
1479
-              this.model.handleUserOrGroup = false;
1480
-              this.model.candidateGroups = branchUserGroup.groupId
1481
-                ? branchUserGroup.groupId
1482
-                : undefined;
1483
-            } else {
1484
-              this.order = 1;
1485
-              this.model.handleUserOrGroup = false;
1486
-              this.model.handlerUser = "";
1487
-              this.model.candidateGroups = "";
1488
-            }
1489
-          } else {
1490
-            this.order = 1;
1491
-            this.model.handleUserOrGroup = false;
1492
-            this.model.handlerUser = "";
1493
-            this.model.candidateGroups = "";
1494
-          }
1495
-        } else {
1496
-          this.order = 1;
1497
-          this.model.handleUserOrGroup = false;
1498
-          this.model.handlerUser = "";
1499
-          this.model.candidateGroups = "";
1368
+
1369
+      if(this.model.category.length){
1370
+        let category = this.initSjList.find(v => v.id == this.model.category.slice(-1)[0]);
1371
+        if(category && category.priority){
1372
+          // 回显优先级
1373
+          this.model.priority = category.priority.id;
1500 1374
         }
1375
+        // 选择了院区,科室,故障现象,责任科室
1376
+        this.showUserOrGroup();
1377
+        // 处理责任科室数据
1378
+        this.handlerDuty();
1501 1379
       }
1502 1380
 
1503
-      console.log(this.order, sj.hasSimple);
1504
-      if (this.order == 1 && sj.hasSimple == 1) {
1505
-        // 直接处理 && 简单处理
1506
-        this.isShowDes = false;
1507
-      } else {
1508
-        this.isShowDes = true;
1509
-      }
1381
+      // ----------------------回显其他数据---------------------
1382
+      // console.log(selectedVal, "seimin");
1383
+      // let reverseArr = selectedVal.filter(Boolean).reverse(); //数组翻转,取第一项不为空的
1384
+      // let sjId = reverseArr[0]; //事件Id
1385
+      // let sj = this.initSjList.filter(v => v.id == sjId)[0];
1386
+      // console.log(sj);
1387
+      // this.model.priority = sj.priority?sj.priority.id:null;
1388
+      // if (sj.branchType == 0) {
1389
+      //   if (sj.userOrGroupType === 1) {
1390
+      //     //派人
1391
+      //     this.order = 2;
1392
+      //     this.model.handleUserOrGroup = true;
1393
+      //     this.model.handlerUser = sj.handleUser ? sj.handleUser.id : "";
1394
+      //   } else if (sj.userOrGroupType === 2) {
1395
+      //     //派组
1396
+      //     this.order = 2;
1397
+      //     this.model.handleUserOrGroup = false;
1398
+      //     this.model.candidateGroups = sj.group ? sj.group.id : "";
1399
+      //   } else {
1400
+      //     this.order = 1;
1401
+      //     this.model.handleUserOrGroup = false;
1402
+      //     this.model.handlerUser = "";
1403
+      //     this.model.candidateGroups = "";
1404
+      //   }
1405
+      // } else if (sj.branchType == 1) {
1406
+      //   // 分院区
1407
+      //   let areaId = this.model.placeValue[0]; //区域id
1408
+      //   console.log(this.initAreaList);
1409
+      //   if (areaId) {
1410
+      //     // 选择了区域
1411
+      //     let areaObj = this.initAreaList.find(v => v.id == areaId);
1412
+      //     if (areaObj) {
1413
+      //       let branchId = areaObj.branch;
1414
+      //       let branchUserGroup =
1415
+      //         sj.branchUserGroups.find(v => v.branchId == branchId) || {};
1416
+      //       if (branchUserGroup.branchUserOrGroupType == 1) {
1417
+      //         //派人
1418
+      //         this.order = 2;
1419
+      //         this.model.handleUserOrGroup = true;
1420
+      //         this.model.handlerUser = branchUserGroup.userId
1421
+      //           ? branchUserGroup.userId
1422
+      //           : undefined;
1423
+      //       } else if (branchUserGroup.branchUserOrGroupType === 2) {
1424
+      //         //派组
1425
+      //         this.order = 2;
1426
+      //         this.model.handleUserOrGroup = false;
1427
+      //         this.model.candidateGroups = branchUserGroup.groupId
1428
+      //           ? branchUserGroup.groupId
1429
+      //           : undefined;
1430
+      //       } else {
1431
+      //         this.order = 1;
1432
+      //         this.model.handleUserOrGroup = false;
1433
+      //         this.model.handlerUser = "";
1434
+      //         this.model.candidateGroups = "";
1435
+      //       }
1436
+      //     } else {
1437
+      //       this.order = 1;
1438
+      //       this.model.handleUserOrGroup = false;
1439
+      //       this.model.handlerUser = "";
1440
+      //       this.model.candidateGroups = "";
1441
+      //     }
1442
+      //   } else {
1443
+      //     this.order = 1;
1444
+      //     this.model.handleUserOrGroup = false;
1445
+      //     this.model.handlerUser = "";
1446
+      //     this.model.candidateGroups = "";
1447
+      //   }
1448
+      // }
1449
+      // console.log(this.order, sj.hasSimple);
1450
+      // if (this.order == 1 && sj.hasSimple == 1) {
1451
+      //   // 直接处理 && 简单处理
1452
+      //   this.isShowDes = false;
1453
+      // } else {
1454
+      //   this.isShowDes = true;
1455
+      // }
1456
+      // ----------------------回显其他数据---------------------
1510 1457
     },
1511 1458
     // 故障现象
1512 1459
     getIncidentcategory() {
1513 1460
       this.loadShow = true;
1514 1461
       var that = this;
1462
+      let postData = {
1463
+        idx: 0,
1464
+        sum: 9999,
1465
+      };
1466
+      // 当前所属院区或责任科室
1467
+      if(this.loginUser.duty){
1468
+        postData.incidentcategory = { duty: this.loginUser.duty.id };
1469
+      }else if(this.loginUser.branch){
1470
+        postData.incidentcategory = { branch: this.loginUser.branch.id }
1471
+      }
1515 1472
       this.$http
1516
-        .post("service/bpm/data/fetchDataList/incidentcategory", {
1517
-          idx: 0,
1518
-          sum: 9999
1519
-        })
1473
+        .post("service/bpm/data/fetchDataList/incidentcategory", postData)
1520 1474
         .then(function(res) {
1521 1475
           that.initSjList = JSON.parse(JSON.stringify(res.data.list));
1522 1476
           var list = res.data.list;
@@ -1558,9 +1512,6 @@ export default {
1558 1512
           that.categoryPicker = that.$createCascadePicker({
1559 1513
             title: "故障现象选择",
1560 1514
             data: that.selectData,
1561
-            // selectedIndex: localStorage.getItem("category")
1562
-            //   ? JSON.parse(localStorage.getItem("category")).index
1563
-            //   : [0, 0, 0],
1564 1515
             selectedIndex:[0, 0, 0],
1565 1516
             onSelect: that.selectCategoryHandler
1566 1517
           });
@@ -1606,7 +1557,7 @@ export default {
1606 1557
       // --------------------start---------------------
1607 1558
       let categoryId = this.model.category.slice(-1)[0];
1608 1559
       if (categoryId) {
1609
-        // 选择了故障现象 liaomingming
1560
+        // 选择了故障现象
1610 1561
         let categoryObj = this.initSjList.find(v => v.id == categoryId);
1611 1562
         if (categoryObj) {
1612 1563
           if (categoryObj.branchType == 1) {
@@ -1656,63 +1607,18 @@ export default {
1656 1607
         this.model.candidateGroups = "";
1657 1608
       }
1658 1609
       // --------------------end---------------------
1659
-      // var place = {
1660
-      //   index: selectedIndex,
1661
-      //   txt: this.model.houseNumber
1662
-      // };
1663
-      // localStorage.setItem("place", JSON.stringify(place));
1664 1610
     },
1665
-    // 报修科室
1666
-    showDeptPicker() {
1667
-      this.deptPicker.show();
1611
+    // 跳转到报修科室搜索页面
1612
+    toSearchDept() {
1613
+      this.$router.push(`/searchDept?type=searchDept`);
1668 1614
     },
1669
-    // 选中报修科室
1670
-    selectDeptHandler(selectedVal, selectedIndex, selectedTxt) {
1671
-      console.log(selectedVal, selectedIndex, selectedTxt);
1672
-      this.deptInpVal = selectedTxt;
1673
-      this.model.requester = this.deptRes[selectedIndex];
1674
-      console.log(this.deptRes[selectedIndex]);
1675
-      this.inpLocalVal = this.model.address = this.deptRes[selectedIndex].place
1676
-        .area
1677
-        ? this.deptRes[selectedIndex].place.area.area
1678
-          ? this.deptRes[selectedIndex].place.place
1679
-            ? this.deptRes[selectedIndex].place.area.area +
1680
-              this.deptRes[selectedIndex].place.place
1681
-            : this.deptRes[selectedIndex].place.area.area
1682
-          : this.deptRes[selectedIndex].place.area
1683
-        : this.deptRes[selectedIndex].place.place;
1684
-      if (this.deptRes[selectedIndex].phone) {
1685
-        this.model.contactsInformation = this.deptRes[selectedIndex].phone;
1686
-      }
1687
-      // this.model.houseNumber = this.selectedPlaceTxt = selectedTxt.join(" ");
1688
-      // var place = {
1689
-      //   index: selectedIndex,
1690
-      //   txt: this.model.houseNumber
1691
-      // };
1692
-      // localStorage.setItem("place", JSON.stringify(place));
1693
-    },
1694
-    // 取消选中报修科室
1695
-    cancelDeptHandler() {
1696
-      if (this.model.requester) {
1697
-        this.deptInpVal = this.model.requester.dept;
1698
-      } else if (!this.model.requester) {
1699
-        this.deptInpVal = "";
1700
-        this.model.requester = "";
1701
-      }
1702
-      // this.model.houseNumber = this.selectedPlaceTxt = selectedTxt.join(" ");
1703
-      // var place = {
1704
-      //   index: selectedIndex,
1705
-      //   txt: this.model.houseNumber
1706
-      // };
1707
-      // localStorage.setItem("place", JSON.stringify(place));
1708
-    },
1709
-    getAreaData() {
1615
+    getAreaData(branchId) {
1710 1616
       this.$http
1711 1617
         .post("service/user/data/fetchDataList/area", {
1712 1618
           idx: 0,
1713
-          sum: 1000,
1619
+          sum: 9999,
1714 1620
           area: {
1715
-            wechatArea: true
1621
+            branch: branchId,
1716 1622
           }
1717 1623
         })
1718 1624
         .then(res => {
@@ -1725,24 +1631,25 @@ export default {
1725 1631
               children: []
1726 1632
             });
1727 1633
           }
1634
+
1635
+          this.getPlaceData(branchId);
1728 1636
         });
1729 1637
     },
1730
-    getPlaceData() {
1731
-      var that = this;
1638
+    getPlaceData(branchId) {
1732 1639
       this.$http
1733 1640
         .post("service/user/data/fetchDataList/place", {
1734 1641
           idx: 0,
1735
-          sum: 1000,
1642
+          sum: 9999,
1736 1643
           area: {
1737
-            wechatAreaId: ""
1644
+            branch: branchId,
1738 1645
           }
1739 1646
         })
1740
-        .then(function(res) {
1647
+        .then((res) => {
1741 1648
           var data = res.data.list;
1742 1649
           for (var i = 0; i < data.length; i++) {
1743
-            for (var j = 0; j < that.placeSelectData.length; j++) {
1744
-              if (data[i].area.id == that.placeSelectData[j].value) {
1745
-                that.placeSelectData[j].children.push({
1650
+            for (var j = 0; j < this.placeSelectData.length; j++) {
1651
+              if (data[i].area.id == this.placeSelectData[j].value) {
1652
+                this.placeSelectData[j].children.push({
1746 1653
                   text: data[i].place,
1747 1654
                   value: data[i].id
1748 1655
                 });
@@ -1750,109 +1657,93 @@ export default {
1750 1657
             }
1751 1658
           }
1752 1659
 
1753
-          that.placePicker = that.$createCascadePicker({
1660
+          console.log(this.initAreaList, data);
1661
+          console.log(this.placeSelectData);
1662
+
1663
+          this.placePicker = this.$createCascadePicker({
1754 1664
             title: "区域地点选择",
1755
-            data: that.placeSelectData,
1756
-            // selectedIndex: localStorage.getItem("place")
1757
-            //   ? JSON.parse(localStorage.getItem("place")).index
1758
-            //   : [0, 0],
1665
+            data: this.placeSelectData,
1759 1666
             selectedIndex: [0, 0],
1760
-            onSelect: that.selectPlaceHandler
1667
+            onSelect: this.selectPlaceHandler
1761 1668
           });
1762 1669
         });
1763 1670
     },
1764
-    // 故障地点
1765
-    getFaultLocation(type) {
1766
-      var that = this;
1671
+    // 获取院区列表
1672
+    getBranchList() {
1767 1673
       this.$http
1768
-        .post("service/apply/bpm/searchFaultLocation", {
1769
-          searchKey: this.inpLocalVal || ""
1674
+        .post("service/user/data/fetchDataList/branch", {
1675
+          idx: 0,
1676
+          sum: 9999,
1770 1677
         })
1771
-        .then(function(res) {
1772
-          var data = res.data.result;
1773
-          that.allPlace = JSON.parse(JSON.stringify(res.data.result));
1774
-          if (type == 1) {
1775
-            that.faultLocationList.length = 0;
1776
-            that.$set(that.faultLocationList, true, []);
1777
-            that.faultLocationList;
1778
-          }
1779
-          for (var i = 0; i < data.length; i++) {
1780
-            that.faultLocationList.push({
1781
-              text: data[i].area
1782
-                ? data[i].area.area
1783
-                  ? data[i].place
1784
-                    ? data[i].area.area + data[i].place
1785
-                    : data[i].area.area
1786
-                  : data[i].area
1787
-                : data[i].place,
1788
-              value: data[i].id
1678
+        .then((res) => {
1679
+          res.data.list.forEach((v) => {
1680
+            this.branchList.push({
1681
+              text: v.hosName,
1682
+              value: v.id
1789 1683
             });
1790
-          }
1791
-          console.log(that.faultLocationList);
1792
-
1793
-          that.placePicker = that.$createCascadePicker({
1794
-            title: "区域地点选择",
1795
-            data: that.faultLocationList,
1796
-            // selectedIndex: localStorage.getItem("place")
1797
-            //   ? JSON.parse(localStorage.getItem("place")).index
1798
-            //   : [0, 0],
1799
-            onSelect: that.selectPlaceHandler
1800 1684
           });
1801
-          // that.fields[19].props.options = that.faultLocationList;
1685
+          this.fields[24].props.options = this.branchList;
1802 1686
         });
1803 1687
     },
1804
-    // 故障地点输入框节流阀
1805
-    changeLocalList() {
1806
-      var that = this;
1807
-      this.model.address = this.inpLocalVal;
1808
-      console.log(this.inpLocalVal);
1809
-      clearTimeout(that.timer);
1810
-      that.timer = setTimeout(() => {
1811
-        this.getFaultLocation(1);
1812
-      }, 600);
1688
+    // 回显处理人或组
1689
+    showUserOrGroup(){
1690
+      this.order = 2;
1691
+      this.model.handleUserOrGroup = true;
1692
+      this.model.handlerUser = this.loginUser.id;
1813 1693
     },
1814
-    // 报修科室
1815
-    getDept(type) {
1816
-      var that = this;
1817
-      this.$http
1818
-        .post("service/user/data/fetchDataList/department", {
1819
-          idx: 0,
1820
-          sum: 50,
1821
-          department: { dept: that.deptInpVal || "" }
1822
-        })
1823
-        .then(function(res) {
1824
-          var data = res.data.list;
1825
-          if (type == 1) {
1826
-            that.deptList.length = 0;
1827
-            that.$set(that.deptList, true, []);
1828
-            that.deptList;
1829
-          }
1830
-          that.deptRes = res.data.list;
1831
-          for (var i = 0; i < data.length; i++) {
1832
-            that.deptList.push({
1833
-              text: data[i].dept,
1834
-              value: data[i].id
1835
-            });
1836
-          }
1694
+    // 处理顶部责任科室数据
1695
+    handlerDuty(){
1696
+      console.log(this.model.category)
1697
+      if(!this.model.category.length){
1698
+        return;
1699
+      }
1700
+      let categoryId = this.model.category.slice(-1)[0];
1701
+      let category = this.initSjList.find(v => v.id == categoryId);
1837 1702
 
1838
-          that.deptPicker = that.$createCascadePicker({
1839
-            title: "报修科室选择",
1840
-            data: that.deptList,
1841
-            onSelect: that.selectDeptHandler,
1842
-            onCancel: that.cancelDeptHandler
1703
+      if(category.branchType == 1){
1704
+        // 分院区
1705
+        if(this.model.branch){
1706
+          var dutyConfig = category.branchUserGroups.find(v=>v.branchId == this.model.branch);
1707
+          if(dutyConfig && dutyConfig.dutyId && dutyConfig.dutyName){
1708
+            this.model.duty = {id:dutyConfig.dutyId,dept:dutyConfig.dutyName};
1709
+          }else{
1710
+            this.model.duty = null;
1711
+          }
1712
+        }else{
1713
+          this.model.duty = null;
1714
+        }
1715
+      }else{
1716
+        // 不分院区
1717
+        this.model.duty = category.dutyDepartment;
1718
+      }
1719
+    },
1720
+  },
1721
+  watch: {
1722
+    "model.room": {
1723
+      handler(newV) {
1724
+        if (newV) {
1725
+          this.fields.forEach(item => {
1726
+            if (item.modelKey == "room") {
1727
+              this.model.houseNumber = item.props.options.find(
1728
+                v => v.value == newV
1729
+              ).text;
1730
+            }
1843 1731
           });
1844
-        });
1732
+        } else {
1733
+          this.model.houseNumber = "";
1734
+        }
1735
+      }
1736
+    },
1737
+    'model.branch': {
1738
+      handler(newVal, oldVal){
1739
+        console.log(newVal, oldVal);
1740
+        this.showUserOrGroup();
1741
+        newVal && this.getAreaData(newVal);
1742
+        this.handlerDuty();
1743
+      }
1845 1744
     },
1846
-    changeDeptList() {
1847
-      var that = this;
1848
-      clearTimeout(that.timer);
1849
-      that.timer = setTimeout(() => {
1850
-        this.getDept(1);
1851
-      }, 600);
1852
-    }
1853 1745
   },
1854 1746
   created() {
1855
-    console.log(this.$route.params.data);
1856 1747
     //获取事件来源
1857 1748
     this.getSource();
1858 1749
     // 优先级
@@ -1869,18 +1760,32 @@ export default {
1869 1760
     this.getHandlerUser();
1870 1761
     // 处理组
1871 1762
     this.getCandidateGroups();
1872
-    // this.getbxcode();
1873 1763
     this.getMessage();
1874 1764
     // 事件单号
1875 1765
     this.getsjnum();
1876 1766
     // 故障现象
1877 1767
     this.getIncidentcategory();
1878
-    this.getAreaData();
1879
-    this.getPlaceData();
1880
-    // 获取故障地点
1881
-    // this.getFaultLocation();
1882 1768
     if (this.valConfig == 2) {
1883
-      this.getDept();
1769
+      // 获取院区列表
1770
+      this.getBranchList();
1771
+
1772
+      // 回显选择的报修科室
1773
+      if(this.$route.query.id && this.$route.query.dept){
1774
+        this.model.requester = this.$route.query.dept;
1775
+        // 回显科室信息
1776
+        this.showUserOrGroup();
1777
+        if(this.$route.query.areaId && this.$route.query.placeId && this.$route.query.areaName && this.$route.query.placeName){
1778
+          this.model.placeValue = [+this.$route.query.areaId, +this.$route.query.placeId];
1779
+          this.selectedPlaceTxt = this.$route.query.areaName + ' ' + this.$route.query.placeName;
1780
+        }else{
1781
+          this.model.placeValue = [];
1782
+          this.selectedPlaceTxt = '';
1783
+        }
1784
+        this.model.contactsInformation = this.$route.query.phone;
1785
+      }
1786
+
1787
+      // 回显院区
1788
+      this.model.branch = this.loginUser.duty ? this.loginUser.duty.branch : this.loginUser.branch.id;
1884 1789
     }
1885 1790
   },
1886 1791
   beforeRouteLeave(to, from, next) {
@@ -1902,14 +1807,14 @@ export default {
1902 1807
     CubePage,
1903 1808
     CubeButtonGroup,
1904 1809
     DatePicker,
1905
-    // JsonView
1906 1810
     CubeExtendPopup,
1907 1811
     LoadIng,
1908 1812
     PrompTing
1909 1813
   }
1910 1814
 };
1911 1815
 </script>
1912
-<style>
1816
+
1817
+<style lang="less" scoped>
1913 1818
 .newIncident .cube-form-group {
1914 1819
   border-bottom: 0.02rem solid rgb(245, 245, 245);
1915 1820
 }
@@ -1924,10 +1829,6 @@ export default {
1924 1829
   background: none;
1925 1830
   border: none;
1926 1831
 }
1927
-
1928
-.btn_local {
1929
-  /* z-index: 101; */
1930
-}
1931 1832
 .inp_local {
1932 1833
   outline: none;
1933 1834
   width: 100%;
@@ -1953,8 +1854,6 @@ export default {
1953 1854
 .cube-picker-wheel-item {
1954 1855
   text-overflow: ellipsis;
1955 1856
 }
1956
-</style>
1957
-<style lang="less" scoped>
1958 1857
 .zc {
1959 1858
   display: flex;
1960 1859
   position: relative;

+ 10 - 38
src/views/searchDept.vue

@@ -5,7 +5,7 @@
5 5
         class="mSearch-input-box"
6 6
         :mode="2"
7 7
         button="inside"
8
-        placeholder="输入关键字"
8
+        placeholder="请输入科室名称"
9 9
         @search="doSearch(false)"
10 10
         @input="changeInp"
11 11
         @confirm="doSearch(false)"
@@ -61,8 +61,6 @@ export default {
61 61
   },
62 62
   data() {
63 63
     return {
64
-      other: {},
65
-      model: {},
66 64
       reFresh: "",
67 65
       keyword: "",
68 66
       oldKeywordList: [],
@@ -81,20 +79,10 @@ export default {
81 79
     }
82 80
   },
83 81
   mounted() {
84
-    if(this.$route.query.model){
85
-      let other = JSON.parse(this.$route.query.other);
86
-      this.model = JSON.parse(this.$route.query.model);
87
-      this.other = other;
88
-    }
82
+    // this.$route.query.type
89 83
     this.init();
90 84
   },
91 85
   methods: {
92
-    // ...mapMutations('other', [
93
-    //   "changeSearchDeptResult",
94
-    //   "changeSeiminModel",
95
-    //   "changeSearchDeptResultList",
96
-    // ]),
97
-    // ...mapMutations("login", ["changeLoginInfo"]),
98 86
     init() {
99 87
       this.loadOldKeyword();
100 88
     },
@@ -124,20 +112,18 @@ export default {
124 112
       let postData = {
125 113
         idx: 0,
126 114
         sum: 9999,
127
-        incidentcategory: {
128
-          category: keyword,
115
+        department: {
116
+          dept: keyword,
129 117
           selectType: "pinyin_qs",
130
-          hierarchyQuery: "three"
131 118
         }
132 119
       };
133 120
       this.toast = this.$createToast({
134
-        time: 0,
135 121
         mask: true,
136 122
         txt: "正在加载中"
137 123
       });
138 124
       this.toast.show();
139 125
       this.$http
140
-        .post("service/user/data/fetchDataList/incidentcategory", postData)
126
+        .post("service/user/data/fetchDataList/department", postData)
141 127
         .then(res => {
142 128
           res = res.data;
143 129
           this.toast.hide();
@@ -176,13 +162,13 @@ export default {
176 162
         //定义高亮#9f9f9f
177 163
         var html = "";
178 164
         // 科室名称
179
-        html = row.mutiCategory.replace(
165
+        html = row.dept.replace(
180 166
           keyword,
181 167
           "<span style='color: #9f9f9f;'>" + keyword + "</span>"
182 168
         );
183 169
         html = "<div>" + html + "</div>";
184 170
         var tmpObj = {
185
-          keyword: row.mutiCategory,
171
+          keyword: row.dept,
186 172
           htmlStr: html
187 173
         };
188 174
         keywordArr.push(tmpObj);
@@ -221,20 +207,10 @@ export default {
221 207
       this.keyword = keyword;
222 208
       this.saveKeyword(keyword); //保存为历史
223 209
       let arr = this.deptList.filter(item => {
224
-        return item.mutiCategory === keyword;
210
+        return item.dept === keyword;
225 211
       });
226 212
       if (arr.length) {
227
-        // model
228
-        this.model.category = arr[0];
229
-        // this.$router.push(`/newIncident?id=${arr[0].id}&model=${JSON.stringify(this.model)}&other=${JSON.stringify(this.other)}`);
230
-        this.$router.push({
231
-          name: 'NewIncident',
232
-          params: {
233
-            id: arr[0].id,
234
-            model: this.model,
235
-            other: this.other,
236
-          },
237
-        })
213
+        this.$router.push(`/newIncident?id=${arr[0].id}&dept=${arr[0].dept}&phone=${arr[0].phone || ''}&areaId=${arr[0].place ? arr[0].place.area.id : ''}&areaName=${arr[0].place ? arr[0].place.area.area : ''}&placeId=${arr[0].place ? arr[0].place.id : ''}&placeName=${arr[0].place ? arr[0].place.place : ''}`);
238 214
       }
239 215
     },
240 216
     //保存关键字到历史记录
@@ -262,10 +238,6 @@ export default {
262 238
 };
263 239
 </script>
264 240
 <style lang="less" scoped>
265
-view {
266
-  display: block;
267
-}
268
-
269 241
 .search-box {
270 242
   background-color: rgb(242, 242, 242);
271 243
   padding: 0.15rem 2.5%;
@@ -406,7 +378,7 @@ view {
406 378
   color: #6b6b6b;
407 379
 }
408 380
 
409
-.keyword-box .keyword-block .keyword > view {
381
+.keyword-box .keyword-block .keyword > div {
410 382
   display: flex;
411 383
   justify-content: center;
412 384
   align-items: center;