From 78e463e1dbab2dae9cbf98d4f976c08600ba6b3b Mon Sep 17 00:00:00 2001 From: lyh <925863403@qq.com> Date: 星期四, 03 四月 2025 09:33:21 +0800 Subject: [PATCH] 点检工单 --- src/views/eam/equipment/modules/MaintenanceEquipmentSelect.vue | 166 +++++++++ src/views/eam/maintenance/modules/EamInspectionOrderDetailForm.vue | 124 +++++++ src/views/eam/maintenance/EamInspectionOrderList.vue | 280 ++++++++++++++++ src/views/eam/maintenance/modules/EamInspectionOrderModal.vue | 237 +++++++++++++ src/views/eam/maintenance/modules/EamInspectionOrderForm.vue | 164 +++++++++ 5 files changed, 971 insertions(+), 0 deletions(-) diff --git a/src/views/eam/equipment/modules/MaintenanceEquipmentSelect.vue b/src/views/eam/equipment/modules/MaintenanceEquipmentSelect.vue new file mode 100644 index 0000000..9d7d80f --- /dev/null +++ b/src/views/eam/equipment/modules/MaintenanceEquipmentSelect.vue @@ -0,0 +1,166 @@ +<template> + + <a-select + showSearch + labelInValue + :disabled="disabled" + :getPopupContainer="getParentContainer" + @search="loadData" + :placeholder="placeholder" + v-model="selectedAsyncValue" + style="width: 100%" + :filterOption="false" + @change="handleAsyncChange" + allowClear + :notFoundContent="loading ? undefined : null" + mode="default" + > + <template #suffixIcon> + <a-icon type="search" /> + </template> + <a-spin v-if="loading" slot="notFoundContent" size="small" /> + <a-select-option v-for="d in options" :key="d.value" :value="d.value">{{ d.text }}</a-select-option> + </a-select> + +</template> + +<script> +import debounce from 'lodash/debounce' +import { getAction } from '@/api/manage' + +export default { + name: 'MaintenanceEquipmentSelect', + props: { + disabled: Boolean, + value: [String, Number], + placeholder: { + type: String, + default: '璇烽�夋嫨', + required: false + }, + pageSize: { + type: Number, + default: 20, + required: false + }, + }, + data() { + this.loadData = debounce(this.loadData, 800)//娑堟姈 + this.lastLoad = 0 + return { + loading: false, + selectedValue: undefined, + selectedAsyncValue: undefined, + options: [] + } + }, + created() { + // this.initDictData() + }, + watch: { + 'value': { + immediate: true, + handler(val) { + if (!val) { + this.initDictData(); + } else { + this.initSelectValue() + } + } + } + }, + methods: { + initSelectValue() { + if(!this.selectedAsyncValue || !this.selectedAsyncValue.key || this.selectedAsyncValue.key!=this.value){ + console.log("杩欐墠璇锋眰鍚庡彴") + getAction(`/eam/maintenanceStandard/listByUser`, { id: this.value }).then(res=>{ + if(res.success){ + if(res.result && res.result.length > 0){ + let obj = { + key : this.value, + label: res.result[0].text + } + this.selectedAsyncValue = {...obj}; + } + this.options = res.result; + } + }) + } + }, + loadData(value) { + console.log('鏁版嵁鍔犺浇', value) + this.lastLoad += 1 + const currentLoad = this.lastLoad + this.options = [] + this.loading = true + // 瀛楀吀code鏍煎紡锛歵able,text,code + getAction(`/eam/maintenanceStandard/listByUser`, { keyword: value, pageSize: this.pageSize }).then(res => { + this.loading = false + if (res.success) { + if (currentLoad != this.lastLoad) { + return + } + this.options = res.result + console.log('鎴戞槸绗竴涓�', res) + } else { + this.$message.warning(res.message) + } + + }) + + }, + initDictData() { + //寮傛涓�寮�濮嬩篃鍔犺浇涓�鐐规暟鎹� + this.loading = true + getAction(`/eam/maintenanceStandard/listByUser`, { pageSize: this.pageSize, keyword: '' }).then(res => { + this.loading = false + if (res.success) { + this.options = [...res.result] + } else { + this.$message.warning(res.message) + } + }) + }, + filterOption(input, option) { + return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0 + }, + handleAsyncChange(selectedObj) { + //update-begin-author:scott date:20201222 for:銆愭悳绱€�戞悳绱㈡煡璇㈢粍浠讹紝鍒犻櫎鏉′欢锛岄粯璁や笅鎷夎繕鏄笂娆$殑缂撳瓨鏁版嵁锛屼笉濂� JT-191 + if (selectedObj) { + this.selectedAsyncValue = selectedObj + //update-begin---author:wangshuai ---date:20221115 for锛歔issues/4213]JSearchSelectTag鏀归�犳敮鎸佸閫�------------ + this.selectedValue = selectedObj.key + //update-end---author:wangshuai ---date:20221115 for锛歔issues/4213]JSearchSelectTag鏀归�犳敮鎸佸閫�------------ + } else { + this.selectedAsyncValue = null + this.selectedValue = null + this.options = null + this.loadData('') + } + this.callback() + //update-end-author:scott date:20201222 for:銆愭悳绱€�戞悳绱㈡煡璇㈢粍浠讹紝鍒犻櫎鏉′欢锛岄粯璁や笅鎷夎繕鏄笂娆$殑缂撳瓨鏁版嵁锛屼笉濂� JT-191 + }, + callback() { + this.$emit('change', this.selectedValue) + }, + getParentContainer(node) { + if (typeof this.getPopupContainer === 'function') { + return this.getPopupContainer(node) + } else if (!this.popContainer) { + return node.parentNode + } else { + return document.querySelector(this.popContainer) + } + } + + }, + model: { + prop: 'value', + event: 'change' + } +} +</script> + +<style scoped> + +</style> \ No newline at end of file diff --git a/src/views/eam/maintenance/EamInspectionOrderList.vue b/src/views/eam/maintenance/EamInspectionOrderList.vue new file mode 100644 index 0000000..3fb8659 --- /dev/null +++ b/src/views/eam/maintenance/EamInspectionOrderList.vue @@ -0,0 +1,280 @@ +<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.orderNum"></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> + </a-col> + <template v-if="toggleSearchStatus"> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <a-form-item label="鐐规鏃ユ湡"> + <j-date placeholder="璇烽�夋嫨鐐规鏃ユ湡" v-model="queryParam.inspectionDate"></j-date> + </a-form-item> + </a-col> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <a-form-item label="鐐规鏃堕棿"> + <j-date placeholder="璇烽�夋嫨鐐规鏃堕棿" v-model="queryParam.operateTime"></j-date> + </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"> + <a-button type="primary" @click="searchQuery" icon="search">鏌ヨ</a-button> + <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">閲嶇疆</a-button> + <a @click="handleToggleSearch" style="margin-left: 8px"> + {{ toggleSearchStatus ? '鏀惰捣' : '灞曞紑' }} + <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/> + </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('eam_inspection_order')">瀵煎嚭</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" + :scroll="{x:true}" + bordered + rowKey="id" + :columns="columns" + :dataSource="dataSource" + :pagination="ipagination" + :loading="loading" + :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" + class="j-table-force-nowrap" + @change="handleTableChange"> + + <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> + + <span slot="action" slot-scope="text, record"> + <a @click="handleEdit(record)">缂栬緫</a> + + <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="handleDetail(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> + + </a-table> + </div> + + <eam-inspection-order-modal ref="modalForm" @ok="modalFormOk"></eam-inspection-order-modal> + </a-card> +</template> + +<script> + + import '@/assets/less/TableExpand.less' + import { mixinDevice } from '@/utils/mixin' + import { JeecgListMixin } from '@/mixins/JeecgListMixin' + import EamInspectionOrderModal from './modules/EamInspectionOrderModal' + + export default { + name: 'EamInspectionOrderList', + mixins:[JeecgListMixin, mixinDevice], + components: { + EamInspectionOrderModal + }, + data () { + return { + description: 'eam_inspection_order绠$悊椤甸潰', + // 琛ㄥご + columns: [ + { + title: '#', + dataIndex: '', + key:'rowIndex', + width:60, + align:"center", + customRender:function (t,r,index) { + return parseInt(index)+1; + } + }, + { + title:'宸ュ崟鍙�', + align:"center", + dataIndex: 'orderNum' + }, + { + title:'璁惧缂栧彿', + align:"center", + dataIndex: 'equipmentId' + }, + { + title:'鏍囧噯缂栫爜', + align:"center", + dataIndex: 'standardId' + }, + { + title:'鐐规鏃ユ湡', + align:"center", + dataIndex: 'inspectionDate', + customRender:function (text) { + return !text?"":(text.length>10?text.substr(0,10):text) + } + }, + { + title:'鐐规鏃堕棿', + align:"center", + dataIndex: 'operateTime', + customRender:function (text) { + return !text?"":(text.length>10?text.substr(0,10):text) + } + }, + { + title:'鐐规浜�', + align:"center", + dataIndex: 'operator' + }, + { + title:'鐐规杩囨湡鏃堕棿', + align:"center", + dataIndex: 'expirationTime', + customRender:function (text) { + return !text?"":(text.length>10?text.substr(0,10):text) + } + }, + { + title:'鍒涘缓鏂瑰紡', + align:"center", + dataIndex: 'creationMethod' + }, + { + title:'鐐规鐘舵��', + align:"center", + dataIndex: 'inspectionStatus_dictText' + }, + { + title:'鐝粍闀跨‘璁�', + align:"center", + dataIndex: 'confirmUser' + }, + { + title:'纭鏃堕棿', + align:"center", + dataIndex: 'confirmTime', + customRender:function (text) { + return !text?"":(text.length>10?text.substr(0,10):text) + } + }, + { + title:'澶囨敞', + align:"center", + dataIndex: 'remark' + }, + { + title: '鎿嶄綔', + dataIndex: 'action', + align:"center", + fixed:"right", + width:147, + scopedSlots: { customRender: 'action' } + } + ], + url: { + list: "/eam/eamInspectionOrder/list", + delete: "/eam/eamInspectionOrder/delete", + deleteBatch: "/eam/eamInspectionOrder/deleteBatch", + exportXlsUrl: "/eam/eamInspectionOrder/exportXls", + importExcelUrl: "eam/eamInspectionOrder/importExcel", + + }, + dictOptions:{}, + superFieldList:[], + } + }, + created() { + this.getSuperFieldList(); + }, + computed: { + importExcelUrl: function(){ + return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; + }, + }, + methods: { + initDictConfig(){ + }, + getSuperFieldList(){ + let fieldList=[]; + fieldList.push({type:'string',value:'orderNum',text:'宸ュ崟鍙�',dictCode:''}) + fieldList.push({type:'string',value:'equipmentId',text:'璁惧ID',dictCode:''}) + fieldList.push({type:'string',value:'standardId',text:'鏍囧噯ID',dictCode:''}) + fieldList.push({type:'date',value:'inspectionDate',text:'鐐规鏃ユ湡'}) + fieldList.push({type:'date',value:'operateTime',text:'鐐规鏃堕棿'}) + fieldList.push({type:'string',value:'operator',text:'鐐规浜�',dictCode:''}) + fieldList.push({type:'date',value:'expirationTime',text:'鐐规杩囨湡鏃堕棿'}) + fieldList.push({type:'string',value:'creationMethod',text:'鍒涘缓鏂瑰紡',dictCode:''}) + fieldList.push({type:'string',value:'inspectionStatus',text:'鐐规鐘舵��',dictCode:''}) + fieldList.push({type:'string',value:'confirmUser',text:'璁惧绠$悊鍛樼‘璁�',dictCode:''}) + fieldList.push({type:'date',value:'confirmTime',text:'纭鏃堕棿'}) + fieldList.push({type:'string',value:'remark',text:'澶囨敞',dictCode:''}) + fieldList.push({type:'string',value:'imageFiles',text:'鐓х墖鏂囦欢ids;id浠ラ�楀彿鍒嗛殧',dictCode:''}) + this.superFieldList = fieldList + } + } + } +</script> +<style scoped> + @import '~@assets/less/common.less'; +</style> \ No newline at end of file diff --git a/src/views/eam/maintenance/modules/EamInspectionOrderDetailForm.vue b/src/views/eam/maintenance/modules/EamInspectionOrderDetailForm.vue new file mode 100644 index 0000000..f27ed57 --- /dev/null +++ b/src/views/eam/maintenance/modules/EamInspectionOrderDetailForm.vue @@ -0,0 +1,124 @@ +<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="24"> + <a-form-model-item label="鍒犻櫎鏍囪" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="delFlag"> + <a-input-number v-model="model.delFlag" placeholder="璇疯緭鍏ュ垹闄ゆ爣璁�" style="width: 100%" /> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="宸ュ崟ID" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="orderId"> + <a-input v-model="model.orderId" placeholder="璇疯緭鍏ュ伐鍗旾D" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="鐐规椤笽D" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="itemId"> + <a-input v-model="model.itemId" placeholder="璇疯緭鍏ョ偣妫�椤笽D" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="鐐规缁撴灉" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="inspectionResult"> + <a-input v-model="model.inspectionResult" placeholder="璇疯緭鍏ョ偣妫�缁撴灉" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="寮傚父鎻忚堪" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="exceptionDescription"> + <a-input v-model="model.exceptionDescription" placeholder="璇疯緭鍏ュ紓甯告弿杩�" ></a-input> + </a-form-model-item> + </a-col> + </a-row> + </a-form-model> + </j-form-container> + </a-spin> +</template> + +<script> + + import { httpAction, getAction } from '@/api/manage' + import { validateDuplicateValue } from '@/utils/util' + + export default { + name: 'EamInspectionOrderDetailForm', + components: { + }, + props: { + //琛ㄥ崟绂佺敤 + disabled: { + type: Boolean, + default: false, + required: false + } + }, + data () { + return { + model:{ + }, + labelCol: { + xs: { span: 24 }, + sm: { span: 5 }, + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 16 }, + }, + confirmLoading: false, + validatorRules: { + }, + url: { + add: "/eam/eamInspectionOrderDetail/add", + edit: "/eam/eamInspectionOrderDetail/edit", + queryById: "/eam/eamInspectionOrderDetail/queryById" + } + } + }, + computed: { + formDisabled(){ + return this.disabled + }, + }, + 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; + }, + 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'; + } + 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/maintenance/modules/EamInspectionOrderForm.vue b/src/views/eam/maintenance/modules/EamInspectionOrderForm.vue new file mode 100644 index 0000000..0cc673a --- /dev/null +++ b/src/views/eam/maintenance/modules/EamInspectionOrderForm.vue @@ -0,0 +1,164 @@ +<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="24"> + <a-form-model-item label="宸ュ崟鍙�" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="orderNum"> + <a-input v-model="model.orderNum" 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="鏍囧噯ID" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="standardId"> + <a-input v-model="model.standardId" placeholder="璇疯緭鍏ユ爣鍑咺D" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="鐐规鏃ユ湡" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="inspectionDate"> + <j-date placeholder="璇烽�夋嫨鐐规鏃ユ湡" v-model="model.inspectionDate" style="width: 100%" /> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="鐐规鏃堕棿" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="operateTime"> + <j-date placeholder="璇烽�夋嫨鐐规鏃堕棿" v-model="model.operateTime" style="width: 100%" /> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="鐐规浜�" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="operator"> + <a-input v-model="model.operator" placeholder="璇疯緭鍏ョ偣妫�浜�" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="鐐规杩囨湡鏃堕棿" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="expirationTime"> + <j-date placeholder="璇烽�夋嫨鐐规杩囨湡鏃堕棿" v-model="model.expirationTime" style="width: 100%" /> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="鍒涘缓鏂瑰紡" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="creationMethod"> + <a-input v-model="model.creationMethod" placeholder="璇疯緭鍏ュ垱寤烘柟寮�" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="鐐规鐘舵��" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="inspectionStatus"> + <j-dict-select-tag type="list" v-model="model.inspectionStatus" dictCode="" placeholder="璇烽�夋嫨鐐规鐘舵��" /> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="璁惧绠$悊鍛樼‘璁�" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="confirmUser"> + <a-input v-model="model.confirmUser" placeholder="璇疯緭鍏ヨ澶囩鐞嗗憳纭" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="纭鏃堕棿" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="confirmTime"> + <j-date placeholder="璇烽�夋嫨纭鏃堕棿" v-model="model.confirmTime" style="width: 100%" /> + </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" rows="4" placeholder="璇疯緭鍏ュ娉�" /> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="鐓х墖鏂囦欢" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="imageFiles"> + <j-image-upload isMultiple v-model="model.imageFiles" ></j-image-upload> + </a-form-model-item> + </a-col> + </a-row> + </a-form-model> + </j-form-container> + </a-spin> +</template> + +<script> + + import { httpAction, getAction } from '@/api/manage' + import { validateDuplicateValue } from '@/utils/util' + + export default { + name: 'EamInspectionOrderForm', + components: { + }, + props: { + //琛ㄥ崟绂佺敤 + disabled: { + type: Boolean, + default: false, + required: false + } + }, + data () { + return { + model:{ + }, + labelCol: { + xs: { span: 24 }, + sm: { span: 5 }, + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 16 }, + }, + confirmLoading: false, + validatorRules: { + }, + url: { + add: "/eam/eamInspectionOrder/add", + edit: "/eam/eamInspectionOrder/edit", + queryById: "/eam/eamInspectionOrder/queryById" + } + } + }, + computed: { + formDisabled(){ + return this.disabled + }, + }, + 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; + }, + 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'; + } + 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/maintenance/modules/EamInspectionOrderModal.vue b/src/views/eam/maintenance/modules/EamInspectionOrderModal.vue new file mode 100644 index 0000000..44dc60d --- /dev/null +++ b/src/views/eam/maintenance/modules/EamInspectionOrderModal.vue @@ -0,0 +1,237 @@ +<template> + <j-modal + :title="title" + :width="1200" + :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 :gutter="24"> + <a-col :span="8"> + <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="standardCode" label="鏍囧噯缂栫爜"> + <a-input placeholder="缂栫爜绯荤粺鑷姩鐢熸垚" v-model="model.standardCode" disabled /> + </a-form-model-item> + </a-col> + <a-col :span="8"> + <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="equipmentId" label="璁惧缂栧彿"> + <MaintenanceEquipmentSelect placeholder="璇疯緭鍏ヨ澶囩紪鍙锋垨鍚嶇О鎼滅储" v-model="model.equipmentId" :disabled="editable"></MaintenanceEquipmentSelect> + </a-form-model-item> + </a-col> + <a-col :span="8"> + <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="standardName" label="鏍囧噯鍚嶇О"> + <a-input placeholder="璇疯緭鍏ユ爣鍑嗗悕绉�" disabled v-model="model.standardName" /> + </a-form-model-item> + </a-col> + </a-row> + <a-row :gutter="24"> + <a-col :span="8"> + <a-form-model-item label="鐐规鏃ユ湡" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="inspectionDate"> + <j-date placeholder="璇烽�夋嫨鐐规鏃ユ湡" v-model="model.inspectionDate" style="width: 100%" /> + </a-form-model-item> + </a-col> + <a-col :span="8"> + <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="maintenancePeriod" label="淇濆吇鍛ㄦ湡"> + <a-input-number v-model="model.maintenancePeriod" :min="1" :precision="0" disabled style="width: 100%"/> + </a-form-model-item> + </a-col> + <a-col :span="8"> + <a-form-model-item label="鐐规杩囨湡鏃堕棿" :labelCol="{span:6}" :wrapperCol="{span:15}" prop="expirationTime"> + <j-date placeholder="璇烽�夋嫨鐐规杩囨湡鏃堕棿" v-model="model.expirationTime" disabled style="width: 100%" /> + </a-form-model-item> + </a-col> + </a-row> + <a-row :gutter="24"> + <a-col :span="24"> + <a-form-model-item label="澶囨敞" :labelCol="{span:1}" :wrapperCol="{span:22}" prop="remark"> + <a-textarea v-model="model.remark" rows="3" placeholder="璇疯緭鍏ュ娉�" /> + </a-form-model-item> + </a-col> + </a-row> + <a-row :gutter="24"> + <j-vxe-table + ref="editableDetailTable" + :rowNumber="true" + :rowSelection="false" + :bordered="true" + :alwaysEdit="true" + :toolbar="false" + keep-source + :height="300" + :loading="detail.loading" + :dataSource="detail.dataSource" + :columns="detail.columns" + style="margin-top: 8px;"/> + </a-row> + </a-form-model> + </a-spin> + </j-modal> +</template> + +<script> +import { getAction, httpAction } from '@/api/manage' +import { JVxeTableModelMixin } from '@/mixins/JVxeTableModelMixin.js' +import { JVXETypes } from '@/components/jeecg/JVxeTable' +import MaintenanceEquipmentSelect from '@views/eam/equipment/modules/MaintenanceEquipmentSelect' + +export default { + name: "EamMaintenanceStandardModal", + mixins: [JVxeTableModelMixin], + components: { + MaintenanceEquipmentSelect, + }, + data () { + return { + title:"鎿嶄綔", + visible: false, + model: {}, + editable: false, + labelCol: { + xs: { span: 24 }, + sm: { span: 5 }, + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 16 }, + }, + confirmLoading: false, + validatorRules: { + standardName: [ + { required: true, message: '璇疯緭鍏ユ爣鍑嗗悕绉�!' } + ], + maintenanceCategory: [ + { required: true, message: '璇烽�夋嫨淇濆吇鍒嗙被!' } + ], + initialDate: [ + { required: true, message: '璇烽�夋嫨鍒濆鏃ユ湡!' } + ], + maintenancePeriod: [ + { required: true, message: '璇疯緭鍏ヤ繚鍏诲懆鏈燂紝鍗曚綅锛氬ぉ!' } + ], + equipmentId: [ + { required: true, message: '璇烽�夋嫨璁惧!' } + ] + }, + url: { + add: "/eam/maintenanceStandard/add", + edit: "/eam/maintenanceStandard/edit", + detail: "/eam/eamMaintenanceStandardDetail/queryList", + }, + detail: { + loading: false, + dataSource: [], + columns: [ + { + title: '搴忓彿', + key: 'itemCode', + width: '10%', + align:"center", + }, + { + title: '淇濆吇椤�', + key: 'itemName', + width: '20%', + align:"center", + }, + { + title: '淇濆吇瑕佹眰', + key: 'itemDemand', + width: '30%', + align:"center", + }, + ], + } + } + }, + created () { + }, + methods: { + add () { + this.model = {}; + this.visible = true; + this.editable = false; + }, + edit (record) { + this.model = Object.assign({}, record); + this.visible = true; + this.editable = true; + if(record && record.referenceFile) { + let obj = JSON.parse(record.referenceFile); + this.model.fileList = [obj]; + }else { + this.model.fieldList = []; + } + this.loadDetail(record.id); + }, + close () { + this.$emit('close'); + this.visible = false; + this.$refs.form.clearValidate(); + }, + async handleOk () { + const that = this; + let errMap = await that.$refs.editableDetailTable.validateTable(); + if(errMap){ + this.$message.warning("鏁版嵁鏍¢獙澶辫触锛�"); + return; + } + // 瑙﹀彂琛ㄥ崟楠岃瘉 + this.$refs.form.validate(valid => { + if (valid) { + let tableData = that.$refs.editableDetailTable.getTableData(); + let removeData = that.$refs.editableDetailTable.getDeleteData(); + that.model.tableDetailList = [...tableData]; + that.model.removeDetailList = [...removeData]; + + 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'); + that.close(); + }else{ + that.$message.warning(res.message); + } + }).finally(() => { + that.confirmLoading = false; + }) + }else{ + return false; + } + }) + }, + handleCancel () { + this.close() + }, + //鍔犺浇璇︽儏鏁版嵁 + loadDetail(standardId) { + this.detail.dataSource = []; + if (standardId) { + getAction(this.url.detail, { standardId: standardId }).then(res => { + if (res.success) { + this.detail.dataSource = [...res.result]; + } + }) + } + } + + } +} +</script> + +<style lang="less" scoped> + +</style> \ No newline at end of file -- Gitblit v1.9.3