Browse Source

新建事件BUG

seimin 1 year ago
parent
commit
d97924aedb

+ 9 - 13
pages/buildIncident/buildIncident.vue

@@ -86,11 +86,13 @@
86 86
   import { useGoBack } from '@/share/useGoBack.js'
87 87
   import { useLoginUserStore } from '@/stores/loginUser'
88 88
   import { useIncidentBuildStore } from '@/stores/incidentBuild'
89
+  import { useHandlerStore } from '@/stores/handler'
89 90
   import { useUploadFile } from '@/share/useUploadFile.js'
90 91
 
91 92
   useSetTitle();
92 93
   const loginUserStore = useLoginUserStore();
93 94
   const incidentBuildStore = useIncidentBuildStore();
95
+  const handlerStore = useHandlerStore();
94 96
   const { uploadFile }  = useUploadFile();
95 97
   const { goBack }  = useGoBack();
96 98
 
@@ -171,7 +173,7 @@
171 173
 
172 174
   // 选择楼栋楼层
173 175
   function selectAreaPlace(){
174
-    incidentBuildStore.setIncidentBuildData(incidentData, 'buildIncident');
176
+    incidentBuildStore.setIncidentBuildData(incidentData, 'buildIncident', 'area');
175 177
     uni.navigateTo({
176 178
       url: `/pages/searchArea/searchArea`
177 179
     })
@@ -179,7 +181,7 @@
179 181
 
180 182
   // 跳转到搜索报修科室
181 183
   function selectDepartment(){
182
-    incidentBuildStore.setIncidentBuildData(incidentData, 'buildIncident');
184
+    incidentBuildStore.setIncidentBuildData(incidentData, 'buildIncident', 'department');
183 185
     uni.navigateTo({
184 186
       url: `/pages/searchDept/searchDept`
185 187
     })
@@ -414,20 +416,14 @@
414 416
   }
415 417
 
416 418
   onLoad((option) => {
419
+    handlerStore.clearHandlerData();
417 420
     if(incidentBuildStore.incidentBuild.data){
418 421
       Object.assign(incidentData, incidentBuildStore.incidentBuild.data);
419
-
420 422
       // 修改报修科室,则回显楼栋,楼层,详细地址,联系电话
421
-      if(!incidentData.place){
422
-        incidentData.place = incidentData.department ? incidentData.department.place : undefined;
423
-      }
424
-
425
-      if(!incidentData.houseNumber){
426
-        incidentData.houseNumber = incidentData.department ? incidentData.department.address : '';
427
-      }
428
-
429
-      if(!incidentData.contactsInformation){
430
-        incidentData.contactsInformation = incidentData.department ? incidentData.department.phone : '';
423
+      if(incidentBuildStore.incidentBuild.sign === 'department'){
424
+        incidentData.place = incidentData.department.place || undefined;
425
+        incidentData.houseNumber = incidentData.department.address || '';
426
+        incidentData.contactsInformation = incidentData.department.phone || '';
431 427
       }
432 428
     }
433 429
     getBranchs();

+ 1 - 0
pages/handler/handler.vue

@@ -472,6 +472,7 @@
472 472
           console.log(dataInfo)
473 473
           handlerStore.clearHandlerData();
474 474
         }else{
475
+          handlerStore.clearHandlerData();
475 476
           // 初始化回显
476 477
           dataInfo.category = dataInfo.incidentData.category || {};
477 478
           dataInfo.synergetic = dataInfo.incidentData.synergetic || [];

+ 1 - 1
pages/searchDept/searchDept.vue

@@ -100,7 +100,7 @@
100 100
   // 点击
101 101
   function clickItem(data){
102 102
     dataInfo.incidentData.department = data;
103
-    incidentBuildStore.setIncidentBuildData(dataInfo.incidentData, incidentBuildStore.incidentBuild.type);
103
+    incidentBuildStore.setIncidentBuildData(dataInfo.incidentData, incidentBuildStore.incidentBuild.type, incidentBuildStore.incidentBuild.sign);
104 104
     uni.navigateTo({
105 105
       url: '/pages/buildIncident/buildIncident'
106 106
     })

+ 1 - 1
pages/searchPlace/searchPlace.vue

@@ -65,7 +65,7 @@
65 65
       return;
66 66
     }
67 67
     dataInfo.paramData.place = dataInfo.placeObj;
68
-    incidentBuildStore.setIncidentBuildData(dataInfo.paramData, incidentBuildStore.incidentBuild.type);
68
+    incidentBuildStore.setIncidentBuildData(dataInfo.paramData, incidentBuildStore.incidentBuild.type, incidentBuildStore.incidentBuild.sign);
69 69
     uni.navigateTo({
70 70
       url: `/pages/${incidentBuildStore.incidentBuild.type}/${incidentBuildStore.incidentBuild.type}?incidentId=${dataInfo.incidentId}`,
71 71
     })

+ 1 - 1
pages/synergeticAdd/synergeticAdd.vue

@@ -120,7 +120,7 @@
120 120
     if(dataInfo.incidentId !== 'undefined'){
121 121
       getIncidentDetail();
122 122
     }else{
123
-      dataInfo.incidentData = handlerStore.handler.data || {};
123
+      dataInfo.incidentData = handlerStore.handler.data.incidentData || {};
124 124
       getList(0);
125 125
     }
126 126
   }

+ 9 - 1
stores/incidentBuild.js

@@ -7,12 +7,19 @@ export const useIncidentBuildStore = defineStore(
7 7
     const incidentBuild = reactive({
8 8
       data: null,
9 9
       type: '',
10
+      sign: '',
10 11
     });
11 12
 
12 13
     // 保存
13
-    function setIncidentBuildData(data, type) {
14
+    /**
15
+     * @param {Object} data 数据
16
+     * @param {Object} type 路由
17
+     * @param {Object} sign 标识
18
+     */
19
+    function setIncidentBuildData(data, type, sign) {
14 20
       incidentBuild.data = data;
15 21
       incidentBuild.type = type;
22
+      incidentBuild.sign = sign;
16 23
     }
17 24
     
18 25
     // 清空
@@ -20,6 +27,7 @@ export const useIncidentBuildStore = defineStore(
20 27
       console.log(incidentBuild.data)
21 28
       incidentBuild.data = null;
22 29
       incidentBuild.type = '';
30
+      incidentBuild.sign = '';
23 31
     }
24 32
 
25 33
     return {