lxf 1 рік тому
батько
коміт
7bc34c068a

+ 14 - 0
src/router/index.js

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

+ 0 - 4
src/views/group/BOM/management/index.vue

@@ -56,10 +56,6 @@
                         :src="spec.mainImgUrl"
                         @click="openFile(spec.mainImgUrl)" />
                     </div>
-                    <div
-                      v-else
-                      class="el-icon-picture-outline"
-                      style="width: 40px; height: 40px; font-size: 36px; line-height: 40px; text-align: center; color: rgb(229 228 228)"></div>
                   </div>
                   <div style="width: 180px">
                     {{ spec.code }}

+ 244 - 0
src/views/production/warehouse/putInStorage/add.vue

@@ -0,0 +1,244 @@
+<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="purchaseId" style="width: 100%; margin-bottom: 18px" @change="changePurchase()">
+                  <el-select v-model="formData.data.purchaseId" 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="departmentId" style="width: 100%; margin-bottom: 18px">
+                  <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">
+                  <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="detailType" style="width: 100%; margin-bottom: 18px">
+                  <el-select v-model="formData.data.detailType" placeholder="请选择入库类型" clearable style="width: 100%">
+                    <el-option v-for="item in useUserStore().allDict['put_stock_type']" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey" />
+                  </el-select>
+                </el-form-item>
+                <el-form-item label="申请人" prop="applicant" style="width: 100%; margin-bottom: 18px">
+                  <el-input v-model="formData.data.applicant" 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 #inOutStorageBomList>
+          <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.inOutStorageBomList" :row-style="{ height: '35px' }" header-row-class-name="tableHeader">
+              <el-table-column label="品号" prop="code" width="160" />
+              <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="入库数量" width="180">
+                <template #default="{ row, $index }">
+                  <el-form-item :prop="'inOutStorageBomList.' + $index + '.quantity'" :rules="rules.quantity" :inline-message="true" style="width: 100%">
+                    <el-input-number
+                      onmousewheel="return false;"
+                      v-model="row.quantity"
+                      placeholder="入库数量"
+                      style="width: 100%"
+                      :controls="false"
+                      :min="0"
+                      :precision="0" />
+                  </el-form-item>
+                </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%">
+      <SelectBOM :selectStatus="true" @selectBOM="selectBOM"></SelectBOM>
+      <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 SelectBOM from "@/views/group/BOM/management/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: {
+    type: 1,
+    applicant: proxy.useUserStore().user.nickName,
+    inOutStorageBomList: [],
+  },
+});
+const formConfig = computed(() => {
+  return [
+    {
+      type: "title",
+      title: "入库信息",
+      label: "",
+    },
+    {
+      type: "slot",
+      slotName: "basicInformation",
+      label: "",
+    },
+    {
+      type: "title",
+      title: "物料信息",
+      label: "",
+    },
+    {
+      type: "slot",
+      slotName: "inOutStorageBomList",
+      label: "",
+    },
+  ];
+});
+const rules = ref({
+  departmentId: [{ required: true, message: "请选择事业部", trigger: "change" }],
+  warehouseId: [{ required: true, message: "请选择仓库", trigger: "change" }],
+  detailType: [{ required: true, message: "请选择入库类型", trigger: "change" }],
+  applicant: [{ required: true, message: "请输入申请人", trigger: "blur" }],
+  quantity: [{ 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 changePurchase = () => {
+  formData.data.inOutStorageBomList = [];
+};
+const openBOM = ref(false);
+const clickAddBOM = () => {
+  openBOM.value = true;
+};
+const selectBOM = (item) => {
+  if (formData.data.inOutStorageBomList && formData.data.inOutStorageBomList.length > 0) {
+    let list = formData.data.inOutStorageBomList.filter((itemFilter) => itemFilter.bomSpecId === item.id);
+    if (list && list.length > 0) {
+      return ElMessage("该BOM已添加");
+    }
+  }
+  if (item.id) {
+    formData.data.inOutStorageBomList.push({
+      bomSpecId: item.id,
+      code: item.code,
+      name: item.name,
+      length: item.length,
+      width: item.width,
+      height: item.height,
+      quantity: undefined,
+    });
+    ElMessage({ message: "选择完成", type: "success" });
+  }
+};
+const clickDelete = (index) => {
+  formData.data.inOutStorageBomList.splice(index, 1);
+};
+const btnDisabled = ref(false);
+const submitForm = () => {
+  submit.value.handleSubmit(() => {
+    if (formData.data.inOutStorageBomList && formData.data.inOutStorageBomList.length > 0) {
+      btnDisabled.value = true;
+      proxy.post("/inOutStorage/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-putInStorage",
+  });
+};
+</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>

+ 217 - 0
src/views/production/warehouse/putInStorage/index.vue

@@ -0,0 +1,217 @@
+<template>
+  <div>
+    <el-card class="box-card">
+      <el-tabs v-model="activeName" type="card">
+        <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">
+            <template #code="{ item }">
+              <div>
+                <a style="color: #409eff; cursor: pointer; word-break: break-all" @click="clickCode(item)">{{ item.code }}</a>
+              </div>
+            </template>
+          </byTable>
+        </el-tab-pane>
+        <el-tab-pane label="入库明细" name="second"> </el-tab-pane>
+      </el-tabs>
+    </el-card>
+  </div>
+</template>
+
+<script setup>
+import byTable from "@/components/byTable/index";
+// import { ElMessage } from "element-plus";
+
+const { proxy } = getCurrentInstance();
+const activeName = ref("first");
+const departmentList = ref([{ dictKey: "0", dictValue: "胜德体育" }]);
+const sourceList = ref({
+  data: [],
+  pagination: {
+    total: 0,
+    pageNum: 1,
+    pageSize: 10,
+    type: "1",
+    code: "",
+    departmentId: "",
+    warehouseName: "",
+    detailType: "",
+    beginTime: "",
+    endTime: "",
+  },
+});
+const loading = ref(false);
+const searchConfig = computed(() => {
+  return [
+    {
+      type: "input",
+      prop: "code",
+      label: "入库单号",
+    },
+    {
+      type: "select",
+      prop: "departmentId",
+      data: departmentList.value,
+      label: "事业部",
+    },
+    {
+      type: "input",
+      prop: "warehouseName",
+      label: "仓库名称",
+    },
+    {
+      type: "select",
+      prop: "detailType",
+      dictKey: "put_stock_type",
+      label: "入库类型",
+    },
+    {
+      type: "date",
+      propList: ["beginTime", "endTime"],
+      label: "日期",
+    },
+  ];
+});
+const config = computed(() => {
+  return [
+    {
+      attrs: {
+        label: "入库单号",
+        slot: "code",
+        "min-width": 160,
+      },
+    },
+    {
+      attrs: {
+        label: "采购单号",
+        prop: "purchaseCode",
+        "min-width": 160,
+      },
+    },
+    {
+      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": 160,
+      },
+    },
+    {
+      attrs: {
+        label: "入库类型",
+        prop: "detailType",
+        width: 140,
+      },
+      render(val) {
+        return proxy.dictKeyValue(val, proxy.useUserStore().allDict["put_stock_type"]);
+      },
+    },
+    {
+      attrs: {
+        label: "入库时间",
+        prop: "createTime",
+        width: 160,
+        align: "center",
+      },
+    },
+    {
+      attrs: {
+        label: "入库申请人",
+        prop: "applicant",
+        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("/inOutStorage/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 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 clickCode = (row) => {
+  console.log(row);
+  // proxy.$router.replace({
+  //   path: "/production/warehouse/warehouse-inventory",
+  //   query: {
+  //     backupDate: row.backupDate,
+  //     backupDateStr: row.backupDateStr,
+  //   },
+  // });
+};
+const clickModal = () => {
+  proxy.$router.replace({
+    path: "/putInStorage/add",
+    query: {
+      random: proxy.random(),
+    },
+  });
+};
+</script>
+
+<style lang="scss" scoped>
+::v-deep(.el-input-number .el-input__inner) {
+  text-align: left;
+}
+</style>