Răsfoiți Sursa

feat(bpm): 工单待办和已办增加权限

liujt 18 ore în urmă
părinte
comite
91d707019e
2 a modificat fișierele cu 62 adăugiri și 49 ștergeri
  1. 21 8
      src/views/bpm/doneTickets/index.vue
  2. 41 41
      src/views/bpm/tickets/index.vue

+ 21 - 8
src/views/bpm/doneTickets/index.vue

@@ -6,7 +6,7 @@
         <div class="switch_left">
           <ul>
             <li
-              v-for="item in tabOptions"
+              v-for="item in permittedTabs"
               :key="item.key"
               :class="{ active: activeComp == item.key }"
               @click="activeComp = item.key"
@@ -46,19 +46,32 @@
       return {
         activeComp: 'patrolInspection',
         tabOptions: [
-          { key: 'patrolInspection', name: '巡点检工单' },
-          { key: 'maintenance', name: '保养工单' },
-          { key: 'service', name: '检修工单' },
-          { key: 'repair', name: '维修工单' },
-          { key: 'productions', name: '生产工单' },
-          { key: 'inspectionWork', name: '质检工单' },
-          { key: 'work', name: '盘点工单' }
+          { key: 'patrolInspection', name: '巡点检工单', permission: 'wt:ticketstab:xdjgd' },
+          { key: 'maintenance', name: '保养工单', permission: 'wt:ticketstab:bygd' },
+          { key: 'service', name: '检修工单', permission: 'wt:ticketstab:jxgd' },
+          { key: 'repair', name: '维修工单', permission: 'wt:ticketstab:wxgd' },
+          { key: 'productions', name: '生产工单', permission: 'wt:ticketstab:scgd' },
+          { key: 'inspectionWork', name: '质检工单', permission: 'wt:ticketstab:zjgd' },
+          { key: 'work', name: '盘点工单', permission: 'wt:ticketstab:pdgd' }
           // { key: 'delivery', name: '量具送检工单' }
           // { key: 'repair', name: '计划性维修工单' },
           // { key: 'malfunction', name: '盘点工单' }
         ]
       };
     },
+    computed: {
+      permittedTabs() {
+        return this.tabOptions.filter(
+          (item) => this.$hasPermission(item.permission)
+        );
+      }
+    },
+    created() {
+      // 确保 activeComp 指向有权 Tab
+      if (this.permittedTabs.length > 0) {
+        this.activeComp = this.permittedTabs[0].key;
+      }
+    },
     mounted() {
       switch (this.$route.query.title) {
         case '巡点检工单':

+ 41 - 41
src/views/bpm/tickets/index.vue

@@ -6,15 +6,17 @@
         <div class="switch_left">
           <ul>
             <li
-              v-for="item in tabOptions"
+              v-for="item in permittedTabs"
               :key="item.key"
               :class="{ active: activeComp == item.key }"
               @click="activeComp = item.key"
             >
-              {{ item.name }}
-              <span v-if="item.count > 0">{{
-                item.count > 99 ? '99+' : item.count
-              }}</span>
+              <div>
+                {{ item.name }}
+                <span v-if="item.count > 0">{{
+                  item.count > 99 ? '99+' : item.count
+                }}</span>
+              </div>
             </li>
           </ul>
         </div>
@@ -52,49 +54,47 @@
     },
     data() {
       return {
-        activeComp: 'patrolInspection',
+        activeComp: '',
         tabOptions: [
-          { key: 'patrolInspection', name: '巡点检工单' },
-          { key: 'maintenance', name: '保养工单' },
-          { key: 'service', name: '检修工单' },
-          { key: 'repair', name: '维修工单' },
-          { key: 'productions', name: '生产工单' },
-          { key: 'inspectionWork', name: '质检工单' },
+          { key: 'patrolInspection', name: '巡点检工单', permission: 'wt:ticketstab:xdjgd' },
+          { key: 'maintenance', name: '保养工单', permission: 'wt:ticketstab:bygd' },
+          { key: 'service', name: '检修工单', permission: 'wt:ticketstab:jxgd' },
+          { key: 'repair', name: '维修工单', permission: 'wt:ticketstab:wxgd' },
+          { key: 'productions', name: '生产工单', permission: 'wt:ticketstab:scgd' },
+          { key: 'inspectionWork', name: '质检工单', permission: 'wt:ticketstab:zjgd' },
           // { key: 'repair', name: '计划性维修工单' },
-          { key: 'work', name: '盘点工单' }
+          { key: 'work', name: '盘点工单', permission: 'wt:ticketstab:pdgd' }
         ]
       };
     },
+    computed: {
+      permittedTabs() {
+        return this.tabOptions.filter(
+          (item) => this.$hasPermission(item.permission)
+        );
+      }
+    },
+    created() {
+      // 确保 activeComp 指向有权 Tab
+      if (this.permittedTabs.length > 0) {
+        this.activeComp = this.permittedTabs[0].key;
+      }
+    },
     mounted() {
-      // this.setCount();
       console.log(this.$route.query);
-      switch (this.$route.query.title) {
-        case '巡点检工单':
-          this.activeComp = 'patrolInspection';
-          break;
-        case '保养工单':
-          this.activeComp = 'maintenance';
-          break;
-        case '检修工单':
-          this.activeComp = 'service';
-          break;
-        case '量具送检工单':
-          this.activeComp = 'delivery';
-          break;
-        case '维修工单':
-          this.activeComp = 'repair';
-          break;
-        case '质检工单':
-          this.activeComp = 'inspectionWork';
-          break;
-        case '盘点工单':
-          this.activeComp = 'work';
-          break;
-        case '生产工单':
-          this.activeComp = 'productions';
-          break;
-        default:
-          break;
+      const titleMap = {
+        '巡点检工单': 'patrolInspection',
+        '保养工单': 'maintenance',
+        '检修工单': 'service',
+        '量具送检工单': 'delivery',
+        '维修工单': 'repair',
+        '质检工单': 'inspectionWork',
+        '盘点工单': 'work',
+        '生产工单': 'productions'
+      };
+      const targetKey = titleMap[this.$route.query.title];
+      if (targetKey && this.permittedTabs.some((t) => t.key === targetKey)) {
+        this.activeComp = targetKey;
       }
     },
     methods: {