瀏覽代碼

指派根据权限

seimin 3 年之前
父節點
當前提交
e9619b68da
共有 2 個文件被更改,包括 43 次插入32 次删除
  1. 10 0
      src/views/Login.vue
  2. 33 32
      src/views/incidentList.vue

+ 10 - 0
src/views/Login.vue

@@ -50,12 +50,17 @@ export default {
50 50
         if (res.data.url) {
51 51
           window.location.href = res.data.url;
52 52
         } else {
53
+          console.log(res.data)
53 54
           if (res.data.user) {
54 55
             localStorage.setItem(
55 56
               "loginUser",
56 57
               JSON.stringify(res.data.user.user)
57 58
             );
58 59
             localStorage.setItem(
60
+              "menu",
61
+              JSON.stringify(res.data.user.menu)
62
+            );
63
+            localStorage.setItem(
59 64
               "login_requester",
60 65
               JSON.stringify(res.data.user.requester)
61 66
             );
@@ -79,6 +84,7 @@ export default {
79 84
         // alert(JSON.stringify(code));
80 85
         that.$http.post("service/auth/wechatLoginEncrypt", code).then((res) => {
81 86
           if (res.data.state == 200) {
87
+            console.log(res.data);
82 88
             // alert(3);
83 89
             // alert(JSON.stringify(res.data));
84 90
             if (res.data.user) {
@@ -87,6 +93,10 @@ export default {
87 93
                 JSON.stringify(res.data.user.user)
88 94
               );
89 95
               localStorage.setItem(
96
+                "menu",
97
+                JSON.stringify(res.data.user.menu)
98
+              );
99
+              localStorage.setItem(
90 100
                 "login_requester",
91 101
                 JSON.stringify(res.data.user.requester)
92 102
               );

+ 33 - 32
src/views/incidentList.vue

@@ -86,21 +86,23 @@
86 86
                 </div>
87 87
                 <div class="btns">
88 88
                   <cube-form-group
89
-                  class="sub-btn"
90
-                  v-show="
91
-                    (item.state.id === 1544 || item.state.id === 1543) &&
92
-                      isAssign &&
93
-                      item.assignee
94
-                  "
95
-                >
96
-                  <cube-button @click.stop="assign(item)">指派</cube-button>
97
-                </cube-form-group>
98
-                <cube-form-group
99
-                  class="sub-btn"
100
-                  v-show="item.state.id === 1544"
101
-                >
102
-                  <cube-button @click.stop="addHandlerLog(item)">新增处理日志</cube-button>
103
-                </cube-form-group>
89
+                    class="sub-btn"
90
+                    v-show="
91
+                      (item.state.id === 1544 || item.state.id === 1543) &&
92
+                        isAssign &&
93
+                        item.assignee
94
+                    "
95
+                  >
96
+                    <cube-button @click.stop="assign(item)">指派</cube-button>
97
+                  </cube-form-group>
98
+                  <cube-form-group
99
+                    class="sub-btn"
100
+                    v-show="item.state.id === 1544"
101
+                  >
102
+                    <cube-button @click.stop="addHandlerLog(item)"
103
+                      >新增处理日志</cube-button
104
+                    >
105
+                  </cube-form-group>
104 106
                 </div>
105 107
               </div>
106 108
             </div>
@@ -184,7 +186,7 @@ export default {
184 186
       models1: {
185 187
         disjunctor: false
186 188
       },
187
-      isAssign: false, //是否是事件经理或事件分类管理员或服务台人员---暂时写死,登录未返回menu,后期需要修改,pc端已根据权限来
189
+      isAssign: false, //是否有权限指派
188 190
       loginUser: JSON.parse(localStorage.getItem("loginUser")),
189 191
       valConfig: JSON.parse(localStorage.getItem("valConfig")) - 0, //报修主体
190 192
       items: [],
@@ -210,7 +212,7 @@ export default {
210 212
         {
211 213
           text: "处理过",
212 214
           value: "done"
213
-        },
215
+        }
214 216
         // {
215 217
         //   text: "我创建",
216 218
         //   value: "create"
@@ -345,11 +347,14 @@ export default {
345 347
       });
346 348
       toast.show();
347 349
       this.$http
348
-        .post(
349
-          "service/bpm/data/addData/operationLog",
350
-          {operationLog:{opType:'handlerLog',opValue:text,extra1:this.modelsData1.id}}
351
-        )
352
-        .then((res) => {
350
+        .post("service/bpm/data/addData/operationLog", {
351
+          operationLog: {
352
+            opType: "handlerLog",
353
+            opValue: text,
354
+            extra1: this.modelsData1.id
355
+          }
356
+        })
357
+        .then(res => {
353 358
           toast.hide();
354 359
           this.models1.disjunctor = false;
355 360
           if (res.status == 200) {
@@ -384,7 +389,7 @@ export default {
384 389
       this.models1.disjunctor = false;
385 390
     },
386 391
     // 新增处理日志
387
-    addHandlerLog(item){
392
+    addHandlerLog(item) {
388 393
       this.modelsData1 = item;
389 394
       this.models1 = {
390 395
         disjunctor: true,
@@ -401,9 +406,9 @@ export default {
401 406
         this.type = this.$route.params.type;
402 407
         if (this.type === "todo") {
403 408
           this.searchType = "todo";
404
-        }else if(this.type === "done"){
409
+        } else if (this.type === "done") {
405 410
           this.searchType = "done";
406
-        }else {
411
+        } else {
407 412
           this.searchType = "userAll";
408 413
         }
409 414
       }
@@ -529,13 +534,9 @@ export default {
529 534
   },
530 535
   created() {
531 536
     var that = this;
532
-    if (this.loginUser.role.length) {
533
-      this.isAssign = this.loginUser.role.some(
534
-        v =>
535
-          v.rolecode === "incident-category-manager" ||
536
-          v.rolecode === "incident manager" ||
537
-          v.rolecode === "call center"
538
-      );
537
+    let menu = JSON.parse(localStorage.getItem("menu"));
538
+    if (menu) {
539
+      this.isAssign = menu.some(v => v.link == "shijianliebiao_assign");
539 540
     }
540 541
     that.loginUser.group.forEach(element => {
541 542
       that.candidateGroups += element.id + ",";