From b2c2a77b5632b7e5f29a6cdce816bd977bc8604d Mon Sep 17 00:00:00 2001 From: haoxuan <haoxuan> Date: 星期四, 25 四月 2024 16:33:53 +0800 Subject: [PATCH] 车间管理 修改完成之后,再次打开 爆红的问题修改+新建薪资方案的前端开发+ --- src/views/productManage/silkRegisterForm/addPage.vue | 89 ++++++++++++++++++++++++++++++++++---------- 1 files changed, 68 insertions(+), 21 deletions(-) diff --git a/src/views/productManage/silkRegisterForm/addPage.vue b/src/views/productManage/silkRegisterForm/addPage.vue index 7b0000d..8a386e9 100644 --- a/src/views/productManage/silkRegisterForm/addPage.vue +++ b/src/views/productManage/silkRegisterForm/addPage.vue @@ -48,7 +48,7 @@ label-width="80px" > <el-form-item label="缂栧彿" prop="number" class="form-item"> - <el-input v-model="form.number" placeholder="璇疯緭鍏�"> </el-input> + <el-input v-model="form.number" :disabled="title=='淇敼'?true:false" placeholder="璇疯緭鍏�"> </el-input> </el-form-item> <el-form-item label="钀戒笣鏃堕棿" prop="finishDate" class="form-item"> <el-date-picker @@ -66,6 +66,7 @@ v-model="form.market" placeholder="璇烽�夋嫨" class="select-width" + @change="getGroupNumber" > <el-option v-for="item in marketList" @@ -81,7 +82,7 @@ v-model="form.name" placeholder="璇烽�夋嫨" class="select-width" - @change="getGroupNumber" + @change="getGroupNumber('name')" > <el-option v-for="item in nameList" @@ -115,7 +116,7 @@ placeholder="璇峰厛閫夋嫨杞﹂棿" no-data-text="璇峰厛閫夋嫨杞﹂棿" class="select-width" - @change="getGroupNumber" + @change="getGroupNumber()" > <el-option v-for="item in workshopGroupList" @@ -426,11 +427,12 @@ </template> <script> -// getWorkshopManageList, +// getWorkshopManageList import { saveRegister, getDictList, getRegisterDetails, + getCarNumber } from "@/api/productManage/silkRegisterForm.js"; import { getCheckDetails, @@ -449,6 +451,7 @@ computed: {}, data() { return { + title:'', loading: false, activeName: "first", searchOptions: [], @@ -464,6 +467,10 @@ { required: true, message: "璇峰~鍐�", trigger: ["change", "blur"] }, ], finishDate: [ + { required: true, message: "璇烽�夋嫨", trigger: ["change", "blur"] }, + ], + // 搴勫彛 + market: [ { required: true, message: "璇烽�夋嫨", trigger: ["change", "blur"] }, ], // 杞﹂棿 搴旇true @@ -547,8 +554,6 @@ { label: "绾ゅ害鍚堣", prop: "sum", - inputNumber: true, - isRequird: true, }, // 涓嬫鍥炶鏃ユ湡 ], }, @@ -572,13 +577,14 @@ this.activeName = query.activeName ? query.activeName : "first"; this.registerId = query.id ? query.id : ""; this.inspectID = query.inspectID ? query.inspectID : ""; + this.title= query.title ? query.title : ""; } this.getSelectDataList(); this.keyword = ""; this.getDetailsData(); }, methods: { - getDetailsData(id) { + async getDetailsData(id) { if (this.activeName == "first") { this.form = { number: "", @@ -593,14 +599,14 @@ 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.getGroupNumber() + this.getGroupNumber('','edit') let finenessList=config.finenessList ? config.finenessList : []; @@ -609,7 +615,6 @@ item.productId=index+1 }) } - console.log(finenessList,'===finenessList') this.tableList.tableData = finenessList this.tableData = this.tableList.tableData; } @@ -757,7 +762,7 @@ } }); }, - getGroupNumber() { + async getGroupNumber(val,type) { if (this.form.name) { //缁勫埆 let number = ""; @@ -767,17 +772,43 @@ break; } } - getWorkshopManageGroup({ number: number }).then((res) => { - if (res.code == 200) { - this.workshopGroupList = []; - let workshopGroupList = res.data || {}; - if (Object.keys(workshopGroupList).length > 0) { - for (let i in workshopGroupList) { - this.workshopGroupList.push(workshopGroupList[i]); + if(number){ + 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&&type!='edit'){ + await 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 = []; } @@ -787,7 +818,6 @@ }, // 浜у搧鏂板 addProductClick() { - debugger this.productId++; this.tableData.push({ productId: this.productId, @@ -806,7 +836,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") { @@ -874,15 +908,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, @@ -891,6 +936,7 @@ if (this.inspectID) { params.ID = this.form.ID ? this.form.ID : Number(this.inspectID); } + saveRegister(params) .then((res) => { if (res.code == 200) { @@ -920,6 +966,7 @@ ? this.form.ID : Number(this.registerId); } + this.isAddloading = true; saveCheck(paramsTwo) .then((res) => { if (res.code == 200) { -- Gitblit v1.8.0