From 5e9b4920000a4d02eef3b207218e3ce8d68935be Mon Sep 17 00:00:00 2001 From: charles <981744753@qq.com> Date: 星期四, 11 七月 2024 17:47:05 +0800 Subject: [PATCH] feat:纤度登记表重构 --- src/views/productManage/silkRegisterForm/addPage.vue | 65 +++++++++++++++++++++++--------- 1 files changed, 47 insertions(+), 18 deletions(-) diff --git a/src/views/productManage/silkRegisterForm/addPage.vue b/src/views/productManage/silkRegisterForm/addPage.vue index 0260ee3..e8967a6 100644 --- a/src/views/productManage/silkRegisterForm/addPage.vue +++ b/src/views/productManage/silkRegisterForm/addPage.vue @@ -36,7 +36,6 @@ </CommonSearch> </div> </div> - <div class="body"> <div class="body-l"> <el-form @@ -430,7 +429,8 @@ saveRegister, getDictList, getRegisterDetails, - getCarNumber + getCarNumber, + getAutoCode } from "@/api/productManage/silkRegisterForm.js"; import { getCheckDetails, @@ -440,8 +440,6 @@ //import CommonFormTableView from "@/components/makepager/CommonFormTableView"; import { getWorkshopManageGroup } from "@/api/productManage/productRegisterForm.js"; import FormTableView from '@/views/productManage/silkRegisterForm/components/FormTableView.vue'; -import moment from 'moment'; -let idValue=moment(new Date()).format('YYYYMMDDHHmmss'); export default { name: "silkRegisterAddPage", props: {}, @@ -462,7 +460,7 @@ deliveryTypeList: [], specList: [], //瑙勬牸 form: { - number:idValue + number:'' }, rules: { number: [ @@ -531,7 +529,7 @@ productId: 1, position: null, fineness: null, - quantity: null, + quantity: 0, sum: null, }, ], @@ -541,18 +539,20 @@ prop: "position", inputNumber: true, isRequird: true, + noOperate:true }, // 瀹㈡埛鍚嶇О { label: "绾ゅ害鍊�", prop: "fineness", inputNumber: true, - isRequird: true, + isRequird: true }, // 閿�鍞礋璐d汉 { label: "鏁伴噺", prop: "quantity", inputNumber: true, isRequird: true, + noOperate:true }, // 閲嶈绾у埆 { label: "绾ゅ害鍚堣", @@ -587,10 +587,18 @@ this.getDetailsData(); }, methods: { + async getAutoCode(){ + const {code,data}=await getAutoCode({type:2}); + if(code===200){ + return data.id; + } + return ''; + }, async getDetailsData(id) { + const code= await this.getAutoCode() if (this.activeName == "first") { this.form = { - number: idValue, + number: code, finishDate:this.$moment(new Date()).format('YYYY-MM-DD'), market: "", workshopObj: "", @@ -630,7 +638,7 @@ } } else { this.form = { - number: idValue, + number: code, workshopObj: "", workshopGroup: "", circle: "", @@ -798,7 +806,13 @@ this.tableData=[] const {startCarNumber,endCarNumber,startCarHalf,endCarHalf}=res.data; for(let i=startCarNumber;i<=endCarNumber;i++){ - if(i===startCarNumber){ + if((i===startCarNumber&&startCarHalf===2)||(i===endCarNumber&&endCarHalf===1)){ + this.tableData.push({position:i,productId:Number(i)*2-1,quantity:1}); + }else{ + this.tableData.push({position:i,productId:Number(i)*2-1,quantity:1}); + this.tableData.push({position:i,productId:Number(i)*2,quantity:1}); + } + /*if(i===startCarNumber){ if(startCarHalf===1){//宸﹀崐杞� this.tableData.push({position:i,productId:Number(i)*2-1}); this.tableData.push({position:i,productId:Number(i)*2}); @@ -815,7 +829,7 @@ }else{ this.tableData.push({position:i,productId:Number(i)*2-1}); this.tableData.push({position:i,productId:Number(i)*2}); - } + }*/ } /*let data = res.data?JSON.parse(JSON.stringify(res.data)) : []; if(Object.keys(data).length>0){ @@ -890,10 +904,11 @@ }, // 绾ゅ害鐧昏琛� // 鏀惧純 - cancelClickOne() { + async cancelClickOne() { + const code=await this.getAutoCode() if (this.activeName == "first") { this.form = { - number: idValue, + number: code, finishDate:this.$moment(new Date()).format('YYYY-MM-DD'), market: "", workshopObj: "", @@ -911,7 +926,7 @@ productId: 1, position: "", fineness: 0, - quantity: 0, + quantity: 1, sum: "", }, ]; @@ -951,6 +966,22 @@ delete finenessList[i].productId; } this.isAddloading = true; + const mapFineness=new Map(); + finenessList.forEach(item=>{ + if(mapFineness.has(item.position)){ + const value=mapFineness.get(item.position); + if(value[0].fineness===item.fineness){ + value[0].sum+=item.sum; + value[0].quantity+=item.quantity; + }else{ + value.push(item); + } + mapFineness.set(item.position,value); + } else{ + mapFineness.set(item.position,[item]); + } + }); + finenessList=[...mapFineness.values()].flat(Infinity); let params = { finenessList: finenessList, ...form, @@ -969,7 +1000,6 @@ message: "淇濆瓨鎴愬姛锛�", type: "success", }); - this.activeName = "second" // this.$router.push({ // path: "/productManage/silkRegisterForm", @@ -984,7 +1014,6 @@ }); } else { let paramsTwo = { - // ...form, info:form, items:this.tableTwoList.tableInfomation, }; @@ -1005,8 +1034,7 @@ this.getDetailsData(); } this.isAddloading = false; - }) - .catch(() => { + }).catch(() => { setTimeout(() => { this.isAddloading = false; }, 3000); @@ -1109,6 +1137,7 @@ } .list-view { + margin-top: 20px; height: calc(100% - 180px); min-height: 200px; overflow-y: auto; -- Gitblit v1.8.0