seimin 1 år sedan
förälder
incheckning
1828c5cd9b
2 ändrade filer med 82 tillägg och 27 borttagningar
  1. 15 21
      pages/changeUser/changeUser.vue
  2. 67 6
      pages/incidentList/incidentList.vue

+ 15 - 21
pages/changeUser/changeUser.vue

@@ -447,14 +447,12 @@
447 447
         	icon: 'none',
448 448
           title: '转派成功',
449 449
           mask: true,
450
-          complete: () => {
451
-            setTimeout(() => {
452
-              uni.reLaunch({
453
-                url: '/pages/incidentList/incidentList',
454
-              })
455
-            }, 1500)
456
-          }
457 450
         });
451
+        setTimeout(() => {
452
+          uni.reLaunch({
453
+            url: '/pages/incidentList/incidentList',
454
+          })
455
+        }, 1500)
458 456
       }else{
459 457
         uni.showToast({
460 458
           icon: 'none',
@@ -522,14 +520,12 @@
522 520
         	icon: 'none',
523 521
           title: '指派成功',
524 522
           mask: true,
525
-          complete: () => {
526
-            setTimeout(() => {
527
-              uni.reLaunch({
528
-                url: '/pages/incidentList/incidentList',
529
-              })
530
-            }, 1500)
531
-          }
532 523
         });
524
+        setTimeout(() => {
525
+          uni.reLaunch({
526
+            url: '/pages/incidentList/incidentList',
527
+          })
528
+        }, 1500)
533 529
       }else{
534 530
         uni.showToast({
535 531
           icon: 'none',
@@ -567,14 +563,12 @@
567 563
         	icon: 'none',
568 564
           title: '退回成功',
569 565
           mask: true,
570
-          complete: () => {
571
-            setTimeout(() => {
572
-              uni.reLaunch({
573
-                url: '/pages/incidentList/incidentList',
574
-              })
575
-            }, 1500)
576
-          }
577 566
         });
567
+        setTimeout(() => {
568
+          uni.reLaunch({
569
+            url: '/pages/incidentList/incidentList',
570
+          })
571
+        }, 1500)
578 572
       }else{
579 573
         uni.showToast({
580 574
           icon: 'none',

+ 67 - 6
pages/incidentList/incidentList.vue

@@ -43,7 +43,7 @@
43 43
           <view class="btns">
44 44
             <button @click="handler('changeUser', data.id)" type="default" class="primaryButton btn" v-if="data.state.value === 'pending' || data.state.value === 'handler' || (data.state.value === 'reassign' && assignFlag)">换人处理</button>
45 45
             <button @click="handler('handler', data.id)" type="default" class="primaryButton btn" v-if="data.state.value === 'handler'">处理</button>
46
-            <button @click="handler('receive', data.id)" type="default" class="primaryButton btn" v-if="data.state.value === 'pending'">接单</button>
46
+            <button @click="receive(data)" type="default" class="primaryButton btn" v-if="computedReceive(data)">接单</button>
47 47
           </view>
48 48
         </view>
49 49
       </view>
@@ -59,9 +59,9 @@
59 59
 <script setup>
60 60
   import IncidentListFilter from '@/components/IncidentListFilter.vue';
61 61
   import IncidentAttachment from '@/components/IncidentAttachment.vue';
62
-  import { ref, reactive } from 'vue'
62
+  import { ref, reactive, computed } from 'vue'
63 63
   import { onLoad, onPullDownRefresh, onReachBottom } from '@dcloudio/uni-app'
64
-  import { api_getDictionary, api_incident, api_incident_count } from "@/http/api.js"
64
+  import { api_getDictionary, api_incident, api_incident_count, api_incidentTask } from "@/http/api.js"
65 65
   import { filterFormatDate } from '@/filters/filterFormatDate.js'
66 66
   import { computedPriorityStyle } from '@/filters/computedPriorityStyle.js'
67 67
   import { computedStateStyle } from '@/filters/computedStateStyle.js'
@@ -83,6 +83,21 @@
83 83
   const primaryColor = ref(defaultColor)
84 84
   
85 85
   const assignFlag = ref(false);//指派权限
86
+  const qiangdan = ref(false);//接单权限
87
+  
88
+  // 判断是否显示接单按钮
89
+  const computedReceive = computed(() => (data) => {
90
+    let inUser = data.currentLog && data.currentLog.workerId == loginUserStore.loginUser.user.id;
91
+    let inGroup = false;
92
+    loginUserStore.loginUser.user.group.forEach(item => {
93
+        if(data.currentLog){
94
+            if (item.id == data.currentLog.groupId) {
95
+                inGroup = true;
96
+            }
97
+        }
98
+    })
99
+    return data.state.value === 'pending' && (inUser || inGroup) && qiangdan.value;
100
+  })
86 101
   
87 102
   // 数据
88 103
   const dataInfo = reactive({
@@ -164,6 +179,49 @@
164 179
     })
165 180
   }
166 181
   
182
+  // 接单调用方案
183
+  function receiveFn(incidentData){
184
+    uni.showLoading({
185
+      title: "加载中",
186
+      mask: true,
187
+    });
188
+    
189
+    let postData = {
190
+      incident: incidentData,
191
+    }
192
+    
193
+    api_incidentTask('receive', postData).then(res => {
194
+      uni.hideLoading();
195
+      if(res.state == 200){
196
+        getList(0);
197
+        uni.showToast({
198
+        	icon: 'none',
199
+          title: '接单成功',
200
+          mask: true,
201
+        });
202
+      }else{
203
+        uni.showToast({
204
+          icon: 'none',
205
+          title: res.msg || '请求数据失败!'
206
+        });
207
+      }
208
+    })
209
+  }
210
+  // 接单按钮
211
+  function receive(incidentData){
212
+    uni.showModal({
213
+      title: '提示',
214
+      content: `您确认要接单吗?`,
215
+      confirmColor: defaultColor,
216
+      confirmText: '确认',
217
+      success: function(res) {
218
+        if (res.confirm) {
219
+          receiveFn(incidentData);
220
+        }
221
+      }
222
+    });
223
+  }
224
+  
167 225
   // 获取列表信息
168 226
   function getList(idx){
169 227
     uni.showLoading({
@@ -286,9 +344,12 @@
286 344
   
287 345
   onLoad((option) => {
288 346
     for (let i = 0; i < loginUserStore.loginUser.menu.length; i++) {
289
-        if (loginUserStore.loginUser.menu[i].link == "shijianliebiao_assign") {
290
-            assignFlag.value = true;
291
-        }
347
+      if (loginUserStore.loginUser.menu[i].link == "shijianliebiao_assign") {
348
+        assignFlag.value = true;
349
+      }
350
+      if (loginUserStore.loginUser.menu[i].link == "shijianliebiao_qiangdan") {
351
+        qiangdan.value = true
352
+      }
292 353
     }
293 354
     getTabs();
294 355
   })