[update] 市场法规清单联调

This commit is contained in:
lideqin
2024-07-02 09:38:04 +08:00
parent 0d33106b25
commit 55a5fc6fbe
2 changed files with 54 additions and 14 deletions
@@ -22,7 +22,7 @@
</a-form-item> </a-form-item>
</a-col> </a-col>
<!-- 清单编号 --> <!-- 清单编号 -->
<a-col :span="12"> <a-col :span="12" v-if="model.id">
<a-form-item :label="$t('standardRegulationLibrary.marketRegulationsList.listNumber')" <a-form-item :label="$t('standardRegulationLibrary.marketRegulationsList.listNumber')"
:labelCol="labelCol" :labelCol="labelCol"
:wrapperCol="wrapperCol"> :wrapperCol="wrapperCol">
@@ -205,6 +205,7 @@ import MarketRegulationsModal from './modules/MarketRegulationsModal'
import StandardSelectionModal from '../../../components/selection/StandardSelectionModal' import StandardSelectionModal from '../../../components/selection/StandardSelectionModal'
import MarketRegulationsListSelectionModal from '../../../components/selection/MarketRegulationsListSelectionModal' import MarketRegulationsListSelectionModal from '../../../components/selection/MarketRegulationsListSelectionModal'
import { import {
getForeignStandardDocumentInfo,
getMarketRegulationListById, getMarketRegulationListById,
getMarketRegulationListByIds, getMarketRegulationListByIds,
marketRegulationListAdd, marketRegulationListAdd,
@@ -369,7 +370,7 @@ export default {
title: this.$t('standardRegulationLibrary.marketListField.applicableCountryRegion'), title: this.$t('standardRegulationLibrary.marketListField.applicableCountryRegion'),
align: 'center', align: 'center',
width: 180, width: 180,
dataIndex: 'applicableCountryRegion', dataIndex: 'applicableCountryRegion_dictText',
scopedSlots: { customRender: 'text' } scopedSlots: { customRender: 'text' }
}, },
{ // 适用车型 { // 适用车型
@@ -507,7 +508,7 @@ export default {
}, },
initData (id) { initData (id) {
this.loading = true this.loading = true
getMarketRegulationListById({ id }).then(res => { getMarketRegulationListById({ manifestId: id }).then(res => {
if (res.success) { if (res.success) {
this.model = Object.assign({}, res.result) this.model = Object.assign({}, res.result)
this.dataSource = JSON.parse(JSON.stringify(this.model.data.map(item => { this.dataSource = JSON.parse(JSON.stringify(this.model.data.map(item => {
@@ -710,8 +711,11 @@ export default {
modalFormOk (value) { modalFormOk (value) {
if (!value.uid) { if (!value.uid) {
// 是新增完成 // 是新增完成
this.dataSource.unshift({ ...value, uid: uidGenerator() }) if (!this.dataList.includes(i => i.standardNumber === value.standardNumber)) {
this.dataList.unshift({ ...value, uid: uidGenerator() }) // 列表中还没有该标准
this.dataSource.unshift({ ...value, uid: uidGenerator() })
this.dataList.unshift({ ...value, uid: uidGenerator() })
}
} else { } else {
// 是编辑完成 // 是编辑完成
const index = this.dataSource.findIndex(item => item.uid === value.uid) const index = this.dataSource.findIndex(item => item.uid === value.uid)
@@ -721,15 +725,45 @@ export default {
} }
}, },
// 调取完成 // 调取完成
transferOk (list) { async transferOk (list) {
this.loading = true
// 已经有的标准去掉,调取不重复的 // 已经有的标准去掉,调取不重复的
for (const item of list) { for (const item of list) {
if (!this.dataList.includes(i => i.standardNumber === item.standardNumber)) { if (!this.dataList.includes(i => i.standardNumber === item.standardNumber)) {
// 列表中还没有该标准 // 列表中还没有该标准,获取标准数据到表格中
this.dataSource.unshift({ ...item, uid: uidGenerator() }) await getForeignStandardDocumentInfo({ id: item.id, type: '2' }).then(res => {
this.dataList.unshift({ ...item, uid: uidGenerator() }) if (res.success) {
const result = res.result
result.standardNumber = result.standard_number // 标准编号
result.standardName = result.standard_name // 标准名称
result.standardEnglishName = result.standard_english_name // 标准英文名称
result.stanardClass = result.standard_class // 标准类型
result.newProductImplDate = result.new_product_impl_date // 新生产车实施日期
result.newAuthImplDate = result.new_auth_impl_date // 新认证车实施日期
result.registrationDate = result.registration_date // 注册日期
result.applicableCountryRegion = result.applicable_market ? (result.applicable_market.split(',').map(item => {
return { value: item }
})) : [] // 适用国家/地区
result.applicableCountryRegion_dictText = result.applicable_market_dictText // 适用国家/地区
result.mainDept = result.main_dept // 主控部门
result.mainDeptProfMode = result.main_dept_prof_mode || undefined // 主控部门专业模块
result.associateDept = result.associate_dept // 关联部门
result.associateDeptProfMode = result.associate_dept_prof_mode || undefined // 关联部门专业模块
result.applicableVehicle = result.applicable_vehicle // 适用车型
result.dynamicType = result.dynamic_type // 动力类型
this.dataSource.unshift({
...result,
uid: uidGenerator()
})
this.dataList.unshift({
...result,
uid: uidGenerator()
})
}
})
} }
} }
this.loading = false
}, },
// 复制完成 // 复制完成
copyOk (ids) { copyOk (ids) {
@@ -276,6 +276,12 @@ export default {
this.form.resetFields() this.form.resetFields()
this.visible = true this.visible = true
this.model = Object.assign({}, record) this.model = Object.assign({}, record)
// 处理适用国家/地区格式
if (this.model.applicableCountryRegion) {
this.model.applicableCountryRegion = this.model.applicableCountryRegion.split(',').map(item => {
return { value: item }
})
}
this.$nextTick(() => { this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model, 'standardNumber', 'standardName', 'standardEnglishName', this.form.setFieldsValue(pick(this.model, 'standardNumber', 'standardName', 'standardEnglishName',
'stanardClass', 'newProductImplDate', 'newAuthImplDate', 'registrationDate', 'applicableCountryRegion', 'stanardClass', 'newProductImplDate', 'newAuthImplDate', 'registrationDate', 'applicableCountryRegion',
@@ -306,12 +312,14 @@ export default {
result.applicableCountryRegion = result.applicable_market ? (result.applicable_market.split(',').map(item => { result.applicableCountryRegion = result.applicable_market ? (result.applicable_market.split(',').map(item => {
return { value: item } return { value: item }
})) : [] // 适用国家/地区 })) : [] // 适用国家/地区
result.applicableCountryRegion_dictText = result.applicable_market_dictText // 适用国家/地区
result.mainDept = result.main_dept // 主控部门 result.mainDept = result.main_dept // 主控部门
result.mainDeptProfMode = result.main_dept_prof_mode || undefined // 主控部门专业模块 result.mainDeptProfMode = result.main_dept_prof_mode || undefined // 主控部门专业模块
result.associateDept = result.associate_dept // 关联部门 result.associateDept = result.associate_dept // 关联部门
result.associateDeptProfMode = result.associate_dept_prof_mode || undefined // 关联部门专业模块 result.associateDeptProfMode = result.associate_dept_prof_mode || undefined // 关联部门专业模块
result.applicableVehicle = result.applicable_vehicle // 适用车型 result.applicableVehicle = result.applicable_vehicle // 适用车型
result.dynamicType = result.dynamic_type // 动力类型 result.dynamicType = result.dynamic_type // 动力类型
this.model = Object.assign({}, result)
this.$nextTick(() => { this.$nextTick(() => {
this.form.setFieldsValue(pick(result, 'standardName', 'standardEnglishName', this.form.setFieldsValue(pick(result, 'standardName', 'standardEnglishName',
'stanardClass', 'newProductImplDate', 'newAuthImplDate', 'registrationDate', 'applicableCountryRegion', 'stanardClass', 'newProductImplDate', 'newAuthImplDate', 'registrationDate', 'applicableCountryRegion',
@@ -328,11 +336,9 @@ export default {
if (!err) { if (!err) {
this.confirmLoading = true this.confirmLoading = true
const param = Object.assign({}, values) const param = Object.assign({}, values)
if (this.model.uid) { // 处理适用国家/地区格式
this.$emit('ok', { ...this.model, ...param }) param.applicableCountryRegion = param.applicableCountryRegion.map(item => item.value).join(',')
} else { this.$emit('ok', { ...this.model, ...param })
this.$emit('ok', param)
}
this.close() this.close()
this.confirmLoading = false this.confirmLoading = false
} }