From f991aa8e159ab30b79f7468883dc63f192af750b Mon Sep 17 00:00:00 2001
From: haoxuan <haoxuan>
Date: 星期一, 29 四月 2024 14:00:48 +0800
Subject: [PATCH] 1
---
src/views/systemSetting/silkStandardSetting/index.vue | 100 ++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 77 insertions(+), 23 deletions(-)
diff --git a/src/views/systemSetting/silkStandardSetting/index.vue b/src/views/systemSetting/silkStandardSetting/index.vue
index 5fa150d..9d315e1 100644
--- a/src/views/systemSetting/silkStandardSetting/index.vue
+++ b/src/views/systemSetting/silkStandardSetting/index.vue
@@ -22,6 +22,7 @@
:silk-table-list="silkTableList"
@inputContent="inputContent"
@addProjectClick="addBtnClick"
+ :isEdit='isEdit'
@clearupProject="clearupProject"
@deleteClick="clearupProject"
@addColumnClick="addColumnClick"
@@ -55,7 +56,7 @@
prop: "checkItem",
projectName: true,
isCallMethod: true,
- getCallMethod: this.getCheckItemName
+ getCallMethod: this.getCheckItemName,
},
{ label: "寮�濮嬬氦搴�", prop: "startFineness", inputFloat: true },
{ label: "缁撴潫绾ゅ害", prop: "endFineness", inputFloat: true },
@@ -64,7 +65,6 @@
{ label: "鐗归噹", prop: "rankC", inputFloat: true }
],
tableColumn: [],
- columnNum: 0,
dataObj: {
checkItem: 1,
startFineness: 0,
@@ -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,15 @@
inputFloat: true
}
})
- this.columnNum = list.length + 1
+ let currentIndex=0
+ this.tableColumn.map((item, index) => {
+ if (item.prop == 'rankA') {
+ currentIndex = index
+ }
+ })
for (let j = 0; j < list.length; j++) {
- this.tableColumn.splice(2, 0, list[j])
+ this.tableColumn.splice(currentIndex+j, 0, list[j])
}
- console.log(this.tableColumn)
this.silkTableList.tableColumn = this.tableColumn
},
setTableForm() {
@@ -138,14 +156,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,8 +172,10 @@
},
// 鏂板
addBtnClick() {
+ console.log(this.silkTableList.tableData,'===1')
+ console.log(this.tableData,'===2')
if(this.isEdit){
- this.tableData.push({
+ this.silkTableList.tableData.push({
projectName: "",
start: 0,
end: 0,
@@ -162,6 +183,7 @@
price2: 0,
price3: 0
})
+ this.tableData=this.silkTableList.tableData
}else{
this.$message.error('璇峰厛瑙i攣鍐嶆柊澧烇紒')
}
@@ -198,19 +220,33 @@
},
// 鍒犻櫎
clearupProject(data, index) {
- console.log(data)
this.tableData.splice(index, 1)
+ this.silkTableList.tableData=this.tableData
},
// 淇濆瓨缂栬緫鎸夐挳鍒囨崲
editSaveClick() {
+ let isOk=false;
+ this.silkTableList.tableColumn.map((item)=>{
+ if(!item.label||!item.prop){
+ isOk=true
+ }
+ })
+ if(isOk){
+ this.$message.error('璇峰厛濉啓瀹屾垚琛ㄥご锛�')
+ return true;
+ }
this.isEdit = !this.isEdit
+ this.silkTableList.tableData.map((item)=>{
+ item.addColumn=false;
+ })
+
let tableData=JSON.parse(
JSON.stringify(this.silkTableList.tableData)
);
- if(tableData.length==0&&!this.isEdit){
- this.$message.error('璇峰厛鏂板鍐嶄繚瀛�!')
- return true;
- }
+ // if(tableData.length==0&&!this.isEdit){
+ // this.$message.error('璇峰厛鏂板鍐嶄繚瀛�!')
+ // return true;
+ // }
if (!this.isEdit) {
let params = this.saveParam(tableData)
saveRankStandard({
@@ -250,14 +286,25 @@
},
// 娣诲姞鍒�
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
+ }
+ })
+ let num=0
+ if(this.tableColumn.length>0){
+ if(this.tableColumn[Number(currentIndex)-1].prop.indexOf('prop')!=-1){
+ num=this.tableColumn[Number(currentIndex)-1].prop.slice(4)
+ }
+ }
+ let propStr = "prop" + (Number(num)+1)
+
+ this.tableColumn.splice(currentIndex, 0, { label: "", prop: propStr, inputFloat: true, addColumn: true })
this.$set(this.dataObj, propStr, 0)
this.$set(this.rankObj, propStr, 0)
this.columnInputList.push({ rankProp: propStr, rankName: "", rankValue: 0 })
- console.log(this.tableColumn, this.dataObj, "32323", this.columnInputList)
this.silkTableList.tableColumn = this.tableColumn
- this.columnNum += 1
let allList = this.tableData.map((item) => {
return {
...item,
@@ -266,6 +313,7 @@
})
this.tableData = allList
this.silkTableList.tableData = allList
+ this.$forceUpdate()
},
// 鍒犻櫎鍒�
clearupColumn(prop) {
@@ -275,13 +323,19 @@
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)
},
// 鍒楄〃澶磋緭鍏ュ洖璋�
addColumnInputChange(val, prop) {
- console.log(val, prop, this.columnInputList)
this.columnInputList.forEach((item) => {
if (item.rankProp == prop) {
item.rankName = val
--
Gitblit v1.8.0