From 61500a41c6559976a56e49e1d07f8f5370a4031b Mon Sep 17 00:00:00 2001 From: haoxuan <haoxuan> Date: 星期三, 17 四月 2024 17:54:36 +0800 Subject: [PATCH] 车间查询组别的接口,增加了限制,没有车间的编号不请求接口 --- src/views/systemSetting/silkStandardSetting/index.vue | 111 +++++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 83 insertions(+), 28 deletions(-) diff --git a/src/views/systemSetting/silkStandardSetting/index.vue b/src/views/systemSetting/silkStandardSetting/index.vue index ea8f6f5..83a6048 100644 --- a/src/views/systemSetting/silkStandardSetting/index.vue +++ b/src/views/systemSetting/silkStandardSetting/index.vue @@ -10,8 +10,8 @@ </CommonSearch> </div> <div class="body-card"> - <div class="edit-save"> - <div class="edit-save-icon" @click="editSaveClick"> + <div class="edit-save" @click="editSaveClick"> + <div class="edit-save-icon"> <i :class="isEdit ? 'el-icon-unlock' : 'el-icon-lock'"></i> </div> <div class="edit-sace-label">{{ isEdit ? "閿佸畾淇濆瓨" : "鐣岄潰璁捐" }}</div> @@ -55,7 +55,7 @@ prop: "checkItem", projectName: true, isCallMethod: true, - getCallMethod: this.getCheckItemName + getCallMethod: this.getCheckItemName, }, { label: "寮�濮嬬氦搴�", prop: "startFineness", inputFloat: true }, { label: "缁撴潫绾ゅ害", prop: "endFineness", inputFloat: true }, @@ -91,7 +91,21 @@ if (res.code === 200) { if (res.data.length > 0) { this.tableData = [] - this.tableColumn = this.defaultColumn + this.tableColumn = [ + { + label: "妫�鏌ラ」鐩悕绉�", + prop: "checkItem", + projectName: true, + isCallMethod: true, + getCallMethod: this.getCheckItemName, + }, + { label: "寮�濮嬬氦搴�", prop: "startFineness", inputFloat: true }, + { label: "缁撴潫绾ゅ害", prop: "endFineness", inputFloat: true }, + { label: "閲庣氦", prop: "rankA", inputFloat: true }, + { label: "澶ч噹", prop: "rankB", inputFloat: true }, + { label: "鐗归噹", prop: "rankC", inputFloat: true } + ] + // this.tableColumn=this.defaultColumn this.columnDataProcess(res.data[0].dynamicsRanks) this.rankObj = {} this.allDataProcess(res.data) @@ -126,11 +140,16 @@ inputFloat: true } }) + let currentIndex=0 + this.tableColumn.map((item, index) => { + if (item.prop == 'rankA') { + currentIndex = index + } + }) this.columnNum = list.length + 1 for (let j = 0; j < list.length; j++) { - this.tableColumn.splice(2, 0, list[j]) + this.tableColumn.splice(currentIndex, 0, list[j]) } - console.log(this.tableColumn) this.silkTableList.tableColumn = this.tableColumn }, setTableForm() { @@ -138,14 +157,15 @@ tableData: this.tableData, isReturn: false, tableColumn: [ - { label: "妫�鏌ラ」鐩悕绉�", prop: "projectName", projectName: true }, - { label: "寮�濮嬬氦搴�", prop: "start", inputFloat: true }, - { label: "缁撴潫绾ゅ害", prop: "end", inputFloat: true }, - { label: "閲庣氦", prop: "price1", inputFloat: true }, - { label: "澶ч噹", prop: "price2", inputFloat: true }, - { label: "鐗归噹", prop: "price3", inputFloat: true } + { label: "妫�鏌ラ」鐩悕绉�", prop: "checkItem", projectName: true }, + { label: "寮�濮嬬氦搴�", prop: "startFineness", inputFloat: true }, + { label: "缁撴潫绾ゅ害", prop: "endFineness", inputFloat: true }, + { label: "閲庣氦", prop: "rankA", inputFloat: true }, + { label: "澶ч噹", prop: "rankB", inputFloat: true }, + { label: "鐗归噹", prop: "rankC", inputFloat: true } ] } + this.tableColumn=this.silkTableList.tableColumn }, // 鎼滅储 onFilterSearch(searchText) { @@ -153,14 +173,20 @@ }, // 鏂板 addBtnClick() { - this.tableData.push({ - projectName: "", - start: 0, - end: 0, - price1: 0, - price2: 0, - price3: 0 - }) + if(this.isEdit){ + this.tableData.push({ + projectName: "", + start: 0, + end: 0, + price1: 0, + price2: 0, + price3: 0 + }) + this.silkTableList.tableData=this.tableData + }else{ + this.$message.error('璇峰厛瑙i攣鍐嶆柊澧烇紒') + } + }, // 鍒锋柊 refreshClick() { @@ -199,12 +225,18 @@ // 淇濆瓨缂栬緫鎸夐挳鍒囨崲 editSaveClick() { this.isEdit = !this.isEdit + let tableData=JSON.parse( + JSON.stringify(this.silkTableList.tableData) + ); + if(tableData.length==0&&!this.isEdit){ + this.$message.error('璇峰厛鏂板鍐嶄繚瀛�!') + return true; + } if (!this.isEdit) { - let params = this.saveParam() + let params = this.saveParam(tableData) saveRankStandard({ rankStandard: params }).then((res) => { - console.log(res) if (res.code == 200) { this.$message.success("淇濆瓨鎴愬姛") this.getData() @@ -212,8 +244,18 @@ }) } }, - saveParam() { - let saveList = this.tableData.map((item) => { + saveParam(tableData) { + for(let i in tableData){ + tableData[i].dynamicsRanks=[] + for(let j in this.columnInputList){ + tableData[i].dynamicsRanks.push({ + rankName:this.columnInputList[j].rankName, + rankProp:this.columnInputList[j].rankProp, + rankValue:tableData[i][this.columnInputList[j].rankProp] + }) + } + } + let saveList = tableData.map((item) => { return { checkItem: item.checkItem, dynamicsRanks: item.dynamicsRanks, @@ -230,10 +272,15 @@ // 娣诲姞鍒� addColumnClick() { let propStr = "prop" + this.columnNum - this.tableColumn.splice(2, 0, { label: "", prop: propStr, inputFloat: true, addColumn: true }) + let currentIndex=0 + this.tableColumn.map((item, index) => { + if (item.prop == 'rankA') { + currentIndex = index + } + }) + this.tableColumn.splice(currentIndex, 0, { label: "", prop: propStr, inputFloat: true, addColumn: true }) this.$set(this.dataObj, propStr, 0) this.$set(this.rankObj, propStr, 0) - console.log(this.columnInputList) this.columnInputList.push({ rankProp: propStr, rankName: "", rankValue: 0 }) console.log(this.tableColumn, this.dataObj, "32323", this.columnInputList) this.silkTableList.tableColumn = this.tableColumn @@ -255,6 +302,13 @@ currentIndex = index } }) + let columnInputIndex=0 + this.columnInputList.forEach((item,index) => { + if (item.rankProp == prop) { + columnInputIndex = index + } + }) + this.columnInputList.splice(columnInputIndex,1) this.tableColumn.splice(currentIndex, 1) this.silkTableList.tableColumn = this.tableColumn this.$delete(this.dataObj, prop) @@ -267,7 +321,6 @@ item.rankName = val } }) - console.log(this.columnInputList, "888") }, getCheckItemName(val) { if (val) { @@ -304,13 +357,15 @@ height: calc(100% - 180px); border-radius: 4px; .edit-save { + width:100px; + padding:0 10px; display: flex; align-items: center; margin-bottom: 10px; + cursor: pointer; .edit-save-icon { font-size: 24px; color: #5582f3; - cursor: pointer; } .edit-sace-label { margin-left: 10px; -- Gitblit v1.8.0