修改收集清单的更新参数列数据

This commit is contained in:
范强强
2023-02-03 10:21:34 +08:00
parent 941ada66ef
commit c6fcaaf773
3 changed files with 918 additions and 584 deletions
File diff suppressed because it is too large Load Diff
@@ -58,7 +58,7 @@
<!-- </span>-->
<!-- </span>-->
<span slot="detailClick" slot-scope="text,record">
<collection-type :detailDate='text'/>
<collection-type @consolidateData="consolidateData" :detailDate='text'/>
</span>
</a-table>
</div>
@@ -293,6 +293,7 @@
detailDateList: [],
selectedRowKeys: [],
selectedRowrowValue: [],
description:'',
dataSource: [],
pageNo: 1,
pageSize: 100,
@@ -653,13 +654,24 @@
if (this.currentPersonRole !== 'dre') {
res.result.records.forEach((Obj) => {
Object.keys(Obj).forEach((item) => {
if (Obj[item] instanceof Object && Obj[item].controlType !== undefined) {
Obj[item].list.forEach((itemLi) => {
itemLi.isLock = 1
if (itemLi.type === 'pull_more') {
itemLi.dataValue = itemLi.dataValue === null ? [] : itemLi.dataValue.split(',')
}
})
for (const key in Obj[item].paramsConfigData){
Obj[item].paramsConfigData[key].forEach((itemLi) =>
{
itemLi.isLock = 1
if (itemLi.type === 'pull_more') {
itemLi.dataValue = itemLi.dataValue === null ? [] : itemLi.dataValue.split(',')
}
})
}
// Obj[item].list.forEach((itemLi) => {
// itemLi.isLock = 1
// if (itemLi.type === 'pull_more') {
// itemLi.dataValue = itemLi.dataValue === null ? [] : itemLi.dataValue.split(',')
// }
// })
}
})
tt.push(Obj)
@@ -668,11 +680,18 @@
res.result.records.forEach((Obj) => {
Object.keys(Obj).forEach((item) => {
if (Obj[item] instanceof Object && Obj[item].controlType !== undefined) {
Obj[item].list.forEach((itemLi) => {
if (itemLi.type === 'pull_more') {
itemLi.dataValue = itemLi.dataValue === null ? [] : itemLi.dataValue.split(',')
}
})
for (const key in Obj[item].paramsConfigData){
Obj[item].paramsConfigData[key].forEach((itemLi) => {
if (itemLi.type === 'pull_more') {
itemLi.dataValue = itemLi.dataValue === null ? [] : itemLi.dataValue.split(',')
}
})
}
// Obj[item].list.forEach((itemLi) => {
// if (itemLi.type === 'pull_more') {
// itemLi.dataValue = itemLi.dataValue === null ? [] : itemLi.dataValue.split(',')
// }
// })
}
})
tt.push(Obj)
@@ -693,6 +712,9 @@
cancleoperationFailed() {
this.selectedRowKeys = []
},
consolidateData(){
this.dataSource = [...this.dataSource]
},
getTableList(currentPersonRole) {
console.log(this.url.tableList)
let paramsManifestid
@@ -734,28 +756,56 @@
// })
let tt = []
if (this.currentPersonRole !== 'dre') {
console.log(res.result.records, 'res.result.records')
res.result.records.forEach((Obj) => {
Object.keys(Obj).forEach((item) => {
if (Obj[item] instanceof Object && Obj[item].controlType !== undefined) {
Obj[item].list.forEach((itemLi) => {
itemLi.isLock = 1
if (itemLi.type === 'pull_more') {
itemLi.dataValue = itemLi.dataValue === null ? [] : itemLi.dataValue.split(',')
}
})
for (const key in Obj[item].paramsConfigData){
Obj[item].paramsConfigData[key].forEach((itemLi) => {
console.log(item)
if((this.currentPersonRole == 'homo' || this.currentPersonRole == 'admin') && item == 'referencesCol'){
itemLi.isLock = 0
}else{
itemLi.isLock = 1
}
if (itemLi.type === 'pull_more') {
itemLi.dataValue = !itemLi.dataValue ? [] : itemLi.dataValue.split(',')
}
})
}
// Obj[item].list.forEach((itemLi) => {
// console.log(item)
// if((this.currentPersonRole == 'homo' || this.currentPersonRole == 'admin') && item == 'referencesCol'){
// itemLi.isLock = 0
// }else{
// itemLi.isLock = 1
// }
// if (itemLi.type === 'pull_more') {
// itemLi.dataValue = !itemLi.dataValue ? [] : itemLi.dataValue.split(',')
// }
// })
}
})
tt.push(Obj)
})
} else {
res.result.records.forEach((Obj) => {
Object.keys(Obj).forEach((item) => {
if (Obj[item] instanceof Object && Obj[item].controlType !== undefined) {
Obj[item].list.forEach((itemLi) => {
if (itemLi.type === 'pull_more') {
itemLi.dataValue = itemLi.dataValue === null ? [] : itemLi.dataValue.split(',')
}
})
for (const key in Obj[item].paramsConfigData){
Obj[item].paramsConfigData[key].forEach((itemLi) => {
if (itemLi.type === 'pull_more') {
itemLi.dataValue = !itemLi.dataValue ? [] : itemLi.dataValue.split(',')
}
})
}
// Obj[item].list.forEach((itemLi) => {
// if (itemLi.type === 'pull_more') {
// itemLi.dataValue = !itemLi.dataValue ? [] : itemLi.dataValue.split(',')
// }
// })
}
})
tt.push(Obj)
@@ -316,34 +316,69 @@
data.forEach(res => {
selectedRowKeysValue.push(res)
})
console.log(selectedRowKeysValue)
for (let i = 0; i < selectedRowKeysValue.length; i++) {
let postDateobj = {}
let itemIn = Object.keys(selectedRowKeysValue[i])
for (let j = 0; j < itemIn.length; j++) {
if (itemIn[j] !== 'sdt' && selectedRowKeysValue[i][itemIn[j]].list) {
if (selectedRowKeysValue[i][itemIn[j]] instanceof Object && !(selectedRowKeysValue[i][itemIn[j]] instanceof Array)) {
postDateobj[itemIn[j]] = selectedRowKeysValue[i][itemIn[j]]
for (let k = 0; k < selectedRowKeysValue[i][itemIn[j]].list.length; k++) {
if (selectedRowKeysValue[i][itemIn[j]].list[k].type == 'pull_more' && selectedRowKeysValue[i][itemIn[j]].list[k].dataValue !== null && selectedRowKeysValue[i][itemIn[j]].list[k].dataValue instanceof Array) {
selectedRowKeysValue[i][itemIn[j]].list[k].dataValue = selectedRowKeysValue[i][itemIn[j]].list[k].dataValue.join(',')
}
if (selectedRowKeysValue[i][itemIn[j]].list[k].type == 'text' && selectedRowKeysValue[i][itemIn[j]].list[k].dataValue !== null) {
selectedRowKeysValue[i][itemIn[j]].list[k].dataValue = selectedRowKeysValue[i][itemIn[j]].list[k].dataValue.toString()
// console.log(selectedRowKeysValue)
// for (let i = 0; i < selectedRowKeysValue.length; i++) {
// let postDateobj = {}
// let itemIn = Object.keys(selectedRowKeysValue[i])
// for (let j = 0; j < itemIn.length; j++) {
// if (itemIn[j] !== 'sdt' && selectedRowKeysValue[i][itemIn[j]].list) {
// if (selectedRowKeysValue[i][itemIn[j]] instanceof Object && !(selectedRowKeysValue[i][itemIn[j]] instanceof Array)) {
// postDateobj[itemIn[j]] = selectedRowKeysValue[i][itemIn[j]]
// for (let k = 0; k < selectedRowKeysValue[i][itemIn[j]].list.length; k++) {
// if (selectedRowKeysValue[i][itemIn[j]].list[k].type == 'pull_more' && selectedRowKeysValue[i][itemIn[j]].list[k].dataValue !== null && selectedRowKeysValue[i][itemIn[j]].list[k].dataValue instanceof Array) {
// selectedRowKeysValue[i][itemIn[j]].list[k].dataValue = selectedRowKeysValue[i][itemIn[j]].list[k].dataValue.join(',')
// }
// if (selectedRowKeysValue[i][itemIn[j]].list[k].type == 'text' && selectedRowKeysValue[i][itemIn[j]].list[k].dataValue !== null) {
// selectedRowKeysValue[i][itemIn[j]].list[k].dataValue = selectedRowKeysValue[i][itemIn[j]].list[k].dataValue.toString()
// }
// }
// }
// }
// }
// postDateobj.id = selectedRowKeysValue[i].id
// postDateobj.remarks = selectedRowKeysValue[i].remarks
// postDate.push(postDateobj)
// }
// let configDataList = { configDataList: postDate }
if (selectedRowKeysValue && selectedRowKeysValue.length > 0) {
let configDataList = []
for (let i = 0; i < selectedRowKeysValue.length; i++) {
configDataList.push({
id: selectedRowKeysValue[i].id
})
if (selectedRowKeysValue[i].configIds && selectedRowKeysValue[i].configIds.length > 0) {
for (let j = 0; j < selectedRowKeysValue[i].configIds.length; j++) {
let keyIndex = Object.keys(selectedRowKeysValue[i])
for (let k = 0; k < keyIndex.length; k++) {
if (keyIndex[k] == selectedRowKeysValue[i].configIds[j]) {
let keyName = keyIndex[k]
configDataList[i][keyName] = selectedRowKeysValue[i][keyName]
}
}
}
}
}
postDateobj.id = selectedRowKeysValue[i].id
postDateobj.remarks = selectedRowKeysValue[i].remarks
postDate.push(postDateobj)
}
let configDataList = { configDataList: postDate }
if (selectedRowKeysValue && selectedRowKeysValue.length > 0) {
// return
if (configDataList && configDataList.length > 0) {
configDataList.forEach(res => {
Object.keys(res).forEach(val => {
if (res[val] && res[val].paramsConfigData) {
let paramsConfigData = res[val].paramsConfigData
Object.keys(paramsConfigData).forEach((ol, index) => {
paramsConfigData[ol][0].orderNum = index
paramsConfigData[ol].forEach(item => {
if (item.type == 'pull_more') {
item.dataValue = item.dataValue.join(',')
}
})
})
}
})
})
}
this.textLoading = true
let query = {
...configDataList,
configDataList: configDataList,
paramsManifestId: this.$route.query.id
}
postAction('/report/detail/save', query).then((res) => {