From 0eaf97f0ae448f4376e89a8544efb54a930eb643 Mon Sep 17 00:00:00 2001 From: zenglf <18502938215@163.com> Date: 星期三, 18 十月 2023 18:07:51 +0800 Subject: [PATCH] 操作证管理功能 前端界面增加操作证明细 --- src/views/eam/OperationCertificateList.vue | 120 +++++- src/views/eam/modules/operationCertificate/OperationCertificateDetailList.vue | 302 +++++++-------- src/views/eam/modules/operationCertificate/OperationCertificateModal.vue | 93 ++-- src/views/eam/modules/operationCertificate/OperationCertificateForm.vue | 430 +++++++++++---------- src/views/eam/modules/operationCertificate/OperationCertificateDetailModal.vue | 148 +++++++ 5 files changed, 647 insertions(+), 446 deletions(-) diff --git a/src/views/eam/OperationCertificateList.vue b/src/views/eam/OperationCertificateList.vue index 5792dfa..dcd8554 100644 --- a/src/views/eam/OperationCertificateList.vue +++ b/src/views/eam/OperationCertificateList.vue @@ -44,8 +44,8 @@ <!-- 鎿嶄綔鎸夐挳鍖哄煙 --> <div class='table-operator'> - <a-button @click='handleAdd' type='primary' icon='plus'>鏂板</a-button> -<!-- <a-button @click='handleChangeCertificate' type='primary' icon='plus'>鍙樻洿鎿嶄綔璇�</a-button>--> +<!-- <a-button @click='handleAdd' type='primary' icon='plus'>鏂板</a-button>--> + <a-button @click='handleChangeCertificate' type='primary' icon='plus'>鍙樻洿鎿嶄綔璇�</a-button> <a-button type='primary' icon='download' @click="handleExportXls('鎿嶄綔璇佷功绠$悊')">瀵煎嚭</a-button> <a-upload name='file' :showUploadList='false' :multiple='false' :headers='tokenHeader' :action='importExcelUrl' @change='handleImportExcel'> @@ -80,8 +80,11 @@ :dataSource='dataSource' :pagination='ipagination' :loading='loading' - :rowSelection='{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}' + :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange ,type:'radio'}" + :customRow='clickThenSelect' @change='handleTableChange'> + + <template slot='htmlSlot' slot-scope='text'> <div v-html='text'></div> @@ -106,8 +109,8 @@ <span slot='action' slot-scope='text, record'> <!-- <a @click='handleEdit(record)'>缂栬緫</a>--> -<!-- <a-divider type='vertical' />--> - <a @click='handleDetail(record)'>璇︽儏</a> + <!-- <a-divider type='vertical' />--> +<!-- <a @click='handleDetail(record)'>璇︽儏</a>--> <!-- <a-divider type="vertical" />--> <!-- <a-dropdown>--> <!-- <a class="ant-dropdown-link">鏇村 <a-icon type="down" /></a>--> @@ -126,7 +129,11 @@ </a-table> </div> - + <a-tabs defaultActiveKey="1"> + <a-tab-pane tab="鎿嶄綔璇佺鐞嗘槑缁�" key="1" > + <OperationCertificateDetailList :mainId="operationCertificateDetailMainId" /> + </a-tab-pane> + </a-tabs> <operation-certificate-modal ref='modalForm' @ok='modalFormOk' /> </a-card> </template> @@ -135,14 +142,16 @@ import { JeecgListMixin } from '@/mixins/JeecgListMixin' import OperationCertificateModal from './modules/operationCertificate/OperationCertificateModal' +import OperationCertificateDetailList from './modules/operationCertificate/OperationCertificateDetailList' import { filterMultiDictText } from '@/components/dict/JDictSelectUtil' import '@/assets/less/TableExpand.less' - +import { getAction } from '@/api/manage' export default { name: 'OperationCertificateList', mixins: [JeecgListMixin], components: { - OperationCertificateModal + OperationCertificateModal, + OperationCertificateDetailList }, data() { return { @@ -213,14 +222,14 @@ align: 'center', dataIndex: 'status_dictText' }, - { - title: '鎿嶄綔', - dataIndex: 'action', - align: 'center', - fixed: 'right', - width: 147, - scopedSlots: { customRender: 'action' } - } + // { + // title: '鎿嶄綔', + // dataIndex: 'action', + // align: 'center', + // fixed: 'right', + // width: 147, + // scopedSlots: { customRender: 'action' } + // } ], url: { list: '/eam/operationCertificate/list', @@ -231,7 +240,22 @@ }, dictOptions: {}, - superFieldList: [] + superFieldList: [], + /* 鍒嗛〉鍙傛暟 */ + ipagination:{ + current: 1, + pageSize: 5, + pageSizeOptions: ['5', '10', '50'], + showTotal: (total, range) => { + return range[0] + "-" + range[1] + " 鍏�" + total + "鏉�" + }, + showQuickJumper: true, + showSizeChanger: true, + total: 0 + }, + selectedMainId:'', + + operationCertificateDetailMainId: '', } }, created() { @@ -245,13 +269,61 @@ methods: { initDictConfig() { }, - - // handleChangeCertificate: function (record) { - // this.$refs.modalForm.edit(record) - // this.$refs.modalForm.title = '鍙樻洿鎿嶄綔璇�' - // this.$refs.modalForm.disableSubmit = false - // // this.$refs.modalForm.isRevise = false; - // }, + clickThenSelect(record) { + return { + on: { + click: () => { + this.onSelectChange(record.id.split(","), [record]); + } + } + } + }, + handleChangeCertificate: function() { + if (this.selectionRows.length <= 0) { + this.$message.warning('璇烽�夋嫨涓�鏉¤褰�') + return + } + const record = this.selectionRows[0] + this.$refs.modalForm.edit(record) + this.$refs.modalForm.title = '鍙樻洿鎿嶄綔璇�' + this.$refs.modalForm.disableSubmit = false + this.$refs.modalForm.loadSubTableDataFlag = false + // this.$refs.modalForm.isRevise = false; + }, + onClearSelected() { + this.selectedRowKeys = []; + this.selectionRows = []; + this.selectedMainId='' + }, + onSelectChange(selectedRowKeys, selectionRows) { + this.selectedMainId=selectedRowKeys[0] + this.selectedRowKeys = selectedRowKeys; + this.selectionRows = selectionRows; + this.operationCertificateDetailMainId = selectionRows[0]['id'] + }, + loadData(arg) { + if(!this.url.list){ + this.$message.error("璇疯缃畊rl.list灞炴��!") + return + } + //鍔犺浇鏁版嵁 鑻ヤ紶鍏ュ弬鏁�1鍒欏姞杞界涓�椤电殑鍐呭 + if (arg === 1) { + this.ipagination.current = 1; + } + this.onClearSelected() + var params = this.getQueryParams();//鏌ヨ鏉′欢 + this.loading = true; + getAction(this.url.list, params).then((res) => { + if (res.success) { + this.dataSource = res.result.records; + this.ipagination.total = res.result.total; + } + if(res.code===510){ + this.$message.warning(res.message) + } + this.loading = false; + }) + }, getSuperFieldList() { let fieldList = [] fieldList.push({ type: 'string', value: 'num', text: '鎿嶄綔璇佺紪鍙�', dictCode: '' }) diff --git a/src/views/eam/modules/operationCertificate/OperationCertificateDetailList.vue b/src/views/eam/modules/operationCertificate/OperationCertificateDetailList.vue index 3a20e21..31ecb2b 100644 --- a/src/views/eam/modules/operationCertificate/OperationCertificateDetailList.vue +++ b/src/views/eam/modules/operationCertificate/OperationCertificateDetailList.vue @@ -1,241 +1,207 @@ <template> - <a-card - :bordered='false' - :class="'cust-erp-sub-tab'" - > + <a-card :bordered="false" :class="'cust-erp-sub-tab'"> <!-- 鏌ヨ鍖哄煙 --> - <div class='table-page-search-wrapper'> + <div class="table-page-search-wrapper"> + <a-form layout="inline" @keyup.enter.native="searchQuery"> + <a-row :gutter="24"> + </a-row> + </a-form> + </div> + <!-- 鏌ヨ鍖哄煙-END --> + <!-- 鎿嶄綔鎸夐挳鍖哄煙 --> + <div class="table-operator" v-if="mainId"> +<!-- <a-button @click="handleAdd" type="primary" icon="plus">鏂板</a-button>--> +<!-- <a-button type="primary" icon="download" @click="handleExportXls('鎿嶄綔璇佺鐞嗘槑缁�')">瀵煎嚭</a-button>--> +<!-- <a-upload--> +<!-- name="file"--> +<!-- :showUploadList="false"--> +<!-- :multiple="false"--> +<!-- :headers="tokenHeader"--> +<!-- :action="importExcelUrl"--> +<!-- @change="handleImportExcel">--> +<!-- <a-button type="primary" icon="import">瀵煎叆</a-button>--> +<!-- </a-upload>--> +<!-- <a-dropdown v-if="selectedRowKeys.length > 0">--> +<!-- <a-menu slot="overlay">--> +<!-- <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>鍒犻櫎</a-menu-item>--> +<!-- </a-menu>--> +<!-- <a-button style="margin-left: 8px"> 鎵归噺鎿嶄綔 <a-icon type="down" /></a-button>--> +<!-- </a-dropdown>--> </div> + <!-- table鍖哄煙-begin --> <div> + <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> + <i class="anticon anticon-info-circle ant-alert-icon"></i> 宸查�夋嫨 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>椤� + <a style="margin-left: 24px" @click="onClearSelected">娓呯┖</a> + </div> <a-table - ref='table' - size='middle' + ref="table" + size="middle" bordered - rowKey='id' - :scroll="{ x: 'calc(1400px + 50%)', y: 900 }" - :columns='columns' - :dataSource='dataSource' - :pagination='ipagination' - :loading='loading' - @change='handleTableChange' - > + rowKey="id" + :scroll="{x:true}" + :columns="columns" + :dataSource="dataSource" + :pagination="ipagination" + :loading="loading" + :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" + @change="handleTableChange"> - <template - slot='htmlSlot' - slot-scope='text' - > - <div v-html='text'></div> + <template slot="htmlSlot" slot-scope="text"> + <div v-html="text"></div> </template> - <template - slot='imgSlot' - slot-scope='text,record' - > - <span - v-if='!text' - style='font-size: 12px;font-style: italic;' - >鏃犲浘鐗�</span> - <img - v-else - :src='getImgView(text)' - :preview='record.id' - height='25px' - alt='' - style='max-width:80px;font-size: 12px;font-style: italic;' - /> + <template slot="imgSlot" slot-scope="text,record"> + <span v-if="!text" style="font-size: 12px;font-style: italic;">鏃犲浘鐗�</span> + <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/> </template> - <template - slot='takingInfo' - slot-scope='text' - > - <span - v-if='!text' - style='font-size: 12px;font-style: italic;color: #126ee7;' - >/</span> - <span - v-if='text' - style='font-size: 12px;font-style: italic;' - >{{ text }}</span> - </template> - <template - slot='fileSlot' - slot-scope='text' - > - <span - v-if='!text' - style='font-size: 12px;font-style: italic;' - >鏃犳枃浠�</span> + <template slot="fileSlot" slot-scope="text"> + <span v-if="!text" style="font-size: 12px;font-style: italic;">鏃犳枃浠�</span> <a-button v-else - :ghost='true' - type='primary' - icon='download' - size='small' - @click='downloadFile(text)' - > + :ghost="true" + type="primary" + icon="download" + size="small" + @click="downloadFile(text)"> 涓嬭浇 </a-button> </template> - <span - slot='action' - slot-scope='text, record' - > - <a @click='handleEdit(record)'>缂栬緫</a> - <a-divider type='vertical' /> - - <a-popconfirm - title='纭畾鍒犻櫎鍚�?' - @confirm='() => handleDelete(record.id)' - > - <a v-if="record.uda1 == '涓嶉�氳繃'">鍒犻櫎</a> + <span slot="action" slot-scope="text, record"> + <a @click="handleEdit(record)">缂栬緫</a> + <a-divider type="vertical" /> + <a-popconfirm title="纭畾鍒犻櫎鍚�?" @confirm="() => handleDelete(record.id)"> + <a>鍒犻櫎</a> </a-popconfirm> - - </span> - - <span - slot="examinationConclusion" - slot-scope="text, record" - > - - - <a - v-if="record.examinationConclusion === 'N' " - >涓嶅悎鏍�</a> - <span v-else>鍚堟牸</span> </span> </a-table> </div> + + <operationCertificateDetail-modal ref="modalForm" @ok="modalFormOk" :mainId="mainId"></operationCertificateDetail-modal> </a-card> </template> <script> import { JeecgListMixin } from '@/mixins/JeecgListMixin' -import { getAction } from '@api/manage' +import OperationCertificateDetailModal from './OperationCertificateDetailModal' export default { - name: 'OperationCertificateDetailList', - mixins: [JeecgListMixin], - - props: { - mainId: { - type: String, - default: '', - required: false + name: "OperationCertificateDetailList", + mixins:[JeecgListMixin], + components: { OperationCertificateDetailModal }, + props:{ + mainId:{ + type:String, + default:'', + required:false } }, - watch: { - mainId: { + watch:{ + mainId:{ immediate: true, handler(val) { - if (!this.mainId) { + if(!this.mainId){ this.clearList() - } else { - this.queryParam['id'] = val - this.loadData(1) + }else{ + this.queryParam['operationCertificateId'] = val + this.loadData(1); } } } }, - data() { + data () { return { - description: '鎿嶄綔璇佺鐞嗘槑缁嗛〉闈�', - disableMixinCreated: true, + description: '鎿嶄綔璇佷功绠$悊绠$悊椤甸潰', + disableMixinCreated:true, // 琛ㄥご columns: [ { title: '#', dataIndex: '', - key: 'rowIndex', - width: 60, - align: 'center', - customRender: function(t, r, index) { - return parseInt(index) + 1 + key:'rowIndex', + width:60, + align:"center", + customRender:function (t,r,index) { + return parseInt(index)+1; + } + }, + // { + // title:'璇佷功ID', + // align:"center", + // dataIndex: 'operationCertificateId' + // }, + { + title:'鍙戠敓鏃堕棿', + align:"center", + dataIndex: 'happenDate', + customRender:function (text) { + return !text?"":(text.length>10?text.substr(0,10):text) } }, { - title: '鎵e垎璁惧', - align: 'center', - dataIndex: 'equipmentNames', - + title:'绫诲瀷', + align:"center", + dataIndex: 'type_dictText' }, { - title: '鎵e垎椤�', - align: 'center', - dataIndex: 'appointmentCardNum', - + title:'璁惧缁熶竴缂栫爜', + align:"center", + dataIndex: 'equipmentId_dictText' }, { - title: '鎵i櫎鍒嗘暟', - align: 'center', - dataIndex: 'replaceReason', - + title:'鎵e垎椤�', + align:"center", + dataIndex: 'deductionItem_dictText' }, - { - title: '鎵e垎鍛ㄦ湡', - align: 'center', - dataIndex: 'theoreticalResults', - - } + // { + // title:'鎵e垎鍛ㄦ湡', + // align:"center", + // dataIndex: 'period' + // }, + // { + // title: '鎿嶄綔', + // dataIndex: 'action', + // align:"center", + // fixed:"right", + // width:147, + // scopedSlots: { customRender: 'action' }, + // } ], url: { - list: '/eam/operationCertificate/queryOperationCertificateDetailByMainId' + list: "/eam/operationCertificate/listOperationCertificateDetailByMainId", + delete: "/eam/operationCertificate/deleteOperationCertificateDetail", + deleteBatch: "/eam/operationCertificate/deleteBatchOperationCertificateDetail", + exportXlsUrl: "/eam/operationCertificate/exportOperationCertificateDetail", + importUrl: "/eam/operationCertificate/importOperationCertificateDetail", }, - dictOptions: { - type: [], - inventoryStatus: [] + dictOptions:{ + equipmentIds:[], + status:[], } } }, created() { }, computed: { - importExcelUrl() { - return `${window._CONFIG['domianURL']}/${this.url.importUrl}/${this.mainId}` + importExcelUrl(){ + return `${window._CONFIG['domianURL']}/${this.url.importUrl}/${this.mainId}`; } }, methods: { - clearList() { - this.dataSource = [] - this.selectedRowKeys = [] + clearList(){ + this.dataSource=[] + this.selectedRowKeys=[] this.ipagination.current = 1 - }, - - loadData(arg) { - if (!this.url.list) { - this.$message.error('璇疯缃畊rl.list灞炴��!') - return - } - //鍔犺浇鏁版嵁 鑻ヤ紶鍏ュ弬鏁�1鍒欏姞杞界涓�椤电殑鍐呭 - if (arg === 1) { - this.ipagination.current = 1 - } - var params = this.getQueryParams()//鏌ヨ鏉′欢 - this.loading = true - getAction(this.url.list, params).then((res) => { - if (res.success) { - //update-begin---author:zhangyafei Date:20201118 for锛氶�傞厤涓嶅垎椤电殑鏁版嵁鍒楄〃------------ - this.dataSource = res.result.records || res.result - if (res.result.total) { - this.ipagination.total = res.result.total - } else { - this.ipagination.total = 0 - } - //update-end---author:zhangyafei Date:20201118 for锛氶�傞厤涓嶅垎椤电殑鏁版嵁鍒楄〃------------ - } else { - this.$message.warning(res.message) - } - }).finally(() => { - this.loading = false - }) } + } } </script> <style scoped> -@import '~@assets/less/common.less'; +@import '~@assets/less/common.less' </style> diff --git a/src/views/eam/modules/operationCertificate/OperationCertificateDetailModal.vue b/src/views/eam/modules/operationCertificate/OperationCertificateDetailModal.vue new file mode 100644 index 0000000..ebb3c10 --- /dev/null +++ b/src/views/eam/modules/operationCertificate/OperationCertificateDetailModal.vue @@ -0,0 +1,148 @@ +<template> + <j-modal + :title="title" + :width="width" + :visible="visible" + :confirmLoading="confirmLoading" + switchFullscreen + @ok="handleOk" + @cancel="handleCancel" + cancelText="鍏抽棴"> + <a-spin :spinning="confirmLoading"> + <a-form-model ref="form" :model="model" :rules="validatorRules"> + <a-row> + <a-col :span="24"> + <a-form-model-item label="璇佷功ID" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="operationCertificateId"> + <a-input v-model="model.operationCertificateId"placeholder="璇疯緭鍏ヨ瘉涔D" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="鍙戠敓鏃堕棿" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="happenDate"> + <j-date placeholder="璇烽�夋嫨鍙戠敓鏃堕棿" v-model="model.happenDate" style="width: 100%" /> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="绫诲瀷" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="type"> + <a-input v-model="model.type"placeholder="璇疯緭鍏ョ被鍨�" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="璁惧id" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="equipmentId"> + <a-input v-model="model.equipmentId"placeholder="璇疯緭鍏ヨ澶噄d" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="鎵e垎椤�" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="deductionItem"> + <a-input v-model="model.deductionItem"placeholder="璇疯緭鍏ユ墸鍒嗛」" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="鎵e垎鍛ㄦ湡" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="period"> + <a-input v-model="model.period"placeholder="璇疯緭鍏ユ墸鍒嗗懆鏈�" ></a-input> + </a-form-model-item> + </a-col> + </a-row> + </a-form-model> + </a-spin> + </j-modal> +</template> + +<script> + + import { httpAction } from '@/api/manage' + import { validateDuplicateValue } from '@/utils/util' + + export default { + name: "OperationCertificateDetailModal", + components: { + }, + props:{ + mainId:{ + type:String, + required:false, + default:'' + } + }, + data () { + return { + title:"鎿嶄綔", + width:800, + visible: false, + model:{ + }, + labelCol: { + xs: { span: 24 }, + sm: { span: 5 }, + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 16 }, + }, + + confirmLoading: false, + validatorRules: { + }, + url: { + add: "/eam/operationCertificate/addOperationCertificateDetail", + edit: "/eam/operationCertificate/editOperationCertificateDetail", + } + + } + }, + created () { + //澶囦唤model鍘熷鍊� + this.modelDefault = JSON.parse(JSON.stringify(this.model)); + }, + methods: { + add () { + this.edit(this.modelDefault); + }, + edit (record) { + this.model = Object.assign({}, record); + this.visible = true; + }, + close () { + this.$emit('close'); + this.visible = false; + this.$refs.form.clearValidate(); + }, + handleOk () { + const that = this; + // 瑙﹀彂琛ㄥ崟楠岃瘉 + this.$refs.form.validate(valid => { + if (valid) { + that.confirmLoading = true; + let httpurl = ''; + let method = ''; + if(!this.model.id){ + httpurl+=this.url.add; + method = 'post'; + }else{ + httpurl+=this.url.edit; + method = 'put'; + } + this.model['operationCertificateId'] = this.mainId + httpAction(httpurl,this.model,method).then((res)=>{ + if(res.success){ + that.$message.success(res.message); + that.$emit('ok'); + }else{ + that.$message.warning(res.message); + } + }).finally(() => { + that.confirmLoading = false; + that.close(); + }) + }else{ + return false + } + }) + }, + handleCancel () { + this.close() + }, + + + } + } +</script> diff --git a/src/views/eam/modules/operationCertificate/OperationCertificateForm.vue b/src/views/eam/modules/operationCertificate/OperationCertificateForm.vue index 2821bf7..f3cb46e 100644 --- a/src/views/eam/modules/operationCertificate/OperationCertificateForm.vue +++ b/src/views/eam/modules/operationCertificate/OperationCertificateForm.vue @@ -1,73 +1,76 @@ <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='璇疯緭鍏ユ搷浣滆瘉缂栧彿'></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' /> </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%' /> </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%' /> </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%' /> </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%' /> </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='璇烽�夋嫨璁惧缁熶竴缂栫爜' /> </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-col :span='24'> + <a-form-model-item label='澶囨敞' :labelCol='labelCol' :wrapperCol='wrapperCol' 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' + /> </a-tab-pane> </a-tabs> </a-spin> @@ -75,177 +78,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: 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' } } - }, - 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) - }, - } + }, + 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> diff --git a/src/views/eam/modules/operationCertificate/OperationCertificateModal.vue b/src/views/eam/modules/operationCertificate/OperationCertificateModal.vue index e881924..ca4cea7 100644 --- a/src/views/eam/modules/operationCertificate/OperationCertificateModal.vue +++ b/src/views/eam/modules/operationCertificate/OperationCertificateModal.vue @@ -1,63 +1,64 @@ <template> <j-modal - :title="title" - :width="1200" - :visible="visible" - :maskClosable="false" + :title='title' + :width='1200' + :visible='visible' + :maskClosable='false' switchFullscreen - @ok="handleOk" + @ok='handleOk' :okButtonProps="{ class:{'jee-hidden': disableSubmit} }" - @cancel="handleCancel"> - <operation-certificate-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"/> + @cancel='handleCancel'> + <operation-certificate-form ref='realForm' @ok='submitCallback' :disabled='disableSubmit' :loadSubTableData='loadSubTableDataFlag' /> </j-modal> </template> <script> - import OperationCertificateForm from './OperationCertificateForm' +import OperationCertificateForm from './OperationCertificateForm' - export default { - name: 'OperationCertificateModal', - components: { - OperationCertificateForm +export default { + name: 'OperationCertificateModal', + components: { + OperationCertificateForm + }, + data() { + return { + title: '', + width: 800, + visible: false, + disableSubmit: false, + loadSubTableDataFlag: true + } + }, + methods: { + add() { + this.visible = true + this.$nextTick(() => { + this.$refs.realForm.add() + }) }, - data() { - return { - title:'', - width:800, - visible: false, - disableSubmit: false - } + edit(record) { + this.visible = true + this.$nextTick(() => { + this.$refs.realForm.edit(record) + }) }, - methods:{ - add () { - this.visible=true - this.$nextTick(()=>{ - this.$refs.realForm.add(); - }) - }, - edit (record) { - this.visible=true - this.$nextTick(()=>{ - this.$refs.realForm.edit(record); - }) - }, - close () { - this.$emit('close'); - this.visible = false; - }, - handleOk () { - this.$refs.realForm.handleOk(); - }, - submitCallback(){ - this.$emit('ok'); - this.visible = false; - }, - handleCancel () { - this.close() - } + close() { + this.$emit('close') + this.visible = false + }, + handleOk() { + this.$refs.realForm.handleOk() + }, + submitCallback() { + this.$emit('ok') + this.visible = false + }, + handleCancel() { + this.close() } } +} </script> <style scoped> -- Gitblit v1.9.3