Ver código fonte

增加校区字段

seimin 2 anos atrás
pai
commit
4b368051f7

+ 6 - 0
src/components/EventInformation/index.vue

@@ -109,6 +109,12 @@
109 109
         <span class="fr">{{ model.incident.overdueTime }}</span>
110 110
       </p>
111 111
       <p>
112
+        <span class="fl">校区</span>
113
+        <span class="fr">{{
114
+          model.incident.branch ? model.incident.branch.hosName : "--"
115
+        }}</span>
116
+      </p>
117
+      <p>
112 118
         <span class="fl">区域</span>
113 119
         <span class="fr">{{
114 120
           model.incident.place ? model.incident.place.area.area : "--"

+ 1 - 0
src/components/form/form-item.vue

@@ -299,6 +299,7 @@
299 299
     align-items: center
300 300
     word-wrap: break-word
301 301
     word-break: break-word
302
+    flex-shrink: 0
302 303
   .cube-form-item_required
303 304
     .cube-form-label
304 305
       &::before

+ 1 - 1
src/views/incidentList.vue

@@ -79,7 +79,7 @@
79 79
                   <span
80 80
                     v-if="item.place"
81 81
                     style="width:70%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;"
82
-                    >{{ item.place.area.area }} {{ item.place.place }}
82
+                    >{{ item.branch?item.branch.hosName:'' }} {{ item.place.area.area }} {{ item.place.place }}
83 83
                     {{ item.houseNumber }}</span
84 84
                   >
85 85
                   <span>{{ item.acceptDate | timeFormat("MM-dd HH:mm") }}</span>

+ 1 - 1
src/views/indes.vue

@@ -185,7 +185,7 @@
185 185
               <span
186 186
                 v-if="item.place"
187 187
                 style="width:70%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;"
188
-                >{{ item.place.area.area }} {{ item.place.place }}
188
+                >{{ item.branch?item.branch.hosName:'' }} {{ item.place.area.area }} {{ item.place.place }}
189 189
                 {{ item.houseNumber }}</span
190 190
               >
191 191
               <span>{{ item.acceptDate | timeFormat("MM-dd HH:mm") }}</span>

+ 119 - 121
src/views/newIncident.vue

@@ -52,7 +52,7 @@
52 52
         <cube-form-item :field="fields[1]"></cube-form-item>
53 53
         <cube-form-item :field="fields[2]" class="btn_plcaeholde">
54 54
           <cube-button @click="showPlacePicker()">{{
55
-            selectedPlaceTxt ? selectedPlaceTxt : "请选择区域地点"
55
+            selectedPlaceTxt ? selectedPlaceTxt : "请选择校区区域地点"
56 56
           }}</cube-button>
57 57
         </cube-form-item>
58 58
         <cube-form-item :field="fields[23]" v-if="ifRoom == 1"></cube-form-item>
@@ -215,10 +215,10 @@ const solution = {
215 215
       selected: [],
216 216
       selectData: [],
217 217
       initVal: JSON.parse(localStorage.getItem("solution")) || [0, 0, 0],
218
-      allPlace: {}, //存放请求到的所有区域地点
219
-      sleectHouseNumber: {}, //区域地点
218
+      allPlace: {}, //存放请求到的所有校区区域地点
219
+      sleectHouseNumber: {}, //校区区域地点
220 220
       initSjList: [], //原始事件列表
221
-      initAreaList: [], //原始区域列表
221
+      // initAreaList: [], //原始区域列表
222 222
     };
223 223
   },
224 224
   render(createElement) {
@@ -348,9 +348,9 @@ export default {
348 348
       timer: null,
349 349
       incidentTitle: "", //事件主题
350 350
       referenceInfo: {}, //引用信息
351
-      placeSelectData: [], //区域地点下拉框选项
351
+      placeSelectData: [], //校区区域地点下拉框选项
352 352
       inpLocalVal: "", //故障地点输入框
353
-      faultLocationList: [], //区域地点拼接下拉框选项
353
+      faultLocationList: [], //校区区域地点拼接下拉框选项
354 354
       deptInpVal: "", //报修科室输入框
355 355
       deptList: [], //报修科室下拉选项
356 356
       deptRes: "", //下拉框科室信息
@@ -380,7 +380,7 @@ export default {
380 380
         room: "" //房间号
381 381
       },
382 382
       selectedCategoryTxt: "", //事件分类选中展示
383
-      selectedPlaceTxt: "", //区域地点选中展示
383
+      selectedPlaceTxt: "", //校区区域地点选中展示
384 384
       // showPrompting:false,
385 385
       promptingConent: "",
386 386
       promptingStatus: "",
@@ -431,12 +431,12 @@ export default {
431 431
         {
432 432
           component: "button",
433 433
           modelKey: "placeValue",
434
-          label: "区域地点:",
434
+          label: "校区区域地点:",
435 435
           rules: {
436 436
             required: false
437 437
           },
438 438
           messages: {
439
-            required: "请选择区域地点"
439
+            required: "请选择校区区域地点"
440 440
           }
441 441
         },
442 442
         {
@@ -975,15 +975,20 @@ export default {
975 975
         }
976 976
       });
977 977
       solutionType = a2;
978
-      if (that.model.placeValue.length == 2) {
979
-        that.model.areaId =
980
-          that.model.placeValue[that.model.placeValue.length - 2];
981
-        that.model.placeId =
982
-          that.model.placeValue[that.model.placeValue.length - 1];
983
-      } else if (that.model.placeValue.length == 1) {
984
-        that.model.areaId =
985
-          that.model.placeValue[that.model.placeValue.length - 1];
986
-        that.model.placeId = "";
978
+      // if (that.model.placeValue.length == 2) {
979
+      //   that.model.areaId =
980
+      //     that.model.placeValue[that.model.placeValue.length - 2];
981
+      //   that.model.placeId =
982
+      //     that.model.placeValue[that.model.placeValue.length - 1];
983
+      // } else if (that.model.placeValue.length == 1) {
984
+      //   that.model.areaId =
985
+      //     that.model.placeValue[that.model.placeValue.length - 1];
986
+      //   that.model.placeId = "";
987
+      // }
988
+      if (that.model.placeValue.length === 3){
989
+          that.model.branchId = that.model.placeValue[0];
990
+          that.model.areaId = that.model.placeValue[1];
991
+          that.model.placeId = that.model.placeValue[2];
987 992
       }
988 993
 
989 994
       // that.modelData.incident.houseNumber = that.model.address[0];
@@ -998,8 +1003,9 @@ export default {
998 1003
       if (that.wxIncidentWithCmdb == 1) {
999 1004
         that.modelData.incident.assetId = that.model.assetId;
1000 1005
       }
1001
-      that.modelData.incident.area = { id: that.model.areaId };
1002
-      that.modelData.incident.place = { id: that.model.placeId };
1006
+      that.modelData.incident.branch = that.model.branchId?{ id: that.model.branchId }:undefined;
1007
+      that.modelData.incident.area = that.model.areaId?{ id: that.model.areaId }:undefined;
1008
+      that.modelData.incident.place = that.model.placeId?{ id: that.model.placeId }:undefined;
1003 1009
       that.modelData.incident.category = {
1004 1010
         id: category[category.length - 1]
1005 1011
       };
@@ -1184,6 +1190,7 @@ export default {
1184 1190
         "2020年4月25日14:09:29"
1185 1191
       );
1186 1192
       console.log(that.modelData.incident.category.id, this.initSjList, "事件");
1193
+      // debugger;//测试
1187 1194
       if (
1188 1195
         this.order == 1 &&
1189 1196
         (this.integralMechanism == 1 ||
@@ -1433,7 +1440,7 @@ export default {
1433 1440
       // ----------------------回显其他数据---------------------
1434 1441
       console.log(selectedVal, "seimin");
1435 1442
       let reverseArr = selectedVal.filter(Boolean).reverse(); //数组翻转,取第一项不为空的
1436
-      let sjId = reverseArr[0]; //事件Id baba
1443
+      let sjId = reverseArr[0]; //事件Id
1437 1444
       let sj = this.initSjList.filter(v => v.id == sjId)[0];
1438 1445
       console.log(sj);
1439 1446
       this.model.priority = sj.priority?sj.priority.id:null;
@@ -1455,37 +1462,26 @@ export default {
1455 1462
           this.model.candidateGroups = "";
1456 1463
         }
1457 1464
       } 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
-            }
1465
+        // 分校区
1466
+        let branchId = this.model.placeValue[0]; //校区id
1467
+        if (branchId) {
1468
+          // 选择了校区
1469
+          let branchUserGroup =
1470
+            sj.branchUserGroups.find(v => v.branchId == branchId) || {};
1471
+          if (branchUserGroup.branchUserOrGroupType == 1) {
1472
+            //派人
1473
+            this.order = 2;
1474
+            this.model.handleUserOrGroup = true;
1475
+            this.model.handlerUser = branchUserGroup.userId
1476
+              ? branchUserGroup.userId
1477
+              : undefined;
1478
+          } else if (branchUserGroup.branchUserOrGroupType === 2) {
1479
+            //派组
1480
+            this.order = 2;
1481
+            this.model.handleUserOrGroup = false;
1482
+            this.model.candidateGroups = branchUserGroup.groupId
1483
+              ? branchUserGroup.groupId
1484
+              : undefined;
1489 1485
           } else {
1490 1486
             this.order = 1;
1491 1487
             this.model.handleUserOrGroup = false;
@@ -1588,13 +1584,13 @@ export default {
1588 1584
           });
1589 1585
         });
1590 1586
     },
1591
-    // 区域地点
1587
+    // 校区区域地点
1592 1588
     showPlacePicker() {
1593 1589
       this.placePicker.show();
1594 1590
     },
1595 1591
     selectPlaceHandler(selectedVal, selectedIndex, selectedTxt) {
1596 1592
       console.log(selectedVal, selectedIndex, selectedTxt);
1597
-      console.log(selectedVal[0], "区");
1593
+      console.log(selectedVal[0], "区");
1598 1594
       console.log(this.initSjList, "事件分类列表");
1599 1595
       console.log(this.model.category.slice(-1)[0], "事件分类");
1600 1596
       if (this.ifRoom == 1) {
@@ -1606,14 +1602,12 @@ export default {
1606 1602
       // --------------------start---------------------
1607 1603
       let categoryId = this.model.category.slice(-1)[0];
1608 1604
       if (categoryId) {
1609
-        // 选择了事件分类 liaomingming
1605
+        // 选择了事件分类
1610 1606
         let categoryObj = this.initSjList.find(v => v.id == categoryId);
1611 1607
         if (categoryObj) {
1612 1608
           if (categoryObj.branchType == 1) {
1613 1609
             // 分院区开关打开的情况下
1614
-            let areaId = this.model.placeValue[0]; //区域id
1615
-            let areaObj = this.initAreaList.find(v => v.id == areaId);
1616
-            let branchId = areaObj.branch;
1610
+            let branchId = this.model.placeValue[0];
1617 1611
             let branchUserGroup =
1618 1612
               categoryObj.branchUserGroups.find(v => v.branchId == branchId) ||
1619 1613
               {};
@@ -1706,51 +1700,51 @@ export default {
1706 1700
       // };
1707 1701
       // localStorage.setItem("place", JSON.stringify(place));
1708 1702
     },
1709
-    getBranchData() {
1710
-      this.$http
1711
-        .post("service/user/data/fetchDataList/branch", {
1712
-          idx: 0,
1713
-          sum: 1000,
1714
-        })
1715
-        .then(res => {
1716
-          let data = res.data.list;
1717
-          for (let i = 0; i < data.length; i++) {
1718
-            this.placeSelectData.push({
1719
-              text: data[i].hosName,
1720
-              value: data[i].id,
1721
-              children: []
1722
-            });
1723
-          }
1724
-          console.log(this.placeSelectData,'校区');
1725
-          this.getAreaData();
1726
-        });
1727
-    },
1728
-    getAreaData() {
1729
-      this.$http
1730
-        .post("service/user/data/fetchDataList/area", {
1731
-          idx: 0,
1732
-          sum: 1000,
1733
-          area: {
1734
-            wechatArea: true
1735
-          }
1736
-        })
1737
-        .then(res => {
1738
-          this.initAreaList = JSON.parse(JSON.stringify(res.data.list));
1739
-          let data = res.data.list;
1740
-          for (let i = 0; i < data.length; i++) {
1741
-            for (let j = 0; j < this.placeSelectData.length; j++) {
1742
-              if (data[i].branch == this.placeSelectData[j].value) {
1743
-                this.placeSelectData[j].children.push({
1744
-                  text: data[i].area,
1745
-                  value: data[i].id
1746
-                });
1747
-              }
1748
-            }
1749
-          }
1750
-          console.log(this.placeSelectData,'区域');
1751
-          this.getPlaceData();
1752
-        });
1753
-    },
1703
+    // getBranchData() {
1704
+    //   this.$http
1705
+    //     .post("service/user/data/fetchDataList/branch", {
1706
+    //       idx: 0,
1707
+    //       sum: 1000,
1708
+    //     })
1709
+    //     .then(res => {
1710
+    //       let data = res.data.list;
1711
+    //       for (let i = 0; i < data.length; i++) {
1712
+    //         this.placeSelectData.push({
1713
+    //           text: data[i].hosName,
1714
+    //           value: data[i].id,
1715
+    //           children: []
1716
+    //         });
1717
+    //       }
1718
+    //       console.log(this.placeSelectData,'校区');
1719
+    //       this.getAreaData();
1720
+    //     });
1721
+    // },
1722
+    // getAreaData() {
1723
+    //   this.$http
1724
+    //     .post("service/user/data/fetchDataList/area", {
1725
+    //       idx: 0,
1726
+    //       sum: 1000,
1727
+    //       area: {
1728
+    //         wechatArea: true
1729
+    //       }
1730
+    //     })
1731
+    //     .then(res => {
1732
+    //       this.initAreaList = JSON.parse(JSON.stringify(res.data.list));
1733
+    //       let data = res.data.list;
1734
+    //       for (let i = 0; i < data.length; i++) {
1735
+    //         for (let j = 0; j < this.placeSelectData.length; j++) {
1736
+    //           if (data[i].branch == this.placeSelectData[j].value) {
1737
+    //             this.placeSelectData[j].children.push({
1738
+    //               text: data[i].area,
1739
+    //               value: data[i].id
1740
+    //             });
1741
+    //           }
1742
+    //         }
1743
+    //       }
1744
+    //       console.log(this.placeSelectData,'区域');
1745
+    //       this.getPlaceData();
1746
+    //     });
1747
+    // },
1754 1748
     getPlaceData() {
1755 1749
       this.$http
1756 1750
         .post("service/user/data/fetchDataList/place", {
@@ -1772,14 +1766,6 @@ export default {
1772 1766
           //     }
1773 1767
           //   }
1774 1768
           // }
1775
-          // const collectionArea = {};
1776
-          // data.forEach((v) => {
1777
-          //   if(collectionArea[v.area.id]){
1778
-          //     collectionArea[v.area.id].push(v);
1779
-          //   }else{
1780
-          //     collectionArea[v.area.id] = [v];
1781
-          //   }
1782
-          // })
1783 1769
           console.log(data, 'data');
1784 1770
           this.placeSelectData = [];
1785 1771
           const collectionBranch = {};
@@ -1792,16 +1778,30 @@ export default {
1792 1778
             }
1793 1779
           })
1794 1780
 
1795
-          // this.placeSelectData.forEach(v => {
1796
-          //   v.children = collectionBranch[v.value];
1797
-          // })
1781
+          this.placeSelectData.forEach(v => {
1782
+            let areaByPlace = collectionBranch[v.value];
1783
+            let areaCollection = {};
1784
+            let areaArr = [];
1785
+            areaByPlace.forEach(vv => {
1786
+              if(areaCollection[vv.area.id]){
1787
+                areaCollection[vv.area.id].push({text:vv.place, value: vv.id});
1788
+              }else{
1789
+                areaArr.push({text:vv.area.area, value: vv.area.id, children: []})
1790
+                areaCollection[vv.area.id] = [{text:vv.place, value: vv.id}];
1791
+              }
1792
+            })
1793
+            areaArr.forEach(vv => {
1794
+              vv.children = areaCollection[vv.value];
1795
+            })
1796
+            v.children = areaArr;
1797
+          })
1798 1798
 
1799 1799
           console.log(collectionBranch,'collectionBranch集合');
1800 1800
           console.log(this.placeSelectData,'地点');
1801 1801
           this.placePicker = this.$createCascadePicker({
1802
-            title: "区域地点选择",
1802
+            title: "校区区域地点选择",
1803 1803
             data: this.placeSelectData,
1804
-            selectedIndex: [0, 0],
1804
+            selectedIndex: [0, 0, 0],
1805 1805
             onSelect: this.selectPlaceHandler
1806 1806
           });
1807 1807
         });
@@ -1836,7 +1836,7 @@ export default {
1836 1836
           console.log(that.faultLocationList);
1837 1837
 
1838 1838
           that.placePicker = that.$createCascadePicker({
1839
-            title: "区域地点选择",
1839
+            title: "校区区域地点选择",
1840 1840
             data: that.faultLocationList,
1841 1841
             // selectedIndex: localStorage.getItem("place")
1842 1842
             //   ? JSON.parse(localStorage.getItem("place")).index
@@ -1953,7 +1953,7 @@ export default {
1953 1953
   }
1954 1954
 };
1955 1955
 </script>
1956
-<style>
1956
+<style scoped>
1957 1957
 .newIncident .cube-form-group {
1958 1958
   border-bottom: 0.02rem solid rgb(245, 245, 245);
1959 1959
 }
@@ -1967,11 +1967,9 @@ export default {
1967 1967
   color: inherit;
1968 1968
   background: none;
1969 1969
   border: none;
1970
+  white-space: normal;
1970 1971
 }
1971 1972
 
1972
-.btn_local {
1973
-  /* z-index: 101; */
1974
-}
1975 1973
 .inp_local {
1976 1974
   outline: none;
1977 1975
   width: 100%;