浏览代码

指派根据权限

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

+ 33 - 32
src/views/incidentList.vue

@@ -86,21 +86,23 @@
86
                 </div>
86
                 </div>
87
                 <div class="btns">
87
                 <div class="btns">
88
                   <cube-form-group
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
                 </div>
106
                 </div>
105
               </div>
107
               </div>
106
             </div>
108
             </div>
@@ -184,7 +186,7 @@ export default {
184
       models1: {
186
       models1: {
185
         disjunctor: false
187
         disjunctor: false
186
       },
188
       },
187
-      isAssign: false, //是否是事件经理或事件分类管理员或服务台人员---暂时写死,登录未返回menu,后期需要修改,pc端已根据权限来
189
+      isAssign: false, //是否有权限指派
188
       loginUser: JSON.parse(localStorage.getItem("loginUser")),
190
       loginUser: JSON.parse(localStorage.getItem("loginUser")),
189
       valConfig: JSON.parse(localStorage.getItem("valConfig")) - 0, //报修主体
191
       valConfig: JSON.parse(localStorage.getItem("valConfig")) - 0, //报修主体
190
       items: [],
192
       items: [],
@@ -210,7 +212,7 @@ export default {
210
         {
212
         {
211
           text: "处理过",
213
           text: "处理过",
212
           value: "done"
214
           value: "done"
213
-        },
215
+        }
214
         // {
216
         // {
215
         //   text: "我创建",
217
         //   text: "我创建",
216
         //   value: "create"
218
         //   value: "create"
@@ -345,11 +347,14 @@ export default {
345
       });
347
       });
346
       toast.show();
348
       toast.show();
347
       this.$http
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
           toast.hide();
358
           toast.hide();
354
           this.models1.disjunctor = false;
359
           this.models1.disjunctor = false;
355
           if (res.status == 200) {
360
           if (res.status == 200) {
@@ -384,7 +389,7 @@ export default {
384
       this.models1.disjunctor = false;
389
       this.models1.disjunctor = false;
385
     },
390
     },
386
     // 新增处理日志
391
     // 新增处理日志
387
-    addHandlerLog(item){
392
+    addHandlerLog(item) {
388
       this.modelsData1 = item;
393
       this.modelsData1 = item;
389
       this.models1 = {
394
       this.models1 = {
390
         disjunctor: true,
395
         disjunctor: true,
@@ -401,9 +406,9 @@ export default {
401
         this.type = this.$route.params.type;
406
         this.type = this.$route.params.type;
402
         if (this.type === "todo") {
407
         if (this.type === "todo") {
403
           this.searchType = "todo";
408
           this.searchType = "todo";
404
-        }else if(this.type === "done"){
409
+        } else if (this.type === "done") {
405
           this.searchType = "done";
410
           this.searchType = "done";
406
-        }else {
411
+        } else {
407
           this.searchType = "userAll";
412
           this.searchType = "userAll";
408
         }
413
         }
409
       }
414
       }
@@ -529,13 +534,9 @@ export default {
529
   },
534
   },
530
   created() {
535
   created() {
531
     var that = this;
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
     that.loginUser.group.forEach(element => {
541
     that.loginUser.group.forEach(element => {
541
       that.candidateGroups += element.id + ",";
542
       that.candidateGroups += element.id + ",";