瀏覽代碼

增加院区字段

seimin 2 年之前
父節點
當前提交
71eb571fdf
共有 4 個文件被更改,包括 153 次插入109 次删除
  1. 6 0
      src/components/EventInformation/index.vue
  2. 1 0
      src/components/form/form-item.vue
  3. 1 1
      src/views/incidentList.vue
  4. 145 108
      src/views/newIncident.vue

+ 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>

+ 145 - 108
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,11 +215,11 @@ 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: [], //原始区域列表
222
-      selectedIndex: [0, 0],
221
+      // initAreaList: [], //原始区域列表
222
+      selectedIndex: [0, 0, 0],
223 223
       selectedIndexCate: [0, 0, 0]
224 224
     };
225 225
   },
@@ -351,9 +351,9 @@ export default {
351 351
       incidentTitle: "", //事件主题
352 352
       referenceInfo: {}, //引用信息
353 353
       roomSelectData: [], //房间下拉框选项
354
-      placeSelectData: [], //区域地点下拉框选项
354
+      placeSelectData: [], //校区区域地点下拉框选项
355 355
       inpLocalVal: "", //故障地点输入框
356
-      faultLocationList: [], //区域地点拼接下拉框选项
356
+      faultLocationList: [], //校区区域地点拼接下拉框选项
357 357
       deptInpVal: "", //报修科室输入框
358 358
       deptList: [], //报修科室下拉选项
359 359
       deptRes: "", //下拉框科室信息
@@ -383,7 +383,7 @@ export default {
383 383
         room: "" //房间号
384 384
       },
385 385
       selectedCategoryTxt: "", //事件分类选中展示
386
-      selectedPlaceTxt: "", //区域地点选中展示
386
+      selectedPlaceTxt: "", //校区区域地点选中展示
387 387
       // showPrompting:false,
388 388
       promptingConent: "",
389 389
       promptingStatus: "",
@@ -434,12 +434,12 @@ export default {
434 434
         {
435 435
           component: "button",
436 436
           modelKey: "placeValue",
437
-          label: "区域地点:",
437
+          label: "校区区域地点:",
438 438
           rules: {
439 439
             required: false
440 440
           },
441 441
           messages: {
442
-            required: "请选择区域地点"
442
+            required: "请选择校区区域地点"
443 443
           }
444 444
         },
445 445
         {
@@ -1003,15 +1003,20 @@ export default {
1003 1003
         }
1004 1004
       });
1005 1005
       solutionType = a2;
1006
-      if (that.model.placeValue.length == 2) {
1007
-        that.model.areaId =
1008
-          that.model.placeValue[that.model.placeValue.length - 2];
1009
-        that.model.placeId =
1010
-          that.model.placeValue[that.model.placeValue.length - 1];
1011
-      } else if (that.model.placeValue.length == 1) {
1012
-        that.model.areaId =
1013
-          that.model.placeValue[that.model.placeValue.length - 1];
1014
-        that.model.placeId = "";
1006
+      // if (that.model.placeValue.length == 2) {
1007
+      //   that.model.areaId =
1008
+      //     that.model.placeValue[that.model.placeValue.length - 2];
1009
+      //   that.model.placeId =
1010
+      //     that.model.placeValue[that.model.placeValue.length - 1];
1011
+      // } else if (that.model.placeValue.length == 1) {
1012
+      //   that.model.areaId =
1013
+      //     that.model.placeValue[that.model.placeValue.length - 1];
1014
+      //   that.model.placeId = "";
1015
+      // }
1016
+      if (that.model.placeValue.length === 3){
1017
+          that.model.branchId = that.model.placeValue[0];
1018
+          that.model.areaId = that.model.placeValue[1];
1019
+          that.model.placeId = that.model.placeValue[2];
1015 1020
       }
1016 1021
 
1017 1022
       // that.modelData.incident.houseNumber = that.model.address[0];
@@ -1026,8 +1031,9 @@ export default {
1026 1031
       if (that.wxIncidentWithCmdb == 1) {
1027 1032
         that.modelData.incident.assetId = that.model.assetId;
1028 1033
       }
1029
-      that.modelData.incident.area = { id: that.model.areaId };
1030
-      that.modelData.incident.place = { id: that.model.placeId };
1034
+      that.modelData.incident.branch = that.model.branchId?{ id: that.model.branchId }:undefined;
1035
+      that.modelData.incident.area = that.model.areaId?{ id: that.model.areaId }:undefined;
1036
+      that.modelData.incident.place = that.model.placeId?{ id: that.model.placeId }:undefined;
1031 1037
       that.modelData.incident.category = {
1032 1038
         id: category[category.length - 1]
1033 1039
       };
@@ -1197,6 +1203,7 @@ export default {
1197 1203
         that.selectHouseNumber,
1198 1204
         "2020年4月25日14:09:29"
1199 1205
       );
1206
+      // debugger;//测试
1200 1207
       //服务台生成事件
1201 1208
       if (this.$route.params.data && this.$route.params.data.id) {
1202 1209
         that.modelData.flow = this.$route.params.data.id;
@@ -1467,36 +1474,25 @@ export default {
1467 1474
         }
1468 1475
       } else if (sj.branchType == 1) {
1469 1476
         // 分院区
1470
-        // liaomingming
1471
-        let areaId = this.model.placeValue[0]; //区域id
1472
-        console.log(this.initAreaList);
1473
-        if (areaId) {
1477
+        let branchId = this.model.placeValue[0]; //校区id
1478
+        if (branchId) {
1474 1479
           // 选择了区域
1475
-          let areaObj = this.initAreaList.find(v => v.id == areaId);
1476
-          if (areaObj) {
1477
-            let branchId = areaObj.branch;
1478
-            let branchUserGroup =
1479
-              sj.branchUserGroups.find(v => v.branchId == branchId) || {};
1480
-            if (branchUserGroup.branchUserOrGroupType == 1) {
1481
-              //派人
1482
-              this.order = 2;
1483
-              this.model.handleUserOrGroup = true;
1484
-              this.model.handlerUser = branchUserGroup.userId
1485
-                ? branchUserGroup.userId
1486
-                : undefined;
1487
-            } else if (branchUserGroup.branchUserOrGroupType === 2) {
1488
-              //派组
1489
-              this.order = 2;
1490
-              this.model.handleUserOrGroup = false;
1491
-              this.model.candidateGroups = branchUserGroup.groupId
1492
-                ? branchUserGroup.groupId
1493
-                : undefined;
1494
-            } else {
1495
-              this.order = 1;
1496
-              this.model.handleUserOrGroup = false;
1497
-              this.model.handlerUser = "";
1498
-              this.model.candidateGroups = "";
1499
-            }
1480
+          let branchUserGroup =
1481
+            sj.branchUserGroups.find(v => v.branchId == branchId) || {};
1482
+          if (branchUserGroup.branchUserOrGroupType == 1) {
1483
+            //派人
1484
+            this.order = 2;
1485
+            this.model.handleUserOrGroup = true;
1486
+            this.model.handlerUser = branchUserGroup.userId
1487
+              ? branchUserGroup.userId
1488
+              : undefined;
1489
+          } else if (branchUserGroup.branchUserOrGroupType === 2) {
1490
+            //派组
1491
+            this.order = 2;
1492
+            this.model.handleUserOrGroup = false;
1493
+            this.model.candidateGroups = branchUserGroup.groupId
1494
+              ? branchUserGroup.groupId
1495
+              : undefined;
1500 1496
           } else {
1501 1497
             this.order = 1;
1502 1498
             this.model.handleUserOrGroup = false;
@@ -1678,7 +1674,7 @@ export default {
1678 1674
           that.loadShow = false;
1679 1675
         });
1680 1676
     },
1681
-    // 区域地点
1677
+    // 校区区域地点
1682 1678
     showPlacePicker() {
1683 1679
       this.placePicker.show();
1684 1680
     },
@@ -1704,14 +1700,12 @@ export default {
1704 1700
       // --------------------start---------------------
1705 1701
       let categoryId = this.model.category.slice(-1)[0];
1706 1702
       if (categoryId) {
1707
-        // 选择了事件分类 liaomingming
1703
+        // 选择了事件分类
1708 1704
         let categoryObj = this.initSjList.find(v => v.id == categoryId);
1709 1705
         if (categoryObj) {
1710 1706
           if (categoryObj.branchType == 1) {
1711 1707
             // 分院区开关打开的情况下
1712
-            let areaId = this.model.placeValue[0]; //区域id
1713
-            let areaObj = this.initAreaList.find(v => v.id == areaId);
1714
-            let branchId = areaObj.branch;
1708
+            let branchId = this.model.placeValue[0]; //校区id
1715 1709
             let branchUserGroup =
1716 1710
               categoryObj.branchUserGroups.find(v => v.branchId == branchId) ||
1717 1711
               {};
@@ -1787,29 +1781,28 @@ export default {
1787 1781
         this.model.requester = "";
1788 1782
       }
1789 1783
     },
1790
-    getAreaData() {
1791
-      this.$http
1792
-        .post("/service/user/data/fetchDataList/area", {
1793
-          idx: 0,
1794
-          sum: 1000,
1795
-          area: {
1796
-            wechatArea: true
1797
-          }
1798
-        })
1799
-        .then(res => {
1800
-          this.initAreaList = JSON.parse(JSON.stringify(res.data.list));
1801
-          var data = res.data.list;
1802
-          for (var i = 0; i < data.length; i++) {
1803
-            this.placeSelectData.push({
1804
-              text: data[i].area,
1805
-              value: data[i].id,
1806
-              children: []
1807
-            });
1808
-          }
1809
-        });
1810
-    },
1784
+    // getAreaData() {
1785
+    //   this.$http
1786
+    //     .post("/service/user/data/fetchDataList/area", {
1787
+    //       idx: 0,
1788
+    //       sum: 1000,
1789
+    //       area: {
1790
+    //         wechatArea: true
1791
+    //       }
1792
+    //     })
1793
+    //     .then(res => {
1794
+    //       this.initAreaList = JSON.parse(JSON.stringify(res.data.list));
1795
+    //       var data = res.data.list;
1796
+    //       for (var i = 0; i < data.length; i++) {
1797
+    //         this.placeSelectData.push({
1798
+    //           text: data[i].area,
1799
+    //           value: data[i].id,
1800
+    //           children: []
1801
+    //         });
1802
+    //       }
1803
+    //     });
1804
+    // },
1811 1805
     getPlaceData() {
1812
-      var that = this;
1813 1806
       this.$http
1814 1807
         .post("/service/user/data/fetchDataList/place", {
1815 1808
           idx: 0,
@@ -1818,44 +1811,90 @@ export default {
1818 1811
             wechatAreaId: ""
1819 1812
           }
1820 1813
         })
1821
-        .then(function(res) {
1822
-          var data = res.data.list;
1823
-          for (var i = 0; i < data.length; i++) {
1824
-            for (var j = 0; j < that.placeSelectData.length; j++) {
1825
-              if (data[i].area.id == that.placeSelectData[j].value) {
1826
-                that.placeSelectData[j].children.push({
1827
-                  text: data[i].place,
1828
-                  value: data[i].id
1829
-                });
1830
-              }
1814
+        .then((res) => {
1815
+          let data = res.data.list;
1816
+          // for (var i = 0; i < data.length; i++) {
1817
+          //   for (var j = 0; j < that.placeSelectData.length; j++) {
1818
+          //     if (data[i].area.id == that.placeSelectData[j].value) {
1819
+          //       that.placeSelectData[j].children.push({
1820
+          //         text: data[i].place,
1821
+          //         value: data[i].id
1822
+          //       });
1823
+          //     }
1824
+          //   }
1825
+          // }
1826
+          // -------------------------start
1827
+          console.log(data, 'data');
1828
+          this.placeSelectData = [];
1829
+          const collectionBranch = {};
1830
+          data.forEach((v) => {
1831
+            if(collectionBranch[v.area.branch]){
1832
+              collectionBranch[v.area.branch].push(v);
1833
+            }else{
1834
+              this.placeSelectData.push({text:v.area.branchName, value: v.area.branch, children: []})
1835
+              collectionBranch[v.area.branch] = [v];
1831 1836
             }
1832
-          }
1837
+          })
1838
+
1839
+          this.placeSelectData.forEach(v => {
1840
+            let areaByPlace = collectionBranch[v.value];
1841
+            let areaCollection = {};
1842
+            let areaArr = [];
1843
+            areaByPlace.forEach(vv => {
1844
+              if(areaCollection[vv.area.id]){
1845
+                areaCollection[vv.area.id].push({text:vv.place, value: vv.id});
1846
+              }else{
1847
+                areaArr.push({text:vv.area.area, value: vv.area.id, children: []})
1848
+                areaCollection[vv.area.id] = [{text:vv.place, value: vv.id}];
1849
+              }
1850
+            })
1851
+            areaArr.forEach(vv => {
1852
+              vv.children = areaCollection[vv.value];
1853
+            })
1854
+            v.children = areaArr;
1855
+          })
1856
+
1857
+          console.log(collectionBranch,'collectionBranch集合');
1858
+          console.log(this.placeSelectData,'地点');
1859
+          // this.placePicker = this.$createCascadePicker({
1860
+          //   title: "校区区域地点选择",
1861
+          //   data: this.placeSelectData,
1862
+          //   selectedIndex: [0, 0, 0],
1863
+          //   onSelect: this.selectPlaceHandler
1864
+          // });
1865
+          // -------------------------end
1866
+          var branchIndex = 0;
1833 1867
           var areaIndex = 0;
1834 1868
           var placeIndex = 0;
1835
-          that.placeSelectData.forEach(function(v, i) {
1836
-            if (that.model.placeValue[0] == v.value) {
1869
+          this.placeSelectData.forEach((v, i) => {
1870
+            if (this.model.placeValue[0] == v.value) {
1871
+              branchIndex = i;
1872
+            }
1873
+          });
1874
+          this.placeSelectData[branchIndex].children.forEach((v, i) => {
1875
+            if (this.model.placeValue[1] == v.value) {
1837 1876
               areaIndex = i;
1838 1877
             }
1839 1878
           });
1840
-          that.placeSelectData[areaIndex].children.forEach(function(v, i) {
1841
-            if (that.model.placeValue[1] == v.value) {
1879
+          this.placeSelectData[branchIndex].children[areaIndex].children.forEach((v, i) => {
1880
+            if (this.model.placeValue[2] == v.value) {
1842 1881
               placeIndex = i;
1843 1882
             }
1844 1883
           });
1845
-          that.selectedIndex = [areaIndex, placeIndex];
1846
-          that.placePicker = that.$createCascadePicker({
1847
-            title: "区域地点选择",
1848
-            data: that.placeSelectData,
1849
-            selectedIndex: that.selectedIndex,
1850
-            onSelect: that.selectPlaceHandler
1884
+          this.selectedIndex = [branchIndex, areaIndex, placeIndex];
1885
+          this.placePicker = this.$createCascadePicker({
1886
+            title: "校区区域地点选择",
1887
+            data: this.placeSelectData,
1888
+            selectedIndex: this.selectedIndex,
1889
+            onSelect: this.selectPlaceHandler
1851 1890
           });
1852 1891
           if (
1853
-            that.ifRoom == 1 &&
1854
-            that.$route.params.data &&
1855
-            that.$route.params.data.room
1892
+            this.ifRoom == 1 &&
1893
+            this.$route.params.data &&
1894
+            this.$route.params.data.room
1856 1895
           ) {
1857 1896
             // 初始化房间号
1858
-            that.getRoomData(that.$route.params.data.place.id);
1897
+            this.getRoomData(this.$route.params.data.place.id);
1859 1898
           }
1860 1899
         });
1861 1900
     },
@@ -1890,7 +1929,7 @@ export default {
1890 1929
           console.log(that.faultLocationList);
1891 1930
 
1892 1931
           that.placePicker = that.$createCascadePicker({
1893
-            title: "区域地点选择",
1932
+            title: "校区区域地点选择",
1894 1933
             data: that.faultLocationList,
1895 1934
             onSelect: that.selectPlaceHandler
1896 1935
           });
@@ -1971,7 +2010,7 @@ export default {
1971 2010
     this.getsjnum();
1972 2011
     // 事件分类
1973 2012
     this.getIncidentcategory();
1974
-    this.getAreaData();
2013
+    // this.getAreaData();
1975 2014
     this.getPlaceData();
1976 2015
     // 获取故障地点
1977 2016
     // this.getFaultLocation();
@@ -2005,7 +2044,7 @@ export default {
2005 2044
   }
2006 2045
 };
2007 2046
 </script>
2008
-<style>
2047
+<style scoped>
2009 2048
 .newIncident .cube-form-group {
2010 2049
   border-bottom: 0.02rem solid rgb(245, 245, 245);
2011 2050
 }
@@ -2019,11 +2058,9 @@ export default {
2019 2058
   color: inherit;
2020 2059
   background: none;
2021 2060
   border: none;
2061
+  white-space: normal;
2022 2062
 }
2023 2063
 
2024
-.btn_local {
2025
-  /* z-index: 101; */
2026
-}
2027 2064
 .inp_local {
2028 2065
   outline: none;
2029 2066
   width: 100%;