From aeb4d26b6c546f4abfcf31c636b70f40f2e49788 Mon Sep 17 00:00:00 2001 From: zhangherong <571457620@qq.com> Date: 星期六, 05 七月 2025 17:26:31 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- src/views/eam/base/modules/EamMaintenanceStandardModal.vue | 104 +++++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 90 insertions(+), 14 deletions(-) diff --git a/src/views/eam/base/modules/EamMaintenanceStandardModal.vue b/src/views/eam/base/modules/EamMaintenanceStandardModal.vue index 0ece138..3ac6bc5 100644 --- a/src/views/eam/base/modules/EamMaintenanceStandardModal.vue +++ b/src/views/eam/base/modules/EamMaintenanceStandardModal.vue @@ -85,16 +85,16 @@ :columns="detail.columns" style="margin-top: 8px;"> <template v-slot:itemPart="props"> - <a-textarea v-model="props.row.itemPart" allowClear @change="$refs.editableDetailTable.validateTable()" - :placeholder="model.maintenanceCategory!='THIRD_MAINTENANCE'?'浠呬笁淇濋渶瑕佺淮鎶�':'璇疯緭鍏ラ儴浣�'" :rows="1" - autoSize :disabled="model.maintenanceCategory!='THIRD_MAINTENANCE'"/> + <a-textarea v-model="props.row.itemPart" allowClear @blur="$refs.editableDetailTable.validateTable()" + :placeholder="!Boolean(model.maintenanceCategory)?'璇烽�夋嫨淇濆吇鍒嗙被':'璇疯緭鍏ラ儴浣�'" :rows="1" + autoSize :disabled="!Boolean(model.maintenanceCategory)"/> </template> <template v-slot:itemCategory="props"> <j-dict-select-tag v-model="props.row.itemCategory" :dict-code="encodedDictCode" @change="$refs.editableDetailTable.validateTable()" - :placeholder="getItemCategoryPlaceholder" - :disabled="!Boolean(model.maintenanceCategory)||model.maintenanceCategory=='THIRD_MAINTENANCE'"/> + :placeholder="!Boolean(model.maintenanceCategory)?'璇烽�夋嫨淇濆吇鍒嗙被':'璇烽�夋嫨椤逛繚鍏诲垎绫�'" + :disabled="!Boolean(model.maintenanceCategory)"/> </template> </j-vxe-table> </a-row> @@ -219,6 +219,67 @@ ] } ], + defaultColumns: [ + { + title: 'ID', + key: 'id', + type: JVXETypes.hidden + }, + { + title: 'standardId', + key: 'standardId', + type: JVXETypes.hidden + }, + { + title: '椤圭洰搴忓彿', + key: 'itemCode', + type: JVXETypes.inputNumber, + align: 'center', + placeholder: '璇疯緭鍏ラ」鐩簭鍙�', + width: 150, + validateRules: [ + { required: true, message: '璇疯緭鍏ラ」鐩簭鍙�' }, + { unique: true, message: '椤圭洰搴忓彿涓嶈兘閲嶅' } + ] + }, + { + title: '閮ㄤ綅', + key: 'itemPart', + type: JVXETypes.slot, + slotName: 'itemPart', + placeholder: '璇疯緭鍏ラ儴浣�', + align: 'center', + validateRules: [{ handler: this.itemPartValidate }] + }, + { + title: '淇濆吇椤瑰垎绫�', + key: 'itemCategory', + type: JVXETypes.slot, + slotName: 'itemCategory', + align: 'center', + validateRules: [{ handler: this.itemCategoryValidate }] + }, + { + title: '淇濆吇椤圭洰', + key: 'itemName', + placeholder: '璇疯緭鍏ヤ繚鍏婚」鐩�', + type: JVXETypes.textarea, + align: 'center', + validateRules: [ + { required: true, message: '璇疯緭鍏ヤ繚鍏婚」鐩�' } + ] + }, + { + title: '淇濆吇瑙勮寖鎴栬姹�', + key: 'itemDemand', + placeholder: '璇疯緭鍏ヤ繚鍏昏鑼冩垨瑕佹眰', + type: JVXETypes.textarea, + align: 'center', + validateRules: [ + { required: true, message: '璇疯緭鍏ヤ繚鍏昏鑼冩垨瑕佹眰' } + ] + } + ], toolbarConfig: { // prefix 鍓嶇紑锛泂uffix 鍚庣紑 slot: ['prefix', 'suffix'], @@ -228,15 +289,19 @@ } } }, - computed: { - getItemCategoryPlaceholder() { - if (!Boolean(this.model.maintenanceCategory)) return '璇烽�夋嫨淇濆吇鍒嗙被' - else { - if (this.model.maintenanceCategory != 'THIRD_MAINTENANCE') return '璇烽�夋嫨淇濆吇椤瑰垎绫�' - else return '涓変繚鏃犻渶缁存姢' - } - }, + watch: { + 'model.maintenanceCategory': { + handler(val) { + if (val) { + if (val != 'THIRD_MAINTENANCE') this.detail.columns = [...this.detail.defaultColumns.filter(item => item.key != 'itemPart')] + else this.detail.columns = [...this.detail.defaultColumns.filter(item => item.key != 'itemCategory')] + } + else this.detail.columns = [...this.detail.defaultColumns] + } + } + }, + computed: { encodedDictCode() { let suffix if (!Boolean(this.model.maintenanceCategory) || this.model.maintenanceCategory === 'THIRD_MAINTENANCE') return @@ -247,6 +312,7 @@ } }, methods: { + // 涓婚〉闈㈢偣鍑绘柊澧炲悗瑙﹀彂 add() { this.model = {} this.visible = true @@ -255,6 +321,10 @@ this.detail.dataSource = [] }, + /** + * 涓婚〉闈㈢偣鍑荤紪杈戝悗瑙﹀彂 + * @param record 涓婚〉闈㈠垪琛ㄨ璁板綍 + */ edit(record) { this.model = Object.assign({}, record) this.visible = true @@ -264,6 +334,10 @@ this.loadDetail(record.id) }, + /** + * 鐐瑰嚮鍗囩増鍚庤Е鍙� + * @param record 涓婚〉闈㈠垪琛ㄨ璁板綍 + */ upgrade(record) { this.model = Object.assign({}, record) this.visible = true @@ -297,8 +371,9 @@ if (value !== 'THIRD_MAINTENANCE') delete item.itemPart delete item.itemCategory }) + this.detail.dataSource = [...tableData] - console.log('tableData', tableData) + this.$refs.editableDetailTable.validateTable() }, /** @@ -419,5 +494,6 @@ /deep/ textarea.ant-input { resize: none; + margin-bottom: 0; } </style> \ No newline at end of file -- Gitblit v1.9.3