From 581ec6c1e6de150da170a651909a3de7d739cb36 Mon Sep 17 00:00:00 2001 From: “linengliang” <vanSuperEnergy@163.com> Date: 星期一, 16 十月 2023 19:07:42 +0800 Subject: [PATCH] 保养计划 --- src/views/eam/modules/maintenancePlan/StandardSelect.vue | 285 ++++++++++++++ src/views/eam/modules/maintenancePlan/EquipmentMaintenancePlanForm.vue | 341 +++++++++++++++++ src/views/eam/EquipmentMaintenancePlanList.vue | 316 +++++++++++++++ src/views/eam/modules/maintenancePlan/EquipmentMaintenancePlanModal.vue | 64 +++ src/views/eam/EquipmentMaintenancePlanDetailList.vue | 186 +++++++++ 5 files changed, 1,192 insertions(+), 0 deletions(-) diff --git a/src/views/eam/EquipmentMaintenancePlanDetailList.vue b/src/views/eam/EquipmentMaintenancePlanDetailList.vue new file mode 100644 index 0000000..69df8aa --- /dev/null +++ b/src/views/eam/EquipmentMaintenancePlanDetailList.vue @@ -0,0 +1,186 @@ +<template> + <a-card :bordered="false" :class="'cust-erp-sub-tab'"> + <!-- 鏌ヨ鍖哄煙 --> + <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-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" + bordered + 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> + <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-popconfirm title="纭畾鍒犻櫎鍚�?" @confirm="() => handleDelete(record.id)"> + <a>鍒犻櫎</a> + </a-popconfirm> + </span> + + </a-table> + </div> + </a-card> +</template> + +<script> + + import { JeecgListMixin } from '@/mixins/JeecgListMixin' + export default { + name: "EquipmentMaintenancePlanDetailList", + mixins:[JeecgListMixin], + components: {}, + props:{ + mainId:{ + type:String, + default:'', + required:false + } + }, + watch:{ + mainId:{ + immediate: true, + handler(val) { + if(!this.mainId){ + this.clearList() + }else{ + this.queryParam['planId'] = val + this.loadData(1); + } + } + } + }, + data () { + return { + description: '淇濆吇璁″垝绠$悊椤甸潰', + disableMixinCreated:true, + // 琛ㄥご + columns: [ + { + title: '#', + dataIndex: '', + key:'rowIndex', + width:45, + align:"center", + customRender:function (t,r,index) { + return parseInt(index)+1; + } + }, + { + title:'淇濆吇鏍囧噯', + align:"center", + dataIndex: 'standardNum', + width:300, + }, + { + title:'璁惧缁熶竴缂栫爜', + align:"center", + dataIndex: 'equipmentNum', + width:300, + }, + { + title:'璁惧鍚嶇О', + align:"center", + dataIndex: 'equipmentName', + width:300, + }, + { + title:'璁惧鍨嬪彿', + align:"center", + dataIndex: 'model', + width:300, + }, + { + title:'璁″垝寮�濮嬫椂闂�', + align:"center", + dataIndex: 'planStartTime', + width:300, + }, + { + title:'璁″垝缁撴潫鏃堕棿', + align:"center", + dataIndex: 'planEndTime', + width:300, + }, + ], + url: { + list: "/eam/equipmentMaintenancePlan/listEquipmentMaintenancePlanDetailByMainId", + delete: "/eam/equipmentMaintenancePlan/deleteEquipmentMaintenancePlanDetail", + deleteBatch: "/eam/equipmentMaintenancePlan/deleteBatchEquipmentMaintenancePlanDetail", + exportXlsUrl: "/eam/equipmentMaintenancePlan/exportEquipmentMaintenancePlanDetail", + importUrl: "/eam/equipmentMaintenancePlan/importEquipmentMaintenancePlanDetail", + }, + dictOptions:{ + } + } + }, + created() { + }, + computed: { + importExcelUrl(){ + return `${window._CONFIG['domianURL']}/${this.url.importUrl}/${this.mainId}`; + } + }, + methods: { + clearList(){ + this.dataSource=[] + this.selectedRowKeys=[] + this.ipagination.current = 1 + } + + } + } +</script> +<style scoped> + @import '~@assets/less/common.less' +</style> diff --git a/src/views/eam/EquipmentMaintenancePlanList.vue b/src/views/eam/EquipmentMaintenancePlanList.vue new file mode 100644 index 0000000..2b35154 --- /dev/null +++ b/src/views/eam/EquipmentMaintenancePlanList.vue @@ -0,0 +1,316 @@ +<template> + <a-card :bordered="false"> + <!-- 鏌ヨ鍖哄煙 --> + <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"> + <a-button @click="handleAdd" type="primary" icon="plus">鏂板</a-button> + </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" + bordered + rowKey="id" + class="j-table-force-nowrap" + :scroll="{x:true}" + :columns="columns" + :dataSource="dataSource" + :pagination="ipagination" + :loading="loading" + :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type:'radio'}" + :customRow="clickThenSelect" + @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)" v-if="record.status==='created'||record.status==='rejected'">缂栬緫</a> + <a-divider type="vertical" v-if="record.status==='created'||record.status==='rejected'"/> + <a-popconfirm title="纭畾鍒犻櫎鍚�?" @confirm="() => handleDelete(record.id)" v-if="record.status==='created'||record.status==='rejected'"> + <a>鍒犻櫎</a> + </a-popconfirm> + <a-divider type="vertical" v-if="record.status==='created'||record.status==='rejected'"/> + <a-popconfirm title="鎻愪氦鍚庝笉鍙挙鍥烇紝纭畾鎻愪氦鍚�?" @confirm="() => handleSubmit(record)" v-if="record.status==='created'||record.status==='rejected'"> + <a>鎻愪氦</a> + </a-popconfirm> + <a-divider type="vertical" v-if="record.status==='created'||record.status==='rejected'"/> + <a-popconfirm title="閫氳繃鍚庝笉鍙挙閿�锛岀‘瀹氶�氳繃鍚�?" @confirm="() => handleAudit(record)" v-if="record.status==='submitted'"> + <a>閫氳繃</a> + </a-popconfirm> + <a-divider type="vertical" v-if="record.status==='submitted'"/> + <a-popconfirm title="纭畾椹冲洖鍚�?" @confirm="() => handleReject(record)" v-if="record.status==='submitted'"> + <a>椹冲洖</a> + </a-popconfirm> + <a-divider type="vertical" v-if="record.status==='submitted'"/> + <a-popconfirm title="涓嬪彂鍚庝笉鍙挙閿�锛岀‘瀹氫笅鍙戝悧?" @confirm="() => handleDistrbute(record)" v-if="record.status==='passed'"> + <a>涓嬪彂</a> + </a-popconfirm> + </span> + + </a-table> + </div> + + <a-tabs defaultActiveKey="1"> + <a-tab-pane tab="淇濆吇璁″垝鏄庣粏" key="1" > + <EquipmentMaintenancePlanDetailList :mainId="equipmentMaintenancePlanDetailMainId" /> + </a-tab-pane> + </a-tabs> + + <equipmentMaintenancePlan-modal ref="modalForm" @ok="modalFormOk"></equipmentMaintenancePlan-modal> + </a-card> +</template> + +<script> + + import { JeecgListMixin } from '@/mixins/JeecgListMixin' + import EquipmentMaintenancePlanModal from './modules/maintenancePlan/EquipmentMaintenancePlanModal' + import { getAction } from '@/api/manage' + import EquipmentMaintenancePlanDetailList from './EquipmentMaintenancePlanDetailList' + import '@/assets/less/TableExpand.less' +import { putAction } from '../../api/manage' + + export default { + name: "EquipmentMaintenancePlanList", + mixins:[JeecgListMixin], + components: { + EquipmentMaintenancePlanDetailList, + EquipmentMaintenancePlanModal + }, + data () { + return { + description: '淇濆吇璁″垝绠$悊椤甸潰', + // 琛ㄥご + columns: [ + { + title:'璁″垝鍗曞彿', + align:"center", + dataIndex: 'num', + }, + { + title:'璁″垝鍗曠被鍨�', + align:"center", + dataIndex: 'type_dictText', + width:200, + }, + { + title:'璁″垝鍗曠姸鎬�', + align:"center", + dataIndex: 'status_dictText', + width:200, + }, + { + title:'璁惧鏁伴噺', + align:"center", + dataIndex: 'equipNo', + width:200, + }, + { + title:'鍒涘缓浜�', + align:"center", + dataIndex: 'createBy', + width:200, + }, + { + title:'鍒涘缓鏃堕棿', + align:"center", + dataIndex: 'createTime', + customRender:function (text) { + return !text?"":(text.length>10?text.substr(0,10):text) + }, + width:200, + }, + { + title:'淇敼浜�', + align:"center", + dataIndex: 'updateBy', + width:200, + }, + { + title:'淇敼鏃堕棿', + align:"center", + dataIndex: 'updateTime', + customRender:function (text) { + return !text?"":(text.length>10?text.substr(0,10):text) + }, + width:200, + }, + { + title: '鎿嶄綔', + dataIndex: 'action', + align:"center", + fixed:"right", + width:200, + scopedSlots: { customRender: 'action' }, + } + ], + url: { + list: "/eam/equipmentMaintenancePlan/list", + delete: "/eam/equipmentMaintenancePlan/delete", + deleteBatch: "/eam/equipmentMaintenancePlan/deleteBatch", + exportXlsUrl: "/eam/equipmentMaintenancePlan/exportXls", + importExcelUrl: "eam/equipmentMaintenancePlan/importExcel", + submit:"eam/equipmentMaintenancePlan/submit", + reject:"eam/equipmentMaintenancePlan/reject", + distrbute:"eam/equipmentMaintenancePlan/distrbute", + audit:"eam/equipmentMaintenancePlan/audit" + }, + dictOptions:{ + }, + /* 鍒嗛〉鍙傛暟 */ + 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:'', + superFieldList:[], + equipmentMaintenancePlanDetailMainId: '', + } + }, + created() { + this.getSuperFieldList(); + }, + computed: { + importExcelUrl: function(){ + return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; + } + }, + methods: { + initDictConfig(){ + }, + clickThenSelect(record) { + return { + on: { + click: () => { + this.onSelectChange(record.id.split(","), [record]); + } + } + } + }, + onClearSelected() { + this.selectedRowKeys = []; + this.selectionRows = []; + this.selectedMainId='' + }, + onSelectChange(selectedRowKeys, selectionRows) { + this.selectedMainId=selectedRowKeys[0] + this.selectedRowKeys = selectedRowKeys; + this.selectionRows = selectionRows; + this.equipmentMaintenancePlanDetailMainId = 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:''}) + fieldList.push({type:'string',value:'type',text:'璁″垝鍗曠被鍨嬶紙鏁版嵁瀛楀吀锛歮aintenance_plan_type锛�',dictCode:''}) + fieldList.push({type:'string',value:'status',text:'璁″垝鍗曠姸鎬�(鏁版嵁瀛楀吀锛歮aintenance_plan_type)',dictCode:''}) + fieldList.push({type:'int',value:'equipNo',text:'璁惧鏁伴噺',dictCode:''}) + fieldList.push({type:'string',value:'createBy',text:'createBy',dictCode:''}) + fieldList.push({type:'date',value:'createTime',text:'createTime'}) + fieldList.push({type:'string',value:'updateBy',text:'updateBy',dictCode:''}) + fieldList.push({type:'date',value:'updateTime',text:'updateTime'}) + this.superFieldList = fieldList + }, + handleSubmit(record){ + putAction(this.url.submit,record).then(res=>{ + if(res.success){ + this.$message.success("鎿嶄綔鎴愬姛"); + }else{ + this.$message.success("鎿嶄綔澶辫触"); + } + }) + }, + handleAudit(record){ + putAction(this.url.audit,record).then(res=>{ + if(res.success){ + this.$message.success("鎿嶄綔鎴愬姛"); + }else{ + this.$message.success("鎿嶄綔澶辫触"); + } + }) + }, + handleDistrbute(record){ + putAction(this.url.distrbute,record).then(res=>{ + if(res.success){ + this.$message.success("鎿嶄綔鎴愬姛"); + }else{ + this.$message.success("鎿嶄綔澶辫触"); + } + }) + }, + handleReject(record){ + putAction(this.url.reject,record).then(res=>{ + if(res.success){ + this.$message.success("鎿嶄綔鎴愬姛"); + }else{ + this.$message.success("鎿嶄綔澶辫触"); + } + }) + } + } + } +</script> +<style scoped> + @import '~@assets/less/common.less' +</style> \ No newline at end of file diff --git a/src/views/eam/modules/maintenancePlan/EquipmentMaintenancePlanForm.vue b/src/views/eam/modules/maintenancePlan/EquipmentMaintenancePlanForm.vue new file mode 100644 index 0000000..369aae2 --- /dev/null +++ b/src/views/eam/modules/maintenancePlan/EquipmentMaintenancePlanForm.vue @@ -0,0 +1,341 @@ +<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="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="type"> + <j-dict-select-tag + allow-clear + placeholder="璇烽�夋嫨璁″垝鍗曠被鍨�" + :triggerChange="true" + dictCode="maintenance_type" + v-model="model.type" + /> + </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"> + <j-vxe-table + keep-source + :ref="refKeys[0]" + :loading="equipmentMaintenancePlanDetailTable.loading" + :columns="equipmentMaintenancePlanDetailTable.columns" + :dataSource="equipmentMaintenancePlanDetailTable.dataSource" + :maxHeight="300" + :disabled="formDisabled" + :rowNumber="true" + :rowSelection="true" + :toolbar="true" + bordered + :alwaysEdit="true" + :toolbarConfig='toolbarConfig' + > + <template slot='toolbarPrefix'> + <a-button type='primary' @click='standardSelect' :disabled="formDisabled" icon="plus">璁惧-淇濆吇鏍囧噯 + </a-button> + </template> + </j-vxe-table> + </a-tab-pane> + </a-tabs> + <standard-select @selectionRows='selectionRows' ref='standardSelectModel' ></standard-select> + </a-spin> +</template> + +<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 StandardSelect from './StandardSelect' + import { duplicateCheck } from '@/api/api' + import dayjs from 'dayjs' + + export default { + name: 'EquipmentMaintenancePlanForm', + mixins: [JVxeTableModelMixin], + components: { + JFormContainer, + StandardSelect, + dayjs + }, + data() { + return { + toolbarConfig: { + // prefix 鍓嶇紑锛泂uffix 鍚庣紑 + slot: ['prefix', 'suffix'], + // add 鏂板鎸夐挳锛況emove 鍒犻櫎鎸夐挳锛沜learSelection 娓呯┖閫夋嫨鎸夐挳 + btn: ['remove', 'clearSelection'] + }, + labelCol: { + xs: { span: 24 }, + sm: { span: 5 }, + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 16 }, + }, + model:{ + }, + // 鏂板鏃跺瓙琛ㄩ粯璁ゆ坊鍔犲嚑琛岀┖鏁版嵁 + addDefaultRowNum: 1, + validatorRules: { + num: [ + { required: true, message: '璇疯緭鍏ョ紪鐮�!' }, + { min: 1, max: 30, message: '闀垮害鍦� 2 鍒� 30 涓瓧绗�', trigger: 'blur' }, + { validator: this.validateNum }, + ], + type: [ + { required: true, message: '璇烽�夋嫨璁″垝鍗曠被鍨�!' }, + ], + }, + refKeys: ['equipmentMaintenancePlanDetail', ], + tableKeys:['equipmentMaintenancePlanDetail', ], + activeKey: 'equipmentMaintenancePlanDetail', + // 淇濆吇璁″垝鏄庣粏 + equipmentMaintenancePlanDetailTable: { + loading: false, + dataSource: [ + ], + columns: [ + { + title: '淇濆吇鏍囧噯id', + key: 'standardId', + type: JVXETypes.hidden, + placeholder: '璇疯緭鍏�${title}', + defaultValue: '', + align:'center', + width:"230px", + }, + { + title: '淇濆吇鏍囧噯', + key: 'standardNum', + type: JVXETypes.normal, + placeholder: '璇疯緭鍏�${title}', + defaultValue: '', + align:'center', + width:"230px", + }, + { + title: '璁惧缁熶竴缂栫爜', + key: 'equipmentNum', + type: JVXETypes.normal, + placeholder: '璇疯緭鍏�${title}', + defaultValue: '', + align:'center', + width:"230px", + }, + { + title: '璁惧鍚嶇О', + key: 'equipmentName', + type: JVXETypes.normal, + placeholder: '璇疯緭鍏�${title}', + defaultValue: '', + align:'center', + width:"230px", + }, + { + title: '璁惧鍨嬪彿', + key: 'model', + type: JVXETypes.normal, + placeholder: '璇疯緭鍏�${title}', + defaultValue: '', + align:'center', + width:"230px", + }, + { + title: '璁″垝寮�濮嬫椂闂�', + key: 'planStartTime', + type: JVXETypes.datetime, + placeholder: '璇疯緭鍏�${title}', + align:'center', + width:"250px", + validateRules: [ + { + required: true, // 蹇呭~ + message: '璇疯緭鍏�${title}' // 鏄剧ず鐨勬枃鏈� + }, + { + handler({ cellValue, row, column }, callback, target) { + var start = dayjs(cellValue); + var end = dayjs(row.planEndTime); + if (!start.isBefore(end)) { + callback(false, '缁撴潫鏃堕棿闇�婊炲悗浜庡紑濮嬫椂闂�') // false = 鏈�氳繃锛屽彲浠ヨ窡鑷畾涔夋彁绀� + } else { + callback(true) // true = 閫氳繃楠岃瘉 + } + }, + message: '${title}榛樿鎻愮ず' + } + ] + }, + { + title: '璁″垝缁撴潫鏃堕棿', + key: 'planEndTime', + type: JVXETypes.datetime, + placeholder: '璇疯緭鍏�${title}', + align:'center', + width:"250px", + validateRules: [ + { + required: true, // 蹇呭~ + message: '璇疯緭鍏�${title}' // 鏄剧ず鐨勬枃鏈� + }, + { + handler({ cellValue, row, column }, callback, target) { + var start = dayjs(row.planStartTime); + var end = dayjs(cellValue); + if (!start.isBefore(end)) { + callback(false, '缁撴潫鏃堕棿闇�婊炲悗浜庡紑濮嬫椂闂�') // false = 鏈�氳繃锛屽彲浠ヨ窡鑷畾涔夋彁绀� + } else { + callback(true) // true = 閫氳繃楠岃瘉 + } + }, + message: '${title}榛樿鎻愮ず' + } + ] + }, + ] + }, + url: { + add: "/eam/equipmentMaintenancePlan/add", + edit: "/eam/equipmentMaintenancePlan/edit", + queryById: "/eam/equipmentMaintenancePlan/queryById", + equipmentMaintenancePlanDetail: { + list: '/eam/equipmentMaintenancePlan/listEquipmentMaintenancePlanDetailByMainId' + }, + } + } + }, + props: { + //琛ㄥ崟绂佺敤 + disabled: { + type: Boolean, + default: false, + required: false + } + }, + computed: { + formDisabled(){ + return this.disabled + }, + }, + created () { + }, + methods: { + addBefore(){ + this.equipmentMaintenancePlanDetailTable.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 = { planId: this.model.id } + this.requestSubTableData(this.url.equipmentMaintenancePlanDetail.list, params, this.equipmentMaintenancePlanDetailTable) + } + }, + //鏍¢獙鎵�鏈変竴瀵逛竴瀛愯〃琛ㄥ崟 + 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, // 灞曞紑 + equipmentMaintenancePlanDetailList: allValues.tablesValue[0].tableData, + } + }, + validateError(msg){ + this.$message.error(msg) + }, + standardSelect() { + let ids = [] + let tableData = this.$refs.equipmentMaintenancePlanDetail.getTableData() + for (let i = 0; i < tableData.length; i++) { + ids.push(tableData[i].standardId) + } + this.$refs.standardSelectModel.showModal(ids) + this.$refs.standardSelectModel.title = '閫夋嫨绮惧害鍙傛暟' + this.$refs.standardSelectModel.disableSubmit = false + }, + addSelected(data) { + let tableData = this.$refs.equipmentMaintenancePlanDetail.getTableData() + var tableStr = JSON.stringify(tableData) + const addRows = [] + for (let i = 0; i < data.length; i++) { + var equipmentMaintenancePlanDetail = {} + if (tableStr.indexOf(data[i].id) == -1) { + equipmentMaintenancePlanDetail = { + standardId:data[i].id, + standardNum: data[i].num, + equipmentNum:data[i].equipmentNum, + equipmentName:data[i].equipmentName, + model:data[i].equipmentModel, + planId:this.model.id, + } + } + addRows.push(equipmentMaintenancePlanDetail) + } + this.$refs.equipmentMaintenancePlanDetail.pushRows(addRows) + }, + selectionRows(data) { + // 澧炲姞閫変腑鐨勮澶囧埌鍒楄〃涓� + this.addSelected(data) + }, + validateNum(rule, value, callback) { + var params = { + tableName: 'mom_eam_equipment_maintenance_plan', + fieldName: 'num', + fieldVal: value, + dataId: this.model.id, + //鏁版嵁搴撲腑瀛樺湪瀛楁del_flag骞朵娇鐢ㄨ瀛楁浣滀负鏈垹闄ょ瓥鐣ワ紝鐪熷垹闄わ細false 鍋囧垹闄わ細true + delFlag: '0', + }; + duplicateCheck(params).then((res) => { + if (res.success) { + callback(); + } else { + callback("缂栧彿宸插瓨鍦�!"); + } + }) + }, + + + } + } +</script> + +<style scoped> +</style> \ No newline at end of file diff --git a/src/views/eam/modules/maintenancePlan/EquipmentMaintenancePlanModal.vue b/src/views/eam/modules/maintenancePlan/EquipmentMaintenancePlanModal.vue new file mode 100644 index 0000000..bb240ac --- /dev/null +++ b/src/views/eam/modules/maintenancePlan/EquipmentMaintenancePlanModal.vue @@ -0,0 +1,64 @@ +<template> + <j-modal + :title="title" + :width="1600" + :visible="visible" + :maskClosable="false" + switchFullscreen + @ok="handleOk" + :okButtonProps="{ class:{'jee-hidden': disableSubmit} }" + @cancel="handleCancel"> + <equipment-maintenance-plan-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"/> + </j-modal> +</template> + +<script> + + import EquipmentMaintenancePlanForm from './EquipmentMaintenancePlanForm' + + export default { + name: 'EquipmentMaintenancePlanModal', + components: { + EquipmentMaintenancePlanForm + }, + data() { + return { + title:'', + width:800, + visible: false, + disableSubmit: false + } + }, + 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() + } + } + } +</script> + +<style scoped> +</style> \ No newline at end of file diff --git a/src/views/eam/modules/maintenancePlan/StandardSelect.vue b/src/views/eam/modules/maintenancePlan/StandardSelect.vue new file mode 100644 index 0000000..46b3804 --- /dev/null +++ b/src/views/eam/modules/maintenancePlan/StandardSelect.vue @@ -0,0 +1,285 @@ +<template> + <!--鏀寔鍏ㄥ睆缂╂斁--> + <a-modal + :visible="visible" + :title="title" + switchFullscreen + @ok="handleSubmit" + @cancel="close" + style="top:50px" + cancelText="鍏抽棴" + :width="1050" + > + <a-card :bordered="false"> + <div class="table-page-search-wrapper"> + <a-form + layout="inline" + @keyup.enter.native="searchQuery" + > + <a-row :gutter="24"> + <a-col + :md="8" + :sm="6" + > + <a-form-item label="妫�楠岄」鐩悕绉�"> + <a-input + placeholder="璇疯緭鍏ユ楠岄」鐩悕绉�" + v-model="queryParam.name" + /> + </a-form-item> + </a-col> + + <a-col :md="3"> + <span + style="float: left;overflow: hidden;" + class="table-page-search-submitButtons" + > + <a-button + type="primary" + @click="searchQuery" + icon="search" + >鏌ヨ</a-button> + <a-button + @click="searchReset" + icon="reload" + style="margin-left: 10px" + >閲嶇疆</a-button> + </span> + </a-col> + </a-row> + </a-form> + </div> + <a-table + ref="table" + :scroll="scrollTrigger" + size="middle" + rowKey="id" + bordered + :columns="columns" + :dataSource="dataSource" + :pagination="ipagination" + :rowSelection="rowSelection" + :loading="loading" + @change="handleTableChange" + > + </a-table> + </a-card> + </a-modal> +</template> + +<script> +import { filterObj } from '@/utils/util' +import { getAction } from '@/api/manage' +import { JeecgListMixin } from '@/mixins/JeecgListMixin' + +export default { + name: 'JSelectToolingModal', + mixins: [JeecgListMixin], + components: {}, + props: { + + }, + data() { + return { + queryParam: { + }, + columns: [ + { + title: '#', + dataIndex: '', + key: 'rowIndex', + width: 50, + align: 'center', + customRender: function (t, r, index) { + return parseInt(index) + 1 + } + }, + { + title: '鐗堟湰', + align: 'center', + dataIndex: 'version', + width: 100, + }, + { + title: '鐗堟湰鐘舵��', + align: 'center', + dataIndex: 'versionStatusName', + width: 130, + }, + { + title: '鏍囧噯缂栫爜', + align: 'center', + dataIndex: 'num', + }, + { + title: '瀵硅薄閮ㄩ棬', + align: 'center', + dataIndex: 'useDepartName', + }, + { + title: '璁惧缂栫爜', + align: 'center', + dataIndex: 'equipmentNum', + }, + { + title: '璁惧鍚嶇О', + align: 'center', + dataIndex: 'equipmentName', + }, + { + title: '璁惧鍨嬪彿', + align: 'center', + dataIndex: 'equipmentModel', + }, + ], + selectedRowKeys: [], + oldSlelectRows: [], + scrollTrigger: {}, + dataSource: [], + selectionRows: [], + title: '鏍规嵁鏌ヨ缁撴灉閫夋嫨绮惧害鍙傛暟', + ipagination: { + current: 1, + pageSize: 10, + pageSizeOptions: ['5', '10', '30', '50', '100'], + showTotal: (total, range) => { + return range[0] + '-' + range[1] + ' 鍏�' + total + '鏉�' + }, + showQuickJumper: true, + showSizeChanger: true, + total: 0 + }, + isorter: { + column: 'num', + order: 'desc' + }, + departTree: [], + visible: false, + loading: false, + url: { + list: '/eam/maintenanceStandard/getMaintenanceStandardList', + }, + } + }, + computed: { + rowSelection() { + return { + type: 'checkbox', + onChange: (selectedRowKeys, selectedRows) => { + this.selectedRowKeys = selectedRowKeys; + this.onSelectChange(selectedRows); + }, + getCheckboxProps: record => ({ + props: { + disabled: record.distable + }, + }), + selectedRowKeys: this.selectedRowKeys, + }; + }, + }, + watch: { + + }, + created() { + }, + methods: { + + async loadData(arg) { + if (arg === 1) { + this.ipagination.current = 1; + } + let that = this + this.loading = true + this.queryParam.versionStatus = '2' + this.queryParam.type = 'daily' + let params = this.getQueryParams()//鏌ヨ鏉′欢 + await getAction(this.url.list, params).then((res) => { + if (res.success) { + for (let i = 0; i < res.result.records.length; i++) { + if (that.oldSlelectRows.indexOf(res.result.records[i].id) > -1) { + res.result.records[i].distable = true; + } else { + res.result.records[i].distable = false; + } + } + this.dataSource = res.result.records; + this.ipagination.total = res.result.total; + } + if (res.code === 510) { + this.$message.warning(res.message) + } + this.loading = false; + }) + }, + showModal(oldSlelectRows) { + this.oldSlelectRows = oldSlelectRows; + this.visible = true; + this.loadData(1); + }, + getQueryParams() { + let param = Object.assign({}, this.queryParam, this.isorter); + param.field = this.getQueryField(); + param.pageNo = this.ipagination.current; + param.pageSize = this.ipagination.pageSize; + return filterObj(param); + }, + //鏌ヨ鏉′欢澶勭悊 + getQueryField() { + let str = 'id,'; + for (let a = 0; a < this.columns.length; a++) { + str += ',' + this.columns[a].dataIndex; + } + return str; + }, + searchReset(num) { + let that = this; + this.queryParam = []; + if (num !== 0) { + that.loadData(1); + } + that.selectborrowIds = []; + }, + close() { + this.searchReset(0); + this.selectedRowKeys = []; + this.visible = false; + }, + handleTableChange(pagination, filters, sorter) { + //TODO 绛涢�� + if (Object.keys(sorter).length > 0) { + this.isorter.column = sorter.field; + this.isorter.order = 'ascend' === sorter.order ? 'asc' : 'desc'; + } + this.ipagination = pagination; + this.loadData(); + }, + handleSubmit() { + this.$emit('selectionRows', this.selectionRows); + this.searchReset(0) + this.close(); + }, + onSelectChange(selectionRows) { + this.selectionRows = selectionRows; + }, + searchQuery() { + this.loadData(1); + }, + } +} +</script> + +<style scoped> +.ant-table-tbody .ant-table-row td { + padding-top: 10px; + padding-bottom: 10px; +} + +#components-layout-demo-custom-trigger .trigger { + font-size: 18px; + line-height: 64px; + padding: 0 24px; + cursor: pointer; + transition: color 0.3s; +} +</style> \ No newline at end of file -- Gitblit v1.9.3