From a34c10535d130c4be667301434a0e8072ee82716 Mon Sep 17 00:00:00 2001 From: 田源 <lastanimals@163.com> Date: 星期一, 14 十月 2024 15:21:48 +0800 Subject: [PATCH] 整合代码,修改表单定义按钮排列方式 --- Source/plt-web/plt-web-ui/src/views/authority/ui/uiAuthorization/index.vue | 112 ++++++++++++++++++++++++++++++------------------------- 1 files changed, 61 insertions(+), 51 deletions(-) diff --git a/Source/plt-web/plt-web-ui/src/views/authority/ui/uiAuthorization/index.vue b/Source/plt-web/plt-web-ui/src/views/authority/ui/uiAuthorization/index.vue index a1d02f2..3fb919b 100644 --- a/Source/plt-web/plt-web-ui/src/views/authority/ui/uiAuthorization/index.vue +++ b/Source/plt-web/plt-web-ui/src/views/authority/ui/uiAuthorization/index.vue @@ -23,8 +23,13 @@ <h3 style="margin: 0 0 10px 0">UI鏉冮檺閰嶇疆</h3> <div> <el-button icon="el-icon-place" plain size="small" type="primary" @click="saveHandler">鎺堟潈</el-button> - <el-button icon="el-icon-close" plain size="small" type="primary" @click="clearValue" style="margin-right: 40px;">閲嶇疆</el-button> - 涓氬姟绫诲瀷锛�<el-select v-model="type" placeholder="璇烽�夋嫨" size="small" :clearable="true" @change="typeChange" style="width: 300px;margin-right: 20px;"> + <el-button icon="el-icon-close" plain size="small" style="margin-right: 40px;" type="primary" + @click="clearValue">閲嶇疆 + </el-button> + 涓氬姟绫诲瀷锛� + <el-select v-model="type" :clearable="true" placeholder="璇烽�夋嫨" size="small" + style="width: 300px;margin-right: 20px;" + @change="typeChange"> <el-option v-for="item in typeData" :key="item.oid" @@ -32,14 +37,16 @@ :value="item.attributes.name"> </el-option> </el-select> - UI涓婁笅鏂囷細<el-select v-model="context" placeholder="璇烽�夋嫨" size="small" :clearable="true" @change="contextChange" style="width: 350px;"> - <el-option - v-for="item in contextData" - :key="item.oid" - :label="item.plCode+' '+item.plName" - :value="item.plCode"> - </el-option> - </el-select> + UI涓婁笅鏂囷細 + <el-select v-model="context" :clearable="true" placeholder="璇烽�夋嫨" size="small" style="width: 350px;" + @change="contextChange"> + <el-option + v-for="item in contextData" + :key="item.oid" + :label="item.plCode+' '+item.plName" + :value="item.plCode"> + </el-option> + </el-select> </div> <div style="height: calc(100vh - 232px);margin-top: 10px;"> <avue-tree ref="uiTree" :data="uiTreeData" :option="uiTreeOption"> @@ -59,15 +66,15 @@ <script> import {gridRoles} from "@/api/system/role/api"; -import {getUIAuthor,authorizedUI} from "@/api/authority/ui/uiAuthor"; +import {getUIAuthor, authorizedUI} from "@/api/authority/ui/uiAuthor"; import {getBizTree, gridUIContextData} from "@/api/UI/uiDefine"; export default { name: "index", data() { return { - type:'',//涓氬姟绫诲瀷 - context:'',//UI涓婁笅鏂嘽ode + type: '',//涓氬姟绫诲瀷 + context: '',//UI涓婁笅鏂嘽ode treeOption: { menu: false, addBtn: false, @@ -79,13 +86,13 @@ }, nodeRow: {}, treeData: [], - defaultExpandKeys:[], + defaultExpandKeys: [], uiTreeOption: { - defaultExpandedKeys:this.defaultExpandKeys, + defaultExpandedKeys: this.defaultExpandKeys, multiple: true, menu: false, addBtn: false, - filter:false, + filter: false, props: { label: 'label', value: 'oid', @@ -93,21 +100,21 @@ } }, uiTreeData: [], - typeData:[], - contextData:[] + typeData: [], + contextData: [] } }, created() { this.getTreeList(); this.getTypeList() }, - methods:{ + methods: { getTreeList() { const loading = this.$loading({}); gridRoles().then(res => { this.treeData = res.data.data; loading.close(); - }).catch(error=>{ + }).catch(error => { loading.close(); }) }, @@ -122,12 +129,13 @@ const params = { 'conditionMap[roleId]': this.nodeRow.oid, 'conditionMap[type]': this.type, - 'conditionMap[context]': this.context + 'conditionMap[context]': this.context, + 'conditionMap[showCheckbox]': true } - this.defaultExpandKeys=['root']; + this.defaultExpandKeys = ['root']; getUIAuthor(params).then(res => { this.processChildren(res.data.data[0]); // 澶勭悊姣忎釜鑺傜偣 - this.uiTreeOption.defaultExpandedKeys=this.defaultExpandKeys; + this.uiTreeOption.defaultExpandedKeys = this.defaultExpandKeys; this.uiTreeData = [{ attributes: {}, checked: false, @@ -149,24 +157,25 @@ processChildren(item) { if (item.children && item.children.length > 0) { item.children = item.children.map(child => { - if(child.level<4){ + if (child.level < 2) { + // 榛樿鏍戣妭鐐瑰睍寮�涓ゅ眰鏁堟灉 this.defaultExpandKeys.push(child.oid) } - if(child.level==1){ - child.icon='el-icon-s-promotion'; - child.label=child.data.label+'锛�'+child.data.name+'锛�' - }else if(child.level==2){ - child.icon='el-icon-s-order'; - child.label=child.text - }else if(child.level==3){ - child.icon='el-icon-office-building'; - child.label=child.text - }else if(child.level==4){ - child.icon='el-icon-document'; - child.label=child.text - }else if(child.level==5){ - child.icon='el-icon-s-tools'; - child.label=child.text + if (child.level == 1) { + child.icon = 'el-icon-s-promotion'; + child.label = child.data.label + '锛�' + child.data.name + '锛�' + } else if (child.level == 2) { + child.icon = 'el-icon-s-order'; + child.label = child.text + } else if (child.level == 3) { + child.icon = 'el-icon-office-building'; + child.label = child.text + } else if (child.level == 4) { + child.icon = 'el-icon-document'; + child.label = child.text + } else if (child.level == 5) { + child.icon = 'el-icon-s-tools'; + child.label = child.text } this.processChildren(child); // 閫掑綊澶勭悊姣忎釜瀛愯妭鐐� return child; // 鍙繑鍥炲瓙鑺傜偣鐨� attributes @@ -175,26 +184,26 @@ }, getTypeList() { getBizTree().then(res => { - this.typeData=res.data.obj.children; + this.typeData = res.data.obj.children; }) }, - typeChange(data){ - this.contextData=[]; - this.type=data; - if(data){ + typeChange(data) { + this.contextData = []; + this.type = data; + if (data) { const params = { 'conditionMap[btmName]': data, } gridUIContextData(1, 500, params).then(res => { this.contextData = res.data.data; }) - }else { + } else { this.contextData = []; } this.getUITree(); }, - contextChange(data){ - this.context=data; + contextChange(data) { + this.context = data; this.getUITree(); }, saveHandler() { @@ -216,8 +225,8 @@ } }); }, - clearValue(){ - this.$refs.uiTree.setCheckedNodes([]) + clearValue() { + this.$refs.uiTree.setCheckedNodes([]); } } } @@ -228,8 +237,9 @@ .el-scrollbar__wrap { overflow: auto !important; } - .headerCon{ - .el-button{ + + .headerCon { + .el-button { width: 82px; } } -- Gitblit v1.9.3