From 1422f3189b43b8274a2d9343c92552d762defe6d Mon Sep 17 00:00:00 2001 From: danshihao Date: Mon, 14 Oct 2024 15:52:41 +0800 Subject: [PATCH] =?UTF-8?q?[update=20=E8=A7=A3=E8=AF=BB=E6=B5=81=E7=A8=8B]?= =?UTF-8?q?=20=E8=A1=A8=E5=A4=B4=E5=8A=A8=E6=80=81=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/InterpretationClauseTable.vue | 275 +++++------------- .../InterpretationClauseTableModal.vue | 114 ++++---- 2 files changed, 125 insertions(+), 264 deletions(-) diff --git a/src/views/workCenter/standardInterpretationProcess/modules/InterpretationClauseTable.vue b/src/views/workCenter/standardInterpretationProcess/modules/InterpretationClauseTable.vue index e4f0eae..76a2f73 100644 --- a/src/views/workCenter/standardInterpretationProcess/modules/InterpretationClauseTable.vue +++ b/src/views/workCenter/standardInterpretationProcess/modules/InterpretationClauseTable.vue @@ -76,10 +76,27 @@ import InterpretationClauseTableModal import { randomUUID } from '@/utils/util' import UserSelectModal from '@comp/selection/UserSelectModal' import { downFile } from '@api/manage' -import { StandardInterpretationNodes } from '@/enums/commonEnums' +import { FieldType, StandardInterpretationNodes } from '@/enums/commonEnums' import UserSelection from '@comp/selection/UserSelection' import Vue from 'vue' import { ACCESS_TOKEN, TENANT_ID } from '@/store/mutation-types' +import { getDocSplitTableHeader } from '@api/documentToolApi' + +// 需要数据字段翻译的属性类型 +const NEED_DICT_FIELD_TYPE = [ + FieldType.USER_SINGLE.value, + FieldType.ORGAN_SINGLE.value, + FieldType.ORGAN_MORE.value, + FieldType.FILE_UP.value, + FieldType.OPTION_SINGLE.value, + FieldType.OPTION_MORE.value, + FieldType.TREE.value, + FieldType.TREE_SINGLE.value, + FieldType.TREE_MODAL_SELECT.value, + FieldType.TREE_MODAL_SELECT_SEARCH_DIFF.value, + FieldType.TREE_MODAL_SELECT_SEARCH_CHILD.value, + FieldType.USER_MORE.value +] // 导入数据没有id,用该标记标记数据是否前端生成id const uuidFlag = '__uuid__' @@ -181,6 +198,7 @@ export default { actionColumn: { // 操作 title: this.$t('operation'), fixed: 'right', + dataIndex: 'action', width: 150, scopedSlots: { customRender: 'action' } }, @@ -201,211 +219,7 @@ export default { scopedSlots: { customRender: 'text' } }, // 解读的其他字段(拆分表的字段) - columnsExtend: [ - { // 是否与上一版相同 - title: this.$t('workCenter.standardInterpretationProcess.sameAsPreviousVersion'), - align: 'center', - width: 180, - dataIndex: 'isSameAsPrevVersion_dictText', - scopedSlots: { customRender: 'dictText' } - }, - { // 相对上一版变化点说明 - title: this.$t('workCenter.standardInterpretationProcess.explanationOfChangePoints'), - align: 'center', - width: 180, - dataIndex: 'changeDescription', - scopedSlots: { customRender: 'text' } - }, - { // 法规注解 - title: this.$t('workCenter.standardInterpretationProcess.regulatoryAnnotations'), - align: 'center', - width: 180, - dataIndex: 'regulatoryNotes', - scopedSlots: { customRender: 'text' } - }, - { // 涉及系统/部件 - title: this.$t('workCenter.standardInterpretationProcess.involvingSystemsComponents'), - align: 'center', - width: 180, - dataIndex: 'partName_dictText', - scopedSlots: { customRender: 'text' } - }, - { // 关键控制器 - title: this.$t('workCenter.standardInterpretationProcess.keyController'), - align: 'center', - width: 180, - dataIndex: 'keyController_dictText', - scopedSlots: { customRender: 'dictText' } - }, - { // 责任部门 - title: this.$t('workCenter.standardInterpretationProcess.responsibleDepartment'), - align: 'center', - width: 180, - dataIndex: 'responsibleDepartment_dictText', - scopedSlots: { customRender: 'text' } - }, - { // 责任部门专业模块 - title: this.$t('workCenter.standardInterpretationProcess.responsibleDepartmentModule'), - align: 'center', - width: 180, - dataIndex: 'responsibleModule_dictText', - scopedSlots: { customRender: 'dictText' } - }, - { // 关联部门 - title: this.$t('workCenter.standardInterpretationProcess.relatedDepartments'), - align: 'center', - width: 180, - dataIndex: 'relatedDepartment_dictText', - scopedSlots: { customRender: 'text' } - }, - { // 关联部门专业模块 - title: this.$t('workCenter.standardInterpretationProcess.relatedDepartmentsModule'), - align: 'center', - width: 180, - dataIndex: 'relatedModule_dictText', - scopedSlots: { customRender: 'dictText' } - }, - { // 适用车型 - title: this.$t('workCenter.standardInterpretationProcess.applications'), - align: 'center', - width: 180, - dataIndex: 'applications_dictText', - scopedSlots: { customRender: 'dictText' } - }, - { // 动力类型 - title: this.$t('workCenter.standardInterpretationProcess.powerType'), - align: 'center', - width: 180, - dataIndex: 'powerType_dictText', - scopedSlots: { customRender: 'dictText' } - }, - { // 专业领域 - title: this.$t('workCenter.standardInterpretationProcess.professionalField'), - align: 'center', - width: 180, - dataIndex: 'domainArea_dictText', - scopedSlots: { customRender: 'dictText' } - }, - { // 配置需求 - title: this.$t('workCenter.standardInterpretationProcess.configurationRequirements'), - align: 'center', - width: 180, - dataIndex: 'configurationRequirements_dictText', - scopedSlots: { customRender: 'dictText' } - }, - { // 新认证车实施日期 - title: this.$t('workCenter.standardInterpretationProcess.newCertificationImplementationDate'), - align: 'center', - width: 180, - dataIndex: 'newCerImplementDate', - scopedSlots: { customRender: 'text' } - }, - { // 新生产车实施日期 - title: this.$t('workCenter.standardInterpretationProcess.newProduceImplementationDate'), - align: 'center', - width: 180, - dataIndex: 'newProductionImplementation', - scopedSlots: { customRender: 'text' } - }, - { // 注册日期 - title: this.$t('workCenter.standardInterpretationProcess.registrationDate'), - align: 'center', - width: 180, - dataIndex: 'registrationDate', - scopedSlots: { customRender: 'text' } - }, - { // 企业标准 - title: this.$t('workCenter.standardInterpretationProcess.enterpriseStandards'), - align: 'center', - width: 180, - dataIndex: 'enterpriseStandard', - scopedSlots: { customRender: 'text' } - }, - { // 技术规范/设计指南 - title: this.$t('workCenter.standardInterpretationProcess.technicalSpecificationsDesignGuidelines'), - align: 'center', - width: 180, - dataIndex: 'technicalSpecificationDesignGuide', - scopedSlots: { customRender: 'text' } - }, - { // 图纸模板 - title: this.$t('workCenter.standardInterpretationProcess.drawingTemplate'), - align: 'center', - width: 180, - dataIndex: 'drawingTemplate', - scopedSlots: { customRender: 'text' } - }, - { // 技术协议模板 - title: this.$t('workCenter.standardInterpretationProcess.technicalAgreementTemplate'), - align: 'center', - width: 180, - dataIndex: 'technicalAgreementTemplate', - scopedSlots: { customRender: 'text' } - }, - { // 校核报告模板/checklist - title: this.$t('workCenter.standardInterpretationProcess.verificationReportTemplate'), - align: 'center', - width: 180, - dataIndex: 'verificationReportTemplateChecklist', - scopedSlots: { customRender: 'text' } - }, - { // DVP模板 - title: this.$t('workCenter.standardInterpretationProcess.dvpTemplate'), - align: 'center', - width: 180, - dataIndex: 'dvpTemplate', - scopedSlots: { customRender: 'text' } - }, - { // DFEMA - title: this.$t('workCenter.standardInterpretationProcess.dfema'), - align: 'center', - width: 180, - dataIndex: 'dfema', - scopedSlots: { customRender: 'text' } - }, - { // 关键技术分解表 - title: this.$t('workCenter.standardInterpretationProcess.specialListTemplate'), - align: 'center', - width: 180, - dataIndex: 'keyTechnologyDecompositionTable', - scopedSlots: { customRender: 'text' } - }, - { // 其他文件或模板 - title: this.$t('workCenter.standardInterpretationProcess.otherFilesOrTemplates'), - align: 'center', - width: 180, - dataIndex: 'otherDocumentsTemplates', - scopedSlots: { customRender: 'text' } - }, - { // 排查阶段 - title: this.$t('workCenter.standardInterpretationProcess.investigationStage'), - align: 'center', - width: 180, - dataIndex: 'investigationStage_dictText', - scopedSlots: { customRender: 'dictText' } - }, - { // P3证明符合性的交付物名称 - title: this.$t('workCenter.standardInterpretationProcess.pThree'), - align: 'center', - width: 180, - dataIndex: 'p3', - scopedSlots: { customRender: 'text' } - }, - { // P5证明符合性的交付物名称 - title: this.$t('workCenter.standardInterpretationProcess.pFive'), - align: 'center', - width: 180, - dataIndex: 'p5', - scopedSlots: { customRender: 'text' } - }, - { // 备注 - title: this.$t('workCenter.standardInterpretationProcess.notes'), - align: 'center', - width: 180, - dataIndex: 'remarks', - scopedSlots: { customRender: 'text' } - } - ], + columnsExtend: [], dataSource: [], ipagination: { current: 1, @@ -434,7 +248,7 @@ export default { computed: { // 最终显示的表格 showColumns () { - const columns = this.baseColumns + const columns = [...this.baseColumns] // 不显示操作列的节点 const noActionCoumnsNodes = [ StandardInterpretationNodes.mainInterpreterSingleLineReview.value, // 标准主解读人单线审核 @@ -552,7 +366,54 @@ export default { return `${window._CONFIG.domianURL}/${this.url.importExcelUrl}` } }, + mounted () { + // 加载表头 + this.getTableHeader() + }, methods: { + // 下划线转换成小驼峰 + toCamelCase (str) { + return str.replace(/_([a-z])/g, (match, letter) => letter.toUpperCase()) + }, + getTableHeader () { + this.loading = true + getDocSplitTableHeader({ module: '4' }).then(res => { + if (res.success) { + this.columnsExtend = this.dealColumns(res.result || []) + console.log(this.columnsExtend) + this.isTrue = false + this.$nextTick(() => { + this.isTrue = true + }) + } + }).finally(() => { + this.loading = false + }) + }, + /** + * 处理表头数据 + * @param columns + * @returns {*[]} + */ + dealColumns (columns) { + const tempColumns = [] + columns.forEach(item => { + const key = this.toCamelCase(item.dbFieldName) + // 如果是默认的基础列,就不需要动态获取 + if (this.baseColumns.find(col => col.dataIndex === key)) { + return + } + item.width = 215 + item.title = this.isChinese() ? item.dbFieldTxt : item.dbFieldEnName + if (NEED_DICT_FIELD_TYPE.includes(item.fieldShowType)) { + item.dataIndex = this.isChinese() ? key + '_dictText' : key + '_dictTextEn' + } else { + item.dataIndex = key + } + tempColumns.push(item) + }) + return tempColumns + }, // 设置组件内数据 setData (data = []) { this.dataSource = data.map(item => { diff --git a/src/views/workCenter/standardInterpretationProcess/modules/InterpretationClauseTableModal.vue b/src/views/workCenter/standardInterpretationProcess/modules/InterpretationClauseTableModal.vue index 6c2420f..836b38b 100644 --- a/src/views/workCenter/standardInterpretationProcess/modules/InterpretationClauseTableModal.vue +++ b/src/views/workCenter/standardInterpretationProcess/modules/InterpretationClauseTableModal.vue @@ -107,63 +107,6 @@ @dictChange="(name) => dictChange(name, 'relatedModule')" v-decorator="['relatedModule']"/> - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + +