lxf 1 năm trước cách đây
mục cha
commit
77298ea825

+ 14 - 0
src/router/index.js

@@ -146,6 +146,20 @@ export const constantRoutes = [
       },
     ],
   },
+  {
+    path: "/check/add",
+    component: Layout,
+    redirect: "/check/add",
+    children: [
+      {
+        path: "/check/add",
+        name: "盘点登记",
+        component: () => import(/* webpackChunkName: "page" */ "@/views/production/warehouse/check/add.vue"),
+        props: true,
+        meta: { title: "盘点登记" },
+      },
+    ],
+  },
 ];
 // 动态路由,基于用户权限动态去加载
 export const dynamicRoutes = [

+ 252 - 0
src/views/production/warehouse/check/add.vue

@@ -0,0 +1,252 @@
+<template>
+  <div>
+    <el-card class="box-card">
+      <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="submit">
+        <template #basicInformation>
+          <div style="width: 100%">
+            <el-row>
+              <el-col :span="12">
+                <el-form-item label="事业部" prop="departmentId" style="width: 100%; margin-bottom: 18px" @change="changeDepartment">
+                  <el-select v-model="formData.data.departmentId" placeholder="请选择事业部" clearable style="width: 100%">
+                    <el-option v-for="item in departmentList" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey" />
+                  </el-select>
+                </el-form-item>
+                <el-form-item label="仓库" prop="warehouseId" style="width: 100%; margin-bottom: 18px" @change="changeDepartment">
+                  <el-select v-model="formData.data.warehouseId" placeholder="请选择仓库" clearable style="width: 100%">
+                    <el-option v-for="item in warehouseList" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey" />
+                  </el-select>
+                </el-form-item>
+                <el-form-item label="盘点人" prop="checkTaker" style="width: 100%; margin-bottom: 18px">
+                  <el-input v-model="formData.data.checkTaker" placeholder="请输入盘点人" />
+                </el-form-item>
+              </el-col>
+              <el-col :span="12">
+                <el-form-item label="备注" prop="remark" style="width: 100%; margin-bottom: 18px">
+                  <el-input v-model="formData.data.remark" :rows="4" type="textarea" placeholder="请输入备注" />
+                </el-form-item>
+              </el-col>
+            </el-row>
+          </div>
+        </template>
+        <template #checkBomList>
+          <div style="width: 100%; padding: 0 20px">
+            <div style="margin-bottom: 10px">
+              <el-button type="primary" size="small" @click="clickAddBOM()">选择BOM</el-button>
+            </div>
+            <el-table :data="formData.data.checkBomList" :row-style="{ height: '35px' }" header-row-class-name="tableHeader">
+              <el-table-column label="品号" prop="code" width="180" />
+              <el-table-column label="品名" prop="name" min-width="220" />
+              <el-table-column label="单品尺寸(L*W*H)" align="center" width="300">
+                <template #default="{ row }">
+                  <span>{{ row.length }} * {{ row.width }} * {{ row.height }}</span>
+                </template>
+              </el-table-column>
+              <el-table-column label="剩余库存" prop="surplusStock" width="140" />
+              <el-table-column label="盘点数量" width="160">
+                <template #default="{ row, $index }">
+                  <el-form-item :prop="'checkBomList.' + $index + '.checkQuantity'" :rules="rules.checkQuantity" :inline-message="true" style="width: 100%">
+                    <el-input-number
+                      onmousewheel="return false;"
+                      v-model="row.checkQuantity"
+                      placeholder="盘点数量"
+                      style="width: 100%"
+                      :controls="false"
+                      :min="0"
+                      :precision="0" />
+                  </el-form-item>
+                </template>
+              </el-table-column>
+              <el-table-column label="状态" width="100">
+                <template #default="{ row }">
+                  <span v-if="row.checkQuantity && Number(row.checkQuantity) === Number(row.surplusStock)">正常</span>
+                  <span v-else-if="row.checkQuantity && Number(row.checkQuantity) < Number(row.surplusStock)" style="color: #d9001b">盘亏</span>
+                  <span v-else-if="row.checkQuantity && Number(row.checkQuantity) > Number(row.surplusStock)" style="color: #f59a23">盘盈</span>
+                </template>
+              </el-table-column>
+              <el-table-column label="操作" align="center" fixed="right" width="60">
+                <template #default="{ $index }">
+                  <el-button type="primary" @click="clickDelete($index)" text>删除</el-button>
+                </template>
+              </el-table-column>
+            </el-table>
+          </div>
+        </template>
+      </byForm>
+      <div style="width: 100%; text-align: center; margin: 10px">
+        <el-button @click="clickCancel()" size="large">取 消</el-button>
+        <el-button type="primary" @click="submitForm()" :disabled="btnDisabled" size="large">确 定</el-button>
+      </div>
+    </el-card>
+
+    <el-dialog title="选择BOM" v-if="openBOM" v-model="openBOM" width="90%">
+      <SelectInventory
+        :selectStatus="true"
+        :departmentId="formData.data.departmentId"
+        :warehouseId="formData.data.warehouseId"
+        @selectBOM="selectBOM"></SelectInventory>
+      <template #footer>
+        <el-button @click="openBOM = false" size="large">关 闭</el-button>
+      </template>
+    </el-dialog>
+  </div>
+</template>
+
+<script setup>
+import byForm from "@/components/byForm/index";
+import { ElMessage } from "element-plus";
+import { useRouter } from "vue-router";
+import useTagsViewStore from "@/store/modules/tagsView";
+import SelectInventory from "@/views/production/warehouse/inventory/index";
+
+const { proxy } = getCurrentInstance();
+const departmentList = ref([{ dictKey: "0", dictValue: "胜德体育" }]);
+const warehouseList = ref([]);
+const router = useRouter();
+const submit = ref(null);
+const formOption = reactive({
+  inline: true,
+  labelWidth: "100px",
+  itemWidth: 100,
+  rules: [],
+  labelPosition: "right",
+});
+const formData = reactive({
+  data: {
+    checkTaker: proxy.useUserStore().user.nickName,
+    checkBomList: [],
+  },
+});
+const formConfig = computed(() => {
+  return [
+    {
+      type: "title",
+      title: "盘点信息",
+      label: "",
+    },
+    {
+      type: "slot",
+      slotName: "basicInformation",
+      label: "",
+    },
+    {
+      type: "title",
+      title: "库存",
+      label: "",
+    },
+    {
+      type: "slot",
+      slotName: "checkBomList",
+      label: "",
+    },
+  ];
+});
+const rules = ref({
+  departmentId: [{ required: true, message: "请选择事业部", trigger: "change" }],
+  warehouseId: [{ required: true, message: "请选择仓库", trigger: "change" }],
+  checkTaker: [{ required: true, message: "请输入盘点人", trigger: "blur" }],
+  checkQuantity: [{ required: true, message: "请输入盘点数量", trigger: "blur" }],
+});
+const getDemandData = () => {
+  proxy.post("/department/page", { pageNum: 1, pageSize: 999 }).then((res) => {
+    if (res.rows && res.rows.length > 0) {
+      departmentList.value = departmentList.value.concat(
+        res.rows.map((item) => {
+          return {
+            dictKey: item.id,
+            dictValue: item.name,
+          };
+        })
+      );
+    }
+  });
+  proxy.post("/warehouse/page", { pageNum: 1, pageSize: 999 }).then((res) => {
+    if (res.rows && res.rows.length > 0) {
+      warehouseList.value = res.rows.map((item) => {
+        return {
+          dictKey: item.id,
+          dictValue: item.name,
+        };
+      });
+    }
+  });
+};
+getDemandData();
+const openBOM = ref(false);
+const clickAddBOM = () => {
+  if (!(formData.data.departmentId || formData.data.departmentId === "0")) {
+    return ElMessage("请先选择事业部");
+  }
+  if (!(formData.data.warehouseId || formData.data.warehouseId === "0")) {
+    return ElMessage("请先选择仓库");
+  }
+  openBOM.value = true;
+};
+const selectBOM = (item) => {
+  if (formData.data.checkBomList && formData.data.checkBomList.length > 0) {
+    let list = formData.data.checkBomList.filter((itemFilter) => itemFilter.bomSpecId === item.id);
+    if (list && list.length > 0) {
+      return ElMessage("该BOM已添加");
+    }
+  }
+  if (item.id) {
+    formData.data.checkBomList.push({
+      bomSpecId: item.bomSpecId,
+      code: item.bomSpecCode,
+      name: item.bomSpecName,
+      length: item.length,
+      width: item.width,
+      height: item.height,
+      surplusStock: item.quantity,
+      checkQuantity: undefined,
+    });
+    ElMessage({ message: "选择完成", type: "success" });
+    console.log(formData.data.checkBomList, item);
+  }
+};
+const changeDepartment = () => {
+  formData.data.checkBomList = [];
+};
+const clickDelete = (index) => {
+  formData.data.checkBomList.splice(index, 1);
+};
+const btnDisabled = ref(false);
+const submitForm = () => {
+  submit.value.handleSubmit(() => {
+    if (formData.data.checkBomList && formData.data.checkBomList.length > 0) {
+      btnDisabled.value = true;
+      proxy.post("/check/add", formData.data).then(
+        () => {
+          ElMessage({
+            message: "提交成功",
+            type: "success",
+          });
+          clickCancel();
+        },
+        (err) => {
+          console.log(err);
+          btnDisabled.value = false;
+        }
+      );
+    } else {
+      return ElMessage("请添加BOM");
+    }
+  });
+};
+const clickCancel = () => {
+  const useTagsStore = useTagsViewStore();
+  useTagsStore.delVisitedView(router.currentRoute.value);
+  router.replace({
+    path: "/production/warehouse/warehouse-check",
+  });
+};
+</script>
+
+<style lang="scss" scoped>
+::v-deep(.el-input-number .el-input__inner) {
+  text-align: left;
+}
+:deep(.el-dialog) {
+  margin-top: 10px !important;
+  margin-bottom: 10px !important;
+}
+</style>

+ 429 - 0
src/views/production/warehouse/check/index.vue

@@ -0,0 +1,429 @@
+<template>
+  <div>
+    <el-card class="box-card">
+      <el-tabs v-model="activeName" type="card" @tab-change="changeActiveName">
+        <el-tab-pane label="盘点单" name="first">
+          <byTable
+            :source="sourceList.data"
+            :pagination="sourceList.pagination"
+            :config="config"
+            :loading="loading"
+            :searchConfig="searchConfig"
+            highlight-current-row
+            :action-list="[
+              {
+                text: '盘点登记',
+                action: () => clickModal(),
+              },
+            ]"
+            @get-list="getList"
+            @clickReset="clickReset">
+          </byTable>
+        </el-tab-pane>
+        <el-tab-pane label="盘点明细" name="second">
+          <byTable
+            :source="sourceListTwo.data"
+            :pagination="sourceListTwo.pagination"
+            :config="configTwo"
+            :loading="loading"
+            :searchConfig="searchConfigTwo"
+            highlight-current-row
+            :action-list="[
+              {
+                text: '盘点登记',
+                action: () => clickModal(),
+              },
+            ]"
+            @get-list="getListTwo"
+            @clickReset="clickResetTwo">
+            <template #quantity="{ item }">
+              <div>{{ calculationNum(item) }}</div>
+            </template>
+            <template #money="{ item }">
+              <div>{{ calculationMoney(item) }}</div>
+            </template>
+          </byTable>
+        </el-tab-pane>
+      </el-tabs>
+    </el-card>
+  </div>
+</template>
+
+<script setup>
+import byTable from "@/components/byTable/index";
+
+const { proxy } = getCurrentInstance();
+const activeName = ref("first");
+const departmentList = ref([{ dictKey: "0", dictValue: "胜德体育" }]);
+const status = ref([
+  { dictKey: "0", dictValue: "正常" },
+  { dictKey: "1", dictValue: "异常" },
+]);
+const sourceList = ref({
+  data: [],
+  pagination: {
+    total: 0,
+    pageNum: 1,
+    pageSize: 10,
+    departmentId: "",
+    warehouseName: "",
+    status: "",
+    beginTime: "",
+    endTime: "",
+  },
+});
+const sourceListTwo = ref({
+  data: [],
+  pagination: {
+    total: 0,
+    pageNum: 1,
+    pageSize: 10,
+    bomSpecCode: "",
+    bomSpecName: "",
+    departmentId: "",
+    warehouseName: "",
+    status: "",
+    beginTime: "",
+    endTime: "",
+  },
+});
+const loading = ref(false);
+const searchConfig = computed(() => {
+  return [
+    {
+      type: "select",
+      prop: "departmentId",
+      data: departmentList.value,
+      label: "事业部",
+    },
+    {
+      type: "input",
+      prop: "warehouseName",
+      label: "仓库名称",
+    },
+    {
+      type: "select",
+      prop: "status",
+      data: status.value,
+      label: "盘点结果",
+    },
+    {
+      type: "date",
+      propList: ["beginTime", "endTime"],
+      label: "盘点日期",
+    },
+  ];
+});
+const searchConfigTwo = computed(() => {
+  return [
+    {
+      type: "input",
+      prop: "bomSpecCode",
+      label: "品号",
+    },
+    {
+      type: "input",
+      prop: "bomSpecName",
+      label: "品名",
+    },
+    {
+      type: "select",
+      prop: "departmentId",
+      data: departmentList.value,
+      label: "事业部",
+    },
+    {
+      type: "input",
+      prop: "warehouseName",
+      label: "仓库名称",
+    },
+    {
+      type: "select",
+      prop: "status",
+      data: status.value,
+      label: "盘点结果",
+    },
+    {
+      type: "date",
+      propList: ["beginTime", "endTime"],
+      label: "盘点日期",
+    },
+  ];
+});
+const config = computed(() => {
+  return [
+    {
+      attrs: {
+        label: "盘点时间",
+        prop: "createTime",
+        width: 160,
+        align: "center",
+      },
+    },
+    {
+      attrs: {
+        label: "归属事业部",
+        prop: "departmentName",
+        "min-width": 160,
+      },
+    },
+    {
+      attrs: {
+        label: "仓库类型",
+        prop: "warehouseType",
+        width: 140,
+      },
+      render(val) {
+        return proxy.dictKeyValue(val, proxy.useUserStore().allDict["warehouse_type"]);
+      },
+    },
+    {
+      attrs: {
+        label: "仓库名称",
+        prop: "warehouseName",
+        "min-width": 200,
+      },
+    },
+    {
+      attrs: {
+        label: "入库类型",
+        prop: "status",
+        width: 140,
+      },
+      render(val) {
+        return proxy.dictKeyValue(val, status.value);
+      },
+    },
+    {
+      attrs: {
+        label: "盘点人",
+        prop: "checkTaker",
+        width: 160,
+        align: "center",
+      },
+    },
+  ];
+});
+const configTwo = computed(() => {
+  return [
+    {
+      attrs: {
+        label: "品号",
+        prop: "bomSpecCode",
+        width: 160,
+      },
+    },
+    {
+      attrs: {
+        label: "品名",
+        prop: "bomSpecName",
+        "min-width": 220,
+      },
+    },
+    {
+      attrs: {
+        label: "结存单价",
+        prop: "balanceUnitPrice",
+        width: 140,
+        algin: "right",
+      },
+    },
+    {
+      attrs: {
+        label: "仓库名称",
+        prop: "warehouseName",
+        width: 160,
+      },
+    },
+    {
+      attrs: {
+        label: "归属事业部",
+        prop: "departmentName",
+        width: 160,
+      },
+    },
+    {
+      attrs: {
+        label: "单位",
+        prop: "bomUnit",
+        width: 140,
+      },
+    },
+    {
+      attrs: {
+        label: "盘前数量",
+        prop: "surplusStock",
+        width: 140,
+      },
+    },
+    {
+      attrs: {
+        label: "盘后数量",
+        prop: "checkQuantity",
+        width: 140,
+      },
+    },
+    {
+      attrs: {
+        label: "盘盈/亏数量",
+        slot: "quantity",
+        width: 140,
+      },
+    },
+    {
+      attrs: {
+        label: "盘盈/亏金额",
+        slot: "money",
+        width: 140,
+      },
+    },
+    {
+      attrs: {
+        label: "备注",
+        slot: "remark",
+        width: 140,
+      },
+    },
+    // {
+    //     attrs: {
+    //       label: "盘点时间",
+    //       prop: "createTime",
+    //       width: 160,
+    //       align: "center",
+    //     },
+    //   },
+    //   {
+    //     attrs: {
+    //       label: "仓库类型",
+    //       prop: "warehouseType",
+    //       width: 140,
+    //     },
+    //     render(val) {
+    //       return proxy.dictKeyValue(val, proxy.useUserStore().allDict["warehouse_type"]);
+    //     },
+    //   },
+    //   {
+    //     attrs: {
+    //       label: "入库类型",
+    //       prop: "status",
+    //       width: 140,
+    //     },
+    //     render(val) {
+    //       return proxy.dictKeyValue(val, status.value);
+    //     },
+    //   },
+    //   {
+    //     attrs: {
+    //       label: "盘点人",
+    //       prop: "checkTaker",
+    //       width: 160,
+    //       align: "center",
+    //     },
+    //   },
+  ];
+});
+const getList = async (req, status) => {
+  if (status) {
+    sourceList.value.pagination = {
+      pageNum: sourceList.value.pagination.pageNum,
+      pageSize: sourceList.value.pagination.pageSize,
+    };
+  } else {
+    sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
+  }
+  loading.value = true;
+  proxy.post("/check/page", sourceList.value.pagination).then((res) => {
+    sourceList.value.data = res.rows;
+    sourceList.value.pagination.total = res.total;
+    setTimeout(() => {
+      loading.value = false;
+    }, 200);
+  });
+};
+getList();
+const clickReset = () => {
+  getList("", true);
+};
+const getListTwo = async (req, status) => {
+  if (status) {
+    sourceListTwo.value.pagination = {
+      pageNum: sourceListTwo.value.pagination.pageNum,
+      pageSize: sourceListTwo.value.pagination.pageSize,
+    };
+  } else {
+    sourceListTwo.value.pagination = { ...sourceListTwo.value.pagination, ...req };
+  }
+  loading.value = true;
+  proxy.post("/checkBom/page", sourceListTwo.value.pagination).then((res) => {
+    sourceListTwo.value.data = res.rows;
+    sourceListTwo.value.pagination.total = res.total;
+    setTimeout(() => {
+      loading.value = false;
+    }, 200);
+  });
+};
+const clickResetTwo = () => {
+  getListTwo("", true);
+};
+const changeActiveName = (val) => {
+  if (val === "first") {
+    getList();
+  } else {
+    getListTwo();
+  }
+};
+const getDemandData = () => {
+  proxy.post("/department/page", { pageNum: 1, pageSize: 999 }).then((res) => {
+    if (res.rows && res.rows.length > 0) {
+      departmentList.value = departmentList.value.concat(
+        res.rows.map((item) => {
+          return {
+            dictKey: item.id,
+            dictValue: item.name,
+          };
+        })
+      );
+    }
+  });
+};
+getDemandData();
+const clickModal = () => {
+  proxy.$router.replace({
+    path: "/check/add",
+    query: {
+      random: proxy.random(),
+    },
+  });
+};
+const calculationNum = (row) => {
+  let num = 0;
+  if (row.checkQuantity) {
+    num = Number(row.checkQuantity);
+  }
+  if (row.surplusStock) {
+    num = Number(num) - Number(row.surplusStock);
+  }
+  return num;
+};
+const calculationMoney = (row) => {
+  let num = 0;
+  if (row.checkQuantity) {
+    num = Number(row.checkQuantity);
+  }
+  if (row.surplusStock) {
+    num = Number(num) - Number(row.surplusStock);
+  }
+  if (row.balanceUnitPrice) {
+    money = Number(Math.round(money * Number(row.balanceUnitPrice) * 100) / 100);
+    return money;
+  } else {
+    return 0;
+  }
+};
+</script>
+
+<style lang="scss" scoped>
+::v-deep(.el-input-number .el-input__inner) {
+  text-align: left;
+}
+</style>

+ 82 - 34
src/views/production/warehouse/inventory/index.vue

@@ -1,6 +1,6 @@
 <template>
   <div>
-    <div style="margin-bottom: 10px">
+    <div style="margin-bottom: 10px" v-if="!props.selectStatus">
       <el-card class="top-card">
         <el-radio-group v-model="sourceList.pagination.departmentId" v-for="(item, index) in departmentList" :key="index" @change="changeDepartment">
           <el-radio-button :label="item.id" style="margin: 0 10px 10px 0">{{ showName(item) }}</el-radio-button>
@@ -8,7 +8,7 @@
       </el-card>
     </div>
     <el-row :gutter="10">
-      <el-col :span="4">
+      <el-col :span="4" v-if="!props.selectStatus">
         <el-card style="height: calc(100vh - 242px); overflow-y: auto; overflow-x: hidden">
           <el-tree
             ref="treeCategory"
@@ -21,8 +21,8 @@
             @node-click="handleNodeClick" />
         </el-card>
       </el-col>
-      <el-col :span="20">
-        <el-card style="height: calc(100vh - 242px); overflow-y: auto; overflow-x: hidden">
+      <el-col :span="props.selectStatus ? 24 : 20">
+        <el-card :style="'overflow-y: auto; overflow-x: hidden; ' + (props.selectStatus ? 'height: calc(100vh - 184px)' : 'height: calc(100vh - 242px)')">
           <byTable
             :source="sourceList.data"
             :pagination="sourceList.pagination"
@@ -54,6 +54,11 @@ import { useRoute } from "vue-router";
 import useTagsViewStore from "@/store/modules/tagsView";
 
 const { proxy } = getCurrentInstance();
+const props = defineProps({
+  selectStatus: Boolean,
+  departmentId: String,
+  warehouseId: String,
+});
 const route = useRoute();
 const departmentList = ref([]);
 const warehouseList = ref([
@@ -190,41 +195,72 @@ const config = computed(() => {
         width: 120,
       },
     },
+    props.selectStatus
+      ? {
+          attrs: {
+            label: "操作",
+            width: 80,
+            align: "center",
+            fixed: "right",
+          },
+          renderHTML(row) {
+            return [
+              {
+                attrs: {
+                  label: "选择",
+                  type: "primary",
+                  text: true,
+                },
+                el: "button",
+                click() {
+                  clickSelect(row);
+                },
+              },
+            ];
+          },
+        }
+      : {
+          attrs: {
+            width: 1,
+          },
+        },
   ];
 });
 const getDemandData = () => {
-  proxy.post("/department/page", { pageNum: 1, pageSize: 999 }).then((res) => {
-    let list = [
-      { id: "", name: "全部" },
-      { id: "0", name: "胜德体育" },
-    ];
-    departmentList.value = list.concat(res.rows);
-    if (!(route.query && route.query.backupDate)) {
-      proxy.post("/inventory/getQuantityByDepartment", {}).then((res) => {
-        for (let i = 0; i < departmentList.value.length; i++) {
-          let list = res.filter((item) => item.departmentId === departmentList.value[i].id);
-          if (list && list.length > 0) {
-            departmentList.value[i].quantity = list[0].inventoryQuantity;
-          }
-        }
-      });
-    }
-  });
-  proxy.post("/warehouse/page", { pageNum: 1, pageSize: 999 }).then((res) => {
-    warehouseList.value[0].children = res.rows;
-    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) {
-          for (let i = 0; i < warehouseList.value[0].children.length; i++) {
-            let list = res.filter((item) => item.warehouseId === warehouseList.value[0].children[i].id);
+  if (!props.selectStatus) {
+    proxy.post("/department/page", { pageNum: 1, pageSize: 999 }).then((res) => {
+      let list = [
+        { id: "", name: "全部" },
+        { id: "0", name: "胜德体育" },
+      ];
+      departmentList.value = list.concat(res.rows);
+      if (!(route.query && route.query.backupDate)) {
+        proxy.post("/inventory/getQuantityByDepartment", {}).then((res) => {
+          for (let i = 0; i < departmentList.value.length; i++) {
+            let list = res.filter((item) => item.departmentId === departmentList.value[i].id);
             if (list && list.length > 0) {
-              warehouseList.value[0].children[i].quantity = list[0].inventoryQuantity;
+              departmentList.value[i].quantity = list[0].inventoryQuantity;
             }
           }
-        }
-      });
-    }
-  });
+        });
+      }
+    });
+    proxy.post("/warehouse/page", { pageNum: 1, pageSize: 999 }).then((res) => {
+      warehouseList.value[0].children = res.rows;
+      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) {
+            for (let i = 0; i < warehouseList.value[0].children.length; i++) {
+              let list = res.filter((item) => item.warehouseId === warehouseList.value[0].children[i].id);
+              if (list && list.length > 0) {
+                warehouseList.value[0].children[i].quantity = list[0].inventoryQuantity;
+              }
+            }
+          }
+        });
+      }
+    });
+  }
 };
 getDemandData();
 const getList = async (req, status) => {
@@ -240,6 +276,12 @@ const getList = async (req, status) => {
   if (route.query && route.query.backupDate) {
     path = "/inventoryBackup/detailPage";
   }
+  if (props.warehouseId) {
+    sourceList.value.pagination.warehouseId = props.warehouseId;
+  }
+  if (props.departmentId) {
+    sourceList.value.pagination.departmentId = props.departmentId;
+  }
   loading.value = true;
   proxy.post(path, sourceList.value.pagination).then((res) => {
     sourceList.value.data = res.rows;
@@ -250,7 +292,9 @@ const getList = async (req, status) => {
   });
 };
 const clickReset = () => {
-  proxy.$refs.treeCategory.setCurrentKey(null);
+  if (!props.selectStatus) {
+    proxy.$refs.treeCategory.setCurrentKey(null);
+  }
   getList("", true);
 };
 const handleNodeClick = (val) => {
@@ -315,6 +359,10 @@ onMounted(() => {
     getList();
   }
 });
+const emit = defineEmits(["selectBOM"]);
+const clickSelect = (item) => {
+  emit("selectBOM", item);
+};
 </script>
 
 <style lang="scss" scoped>