diff --git a/src/views/standardRegulationLibrary/marketRegulationsList/MarketRegulationsFormPage.vue b/src/views/standardRegulationLibrary/marketRegulationsList/MarketRegulationsFormPage.vue index 8b4091e..03ba941 100644 --- a/src/views/standardRegulationLibrary/marketRegulationsList/MarketRegulationsFormPage.vue +++ b/src/views/standardRegulationLibrary/marketRegulationsList/MarketRegulationsFormPage.vue @@ -22,7 +22,7 @@ - + @@ -205,6 +205,7 @@ import MarketRegulationsModal from './modules/MarketRegulationsModal' import StandardSelectionModal from '../../../components/selection/StandardSelectionModal' import MarketRegulationsListSelectionModal from '../../../components/selection/MarketRegulationsListSelectionModal' import { + getForeignStandardDocumentInfo, getMarketRegulationListById, getMarketRegulationListByIds, marketRegulationListAdd, @@ -369,7 +370,7 @@ export default { title: this.$t('standardRegulationLibrary.marketListField.applicableCountryRegion'), align: 'center', width: 180, - dataIndex: 'applicableCountryRegion', + dataIndex: 'applicableCountryRegion_dictText', scopedSlots: { customRender: 'text' } }, { // 适用车型 @@ -507,7 +508,7 @@ export default { }, initData (id) { this.loading = true - getMarketRegulationListById({ id }).then(res => { + getMarketRegulationListById({ manifestId: id }).then(res => { if (res.success) { this.model = Object.assign({}, res.result) this.dataSource = JSON.parse(JSON.stringify(this.model.data.map(item => { @@ -710,8 +711,11 @@ export default { modalFormOk (value) { if (!value.uid) { // 是新增完成 - this.dataSource.unshift({ ...value, uid: uidGenerator() }) - this.dataList.unshift({ ...value, uid: uidGenerator() }) + if (!this.dataList.includes(i => i.standardNumber === value.standardNumber)) { + // 列表中还没有该标准 + this.dataSource.unshift({ ...value, uid: uidGenerator() }) + this.dataList.unshift({ ...value, uid: uidGenerator() }) + } } else { // 是编辑完成 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) { if (!this.dataList.includes(i => i.standardNumber === item.standardNumber)) { - // 列表中还没有该标准 - this.dataSource.unshift({ ...item, uid: uidGenerator() }) - this.dataList.unshift({ ...item, uid: uidGenerator() }) + // 列表中还没有该标准,获取标准数据到表格中 + await getForeignStandardDocumentInfo({ id: item.id, type: '2' }).then(res => { + 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) { diff --git a/src/views/standardRegulationLibrary/marketRegulationsList/modules/MarketRegulationsModal.vue b/src/views/standardRegulationLibrary/marketRegulationsList/modules/MarketRegulationsModal.vue index 4856a08..67e7b48 100644 --- a/src/views/standardRegulationLibrary/marketRegulationsList/modules/MarketRegulationsModal.vue +++ b/src/views/standardRegulationLibrary/marketRegulationsList/modules/MarketRegulationsModal.vue @@ -276,6 +276,12 @@ export default { this.form.resetFields() this.visible = true this.model = Object.assign({}, record) + // 处理适用国家/地区格式 + if (this.model.applicableCountryRegion) { + this.model.applicableCountryRegion = this.model.applicableCountryRegion.split(',').map(item => { + return { value: item } + }) + } this.$nextTick(() => { this.form.setFieldsValue(pick(this.model, 'standardNumber', 'standardName', 'standardEnglishName', 'stanardClass', 'newProductImplDate', 'newAuthImplDate', 'registrationDate', 'applicableCountryRegion', @@ -306,12 +312,14 @@ export default { 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.model = Object.assign({}, result) this.$nextTick(() => { this.form.setFieldsValue(pick(result, 'standardName', 'standardEnglishName', 'stanardClass', 'newProductImplDate', 'newAuthImplDate', 'registrationDate', 'applicableCountryRegion', @@ -328,11 +336,9 @@ export default { if (!err) { this.confirmLoading = true const param = Object.assign({}, values) - if (this.model.uid) { - this.$emit('ok', { ...this.model, ...param }) - } else { - this.$emit('ok', param) - } + // 处理适用国家/地区格式 + param.applicableCountryRegion = param.applicableCountryRegion.map(item => item.value).join(',') + this.$emit('ok', { ...this.model, ...param }) this.close() this.confirmLoading = false }