From 9b28c5569d8cbf34b94f89041f6f19e500912990 Mon Sep 17 00:00:00 2001 From: zhangdi <1104545947@qq.com> Date: Thu, 4 Jun 2026 18:23:52 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/consumableDialog.vue | 2 + src/views/firstOrder/components/inDialog.vue | 19 +- src/views/firstOrder/components/outDialog.vue | 906 +++++++++--------- src/views/materials/expend.vue | 6 + 4 files changed, 481 insertions(+), 452 deletions(-) diff --git a/src/views/firstOrder/components/consumableDialog.vue b/src/views/firstOrder/components/consumableDialog.vue index e435564..a9bedcb 100644 --- a/src/views/firstOrder/components/consumableDialog.vue +++ b/src/views/firstOrder/components/consumableDialog.vue @@ -27,6 +27,7 @@ export default { type: String, default: '' }, + tableData: { type: Array, default: () => [] }, }, data() { return { @@ -175,6 +176,7 @@ export default { }, mounted() { this.consumableVisible = this.consumableVisible + this.allSelectedList = this.tableData }, methods: { async handleLog(row) { diff --git a/src/views/firstOrder/components/inDialog.vue b/src/views/firstOrder/components/inDialog.vue index f8526fb..c0aacdf 100644 --- a/src/views/firstOrder/components/inDialog.vue +++ b/src/views/firstOrder/components/inDialog.vue @@ -25,12 +25,12 @@ :span="12" v-show="sizeForm.options == 1 && inDialogType != 'add'" > - + - + - + - + - + - + - + @@ -829,9 +829,10 @@ export default { return; } if ( - row.theInboundQuantity + row.yetInboundQuantity > + row.theInboundQuantity>0&& + ( row.theInboundQuantity + row.yetInboundQuantity > row.requiredQuantity && - !row.remark + !row.remark) ) { this.$message.warning( row.materialName + diff --git a/src/views/firstOrder/components/outDialog.vue b/src/views/firstOrder/components/outDialog.vue index 9820d52..92773bf 100644 --- a/src/views/firstOrder/components/outDialog.vue +++ b/src/views/firstOrder/components/outDialog.vue @@ -4,27 +4,27 @@ :append-to-body="true" width="70%" @close="handleCloseDetail" fullscreen>
- +
基本信息
- + - + - + - + @@ -33,7 +33,7 @@ - + 批量选择 @@ -42,7 +42,7 @@ - + 易耗品 @@ -51,12 +51,12 @@ - + - + 暂存 待二级库入库 已出库 @@ -267,7 +267,7 @@ + :demandDialogTitle="demandDialogTitle" :tableData="sizeForm.inTableData" @handleCloseDetail="closeDialog" @confirm="confirm"> { + data_.forEach((stat, index) => { const detail = this.sizeForm.inTableData.find( (item) => item.materialCode === stat.materialCode ); - + if (detail) { // console.log(99999,index, detail, stat.materialCode) if ( @@ -468,476 +468,496 @@ export default { this.getDepartmentName(detail.department), }) - } + } }); - console.log('detail', this.statisticsList) - }); -}, -changeDepartment() { - this.getStatistics(); -}, -batchclose() { - this.batchSelectionVisible = false; -}, -selectionChange(row) { - this.batchSelectionVisible = false; - row.forEach((item) => { - item.outboundQuantity = 1; - item.theOutboundQuantity = 1; - item.oneFormId = item.id - }); - this.sizeForm.inTableData = row; - - this.getStatistics(); -}, -confirm(allSelectedList) { - this.consumableVisible = false; - allSelectedList.forEach((item) => { - item.outboundQuantity = 1; - item.theOutboundQuantity = 1; - item.oneFormId = item.id - }); - - this.sizeForm.inTableData = allSelectedList; - this.getStatistics(); -}, // 处理搜索 + console.log('detail', this.statisticsList) + }); + }, + changeDepartment() { + this.getStatistics(); + }, + batchclose() { + this.batchSelectionVisible = false; + }, + selectionChange(row) { + this.batchSelectionVisible = false; + row.forEach((item) => { + item.outboundQuantity = 1; + item.theOutboundQuantity = 1; + item.oneFormId = item.id + }); + this.sizeForm.inTableData = row; + + this.getStatistics(); + }, + confirm(allSelectedList) { + this.consumableVisible = false; + allSelectedList.forEach((item) => { + item.outboundQuantity = 1; + item.theOutboundQuantity = 1; + item.oneFormId = item.id + }); + + this.sizeForm.inTableData = allSelectedList; + this.getStatistics(); + }, // 处理搜索 async handleSearch() { - // 重置当前页 - this.currentPage = 1; - await this.loadGoodsList(); -}, - -// 分页大小改变 -handleSizeChange(val) { - this.pageSize = val; - this.currentPage = 1; - this.loadGoodsList(); -}, - -// 当前页改变 -handleCurrentChange(val) { - this.currentPage = val; - this.loadGoodsList(); -}, -depchange(value) { - this.departmentList = this.departmentList; -}, -//关闭 -handleBatchClose() { - this.inBatchDialogVisible = false; -}, -// 添加出库数据 -inTableAdd() { - const requiredFields = [ - { value: this.sizeForm.reason, message: "请填写事由" }, - { value: this.sizeForm.materialType, message: "请选择物资类型" }, - { - value: this.sizeForm.optionType, - message: "请选择类别(易耗品/耐用品)", - }, - ]; - // 检查所有必填项 - for (const field of requiredFields) { - if (!field.value) { - this.$message.warning(field.message); - return; - } - } - this.sizeForm.inTableData.push({}); -}, -addInit() { - this.sizeForm.outDate = new Date(); //出库时间 -}, -//本次出库数量 -syncInboundQuantity(row) { - row.theOutboundQuantity = Number(row.theOutboundQuantity); - if (this.sizeForm.options === 1) { - const maxAllowQuantity = - (row.applicationQuantity || 0) - (row.outboundQuantity || 0); - if (row.theOutboundQuantity > maxAllowQuantity) { - this.$message.error(`本次出库数量不能大于${maxAllowQuantity}`); - row.theOutboundQuantity = maxAllowQuantity; - return false; - } - } - if (this.sizeForm.optionType === "NY") { - row.outboundQuantity = 1; - } - this.getStatistics(); -}, -//关闭新增弹窗 -handleCloseDetail() { - this.outDialogVisible = false; - - this.$emit("handleCloseDetail"); -}, -closeDialog() { - this.consumableVisible = false; -}, + // 重置当前页 + this.currentPage = 1; + await this.loadGoodsList(); + }, + + // 分页大小改变 + handleSizeChange(val) { + this.pageSize = val; + this.currentPage = 1; + this.loadGoodsList(); + }, + + // 当前页改变 + handleCurrentChange(val) { + this.currentPage = val; + this.loadGoodsList(); + }, + depchange(value) { + this.departmentList = this.departmentList; + }, + //关闭 + handleBatchClose() { + this.inBatchDialogVisible = false; + }, + // 添加出库数据 + inTableAdd() { + const requiredFields = [ + { value: this.sizeForm.reason, message: "请填写事由" }, + { value: this.sizeForm.materialType, message: "请选择物资类型" }, + { + value: this.sizeForm.optionType, + message: "请选择类别(易耗品/耐用品)", + }, + ]; + // 检查所有必填项 + for (const field of requiredFields) { + if (!field.value) { + this.$message.warning(field.message); + return; + } + } + if ( + this.sizeForm.optionType === "NY" && + this.outDialogType !== "details" + ) { + this.consumableVisible = true; + + } else { + this.sizeForm.inTableData.push({}); + } + + }, + addInit() { + this.sizeForm.outDate = new Date(); //出库时间 + }, + //本次出库数量 + syncInboundQuantity(row) { + row.theOutboundQuantity = Number(row.theOutboundQuantity); + if (this.sizeForm.options === 1) { + const maxAllowQuantity = + (row.applicationQuantity || 0) - (row.outboundQuantity || 0); + if (row.theOutboundQuantity > maxAllowQuantity) { + this.$message.error(`本次出库数量不能大于${maxAllowQuantity}`); + row.theOutboundQuantity = maxAllowQuantity; + return false; + } + } + if (this.sizeForm.optionType === "NY") { + row.outboundQuantity = 1; + } + this.getStatistics(); + }, + //关闭新增弹窗 + handleCloseDetail() { + this.outDialogVisible = false; + + this.$emit("handleCloseDetail"); + }, + closeDialog() { + this.consumableVisible = false; + }, // 获取批量需求单列表 async getQuarterList() { - try { - const res = await getQuarterList(); - if (res.data && res.data.result) { - this.quarterList = res.data.result; - this.quarterList.forEach((item) => { - if (item.year && item.quarter && item.ids) { - this.quarterYearMap[item.ids] = item.year; - this.quarterQuarterMap[item.ids] = item.quarter; - this.sizeForm.inTableData.ldDemandEndId = item.ids; + try { + const res = await getQuarterList(); + if (res.data && res.data.result) { + this.quarterList = res.data.result; + this.quarterList.forEach((item) => { + if (item.year && item.quarter && item.ids) { + this.quarterYearMap[item.ids] = item.year; + this.quarterQuarterMap[item.ids] = item.quarter; + this.sizeForm.inTableData.ldDemandEndId = item.ids; + } + }); } - }); - } - } catch (error) { - this.$message.error("获取需求单列表失败"); - } -}, + } catch (error) { + this.$message.error("获取需求单列表失败"); + } + }, // 批量需求单选择变化,获取部门列表 async onQuarterSelectChange(ids) { - if (!ids) return; - const year = this.quarterYearMap[ids]; - const quarter = this.quarterQuarterMap[ids]; - if (year && quarter) { - try { - const res = await getDepartmentList({ - year: year, - quarter: quarter, - }); - if (res.data && res.data.result) { - this.departmentList = res.data.result; + if (!ids) return; + const year = this.quarterYearMap[ids]; + const quarter = this.quarterQuarterMap[ids]; + if (year && quarter) { + try { + const res = await getDepartmentList({ + year: year, + quarter: quarter, + }); + if (res.data && res.data.result) { + this.departmentList = res.data.result; + } else { + this.departmentList = []; + } + } catch (error) { + this.$message.error("获取部门列表失败"); + this.departmentList = []; + } } else { this.departmentList = []; } - } catch (error) { - this.$message.error("获取部门列表失败"); - this.departmentList = []; - } - } else { - this.departmentList = []; - } -}, + }, async batchSubmit() { - if (!this.inBatchForm.batchType) { - this.$message.error("请选择需求单"); - return; - } - if (!this.inBatchForm.department) { - this.$message.error("请选择部门"); - return; - } - if (!this.inBatchForm.optionType) { - this.$message.error("请选择类别"); - return; - } - - const requestParams = { - ids: this.inBatchForm.batchType, - departmentId: this.inBatchForm.department, - optionType: this.inBatchForm.optionType, - }; - - try { - let res; - if (this.inBatchForm.optionType === "YH") { - res = await getDetailedList(requestParams); - } else if (this.inBatchForm.optionType === "NY") { - res = await batchList(requestParams); - } - - if (res.data && res.data.result) { - // this.sizeForm.inTableData = res.data.result; - const selectedDept = this.departmentList.find( - (dept) => dept.departmentId === this.inBatchForm.department - ); + if (!this.inBatchForm.batchType) { + this.$message.error("请选择需求单"); + return; + } + if (!this.inBatchForm.department) { + this.$message.error("请选择部门"); + return; + } + if (!this.inBatchForm.optionType) { + this.$message.error("请选择类别"); + return; + } - const processedData = res.data.result.map((item) => { - // 计算剩余可出库数量:申请数量 - 已出库数量 - // 如果字段不存在,默认为 0 - const appQty = Number(item.applicationQuantity || 0); - const outQty = Number(item.outboundQuantity || 0); + const requestParams = { + ids: this.inBatchForm.batchType, + departmentId: this.inBatchForm.department, + optionType: this.inBatchForm.optionType, + }; - const defaultQty = appQty - outQty; + try { + let res; if (this.inBatchForm.optionType === "YH") { - item.department = selectedDept.departmentId - item.departmentName = selectedDept.department + res = await getDetailedList(requestParams); + } else if (this.inBatchForm.optionType === "NY") { + res = await batchList(requestParams); } - return { - ...item, - IdDemandEndld: this.inBatchForm.batchType, - // department: deptName, // 注意:这里存的是名称还是ID需根据后续submit逻辑确认,原代码存的是名称 - // 设置本次出库数量默认值,且不能小于0 - theOutboundQuantity: defaultQty > 0 ? defaultQty : 0, - }; - }); - this.sizeForm.inTableData = processedData; - // - // 关闭批量选择弹窗 - this.inBatchDialogVisible = false; + if (res.data && res.data.result) { + // this.sizeForm.inTableData = res.data.result; + const selectedDept = this.departmentList.find( + (dept) => dept.departmentId === this.inBatchForm.department + ); - // 设置需求单名称 - const selectedQuarter = this.quarterList.find( - (item) => item.ids === this.inBatchForm.batchType - ); - if (selectedQuarter) { - this.sizeForm.demandEndInfo = selectedQuarter.quarterName; - } + const processedData = res.data.result.map((item) => { + // 计算剩余可出库数量:申请数量 - 已出库数量 + // 如果字段不存在,默认为 0 + const appQty = Number(item.applicationQuantity || 0); + const outQty = Number(item.outboundQuantity || 0); - // 耐用品特殊处理(打开批量选择弹窗) - if (this.inBatchForm.optionType === "NY") { - this.batchSelectionVisible = true; - this.dialogVisible = true; - this.batchTableData = res.data.result; - } else { + const defaultQty = appQty - outQty; + if (this.inBatchForm.optionType === "YH") { + item.department = selectedDept.departmentId + item.departmentName = selectedDept.department + } + return { + ...item, + IdDemandEndld: this.inBatchForm.batchType, + // department: deptName, // 注意:这里存的是名称还是ID需根据后续submit逻辑确认,原代码存的是名称 + // 设置本次出库数量默认值,且不能小于0 + theOutboundQuantity: defaultQty > 0 ? defaultQty : 0, + }; + }); - this.getStatistics(); - } + this.sizeForm.inTableData = processedData; + // + // 关闭批量选择弹窗 + this.inBatchDialogVisible = false; - // 强制更新视图 - this.$nextTick(() => { - this.$forceUpdate(); - }); - } else { - this.$message.warning("未获取到详细数据"); - } - } catch (error) { - this.$message.error( - `获取${this.inBatchForm.optionType === "YH" ? "易耗品" : "耐用品" - }数据失败:${error.message}` - ); - } -}, + // 设置需求单名称 + const selectedQuarter = this.quarterList.find( + (item) => item.ids === this.inBatchForm.batchType + ); + if (selectedQuarter) { + this.sizeForm.demandEndInfo = selectedQuarter.quarterName; + } + + // 耐用品特殊处理(打开批量选择弹窗) + if (this.inBatchForm.optionType === "NY") { + this.batchSelectionVisible = true; + this.dialogVisible = true; + this.batchTableData = res.data.result; + } else { + + this.getStatistics(); + } + + // 强制更新视图 + this.$nextTick(() => { + this.$forceUpdate(); + }); + } else { + this.$message.warning("未获取到详细数据"); + } + } catch (error) { + this.$message.error( + `获取${this.inBatchForm.optionType === "YH" ? "易耗品" : "耐用品" + }数据失败:${error.message}` + ); + } + }, //获取单条选择的部门名称列表 async getDetailedItems() { - this.loading = true; - try { - // const res = await ; - // this.list = res.data.result; - getDetailedItems().then(res => { - this.list = res.data.result; - }) - } catch (error) { - this.$message.error("获取数据来源失败,请重试"); - } finally { - this.loading = false; - } -}, -getDepartmentName(departmentId) { - const department = this.list.find( - (item) => item.departmentId === departmentId - ); - return department ? department.department : ""; -}, + this.loading = true; + try { + // const res = await ; + // this.list = res.data.result; + getDetailedItems().then(res => { + this.list = res.data.result; + }) + } catch (error) { + this.$message.error("获取数据来源失败,请重试"); + } finally { + this.loading = false; + } + }, + getDepartmentName(departmentId) { + const department = this.list.find( + (item) => item.departmentId === departmentId + ); + return department ? department.department : ""; + }, //获取单条选择的物资名称列表 async getMaterialList() { - this.loading = true; - this.consumableVisible = false; - try { - if ( - this.sizeForm.optionType === "NY" && - this.outDialogType !== "details" - ) { - this.consumableVisible = true; - } else { - getMaterialList({ - optionType: this.sizeForm.optionType, - }).then((res) => { - this.materials = res.data.result; - }); - } - } catch (error) { - this.$message.error("获取失败,请重试"); - } finally { - this.loading = false; - } -}, -// 处理物资选择变化 -handleMaterialChange(row, index) { - let select = this.materials.filter( - (item) => item.materialId === row.materialId - )[0]; - - this.sizeForm.inTableData[index].materialId = select.materialId; - this.sizeForm.inTableData[index].model = select.model; - this.sizeForm.inTableData[index].materialCode = select.materialCode; - this.sizeForm.inTableData[index].materialName = select.materialName; - this.sizeForm.inTableData[index].type = select.type; - this.sizeForm.inTableData[index].unit = select.unit; - this.sizeForm.inTableData[index].num = select.num; - this.getStatistics(); -}, + this.loading = true; + this.consumableVisible = false; + this.sizeForm.inTableData = []; + this.statisticsList = []; + // this.sizeForm.optionType = ""; + this.inBatchDialogVisible = false; + this.consumableVisible = false; + this.inBatchDialogVisible = false; + this.batchSelectionVisible = false; + this.batchTableData = []; + // this.inBatchForm.batchType = "" + // this.inBatchForm.department = "" + this.sizeForm.demandEndInfo = ""; + try { + if ( + this.sizeForm.optionType === "NY" && + this.outDialogType !== "details" + ) { + this.consumableVisible = true; + } else { + getMaterialList({ + optionType: this.sizeForm.optionType, + }).then((res) => { + this.materials = res.data.result; + }); + } + } catch (error) { + this.$message.error("获取失败,请重试"); + } finally { + this.loading = false; + } + }, + // 处理物资选择变化 + handleMaterialChange(row, index) { + let select = this.materials.filter( + (item) => item.materialId === row.materialId + )[0]; + + this.sizeForm.inTableData[index].materialId = select.materialId; + this.sizeForm.inTableData[index].model = select.model; + this.sizeForm.inTableData[index].materialCode = select.materialCode; + this.sizeForm.inTableData[index].materialName = select.materialName; + this.sizeForm.inTableData[index].type = select.type; + this.sizeForm.inTableData[index].unit = select.unit; + this.sizeForm.inTableData[index].num = select.num; + this.getStatistics(); + }, // 提交 async submit(index) { - if (!this.sizeForm.reason) { - this.$message.error("事由不能为空"); - return; - } - if (!this.sizeForm.materialType) { - this.$message.error("请选择物资类型"); - return; - } - if (this.sizeForm.options === 1) { - if (!this.sizeForm.demandEndInfo) { - this.$message.error("请选择需求单名称"); - return; - } - if ( - !this.sizeForm.inTableData || - this.sizeForm.inTableData.length === 0 - ) { - this.$message.error("请添加批量选择数据"); - return; - } - if (this.sizeForm.options === 2) { - for (const row of this.sizeForm.inTableData) { - if (!row.departmentName) { - this.$message.error("请选择部门"); + if (!this.sizeForm.reason) { + this.$message.error("事由不能为空"); + return; + } + if (!this.sizeForm.materialType) { + this.$message.error("请选择物资类型"); + return; + } + if (this.sizeForm.options === 1) { + if (!this.sizeForm.demandEndInfo) { + this.$message.error("请选择需求单名称"); return; } + if ( + !this.sizeForm.inTableData || + this.sizeForm.inTableData.length === 0 + ) { + this.$message.error("请添加批量选择数据"); + return; + } + if (this.sizeForm.options === 2) { + for (const row of this.sizeForm.inTableData) { + if (!row.departmentName) { + this.$message.error("请选择部门"); + return; + } + } + } } - } - } - if (this.sizeForm.options == 2) { - console.log(898989, "易耗是否选择部门!"); - const invalidRow = this.sizeForm.inTableData.find( - (row) => !row.department - ); - if (invalidRow) { - this.$message.error("存在未选择部门的物资,请补充完整"); - return; - } - } - // status == 1 暂存 ,2提交 - this.sizeForm.status = index; - this.sizeForm.ldOneOutStorageDetailVOList = this.sizeForm.inTableData; - let arr = this.list.find( - (item) => item.departmentId === this.inBatchForm.department - ); - - this.sizeForm.ldOneOutStorageDetailVOList = this.sizeForm.inTableData.map( - (row) => { - const deptId = row.department; - const dept = this.list.find((item) => item.departmentId === deptId); - - let select = this.sizeForm.inTableData.find( - (item) => item.materialId === row.materialId + if (this.sizeForm.options == 2) { + console.log(898989, "易耗是否选择部门!"); + const invalidRow = this.sizeForm.inTableData.find( + (row) => !row.department + ); + if (invalidRow) { + this.$message.error("存在未选择部门的物资,请补充完整"); + return; + } + } + // status == 1 暂存 ,2提交 + this.sizeForm.status = index; + this.sizeForm.ldOneOutStorageDetailVOList = this.sizeForm.inTableData; + let arr = this.list.find( + (item) => item.departmentId === this.inBatchForm.department ); - console.log(99999, select, this.sizeForm.inTableData); - const oneFormId = row.oneFormId - - return { - ...row, - department: deptId, - departmentName: dept.department, - oneFormId: oneFormId, - }; - } - ); - if (this.outDialogTiltle == "编辑") { - this.sizeForm.id = this.id; - } - - if (this.sizeForm.options == 1) { - this.sizeForm.optionType = this.inBatchForm.optionType; - } - - try { - console.log(this.sizeForm, "提交数据"); - this.saveLoading = true; - const res = await submitData(this.sizeForm); - if (res.data.success) { - this.$message({ - type: "success", - message: "提交成功", - }); - this.$emit("submitSuccess"); - this.saveLoading = false; - this.handleCloseDetail(); - } else { - this.saveLoading = false; - this.$message.error(res.data.message || "提交失败"); - } - } catch (error) { - this.saveLoading = false; - this.$message.error(error.message || "服务器错误"); - } -}, + + this.sizeForm.ldOneOutStorageDetailVOList = this.sizeForm.inTableData.map( + (row) => { + const deptId = row.department; + const dept = this.list.find((item) => item.departmentId === deptId); + + let select = this.sizeForm.inTableData.find( + (item) => item.materialId === row.materialId + ); + console.log(99999, select, this.sizeForm.inTableData); + const oneFormId = row.oneFormId + + return { + ...row, + department: deptId, + departmentName: dept.department, + oneFormId: oneFormId, + }; + } + ); + if (this.outDialogTiltle == "编辑") { + this.sizeForm.id = this.id; + } + + if (this.sizeForm.options == 1) { + this.sizeForm.optionType = this.inBatchForm.optionType; + } + + try { + console.log(this.sizeForm, "提交数据"); + this.saveLoading = true; + const res = await submitData(this.sizeForm); + if (res.data.success) { + this.$message({ + type: "success", + message: "提交成功", + }); + this.$emit("submitSuccess"); + this.saveLoading = false; + this.handleCloseDetail(); + } else { + this.saveLoading = false; + this.$message.error(res.data.message || "提交失败"); + } + } catch (error) { + this.saveLoading = false; + this.$message.error(error.message || "服务器错误"); + } + }, //编辑和详情 async inInit() { - if (this.outDialogType == "details" || this.outDialogType == "edit") { - editList(this.id).then((res) => { - const { ldOneOutStorage, ldOneOutStorageDetails } = - res.data.result || {}; - // this.sizeForm = res.data.result.ldOneOutStorage - // this.sizeForm.id = - this.sizeForm.inTableData = res.data.result.ldOneOutStorageDetails; - this.sizeForm.orderNo = ldOneOutStorage.orderNo; - this.sizeForm.reason = ldOneOutStorage.reason; - this.sizeForm.demandEndInfo = ldOneOutStorage.demandEndInfo; - this.sizeForm.outDate = ldOneOutStorage.outDate; - this.sizeForm.options = Number(ldOneOutStorage.options); - this.sizeForm.optionType = ldOneOutStorage.optionType; - this.batchSelectionVisible = false; - this.inBatchForm.optionType = ldOneOutStorage.optionType; - if (this.sizeForm.options == 2 && this.sizeForm.optionType == "YH") { - this.getMaterialList(); + if (this.outDialogType == "details" || this.outDialogType == "edit") { + editList(this.id).then((res) => { + const { ldOneOutStorage, ldOneOutStorageDetails } = + res.data.result || {}; + // this.sizeForm = res.data.result.ldOneOutStorage + // this.sizeForm.id = + this.sizeForm.inTableData = res.data.result.ldOneOutStorageDetails; + this.sizeForm.orderNo = ldOneOutStorage.orderNo; + this.sizeForm.reason = ldOneOutStorage.reason; + this.sizeForm.demandEndInfo = ldOneOutStorage.demandEndInfo; + this.sizeForm.outDate = ldOneOutStorage.outDate; + this.sizeForm.options = Number(ldOneOutStorage.options); + this.sizeForm.optionType = ldOneOutStorage.optionType; + this.batchSelectionVisible = false; + this.inBatchForm.optionType = ldOneOutStorage.optionType; + if (this.sizeForm.options == 2 && this.sizeForm.optionType == "YH") { + this.getMaterialList(); + } + + this.$set(this.sizeForm, "inTableData", ldOneOutStorageDetails); + this.getStatistics(); + }); } + }, - this.$set(this.sizeForm, "inTableData", ldOneOutStorageDetails); + // 选项选择 + radioChange() { + this.sizeForm.inTableData = []; + this.statisticsList = []; + this.sizeForm.optionType = ""; + this.inBatchDialogVisible = false; + this.consumableVisible = false; + this.inBatchDialogVisible = false; + this.batchSelectionVisible = false; + this.batchTableData = []; + // this.inBatchForm.batchType = "" + // this.inBatchForm.department = "" + this.sizeForm.demandEndInfo = ""; + + if (this.sizeForm.options === 1) { + this.getQuarterList(); + this.inBatchDialogVisible = true; + (this.inBatchForm.batchType = ""), (this.inBatchForm.department = ""); + this.inBatchForm.optionType = ""; + this.inBatchForm.optionType = ""; + } + }, + // 删除表格行数据 + handleDelete(index, row) { + this.sizeForm.inTableData.splice(index, 1); + this.$message.success("已成功删除该条记录"); this.getStatistics(); - }); - } -}, - -// 选项选择 -radioChange() { - this.sizeForm.inTableData = []; - this.statisticsList = []; - this.sizeForm.optionType = ""; - this.inBatchDialogVisible = false; - this.consumableVisible = false; - this.inBatchDialogVisible = false; - this.batchSelectionVisible = false; - this.batchTableData = []; - // this.inBatchForm.batchType = "" - // this.inBatchForm.department = "" - this.sizeForm.demandEndInfo = ""; - - if (this.sizeForm.options === 1) { - this.getQuarterList(); - this.inBatchDialogVisible = true; - (this.inBatchForm.batchType = ""), (this.inBatchForm.department = ""); - this.inBatchForm.optionType = ""; - this.inBatchForm.optionType = ""; - } -}, -// 删除表格行数据 -handleDelete(index, row) { - this.sizeForm.inTableData.splice(index, 1); - this.$message.success("已成功删除该条记录"); - this.getStatistics(); -}, + }, + }, + watch: { + // 监听需求单选择变化 + // "inBatchForm.batchType": function (newVal) { + // (this.inBatchForm.department = ""), (this.inBatchForm.optionType = 1); + // if (newVal) { + // this.onQuarterSelectChange(newVal); + // } + // }, + // "sizeForm.optionType": function (newVal) { + // if (newVal && this.outDialogType === "add") { + // this.sizeForm.inTableData = []; + // this.getMaterialList(); + // } else if (newVal && this.outDialogType !== "add") { + // this.getMaterialList(); + // } + // }, }, -watch: { - // 监听需求单选择变化 - // "inBatchForm.batchType": function (newVal) { - // (this.inBatchForm.department = ""), (this.inBatchForm.optionType = 1); - // if (newVal) { - // this.onQuarterSelectChange(newVal); - // } - // }, - // "sizeForm.optionType": function (newVal) { - // if (newVal && this.outDialogType === "add") { - // this.sizeForm.inTableData = []; - // this.getMaterialList(); - // } else if (newVal && this.outDialogType !== "add") { - // this.getMaterialList(); - // } - // }, -}, };