| | |
| | | :silk-table-list="silkTableList" |
| | | @inputContent="inputContent" |
| | | @addProjectClick="addBtnClick" |
| | | :isEdit='isEdit' |
| | | @clearupProject="clearupProject" |
| | | @deleteClick="clearupProject" |
| | | @addColumnClick="addColumnClick" |
| | |
| | | { label: "特野", prop: "rankC", inputFloat: true } |
| | | ], |
| | | tableColumn: [], |
| | | columnNum: 0, |
| | | dataObj: { |
| | | checkItem: 1, |
| | | startFineness: 0, |
| | |
| | | currentIndex = index |
| | | } |
| | | }) |
| | | this.columnNum = list.length + 1 |
| | | for (let j = 0; j < list.length; j++) { |
| | | this.tableColumn.splice(currentIndex+j, 0, list[j]) |
| | | } |
| | |
| | | }, |
| | | // 保存编辑按钮切换 |
| | | 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) |
| | | ); |
| | |
| | | }, |
| | | // 添加列 |
| | | addColumnClick() { |
| | | let propStr = "prop" + this.columnNum |
| | | 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, |
| | |
| | | }) |
| | | this.tableData = allList |
| | | this.silkTableList.tableData = allList |
| | | this.$forceUpdate() |
| | | }, |
| | | // 删除列 |
| | | clearupColumn(prop) { |