|
@@ -121,10 +121,10 @@
|
|
|
</vxe-column>
|
|
|
<vxe-column title="操作" width="230px" fixed="right" align="center">
|
|
|
<template #default="scope">
|
|
|
- <el-button v-if="scope.row.level === '1'" :disabled="status === 'audit' || status === 'taskFormDetail'" text type="primary" @click="add(scope.row)">添加</el-button>
|
|
|
- <el-button v-if="scope.row.level !== '1'" :disabled="status === 'audit' || status === 'taskFormDetail'" text type="primary" @click="edit(scope.row)">修改</el-button>
|
|
|
+ <el-button v-if="scope.row.level === '1'" :disabled="status === 'audit' || status === 'taskFormDetail'" text type="primary" @click="add(scope.row)">编辑</el-button>
|
|
|
+<!-- <el-button v-if="scope.row.level !== '1'" :disabled="status === 'audit' || status === 'taskFormDetail'" text type="primary" @click="edit(scope.row)">编辑</el-button>-->
|
|
|
<el-button text type="primary" v-if="scope.row.level === '1'" :disabled ="scope.row.level === '1' && commonJS.isNotEmpty(scope.row.children)" @click="removeEvent(scope.row,scope.$rowIndex)">删除</el-button>
|
|
|
- <el-button text type="primary" v-if="scope.row.level !== '1'" :disabled="status === 'audit' || status === 'taskFormDetail'" @click="removeChildEvent(scope.row)">删除</el-button>
|
|
|
+<!-- <el-button text type="primary" v-if="scope.row.level !== '1'" :disabled="status === 'audit' || status === 'taskFormDetail'" @click="removeChildEvent(scope.row)">删除</el-button>-->
|
|
|
</template>
|
|
|
</vxe-column>
|
|
|
</vxe-table>
|
|
@@ -479,34 +479,63 @@
|
|
|
}
|
|
|
console.log('row',rows)
|
|
|
rows.forEach(item => {
|
|
|
- let d={
|
|
|
- reportId: item.reportId,
|
|
|
- projectNumber : item.projectNumber,
|
|
|
- name : item.name,
|
|
|
- no :item.no,
|
|
|
- parentId :'',
|
|
|
- level:item.level,
|
|
|
- id:item.reportId
|
|
|
+ const isExist = this.inputForm.cwFillingbatchProjects.some(existingItem => existingItem.reportId === item.reportId);
|
|
|
+ if (!isExist){
|
|
|
+ let d={
|
|
|
+ reportId: item.reportId,
|
|
|
+ projectNumber : item.projectNumber,
|
|
|
+ name : item.name,
|
|
|
+ no :item.no,
|
|
|
+ parentId :'',
|
|
|
+ level:item.level,
|
|
|
+ id:item.reportId
|
|
|
+ }
|
|
|
+ this.$refs.batchTable.insertAt(d)
|
|
|
+ this.inputForm.cwFillingbatchProjects.push(d)
|
|
|
+ this.tableKeyProject = Math.random()
|
|
|
}
|
|
|
- this.$refs.batchTable.insertAt(d)
|
|
|
- this.inputForm.cwFillingbatchProjects.push(d)
|
|
|
- this.tableKeyProject = Math.random()
|
|
|
+
|
|
|
})
|
|
|
console.log('this.inputForm.cwFillingbatchProjects',this.inputForm.cwFillingbatchProjects)
|
|
|
},
|
|
|
add(row){
|
|
|
this.$refs.fileForm.init('add',row)
|
|
|
},
|
|
|
- getFile(list){
|
|
|
+ getFile(list, parentId){
|
|
|
console.log('list',list)
|
|
|
+ console.log('this.inputForm.cwFillingbatchProjects',this.inputForm.cwFillingbatchProjects)
|
|
|
|
|
|
- list.forEach(item=>{
|
|
|
- if (this.commonJS.isEmpty(item.id)){
|
|
|
- this.$refs.batchTable.insertAt(item)
|
|
|
- this.inputForm.cwFillingbatchProjects.push(item)
|
|
|
- this.tableKeyProject = Math.random()
|
|
|
+ this.inputForm.cwFillingbatchProjects.forEach(item=>{
|
|
|
+ if(item.id == parentId || item.reportId == parentId){
|
|
|
+ item.children = []
|
|
|
}
|
|
|
})
|
|
|
+ this.inputForm.cwFillingbatchProjects = this.inputForm.cwFillingbatchProjects.filter(item=>{
|
|
|
+ return item.parentId != parentId
|
|
|
+ })
|
|
|
+
|
|
|
+ //重新添加子级
|
|
|
+ list.forEach(item => {
|
|
|
+ console.log('item',item)
|
|
|
+ this.inputForm.cwFillingbatchProjects.forEach(it =>{
|
|
|
+ // 如果 item 需要被作为 parentId 的子节点添加
|
|
|
+ if (it.level == '1' && (item.parentId === it.id || it.reportId == item.parentId)) {
|
|
|
+ // 确保 item 是作为子节点添加
|
|
|
+ let d={
|
|
|
+ projectNumber : item.projectNumber,
|
|
|
+ name : item.name,
|
|
|
+ parentId :item.parentId,
|
|
|
+ children : []
|
|
|
+ }
|
|
|
+ it.children.push(d); // 添加到父级的子级数组中
|
|
|
+ // 同时也要将子节点添加到 cwFillingbatchProjects
|
|
|
+ this.inputForm.cwFillingbatchProjects.push(d);
|
|
|
+ // 插入表格
|
|
|
+ this.$refs.batchTable.insertAt(d);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ });
|
|
|
+ // inputForm.cwFillingbatchProjects
|
|
|
console.log('this.inputForm.cwFillingbatchProjects1',this.inputForm.cwFillingbatchProjects)
|
|
|
},
|
|
|
removeEvent(row,rowIndex){
|