seimin 1 year ago
parent
commit
8a84afe45d
2 changed files with 46 additions and 86 deletions
  1. 31 84
      src/views/newIncident.vue
  2. 15 2
      src/views/searchDept.vue

+ 31 - 84
src/views/newIncident.vue

@@ -109,26 +109,12 @@
109 109
           :field="fields[13]"
110 110
           class="btn_plcaeholde"
111 111
         ></cube-form-item>
112
-        <div v-if="order == 1" class="label formLabel">
113
-          报修图片
114
-          <span>(最多可上传3张JPG或PNG,每张不能超过10M)</span>
115
-        </div>
116
-        <div class="uplod" v-if="order == 1">
117
-          <cube-upload
118
-            ref="upload1"
119
-            :max="3"
120
-            :action="action1"
121
-            :simultaneous-uploads="3"
122
-            @files-added="filesAdded1"
123
-            @file-submitted="fileSubmitted1"
124
-          />
125
-        </div>
126
-        <cube-form-item v-if="order == 1" :field="fields[14]"></cube-form-item>
112
+        <!-- <cube-form-item v-if="order == 1" :field="fields[14]"></cube-form-item>
127 113
         <cube-form-item
128 114
           v-if="order == 1 && model.knowledge == true"
129 115
           :field="fields[15]"
130 116
           class="btn_plcaeholde"
131
-        ></cube-form-item>
117
+        ></cube-form-item> -->
132 118
         <!-- 直接处理 end -->
133 119
 
134 120
         <!-- 派单 begin -->
@@ -292,11 +278,6 @@ export default {
292 278
           this.$host + "/service/common/common/uploadAttachment/incident/",
293 279
         data: {}
294 280
       },
295
-      action1: {
296
-        target:
297
-          this.$host + "/service/common/common/uploadAttachment/incident/",
298
-        data: {}
299
-      },
300 281
       isUploading: false,
301 282
       loadShow: false,
302 283
       incidentWithConsumable: localStorage.getItem("incidentWithConsumable"), //是否绑定耗材
@@ -971,8 +952,8 @@ export default {
971 952
         // that.modelData.requestershow = that.loginUser;
972 953
       } else if (that.valConfig == 2) {
973 954
         that.modelData.incident.branch = that.model.branch;
974
-        if(that.$route.query.id && that.model.requester){
975
-          that.modelData.incident.department = {id: +that.$route.query.id};
955
+        if(that.$route.params.dept && that.$route.params.dept.id && that.model.requester){
956
+          that.modelData.incident.department = {id: +that.$route.params.dept.id};
976 957
         }
977 958
       }
978 959
       if (that.wxIncidentWithCmdb == 1) {
@@ -1068,6 +1049,18 @@ export default {
1068 1049
     getMessage() {
1069 1050
       var that = this;
1070 1051
 
1052
+      if(that.$route.params.model){
1053
+        that.model = that.$route.params.model;
1054
+      }
1055
+
1056
+      if(that.$route.params.order){
1057
+        that.order = that.$route.params.order;
1058
+      }
1059
+
1060
+      if(that.$route.params.selectedCategoryTxt){
1061
+        that.selectedCategoryTxt = that.$route.params.selectedCategoryTxt;
1062
+      }
1063
+
1071 1064
       if (that.$route.params.data) {
1072 1065
         var inspecInfo = that.$route.params.data;
1073 1066
         // 巡检生成事件
@@ -1094,30 +1087,6 @@ export default {
1094 1087
           that.model.description = that.modelData.incident.description =
1095 1088
             that.$route.params.abnormal;
1096 1089
         }
1097
-      } else {
1098
-        // that.name = that.loginUser.name;
1099
-        // that.model.contactsInformation = that.loginUser.phone;
1100
-        // that.model.contacts = that.loginUser.name;
1101
-        // that.model.houseNumber = that.loginUser.houseNumber;
1102
-      }
1103
-      // if (that.loginUser.place && that.loginUser.place.length) {
1104
-      //   if (that.loginUser.place.id) {
1105
-      //     if (that.loginUser.place.area) {
1106
-      //       that.model.placeValue[0] = that.loginUser.place.area.id;
1107
-      //     }
1108
-      //     that.model.placeValue[1] = that.loginUser.place.id;
1109
-      //   }
1110
-      // }
1111
-
1112
-      if (localStorage.getItem("model")) {
1113
-        that.model = JSON.parse(localStorage.getItem("model"));
1114
-        that.incidentTitle = that.model.title;
1115
-      }
1116
-      if (localStorage.getItem("modelData")) {
1117
-        that.modelData = JSON.parse(localStorage.getItem("modelData"));
1118
-      }
1119
-      if (localStorage.getItem("order")) {
1120
-        that.order = localStorage.getItem("order") - 0;
1121 1090
       }
1122 1091
     },
1123 1092
     // 提交
@@ -1231,12 +1200,8 @@ export default {
1231 1200
         .then(res => {
1232 1201
           if (res.data) {
1233 1202
             that.action.target = that.action.target + res.data.id;
1234
-            that.action1.target = that.action1.target + res.data.id;
1235 1203
             setTimeout(function() {
1236 1204
               that.$refs.upload.start();
1237
-              if (that.order == 1) {
1238
-                that.$refs.upload1.start();
1239
-              }
1240 1205
             }, 100);
1241 1206
             if (
1242 1207
               this.order == 1 &&
@@ -1337,29 +1302,9 @@ export default {
1337 1302
           txt: "不能上传超过100M的文件"
1338 1303
         }).show();
1339 1304
     },
1340
-    filesAdded1(files) {
1341
-      let hasIgnore = false;
1342
-      const maxSize = 1000 * 1024 * 1024; // 1M
1343
-      for (let k in files) {
1344
-        const file = files[k];
1345
-        if (file.size > maxSize) {
1346
-          file.ignore = true;
1347
-          hasIgnore = true;
1348
-        }
1349
-      }
1350
-      hasIgnore &&
1351
-        this.$createToast({
1352
-          type: "warn",
1353
-          time: 1000,
1354
-          txt: "不能上传超过100M的文件"
1355
-        }).show();
1356
-    },
1357 1305
     fileSubmitted(files) {
1358 1306
       this.action.data = { fileName: files.name };
1359 1307
     },
1360
-    fileSubmitted1(files) {
1361
-      this.action1.data = { fileName: files.name };
1362
-    },
1363 1308
     // 展示故障现象选择器
1364 1309
     showCategoryPicker() {
1365 1310
       this.categoryPicker.show();
@@ -1622,7 +1567,7 @@ export default {
1622 1567
     },
1623 1568
     // 跳转到报修科室搜索页面
1624 1569
     toSearchDept() {
1625
-      this.$router.push(`/searchDept?type=searchDept&branch=${this.model.branch}`);
1570
+      this.$router.push({name: 'SearchDept', params: {model: this.model, branch: this.model.branch, order: this.order, selectedCategoryTxt: this.selectedCategoryTxt}});
1626 1571
     },
1627 1572
     getAreaData(branchId) {
1628 1573
       this.placeSelectData = [];
@@ -1714,9 +1659,14 @@ export default {
1714 1659
     },
1715 1660
     // 回显处理人或组
1716 1661
     showUserOrGroup(){
1717
-      this.order = 2;
1718
-      this.model.handleUserOrGroup = true;
1719
-      this.model.handlerUser = this.loginUser.id;
1662
+      if(!this.$route.params.model){
1663
+        this.model.handleUserOrGroup = true;
1664
+        this.model.handlerUser = this.loginUser.id;
1665
+      }
1666
+
1667
+      if(!this.$route.params.order){
1668
+        this.order = 2;
1669
+      }
1720 1670
     },
1721 1671
     // 处理顶部责任科室数据
1722 1672
     handlerDuty(){
@@ -1797,18 +1747,18 @@ export default {
1797 1747
       this.getBranchList();
1798 1748
 
1799 1749
       // 回显选择的报修科室
1800
-      if(this.$route.query.id && this.$route.query.dept){
1801
-        this.model.requester = this.$route.query.dept;
1750
+      if(this.$route.params.dept && this.$route.params.dept.id && this.$route.params.dept.dept){
1751
+        this.model.requester = this.$route.params.dept.dept;
1802 1752
         // 回显科室信息
1803 1753
         this.showUserOrGroup();
1804
-        if(this.$route.query.areaId && this.$route.query.placeId && this.$route.query.areaName && this.$route.query.placeName){
1805
-          this.model.placeValue = [+this.$route.query.areaId, +this.$route.query.placeId];
1806
-          this.selectedPlaceTxt = this.$route.query.areaName + ' ' + this.$route.query.placeName;
1754
+        if(this.$route.params.dept.areaId && this.$route.params.dept.placeId && this.$route.params.dept.areaName && this.$route.params.dept.placeName){
1755
+          this.model.placeValue = [+this.$route.params.dept.areaId, +this.$route.params.dept.placeId];
1756
+          this.selectedPlaceTxt = this.$route.params.dept.areaName + ' ' + this.$route.params.dept.placeName;
1807 1757
         }else{
1808 1758
           this.model.placeValue = [];
1809 1759
           this.selectedPlaceTxt = '';
1810 1760
         }
1811
-        this.model.contactsInformation = this.$route.query.phone;
1761
+        this.model.contactsInformation = this.$route.params.dept.phone;
1812 1762
       }
1813 1763
 
1814 1764
       // 回显院区
@@ -1825,9 +1775,6 @@ export default {
1825 1775
   },
1826 1776
   mounted() {
1827 1777
     this.$refs.upload.pause();
1828
-    if (this.$refs.upload1) {
1829
-      this.$refs.upload1.pause();
1830
-    }
1831 1778
   },
1832 1779
   components: {
1833 1780
     seiminModel,

+ 15 - 2
src/views/searchDept.vue

@@ -115,7 +115,7 @@ export default {
115 115
         department: {
116 116
           dept: keyword,
117 117
           selectType: "pinyin_qs",
118
-          branch: this.$route.query.branch ? +this.$route.query.branch : undefined,
118
+          branch: this.$route.params.branch ? +this.$route.params.branch : undefined,
119 119
         }
120 120
       };
121 121
       this.toast = this.$createToast({
@@ -211,7 +211,20 @@ export default {
211 211
         return item.dept === keyword;
212 212
       });
213 213
       if (arr.length) {
214
-        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 : ''}`);
214
+        this.$router.push({name: 'NewIncident', params: {
215
+            model: this.$route.params.model,
216
+            order: this.$route.params.order,
217
+            selectedCategoryTxt: this.$route.params.selectedCategoryTxt,
218
+            dept: {
219
+              id: arr[0].id,
220
+              dept: arr[0].dept,
221
+              phone: arr[0].phone || '',
222
+              areaId: arr[0].place ? arr[0].place.area.id : '',
223
+              areaName: arr[0].place ? arr[0].place.area.area : '',
224
+              placeId: arr[0].place ? arr[0].place.id : '',
225
+              placeName: arr[0].place ? arr[0].place.place : '',
226
+            }
227
+        }})
215 228
       }
216 229
     },
217 230
     //保存关键字到历史记录