From d52a080379b48656dd460c5dbbc42876a374a807 Mon Sep 17 00:00:00 2001 From: hongchao <3228015117@qq.com> Date: Tue, 18 Mar 2025 16:53:41 +0800 Subject: [PATCH] =?UTF-8?q?bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/business/businessHandling/index.vue | 95 ++++++++++++++++--- src/views/business/discountApply/index.vue | 8 +- .../lease/apply/component/homeApply.vue | 2 +- .../repair/scrapLedgerReview/index.vue | 8 +- .../scrapManage/component/addToolsApply.vue | 2 +- .../scrapManage/component/queryToolsApply.vue | 2 +- .../material/report/goodsEntryReport.vue | 4 +- 7 files changed, 97 insertions(+), 24 deletions(-) diff --git a/src/views/business/businessHandling/index.vue b/src/views/business/businessHandling/index.vue index 627443dd..3b25e1b2 100644 --- a/src/views/business/businessHandling/index.vue +++ b/src/views/business/businessHandling/index.vue @@ -237,7 +237,7 @@ filterable clearable :disabled="isDetail" - @change="getTypeList(scope.row, $event)" + @change="(selectedIds) => getTypeList(scope.row, selectedIds, scope.$index)" > {{ scope.row.maTypeName }} @@ -252,9 +252,9 @@ filterable placeholder="请选择规格型号" :disabled="isDetail" - @change="changeTypeName(scope.row, $event)" + @change="(val) => changeTypeName(scope.row, val, getSelectedItemName(val,scope.row))" > - + {{ scope.row.typeName }} @@ -596,10 +596,37 @@ export default { console.log('🚀 ~ error:', error) } }, - // 获取规格型号 - async getTypeList(row, typeIds) { - // console.log('🚀 ~ getTypeList ~ row:', row) - // console.log('🚀 ~ getTypeList ~ typeId:', typeIds[typeIds.length - 1]) + // // 获取规格型号 + // async getTypeList(row, typeIds) { + // console.log('🚀 ~ getTypeList ~ row:', row) + // console.log('🚀 ~ getTypeList ~ typeId:', typeIds[typeIds.length - 1]) + // // 递归循环 获取类型名称 + // const filterData = data => { + // data.forEach(item => { + // if (item.typeId === typeIds[typeIds.length - 1]) { + // row.maTypeName = item.typeName + // } else { + // if (item.children && item.children.length) { + // filterData(item.children) + // } + // } + // }) + // } + // filterData(this.maTypeList) + // console.log('🚀 ~ getTypeList ~ maType:', row) + // row.typeId = '' + // row.unitName = '' + // try { + // const res = await getMaTypeOpt({ typeId: typeIds[typeIds.length - 1] }) + // // console.log('🚀 ~ getMaTypeOpt ~ res:', res) + // this.typeList = res.data + // } catch (error) { + // console.log('🚀 ~ error:', error) + // } + // }, + async getTypeList(row, typeIds, index) { + console.log('🚀 ~ getTypeList ~ row:', row) + console.log('🚀 ~ getTypeList ~ typeId:', typeIds[typeIds.length - 1]) // 递归循环 获取类型名称 const filterData = data => { data.forEach(item => { @@ -617,18 +644,53 @@ export default { row.typeId = '' row.unitName = '' try { + if (typeIds.length === 0) { + // 如果 typeIds 为空,则清空 typeList + row.typeList = [] + return + } const res = await getMaTypeOpt({ typeId: typeIds[typeIds.length - 1] }) - // console.log('🚀 ~ getMaTypeOpt ~ res:', res) - this.typeList = res.data + // 将每个条目的规格型号列表存储在各自的 row 对象中 + this.equipmentList[index].typeList = res.data } catch (error) { console.log('🚀 ~ error:', error) } + }, + + + getSelectedItemName(typeId,row) { + const selectedItem = row.typeList.find(item => item.typeId === typeId); + return selectedItem ? selectedItem.name : ''; }, // - changeTypeName(row, val) { - // console.log('🚀 ~ changeTypeName ~ row:', row) - // console.log('🚀 ~ changeTypeName ~ val:', val) - const type = this.typeList.find(item => item.typeId === val) + changeTypeName(row, val,name) { + console.log('🚀 ~ changeTypeName ~ row:', row) + console.log('🚀 ~ changeTypeName ~ val:', val) + this.equipmentList.some(item => { + // 跳过当前行 + if (item === row) return false; + if (item.typeId === val) { + this.$message({ + message: `${name} 已添加到列表中`, + type: 'warning' + }); + row.typeId = ''; + return true; + } + return false; + }); + // console.log('xxxxxxxxxxxxxxxxx', this.equipmentList.some(item => item.typeId === val)) + // if (this.equipmentList.some(item => item.typeId === val)) { + // // console.log("yyyyyyyyyyy",item.typeId) + // console.log("zzzzzzzzz",val) + // this.$message({ + // message: `${name} 已添加到列表中`, + // type: 'warning' + // }) + // row.typeId = '' + // return + // } + const type = row.typeList.find(item => item.typeId === val) // console.log('🚀 ~ changeTypeName ~ type:', type) row.unitName = type.unitName row.typeName = type.name @@ -873,7 +935,8 @@ export default { typeId: '', typeName: '', preNum: 0, - remark: '' + remark: '', + typeList: [] }) }, /** 保存按钮操作 */ @@ -884,6 +947,10 @@ export default { this.$refs['maForm'].validate(async valid => { if (valid) { for (let i = 0; i < this.equipmentList.length; i++) { + if(!this.equipmentList[i].typeId){ + this.$message.error(`第 ${i + 1} 行的 ${'规格型号'} 不能为空`) + return + } if (this.equipmentList[i].preNum <= 0) { this.$message.error(`第 ${i + 1} 行的 ${'预领数量必须大于0'} `) return diff --git a/src/views/business/discountApply/index.vue b/src/views/business/discountApply/index.vue index 5b5e3cb8..d4488ee8 100644 --- a/src/views/business/discountApply/index.vue +++ b/src/views/business/discountApply/index.vue @@ -537,9 +537,11 @@ export default { getReliefList(params).then((response) => { this.pushReviewList = response.data; console.log('22222222',this.pushReviewList) - this.leaseAll = this.pushReviewList.reduce((total, item) => { - return total + Number(item.leaseMoney); - }, 0); + this.leaseAll = Number( + this.pushReviewList.reduce((total, item) => { + return total + Number(item.leaseMoney); + }, 0).toFixed(2) + ); let obj = { id:null, leaseMoney: this.leaseAll, diff --git a/src/views/material/lease/apply/component/homeApply.vue b/src/views/material/lease/apply/component/homeApply.vue index 998b75d6..ac8e8809 100644 --- a/src/views/material/lease/apply/component/homeApply.vue +++ b/src/views/material/lease/apply/component/homeApply.vue @@ -445,7 +445,7 @@ export default { endTime: this.queryParams.time && this.queryParams.time[1], pageSize: this.queryParams.pageSize, pageNum: this.queryParams.pageNum, - statusList:[this.queryParams.taskStatus] + statusList: this.queryParams.taskStatus ? [this.queryParams.taskStatus]:this.dict.type.lease_task_status.map(item => item.value) }; getListLeaseApply(params).then((response) => { this.typeList = response.data.rows; diff --git a/src/views/material/repair/scrapLedgerReview/index.vue b/src/views/material/repair/scrapLedgerReview/index.vue index 15bd99c4..0dc414ac 100644 --- a/src/views/material/repair/scrapLedgerReview/index.vue +++ b/src/views/material/repair/scrapLedgerReview/index.vue @@ -66,7 +66,7 @@ 待审核周期:{{ reviewPeriod }} - 审核费用(万元):{{ reviewCost }} + 审核费用(元):{{ reviewCost.toFixed(2) }} @@ -94,7 +94,11 @@ - + + + {{ scope.row.totalCost.toFixed(2) }} + + diff --git a/src/views/material/repair/scrapManage/component/addToolsApply.vue b/src/views/material/repair/scrapManage/component/addToolsApply.vue index 31989966..2e89018c 100644 --- a/src/views/material/repair/scrapManage/component/addToolsApply.vue +++ b/src/views/material/repair/scrapManage/component/addToolsApply.vue @@ -124,7 +124,7 @@ :show-overflow-tooltip="true" />