Browse Source

Merge branch '财务角色限制显示库存仓库数据'

lxf 1 year ago
parent
commit
895f5f677b
1 changed files with 18 additions and 1 deletions
  1. 18 1
      src/views/production/warehouse/inventory/index.vue

+ 18 - 1
src/views/production/warehouse/inventory/index.vue

@@ -92,6 +92,7 @@ const sourceList = ref({
     bomSpecWidth: "",
     departmentId: "",
     warehouseId: "",
+    warehouseIdList: [],
   },
 });
 const loading = ref(false);
@@ -265,7 +266,18 @@ const getDemandData = () => {
       }
     });
     proxy.post("/warehouse/page", { pageNum: 1, pageSize: 999 }).then((res) => {
-      warehouseList.value[0].children = res.rows.filter((item) => item.type !== "1");
+      let rolesStatus = false;
+      if (proxy.useUserStore().roles && proxy.useUserStore().roles.length > 0) {
+        let roles = proxy.useUserStore().roles.filter((item) => item === "financeOfficer");
+        if (roles && roles.length > 0) {
+          rolesStatus = true;
+        }
+      }
+      if (rolesStatus) {
+        warehouseList.value[0].children = res.rows.filter((item) => ["2", "3", "5"].includes(item.type));
+      } else {
+        warehouseList.value[0].children = res.rows.filter((item) => item.type !== "1");
+      }
       if (!(route.query && route.query.backupDate)) {
         proxy.post("/inventory/getQuantityByWarehouse", { departmentId: sourceList.value.pagination.departmentId }).then((res) => {
           if (warehouseList.value[0].children && warehouseList.value[0].children.length > 0) {
@@ -302,6 +314,11 @@ const getList = async (req, status) => {
     sourceList.value.pagination.departmentId = props.departmentId;
   }
   loading.value = true;
+  if (sourceList.value.pagination.warehouseId) {
+    sourceList.value.pagination.warehouseIdList = [sourceList.value.pagination.warehouseId];
+  } else {
+    sourceList.value.pagination.warehouseIdList = warehouseList.value[0].children.map((item) => item.id);
+  }
   proxy.post(path, sourceList.value.pagination).then((res) => {
     sourceList.value.data = res.rows;
     sourceList.value.pagination.total = res.total;