|
@@ -0,0 +1,479 @@
|
|
|
+<template>
|
|
|
+ <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
|
|
|
+ :table-events="{
|
|
|
+ select: selectRow,
|
|
|
+ 'select-all': selectRow,
|
|
|
+ }"
|
|
|
+ :action-list="[
|
|
|
+ {
|
|
|
+ text: '新增入库',
|
|
|
+ action: () => clickModal(),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ text: '调拨出库',
|
|
|
+ action: () => clickOutbound(),
|
|
|
+ disabled: selectData.length === 0,
|
|
|
+ },
|
|
|
+ ]"
|
|
|
+ @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
|
|
|
+ @get-list="getListTwo"
|
|
|
+ @clickReset="clickResetTwo">
|
|
|
+ </byTable>
|
|
|
+ </el-tab-pane>
|
|
|
+ </el-tabs>
|
|
|
+
|
|
|
+ <el-dialog :title="formData.data.type === 1 ? '入库' : '出库'" v-if="openAdd" v-model="openAdd" width="70%">
|
|
|
+ <div style="max-height: calc(100vh - 176px); overflow-y: auto; overflow-x: hidden" v-loading="loadingAdd">
|
|
|
+ <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="allotFlag" style="width: 100%; margin-bottom: 18px">
|
|
|
+ <el-select v-model="formData.data.allotFlag" 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="operationTime" style="width: 100%; margin-bottom: 18px">
|
|
|
+ <el-date-picker
|
|
|
+ v-model="formData.data.operationTime"
|
|
|
+ type="datetime"
|
|
|
+ placeholder="请选择操作时间"
|
|
|
+ value-format="YYYY-MM-DD HH:mm:ss"
|
|
|
+ style="width: 100%" />
|
|
|
+ </el-form-item>
|
|
|
+ <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 #detailDtoList>
|
|
|
+ <div style="width: 100%; padding: 0 20px">
|
|
|
+ <div style="margin-bottom: 10px" v-if="formData.data.type === 1">
|
|
|
+ <el-button type="primary" size="small" @click="clickAddSKU()">选择SKU</el-button>
|
|
|
+ </div>
|
|
|
+ <el-table :data="formData.data.detailDtoList" :row-style="{ height: '35px' }" header-row-class-name="tableHeader">
|
|
|
+ <el-table-column label="品号" prop="skuSpecCode" width="160" />
|
|
|
+ <el-table-column label="品名" prop="skuSpecName" min-width="220" />
|
|
|
+ <el-table-column label="入库数量" width="160">
|
|
|
+ <template #default="{ row, $index }">
|
|
|
+ <el-form-item :prop="'detailDtoList.' + $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="danger" @click="clickDelete($index)" text>删除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </byForm>
|
|
|
+ </div>
|
|
|
+ <div style="text-align: center; margin: 10px">
|
|
|
+ <el-button @click="openAdd = false" size="large">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="submitForm()" size="large" v-preReClick>确 定</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <el-dialog title="选择产品" v-if="openProduct" v-model="openProduct" width="90%">
|
|
|
+ <SelectProduct :selectStatus="true" :type="'null'" @selectProduct="selectProduct"></SelectProduct>
|
|
|
+ <template #footer>
|
|
|
+ <el-button @click="openProduct = false" size="large">关 闭</el-button>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
+ </el-card>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup>
|
|
|
+import byTable from "/src/components/byTable/index";
|
|
|
+import { ElMessage } from "element-plus";
|
|
|
+import moment from "moment";
|
|
|
+import byForm from "/src/components/byForm/index";
|
|
|
+import SelectProduct from "/src/views/group/product/management/index";
|
|
|
+
|
|
|
+const { proxy } = getCurrentInstance();
|
|
|
+const warehouseList = ref([]);
|
|
|
+const type = ref([
|
|
|
+ {
|
|
|
+ dictKey: 1,
|
|
|
+ dictValue: "入库",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ dictKey: 0,
|
|
|
+ dictValue: "出库",
|
|
|
+ },
|
|
|
+]);
|
|
|
+const activeName = ref("first");
|
|
|
+const sourceList = ref({
|
|
|
+ data: [],
|
|
|
+ pagination: {
|
|
|
+ total: 0,
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ skuSpecCode: "",
|
|
|
+ skuSpecName: "",
|
|
|
+ },
|
|
|
+});
|
|
|
+const sourceListTwo = ref({
|
|
|
+ data: [],
|
|
|
+ pagination: {
|
|
|
+ total: 0,
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ skuSpecCode: "",
|
|
|
+ skuSpecName: "",
|
|
|
+ type: "",
|
|
|
+ beginTime: "",
|
|
|
+ endTime: "",
|
|
|
+ },
|
|
|
+});
|
|
|
+const loading = ref(false);
|
|
|
+const searchConfig = computed(() => {
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ type: "input",
|
|
|
+ prop: "skuSpecCode",
|
|
|
+ label: "SKU品号",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "input",
|
|
|
+ prop: "skuSpecName",
|
|
|
+ label: "SKU品名",
|
|
|
+ },
|
|
|
+ ];
|
|
|
+});
|
|
|
+const searchConfigTwo = computed(() => {
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ type: "input",
|
|
|
+ prop: "skuSpecCode",
|
|
|
+ label: "SKU品号",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "input",
|
|
|
+ prop: "skuSpecName",
|
|
|
+ label: "SKU品名",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "select",
|
|
|
+ prop: "type",
|
|
|
+ data: type.value,
|
|
|
+ label: "类型",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "date",
|
|
|
+ propList: ["beginTime", "endTime"],
|
|
|
+ label: "时间",
|
|
|
+ },
|
|
|
+ ];
|
|
|
+});
|
|
|
+const config = computed(() => {
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ type: "selection",
|
|
|
+ attrs: {
|
|
|
+ checkAtt: "isCheck",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "SKU品号",
|
|
|
+ prop: "skuSpecCode",
|
|
|
+ "min-width": 140,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "SKU品名",
|
|
|
+ prop: "skuSpecName",
|
|
|
+ "min-width": 340,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "数量",
|
|
|
+ prop: "quantity",
|
|
|
+ "min-width": 120,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ];
|
|
|
+});
|
|
|
+const configTwo = computed(() => {
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "SKU品号",
|
|
|
+ prop: "skuSpecCode",
|
|
|
+ width: 160,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "SKU品名",
|
|
|
+ prop: "skuSpecName",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "备注",
|
|
|
+ prop: "remark",
|
|
|
+ width: 240,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "数量",
|
|
|
+ prop: "quantity",
|
|
|
+ width: 100,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "操作类型",
|
|
|
+ prop: "type",
|
|
|
+ width: 100,
|
|
|
+ },
|
|
|
+ render(val) {
|
|
|
+ return proxy.dictKeyValue(val, type.value);
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "操作时间",
|
|
|
+ prop: "operationTime",
|
|
|
+ width: 160,
|
|
|
+ align: "center",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ];
|
|
|
+});
|
|
|
+const getDemandData = () => {
|
|
|
+ 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 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("/inventoryFinishedTemporary/page", sourceList.value.pagination).then((res) => {
|
|
|
+ if (res.rows && res.rows.length > 0) {
|
|
|
+ sourceList.value.data = res.rows.map((item) => {
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ isCheck: true,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ sourceList.value.data = [];
|
|
|
+ }
|
|
|
+ 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("/inventoryFinishedTemporaryDetail/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 openAdd = ref(false);
|
|
|
+const loadingAdd = ref(false);
|
|
|
+const formData = reactive({
|
|
|
+ data: {
|
|
|
+ type: 1,
|
|
|
+ operationTime: "",
|
|
|
+ allotFlag: "",
|
|
|
+ remark: "",
|
|
|
+ detailDtoList: [],
|
|
|
+ },
|
|
|
+});
|
|
|
+const formOption = reactive({
|
|
|
+ inline: true,
|
|
|
+ labelWidth: "100px",
|
|
|
+ itemWidth: 100,
|
|
|
+ rules: [],
|
|
|
+ labelPosition: "right",
|
|
|
+});
|
|
|
+const formConfig = computed(() => {
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ type: "slot",
|
|
|
+ slotName: "basicInformation",
|
|
|
+ label: "",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "slot",
|
|
|
+ slotName: "detailDtoList",
|
|
|
+ label: "",
|
|
|
+ },
|
|
|
+ ];
|
|
|
+});
|
|
|
+const rules = ref({
|
|
|
+ allotFlag: [{ required: true, message: "请选择调拨仓库", trigger: "change" }],
|
|
|
+ operationTime: [{ required: true, message: "请选择操作时间", trigger: "change" }],
|
|
|
+ quantity: [{ required: true, message: "请输入数量", trigger: "blur" }],
|
|
|
+});
|
|
|
+const clickModal = () => {
|
|
|
+ formData.data = {
|
|
|
+ type: 1,
|
|
|
+ operationTime: moment().format("yyyy-MM-DD HH:mm:ss"),
|
|
|
+ allotFlag: "",
|
|
|
+ remark: "",
|
|
|
+ detailDtoList: [],
|
|
|
+ };
|
|
|
+ loadingAdd.value = false;
|
|
|
+ openAdd.value = true;
|
|
|
+};
|
|
|
+const clickDelete = (index) => {
|
|
|
+ formData.data.detailDtoList.splice(index, 1);
|
|
|
+};
|
|
|
+const openProduct = ref(false);
|
|
|
+const clickAddSKU = () => {
|
|
|
+ openProduct.value = true;
|
|
|
+};
|
|
|
+const selectProduct = (row) => {
|
|
|
+ if (row.id) {
|
|
|
+ let list = formData.data.detailDtoList.filter((item) => item.skuSpecId === row.id);
|
|
|
+ if (list && list.length > 0) {
|
|
|
+ return ElMessage("该产品已添加");
|
|
|
+ }
|
|
|
+ formData.data.detailDtoList.push({
|
|
|
+ skuSpecCode: row.code,
|
|
|
+ skuSpecName: row.name,
|
|
|
+ skuSpecId: row.id,
|
|
|
+ quantity: undefined,
|
|
|
+ });
|
|
|
+ ElMessage({ message: "添加成功", type: "success" });
|
|
|
+ } else {
|
|
|
+ ElMessage("添加失败");
|
|
|
+ }
|
|
|
+};
|
|
|
+const submit = ref(null);
|
|
|
+const submitForm = () => {
|
|
|
+ submit.value.handleSubmit(() => {
|
|
|
+ if (formData.data.detailDtoList && formData.data.detailDtoList.length > 0) {
|
|
|
+ loadingAdd.value = true;
|
|
|
+ proxy.post("/inventoryFinishedTemporaryDetail/add", formData.data).then(
|
|
|
+ () => {
|
|
|
+ ElMessage({ message: "提交成功", type: "success" });
|
|
|
+ openAdd.value = false;
|
|
|
+ getList();
|
|
|
+ },
|
|
|
+ (err) => {
|
|
|
+ console.log(err);
|
|
|
+ loadingAdd.value = false;
|
|
|
+ }
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ return ElMessage("请添加SKU");
|
|
|
+ }
|
|
|
+ });
|
|
|
+};
|
|
|
+const selectData = ref([]);
|
|
|
+const selectRow = (data) => {
|
|
|
+ selectData.value = data;
|
|
|
+};
|
|
|
+const clickOutbound = () => {
|
|
|
+ formData.data = {
|
|
|
+ type: 0,
|
|
|
+ operationTime: moment().format("yyyy-MM-DD HH:mm:ss"),
|
|
|
+ allotFlag: "",
|
|
|
+ remark: "",
|
|
|
+ detailDtoList: selectData.value.map((item) => {
|
|
|
+ return {
|
|
|
+ skuSpecId: item.skuSpecId,
|
|
|
+ skuSpecCode: item.skuSpecCode,
|
|
|
+ skuSpecName: item.skuSpecName,
|
|
|
+ quantity: item.quantity,
|
|
|
+ };
|
|
|
+ }),
|
|
|
+ };
|
|
|
+ loadingAdd.value = false;
|
|
|
+ openAdd.value = true;
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+:deep(.el-dialog) {
|
|
|
+ margin-top: 10px !important;
|
|
|
+ margin-bottom: 10px !important;
|
|
|
+}
|
|
|
+::v-deep(.el-input-number .el-input__inner) {
|
|
|
+ text-align: left;
|
|
|
+}
|
|
|
+</style>
|