From a64e391e8bdf7d2fd8e9de007ab2fb3c5a2bd035 Mon Sep 17 00:00:00 2001 From: zhangdi <1104545947@qq.com> Date: Wed, 3 Jun 2026 20:59:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=87=BA=E5=BA=93=E9=97=AE=E9=A2=98=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/firstOrder/components/outDialog.vue | 925 +++++++++--------- 1 file changed, 468 insertions(+), 457 deletions(-) diff --git a/src/views/firstOrder/components/outDialog.vue b/src/views/firstOrder/components/outDialog.vue index 60cf3ca..f61c486 100644 --- a/src/views/firstOrder/components/outDialog.vue +++ b/src/views/firstOrder/components/outDialog.vue @@ -423,510 +423,521 @@ export default { } }, getStatistics() { - let arr = JSON.parse(JSON.stringify(this.sizeForm.inTableData)); + let arr = this.sizeForm.inTableData; arr.forEach((row) => { row.id = row.oneFormId; }); + getStatistics(arr).then((res) => { - this.statisticsList = res.data.result; - this.statisticsList = this.statisticsList.map((stat) => { + // this.statisticsList = res.data.result; + let data_ = res.data.result + // this.statisticsList = + console.log('批量易耗品', this.sizeForm.inTableData, data_) + data_.forEach((stat,index) => { const detail = this.sizeForm.inTableData.find( (item) => item.materialCode === stat.materialCode ); - // - if ( - (this.sizeForm.options == 1 && - this.inBatchForm.optionType == "NY") || - (this.sizeForm.options == 2 && this.sizeForm.optionType == "NY") - ) { - const detailList = this.sizeForm.inTableData.filter( - (item) => - item.materialCode === stat.materialCode && - item.materialName === stat.materialName - ); - console.log(8989898989, detailList) - detail.theOutboundQuantity = detailList.reduce( - (acc, cur) => acc + cur.theOutboundQuantity, - 0 - ); - } - - return { - ...stat, - theOutboundQuantity: detail.theOutboundQuantity, //本次出库数量 - unitPrice: detail.unitPrice, - totalQuantity: stat.num - detail.theOutboundQuantity, - department: detail.department, // 部门ID - departmentName: - detail.departmentName || - this.getDepartmentName(detail.department), - }; - }); - }); - }, - 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(); - }, + + if (detail) { + // console.log(99999,index, detail, stat.materialCode) + if ( + (this.sizeForm.options == 1 && + this.inBatchForm.optionType == "NY") || + (this.sizeForm.options == 2 && this.sizeForm.optionType == "NY") + ) { + + const detailList = this.sizeForm.inTableData.filter( + (item) => + item.materialCode === stat.materialCode && + item.materialName === stat.materialName + ); + detail.theOutboundQuantity = detailList.reduce( + (acc, cur) => cur.theOutboundQuantity, + 0 + ); + } + this.statisticsList.push({ + ...stat, + theOutboundQuantity: detail.theOutboundQuantity, //本次出库数量 + unitPrice: detail.unitPrice, + totalQuantity: stat.num - detail.theOutboundQuantity, + department: detail.department, // 部门ID + departmentName: + detail.departmentName || + this.getDepartmentName(detail.department), + }) - // 当前页改变 - 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; - }, + }); + 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; +}, // 获取批量需求单列表 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; - } else { - this.departmentList = []; - } - } catch (error) { - this.$message.error("获取部门列表失败"); - this.departmentList = []; - } + 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 = []; + } +}, 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; - } + 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); + } - const requestParams = { - ids: this.inBatchForm.batchType, - departmentId: this.inBatchForm.department, - optionType: this.inBatchForm.optionType, - }; + if (res.data && res.data.result) { + // this.sizeForm.inTableData = res.data.result; + const selectedDept = this.departmentList.find( + (dept) => dept.departmentId === this.inBatchForm.department + ); + + const processedData = res.data.result.map((item) => { + // 计算剩余可出库数量:申请数量 - 已出库数量 + // 如果字段不存在,默认为 0 + const appQty = Number(item.applicationQuantity || 0); + const outQty = Number(item.outboundQuantity || 0); - try { - let res; + const defaultQty = appQty - outQty; if (this.inBatchForm.optionType === "YH") { - res = await getDetailedList(requestParams); - } else if (this.inBatchForm.optionType === "NY") { - res = await batchList(requestParams); + item.department = selectedDept.departmentId + item.departmentName = selectedDept.department } + return { + ...item, + IdDemandEndld: this.inBatchForm.batchType, + // department: deptName, // 注意:这里存的是名称还是ID需根据后续submit逻辑确认,原代码存的是名称 + // 设置本次出库数量默认值,且不能小于0 + theOutboundQuantity: defaultQty > 0 ? defaultQty : 0, + }; + }); - if (res.data && res.data.result) { - this.sizeForm.inTableData = res.data.result; - const selectedDept = this.departmentList.find( - (dept) => dept.departmentId === this.inBatchForm.department - ); - - const processedData = res.data.result.map((item) => { - // 计算剩余可出库数量:申请数量 - 已出库数量 - // 如果字段不存在,默认为 0 - const appQty = Number(item.applicationQuantity || 0); - const outQty = Number(item.outboundQuantity || 0); - 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.sizeForm.inTableData = processedData; - - // 关闭批量选择弹窗 - this.inBatchDialogVisible = false; - - // 设置需求单名称 - const selectedQuarter = this.quarterList.find( - (item) => item.ids === this.inBatchForm.batchType - ); - if (selectedQuarter) { - this.sizeForm.demandEndInfo = selectedQuarter.quarterName; - } + this.sizeForm.inTableData = processedData; + // + // 关闭批量选择弹窗 + this.inBatchDialogVisible = false; - // 耐用品特殊处理(打开批量选择弹窗) - if (this.inBatchForm.optionType === "NY") { - this.batchSelectionVisible = true; - this.dialogVisible = true; - this.batchTableData = res.data.result; - } else { + // 设置需求单名称 + const selectedQuarter = this.quarterList.find( + (item) => item.ids === this.inBatchForm.batchType + ); + if (selectedQuarter) { + this.sizeForm.demandEndInfo = selectedQuarter.quarterName; + } - this.getStatistics(); - } + // 耐用品特殊处理(打开批量选择弹窗) + if (this.inBatchForm.optionType === "NY") { + this.batchSelectionVisible = true; + this.dialogVisible = true; + this.batchTableData = res.data.result; + } else { - // 强制更新视图 - this.$nextTick(() => { - this.$forceUpdate(); - }); - } else { - this.$message.warning("未获取到详细数据"); - } - } catch (error) { - this.$message.error( - `获取${this.inBatchForm.optionType === "YH" ? "易耗品" : "耐用品" - }数据失败:${error.message}` - ); + 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; + 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("请选择部门"); - return; - } - } - } - } - if (this.sizeForm.options == 2) { - console.log(898989, "易耗是否选择部门!"); - const invalidRow = this.sizeForm.inTableData.find( - (row) => !row.department - ); - if (invalidRow) { - 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; } } - // 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 - ); - console.log(99999, select, this.sizeForm.inTableData); - const oneFormId = row.oneFormId - - return { - ...row, - department: deptId, - departmentName: dept.department, - oneFormId: oneFormId, - }; - } + } + } + 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.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 || "服务器错误"); - } - }, + 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(); - } - - this.$set(this.sizeForm, "inTableData", ldOneOutStorageDetails); - this.getStatistics(); - }); - } - }, - - // 选项选择 - radioChange() { - this.sizeForm.inTableData = []; - this.statisticsList = []; - this.sizeForm.optionType = ""; - this.inBatchDialogVisible = false; - this.consumableVisible = false; - this.inBatchDialogVisible = false; + 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.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 = ""; + this.inBatchForm.optionType = ldOneOutStorage.optionType; + if (this.sizeForm.options == 2 && this.sizeForm.optionType == "YH") { + this.getMaterialList(); } - }, - // 删除表格行数据 - handleDelete(index, row) { - this.sizeForm.inTableData.splice(index, 1); - this.$message.success("已成功删除该条记录"); + + this.$set(this.sizeForm, "inTableData", ldOneOutStorageDetails); 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(); - // } - // }, + }); + } +}, + +// 选项选择 +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(); + // } + // }, +}, };