From d3642faa7f79bc1e8992e528ad102587a2c44499 Mon Sep 17 00:00:00 2001 From: haoxuan <haoxuan> Date: 星期二, 16 四月 2024 15:27:42 +0800 Subject: [PATCH] 新增行的时候点击范围修改 --- src/views/productManage/silkRegisterForm/addPage.vue | 200 +++++++++++++++++++++++++++++++++++++------------ 1 files changed, 151 insertions(+), 49 deletions(-) diff --git a/src/views/productManage/silkRegisterForm/addPage.vue b/src/views/productManage/silkRegisterForm/addPage.vue index 16d2de0..6af9a0a 100644 --- a/src/views/productManage/silkRegisterForm/addPage.vue +++ b/src/views/productManage/silkRegisterForm/addPage.vue @@ -54,6 +54,7 @@ <el-date-picker v-model="form.finishDate" value-format="yyyy-MM-dd" + :picker-options="pickerOptions" type="date" placeholder="閫夋嫨鏃ユ湡" class="select-width" @@ -65,6 +66,7 @@ v-model="form.market" placeholder="璇烽�夋嫨" class="select-width" + @change="getGroupNumber" > <el-option v-for="item in marketList" @@ -80,6 +82,7 @@ v-model="form.name" placeholder="璇烽�夋嫨" class="select-width" + @change="getGroupNumber('name')" > <el-option v-for="item in nameList" @@ -110,14 +113,16 @@ <el-form-item label="缁勫埆" prop="workshopGroup" class="form-item"> <el-select v-model="form.workshopGroup" - placeholder="璇烽�夋嫨" + placeholder="璇峰厛閫夋嫨杞﹂棿" + no-data-text="璇峰厛閫夋嫨杞﹂棿" class="select-width" + @change="getGroupNumber()" > <el-option v-for="item in workshopGroupList" - :key="item.ID" - :label="item.name" - :value="item.ID" + :key="item" + :label="item" + :value="item" > </el-option> </el-select> @@ -206,7 +211,7 @@ >淇濆瓨</el-button > <!-- </template> -</CommonSearch> --> + </CommonSearch> --> </div> </div> <div class="body-two body"> @@ -319,9 +324,17 @@ </el-table-column> <el-table-column prop="finenessGradeye" label="閲庣氦" width="120"> </el-table-column> - <el-table-column prop="finenessGradebig" label="澶ч噹" show-overflow-tooltip> + <el-table-column + prop="finenessGradebig" + label="澶ч噹" + show-overflow-tooltip + > </el-table-column> - <el-table-column prop="finenessGradeSpecial" label="鐗归噹" width="120"> + <el-table-column + prop="finenessGradeSpecial" + label="鐗归噹" + width="120" + > </el-table-column> <el-table-column prop="finenessGrade" @@ -414,11 +427,12 @@ </template> <script> +// getWorkshopManageList import { saveRegister, getDictList, - getWorkshopManageList, getRegisterDetails, + getCarNumber } from "@/api/productManage/silkRegisterForm.js"; import { getCheckDetails, @@ -426,6 +440,7 @@ } from "@/api/productManage/silkInspectForm.js"; import pageMixin from "@/components/makepager/pager/mixin/pageMixin"; import CommonFormTableView from "@/components/makepager/CommonFormTableView"; +import { getWorkshopManageGroup } from "@/api/productManage/productRegisterForm.js"; export default { name: "silkRegisterAddPage", props: {}, @@ -453,6 +468,10 @@ finishDate: [ { required: true, message: "璇烽�夋嫨", trigger: ["change", "blur"] }, ], + // 搴勫彛 + market: [ + { required: true, message: "璇烽�夋嫨", trigger: ["change", "blur"] }, + ], // 杞﹂棿 搴旇true name: [ { required: true, message: "璇烽�夋嫨", trigger: ["change", "blur"] }, @@ -476,6 +495,11 @@ position: [ { required: true, message: "璇峰~鍐�", trigger: ["change", "blur"] }, ], + }, + pickerOptions: { + disabledDate(time) { + return time.getTime() < new Date().getTime() - 86400000; + }, }, tableTwoList: { tableInfomation: [], @@ -529,12 +553,18 @@ { label: "绾ゅ害鍚堣", prop: "sum", - inputNumber: true, - isRequird: true, }, // 涓嬫鍥炶鏃ユ湡 ], }, - tableData: [], + tableData: [ + { + productId: 1, + position: null, + fineness: null, + quantity: null, + sum: null, + } + ], registerId: "", inspectID: "", isRegisterSave: false, @@ -552,7 +582,7 @@ this.getDetailsData(); }, methods: { - getDetailsData(id) { + async getDetailsData(id) { if (this.activeName == "first") { this.form = { number: "", @@ -567,17 +597,24 @@ position: "", }; if (this.registerId) { - getRegisterDetails({ id: id ? id : this.registerId }).then( + await getRegisterDetails({ id: id ? id : this.registerId }).then( (response) => { if (response.code === 200) { let config = JSON.parse( JSON.stringify(response.data ? response.data : {}) ); this.form = config; - this.tableList.tableData = config.finenessList + this.getGroupNumber() + let finenessList=config.finenessList ? config.finenessList : []; - this.tableData=this.tableList.tableData + if(finenessList.length>0){ + finenessList.map((item,index)=>{ + item.productId=index+1 + }) + } + this.tableList.tableData = finenessList + this.tableData = this.tableList.tableData; } } ); @@ -615,27 +652,25 @@ this.form.finishDate = config.finenessRegister.finishDate; this.form.circle = config.finenessRegister.circle; this.getTableHeader(); - let arr= response.data.items - ? response.data.items - : []; - for(let i in arr){ - let round=arr[i].finenessRoundingItems - if(arr[i].finenessGrade){ - if(arr[i].finenessGrade.indexOf('閲庣氦')>-1){ - arr[i].finenessGradeye=arr[i].finenessGrade - }else if(arr[i].finenessGrade.indexOf('澶ч噹')>-1){ - arr[i].finenessGradebig=arr[i].finenessGrade - }else if(arr[i].finenessGrade.indexOf('鐗归噹')>-1){ - arr[i].finenessGradeSpecial=arr[i].finenessGrade - } - } - if(round){ - for(let j in round){ - arr[i][round[j].fineness]=round[j].quantity - } - } + let arr = response.data.items ? response.data.items : []; + for (let i in arr) { + let round = arr[i].finenessRoundingItems; + if (arr[i].finenessGrade) { + if (arr[i].finenessGrade.indexOf("閲庣氦") > -1) { + arr[i].finenessGradeye = arr[i].finenessGrade; + } else if (arr[i].finenessGrade.indexOf("澶ч噹") > -1) { + arr[i].finenessGradebig = arr[i].finenessGrade; + } else if (arr[i].finenessGrade.indexOf("鐗归噹") > -1) { + arr[i].finenessGradeSpecial = arr[i].finenessGrade; + } } - this.tableTwoList.tableInfomation =arr; + if (round) { + for (let j in round) { + arr[i][round[j].fineness] = round[j].quantity; + } + } + } + this.tableTwoList.tableInfomation = arr; } }); } @@ -711,11 +746,11 @@ } }); //缁勫埆 - getWorkshopManageList().then((res) => { - if (res.code == 200) { - this.workshopGroupList = res.data || []; - } - }); + // getWorkshopManageList().then((res) => { + // if (res.code == 200) { + // this.workshopGroupList = res.data || []; + // } + // }); //搴勫彛 getDictList({ dictType: 0, @@ -724,6 +759,55 @@ this.marketList = res.data || []; } }); + }, + async getGroupNumber(val) { + if (this.form.name) { + //缁勫埆 + let number = ""; + for (let i in this.nameList) { + if (this.nameList[i].name == this.form.name) { + number = this.nameList[i].number; + break; + } + } + await getWorkshopManageGroup({ number: number }).then((res) => { + if (res.code == 200) { + this.workshopGroupList = []; + let workshopGroupList = res.data || {}; + this.workshopGroupList=[] + if(val=='name'){ + this.form.workshopGroup='' + } + if (Object.keys(workshopGroupList).length > 0) { + for (let i in workshopGroupList) { + this.workshopGroupList.push(workshopGroupList[i]); + } + } + } + }) + if(this.form.workshopGroup&&this.form.market){ + getCarNumber({ + workshopName:this.form.name, + marketName:this.form.market, + groupNumber:this.form.workshopGroup, + }).then((res) => { + if (res.code == 200) { + this.tableData=[] + let data = res.data?JSON.parse(JSON.stringify(res.data)) : []; + if(Object.keys(data).length>0){ + for(let i in data){ + this.tableData.push({position:data[i],productId:Number(i)+1}) + } + } + this.tableList.tableData = this.tableData + }else{ + this.tableData=[] + } + }); + } + } else { + this.workshopGroupList = []; + } }, inputStart() { this.form.circleTwo = this.form.circle + "-" + this.form.totalCircle; @@ -748,7 +832,11 @@ if (item.productId === row.productId) { item[prop] = val; } + if(item.fineness&&item.quantity){ + item.sum=Number(item.fineness)*Number(item.quantity).toFixed(2) + } }); + this.tableList.tableData= this.tableData }, tabsClick() { // if (tab.name === "first") { @@ -800,13 +888,14 @@ sum: "", }, ]; - }else{ - this.form.measureFineness='' - this.form.twiceChange='' - this.form.cleanliness='' - this.form.purity='' - this.form.marketProcessOrderNumber='' - this.form.inspector='' + this.tableData =this.tableList.tableData + } else { + this.form.measureFineness = ""; + this.form.twiceChange = ""; + this.form.cleanliness = ""; + this.form.purity = ""; + this.form.marketProcessOrderNumber = ""; + this.form.inspector = ""; } }, // 淇濆瓨 @@ -815,15 +904,26 @@ if (valid) { let form = JSON.parse(JSON.stringify(this.form)); // params.workshopGroup=Number(params.workshopGroup) - this.isAddloading = true; if (this.activeName == "first") { delete form.circleTwo; let finenessList = JSON.parse( JSON.stringify(this.tableList.tableData) ); + let isContinue=false + for (let i in finenessList) { + if(!finenessList[i].position||!finenessList[i].fineness||!finenessList[i].quantity||!finenessList[i].sum){ + isContinue=true + break; + } + } + if(isContinue){ + this.$message.error('璇峰~鍐欏畬鏁村啀淇濆瓨锛�') + return true; + } for (let i in finenessList) { delete finenessList[i].productId; } + this.isAddloading = true; let params = { finenessList: finenessList, ...form, @@ -832,6 +932,7 @@ if (this.inspectID) { params.ID = this.form.ID ? this.form.ID : Number(this.inspectID); } + saveRegister(params) .then((res) => { if (res.code == 200) { @@ -861,6 +962,7 @@ ? this.form.ID : Number(this.registerId); } + this.isAddloading = true; saveCheck(paramsTwo) .then((res) => { if (res.code == 200) { @@ -868,7 +970,7 @@ message: "淇濆瓨鎴愬姛锛�", type: "success", }); - this.getDetailsData() + this.getDetailsData(); } this.isAddloading = false; }) -- Gitblit v1.8.0