From c7bbdaab4503cc0e470623e87cca3b8a1840bff0 Mon Sep 17 00:00:00 2001 From: cuilei <ray_tsu1@163.com> Date: 星期二, 24 六月 2025 17:43:05 +0800 Subject: [PATCH] 设备管理-大修项修页面 --- src/views/eam/repair/modules/EamMajorPartialRepairModal.vue | 148 +------ src/views/eam/repair/modules/EamMajorPartialRepairDetailModal.vue | 137 +++++++ src/views/eam/repair/EamMajorPartialRepairList.vue | 509 ++++++++++++++++++++------ src/views/eam/repair/modules/EamMajorPartialRepairForm.vue | 306 ++++++++++++++++ 4 files changed, 849 insertions(+), 251 deletions(-) diff --git a/src/views/eam/repair/EamMajorPartialRepairList.vue b/src/views/eam/repair/EamMajorPartialRepairList.vue index 4286fc2..b3176e9 100644 --- a/src/views/eam/repair/EamMajorPartialRepairList.vue +++ b/src/views/eam/repair/EamMajorPartialRepairList.vue @@ -1,37 +1,43 @@ <template> <a-card :bordered="false"> - <!-- 鏌ヨ鍖哄煙 --> <div class="table-page-search-wrapper"> <a-form layout="inline" @keyup.enter.native="searchQuery"> <a-row :gutter="24"> - <a-col :xl="6" :lg="7" :md="8" :sm="24"> - <a-form-item label="鍒犻櫎鏍囪"> - <a-input placeholder="璇疯緭鍏ュ垹闄ゆ爣璁�" v-model="queryParam.delFlag"></a-input> + <a-form-item label="缁翠慨缂栫爜"> + <a-input placeholder="璇疯緭鍏ョ淮淇紪鐮�" v-model="queryParam.repairCode"></a-input> </a-form-item> </a-col> <a-col :xl="6" :lg="7" :md="8" :sm="24"> - <a-form-item label="璁惧ID"> - <a-input placeholder="璇疯緭鍏ヨ澶嘔D" v-model="queryParam.equipmentId"></a-input> + <a-form-item label="椤圭洰鍚嶇О"> + <a-input placeholder="璇疯緭鍏ラ」鐩悕绉�" v-model="queryParam.repairName"></a-input> </a-form-item> </a-col> - <template v-if="toggleSearchStatus"> - <a-col :xl="6" :lg="7" :md="8" :sm="24"> - <a-form-item label="缁翠慨绫诲瀷"> - <a-input placeholder="璇疯緭鍏ョ淮淇被鍨�" v-model="queryParam.repairType"></a-input> - </a-form-item> - </a-col> - <a-col :xl="6" :lg="7" :md="8" :sm="24"> - <a-form-item label="璁″垝寮�濮嬫椂闂�"> - <a-input placeholder="璇疯緭鍏ヨ鍒掑紑濮嬫椂闂�" v-model="queryParam.planStartTime"></a-input> - </a-form-item> - </a-col> - <a-col :xl="6" :lg="7" :md="8" :sm="24"> - <a-form-item label="璁″垝缁撴潫鏃堕棿"> - <a-input placeholder="璇疯緭鍏ヨ鍒掔粨鏉熸椂闂�" v-model="queryParam.planEndTime"></a-input> - </a-form-item> - </a-col> + <template v-if="toggleSearchStatus"> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <a-form-item label="缁翠慨鐘舵��"> + <j-dict-select-tag placeholder="璇烽�夋嫨缁翠慨鐘舵��" v-model="queryParam.repairStatus" dictCode="major_partial_repair_status"/> + </a-form-item> + </a-col> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <a-form-item label="缁翠慨绫诲瀷"> + <a-select v-model="queryParam.repairType" placeholder="璇烽�夋嫨缁翠慨绫诲瀷"> + <a-select-option value="澶т慨">澶т慨</a-select-option> + <a-select-option value="椤逛慨">椤逛慨</a-select-option> + </a-select> + </a-form-item> + </a-col> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <a-form-item label="璁″垝寮�濮嬫棩鏈�"> + <a-range-picker + v-model="planDateRange" + @change="selectDateChange" + format="YYYY-MM-DD" + value-format="YYYY-MM-DD" + /> + </a-form-item> + </a-col> </template> <a-col :xl="6" :lg="7" :md="8" :sm="24"> <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons"> @@ -43,21 +49,26 @@ </a> </span> </a-col> - </a-row> </a-form> </div> + <!-- 鏌ヨ鍖哄煙-END --> <!-- 鎿嶄綔鎸夐挳鍖哄煙 --> <div class="table-operator"> <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-button type="primary" icon="download" @click="handleExportXls('eam_major_partial_repair')">瀵煎嚭</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>--> + <!-- 楂樼骇鏌ヨ鍖哄煙 --> +<!-- <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>--> <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-item key="1" @click="batchSubmit"><a-icon type="form"/>鎻愪氦</a-menu-item> + <a-menu-item key="2" @click="batchConfirm"><a-icon type="check"/>纭</a-menu-item> + <a-menu-item key="3" @click="batchRepeal"><a-icon type="close"/>浣滃簾</a-menu-item> + <a-menu-item key="4" @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> @@ -73,51 +84,97 @@ <a-table ref="table" size="middle" + :scroll="{x:true}" bordered rowKey="id" :columns="columns" :dataSource="dataSource" :pagination="ipagination" :loading="loading" - class="j-table-force-nowrap" :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" + class="j-table-force-nowrap" @change="handleTableChange"> - <span slot="action" slot-scope="text, record"> - <a @click="handleEdit(record)">缂栬緫</a> + <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> + <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)"> + 涓嬭浇 + </a-button> + </template> - <a-divider type="vertical" /> - <a-dropdown> - <a class="ant-dropdown-link">鏇村 <a-icon type="down" /></a> - <a-menu slot="overlay"> - <a-menu-item> - <a-popconfirm title="纭畾鍒犻櫎鍚�?" @confirm="() => handleDelete(record.id)"> - <a>鍒犻櫎</a> - </a-popconfirm> - </a-menu-item> - </a-menu> - </a-dropdown> + <span slot="action" slot-scope="text, record"> + <a @click="handleDetail(record)">璇︽儏</a> + <span v-if="record.repairStatus === 'PENDING_SUBMISSION'"> + <a-divider type="vertical" /> + <a-popconfirm title="纭畾瑕佹彁浜ゅ悧?" @confirm="() => handleSubmit(record.id)"> + <a>鎻愪氦</a> + </a-popconfirm> + </span> + <span v-if="record.repairStatus === 'PENDING_CONFIRMATION'"> + <a-divider type="vertical" /> + <a-popconfirm title="瑕佸畬鎴愮‘璁ゅ悧?" @confirm="() => handleConfirm(record.id)"> + <a>纭</a> + </a-popconfirm> + </span> + <span v-if="record.repairStatus === 'CONFIRMED'"> + <a-divider type="vertical" /> + <a @click="handleFill(record)">濉姤</a> + </span> + + <span v-if="record.repairStatus === 'PENDING_SUBMISSION'"> + <a-divider type="vertical" /> + <a-dropdown> + <a class="ant-dropdown-link">鏇村<a-icon type="down" /></a> + <a-menu slot="overlay"> + <a-menu-item> + <a @click="handleEdit(record)">缂栬緫</a> + </a-menu-item> + <a-menu-item> + <a-popconfirm title="纭畾鍒犻櫎鍚�?" @confirm="() => handleDelete(record.id)"> + <a>鍒犻櫎</a> + </a-popconfirm> + </a-menu-item> + </a-menu> + </a-dropdown> + </span> </span> </a-table> </div> - <!-- table鍖哄煙-end --> - <!-- 琛ㄥ崟鍖哄煙 --> - <eamMajorPartialRepair-modal ref="modalForm" @ok="modalFormOk"></eamMajorPartialRepair-modal> + <eam-major-partial-repair-modal ref="modalForm" @ok="modalFormOk"></eam-major-partial-repair-modal> + <eam-major-partial-repair-detail-modal ref="modalDetailForm" @ok="modalFormOk"></eam-major-partial-repair-detail-modal> </a-card> </template> <script> + import '@/assets/less/TableExpand.less' - import EamMajorPartialRepairModal from './modules/EamMajorPartialRepairModal' + import { mixinDevice } from '@/utils/mixin' import { JeecgListMixin } from '@/mixins/JeecgListMixin' + import EamMajorPartialRepairModal from './modules/EamMajorPartialRepairModal' + import EamMajorPartialRepairDetailModal from './modules/EamMajorPartialRepairDetailModal' + import { getAction } from '../../../api/manage' export default { - name: "EamMajorPartialRepairList", - mixins:[JeecgListMixin], + name: 'EamMajorPartialRepairList', + mixins:[JeecgListMixin, mixinDevice], components: { - EamMajorPartialRepairModal + EamMajorPartialRepairModal, + EamMajorPartialRepairDetailModal }, data () { return { @@ -133,110 +190,304 @@ customRender:function (t,r,index) { return parseInt(index)+1; } - }, - { - title: '鍒犻櫎鏍囪', - align:"center", - dataIndex: 'delFlag' - }, - { - title: '璁惧ID', - align:"center", - dataIndex: 'equipmentId' - }, - { - title: '缁翠慨绫诲瀷', - align:"center", - dataIndex: 'repairType' - }, - { - title: '璁″垝寮�濮嬫椂闂�', - align:"center", - dataIndex: 'planStartTime' - }, - { - title: '璁″垝缁撴潫鏃堕棿', - align:"center", - dataIndex: 'planEndTime' - }, - { - title: '缁翠慨缂栫爜', + }, + { + title:'缁翠慨缂栫爜', align:"center", dataIndex: 'repairCode' - }, - { - title: '缁翠慨鍚嶇О', + }, + { + title:'椤圭洰鍚嶇О', align:"center", dataIndex: 'repairName' - }, - { - title: '缁翠慨鐘舵��', + }, + { + title:'缁翠慨鐘舵��', align:"center", - dataIndex: 'repairStatus' - }, - { - title: '瀹為檯寮�濮嬫椂闂�', + dataIndex: 'repairStatus_dictText' + }, + { + title:'缁翠慨绫诲瀷', + align:"center", + dataIndex: 'repairType' + }, + { + title:'鐢宠浜�', + align:"center", + dataIndex: 'applicant_dictText' + }, + { + title:'鐢宠杞﹂棿', + align:"center", + dataIndex: 'applicantProduction_dictText' + }, + { + title:'璁″垝寮�濮嬫棩鏈�', + align:"center", + dataIndex: 'planStartDate' + }, + { + title:'璁″垝缁撴潫鏃ユ湡', + align:"center", + dataIndex: 'planEndDate' + }, + { + title:'瀹為檯寮�濮嬫椂闂�', align:"center", dataIndex: 'actualStartTime' - }, - { - title: '瀹為檯缁撴潫鏃堕棿', + }, + { + title:'瀹為檯缁撴潫鏃堕棿', align:"center", dataIndex: 'actualEndTime' - }, - { - title: '鎬婚噾棰�', + }, + { + title:'鎬婚噾棰�', align:"center", dataIndex: 'totalAmount' - }, - { - title: '闄勪欢', + }, + // { + // title:'鏁呴殰鎻忚堪', + // align:"center", + // dataIndex: 'faultDescription' + // }, + // { + // title:'鐢宠鍘熷洜', + // align:"center", + // dataIndex: 'applicantReason' + // }, + { + title:'璐d换浜�', align:"center", - dataIndex: 'attachment' - }, - { - title: '缁翠慨鎻忚堪', + dataIndex: 'responsiblePerson_dictText' + }, + { + title:'澶囨敞', align:"center", - dataIndex: 'repairDescription' - }, - { - title: '缁翠慨鏂瑰紡', - align:"center", - dataIndex: 'repairMethod' - }, - { - title: '濮斿鍏徃', - align:"center", - dataIndex: 'outsourcedCompany' - }, - { - title: '璐d换浜�', - align:"center", - dataIndex: 'responsiblePerson' - }, + dataIndex: 'remark' + }, { title: '鎿嶄綔', dataIndex: 'action', align:"center", - scopedSlots: { customRender: 'action' }, + fixed:"right", + width:147, + scopedSlots: { customRender: 'action' } } ], - url: { + url: { list: "/eam/eamMajorPartialRepair/list", delete: "/eam/eamMajorPartialRepair/delete", deleteBatch: "/eam/eamMajorPartialRepair/deleteBatch", - exportXlsUrl: "eam/eamMajorPartialRepair/exportXls", + exportXlsUrl: "/eam/eamMajorPartialRepair/exportXls", importExcelUrl: "eam/eamMajorPartialRepair/importExcel", - }, - } - }, - computed: { - importExcelUrl: function(){ - return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; - } - }, + submit: "eam/eamMajorPartialRepair/submit", + submitBatch: "eam/eamMajorPartialRepair/submitBatch", + confirm: "eam/eamMajorPartialRepair/confirm", + confirmBatch: "eam/eamMajorPartialRepair/confirmBatch", + repeal: "eam/eamMajorPartialRepair/repeal", + repealBatch: "eam/eamMajorPartialRepair/repealBatch" + }, + planDateRange: [], + dictOptions:{}, + superFieldList:[], + } + }, + created() { + this.getSuperFieldList(); + }, + computed: { + importExcelUrl: function(){ + return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; + }, + }, methods: { - + searchReset() { + this.planDateRange = [] + this.queryParam = {} + this.loadData(1); + }, + selectDateChange(value, dateString) { + if (dateString && dateString.length === 2) { + this.queryParam.planStartDate = dateString[0] + this.queryParam.planEndDate = dateString[1] + } + }, + handleFill(record) { + this.$refs.modalDetailForm.open(record); + this.$refs.modalDetailForm.title = "濉姤"; + this.$refs.modalDetailForm.disableSubmit = false; + }, + handleSubmit(id) { + getAction(this.url.submit,{id:id}).then((res)=>{ + if(res.success){ + this.loadData(); + this.$message.success(res.message); + } else { + this.$message.warning(res.message); + } + }) + }, + handleConfirm(id) { + getAction(this.url.confirm,{id:id}).then((res)=>{ + if(res.success){ + this.loadData(); + this.$message.success(res.message); + } else { + this.$message.warning(res.message); + } + }) + }, + batchSubmit() { + if (this.selectedRowKeys.length <= 0) { + this.$notification.warning({ + message: '娑堟伅', + description: '璇烽�夋嫨涓�鏉¤褰�' + }) + return + } else { + var ids = '' + for (var a = 0; a < this.selectedRowKeys.length; a++) { + ids += this.selectedRowKeys[a] + ',' + } + var that = this + this.$confirm({ + title: '纭鎻愪氦', + content: '鏄惁鎻愪氦閫変腑鏁版嵁锛屽彧鏈夊緟鎻愪氦鐘舵�佺殑鏁版嵁鎵嶅彲鎻愪氦鎴愬姛?', + onOk: function () { + that.loading = true + getAction(that.url.submitBatch, { ids: ids }).then((res) => { + if (res.success) { + //閲嶆柊璁$畻鍒嗛〉闂 + that.reCalculatePage(that.selectedRowKeys.length) + // that.$message.success(res.message); + that.$notification.success({ + message: '娑堟伅', + description: res.message + }) + that.loadData() + that.onClearSelected() + } else { + // that.$message.warning(res.message); + that.$notification.warning({ + message: '娑堟伅', + description: res.message + }) + } + }).finally(() => { + that.loading = false + }) + } + }) + } + }, + batchConfirm() { + if (this.selectedRowKeys.length <= 0) { + this.$notification.warning({ + message: '娑堟伅', + description: '璇烽�夋嫨涓�鏉¤褰�' + }) + return + } else { + var ids = '' + for (var a = 0; a < this.selectedRowKeys.length; a++) { + ids += this.selectedRowKeys[a] + ',' + } + var that = this + this.$confirm({ + title: '鏄惁纭', + content: '鏄惁纭閫変腑鏁版嵁锛屽彧鏈夊緟纭鐘舵�佺殑鏁版嵁鎵嶅彲纭鎴愬姛?', + onOk: function () { + that.loading = true + getAction(that.url.confirmBatch, { ids: ids }).then((res) => { + if (res.success) { + //閲嶆柊璁$畻鍒嗛〉闂 + that.reCalculatePage(that.selectedRowKeys.length) + // that.$message.success(res.message); + that.$notification.success({ + message: '娑堟伅', + description: res.message + }) + that.loadData() + that.onClearSelected() + } else { + // that.$message.warning(res.message); + that.$notification.warning({ + message: '娑堟伅', + description: res.message + }) + } + }).finally(() => { + that.loading = false + }) + } + }) + } + }, + batchRepeal() { + if (this.selectedRowKeys.length <= 0) { + this.$notification.warning({ + message: '娑堟伅', + description: '璇烽�夋嫨涓�鏉¤褰�' + }) + return + } else { + var ids = '' + for (var a = 0; a < this.selectedRowKeys.length; a++) { + ids += this.selectedRowKeys[a] + ',' + } + var that = this + this.$confirm({ + title: '鏄惁浣滃簾', + content: '鏄惁浣滃簾閫変腑鏁版嵁锛屽彧鏈夊緟鎻愪氦鐘舵�佺殑鏁版嵁鎵嶅彲浣滃簾鎴愬姛?', + onOk: function () { + that.loading = true + getAction(that.url.repealBatch, { ids: ids }).then((res) => { + if (res.success) { + //閲嶆柊璁$畻鍒嗛〉闂 + that.reCalculatePage(that.selectedRowKeys.length) + // that.$message.success(res.message); + that.$notification.success({ + message: '娑堟伅', + description: res.message + }) + that.loadData() + that.onClearSelected() + } else { + // that.$message.warning(res.message); + that.$notification.warning({ + message: '娑堟伅', + description: res.message + }) + } + }).finally(() => { + that.loading = false + }) + } + }) + } + }, + initDictConfig(){ + }, + getSuperFieldList(){ + let fieldList=[]; + fieldList.push({type:'string',value:'repairCode',text:'缁翠慨缂栫爜',dictCode:''}) + fieldList.push({type:'string',value:'repairName',text:'椤圭洰鍚嶇О',dictCode:''}) + fieldList.push({type:'string',value:'repairStatus',text:'缁翠慨鐘舵��',dictCode:''}) + fieldList.push({type:'string',value:'repairType',text:'缁翠慨绫诲瀷',dictCode:''}) + fieldList.push({type:'string',value:'applicant',text:'鐢宠浜�',dictCode:''}) + fieldList.push({type:'string',value:'applicantProduction',text:'鐢宠杞﹂棿',dictCode:''}) + fieldList.push({type:'date',value:'planStartDate',text:'璁″垝寮�濮嬫棩鏈�'}) + fieldList.push({type:'date',value:'planEndDate',text:'璁″垝缁撴潫鏃ユ湡'}) + fieldList.push({type:'date',value:'actualStartTime',text:'瀹為檯寮�濮嬫椂闂�'}) + fieldList.push({type:'date',value:'actualEndTime',text:'瀹為檯缁撴潫鏃堕棿'}) + fieldList.push({type:'BigDecimal',value:'totalAmount',text:'鎬婚噾棰�',dictCode:''}) + fieldList.push({type:'string',value:'faultDescription',text:'鏁呴殰鎻忚堪',dictCode:''}) + fieldList.push({type:'string',value:'applicantReason',text:'鐢宠鍘熷洜',dictCode:''}) + fieldList.push({type:'string',value:'responsiblePerson',text:'璐d换浜�',dictCode:''}) + fieldList.push({type:'string',value:'remark',text:'澶囨敞',dictCode:''}) + this.superFieldList = fieldList + } } } </script> diff --git a/src/views/eam/repair/modules/EamMajorPartialRepairDetailModal.vue b/src/views/eam/repair/modules/EamMajorPartialRepairDetailModal.vue new file mode 100644 index 0000000..96bef70 --- /dev/null +++ b/src/views/eam/repair/modules/EamMajorPartialRepairDetailModal.vue @@ -0,0 +1,137 @@ +<template> + <j-modal + :title="title" + :width="width" + :visible="visible" + switchFullscreen + @ok="handleOk" + :okButtonProps="{ class:{'jee-hidden': disableSubmit} }" + @cancel="handleCancel" + cancelText="鍏抽棴"> + + <j-vxe-table + ref="editableDetailTable" + :rowNumber="true" + :rowSelection="false" + :bordered="false" + :alwaysEdit="true" + :toolbar="false" + keep-source + :height="300" + :loading="detail.loading" + :dataSource="detail.dataSource" + :columns="equipmentColumns" + style="margin-top: 8px;" /> + + </j-modal> + +</template> + +<script> + +import { JVxeTableModelMixin } from '@/mixins/JVxeTableModelMixin.js' +import { JVXETypes } from '@/components/jeecg/JVxeTable' +import { getAction, postAction } from '../../../../api/manage' + +export default { + name: 'EamMajorPartialRepairDetailModal', + mixins: [JVxeTableModelMixin], + data() { + return { + title: '', + width: 1200, + visible: false, + disableSubmit: false, + equipmentOptions: [], + detail: { + loading: false, + dataSource: [] + }, + url: { + queryDetailList: '/eam/eamMajorPartialRepairDetail/list', + fillResult: '/eam/eamMajorPartialRepair/fillResult' + } + } + }, + computed: { + equipmentColumns() { + return [ + { + title: '璁惧', + key: 'equipmentId_dictText', + type: JVXETypes.normal, + width: '25%', + align: 'center' + }, + { + title: '鍗曚环', + key: 'unitPrice', + type: JVXETypes.normal, + width: '10%', + align: 'center' + }, + { + title: '缁翠慨缁撴灉', + key: 'repairResult', + type: JVXETypes.textarea, + width: '30%', + align: 'center', + validateRules: [{ required: true, message: '缁翠慨缁撴灉涓嶈兘涓虹┖锛�' }] + }, + { + title: '缁翠慨鎻忚堪', + key: 'repairDescription', + type: JVXETypes.textarea, + width: '30%', + align: 'center', + validateRules: [{ required: true, message: '缁翠慨鎻忚堪涓嶈兘涓虹┖锛�' }] + } + ]; + } + }, + methods: { + open(record) { + this.visible = true + getAction(this.url.queryDetailList, { repairId: record.id }).then((res) => { + if (res.success) { + if (res.result.total) { + this.detail.dataSource = res.result.records + } + } + }) + }, + close() { + this.$emit('close') + this.visible = false + }, + async handleOk() { + // 馃憞 瑙﹀彂琛ㄦ牸鏍¢獙 + const errMap = await this.$refs.editableDetailTable.validateTable(); + + if (errMap) { + return; + } + + // 鏍¢獙閫氳繃锛岃幏鍙栬〃鏍兼暟鎹� + const tableData = this.$refs.editableDetailTable.getTableData(); + + postAction(this.url.fillResult, tableData).then((res) => { + if (res.success) { + this.$message.success(res.message) + // 馃憞 鎻愪氦鎴愬姛鍚庡叧闂脊绐� + this.submitCallback(); + } else { + this.$message.warning(res.message) + } + }) + }, + submitCallback() { + this.$emit('ok') + this.visible = false + }, + handleCancel() { + this.close() + } + } +} +</script> \ No newline at end of file diff --git a/src/views/eam/repair/modules/EamMajorPartialRepairForm.vue b/src/views/eam/repair/modules/EamMajorPartialRepairForm.vue new file mode 100644 index 0000000..9a95c52 --- /dev/null +++ b/src/views/eam/repair/modules/EamMajorPartialRepairForm.vue @@ -0,0 +1,306 @@ +<template> + <a-spin :spinning="confirmLoading"> + <j-form-container :disabled="formDisabled"> + <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail"> + <a-row> + <a-col :span="8"> + <a-form-model-item label="缁翠慨缂栫爜" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="repairCode"> + <a-input v-model="model.repairCode" placeholder="绯荤粺鑷姩鐢熸垚" disabled ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="8"> + <a-form-model-item label="椤圭洰鍚嶇О" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="repairName"> + <a-input v-model="model.repairName" placeholder="璇疯緭鍏ラ」鐩悕绉�" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="8" v-if="disabled"> + <a-form-model-item label="缁翠慨鐘舵��" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="repairStatus"> + <j-dict-select-tag placeholder="璇烽�夋嫨缁翠慨鐘舵��" v-model="model.repairStatus" dictCode="major_partial_repair_status" disabled/> + </a-form-model-item> + </a-col> + <a-col :span="8"> + <a-form-model-item label="缁翠慨绫诲瀷" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="repairType"> + <a-select v-model="model.repairType" placeholder="璇烽�夋嫨缁翠慨绫诲瀷"> + <a-select-option value="澶т慨">澶т慨</a-select-option> + <a-select-option value="椤逛慨">椤逛慨</a-select-option> + </a-select> + </a-form-model-item> + </a-col> + <a-col :span="8"> + <a-form-model-item label="鐢宠浜�" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="applicant"> + <j-search-select-tag placeholder="璇烽�夋嫨鐢宠浜�" v-model="model.applicant" dict="sys_user,realname, username, del_flag=0 and status=1"/> + </a-form-model-item> + </a-col> + <a-col :span="8"> + <a-form-model-item label="鐢宠杞﹂棿" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="applicantProduction"> + <a-tree-select v-model="model.applicantProduction" + style="width: 100%" + :tree-data="treeData" + :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }" + placeholder="璇烽�夋嫨鐢宠杞﹂棿" + allow-clear + tree-default-expand-all + > + </a-tree-select> + </a-form-model-item> + </a-col> + <a-col :span="8"> + <a-form-model-item label="璁″垝寮�濮嬫棩鏈�" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="planStartDate"> + <j-date placeholder="璇烽�夋嫨璁″垝寮�濮嬫棩鏈�" v-model="model.planStartDate" style="width: 100%" /> + </a-form-model-item> + </a-col> + <a-col :span="8"> + <a-form-model-item label="璁″垝缁撴潫鏃ユ湡" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="planEndDate"> + <j-date placeholder="璇烽�夋嫨璁″垝缁撴潫鏃ユ湡" v-model="model.planEndDate" style="width: 100%" /> + </a-form-model-item> + </a-col> + <a-col :span="8" v-if="disabled"> + <a-form-model-item label="瀹為檯寮�濮嬫椂闂�" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="actualStartTime"> + <j-date :show-time="true" dateFormat="YYYY-MM-DD HH" placeholder="璇烽�夋嫨瀹為檯寮�濮嬫椂闂�" v-model="model.actualStartTime" style="width: 100%" /> + </a-form-model-item> + </a-col> + <a-col :span="8" v-if="disabled"> + <a-form-model-item label="瀹為檯缁撴潫鏃堕棿" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="actualEndTime"> + <j-date :show-time="true" dateFormat="YYYY-MM-DD HH" placeholder="璇烽�夋嫨瀹為檯缁撴潫鏃堕棿" v-model="model.actualEndTime" style="width: 100%" /> + </a-form-model-item> + </a-col> + <a-col :span="8" v-if="disabled"> + <a-form-model-item label="鎬婚噾棰�" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="totalAmount"> + <a-input-number :min=0 :precision="2" v-model="model.totalAmount" placeholder="璇疯緭鍏ユ�婚噾棰�" style="width: 100%" /> + </a-form-model-item> + </a-col> + <a-col :span="8"> + <a-form-model-item label="鐢宠鍘熷洜" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="applicantReason"> + <a-input v-model="model.applicantReason" placeholder="璇疯緭鍏ョ敵璇峰師鍥�" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="8"> + <a-form-model-item label="璐d换浜�" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="responsiblePerson"> + <j-search-select-tag placeholder="璇烽�夋嫨璐d换浜�" v-model="model.responsiblePerson" dict="sys_user,realname, username, del_flag=0 and status=1"/> + </a-form-model-item> + </a-col> + <a-col :span="8"> + <a-form-model-item label="鏁呴殰鎻忚堪" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="faultDescription"> + <a-textarea v-model="model.faultDescription" placeholder="璇疯緭鍏ユ晠闅滄弿杩�" ></a-textarea> + </a-form-model-item> + </a-col> + <a-col :span="8"> + <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-row :gutter="24"> + <a-tabs defaultActiveKey="1"> + <a-tab-pane key="1" tab="缁翠慨鏄庣粏"> + <j-vxe-table + ref="editableDetailTable" + :rowNumber="true" + :rowSelection="true" + :bordered="true" + :alwaysEdit="true" + :toolbar="true" + :toolbar-config="detailToolbarConfig" + keep-source + :height="300" + :loading="detail.loading" + :dataSource="detail.dataSource" + :columns="equipmentColumns" + style="margin-top: 8px;"/> + </a-tab-pane> + </a-tabs> + </a-row> + </a-form-model> + </j-form-container> + </a-spin> +</template> + +<script> + +import { getAction, httpAction } from '@/api/manage' +import { JVxeTableModelMixin } from '@/mixins/JVxeTableModelMixin.js' +import { JVXETypes } from '@/components/jeecg/JVxeTable' + +export default { + name: 'EamMajorPartialRepairForm', + mixins: [JVxeTableModelMixin], + components: { + }, + props: { + //琛ㄥ崟绂佺敤 + disabled: { + type: Boolean, + default: false, + required: false + } + }, + data () { + return { + model: {}, + labelCol: { + xs: { span: 24 }, + sm: { span: 7 }, + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 16 }, + }, + confirmLoading: false, + validatorRules: { + repairName: { required: true, message: '璇疯緭鍏ラ」鐩悕绉�!' }, + repairType: { required: true, message: '璇烽�夋嫨缁翠慨绫诲瀷!' }, + applicant: { required: true, message: '璇烽�夋嫨鐢宠浜�!' }, + applicantProduction: { required: true, message: '璇疯緭鍏ョ敵璇疯溅闂�!' }, + planStartDate: { required: true, message: '璇烽�夋嫨璁″垝寮�濮嬫棩鏈�!' }, + planEndDate: { required: true, message: '璇烽�夋嫨璁″垝缁撴潫鏃ユ湡!' }, + applicantReason: { required: true, message: '璇疯緭鍏ョ敵璇峰師鍥�!' }, + responsiblePerson: { required: true, message: '璇疯緭鍏ヨ矗浠讳汉!' }, + faultDescription: { required: true, message: '璇疯緭鍏ユ晠闅滄弿杩�!' } + }, + treeData: [], + equipmentOptions: [], + detail: { + loading: false, + dataSource: [], + }, + url: { + add: "/eam/eamMajorPartialRepair/add", + edit: "/eam/eamMajorPartialRepair/edit", + queryById: "/eam/eamMajorPartialRepair/queryById", + queryDetailList: "/eam/eamMajorPartialRepairDetail/list", + queryEquipmentList: "/eam/equipment/asyncLoadEquipment", + loadWorkShopOptions:'/mdc/mdcProduction/loadProductionTreeOptions' + } + } + }, + computed: { + detailToolbarConfig() { + return { + // 濡傛灉鏄鎯呴〉锛屽垯涓嶆樉绀� add 鎸夐挳 + btns: this.disabled ? ['remove', 'clearSelection'] : ['add', 'remove', 'clearSelection'], + slots: ['prefix', 'suffix'] + }; + }, + formDisabled(){ + return this.disabled + }, + equipmentColumns() { + return [ + { + title: '璁惧', + key: 'equipmentId', + type: JVXETypes.select, + options: this.equipmentOptions, + width: '20%', + align: 'center', + validateRules: [{ required: true, message: '璁惧涓嶈兘涓虹┖锛�' }] + }, + { + title: '鍗曚环', + key: 'unitPrice', + type: JVXETypes.inputNumber, + width: '10%', + align: 'center', + validateRules: [{ required: true, message: '鍗曚环涓嶈兘涓虹┖锛�' }] + }, + { + title: '缁翠慨缁撴灉', + key: 'repairResult', + type: JVXETypes.textarea, + width: '20%', + align: 'center', + visible: this.disabled + }, + { + title: '缁翠慨鎻忚堪', + key: 'repairDescription', + type: JVXETypes.textarea, + width: '30%', + align: 'center', + visible: this.disabled + } + ]; + } + }, + created () { + //澶囦唤model鍘熷鍊� + this.modelDefault = JSON.parse(JSON.stringify(this.model)); + this.loadWorkShopTree() + }, + methods: { + loadWorkShopTree() { + //鍔犺浇杞﹂棿閫夋嫨鏍� + getAction(this.url.loadWorkShopOptions).then(res => { + if (res.success) { + this.treeData = [...res.result] + }else { + that.$message.warning(res.message) + } + }) + }, + add () { + this.edit(this.modelDefault) + }, + edit (record) { + this.model = Object.assign({}, record); + this.visible = true + if (this.model.id) { + getAction(this.url.queryDetailList, { repairId: this.model.id }).then((res) => { + if (res.success) { + console.log(res.result) + if (res.result.total) { + this.detail.dataSource = res.result.records + } + } + }) + } + getAction(this.url.queryEquipmentList, {}).then((res) => { + if (res.success) { + this.equipmentOptions = res.result.map(item => { + return { + label: item.text, + value: item.value + } + }) + } + }) + }, + submitForm () { + 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'; + } + const detailList = this.$refs.editableDetailTable.getTableData() + if (detailList.length === 0 || !detailList[0].equipmentId) { + this.$message.warning('璇锋坊鍔犵淮淇槑缁嗭紒') + that.confirmLoading = false; + return + } + this.model.eamMajorPartialRepairDetailList = this.$refs.editableDetailTable.getTableData() + 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; + }) + } + + }) + }, + } + } +</script> \ No newline at end of file diff --git a/src/views/eam/repair/modules/EamMajorPartialRepairModal.vue b/src/views/eam/repair/modules/EamMajorPartialRepairModal.vue index e43dcf0..5b6aa37 100644 --- a/src/views/eam/repair/modules/EamMajorPartialRepairModal.vue +++ b/src/views/eam/repair/modules/EamMajorPartialRepairModal.vue @@ -1,156 +1,60 @@ <template> <j-modal :title="title" - :width="800" + :width="width" :visible="visible" - :confirmLoading="confirmLoading" switchFullscreen @ok="handleOk" + :okButtonProps="{ class:{'jee-hidden': disableSubmit} }" @cancel="handleCancel" cancelText="鍏抽棴"> - - <a-spin :spinning="confirmLoading"> - <a-form-model ref="form" :model="model" :rules="validatorRules"> - - <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="delFlag" label="鍒犻櫎鏍囪"> - <a-input-number v-model="model.delFlag"/> - </a-form-model-item> - <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="equipmentId" label="璁惧ID"> - <a-input placeholder="璇疯緭鍏ヨ澶嘔D" v-model="model.equipmentId" /> - </a-form-model-item> - <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="repairType" label="缁翠慨绫诲瀷"> - <a-input placeholder="璇疯緭鍏ョ淮淇被鍨�" v-model="model.repairType" /> - </a-form-model-item> - <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="planStartTime" label="璁″垝寮�濮嬫椂闂�"> - <a-input placeholder="璇疯緭鍏ヨ鍒掑紑濮嬫椂闂�" v-model="model.planStartTime" /> - </a-form-model-item> - <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="planEndTime" label="璁″垝缁撴潫鏃堕棿"> - <a-input placeholder="璇疯緭鍏ヨ鍒掔粨鏉熸椂闂�" v-model="model.planEndTime" /> - </a-form-model-item> - <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="repairCode" label="缁翠慨缂栫爜"> - <a-input placeholder="璇疯緭鍏ョ淮淇紪鐮�" v-model="model.repairCode" /> - </a-form-model-item> - <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="repairName" label="缁翠慨鍚嶇О"> - <a-input placeholder="璇疯緭鍏ョ淮淇悕绉�" v-model="model.repairName" /> - </a-form-model-item> - <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="repairStatus" label="缁翠慨鐘舵��"> - <a-input placeholder="璇疯緭鍏ョ淮淇姸鎬�" v-model="model.repairStatus" /> - </a-form-model-item> - <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="actualStartTime" label="瀹為檯寮�濮嬫椂闂�"> - <a-input placeholder="璇疯緭鍏ュ疄闄呭紑濮嬫椂闂�" v-model="model.actualStartTime" /> - </a-form-model-item> - <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="actualEndTime" label="瀹為檯缁撴潫鏃堕棿"> - <a-input placeholder="璇疯緭鍏ュ疄闄呯粨鏉熸椂闂�" v-model="model.actualEndTime" /> - </a-form-model-item> - <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="totalAmount" label="鎬婚噾棰�"> - <a-input placeholder="璇疯緭鍏ユ�婚噾棰�" v-model="model.totalAmount" /> - </a-form-model-item> - <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="attachment" label="闄勪欢"> - <a-input placeholder="璇疯緭鍏ラ檮浠�" v-model="model.attachment" /> - </a-form-model-item> - <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="repairDescription" label="缁翠慨鎻忚堪"> - <a-input placeholder="璇疯緭鍏ョ淮淇弿杩�" v-model="model.repairDescription" /> - </a-form-model-item> - <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="repairMethod" label="缁翠慨鏂瑰紡"> - <a-input placeholder="璇疯緭鍏ョ淮淇柟寮�" v-model="model.repairMethod" /> - </a-form-model-item> - <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="outsourcedCompany" label="濮斿鍏徃"> - <a-input placeholder="璇疯緭鍏ュ澶栧叕鍙�" v-model="model.outsourcedCompany" /> - </a-form-model-item> - <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="responsiblePerson" label="璐d换浜�"> - <a-input placeholder="璇疯緭鍏ヨ矗浠讳汉" v-model="model.responsiblePerson" /> - </a-form-model-item> - - </a-form-model> - </a-spin> + <eam-major-partial-repair-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></eam-major-partial-repair-form> </j-modal> </template> <script> - import { httpAction } from '@/api/manage' - import moment from "moment" + import EamMajorPartialRepairForm from './EamMajorPartialRepairForm' export default { - name: "EamMajorPartialRepairModal", + name: 'EamMajorPartialRepairModal', + components: { + EamMajorPartialRepairForm + }, data () { return { - title:"鎿嶄綔", + title:'', + width:1200, visible: false, - model: {}, - labelCol: { - xs: { span: 24 }, - sm: { span: 5 }, - }, - wrapperCol: { - xs: { span: 24 }, - sm: { span: 16 }, - }, - - confirmLoading: false, - validatorRules:{ - }, - url: { - add: "/eam/eamMajorPartialRepair/add", - edit: "/eam/eamMajorPartialRepair/edit", - }, + disableSubmit: false } - }, - created () { }, methods: { add () { - //鍒濆鍖栭粯璁ゅ�� - this.edit({}); + this.visible=true + this.$nextTick(()=>{ + this.$refs.realForm.add(); + }) }, edit (record) { - this.model = Object.assign({}, record); - this.visible = true; + this.visible=true + this.$nextTick(()=>{ + this.$refs.realForm.edit(record); + }) }, 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'; - } - 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; - } - }) + this.$refs.realForm.submitForm(); + }, + submitCallback(){ + this.$emit('ok'); + this.visible = false; }, handleCancel () { this.close() - }, - - + } } } -</script> - -<style lang="less" scoped> - -</style> \ No newline at end of file +</script> \ No newline at end of file -- Gitblit v1.9.3