From 2b6c67c330d86e84dfbeec9b7b66a45567aaeb00 Mon Sep 17 00:00:00 2001 From: Lius <Lius2225@163.com> Date: 星期二, 05 八月 2025 17:11:46 +0800 Subject: [PATCH] MDC设备车间树改造,设备权限改造 --- src/views/mdc/base/EquipmentList.vue | 16 src/views/mdc/base/modules/EquipmentList/UserModal.vue | 102 +++--- src/store/mutation-types.js | 4 src/views/mdc/common/BaseTree.vue | 4 src/views/system/modules/UserModal.vue | 116 ++++--- src/components/jeecgbiz/JSelectFactory.vue | 10 src/store/index.js | 2 src/views/mdc/base/modules/EquipmentList/EquipmentModal.vue | 10 src/store/modules/factory.js | 45 +++ src/components/jeecgbiz/JSelectEquipmentFactory.vue | 183 +++++++++++++ src/components/jeecgbiz/modal/JSelectEquipmentFactoryModal.vue | 348 ++++++++++++++++++++++++ 11 files changed, 718 insertions(+), 122 deletions(-) diff --git a/src/components/jeecgbiz/JSelectEquipmentFactory.vue b/src/components/jeecgbiz/JSelectEquipmentFactory.vue new file mode 100644 index 0000000..cac6cca --- /dev/null +++ b/src/components/jeecgbiz/JSelectEquipmentFactory.vue @@ -0,0 +1,183 @@ +<template> + <div class="components-input-demo-presuffix"> + <!----> + <a-input @click="openModal" placeholder="璇风偣鍑婚�夋嫨杞﹂棿" v-model="textVals" readOnly :disabled="disabled"> + <a-icon slot="prefix" type="cluster" title="杞﹂棿閫夋嫨鎺т欢"/> + <a-icon v-if="storeVals&&!disabled" slot="suffix" type="close-circle" @click="handleEmpty" title="娓呯┖"/> + </a-input> + <j-select-equipment-factory-modal + ref="innerDepartSelectModal" + :modal-width="modalWidth" + :multi="multi" + :rootOpened="rootOpened" + :factory-id="value" + :store="storeField" + :text="textField" + :treeProductOpera="treeProductOpera" + @ok="handleOK" + @initComp="initComp"> + + </j-select-equipment-factory-modal> + </div> +</template> + +<script> + import JSelectEquipmentFactoryModal from './modal/JSelectEquipmentFactoryModal' + import { underLinetoHump } from '@comp/_util/StringUtil' + export default { + name: 'JSelectEquipmentFactory', + components:{ + JSelectEquipmentFactoryModal, + }, + 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: '' + }, + backFactory: { + type: Boolean, + default: false, + required: false + }, + // 瀛樺偍瀛楁 [key field] + store: { + type: String, + default: 'id', + required: false + }, + // 鏄剧ず瀛楁 [label field] + text: { + type: String, + default: 'factoryName', + required: false + }, + treeProductOpera: { + 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 + }, + //杩斿洖閫変腑鐨勮溅闂翠俊鎭� + backProductInfo(){ + if(this.backFactory===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.innerDepartSelectModal.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.backProductInfo() + }, + getDepartNames(){ + 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/JSelectFactory.vue b/src/components/jeecgbiz/JSelectFactory.vue index 1af1e2f..927778e 100644 --- a/src/components/jeecgbiz/JSelectFactory.vue +++ b/src/components/jeecgbiz/JSelectFactory.vue @@ -59,7 +59,7 @@ type: String, default: '' }, - backProduction: { + backFactory: { type: Boolean, default: false, required: false @@ -116,8 +116,8 @@ this.textVals = textVals }, //杩斿洖閫変腑鐨勮溅闂翠俊鎭� - backProductInfo(){ - if(this.backProduction===true){ + backFactoryInfo(){ + if(this.backFactory===true){ if(this.storeVals && this.storeVals.length>0){ let arr1 = this.storeVals.split(',') let arr2 = this.textVals.split(',') @@ -150,9 +150,9 @@ this.textVals = arr2.join(',') } this.$emit("change", this.storeVals) - this.backProductInfo() + this.backFactoryInfo() }, - + handleEmpty(){ this.handleOK('') } diff --git a/src/components/jeecgbiz/modal/JSelectEquipmentFactoryModal.vue b/src/components/jeecgbiz/modal/JSelectEquipmentFactoryModal.vue new file mode 100644 index 0000000..a310faf --- /dev/null +++ b/src/components/jeecgbiz/modal/JSelectEquipmentFactoryModal.vue @@ -0,0 +1,348 @@ +<template> + <j-modal + title="閫夋嫨杞﹂棿" + :width="modalWidth" + :visible="visible" + :confirmLoading="confirmLoading" + @ok="handleSubmit" + @cancel="handleCancel" + @update:fullscreen="isFullscreen" + wrapClassName="j-factory-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> + <!--搴曢儴鐖跺瓙鍏宠仈鎿嶄綔鍜岀‘璁ゅ彇娑堟寜閽�--> + <!--<template slot="footer">--> + <!--<div class="drawer-bootom-button">--> + <!--<a-dropdown style="float: left" :trigger="['click']" placement="topCenter">--> + <!--<a-menu slot="overlay">--> + <!--<a-menu-item key="1" @click="switchCheckStrictly(1)">鐖跺瓙鍏宠仈</a-menu-item>--> + <!--<a-menu-item key="2" @click="switchCheckStrictly(2)">鍙栨秷鍏宠仈</a-menu-item>--> + <!--</a-menu>--> + <!--<a-button>--> + <!--鏍戞搷浣� <a-icon type="up" />--> + <!--</a-button>--> + <!--</a-dropdown>--> + <!--<a-button @click="handleCancel" type="primary" style="margin-right: 0.8rem">鍏抽棴</a-button>--> + <!--<a-button @click="handleSubmit" type="primary" >纭</a-button>--> + <!--</div>--> + <!--</template>--> + </j-modal> +</template> + +<script> + import { queryFactoryTreeList } from '@/api/api' + import { getAction } from '@/api/manage' + export default { + name: 'JSelectEquipmentFactoryModal', + props:['modalWidth','multi','rootOpened','factoryId', 'store', 'text','treeOpera'], + data(){ + return { + visible:false, + confirmLoading:false, + treeData:[], + autoExpandParent:true, + expandedKeys:[], + dataList:[], + checkedKeys:[], + checkedRows:[], + searchValue:"", + checkStrictly: true, + fullscreen:false, + allTreeKeys:[], + url:{ + queryTreeIdList:'/base/factory/queryTreeIdList' + } + } + }, + created(){ + this.loadFactoryTree(); + }, + watch:{ + factoryId(){ + this.initDepartComponent() + }, + visible: { + handler() { + this.initDepartComponent(true) + } + } + }, + computed:{ + treeScreenClass() { + return { + 'my-dept-select-tree': true, + 'fullscreen': this.fullscreen, + } + }, + }, + methods:{ + loadFactoryTree(){ + getAction(this.url.queryTreeIdList).then(res => { + if (res.success) { + this.allTreeKeys = res.result + this.loadDepart() + } else { + // this.$message.warning(res.message) + this.$notification.warning({ + message:'娑堟伅', + description:res.message + }); + } + }).finally(() => { + this.loading = false + }) + }, + matterTree(data) { + for (var i = 0; i < data.length; i++) { + if(data[i].leaf == false){ + data[i].disabled = true + } + + // // 杩欓噷闈㈠氨鏄綘澶勭悊鏁版嵁鐨勫湴鏂� + // data[i].width = '200' + if (data[i].children && data[i].children.length > 0) { + // children鑻ヤ笉涓虹┖鏁扮粍锛屽垯缁х画 閫掑綊璋冪敤 鏈柟娉� + this.matterTree(data[i].children) + } + } + return data + }, + show(){ + this.visible=true + this.checkedRows=[] + this.checkedKeys=[] + }, + loadDepart(){ + // 杩欎釜鏂规硶鏄壘鍒版墍鏈夌殑閮ㄩ棬淇℃伅 + queryFactoryTreeList().then(res=>{ + if(res.success){ + let arr = [...res.result] + this.reWriterWithSlot(arr) + this.treeData = arr + this.initDepartComponent() + if(this.rootOpened){ + this.initExpandedKeys(res.result) + } + this.matterTree(this.treeData) + this.expandedKeys = this.allTreeKeys + } + }) + }, + initDepartComponent(flag){ + let arr = [] + //璇ユ柟娉曚袱涓湴鏂圭敤 1.visible鏀瑰彉浜嬩欢閲嶆柊璁剧疆閫変腑椤� 2.缁勪欢缂栬緫椤甸潰鍥炴樉 + let fieldName = flag==true?'key':this.text + if(this.factoryId){ + let arr2 = this.factoryId.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/store/index.js b/src/store/index.js index c6e17e0..3d15c3c 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -11,6 +11,7 @@ import Production from './modules/Production' //閮ㄩ棬鏍戞潈闄� import DepartTree from './modules/DepartTree' +import factory from './modules/factory' Vue.use(Vuex) @@ -22,6 +23,7 @@ enhance, online, Production, + factory, DepartTree }, state: { diff --git a/src/store/modules/factory.js b/src/store/modules/factory.js new file mode 100644 index 0000000..66239ee --- /dev/null +++ b/src/store/modules/factory.js @@ -0,0 +1,45 @@ +import Vue from 'vue' +import { SET_FACTORY } from "@/store/mutation-types" +import { getAction } from '@/api/manage' + +const Factory = { + state: { + token: '', + //浜х嚎鏍� + FactoryTree:[] + + }, + + mutations: { + SET_TOKEN: (state, token) => { + state.token = token + }, + SET_FACTORY:(state,FactoryTree) => { + state.FactoryTree = FactoryTree + } + }, + + actions: { + // 浜х嚎鏍� + QueryFactory({ commit }) { + return new Promise((resolve, reject) => { + getAction("/mdc/mdcEquipment/queryTreeListByFactory").then(response => { + if(response.success){ + const result = response.result + Vue.ls.set(SET_FACTORY, result) + commit('SET_FACTORY', result) + resolve(response) + }else{ + resolve(response) + } + }).catch(error => { + reject(error) + }) + }) + }, + + + } +} + +export default Factory \ No newline at end of file diff --git a/src/store/mutation-types.js b/src/store/mutation-types.js index ec1f45c..8655479 100644 --- a/src/store/mutation-types.js +++ b/src/store/mutation-types.js @@ -30,4 +30,6 @@ //浜х嚎鏍� export const SYS_PRODUCTION = 'SYS_PRODUCTION' //閮ㄩ棬鏍戞潈闄� -export const SYS_DEPARTTREE = 'SYS_DEPARTTREE' \ No newline at end of file +export const SYS_DEPARTTREE = 'SYS_DEPARTTREE' + +export const SET_FACTORY = 'SET_FACTORY' \ No newline at end of file diff --git a/src/views/mdc/base/EquipmentList.vue b/src/views/mdc/base/EquipmentList.vue index ae5950e..d48afe9 100644 --- a/src/views/mdc/base/EquipmentList.vue +++ b/src/views/mdc/base/EquipmentList.vue @@ -107,7 +107,7 @@ <script> import UserModal from './modules/EquipmentList/UserModal' import { JeecgListMixin } from '@/mixins/JeecgListMixin' - import { queryProductionTreeListByMdc } from '@/api/api' + import { queryFactoryTreeList } from '@/api/api' import { mapActions } from 'vuex' export default { @@ -256,12 +256,12 @@ width: 200 // sorter: true }, - { - title: '瀹夎浣嶇疆', - align: 'center', - width: 200, - dataIndex: 'equipmentAddress' - }, + // { + // title: '瀹夎浣嶇疆', + // align: 'center', + // width: 200, + // dataIndex: 'equipmentAddress' + // }, { title: '杞﹂棿', align: 'center', @@ -406,7 +406,7 @@ * 璋冪敤鎺ュ彛鑾峰彇鏌ヨ鍖哄煙杞﹂棿鏍戝垪琛� */ getWorkshopListByApi() { - queryProductionTreeListByMdc().then(res => { + queryFactoryTreeList().then(res => { if (res.success) { this.workshopTreeData = res.result this.treeDefaultExpandedKeys = [...res.result].map(item => item.key) diff --git a/src/views/mdc/base/modules/EquipmentList/EquipmentModal.vue b/src/views/mdc/base/modules/EquipmentList/EquipmentModal.vue index ce4eb25..344325b 100644 --- a/src/views/mdc/base/modules/EquipmentList/EquipmentModal.vue +++ b/src/views/mdc/base/modules/EquipmentList/EquipmentModal.vue @@ -64,7 +64,7 @@ <!--杞﹂棿鍒嗛厤--> <a-form-model-item label="杞﹂棿鍒嗛厤" :labelCol="labelCol" :wrapperCol="wrapperCol" v-show="!productionDisabled"> - <j-select-production v-model="model.selectedProduction" :multi="true" @back="backProductionInfo" :backProduction="true" :treeProductOpera="true"></j-select-production> + <j-select-production v-model="model.selectedFactory" :multi="true" @back="backProductionInfo" :backProduction="true" :treeProductOpera="true"></j-select-production> </a-form-model-item> <a-form-model-item label="璐熻矗閮ㄩ棬" :labelCol="labelCol" :wrapperCol="wrapperCol" v-if="departIdShow==true"> @@ -220,7 +220,7 @@ this.resetScreenSize(); that.userId = record.id; that.model = Object.assign({},{selectedroles:'',selecteddeparts:''}, record); - that.model = Object.assign({},{selectedroles:'',selectedProduction:''}, record); + that.model = Object.assign({},{selectedroles:'',selectedFactory:''}, record); //韬唤涓轰笂绾ф樉绀鸿礋璐i儴闂紝鍚﹀垯涓嶆樉绀� if(this.model.userIdentity==2){ @@ -305,7 +305,7 @@ } that.model.selecteddeparts = selectDepartKeys.join(",") - that.model.selectedProduction = selectDepartKeys.join(",") + that.model.selectedFactory = selectDepartKeys.join(",") that.nextDepartOptions=departOptions; console.log('that.nextDepartOptions=',that.nextDepartOptions) @@ -325,7 +325,7 @@ }) } - that.model.selectedProduction = selectProductKeys.join(",") + that.model.selectedFactory = selectProductKeys.join(",") that.nextProductionOptions=ProductionOptions; console.log('that.nextProductionOptions=',that.nextProductionOptions) @@ -341,7 +341,7 @@ }) }, backProductionInfo(info) { - this.model.productionIds = this.model.selectedProduction; + this.model.productionIds = this.model.selectedFactory; this.nextProductionOptions = info.map((item,index,arr)=>{ let c = {label:item.text, value: item.value+""} return c; diff --git a/src/views/mdc/base/modules/EquipmentList/UserModal.vue b/src/views/mdc/base/modules/EquipmentList/UserModal.vue index cb93b44..d22bb6d 100644 --- a/src/views/mdc/base/modules/EquipmentList/UserModal.vue +++ b/src/views/mdc/base/modules/EquipmentList/UserModal.vue @@ -57,12 +57,12 @@ </a-form-model-item> </a-col> <a-col :span="12"> - <a-form-model-item label="杞﹂棿鍒嗛厤" v-show="!productionDisabled" - ref="selectedProduction" prop="selectedProduction"> + <a-form-model-item label="杞﹂棿鍒嗛厤" v-show="!factoryDisabled" + ref="selectedFactory" prop="selectedFactory"> <!--<j-select-equipment-production v-decorator="['selectedProduction',{rules:[{required:true,message:'璇烽�夋嫨杞﹂棿!'}]}]" :multi="false" @back="backProductionInfo" :backProduction="true" :treeProductOpera="true"></j-select-equipment-production>--> - <j-select-equipment-production :disabled="disableSubmit" v-model="model.selectedProduction" :multi="false" - @back="backProductionInfo" :backProduction="true" - :treeProductOpera="true"></j-select-equipment-production> + <j-select-equipment-factory :disabled="disableSubmit" v-model="model.selectedFactory" :multi="false" + @back="backFactoryInfo" :backFactory="true" + :treeProductOpera="true"></j-select-equipment-factory> </a-form-model-item> </a-col> @@ -124,13 +124,13 @@ </a-row> <a-row :gutter="24"> - <a-col :span="12"> - <a-form-model-item label="绯荤粺绫诲瀷"> - <j-dict-select-tag placeholder="璇烽�夋嫨绯荤粺绫诲瀷" :triggerChange="true" dictCode="system_type" - :disabled="disableSubmit" - v-model="model.systemType" allow-clear/> - </a-form-model-item> - </a-col> +<!-- <a-col :span="12">--> +<!-- <a-form-model-item label="绯荤粺绫诲瀷">--> +<!-- <j-dict-select-tag placeholder="璇烽�夋嫨绯荤粺绫诲瀷" :triggerChange="true" dictCode="system_type"--> +<!-- :disabled="true"--> +<!-- v-model="model.systemType" allow-clear/>--> +<!-- </a-form-model-item>--> +<!-- </a-col>--> <a-col :span="12"> <a-form-model-item label="鎺掑簭"> <a-input :disabled="disableSubmit" :readOnly="disableSubmit" placeholder="璇疯緭鍏ユ帓搴�" @@ -139,22 +139,22 @@ </a-col> </a-row> - <a-row :gutter="24"> - <a-col :span='12' v-if="systemType"> - <a-form-model-item label="绯荤粺绫诲瀷"> - <a-radio-group name="radioGroup" v-model="systemValue" :disabled="disableSubmit"> - <a-radio value="1">DNC</a-radio> - <a-radio value="2">MDC</a-radio> - <a-radio value="3">閫氱敤</a-radio> - </a-radio-group> - </a-form-model-item> - </a-col> - <a-col :span='12'> - <a-form-model-item label="瀹夎浣嶇疆"> - <a-input v-model="model.equipmentAddress" allow-clear placeholder="璇疯緭鍏ュ畨瑁呬綅缃�" :disabled="disableSubmit"/> - </a-form-model-item> - </a-col> - </a-row> +<!-- <a-row :gutter="24">--> +<!-- <a-col :span='12' v-if="systemType">--> +<!-- <a-form-model-item label="绯荤粺绫诲瀷">--> +<!-- <a-radio-group name="radioGroup" v-model="systemValue" :disabled="disableSubmit">--> +<!-- <a-radio value="1">DNC</a-radio>--> +<!-- <a-radio value="2">MDC</a-radio>--> +<!-- <a-radio value="3">閫氱敤</a-radio>--> +<!-- </a-radio-group>--> +<!-- </a-form-model-item>--> +<!-- </a-col>--> +<!-- <a-col :span='12'>--> +<!-- <a-form-model-item label="瀹夎浣嶇疆">--> +<!-- <a-input v-model="model.equipmentAddress" allow-clear placeholder="璇疯緭鍏ュ畨瑁呬綅缃�" :disabled="disableSubmit"/>--> +<!-- </a-form-model-item>--> +<!-- </a-col>--> +<!-- </a-row>--> <a-row :gutter="24"> @@ -198,8 +198,8 @@ import { addEquipment, editEquipment } from '@/api/api' import { disabledAuthFilter } from '@/utils/authFilter' import { duplicateCheck } from '@/api/api' - import JSelectEquipmentProduction from '../../../../../components/jeecgbiz/JSelectEquipmentProduction' - import JSelectProduction from '../../../../../components/jeecgbiz/JSelectProduction' + import JSelectEquipmentFactory from '../../../../../components/jeecgbiz/JSelectEquipmentFactory' + import JSelectFactory from '../../../../../components/jeecgbiz/JSelectFactory' import DeviceListModel from './DeviceListModal' import JSelectEquipmentDepart from '../../../../../components/jeecgbiz/JSelectEquipmentDepart' import { mapActions } from 'vuex' @@ -207,15 +207,15 @@ export default { name: 'UserModal', components: { - JSelectProduction, + JSelectFactory, JSelectEquipmentDepart, - JSelectEquipmentProduction, + JSelectEquipmentFactory, DeviceListModel }, data() { return { departDisabled: false, //鏄惁鏄垜鐨勯儴闂ㄨ皟鐢ㄨ椤甸潰 - productionDisabled: false, //鏄惁鏄垜鐨勮溅闂磋皟鐢ㄨ椤甸潰 + factoryDisabled: false, //鏄惁鏄垜鐨勮溅闂磋皟鐢ㄨ椤甸潰 roleDisabled: false, //鏄惁鏄鑹茬淮鎶よ皟鐢ㄨ椤甸潰 modalWidth: 800, drawerWidth: 700, @@ -240,7 +240,7 @@ ], // trigger: 'blur' // 瑙﹀彂鏂瑰紡 - selectedProduction: + selectedFactory: [ { required: true, message: '璇烽�夋嫨杞﹂棿锛�' @@ -289,7 +289,7 @@ fileUpload: window._CONFIG['domianURL'] + '/sys/common/upload', userWithDepart: '/mdc/mdcEquipment/equipmentDepartList', // 寮曞叆涓烘寚瀹氱敤鎴锋煡鐪嬮儴闂ㄤ俊鎭渶瑕佺殑url //寮曞叆涓烘寚瀹氱敤鎴锋煡鐪嬭溅闂翠俊鎭渶瑕佺殑url - userProductionList: '/mdc/mdcEquipment/equipmentProductionList', + equipmentFactoryList: '/mdc/mdcEquipment/equipmentFactoryList', userId: '/sys/user/generateUserId', // 寮曞叆鐢熸垚娣诲姞鐢ㄦ埛鎯呭喌涓嬬殑url syncUserByUserName: '/act/process/extActProcess/doSyncUserByUserName',//鍚屾鐢ㄦ埛鍒板伐浣滄祦 queryTenantList: '/sys/tenant/queryList', @@ -309,7 +309,7 @@ this.headers = { 'X-Access-Token': token } this.queryGroup() this.queryTreeData() - this.getAppPlatformName() + // this.getAppPlatformName() // this.initRoleList() // this.initTenantList() }, @@ -334,13 +334,13 @@ }).finally(() => { }) }, - getAppPlatformName() { - getAction(`/system/sysParams/query/by/settingKey?settingKey=system_type`).then(res => { - if (res.success) { - this.systemType = res.result.settingValue === '0' - } - }) - }, + // getAppPlatformName() { + // getAction(`/system/sysParams/query/by/settingKey?settingKey=system_type`).then(res => { + // if (res.success) { + // this.systemType = res.result.settingValue === '0' + // } + // }) + // }, queryGroup() { getAction(this.url.queryEquipmentType).then(res => { if (res.success) { @@ -412,7 +412,7 @@ // this.model = Object.assign({}, record) this.$nextTick(() => { - this.form.setFieldsValue(pick(that.model, 'selectedDeparts', 'selectedProduction', 'equipmentId', 'equipmentName', 'equipmentModel', 'equipmentType', 'equipmentIp', 'dataPort', + this.form.setFieldsValue(pick(that.model, 'selectedDeparts', 'selectedFactory', 'equipmentId', 'equipmentName', 'equipmentModel', 'equipmentType', 'equipmentIp', 'dataPort', 'driveType', 'sortNo', 'remark', 'systemVersion', 'devicePower', 'controlSystem', 'saveTableName', 'systemValue', 'equipmentAddress')) }) if (record.hasOwnProperty('id')) { @@ -467,24 +467,24 @@ } }) - getAction(that.url.userProductionList, { equipmentId: userid }).then((res) => { + getAction(that.url.equipmentFactoryList, { equipmentId: userid }).then((res) => { if (res.success) { // console.log(res.result) - let ProductionOptions = [] + let factoryOptions = [] let selectProductKeys = [] // console.log(res.result) for (let i = 0; i < res.result.length; i++) { selectProductKeys.push(res.result[i].key) //鏂板璐熻矗閮ㄩ棬閫夋嫨涓嬫媺妗� - ProductionOptions.push({ + factoryOptions.push({ value: res.result[i].key, label: res.result[i].title }) } - that.model.selectedProduction = selectProductKeys.join(',') + that.model.selectedFactory = selectProductKeys.join(',') - that.nextProductionOptions = ProductionOptions + that.nextProductionOptions = factoryOptions // console.log('that.nextProductionOptions=',that.nextProductionOptions) } }) @@ -498,9 +498,9 @@ return c }) }, - backProductionInfo(info) { + backFactoryInfo(info) { // console.log(info) - this.model.productionIds = this.model.selectedProduction + this.model.productionIds = this.model.selectedFactory this.nextProductionOptions = info.map((item, index, arr) => { let c = { label: item.text, value: item.value + '' } return c diff --git a/src/views/mdc/common/BaseTree.vue b/src/views/mdc/common/BaseTree.vue index 445f539..a32611c 100644 --- a/src/views/mdc/common/BaseTree.vue +++ b/src/views/mdc/common/BaseTree.vue @@ -115,7 +115,7 @@ } , methods: { - ...mapActions(['QueryProduction']), + ...mapActions(['QueryFactory']), getCurrSelectedTitle() { return !this.currSelected.title ? '' : this.currSelected.title }, @@ -149,7 +149,7 @@ queryTreeData() { this.loading = true this.cardLoading = true - this.QueryProduction().then(res => { + this.QueryFactory().then(res => { if (res.success) { this.dataList = [] this.allTreeKeys = [] diff --git a/src/views/system/modules/UserModal.vue b/src/views/system/modules/UserModal.vue index 8044934..93f60a0 100644 --- a/src/views/system/modules/UserModal.vue +++ b/src/views/system/modules/UserModal.vue @@ -136,40 +136,55 @@ </a-form-model-item> <!--杞﹂棿鍒嗛厤--> +<!-- <a-form-model-item--> +<!-- label="杞﹂棿鍒嗛厤"--> +<!-- :labelCol="labelCol"--> +<!-- :wrapperCol="wrapperCol"--> +<!-- v-show="!productionDisabled"--> +<!-- >--> +<!-- <j-select-production--> +<!-- v-model="model.selectedProduction"--> +<!-- :multi="true"--> +<!-- @back="backProductionInfo"--> +<!-- :backProduction="true"--> +<!-- :treeProductOpera="true"--> +<!-- ></j-select-production>--> +<!-- </a-form-model-item>--> + + <!--涓績鍒嗛厤--> <a-form-model-item - label="杞﹂棿鍒嗛厤" + label="涓績鍒嗛厤" :labelCol="labelCol" :wrapperCol="wrapperCol" - v-show="!productionDisabled" + v-show="!factoryDisabled" > - <j-select-production - v-model="model.selectedProduction" + <j-select-factory + v-model="model.selectedFactorys" :multi="true" - @back="backProductionInfo" - :backProduction="true" - :treeProductOpera="true" - ></j-select-production> + @back="backFactoryInfo" + :backFactory="true" + :treeFactoryOpera="true" + ></j-select-factory> </a-form-model-item> - - <a-form-model-item - label="閫夋嫨璁惧" - :labelCol="labelCol" - :wrapperCol="wrapperCol" - v-show="!productionDisabled" - > - <a-tooltip title="閫夋嫨璁惧鍚庯紝鐢ㄦ埛灏卞彧鏈夎繖浜涜澶囩殑鏉冮檺锛佷笉閫夋嫨璁惧锛屽垯浼氭牴鎹溅闂村垎閰嶆帶鍒惰澶囩殑鏉冮檺锛�" - placement="topRight"> - <a-input-search - :readOnly="true" - v-model="model.equipmentIds" - @search="deviceSearch" - enter-button - placeholder="璇烽�夋嫨璁惧" - :disabled="!model.selectedProduction" - /> - </a-tooltip> - </a-form-model-item> +<!-- <a-form-model-item--> +<!-- label="閫夋嫨璁惧"--> +<!-- :labelCol="labelCol"--> +<!-- :wrapperCol="wrapperCol"--> +<!-- v-show="!productionDisabled"--> +<!-- >--> +<!-- <a-tooltip title="閫夋嫨璁惧鍚庯紝鐢ㄦ埛灏卞彧鏈夎繖浜涜澶囩殑鏉冮檺锛佷笉閫夋嫨璁惧锛屽垯浼氭牴鎹溅闂村垎閰嶆帶鍒惰澶囩殑鏉冮檺锛�"--> +<!-- placement="topRight">--> +<!-- <a-input-search--> +<!-- :readOnly="true"--> +<!-- v-model="model.equipmentIds"--> +<!-- @search="deviceSearch"--> +<!-- enter-button--> +<!-- placeholder="璇烽�夋嫨璁惧"--> +<!-- :disabled="!model.selectedProduction"--> +<!-- />--> +<!-- </a-tooltip>--> +<!-- </a-form-model-item>--> <!--<a-form-model-item--> @@ -356,7 +371,7 @@ import { addUser, editUser, queryUserRole, queryall } from '@/api/api' import { disabledAuthFilter } from '@/utils/authFilter' import { duplicateCheck } from '@/api/api' -import JSelectProduction from '../../../components/jeecgbiz/JSelectProduction' +import JSelectFactory from '../../../components/jeecgbiz/JSelectFactory' import { mapActions } from 'vuex' import { ajaxGetDictItems, getDictItemsFromCache } from '@/api/api' import SelectDeviceModal from './SelectDeviceModal' @@ -365,12 +380,12 @@ name: 'UserModal', components: { SelectDeviceModal, - JSelectProduction + JSelectFactory }, data() { return { departDisabled: false, //鏄惁鏄垜鐨勯儴闂ㄨ皟鐢ㄨ椤甸潰 - productionDisabled: false, //鏄惁鏄垜鐨勮溅闂磋皟鐢ㄨ椤甸潰 + factoryDisabled: false, //鏄惁鏄垜鐨勮溅闂磋皟鐢ㄨ椤甸潰 roleDisabled: false, //鏄惁鏄鑹茬淮鎶よ皟鐢ㄨ椤甸潰 modalWidth: 800, drawerWidth: 700, @@ -404,7 +419,6 @@ departIdShow: false, title: '鎿嶄綔', visible: false, - model: {}, labelCol: { xs: { span: 24 }, sm: { span: 5 } @@ -420,7 +434,7 @@ fileUpload: window._CONFIG['domianURL'] + 'sys/common/upload', userWithDepart: '/sys/user/userDepartList', // 寮曞叆涓烘寚瀹氱敤鎴锋煡鐪嬮儴闂ㄤ俊鎭渶瑕佺殑url //寮曞叆涓烘寚瀹氱敤鎴锋煡鐪嬭溅闂翠俊鎭渶瑕佺殑url - userProductionList: '/sys/user/userProductionList', + userFactoryList: '/sys/user/userFactorysList', userId: '/sys/user/generateUserId', // 寮曞叆鐢熸垚娣诲姞鐢ㄦ埛鎯呭喌涓嬬殑url syncUserByUserName: '/act/process/extActProcess/doSyncUserByUserName',//鍚屾鐢ㄦ埛鍒板伐浣滄祦 queryTenantList: '/sys/tenant/queryList' @@ -428,10 +442,10 @@ tenantsOptions: [], rolesOptions: [], nextDepartOptions: [], - nextProductionOptions: [], + nextFactoryOptions: [], isDepartType: '', model: { - selectedProduction: '' + selectedFactorys: '' } } }, @@ -441,7 +455,7 @@ if (value) this.initDictData('password_length') } }, - 'model.selectedProduction': { + 'model.selectedFactorys': { handler(newVal, oldVal) { if (newVal && this.$refs.selectDeviceModal) { // 濡傛灉杞﹂棿閫夋嫨鍓嶅悗涓嶄竴鑷村垯閲嶇疆閫夋嫨璁惧 @@ -489,7 +503,7 @@ userIdentity: 1, selectedroles: '', selecteddeparts: '', - selectedProduction: '' + selectedFactorys: '' }) }, edit(record) { @@ -510,6 +524,7 @@ if (record.hasOwnProperty('id')) { that.getUserRoles(record.id) that.getUserDeparts(record.id) + that.getUserFactorys(record.id) } }, isDisabledAuth(code) { @@ -582,26 +597,27 @@ that.nextDepartOptions = departOptions } }) - + }, + getUserFactorys(userid) { + let that = this // 鑾峰彇杞﹂棿鍒嗛厤 - getAction(that.url.userProductionList, { userId: userid }).then((res) => { + getAction(that.url.userFactoryList, { userId: userid }).then((res) => { if (res.success) { - let ProductionOptions = [] - let selectProductKeys = [] + let factoryOptions = [] + let selectFactoryKeys = [] for (let i = 0; i < res.result.length; i++) { - selectProductKeys.push(res.result[i].key) + selectFactoryKeys.push(res.result[i].key) //鏂板璐熻矗閮ㄩ棬閫夋嫨涓嬫媺妗� - ProductionOptions.push({ + factoryOptions.push({ value: res.result[i].key, label: res.result[i].title }) } - this.$set(this.model, 'selectedProduction', selectProductKeys.join(',')) - that.nextProductionOptions = ProductionOptions + this.$set(this.model, 'selectedFactorys', selectFactoryKeys.join(',')) + that.nextFactoryOptions = factoryOptions } }) - //杞﹂棿鐨剈rl }, backDepartInfo(info) { this.model.departIds = this.model.selecteddeparts @@ -610,9 +626,9 @@ return c }) }, - backProductionInfo(info) { - this.model.productionIds = this.model.selectedProduction - this.nextProductionOptions = info.map((item, index, arr) => { + backFactoryInfo(info) { + this.model.productionIds = this.model.selectedFactorys + this.nextFactoryOptions = info.map((item, index, arr) => { let c = { label: item.text, value: item.value + '' } return c }) @@ -621,7 +637,7 @@ refresh() { this.userId = '' this.nextDepartOptions = [] - this.nextProductionOptions = [] + this.nextFactoryOptions = [] this.departIdShow = false }, close() { @@ -629,7 +645,7 @@ this.visible = false this.disableSubmit = false this.nextDepartOptions = [] - this.nextProductionOptions = [] + this.nextFactoryOptions = [] this.departIdShow = false this.$refs.form.resetFields() }, -- Gitblit v1.9.3