From a86026e27041a0c994d0c94f0f9580d7e330e67a Mon Sep 17 00:00:00 2001 From: lyh <925863403@qq.com> Date: 星期三, 09 七月 2025 10:33:44 +0800 Subject: [PATCH] 用户管理新增eam中心 --- src/views/system/modules/SelectEamDeviceModal.vue | 231 ++++++++++++++++ src/components/jeecgbiz/JSelectBaseFactory.vue | 183 +++++++++++++ src/api/api.js | 11 src/views/system/modules/UserModal.vue | 74 ++++ src/components/jeecgbiz/modal/JSelectBaseFactoryModal.vue | 294 +++++++++++++++++++++ src/views/eam/base/EamMaintenanceStandardList.vue | 5 6 files changed, 787 insertions(+), 11 deletions(-) diff --git a/src/api/api.js b/src/api/api.js index 41f3a08..371c8fe 100644 --- a/src/api/api.js +++ b/src/api/api.js @@ -67,7 +67,10 @@ const queryRepairDepartTreeList = (params)=>getAction("/eam/eamBaseRepairDepart/queryTreeList",params); const queryRepDepIdTree = (params)=>getAction("/eam/eamBaseRepairDepart/queryIdTree",params); const deleteByRepairDepartId = (params)=>deleteAction("/eam/eamBaseRepairDepart/delete",params); - +//EAM涓績 +const queryEamCenterTreeList = (params)=>getAction("/eam/BaseFactory/queryTreeList",params); +const queryEamCenterIdTree = (params)=>getAction("/eam/BaseFactory/queryIdTree",params); +const deleteByEamCenterId = (params)=>deleteAction("/eam/BaseFactory/delete",params); //浜х嚎鏍� @@ -190,8 +193,10 @@ editEquipment, queryRepairDepartTreeList, queryRepDepIdTree, - deleteByRepairDepartId - + deleteByRepairDepartId, + queryEamCenterTreeList, + queryEamCenterIdTree, + deleteByEamCenterId } diff --git a/src/components/jeecgbiz/JSelectBaseFactory.vue b/src/components/jeecgbiz/JSelectBaseFactory.vue new file mode 100644 index 0000000..22df2a6 --- /dev/null +++ b/src/components/jeecgbiz/JSelectBaseFactory.vue @@ -0,0 +1,183 @@ +<template> + <div class="components-input-demo-presuffix"> + <!----> + <a-input @click="openModal" placeholder="璇风偣鍑婚�夋嫨EAM涓績" v-model="textVals" readOnly :disabled="disabled"> + <a-icon slot="prefix" type="cluster" title="EAM涓績閫夋嫨鎺т欢"/> + <a-icon v-if="storeVals" slot="suffix" type="close-circle" @click="handleEmpty" title="娓呯┖"/> + </a-input> + <JSelectBaseFactoryModal + ref="innerBaseFactorySelectModal" + :modal-width="modalWidth" + :multi="multi" + :rootOpened="rootOpened" + :BaseFactoryId="value" + :store="storeField" + :text="textField" + :treeBaseFactory="treeBaseFactory" + @ok="handleOK" + @initComp="initComp"> + + </JSelectBaseFactoryModal> + </div> +</template> + +<script> + import JSelectBaseFactoryModal from './modal/JSelectBaseFactoryModal' + import { underLinetoHump } from '@/components/_util/StringUtil' + export default { + name: 'JSelectBaseFactory', + components:{ + JSelectBaseFactoryModal + }, + props:{ + modalWidth:{ + type:Number, + default:500, + required:false + }, + multi:{ + type:Boolean, + default:false, + required:false + }, + rootOpened:{ + type:Boolean, + default:true, + required:false + }, + value:{ + type:String, + required:false + }, + disabled:{ + type: Boolean, + required: false, + default: false + }, + // 鑷畾涔夎繑鍥炲瓧娈碉紝榛樿杩斿洖 id + customReturnField: { + type: String, + default: '' + }, + backBaseFactory: { + type: Boolean, + default: false, + required: false + }, + // 瀛樺偍瀛楁 [key field] + store: { + type: String, + default: 'id', + required: false + }, + // 鏄剧ず瀛楁 [label field] + text: { + type: String, + default: 'factoryName', + required: false + }, + treeBaseFactory: { + type: Boolean, + default: false, + required: false + } + + }, + data(){ + return { + visible:false, + confirmLoading:false, + storeVals: '', //[key values] + textVals: '' //[label values] + } + }, + computed:{ + storeField(){ + let field = this.customReturnField + if(!field){ + field = this.store; + } + return underLinetoHump(field) + }, + textField(){ + return underLinetoHump(this.text) + } + }, + mounted(){ + this.storeVals = this.value + }, + watch:{ + value(val){ + this.storeVals = val + } + }, + methods:{ + initComp(textVals){ + this.textVals = textVals + }, + //杩斿洖閫変腑鐨勮溅闂翠俊鎭� + backBaseFactoryInfo(){ + if(this.backBaseFactory===true){ + //LOWCOD-2147 銆愮敤鎴风鐞嗐�戦�夋嫨閮ㄩ棬鍜屼笂绾т互鍚庯紝璐熻矗閮ㄩ棬娌℃湁鏁版嵁鍙�� (闄剁値鏀归�犺嚜瀹氫箟杩斿洖瀛楁瀵艰嚧) + if(this.storeVals && this.storeVals.length>0){ + let arr1 = this.storeVals.split(',') + let arr2 = this.textVals.split(',') + let info = [] + for(let i=0;i<arr1.length;i++){ + info.push({ + value: arr1[i], + text: arr2[i] + }) + } + this.$emit('back', info) + } + } + }, + openModal(){ + this.$refs.innerBaseFactorySelectModal.show() + }, + handleOK(rows) { + if (!rows && rows.length <= 0) { + this.textVals = '' + this.storeVals = '' + } else { + let arr1 = [] + let arr2 = [] + for(let dep of rows){ + arr1.push(dep[this.storeField]) + arr2.push(dep[this.textField]) + } + this.storeVals = arr1.join(',') + this.textVals = arr2.join(',') + } + this.$emit("change", this.storeVals) + this.backBaseFactoryInfo() + }, + getBaseFactoryNames(){ + return this.departNames + }, + handleEmpty(){ + this.handleOK('') + } + }, + model: { + prop: 'value', + event: 'change' + } + } +</script> + +<style scoped> + .components-input-demo-presuffix .anticon-close-circle { + cursor: pointer; + color: #ccc; + transition: color 0.3s; + font-size: 12px; + } + .components-input-demo-presuffix .anticon-close-circle:hover { + color: #f5222d; + } + .components-input-demo-presuffix .anticon-close-circle:active { + color: #666; + } +</style> \ No newline at end of file diff --git a/src/components/jeecgbiz/modal/JSelectBaseFactoryModal.vue b/src/components/jeecgbiz/modal/JSelectBaseFactoryModal.vue new file mode 100644 index 0000000..2e839c9 --- /dev/null +++ b/src/components/jeecgbiz/modal/JSelectBaseFactoryModal.vue @@ -0,0 +1,294 @@ +<template> + <j-modal + title="璇风偣鍑婚�夋嫨EAM涓績" + :width="modalWidth" + :visible="visible" + :confirmLoading="confirmLoading" + @ok="handleSubmit" + @cancel="handleCancel" + @update:fullscreen="isFullscreen" + wrapClassName="j-repair-depart-select-modal" + switchFullscreen + cancelText="鍏抽棴"> + <a-spin tip="Loading..." :spinning="false"> + <a-input-search style="margin-bottom: 1px" placeholder="璇疯緭鍏ヤ腑蹇�/宸ュ尯/宸ユ鍚嶇О鎸夊洖杞﹁繘琛屾悳绱�" @search="onSearch" /> + <a-tree + checkable + :class="treeScreenClass" + :treeData="treeData" + :checkStrictly="checkStrictly" + @check="onCheck" + @select="onSelect" + @expand="onExpand" + :autoExpandParent="autoExpandParent" + :expandedKeys="expandedKeys" + :checkedKeys="checkedKeys"> + + <template slot="title" slot-scope="{title}"> + <span v-if="title.indexOf(searchValue) > -1"> + {{title.substr(0, title.indexOf(searchValue))}} + <span style="color: #f50">{{searchValue}}</span> + {{title.substr(title.indexOf(searchValue) + searchValue.length)}} + </span> + <span v-else>{{title}}</span> + </template> + </a-tree> + </a-spin> + </j-modal> +</template> + +<script> +import {queryEamCenterTreeList} from '@/api/api' + export default { + name: 'JSelectBaseFactoryModal', + props:['modalWidth','multi','rootOpened','BaseFactoryId', 'store', 'text','treeBaseFactory'], + data(){ + return { + visible:false, + confirmLoading:false, + treeData:[], + autoExpandParent:true, + expandedKeys:[], + dataList:[], + checkedKeys:[], + checkedRows:[], + searchValue:"", + checkStrictly: false, + fullscreen:false + } + }, + created(){ + this.loadDepart(); + }, + watch:{ + BaseFactoryId(){ + this.initDepartComponent() + }, + visible: { + handler() { + this.initDepartComponent(true) + } + } + }, + computed:{ + treeScreenClass() { + return { + 'my-dept-select-tree': true, + 'fullscreen': this.fullscreen, + } + }, + }, + methods:{ + show(){ + this.visible=true + this.checkedRows=[] + this.checkedKeys=[] + }, + loadDepart(){ + // 杩欎釜鏂规硶鏄壘鍒版墍鏈夌殑閮ㄩ棬淇℃伅 + queryEamCenterTreeList().then(res=>{ + if(res.success){ + let arr = [...res.result] + this.reWriterWithSlot(arr) + this.treeData = arr + this.initDepartComponent() + if(this.rootOpened){ + this.initExpandedKeys(res.result) + } + } + }) + }, + initDepartComponent(flag){ + let arr = [] + //璇ユ柟娉曚袱涓湴鏂圭敤 1.visible鏀瑰彉浜嬩欢閲嶆柊璁剧疆閫変腑椤� 2.缁勪欢缂栬緫椤甸潰鍥炴樉 + let fieldName = flag==true?'key':this.text + if(this.BaseFactoryId){ + let arr2 = this.BaseFactoryId.split(',') + for(let item of this.dataList){ + if(arr2.indexOf(item[this.store])>=0){ + arr.push(item[fieldName]) + } + } + } + if(flag==true){ + this.checkedKeys = [...arr] + }else{ + this.$emit("initComp", arr.join(',')) + } + }, + reWriterWithSlot(arr){ + for(let item of arr){ + if(item.children && item.children.length>0){ + this.reWriterWithSlot(item.children) + let temp = Object.assign({},item) + temp.children = {} + this.dataList.push(temp) + }else{ + this.dataList.push(item) + item.scopedSlots={ title: 'title' } + } + } + }, + initExpandedKeys(arr){ + if(arr && arr.length>0){ + let keys = [] + for(let item of arr){ + if(item.children && item.children.length>0){ + keys.push(item.id) + } + } + this.expandedKeys=[...keys] + //鍏ㄩ儴keys + //this.allTreeKeys = [...keys] + }else{ + this.expandedKeys=[] + //this.allTreeKeys = [] + } + }, + onCheck (checkedKeys,info) { + if(!this.multi){ + let arr = checkedKeys.checked.filter(item => this.checkedKeys.indexOf(item) < 0) + this.checkedKeys = [...arr] + this.checkedRows = (this.checkedKeys.length === 0) ? [] : [info.node.dataRef] + }else{ + if(this.checkStrictly){ + this.checkedKeys = checkedKeys.checked + }else{ + this.checkedKeys = checkedKeys + } + this.checkedRows = this.getCheckedRows(this.checkedKeys) + } + }, + onSelect(selectedKeys,info) { + //鍙栨秷鍏宠仈鐨勬儏鍐典笅鎵嶈蛋onSelect鐨勯�昏緫 + if(this.checkStrictly){ + let keys = [] + keys.push(selectedKeys[0]) + if(!this.checkedKeys || this.checkedKeys.length===0 || !this.multi){ + this.checkedKeys = [...keys] + this.checkedRows=[info.node.dataRef] + }else{ + let currKey = info.node.dataRef.key + if(this.checkedKeys.indexOf(currKey)>=0){ + this.checkedKeys = this.checkedKeys.filter(item=> item !==currKey) + }else{ + this.checkedKeys.push(...keys) + } + } + this.checkedRows = this.getCheckedRows(this.checkedKeys) + } + }, + onExpand (expandedKeys) { + this.expandedKeys = expandedKeys + this.autoExpandParent = false + }, + handleSubmit(){ + if(!this.checkedKeys || this.checkedKeys.length==0){ + this.$emit("ok",'') + }else{ + let checkRow = this.getCheckedRows(this.checkedKeys) + let keyStr = this.checkedKeys.join(",") + this.$emit("ok", checkRow, keyStr) + } + this.handleClear() + }, + handleCancel(){ + this.handleClear() + }, + handleClear(){ + this.visible=false + this.checkedKeys=[] + }, + getParentKey(currKey,treeData){ + let parentKey + for (let i = 0; i < treeData.length; i++) { + const node = treeData[i] + if (node.children) { + if (node.children.some(item => item.key === currKey)) { + parentKey = node.key + } else if (this.getParentKey(currKey, node.children)) { + parentKey = this.getParentKey(currKey, node.children) + } + } + } + return parentKey + }, + onSearch(value){ + const expandedKeys = this.dataList.map((item) => { + if (item.title.indexOf(value) > -1) { + return this.getParentKey(item.key,this.treeData) + } + return null + }).filter((item, i, self) => item && self.indexOf(item) === i) + + Object.assign(this, { + expandedKeys, + searchValue: value, + autoExpandParent: true, + }) + + + }, + // 鏍规嵁 checkedKeys 鑾峰彇 rows + getCheckedRows(checkedKeys) { + const forChildren = (list, key) => { + for (let item of list) { + if (item.id === key) { + return item + } + if (item.children instanceof Array) { + let value = forChildren(item.children, key) + if (value != null) { + return value + } + } + } + return null + } + + let rows = [] + for (let key of checkedKeys) { + let row = forChildren(this.treeData, key) + if (row != null) { + rows.push(row) + } + } + return rows + }, + switchCheckStrictly (v) { + if(v==1){ + this.checkStrictly = false + }else if(v==2){ + this.checkStrictly = true + } + }, + isFullscreen(val){ + this.fullscreen=val + } + } + } + +</script> + +<style lang="less" scoped> +// 闄愬埗閮ㄩ棬閫夋嫨鏍戦珮搴︼紝閬垮厤閮ㄩ棬澶鏃剁偣鍑荤‘瀹氫笉渚� +.my-dept-select-tree{ + height:350px; + + &.fullscreen{ + height: calc(100vh - 250px); + } + overflow-y: scroll; +} +.drawer-bootom-button { + position: absolute; + bottom: 0; + width: 100%; + border-top: 1px solid #e8e8e8; + padding: 10px 16px; + text-align: right; + left: 0; + background: #fff; + border-radius: 0 0 2px 2px; +} +</style> \ No newline at end of file diff --git a/src/views/eam/base/EamMaintenanceStandardList.vue b/src/views/eam/base/EamMaintenanceStandardList.vue index 5f8eec9..f437afa 100644 --- a/src/views/eam/base/EamMaintenanceStandardList.vue +++ b/src/views/eam/base/EamMaintenanceStandardList.vue @@ -253,9 +253,8 @@ secondMaintenanceImportExcel: '/eam/maintenanceStandard/importSecondMaintenanceStandard', thirdMaintenanceImportExcel: '/eam/maintenanceStandard/importThirdMaintenanceStandard', inspectionXlsDownloadUrl: '瀵煎叆妯℃澘/鐐规鏍囧噯瀵煎叆妯℃澘_v1.0.xlsx', - weekMaintenanceXlsDownloadUrl: '瀵煎叆妯℃澘/鍛ㄤ繚鏍囧噯瀵煎叆妯℃澘_v1.0.xlsx', - secondMaintenanceXlsDownloadUrl: '瀵煎叆妯℃澘/浜屼繚鏍囧噯瀵煎叆妯℃澘_v1.0.xlsx', - thirdMaintenanceXlsDownloadUrl: '瀵煎叆妯℃澘/涓変繚鏍囧噯瀵煎叆妯℃澘_v1.0.xlsx' + secondMaintenanceXlsDownloadUrl: '瀵煎叆妯℃澘/浜屼繚鏍囧噯瀵煎叆妯℃澘_v1.0.docx', + thirdMaintenanceXlsDownloadUrl: '瀵煎叆妯℃澘/涓変繚鏍囧噯瀵煎叆妯℃澘_v1.0.docx' }, standardId: '-1' } diff --git a/src/views/system/modules/SelectEamDeviceModal.vue b/src/views/system/modules/SelectEamDeviceModal.vue new file mode 100644 index 0000000..74fb71b --- /dev/null +++ b/src/views/system/modules/SelectEamDeviceModal.vue @@ -0,0 +1,231 @@ +<template> + <a-modal + :title="title" + :visible="visible" + @ok="handleOk" + @cancel="handleCancel" + > + + <a-spin :spinning="loading"> + <!-- showLine --> + <a-form> + <a-form-item label="杞﹂棿灞傜骇锛�"> + <a-tree showLine ref="tree" :expandedKeys.sync="expandedKeys" + :treeData="treeDataSource" checkable @check="onCheck" v-model="checkedKeys" + @expand="onExpand"> + </a-tree> + </a-form-item> + </a-form> + + </a-spin> + + <template slot="footer"> + <div> + <a-dropdown + style="float: left" + :trigger="['click']" + placement="topCenter" + > + <a-menu slot="overlay"> + <a-menu-item key="1" @click="expandAll">灞曞紑鎵�鏈�</a-menu-item> + <a-menu-item key="2" @click="closeAll">鍚堝苟鎵�鏈�</a-menu-item> + <a-menu-item key="3" @click="refreshTree">鍒锋柊</a-menu-item> + </a-menu> + <a-button> + 鏍戞搷浣� + <a-icon type="up"/> + </a-button> + </a-dropdown> + <a-popconfirm title="纭畾鏀惧純缂栬緫锛�" @confirm="handleCancel" okText="纭畾" cancelText="鍙栨秷"> + <a-button style="margin-right: .8rem">鍏抽棴</a-button> + </a-popconfirm> + <a-button + @click="handleOk" + type="primary" + >纭畾 + </a-button> + </div> + </template> + + </a-modal> +</template> + +<script> + import { + getAction, + postAction, + deleteAction + } from '@/api/manage' + import BaseTree from '@/views/mdc/common/BaseTree' + import DepartTree from '@/views/mdc/base/modules/DepartList/DepartListTree/DepartTree' + + export default { + name: 'selectEamDeviceModal', + components: { + BaseTree, DepartTree + }, + props: { + editDisable: { + type: Boolean, + default() { + return true + } + }, + title: { + type: String + }, + selectedProduction: { + type: String + } + }, + data() { + return { + loading: false, + treeDataSource: [], + expandedKeys: [], + checkedKeys: [], + url: { + getDeviceTree: '/eam/equipment/loadTreeListByEamCenterIds' + }, + selectedWorkshopIds: '', + dataList: [], + allTreeKeys: [], + visible: false, + dataSource: [] + } + }, + created() { + this.closeAll() + }, + methods: { + onExpand(expandedKeys) { + this.expandedKeys = expandedKeys + this.autoExpandParent = false + }, + queryTreeData(value) { + this.loading = true + this.selectedWorkshopIds = value + getAction(this.url.getDeviceTree, { ids: value }) + .then(res => { + if (res.success) { + this.dataList = [] + this.allTreeKeys = [] + this.getTreeDataSouce(res.result) + this.treeDataSource = res.result + this.generateList(this.treeDataSource) + this.expandedKeys = this.allTreeKeys + } else { + this.$notification.warning({ + message: '娑堟伅', + description: res.message + }) + } + }) + .catch(err => { + this.$notification.error({ + message: '娑堟伅', + description: err.message + }) + }) + .finally(() => { + this.loading = false + }) + }, + + generateList(data) { + for (let i = 0; i < data.length; i++) { + const node = data[i] + const key = node.key + const title = node.title + this.dataList.push({ + key, + title: title + }) + this.allTreeKeys.push(key) + if (node.children) { + this.generateList(node.children) + } + } + }, + + getTreeDataSouce(data) { + data.forEach(item => { + if (item.children && item.children.length > 0) { + this.getTreeDataSouce(item.children) + } + item.key = item.equipmentId ? item.equipmentId : item.key + item.value = item.equipmentId ? item.equipmentId : item.value + }) + }, + expandAll() { + this.expandedKeys = this.allTreeKeys + }, + closeAll() { + this.expandedKeys = ['-1'] + }, + refreshTree() { + this.queryTreeData(this.selectedWorkshopIds) + }, + onCheck(value, obj) { + this.checkedKeys = value + this.deviceNodes = obj.checkedNodes.filter(item => item.data.props.equipmentId).map(item => item.data.props.equipmentId) + }, + handleCancel() { + this.visible = false + }, + handleOk() { + this.$emit('selectFinished', this.deviceNodes) + this.visible = false + } + + } + } +</script> +<style lang="less" scoped> + /deep/ .ant-modal { + /*transform-origin: 337px 50px;*/ + } + + .ant-card-body .table-operator { + margin-bottom: 18px; + } + + .ant-table-tbody .ant-table-row td { + padding-top: 15px; + padding-bottom: 15px; + } + + .anty-row-operator button { + margin: 0 5px + } + + .ant-btn-danger { + background-color: #ffffff + } + + .ant-modal-cust-warp { + height: 100% + } + + .ant-modal-cust-warp .ant-modal-body { + height: calc(100% - 110px) !important; + overflow-y: auto + } + + .ant-modal-cust-warp .ant-modal-content { + height: 90% !important; + overflow-y: hidden + } + + .drawer-bottom-button { + position: absolute; + bottom: 0; + width: 100%; + border-top: 1px solid #e8e8e8; + padding: 10px 16px; + text-align: right; + left: 0; + background: #fff; + border-radius: 0 0 2px 2px; + } +</style> \ No newline at end of file diff --git a/src/views/system/modules/UserModal.vue b/src/views/system/modules/UserModal.vue index 76bd7f1..740580c 100644 --- a/src/views/system/modules/UserModal.vue +++ b/src/views/system/modules/UserModal.vue @@ -74,12 +74,12 @@ <a-input-search :readOnly="true" v-model="model.equipmentIds" @search="deviceSearch" enter-button placeholder="璇烽�夋嫨璁惧" :disabled="!model.selectedProduction"/> </a-form-model-item> - <a-form-model-item label="EAM涓績鍒嗛厤" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="areaId"> - <j-multi-select-tag :triggerChange="true" v-model="model.eamFactoryIds" dictCode="mom_base_area,name,id,del_flag = 0 and type = 1" placeholder="璇风淮鎶や腑蹇�"/> + <a-form-model-item label="EAM涓績鍒嗛厤" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="eamFactoryIds"> + <JSelectBaseFactory v-model="model.selectedBaseFactory" :multi="true" @back="backBaseFactoryInfo" :backProduction="true" :treeProductOpera="true"/> </a-form-model-item> <a-form-model-item label="EAM璁惧鍒嗛厤" :labelCol="labelCol" :wrapperCol="wrapperCol" v-show="!productionDisabled"> - <a-input-search :readOnly="true" v-model="model.eamEquipmentIds" @search="deviceSearch" enter-button placeholder="璇烽�夋嫨璁惧" :disabled="!model.selectedProduction"/> + <a-input-search :readOnly="true" v-model="model.eamEquipmentIds" @search="eamDeviceSearch" enter-button placeholder="璇烽�夋嫨EAM璁惧" :disabled="!model.selectedBaseFactory"/> </a-form-model-item> <a-form-model-item label="缁翠慨閮ㄩ棬/鐝粍鍒嗛厤" :labelCol="labelCol" :wrapperCol="wrapperCol" v-show="!repairDepartDisabled"> @@ -100,6 +100,9 @@ </div> <select-device-modal ref="selectDeviceModal" @selectFinished="selectOK" :title="'閫夋嫨璁惧'"/> + + <select-eam-device-modal ref="selectEamDeviceModal" @selectFinished="selectEamOK" :title="'閫夋嫨EAM璁惧'"/> + </a-drawer> </template> @@ -116,13 +119,17 @@ import { mapActions } from 'vuex' import { ajaxGetDictItems, getDictItemsFromCache } from '@/api/api' import SelectDeviceModal from './SelectDeviceModal' + import SelectEamDeviceModal from './SelectEamDeviceModal' + import JSelectBaseFactory from "@comp/jeecgbiz/JSelectBaseFactory.vue"; export default { name: 'UserModal', components: { + JSelectBaseFactory, SelectDeviceModal, JSelectProduction, - JSelectRepairDepart + JSelectRepairDepart, + SelectEamDeviceModal }, data() { return { @@ -181,17 +188,20 @@ syncUserByUserName: '/act/process/extActProcess/doSyncUserByUserName',//鍚屾鐢ㄦ埛鍒板伐浣滄祦 queryTenantList: '/sys/tenant/queryList', userRepairDepartList: '/sys/user/userRepairDepartList', + userBaseFactoryList: '/sys/user/userBaseFactoryList', repairDepartTreeList: '/eam/eamBaseRepairDepart/queryTreeList' }, tenantsOptions: [], rolesOptions: [], nextDepartOptions: [], nextProductionOptions: [], + nextBaseFactoryOptions:[], nextRepairDepartOptions: [], isDepartType: '', model: { selectedProduction: '', - selectedRepairDeparts: '' + selectedRepairDeparts: '', + selectedBaseFactory:'', } } }, @@ -210,6 +220,17 @@ } // 濡傛灉娓呯┖杞﹂棿鍊煎垯閲嶇疆閫夋嫨璁惧 if (newVal === '') this.model.equipmentIds = '' + } + }, + 'model.selectedBaseFactory': { + handler(newVal, oldVal) { + if (newVal && this.$refs.selectEamDeviceModal) { + // 濡傛灉杞﹂棿閫夋嫨鍓嶅悗涓嶄竴鑷村垯閲嶇疆閫夋嫨璁惧 + if ((oldVal && newVal !== oldVal)) this.model.eamEquipmentIds = '' + this.$refs.selectEamDeviceModal.queryTreeData(newVal) + } + // 濡傛灉娓呯┖杞﹂棿鍊煎垯閲嶇疆閫夋嫨璁惧 + if (newVal === '') this.model.eamEquipmentIds = '' } } }, @@ -265,6 +286,7 @@ selectedroles: '', selecteddeparts: '', selectedProduction: '', + selectedBaseFactory:'', selectedRepairDeparts: '' }) }, @@ -288,6 +310,7 @@ that.getUserDeparts(record.id) that.getUserProductions(record.id) that.getUserRepairDeparts(record.id) + this.getUserBaseFactorys(record.id) } }, isDisabledAuth(code) { @@ -403,6 +426,27 @@ } }) }, + getUserBaseFactorys(userid) { + let that = this + // 鑾峰彇EAM涓績/宸ュ尯/宸ユ鍒嗛厤 + getAction(that.url.userBaseFactoryList, { userId: userid }).then((res) => { + if (res.success) { + let BaseFactoryOptions = [] + let selectedBaseFactoryOptionsKeys = [] + for (let i = 0; i < res.result.length; i++) { + selectedBaseFactoryOptionsKeys.push(res.result[i].key) + //鏂板璐熻矗缁翠慨閮ㄩ棬/鐝粍閫夋嫨涓嬫媺妗� + BaseFactoryOptions.push({ + value: res.result[i].key, + label: res.result[i].title + }) + } + + this.$set(this.model, 'selectedBaseFactory', selectedBaseFactoryOptionsKeys.join(',')) + that.nextBaseFactoryOptions = BaseFactoryOptions + } + }) + }, backDepartInfo(info) { this.model.departIds = this.model.selecteddeparts this.nextDepartOptions = info.map((item, index, arr) => { @@ -413,6 +457,13 @@ backProductionInfo(info) { this.model.productionIds = this.model.selectedProduction this.nextProductionOptions = info.map((item, index, arr) => { + let c = { label: item.text, value: item.value + '' } + return c + }) + }, + backBaseFactoryInfo(info) { + this.model.eamFactoryIds = this.model.selectedBaseFactory + this.nextBaseFactoryOptions = info.map((item, index, arr) => { let c = { label: item.text, value: item.value + '' } return c }) @@ -429,6 +480,7 @@ this.userId = '' this.nextDepartOptions = [] this.nextProductionOptions = [] + this.nextBaseFactoryOptions = [] this.nextRepairDepartOptions = [] this.departIdShow = false }, @@ -437,6 +489,7 @@ this.visible = false this.disableSubmit = false this.nextDepartOptions = [] + this.nextProductionOptions = [] this.nextProductionOptions = [] this.nextRepairDepartOptions = [] this.departIdShow = false @@ -615,6 +668,13 @@ this.$refs.selectDeviceModal.checkedKeys = this.model.equipmentIds ? this.model.equipmentIds.split(',') : [] }, + eamDeviceSearch(){ + this.$refs.selectEamDeviceModal.visible = true + this.$refs.selectEamDeviceModal.selectedRowKeys = [] + this.$refs.selectEamDeviceModal.selectedRows = [] + this.$refs.selectEamDeviceModal.checkedKeys = this.model.eamEquipmentIds ? this.model.eamEquipmentIds.split(',') : [] + }, + /** * 閫夋嫨宸叉湁璁惧鍚庣偣鍑荤‘瀹氭椂瑙﹀彂 * @param data 宸查�夋嫨鐨勮澶囨暟缁� @@ -622,6 +682,10 @@ selectOK(data) { console.log('data=', data) this.$set(this.model, 'equipmentIds', data.join(',')) + }, + selectEamOK(data) { + console.log('data=', data) + this.$set(this.model, 'eamEquipmentIds', data.join(',')) } } } -- Gitblit v1.9.3