diff --git a/inventory-web/src/views/material/list.vue b/inventory-web/src/views/material/list.vue
index 1476c3c..09faa09 100644
--- a/inventory-web/src/views/material/list.vue
+++ b/inventory-web/src/views/material/list.vue
@@ -98,18 +98,18 @@
列展示设置
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
@@ -504,6 +504,33 @@ const columns = reactive({
isEnabled: { visible: true }
});
+// 列与权限Code的映射关系(数据库中的code)
+const permissionMap: Record = {
+ id: 'id',
+ companyName: 'companyName',
+ name: 'name',
+ commonName: 'commonName',
+ category: 'category',
+ type: 'type',
+ spec: 'spec',
+ unit: 'unit',
+ inventory: 'inventoryCount', // 前端变量是 inventory,数据库Code是 inventoryCount
+ available: 'availableCount', // 前端变量是 available,数据库Code是 availableCount
+ files: 'files',
+ isEnabled: 'isEnabled'
+};
+
+// 根据用户权限初始化列显示状态
+const initColumnPermissions = () => {
+ Object.keys(columns).forEach(key => {
+ const code = permissionMap[key];
+ if (code) {
+ // 如果用户有该权限,则显示列(默认true);否则隐藏
+ columns[key].visible = userStore.hasPermission(code);
+ }
+ });
+};
+
const companyOptions = ref([]);
const categoryOptions = ref([]);
const typeOptions = ref([]);
@@ -991,6 +1018,8 @@ const handleCameraConfirm = async (file: File) => {
};
onMounted(() => {
+ // 先根据权限初始化列显示状态
+ initColumnPermissions();
getList();
getOptionsList();
});