From 2de735967d33dba5da5fc87191dee543b000afaf Mon Sep 17 00:00:00 2001 From: lyh <925863403@qq.com> Date: 星期五, 18 七月 2025 20:20:18 +0800 Subject: [PATCH] 删除 --- src/views/eam/maintenance/modules/EamSecondMaintenanceBatchOrderModal.vue | 167 +++++++++++++++++++++++++++++++++++-------------------- 1 files changed, 106 insertions(+), 61 deletions(-) diff --git a/src/views/eam/maintenance/modules/EamSecondMaintenanceBatchOrderModal.vue b/src/views/eam/maintenance/modules/EamSecondMaintenanceBatchOrderModal.vue index 7f78e9f..71ba4f5 100644 --- a/src/views/eam/maintenance/modules/EamSecondMaintenanceBatchOrderModal.vue +++ b/src/views/eam/maintenance/modules/EamSecondMaintenanceBatchOrderModal.vue @@ -2,21 +2,41 @@ <j-modal :title="title" :width="1200" :visible="visible" :confirmLoading="confirmLoading" switchFullscreen centered :mask-closable="false" @ok="handleOk" @cancel="handleCancel" cancelText="鍏抽棴"> <a-spin :spinning="spinning"> - <j-vxe-table ref="editableDetailTable" rowNumber rowSelection bordered alwaysEdit toolbar @added="addNewRow" + <j-vxe-table ref="editableDetailTable" rowNumber rowSelection bordered alwaysEdit toolbar :toolbarConfig="detail.toolbarConfig" keep-source :height="500" - :dataSource="detail.dataSource" :columns="detail.columns"/> + :dataSource="detail.dataSource" :columns="detail.columns"> + <!--缁熶竴缂栫爜--> + <template v-slot:equipmentId="props"> + <maintenance-equipment-select placeholder="璇疯緭鍏ョ粺涓�缂栫爜鎴栧悕绉版悳绱�" v-model="props.row.equipmentId" + maintenanceCategory="SECOND_MAINTENANCE" :allowClear="false" + @autocompleteForm="autocompleteForm($event,props.row)"/> + </template> + + <!-- 淇濆吇鏃ユ湡--> + <template v-slot:maintenanceDate="props"> + <a-date-picker v-model="props.row.maintenanceDate" value-format="YYYY-MM-DD"/> + </template> + + <!-- 鎿嶄綔--> + <template v-slot:action="props"> + <a :disabled="!props.row.equipmentId" @click="handlePreviewDetail(props.row.standardId)">棰勮鏄庣粏</a> + </template> + </j-vxe-table> </a-spin> + + <eam-second-maintenance-batch-order-detail-modal ref="detailModal"/> </j-modal> </template> <script> - import { getAction, httpAction } from '@/api/manage' + import { postAction } from '@/api/manage' import MaintenanceEquipmentSelect from '@views/eam/equipment/modules/MaintenanceEquipmentSelect.vue' import { JVXETypes } from '@comp/jeecg/JVxeTable' + import EamSecondMaintenanceBatchOrderDetailModal from './EamSecondMaintenanceBatchOrderDetailModal' export default { name: 'EamSecondMaintenanceBatchOrderModal', - components: { MaintenanceEquipmentSelect }, + components: { EamSecondMaintenanceBatchOrderDetailModal, MaintenanceEquipmentSelect }, data() { return { title: '鎿嶄綔', @@ -36,39 +56,63 @@ }, { title: '宸ュ崟鍙�', - dataIndex: 'orderNum', + key: 'orderNum', align: 'center', type: JVXETypes.inputNumber, disabled: true, - placeholder: '宸ュ崟鍙风郴缁熻嚜鍔ㄧ敓鎴�' + placeholder: '${title}绯荤粺鑷姩鐢熸垚', + width: 200 }, { title: '缁熶竴缂栫爜', - dataIndex: 'equipmentId', + key: 'equipmentId', align: 'center', type: JVXETypes.slot, - slotName: 'equipmentId' + slotName: 'equipmentId', + width: 300, + validateRules: [ + { required: true, message: '璇疯緭鍏�${title}鎴栧悕绉版悳绱�' }, + { unique: true, message: '${title}涓嶈兘閲嶅' } + ] }, { title: '瑙勮寖鍚嶇О', - dataIndex: 'standardName', + key: 'standardName', align: 'center', - type: JVXETypes.input, - disabled: true, - placeholder: '閫夋嫨璁惧鍚庤嚜鍔ㄥ甫鍑�' + type: JVXETypes.normal, + width: 200 }, { title: '淇濆吇鏃ユ湡', - dataIndex: 'maintenanceDate', + key: 'maintenanceDate', align: 'center', - type: JVXETypes.date + type: JVXETypes.slot, + width: 200, + slotName: 'maintenanceDate', + validateRules: [{ required: true, message: '璇烽�夋嫨${title}' }] }, { title: '淇濆吇鍛ㄦ湡', - dataIndex: 'maintenancePeriod', + key: 'maintenancePeriod', align: 'center', - type: JVXETypes.inputNumber, - defaultValue: '6' + type: JVXETypes.normal, + width: 150 + }, + { + title: '澶囨敞', + key: 'remark', + align: 'center', + type: JVXETypes.textarea, + placeholder: '璇疯緭鍏ュ娉�', + width: 300 + }, + { + title: '鎿嶄綔', + align: 'center', + type: JVXETypes.slot, + width: 150, + slotName: 'action', + fixed: 'right' } ], toolbarConfig: { @@ -89,57 +133,52 @@ this.detail.operatorMaintenanceList = this.detail.repairerMaintenanceList = [] }, - addNewRow({ row }) { - console.log('row', row) - row.maintenancePeriod = 6 - this.$refs.editableDetailTable.updateData() + handlePreviewDetail(standardId) { + this.$refs.detailModal.visible = true + this.$refs.detailModal.loadStandardDetail(standardId) }, - autocompleteForm(selectObj) { - this.$set(this.model, 'standardName', selectObj.standardName) - this.$set(this.model, 'standardId', selectObj.id) - this.$set(this.model, 'equipmentId', selectObj.equipmentId) - if (!this.model.id) this.loadStandardDetail(selectObj.id) + autocompleteForm(selectObj, record) { + this.$set(record, 'standardName', selectObj.standardName) + this.$set(record, 'standardId', selectObj.id) + this.$set(record, 'equipmentId', selectObj.equipmentId) + this.$set(record, 'maintenancePeriod', selectObj.maintenancePeriod) + this.$refs.editableDetailTable.validateTable() }, async handleOk() { - const that = this - // 瑙﹀彂琛ㄥ崟楠岃瘉 - this.$refs.form.validate(valid => { - if (valid) { - that.confirmLoading = that.spinning = true - let httpUrl = '' - let method = '' - if (!this.model.id) { - httpUrl += this.url.add - method = 'post' + const requests = this.$refs.editableDetailTable.getTableData() + if (requests.length == 0) { + this.$notification.warning({ + message: '娑堟伅', + description: '璇疯嚦灏戞柊澧炰竴鏉¤褰�' + }) + return + } + + const errMap = await this.$refs.editableDetailTable.validateTable() + if (errMap) return + + this.confirmLoading = this.spinning = true + postAction(this.url.batchAdd, requests) + .then((res) => { + if (res.success) { + this.$notification.success({ + message: '娑堟伅', + description: res.message + }) + this.$emit('ok') + this.close() } else { - httpUrl += this.url.edit - method = 'put' + this.$notification.warning({ + message: '娑堟伅', + description: res.message + }) } - httpAction(httpUrl, this.model, method) - .then((res) => { - if (res.success) { - that.$notification.success({ - message: '娑堟伅', - description: res.message - }) - that.$emit('ok') - that.close() - } else { - that.$notification.warning({ - message: '娑堟伅', - description: res.message - }) - } - }) - .finally(() => { - that.confirmLoading = that.spinning = false - }) - } else { - return false - } - }) + }) + .finally(() => { + this.confirmLoading = this.spinning = false + }) }, handleCancel() { @@ -154,3 +193,9 @@ } } </script> + +<style scoped lang="less"> + /deep/ .ant-select-dropdown-menu { + text-align: left; + } +</style> -- Gitblit v1.9.3