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

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
@@ -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) => {