[update] 市场法规清单联调

This commit is contained in:
lideqin
2024-07-02 13:52:49 +08:00
parent 7eff7ddf7a
commit 1ae6661873
3 changed files with 21 additions and 27 deletions
@@ -509,11 +509,12 @@ export default {
getMarketRegulationListById(param).then(res => {
if (res.success) {
this.model = Object.assign({}, res.result)
const uid = uidGenerator()
this.dataSource = JSON.parse(JSON.stringify(this.model.lists.map(item => {
return { ...item, uid: uidGenerator() }
return { ...item, uid }
})))
this.dataList = JSON.parse(JSON.stringify(this.model.lists.map(item => {
return { ...item, uid: uidGenerator() }
return { ...item, uid }
})))
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model.manifest, 'country', 'manifestNo', 'customName', 'drivePosition', 'securityLevel', 'manifestDesc', 'file'))
@@ -574,8 +575,8 @@ export default {
this.loading = true
this.dataList = this.dataList.filter(item => !this.selectedRowKeys.includes(item.uid))
this.dataSource = this.dataSource.filter(item => !this.selectedRowKeys.includes(item.uid))
this.reCalculatePage(this.selectedRowKeys.length)
this.onClearSelected()
console.log(this.dataList)
this.loading = false
}
})
@@ -625,12 +626,13 @@ export default {
} else {
this.$message.success(info.file.response.message || `${info.file.name} 文件上传成功`)
}
const uid = uidGenerator()
// 推入表格中
this.dataSource = info.file.response.result.map(item => {
return { uid: uidGenerator(), ...item }
return { uid, ...item }
})
this.dataList = info.file.response.result.map(item => {
return { uid: uidGenerator(), ...item }
return { uid, ...item }
})
} else {
if (Array.isArray(info.file.response.result) && info.file.response.result.length > 0) {
@@ -678,17 +680,6 @@ export default {
this.selectedRowKeys = []
this.selectionRows = []
},
reCalculatePage (count) {
// 总数量-count
const total = this.ipagination.total - count
// 获取删除后的分页数
const currentIndex = Math.ceil(total / this.ipagination.pageSize)
// 删除后的分页数<所在当前页
if (currentIndex < this.ipagination.current) {
this.ipagination.current = currentIndex
}
console.log('currentIndex', currentIndex)
},
// 下一步
handleNext () {
this.showList = true
@@ -711,9 +702,10 @@ export default {
if (!value.uid) {
// 是新增完成
if (!this.dataList.find(i => i.standardNumber === value.standardNumber)) {
const uid = uidGenerator()
// 列表中还没有该标准
this.dataSource.unshift({ ...value, uid: uidGenerator() })
this.dataList.unshift({ ...value, uid: uidGenerator() })
this.dataSource.unshift({ ...value, uid })
this.dataList.unshift({ ...value, uid })
} else {
// 提示标准已存在
this.$message.warning(this.$t('standardRegulationLibrary.marketRegulationsList.standardExist'))
@@ -730,10 +722,9 @@ export default {
async transferOk (list) {
this.loading = true
let repeatNum = 0
console.log('---list', list)
console.log('---list', list, this.dataList)
// 已经有的标准去掉,调取不重复的
for (const item of list) {
console.log('------item', item)
if (!this.dataList.find(i => i.standardNumber === item.standardNumber)) {
// 列表中还没有该标准,获取标准数据到表格中
await getForeignStandardDocumentInfo({ id: item.id, type: '2' }).then(res => {
@@ -761,13 +752,14 @@ export default {
result.applicableVehicle_dictText = result.applicable_vehicle_dictText // 适用车型
result.dynamicType = result.dynamic_type // 动力类型
result.dynamicType_dictText = result.dynamic_type_dictText // 动力类型
const uid = uidGenerator()
this.dataSource.unshift({
...result,
uid: uidGenerator()
uid
})
this.dataList.unshift({
...result,
uid: uidGenerator()
uid
})
}
})
@@ -792,9 +784,10 @@ export default {
if (res.success) {
for (const item of res.result.lists) {
if (!this.dataList.find(i => i.standardNumber === item.standardNumber)) {
const uid = uidGenerator()
// 列表中还没有该标准
this.dataSource.unshift({ ...item, uid: uidGenerator() })
this.dataList.unshift({ ...item, uid: uidGenerator() })
this.dataSource.unshift({ ...item, uid })
this.dataList.unshift({ ...item, uid })
} else {
repeatNum++
}
@@ -907,6 +900,6 @@ export default {
}
.center-operate-box {
text-align: right;
float: right;
}
</style>
@@ -307,7 +307,7 @@ export default {
},
// 选择标准改变
selectStandardChange (value) {
this.loading = true
this.confirmLoading = true
// 根据返回的id查询企标数据
getForeignStandardDocumentInfo({ id: value[0].id, type: '2' }).then(res => {
if (res.success) {
@@ -343,7 +343,7 @@ export default {
})
}
}).finally(() => {
this.loading = false
this.confirmLoading = false
})
},
// 适用国家/地区改变