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