seimin 2 vuotta sitten
vanhempi
commit
364e0be016
3 muutettua tiedostoa jossa 168 lisäystä ja 36 poistoa
  1. 19 0
      src/router/index.js
  2. 56 27
      src/views/grabSheet.vue
  3. 93 9
      src/views/incidentList.vue

+ 19 - 0
src/router/index.js

@@ -46,8 +46,27 @@ export default new Router({
46 46
     component: Main,
47 47
     name: '',
48 48
     hidden: true,
49
+    beforeEnter:(to, from, next)=>{
50
+      console.log(from.fullPath);
51
+      console.log(to.fullPath);
52
+      if(to.fullPath == '/main'){
53
+        let loginUser = JSON.parse(localStorage.getItem('loginUser'));
54
+        if(loginUser){
55
+          if(loginUser.role.some(v => v.rolecode == 'first-line support' || v.rolecode == 'second-line support')){
56
+            next('/main/incidentList/todo/0');
57
+          }else{
58
+            next('/main/indes');
59
+          }
60
+        }else{
61
+          next();
62
+        }
63
+      }else{
64
+        next();
65
+      }
66
+    },
49 67
     children: [{
50 68
       path: '/',
69
+      // redirect: '/main/incidentList/todo/0'
51 70
       redirect: '/main/indes'
52 71
     },
53 72
     {

+ 56 - 27
src/views/grabSheet.vue

@@ -90,7 +90,7 @@
90 90
               }}</span>
91 91
             </p>
92 92
           </div>
93
-          <cube-form-group class="sub">
93
+          <cube-form-group class="sub" v-if="model.incident.state.value != 1546 && !model.incident.handlerUser && jurisdiction && qiangdan">
94 94
             <cube-button type="submit" @click="subVali()">抢单</cube-button>
95 95
           </cube-form-group>
96 96
         </div>
@@ -106,8 +106,10 @@ import EventInformation from './../components/EventInformation/index.vue'
106 106
 export default {
107 107
   data() {
108 108
     return {
109
+      qiangdan: false,
109 110
       id: "",
110 111
       loginUser: JSON.parse(localStorage.getItem("loginUser")),
112
+      menu: JSON.parse(localStorage.getItem("menu")),
111 113
       selected: 1,
112 114
       options: [
113 115
         {
@@ -245,33 +247,57 @@ export default {
245 247
     subVali() {
246 248
       //数据提交
247 249
       var that = this;
248
-      that.$http
249
-        .post(
250
-          "service/bpm/bpm/claimAndCompletedTask/" + that.model.incident.taskId,
251
-          { receive_code: "handler", userId: that.loginUser.id }
252
-        )
253
-        .then(function (res) {
254
-          console.log(res.data);
255
-          if (res.data.status == 200) {
256
-            $("#fade").fadeIn();
257
-            that.promptingConent = "恭喜您,抢单成功!";
258
-            that.promptingStatus = true;
259
-            that.dialog = that
260
-              .$createDialog({
250
+      this.$createDialog({
251
+        type: 'confirm',
252
+        icon: 'cubeic-alert',
253
+        title: '提示',
254
+        content: '是否抢单?',
255
+        confirmBtn: {
256
+          text: '确定',
257
+          active: true,
258
+          disabled: false,
259
+          href: 'javascript:;'
260
+        },
261
+        cancelBtn: {
262
+          text: '取消',
263
+          active: false,
264
+          disabled: false,
265
+          href: 'javascript:;'
266
+        },
267
+        onConfirm: () => {
268
+          that.$http
269
+          .post(
270
+            "service/bpm/bpm/claimAndCompletedTask/" + that.model.incident.taskId,
271
+            { receive_code: "handler", userId: that.loginUser.id }
272
+          )
273
+          .then(function (res) {
274
+            console.log(res.data);
275
+            if (res.data.status == 200) {
276
+              that
277
+                .$createDialog({
278
+                  type: "alert",
279
+                  title: "抢单成功",
280
+                  content: "点击返回首页",
281
+                  icon: "cubeic-right",
282
+                  onConfirm: (e, promptValue) => {
283
+                    that.$router.push({ path: "/main" });
284
+                  },
285
+                })
286
+                .show();
287
+            }else{
288
+              this.$createDialog({
261 289
                 type: "alert",
262
-                title: "抢单成功",
263
-                content: "点击返回首页",
264
-                icon: "cubeic-right",
265
-                onConfirm: (e, promptValue) => {
266
-                  that.$router.push({ path: "/main" });
267
-                },
268
-              })
269
-              .show();
270
-            setTimeout(function () {
271
-              $("#fade").fadeOut();
272
-            }, 2000);
273
-          }
274
-        });
290
+                title: "系统错误,请稍后再试!",
291
+                icon: "cubeic-wrong",
292
+              }).show();
293
+            }
294
+          });
295
+        },
296
+        onCancel: () => {
297
+
298
+        }
299
+      }).show()
300
+
275 301
     },
276 302
     // 快速定位
277 303
     toInfo(id) {
@@ -292,6 +318,9 @@ export default {
292 318
     EventInformation,
293 319
   },
294 320
   created() {
321
+    if(this.menu){
322
+      this.qiangdan = this.menu.some(v => v.link == 'shijianliebiao_qiangdan');
323
+    }
295 324
     // seimin
296 325
     this.processInstanceId = this.$route.params.data
297 326
       ? this.$route.params.data.processInstanceId

+ 93 - 9
src/views/incidentList.vue

@@ -117,7 +117,15 @@
117 117
                     v-show="item.state.id === 1544"
118 118
                   >
119 119
                     <cube-button @click.stop="addHandlerLog(item)"
120
-                      >新增维修记录</cube-button
120
+                      >维修进度</cube-button
121
+                    >
122
+                  </cube-form-group>
123
+                  <cube-form-group
124
+                    class="sub-btn"
125
+                     v-if="item.state.value != 1546 && !item.handlerUser && jurisdiction(item) && qiangdan(item)"
126
+                  >
127
+                    <cube-button @click.stop="subVali(item)"
128
+                      >抢单</cube-button
121 129
                     >
122 130
                   </cube-form-group>
123 131
                 </div>
@@ -189,7 +197,6 @@
189 197
   </div>
190 198
 </template>
191 199
 <script>
192
-import Vue from "vue";
193 200
 import showModel from "../components/showModel/showModel.vue";
194 201
 import CubePage from "../components/cube-page.vue";
195 202
 import SwitchOption from "../components/switch-option";
@@ -214,6 +221,7 @@ export default {
214 221
       isAssign: false, //是否有权限指派
215 222
       isAll: false, //是否显示全部事件
216 223
       loginUser: JSON.parse(localStorage.getItem("loginUser")),
224
+      menu: JSON.parse(localStorage.getItem("menu")),
217 225
       valConfig: JSON.parse(localStorage.getItem("valConfig")) - 0, //报修主体
218 226
       items: [],
219 227
       pullDownRefresh: true,
@@ -235,17 +243,13 @@ export default {
235 243
           text: "与我关联",
236 244
           value: "done"
237 245
         }
238
-        // {
239
-        //   text: "我创建",
240
-        //   value: "create"
241
-        // }
242 246
       ],
243 247
       searchsState:[],//状态列表
244 248
       searchType: "all",
245 249
       searchState: 0,
246 250
       type: "all",
247 251
       isToday: "",
248
-      sum: 20,
252
+      sum: 10,
249 253
       idx: 0,
250 254
       stateClass: "",
251 255
       loadShow: true
@@ -288,6 +292,68 @@ export default {
288 292
     }
289 293
   },
290 294
   methods: {
295
+    qiangdan(incident){
296
+      return this.menu.some(v => v.link == 'shijianliebiao_qiangdan');
297
+    },
298
+    jurisdiction(incident){
299
+      return this.loginUser.group.some(v => v.id == incident.candidateGroups);
300
+    },
301
+    // 抢单
302
+    subVali(incident) {
303
+      //数据提交
304
+      var that = this;
305
+      this.$createDialog({
306
+        type: 'confirm',
307
+        icon: 'cubeic-alert',
308
+        title: '提示',
309
+        content: '是否抢单?',
310
+        confirmBtn: {
311
+          text: '确定',
312
+          active: true,
313
+          disabled: false,
314
+          href: 'javascript:;'
315
+        },
316
+        cancelBtn: {
317
+          text: '取消',
318
+          active: false,
319
+          disabled: false,
320
+          href: 'javascript:;'
321
+        },
322
+        onConfirm: () => {
323
+          that.$http
324
+          .post(
325
+            "service/bpm/bpm/claimAndCompletedTask/" + incident.taskId,
326
+            { receive_code: "handler", userId: that.loginUser.id }
327
+          )
328
+          .then(function (res) {
329
+            console.log(res.data);
330
+            if (res.data.status == 200) {
331
+              that
332
+                .$createDialog({
333
+                  type: "alert",
334
+                  title: "抢单成功",
335
+                  content: "点击返回首页",
336
+                  icon: "cubeic-right",
337
+                  onConfirm: (e, promptValue) => {
338
+                    that.$router.push({ path: "/main" });
339
+                  },
340
+                })
341
+                .show();
342
+            }else{
343
+              this.$createDialog({
344
+                type: "alert",
345
+                title: "系统错误,请稍后再试!",
346
+                icon: "cubeic-wrong",
347
+              }).show();
348
+            }
349
+          });
350
+        },
351
+        onCancel: () => {
352
+
353
+        }
354
+      }).show()
355
+
356
+    },
291 357
     // 播放音频
292 358
     showAudio(callID){
293 359
       const toast = this.$createToast({
@@ -488,7 +554,7 @@ export default {
488 554
       this.loadShow = true;
489 555
       this.items = [];
490 556
       this.idx = 0;
491
-      this.sum = 20;
557
+      this.sum = 10;
492 558
       this.getData();
493 559
     },
494 560
     toIncidentDetails(data) {
@@ -556,6 +622,15 @@ export default {
556 622
         .then((res) => {
557 623
           if (res.data.list.length > 0) {
558 624
             for (var i = 0; i < res.data.list.length; i++) {
625
+              delete res.data.list[i].handlingPersonnelUser;
626
+              delete res.data.list[i].sendBackUser;
627
+              delete res.data.list[i].colourInfo;
628
+              if(res.data.list[i].acceptUser){
629
+                res.data.list[i].acceptUser = {
630
+                  id: res.data.list[i].acceptUser.id,
631
+                  name: res.data.list[i].acceptUser.name,
632
+                };
633
+              }
559 634
               res.data.list[i].createTime = formatDate(
560 635
                 new Date(res.data.list[i].createTime),
561 636
                 "yyyy-MM-dd hh:mm"
@@ -578,6 +653,15 @@ export default {
578 653
         .then((res) => {
579 654
           if (res.data.data.length > 0) {
580 655
             for (var i = 0; i < res.data.data.length; i++) {
656
+              delete res.data.data[i].handlingPersonnelUser;
657
+              delete res.data.data[i].sendBackUser;
658
+              delete res.data.data[i].colourInfo;
659
+              if(res.data.data[i].acceptUser){
660
+                res.data.data[i].acceptUser = {
661
+                  id: res.data.data[i].acceptUser.id,
662
+                  name: res.data.data[i].acceptUser.name,
663
+                };
664
+              }
581 665
               res.data.data[i].createTime = formatDate(
582 666
                 new Date(res.data.data[i].createTime),
583 667
                 "yyyy-MM-dd hh:mm"
@@ -598,7 +682,7 @@ export default {
598 682
     },
599 683
     onPullingDown() {
600 684
       this.idx = 0;
601
-      this.sum = 20;
685
+      this.sum = 10;
602 686
       this.getData();
603 687
     },
604 688
     onPullingUp() {