From a9f005e2af294c47d7cd1e4b6ed401bf65f5b080 Mon Sep 17 00:00:00 2001 From: zhangherong <571457620@qq.com> Date: 星期二, 04 三月 2025 16:44:09 +0800 Subject: [PATCH] art: 所有设备 台账 二保工单 根据设备id查询二保工单,并过滤掉已完成和已取消的二保工单 --- src/views/eam/modules/operationCertificate/OperationCertificateForm.vue | 540 ++++++++++++++++++++++++++++++++++++----------------------- 1 files changed, 330 insertions(+), 210 deletions(-) diff --git a/src/views/eam/modules/operationCertificate/OperationCertificateForm.vue b/src/views/eam/modules/operationCertificate/OperationCertificateForm.vue index 2821bf7..4765370 100644 --- a/src/views/eam/modules/operationCertificate/OperationCertificateForm.vue +++ b/src/views/eam/modules/operationCertificate/OperationCertificateForm.vue @@ -1,73 +1,182 @@ <template> - <a-spin :spinning="confirmLoading"> - <j-form-container :disabled="formDisabled"> + <a-spin :spinning='confirmLoading'> + <j-form-container :disabled='formDisabled'> <!-- 涓昏〃鍗曞尯鍩� --> - <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail"> + <a-form-model + ref='form' + :model='model' + :rules='validatorRules' + slot='detail' + > <a-row> - <a-col :span="12" > - <a-form-model-item label="鎿嶄綔璇佺紪鍙�" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="num"> - <a-input v-model="model.num" placeholder="璇疯緭鍏ユ搷浣滆瘉缂栧彿" ></a-input> + <a-col :span='12'> + <a-form-model-item + label='鎿嶄綔璇佺紪鍙�' + :labelCol='labelCol' + :wrapperCol='wrapperCol' + prop='num' + > + <a-input + v-model='model.num' + placeholder='璇疯緭鍏ユ搷浣滆瘉缂栧彿' + disabled + ></a-input> </a-form-model-item> </a-col> - <a-col :span="12" > - <a-form-model-item label="濮撳悕" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="userId"> - <j-select-user-by-dep v-model="model.userId" :multi="false" /> + <a-col :span='12'> + <a-form-model-item + label='濮撳悕' + :labelCol='labelCol' + :wrapperCol='wrapperCol' + prop='userId' + > + <!-- <j-select-user-by-dep + v-model='model.userId' + :multi='false' + /> --> + <j-dict-select-tag + type='list' + v-model='model.userId' + dictCode='sys_user,realname,id' + placeholder='璇烽�夋嫨鐢宠浜�' + disabled + /> </a-form-model-item> </a-col> - <a-col :span="12" > - <a-form-model-item label="鍙戣瘉鏃ユ湡" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="issueDate"> - <j-date placeholder="璇烽�夋嫨鍙戣瘉鏃ユ湡" v-model="model.issueDate" style="width: 100%" /> + <a-col :span='12'> + <a-form-model-item + label='鍙戣瘉鏃ユ湡' + :labelCol='labelCol' + :wrapperCol='wrapperCol' + prop='issueDate' + > + <j-date + placeholder='璇烽�夋嫨鍙戣瘉鏃ユ湡' + v-model='model.issueDate' + style='width: 100%' + disabled + /> </a-form-model-item> </a-col> - <a-col :span="12" > - <a-form-model-item label="寮�濮嬫椂闂�" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="startTime"> - <j-date placeholder="璇烽�夋嫨寮�濮嬫椂闂�" v-model="model.startTime" style="width: 100%" /> + <a-col :span='12'> + <a-form-model-item + label='寮�濮嬫椂闂�' + :labelCol='labelCol' + :wrapperCol='wrapperCol' + prop='startTime' + > + <j-date + placeholder='璇烽�夋嫨寮�濮嬫椂闂�' + v-model='model.startTime' + style='width: 100%' + disabled + /> </a-form-model-item> </a-col> - <a-col :span="12" > - <a-form-model-item label="缁撴潫鏃堕棿" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="endTime"> - <j-date placeholder="璇烽�夋嫨缁撴潫鏃堕棿" v-model="model.endTime" style="width: 100%" /> + <a-col :span='12'> + <a-form-model-item + label='缁撴潫鏃堕棿' + :labelCol='labelCol' + :wrapperCol='wrapperCol' + prop='endTime' + > + <j-date + placeholder='璇烽�夋嫨缁撴潫鏃堕棿' + v-model='model.endTime' + style='width: 100%' + disabled + /> </a-form-model-item> </a-col> - <a-col :span="12" > - <a-form-model-item label="褰撳墠鍛ㄦ湡鍒嗘暟" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="currentCycleScore"> - <a-input-number v-model="model.currentCycleScore" placeholder="璇疯緭鍏ュ綋鍓嶅懆鏈熷垎鏁�" style="width: 100%" /> + <a-col :span='12'> + <a-form-model-item + label='褰撳墠鍛ㄦ湡鍒嗘暟' + :labelCol='labelCol' + :wrapperCol='wrapperCol' + prop='currentCycleScore' + > + <a-input-number + v-model='model.currentCycleScore' + placeholder='璇疯緭鍏ュ綋鍓嶅懆鏈熷垎鏁�' + style='width: 100%' + disabled + /> </a-form-model-item> </a-col> - <a-col :span="12" > - <a-form-model-item label="璁惧缁熶竴缂栫爜" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="equipmentIds"> - <j-multi-select-tag type="list_multi" v-model="model.equipmentIds" dictCode="mom_eam_equipment,num,id" placeholder="璇烽�夋嫨璁惧缁熶竴缂栫爜" /> + <a-col :span='12'> + <a-form-model-item + label='璁惧缁熶竴缂栫爜' + :labelCol='labelCol' + :wrapperCol='wrapperCol' + prop='equipmentIds' + > + <j-multi-select-tag + type='list_multi' + v-model='model.equipmentIds' + dictCode='mom_eam_equipment,num,id' + placeholder='璇烽�夋嫨璁惧缁熶竴缂栫爜' + disabled + /> </a-form-model-item> </a-col> - <a-col :span="12" > - <a-form-model-item label="鐘舵��" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="status"> - <j-dict-select-tag type="list" v-model="model.status" dictCode="certificate_status" placeholder="璇烽�夋嫨鐘舵��" disabled/> + <a-col :span='12'> + <a-form-model-item + label='鐘舵��' + :labelCol='labelCol' + :wrapperCol='wrapperCol' + prop='status' + > + <j-dict-select-tag + type='list' + v-model='model.status' + dictCode='certificate_status' + placeholder='璇烽�夋嫨鐘舵��' + disabled + /> </a-form-model-item> </a-col> - <a-col :span="24" > - <a-form-model-item label="澶囨敞" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="remark"> - <a-textarea v-model="model.remark" placeholder="璇疯緭鍏ュ娉�" ></a-textarea> + </a-row> + <a-row :gutter="24"> + <a-col :span="24"> + <a-form-model-item + label='澶囨敞' + :labelCol="{span:3}" + :wrapperCol="{span:21}" + prop='remark' + > + <a-textarea + v-model='model.remark' + placeholder='璇疯緭鍏ュ娉�' + ></a-textarea> </a-form-model-item> </a-col> - </a-row> </a-form-model> </j-form-container> - <!-- 瀛愯〃鍗曞尯鍩� --> - <a-tabs v-model="activeKey" @change="handleChangeTabs"> - <a-tab-pane tab="鎿嶄綔璇佺鐞嗘槑缁�" :key="refKeys[0]" :forceRender="true"> + <!-- 瀛愯〃鍗曞尯鍩� --> + <a-tabs + v-model='activeKey' + @change='handleChangeTabs' + > + <a-tab-pane + tab='鎿嶄綔璇佺鐞嗘槑缁�' + :key='refKeys[0]' + :forceRender='true' + > <j-vxe-table keep-source - :ref="refKeys[0]" - :loading="operationCertificateDetailTable.loading" - :columns="operationCertificateDetailTable.columns" - :dataSource="operationCertificateDetailTable.dataSource" - :maxHeight="300" - :disabled="formDisabled" - :rowNumber="true" - :rowSelection="true" - :toolbar="true" - /> + :ref='refKeys[0]' + :loading='operationCertificateDetailTable.loading' + :columns='operationCertificateDetailTable.columns' + :dataSource='operationCertificateDetailTable.dataSource' + :maxHeight='300' + :disabled='formDisabled' + :rowNumber='true' + :rowSelection='true' + :toolbar='true' + :bordered='true' + :alwaysEdit='true' + /> </a-tab-pane> </a-tabs> </a-spin> @@ -75,177 +184,188 @@ <script> - import { getAction } from '@/api/manage' - import { JVxeTableModelMixin } from '@/mixins/JVxeTableModelMixin.js' - import { JVXETypes } from '@/components/jeecg/JVxeTable' - import { getRefPromise,VALIDATE_FAILED} from '@/components/jeecg/JVxeTable/utils/vxeUtils.js' - import { validateDuplicateValue } from '@/utils/util' - import JFormContainer from '@/components/jeecg/JFormContainer' +import { getAction } from '@/api/manage' +import { JVxeTableModelMixin } from '@/mixins/JVxeTableModelMixin.js' +import { JVXETypes } from '@/components/jeecg/JVxeTable' +import { getRefPromise, VALIDATE_FAILED } from '@/components/jeecg/JVxeTable/utils/vxeUtils.js' +import { validateDuplicateValue } from '@/utils/util' +import JFormContainer from '@/components/jeecg/JFormContainer' - export default { - name: 'OperationCertificateForm', - mixins: [JVxeTableModelMixin], - components: { - JFormContainer, - }, - data() { - return { - labelCol: { - xs: { span: 24 }, - sm: { span: 5 }, - }, - wrapperCol: { - xs: { span: 24 }, - sm: { span: 16 }, - }, - model:{ - }, - // 鏂板鏃跺瓙琛ㄩ粯璁ゆ坊鍔犲嚑琛岀┖鏁版嵁 - addDefaultRowNum: 1, - validatorRules: { - num: [ - { required: true, message: '璇疯緭鍏ユ搷浣滆瘉缂栧彿!'}, - ], - currentCycleScore: [ - { required: true, message: '璇疯緭鍏ュ綋鍓嶅懆鏈熷垎鏁�!'}, - { pattern: /^-?\d+\.?\d*$/, message: '璇疯緭鍏ユ暟瀛�!'}, - ], - }, - refKeys: ['operationCertificateDetail', ], - tableKeys:['operationCertificateDetail', ], - activeKey: 'operationCertificateDetail', - // 鎿嶄綔璇佺鐞嗘槑缁� - operationCertificateDetailTable: { - loading: false, - dataSource: [], - columns: [ - { - title: '璇佷功ID', - key: 'operationCertificateId', - type: JVXETypes.hidden, - width:"200px", - placeholder: '璇疯緭鍏�${title}', - defaultValue:'', - }, - { - title: '鏃ユ湡', - key: 'happenDate', - type: JVXETypes.date, - width:"120px", - placeholder: '璇疯緭鍏�${title}', - defaultValue:'', - }, - { - title: '绫诲瀷', - key: 'type', - type: JVXETypes.select, - dictCode: 'certificate_change_type', - width:"100px", - placeholder: '璇疯緭鍏�${title}', - defaultValue:'', - }, - { - title: '璁惧缁熶竴缂栫爜', - key: 'equipmentId', - type: JVXETypes.selectSearch, - dictCode: 'mom_eam_equipment,num,id ', - width: '200px', - placeholder: '璇疯緭鍏�${title}', - defaultValue: '', - validateRules: [{ required: true, message: '${title}涓嶈兘涓虹┖' }] - }, - { - title: '鎵e垎椤�', - key: 'deductionItem', - type: JVXETypes.selectSearch, - dictCode: 'mom_eam_base_deduction_item,content,id ', - width:"500px", - placeholder: '璇疯緭鍏�${title}', - defaultValue:'', - }, - { - title: '鎵e垎鍛ㄦ湡', - key: 'period', - type: JVXETypes.normal, - width:"200px", - placeholder: '璇疯緭鍏�${title}', - defaultValue:'', - }, - ] - }, - url: { - add: "/eam/operationCertificate/add", - edit: "/eam/operationCertificate/edit", - queryById: "/eam/operationCertificate/queryById", - operationCertificateDetail: { - list: '/eam/operationCertificate/queryOperationCertificateDetailByMainId' +export default { + name: 'OperationCertificateForm', + mixins: [JVxeTableModelMixin], + components: { + JFormContainer + }, + data() { + return { + labelCol: { + xs: { span: 24 }, + sm: { span: 6 }, + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 18 }, + }, + model: {}, + // 鏂板鏃跺瓙琛ㄩ粯璁ゆ坊鍔犲嚑琛岀┖鏁版嵁 + addDefaultRowNum: 1, + + validatorRules: { + num: [ + { required: true, message: '璇疯緭鍏ユ搷浣滆瘉缂栧彿!' } + ], + currentCycleScore: [ + { required: true, message: '璇疯緭鍏ュ綋鍓嶅懆鏈熷垎鏁�!' }, + { pattern: /^-?\d+\.?\d*$/, message: '璇疯緭鍏ユ暟瀛�!' } + ] + }, + refKeys: ['operationCertificateDetail'], + tableKeys: ['operationCertificateDetail'], + activeKey: 'operationCertificateDetail', + // 鎿嶄綔璇佺鐞嗘槑缁� + operationCertificateDetailTable: { + loading: false, + dataSource: [], + columns: [ + { + title: '璇佷功ID', + key: 'operationCertificateId', + type: JVXETypes.hidden, + placeholder: '璇疯緭鍏�${title}', + defaultValue: '' }, - } - } - }, - props: { - //琛ㄥ崟绂佺敤 - disabled: { - type: Boolean, - default: false, - required: false - } - }, - computed: { - formDisabled(){ - return this.disabled - }, - }, - created () { - }, - methods: { - addBefore(){ - this.operationCertificateDetailTable.dataSource=[] - }, - getAllTable() { - let values = this.tableKeys.map(key => getRefPromise(this, key)) - return Promise.all(values) - }, - /** 璋冪敤瀹宔dit()鏂规硶涔嬪悗浼氳嚜鍔ㄨ皟鐢ㄦ鏂规硶 */ - editAfter() { - this.$nextTick(() => { - }) - // 鍔犺浇瀛愯〃鏁版嵁 - if (this.model.id) { - let params = { id: this.model.id } - this.requestSubTableData(this.url.operationCertificateDetail.list, params, this.operationCertificateDetailTable) - } - }, - //鏍¢獙鎵�鏈変竴瀵逛竴瀛愯〃琛ㄥ崟 - validateSubForm(allValues){ - return new Promise((resolve,reject)=>{ - Promise.all([ - ]).then(() => { - resolve(allValues) - }).catch(e => { - if (e.error === VALIDATE_FAILED) { - // 濡傛灉鏈夋湭閫氳繃琛ㄥ崟楠岃瘉鐨勫瓙琛紝灏辫嚜鍔ㄨ烦杞埌瀹冩墍鍦ㄧ殑tab - this.activeKey = e.index == null ? this.activeKey : this.refKeys[e.index] - } else { - console.error(e) - } - }) - }) - }, - /** 鏁寸悊鎴恌ormData */ - classifyIntoFormData(allValues) { - let main = Object.assign(this.model, allValues.formValue) - return { - ...main, // 灞曞紑 - operationCertificateDetailList: allValues.tablesValue[0].tableData, - } - }, - validateError(msg){ - this.$message.error(msg) - }, + { + title: '鏃ユ湡', + key: 'happenDate', + type: JVXETypes.date, + placeholder: '璇疯緭鍏�${title}', + width: '300px', + defaultValue: '' + }, + { + title: '绫诲瀷', + key: 'type', + type: JVXETypes.select, + dictCode: 'certificate_change_type', + placeholder: '璇疯緭鍏�${title}', + width: '200px', + defaultValue: '' + }, + { + title: '璁惧缁熶竴缂栫爜', + key: 'equipmentId', + type: JVXETypes.selectSearch, + dictCode: 'mom_eam_equipment,num,id ', + width: '250px', + placeholder: '璇疯緭鍏�${title}', + defaultValue: '', + validateRules: [{ required: true, message: '${title}涓嶈兘涓虹┖' }] + }, + { + title: '鎵e垎椤�', + key: 'deductionItem', + type: JVXETypes.selectSearch, + dictCode: 'mom_eam_base_deduction_item,content,id ', + width: '500px', + placeholder: '璇疯緭鍏�${title}', + defaultValue: '' + }, + // { + // title: '鎵e垎鍛ㄦ湡', + // key: 'period', + // type: JVXETypes.normal, + // width: '200px', + // placeholder: '璇疯緭鍏�${title}', + // defaultValue: '' + // } + ] + }, + url: { + add: '/eam/operationCertificate/add', + edit: '/eam/operationCertificate/edit', + queryById: '/eam/operationCertificate/queryById', + operationCertificateDetail: { + list: '/eam/operationCertificate/queryOperationCertificateDetailByMainId' + } + } } + }, + props: { + //琛ㄥ崟绂佺敤 + disabled: { + type: Boolean, + default: false, + required: false + }, + //瀛愯〃鍔犺浇 + loadSubTableData: { + type: Boolean, + default: true, + required: false + } + }, + computed: { + formDisabled() { + return this.disabled + }, + loadSubTableDataMode() { + return this.loadSubTableData + } + }, + created() { + }, + methods: { + addBefore() { + this.operationCertificateDetailTable.dataSource = [] + }, + getAllTable() { + let values = this.tableKeys.map(key => getRefPromise(this, key)) + return Promise.all(values) + }, + /** 璋冪敤瀹宔dit()鏂规硶涔嬪悗浼氳嚜鍔ㄨ皟鐢ㄦ鏂规硶 */ + editAfter() { + this.$nextTick(() => { + }) + console.log("this.loadSubTableDataMode:" + this.loadSubTableDataMode) + // 鍔犺浇瀛愯〃鏁版嵁 + if (this.model.id && this.loadSubTableDataMode) { + let params = { id: this.model.id } + // 鍔犺浇瀛愯〃鏁版嵁 + this.requestSubTableData(this.url.operationCertificateDetail.list, params, this.operationCertificateDetailTable) + } + + }, + //鏍¢獙鎵�鏈変竴瀵逛竴瀛愯〃琛ㄥ崟 + validateSubForm(allValues) { + return new Promise((resolve, reject) => { + Promise.all([]).then(() => { + resolve(allValues) + }).catch(e => { + if (e.error === VALIDATE_FAILED) { + // 濡傛灉鏈夋湭閫氳繃琛ㄥ崟楠岃瘉鐨勫瓙琛紝灏辫嚜鍔ㄨ烦杞埌瀹冩墍鍦ㄧ殑tab + this.activeKey = e.index == null ? this.activeKey : this.refKeys[e.index] + } else { + console.error(e) + } + }) + }) + }, + /** 鏁寸悊鎴恌ormData */ + classifyIntoFormData(allValues) { + let main = Object.assign(this.model, allValues.formValue) + return { + ...main, // 灞曞紑 + operationCertificateDetailList: allValues.tablesValue[0].tableData + } + }, + validateError(msg) { + this.$message.error(msg) + } + } +} </script> <style scoped> -- Gitblit v1.9.3