update 自定义比对;资料中心

This commit is contained in:
赵霄
2023-10-27 18:03:26 +08:00
parent cf44116037
commit 4b8ec3112c
8 changed files with 337 additions and 304 deletions
@@ -17,19 +17,31 @@
<a-input :placeholder="$t('pleaseEnter') + $t('docTool.customComparison.listName')"
@change="event => event.target.value = event.target.value.trim()"
:maxLength="50"
v-decorator="['title', validatorRules.title]" />
v-decorator="['listName', validatorRules.listName]" />
</a-form-item>
<!--涉及标准-->
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('docTool.customComparison.referenceStandard')">
<standard-selection :placeholder="$t('pleaseSelect') + $t('docTool.customComparison.referenceStandard')"
v-decorator="['serialNumber', validatorRules.serialNumber]" />
v-decorator="['referenceStandard', validatorRules.referenceStandard]"
@change="handleStandardChange" />
</a-form-item>
<!--涉及国家-->
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('docTool.customComparison.countriesInvolved')">
<a-tree-select
v-decorator="['referenceCountry', validatorRules.referenceCountry]"
:getPopupContainer="triggerNode=> triggerNode.parentNode"
style="width: 100%"
:tree-data="countryTreeData"
tree-checkable
treeCheckStrictly
:replace-fields="{key: 'value'}"
:label-in-value="false"
disabled
:placeholder="$t('pleaseSelect')+$t('docTool.customComparison.countriesInvolved')" />
</a-form-item>
<!--是否公开-->
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('docTool.customComparison.whetherToMakePublic')">
<j-dict-select-tag v-decorator="['serialNumber', validatorRules.serialNumber]"
<j-dict-select-tag v-decorator="['isShow', validatorRules.isShow]"
:placeholder="$t('pleaseSelect')+$t('docTool.customComparison.whetherToMakePublic')"
type="radio"
:triggerChange="false"
@@ -37,7 +49,8 @@
</a-form-item>
<!--在线对比-->
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('docTool.customComparison.onlineComparison')">
<a-switch default-checked v-model="isStartComparison" />
<a-switch default-checked v-model="isStartComparison" @change="handleSwitchChange" />
<a-button type="primary" class="submit-btn" ghost @click="handleSaveForm">{{ $t('submit') }}</a-button>
</a-form-item>
<div v-show="isStartComparison" class="comparison-box">
<div class="operation-box">
@@ -132,251 +145,16 @@ import StandardSelection from '../../../../components/selection/StandardSelectio
import { downFile } from '../../../../api/manage'
import StandardListDrawer from './StandardListDrawer'
import ComparisonMaintainDrawer from './ComparisonMaintainDrawer'
import { deleteSpecialtyItem, deleteMaintainItem } from '../../../../api/documentToolApi'
import {
deleteSpecialtyItem,
deleteMaintainItem,
saveFormData,
getFormDataById,
saveStandard,
getTableData
} from '../../../../api/documentToolApi'
import CustomComparisonCellDrawer from './CustomComparisonCellDrawer'
const ApiData = {
'countryMap': {
'': [
{
'id': 'QTGBP59D7AKHDLD2T4R6',
'country': null,
'standNum': 'GB 11212-121212',
'standName': '1111',
'standId': '63e289e4dda24f90a51e',
'standType': 'INLAND',
'compareBaseId': 'GGCD9DAEY3M7LMRPQ96C',
'createTime': 1698136081000,
'countries': null,
'standState': null,
'standStateShow': null
},
{
'id': 'UWARF4EQJLVNQ9A5J29H',
'country': null,
'standNum': 'GB 9999-2023',
'standName': '商-测试标准',
'standId': 'c427b19d88374476b71e',
'standType': 'INLAND',
'compareBaseId': 'GGCD9DAEY3M7LMRPQ96C',
'createTime': 1698136081000,
'countries': null,
'standState': null,
'standStateShow': null
}
],
'欧盟': [
{
'id': 'XL438X5H5LRUMBE49FF5',
'country': 'EU_C',
'standNum': 'GB 7258-20XX',
'standName': '机动车运行安全条件',
'standId': '738414b579b84093b151',
'standType': 'INLAND',
'compareBaseId': 'GGCD9DAEY3M7LMRPQ96C',
'createTime': 1698284537000,
'countries': null,
'standState': null,
'standStateShow': null
}
],
'中国,欧盟,非洲': [
{
'id': 'VHBUCSFG3BW6RMNUGRA5',
'country': 'EU_C,S9BPTW2EPF,CN',
'standNum': 'GB 15089-2001',
'standName': '机动车辆及其挂车分类',
'standId': '14516a9061b745fbad71',
'standType': 'INLAND',
'compareBaseId': 'GGCD9DAEY3M7LMRPQ96C',
'createTime': 1698285956000,
'countries': null,
'standState': null,
'standStateShow': null
}
]
},
'ranksMap': {
'ITEM': [
{
'id': 'a4363725b24d46e2b985',
'compareId': 'GGCD9DAEY3M7LMRPQ96C',
'proertyVal': '适用范围',
'validFlag': '0',
'creationTime': '2023-10-24',
'modifyTime': '2023-10-26',
'proertyType': 'ITEM',
'natureList': null,
'compareItemList': null,
'color': 'red',
'result': 'sdfd ',
'orderNum': null,
'underOrderNum': null
},
{
'id': '2eb67bc13f294f649e04',
'compareId': 'GGCD9DAEY3M7LMRPQ96C',
'proertyVal': '定义',
'validFlag': '0',
'creationTime': '2023-10-24',
'modifyTime': '2023-10-26',
'proertyType': 'ITEM',
'natureList': null,
'compareItemList': null,
'color': '',
'result': null,
'orderNum': null,
'underOrderNum': null
},
{
'id': '8e29f388af374eaeb607',
'compareId': 'GGCD9DAEY3M7LMRPQ96C',
'proertyVal': '东方红发过火',
'validFlag': '0',
'creationTime': '2023-10-26',
'modifyTime': '2023-10-26',
'proertyType': 'ITEM',
'natureList': null,
'compareItemList': null,
'color': '',
'result': null,
'orderNum': null,
'underOrderNum': null
}
],
'NATURE': [
{
'id': 'c918fe1cc95c4d4c9776',
'compareId': 'GGCD9DAEY3M7LMRPQ96C',
'proertyVal': '章节',
'validFlag': '0',
'creationTime': '2023-10-26',
'modifyTime': '2023-10-26',
'proertyType': 'NATURE',
'natureList': null,
'compareItemList': null,
'color': '',
'result': null,
'orderNum': null,
'underOrderNum': null
},
{
'id': '58d6c194ecc44c66b0a6',
'compareId': 'GGCD9DAEY3M7LMRPQ96C',
'proertyVal': '法规内容',
'validFlag': '0',
'creationTime': '2023-10-26',
'modifyTime': '2023-10-26',
'proertyType': 'NATURE',
'natureList': null,
'compareItemList': null,
'color': '',
'result': null,
'orderNum': null,
'underOrderNum': null
},
{
'id': 'd89f153e6a3e4950b46c',
'compareId': 'GGCD9DAEY3M7LMRPQ96C',
'proertyVal': '但是丰东股份冻干粉大概',
'validFlag': '0',
'creationTime': '2023-10-26',
'modifyTime': '2023-10-26',
'proertyType': 'NATURE',
'natureList': null,
'compareItemList': null,
'color': '',
'result': null,
'orderNum': null,
'underOrderNum': null
}
]
},
'list': [
{
'validFlag': '0',
'creationTime': '2023-10-25',
'modifyTime': '2023-10-25',
'formFile': null,
'id': '3S49DS2MCRW2LLR85ANF',
'compareId': 'GGCD9DAEY3M7LMRPQ96C',
'sarId': '63e289e4dda24f90a51e',
'natureId': '6fd7471e1f364299b8fc',
'itemId': '2eb67bc13f294f649e04',
'formContent': 'uj',
'sarNumber': 'GB 11212-121212',
'sarRegion': '',
'compareName': null,
'natureName': null,
'formFileList': []
},
{
'validFlag': '0',
'creationTime': '2023-10-24',
'modifyTime': '2023-10-24',
'formFile': null,
'id': '5QZFJA8RJQ67MTXRLGN2',
'compareId': 'GGCD9DAEY3M7LMRPQ96C',
'sarId': '63e289e4dda24f90a51e',
'natureId': '6fd7471e1f364299b8fc',
'itemId': 'a4363725b24d46e2b985',
'formContent': 'xx',
'sarNumber': 'GB 11212-121212',
'sarRegion': '',
'compareName': null,
'natureName': null,
'formFileList': []
},
{
'validFlag': '0',
'creationTime': '2023-10-26',
'modifyTime': '2023-10-26',
'formFile': ',ATT_FILE_10_UJZTNK3EV4YCCFHY3BC8',
'id': 'B2M2LAASEGPP5QRX6PLF',
'compareId': 'GGCD9DAEY3M7LMRPQ96C',
'sarId': '63e289e4dda24f90a51e',
'natureId': 'f1e39a369b5748e8bd76',
'itemId': 'a4363725b24d46e2b985',
'formContent': null,
'sarNumber': 'GB 11212-121212',
'sarRegion': '',
'compareName': null,
'natureName': null,
'formFileList': [
{
'id': 'ATT_FILE_10_UJZTNK3EV4YCCFHY3BC8',
'fileName': 'UJZTNK3EV4YCCFHY3BC8.png',
'oldFileName': '42391722989afbf0579b0876cad9707.png',
'fileSuffix': 'png',
'filePath': '/69/27/34/',
'validFlag': 0,
'creationTime': 1698284432000,
'modifyTime': 1698284432000,
'tableName': 'ATT_FILE_10',
'resId': null,
'downLoadUrl': null
}
]
},
{
'validFlag': '0',
'creationTime': '2023-10-26',
'modifyTime': '2023-10-26',
'formFile': null,
'id': 'KKESX8FVKZXLRU74YRFG',
'compareId': 'GGCD9DAEY3M7LMRPQ96C',
'sarId': '63e289e4dda24f90a51e',
'natureId': 'c918fe1cc95c4d4c9776',
'itemId': 'a4363725b24d46e2b985',
'formContent': '电饭锅地方会更好v才不会v才能帮你',
'sarNumber': 'GB 11212-121212',
'sarRegion': '',
'compareName': null,
'natureName': null,
'formFileList': []
}
]
}
import { getFormDictTreeList } from '../../../../api/api'
export default {
name: 'CustomComparisonDrawer',
@@ -401,18 +179,18 @@ export default {
},
validatorRules: {
// 清单名称
title: {
listName: {
rules: [{ required: true, message: this.$t('pleaseEnter') + this.$t('standardSelect.standardName') }],
validateTrigger: 'blur'
},
// 涉及标准
serialNumber: {
referenceStandard: {
rules: [{ required: true, message: this.$t('pleaseSelect') + this.$t('standardSelect.standardNumber') }],
validateTrigger: 'change'
},
// 文本状态
fileType: {
rules: [{ required: true, message: this.$t('pleaseSelect') + this.$t('docTool.comparison.textStatus') }],
// 涉及国家
referenceCountry: {
rules: [{ required: false, message: this.$t('pleaseSelect') + this.$t('docTool.comparison.textStatus') }],
validateTrigger: 'change'
},
// 拆分结果文件
@@ -421,26 +199,48 @@ export default {
validateTrigger: 'change'
}
},
isStartComparison: true, // 是否发起比对,为是的时候显示下面的内容
isEdit: true, // 是否在编辑状态里
isStartComparison: false, // 是否发起比对,为是的时候显示下面的内容
isEdit: false, // 是否在编辑状态里
standardList: [], // 标准的列表
specialtyItemList: [] // 特点的列表(三级表头)
specialtyItemList: [], // 特点的列表(三级表头)
isFirstOpenComparison: true, // 第一次打开在线比对
countryTreeData: [] // 涉及国家数据
}
},
methods: {
add () {
this.visible = true
this.processData(ApiData)
this.processTableData(ApiData)
this.initDictConfig()
},
edit (record) {
this.modal = Object.assign({}, record)
edit (id) {
this.visible = true
this.initDictConfig()
this.modal = { id }
this.isFirstOpenComparison = false
this.getFormData()
this.initTableData()
},
initDictConfig () {
// 涉及国家
getFormDictTreeList({ dictId: '1706192138039345153' }).then(res => {
if (res.success) {
this.countryTreeData = res.result || []
}
})
},
handleCancel () {
this.close()
},
close () {
this.visible = false
this.form.resetFields()
this.modal = {}
this.isStartComparison = false
this.isEdit = false
this.standardList = []
this.specialtyItemList = []
this.columns = []
this.dataSource = []
},
/**
* 导出
@@ -492,7 +292,7 @@ export default {
*/
viewStandardList () {
console.log(this.form.getFieldValue('serialNumber'))
this.$refs.standardListDrawer.open()
this.$refs.standardListDrawer.open(this.modal.id)
},
/**
* 删除标准
@@ -508,7 +308,7 @@ export default {
* 重新加载表格数据
*/
reloadTableData () {
this.initTableData()
},
/**
* 对比维护
@@ -543,7 +343,7 @@ export default {
const levelTwo = []
countryStandardList.forEach((standard, standardIndex) => {
const objLevelTwo = {
title: standard.standNum,
title: standard.standardNumber,
children: [],
width: this.specialtyItemList.length * 200 || 400
}
@@ -551,7 +351,7 @@ export default {
if (this.specialtyItemList && this.specialtyItemList.length > 0) {
this.specialtyItemList.forEach((specialtyItem, specialtyItemIndex) => {
objLevelTwo.children.push({
dataIndex: `${standard.standNum}-${specialtyItem.id}-label`,
dataIndex: `${standard.standardNumber}-${specialtyItem.id}-label`,
slots: { title: 'specialtyItem' + standardIndex + specialtyItemIndex },
width: 200,
scopedSlots: { customRender: 'cell' }
@@ -640,7 +440,7 @@ export default {
* 比对分析结果,在末尾加一列,如果已经有了,就隐藏这列
*/
handleResult () {
if (this.columns[this.columns.length - 1].dataIndex === 'color') {
if (this.columns && this.columns.length > 0 && this.columns[this.columns.length - 1].dataIndex === 'result') {
this.columns.splice(this.columns.length - 1, 1)
} else {
this.columns.push({
@@ -651,6 +451,104 @@ export default {
scopedSlots: { customRender: 'resultCell' }
})
}
},
/**
* 保存表单内容
* 清单名称、涉及国家、是否公开三个字段
*/
handleSaveForm () {
this.form.validateFields((errors, values) => {
if (!errors) {
this.confirmLoading = true
const formData = Object.assign(this.modal, values)
saveFormData(formData).then(res => {
if (res.success) {
this.$message.success(res.message)
this.isFirstOpenComparison = false
this.reloadTableData()
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.confirmLoading = false
})
}
})
},
/**
* 切换显隐下方表格,如果是首次显示,需要保存form表单
*/
handleSwitchChange () {
if (this.isStartComparison && this.isFirstOpenComparison) {
this.handleSaveForm()
}
},
/**
* 获取上方表单数据,修改了标准的信息也需要调用这个方法
*/
getFormData () {
this.confirmLoading = true
getFormDataById({ id: this.modal.id }).then(res => {
if (res.success) {
this.modal = Object.assign(this.modal, res.result || {})
// 处理关联国家的回显
if (this.modal.referenceCountry) {
const referenceCountryArr = this.modal.referenceCountry.split(',')
this.modal.referenceCountry = referenceCountryArr.map(tt => {
return {
value: tt
}
})
} else {
this.modal.referenceCountry = undefined
}
this.$nextTick(() => {
this.form.setFieldsValue(this.modal)
})
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.confirmLoading = false
})
},
/**
* 修改了标准,调用标准检索保存接口,成功后再次获取表单数据和表格数据
* @param value
*/
handleStandardChange (value) {
this.confirmLoading = true
const params = this.form.getFieldsValue()
params.standardNumber = value
saveStandard(params).then(res => {
if (res.success) {
this.$message.success(res.message)
this.getFormData()
this.reloadTableData()
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.confirmLoading = false
})
},
/**
* 获取表格数据
*/
initTableData () {
this.confirmLoading = true
getTableData({ id: this.modal.id }).then(res => {
if (res.success) {
// 平铺一些数据
this.processData(res.result || {})
// 把数据处理成表格需要的样子
this.processTableData(res.result || {})
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.confirmLoading = false
})
}
}
}
@@ -732,4 +630,9 @@ export default {
color: @primary-color;
}
}
.submit-btn {
float: right;
margin-top: 4px;
}
</style>