diff --git a/src/views/modules/part/partInformation.vue b/src/views/modules/part/partInformation.vue index d9724c5..a40510e 100644 --- a/src/views/modules/part/partInformation.vue +++ b/src/views/modules/part/partInformation.vue @@ -112,7 +112,7 @@
- {{ scope.row[item.columnProp] }} + {{ item.columnProp === 'drawingNo' ? formatDrawingNoForDisplay(scope.row[item.columnProp]) : scope.row[item.columnProp] }}
@@ -169,7 +169,12 @@ - + + 获取编码 @@ -3542,6 +3547,38 @@ }, methods: { + formatDrawingNoForDisplay (drawingNo) { + if (drawingNo === null || drawingNo === undefined) { + return '' + } + const drawingNoText = String(drawingNo) + if (/^[FR]/i.test(drawingNoText)) { + return drawingNoText.substring(1) + } + return drawingNoText + }, + + normalizeDrawingNoDisplayInput (displayValue, currentDrawingNo) { + if (displayValue === null || displayValue === undefined) { + return '' + } + const drawingNoDisplayText = String(displayValue) + if (drawingNoDisplayText === '') { + return '' + } + const currentDrawingNoText = currentDrawingNo === null || currentDrawingNo === undefined + ? '' + : String(currentDrawingNo) + const currentPrefix = currentDrawingNoText.charAt(0) + if (/^[FR]$/i.test(currentPrefix) && !/^[FR]/i.test(drawingNoDisplayText)) { + return currentPrefix + drawingNoDisplayText + } + return drawingNoDisplayText + }, + + handleModalDrawingNoInput (value) { + this.modalData.drawingNo = this.normalizeDrawingNoDisplayInput(value, this.modalData.drawingNo) + }, // 重置标识 resetFlags () { @@ -6207,7 +6244,11 @@ await partInformationSearch(this.searchData).then(({data}) => { this.resultList = data.page.list }) - return this.resultList + const exportList = (this.resultList || []).map(item => ({ + ...item, + drawingNo: this.formatDrawingNoForDisplay(item.drawingNo) + })) + return exportList }, startDownload () { diff --git a/src/views/modules/project/projectInfo/com_project_info_part.vue b/src/views/modules/project/projectInfo/com_project_info_part.vue index 993eb14..57a51d6 100644 --- a/src/views/modules/project/projectInfo/com_project_info_part.vue +++ b/src/views/modules/project/projectInfo/com_project_info_part.vue @@ -63,7 +63,7 @@
- {{ scope.row[item.columnProp] }} + {{ item.columnProp === 'drawingNo' ? formatDrawingNoForDisplay(scope.row[item.columnProp]) : scope.row[item.columnProp] }}
@@ -108,7 +108,12 @@
- + + 获取编码 @@ -1923,6 +1928,39 @@ import CodeGeneration from "../../code/generation.vue"; }, methods: { + formatDrawingNoForDisplay (drawingNo) { + if (drawingNo === null || drawingNo === undefined) { + return '' + } + const drawingNoText = String(drawingNo) + if (/^[FR]/i.test(drawingNoText)) { + return drawingNoText.substring(1) + } + return drawingNoText + }, + + normalizeDrawingNoDisplayInput (displayValue, currentDrawingNo) { + if (displayValue === null || displayValue === undefined) { + return '' + } + const drawingNoDisplayText = String(displayValue) + if (drawingNoDisplayText === '') { + return '' + } + const currentDrawingNoText = currentDrawingNo === null || currentDrawingNo === undefined + ? '' + : String(currentDrawingNo) + const currentPrefix = currentDrawingNoText.charAt(0) + if (/^[FR]$/i.test(currentPrefix) && !/^[FR]/i.test(drawingNoDisplayText)) { + return currentPrefix + drawingNoDisplayText + } + return drawingNoDisplayText + }, + + handleModalDrawingNoInput (value) { + this.modalData.drawingNo = this.normalizeDrawingNoDisplayInput(value, this.modalData.drawingNo) + }, + // 重置标识 resetFlags () { this.mainInfoFlag = false @@ -3062,7 +3100,10 @@ import CodeGeneration from "../../code/generation.vue"; //导出excel createExportData() { - return this.dataList + return (this.dataList || []).map(item => ({ + ...item, + drawingNo: this.formatDrawingNoForDisplay(item.drawingNo) + })) }, startDownload() {