miaofuhao 3 週間 前
コミット
0bf63fd97a

+ 11 - 4
apps/web-ele/src/store/auth.ts

@@ -41,10 +41,13 @@ export const useAuthStore = defineStore('auth', () => {
41 41
         // 获取用户信息并存储到 accessStore 中
42 42
         userInfo = await fetchUserInfo();
43 43
         userStore.setUserInfo(userInfo);
44
+        console.log(userInfo);
45
+        
44 46
         /**
45 47
          * 在这里设置权限
46 48
          */
47
-        accessStore.setAccessCodes(userInfo.permissions);
49
+        console.log(userInfo.buttons);
50
+        accessStore.setAccessCodes(userInfo.buttons);
48 51
         if (accessStore.loginExpired) {
49 52
           accessStore.setLoginExpired(false);
50 53
         } else {
@@ -91,10 +94,12 @@ export const useAuthStore = defineStore('auth', () => {
91 94
         // 获取用户信息并存储到 accessStore 中
92 95
         userInfo = await fetchUserInfo();
93 96
         userStore.setUserInfo(userInfo);
97
+        console.log(userInfo);
98
+        
94 99
         /**
95 100
          * 在这里设置权限
96 101
          */
97
-        accessStore.setAccessCodes(userInfo.permissions);
102
+        accessStore.setAccessCodes(userInfo.buttons);
98 103
         if (accessStore.loginExpired) {
99 104
           accessStore.setLoginExpired(false);
100 105
         } else {
@@ -147,13 +152,13 @@ export const useAuthStore = defineStore('auth', () => {
147 152
     if (!backUserInfo) {
148 153
       throw new Error('获取用户信息失败.');
149 154
     }
150
-    const { permissions = [], roles = [], user } = backUserInfo;
155
+    const { buttons = [], roles = [], user } = backUserInfo;
151 156
     /**
152 157
      * 从后台user -> vben user转换
153 158
      */
154 159
     const userInfo: UserInfo = {
155 160
       avatar: user.avatar ?? '',
156
-      permissions,
161
+      buttons,
157 162
       realName: user.nickName,
158 163
       roles,
159 164
       userId: user.userId.toString(),
@@ -162,6 +167,8 @@ export const useAuthStore = defineStore('auth', () => {
162 167
       // @ts-ignore
163 168
       stations: user.stations || [],
164 169
     };
170
+    console.log(userInfo);
171
+    
165 172
     userStore.setUserInfo(userInfo);
166 173
     return userInfo;
167 174
   }

+ 3 - 2
apps/web-ele/src/views/Archive/figuresManage/addInventory/index.vue

@@ -85,7 +85,7 @@ const workReportGridOptions: VxeGridProps = {
85 85
     },
86 86
   },
87 87
   rowConfig: { keyField: 'id' },
88
-  pagerConfig: { enabled: true, pageSize: 100, pageSizes: [10, 20, 50, 100] },
88
+  pagerConfig: { enabled: true, pageSize: 10, pageSizes: [10, 20, 50, 100] },
89 89
   toolbarConfig: {
90 90
     custom: true,
91 91
     refresh: true,
@@ -118,7 +118,8 @@ const handleView = (row: any) => {
118 118
     queryParams.append(key, route.query[key] as string);
119 119
   });
120 120
   // 跳转到任务详情页面
121
-  router.push(`/schedule/detail?${queryParams.toString()}`);
121
+
122
+  router.push(`/schedule/detail/${row.id}`);
122 123
 };
123 124
 </script>
124 125
 <template>

+ 1 - 1
apps/web-ele/src/views/Archive/operationsManagement/gasStationRegularMeeting/config-data.tsx

@@ -195,7 +195,7 @@ export const columns: VxeGridProps['columns'] = [
195 195
     minWidth: 100,
196 196
     align: 'center',
197 197
     formatter: (cellValue: number) => {
198
-      return cellValue === 0 ? '系统' : '新增';
198
+      return cellValue === 0 ? '新增' : '系统';
199 199
     },
200 200
   },
201 201
   {

+ 5 - 1
apps/web-ele/src/views/oilstation/idphoto/index.vue

@@ -8,6 +8,7 @@ import { onMounted, ref } from 'vue';
8 8
 import { Page, useVbenDrawer } from '@vben/common-ui';
9 9
 
10 10
 import { ElMessageBox } from 'element-plus';
11
+import { useAccess } from '@vben/access';
11 12
 
12 13
 import { useVbenVxeGrid } from '#/adapter/vxe-table';
13 14
 // 将模拟API替换为实际API
@@ -98,6 +99,7 @@ const certificateTypes = ref<any[]>([]);
98 99
 const organizationTypes = ref<any[]>([]);
99 100
 const storageLocations = ref<any[]>([]);
100 101
 const statusOptions = ref<any[]>([]);
102
+const { hasAccessByCodes } = useAccess();
101 103
 
102 104
 // 加载字典数据
103 105
 onMounted(() => {
@@ -109,6 +111,7 @@ onMounted(() => {
109 111
     { label: '启用', value: 'enabled' },
110 112
     { label: '禁用', value: 'disabled' },
111 113
   ];
114
+
112 115
 });
113 116
 
114 117
 // 新增证照
@@ -177,7 +180,8 @@ async function exportHandle() {
177 180
           <ElButton
178 181
             type="primary"
179 182
             @click="openDrawer"
180
-            v-access:code="['oilstation:idphoto:add']"
183
+             v-access:code="['oilstation:idphoto:add']"
184
+            
181 185
           >
182 186
             新增证照
183 187
           </ElButton>

+ 16 - 0
apps/web-ele/src/views/system/infoEntry/certificateSetting/certificateSetting-data.tsx

@@ -134,6 +134,10 @@ export const drawerFormSchema: FormSchemaGetter = () => [
134 134
     fieldName: 'taskStartMonth',
135 135
     label: '任务开始时间',
136 136
     labelWidth: 120,
137
+    dependencies: {
138
+      show: (values) => values.annualReviewToTask === 1,
139
+      triggerFields: ['annualReviewToTask'],
140
+    },
137 141
     componentProps: {
138 142
       placeholder: '请选择任务开始时间',
139 143
       options: Array.from({ length: 12 }, (_, i) => ({
@@ -147,6 +151,10 @@ export const drawerFormSchema: FormSchemaGetter = () => [
147 151
     fieldName: 'taskEndMonth',
148 152
     label: '任务截止时间',
149 153
     labelWidth: 120,
154
+    dependencies: {
155
+      show: (values) => values.annualReviewToTask === 1,
156
+      triggerFields: ['annualReviewToTask'],
157
+    },
150 158
     componentProps: {
151 159
       placeholder: '请选择任务截止时间',
152 160
       options: Array.from({ length: 12 }, (_, i) => ({
@@ -174,12 +182,20 @@ export const drawerFormSchema: FormSchemaGetter = () => [
174 182
       placeholder: '请选择换证频率',
175 183
       options: getDictOptions('renew_frequency'),
176 184
     },
185
+    dependencies: {
186
+      show: (values) => values.renewToTask === 1,
187
+      triggerFields: ['renewToTask'],
188
+    },
177 189
     fieldName: 'renewFrequency',
178 190
     label: '换证频率',
179 191
     labelWidth: 120,
180 192
   },
181 193
   {
182 194
     component: 'InputNumber',
195
+    dependencies: {
196
+      show: (values) => values.renewToTask === 1,
197
+      triggerFields: ['renewToTask'],
198
+    },
183 199
     fieldName: 'renewAdvanceMonths',
184 200
     label: '换证提前时间/月',
185 201
     labelWidth: 120,

+ 11 - 1
apps/web-ele/src/views/system/infoEntry/certificateSetting/certificateSetting-drawer.vue

@@ -47,7 +47,17 @@ const [Drawer, drawerApi] = useVbenDrawer({
47 47
         return;
48 48
       }
49 49
       const data = await formApi.getValues();
50
-      
50
+
51
+      if (data.annualReviewToTask === 0) {
52
+        data.taskStartMonth = '';
53
+        data.taskEndMonth = '';
54
+      }
55
+
56
+      if (data.renewToTask === 0) {
57
+        data.renewFrequency = '';
58
+        data.renewAdvanceMonths = '';
59
+      }
60
+
51 61
       await (isUpdateRef.value
52 62
         ? updateCertificateSetting(data)
53 63
         : addCertificateSetting(data));

+ 2 - 0
apps/web-ele/src/views/system/user/index.vue

@@ -417,3 +417,5 @@ onMounted(async () => {
417 417
   outline: none;
418 418
 }
419 419
 </style>
420
+
421
+</style>

+ 3 - 0
packages/effects/access/src/use-access.ts

@@ -27,6 +27,7 @@ function useAccess() {
27 27
    * @param codes
28 28
    */
29 29
   function hasAccessByCodes(codes: string[]) {
30
+    
30 31
     const userCodesSet = new Set(accessStore.accessCodes);
31 32
     /**
32 33
      * 管理员权限
@@ -34,7 +35,9 @@ function useAccess() {
34 35
     if (userCodesSet.has('*:*:*')) {
35 36
       return true;
36 37
     }
38
+     
37 39
     const intersection = codes.filter((item) => userCodesSet.has(item));
40
+    console.log('codes', codes, intersection);
38 41
     return intersection.length > 0;
39 42
   }
40 43
 

+ 3 - 1
packages/stores/src/modules/access.ts

@@ -62,7 +62,9 @@ export const useAccessStore = defineStore('core-access', {
62 62
       return findMenu(this.accessMenus, path);
63 63
     },
64 64
     setAccessCodes(codes: string[]) {
65
-      this.accessCodes = codes;
65
+      // 去重
66
+      const uniqueCodes = [...new Set(codes)];
67
+      this.accessCodes = uniqueCodes;
66 68
     },
67 69
     setAccessMenus(menus: MenuRecordRaw[]) {
68 70
       this.accessMenus = menus;