From c65c0b31e6dfd01db744a450dda3816f65eebbc1 Mon Sep 17 00:00:00 2001 From: yuxc <yuxc@vci-tech.com> Date: 星期四, 05 十二月 2024 11:41:10 +0800 Subject: [PATCH] 1、修改使用当前用户的类型查询用户接口,可以传入用户类型。 2、增加根据用户主键获取关联的部门接口。 3、增加查询授权结果接口。 4、增加查询业务对象接口。 --- Source/plt-web/plt-web-ui/src/views/authority/ui/dataAuthorization/index.vue | 165 ++++++++++++++++++++++++++++++++---------------------- 1 files changed, 97 insertions(+), 68 deletions(-) diff --git a/Source/plt-web/plt-web-ui/src/views/authority/ui/dataAuthorization/index.vue b/Source/plt-web/plt-web-ui/src/views/authority/ui/dataAuthorization/index.vue index 1412b4f..2b0c6fa 100644 --- a/Source/plt-web/plt-web-ui/src/views/authority/ui/dataAuthorization/index.vue +++ b/Source/plt-web/plt-web-ui/src/views/authority/ui/dataAuthorization/index.vue @@ -19,23 +19,23 @@ </el-aside> <el-main> - <basic-container> + <basic-container cardBodyStyle="padding-bottom:0;"> <avue-crud ref="crud" :data="data" :option="option" :table-loading="tableLoading" @refresh-change="handleRefresh" - @selection-change="selectChange" - @row-click="rowClickHandler"> + @current-row-change="rowClickHandler"> <template slot="menuLeft"> <el-button icon="el-icon-plus" size="small" type="primary" @click="addHandler">娣诲姞</el-button> + <el-button icon="el-icon-plus" size="small" type="primary" @click="editHandler">淇敼</el-button> <el-button icon="el-icon-delete" plain size="small" type="danger" @click="delHandler">鍒犻櫎</el-button> <el-button icon="el-icon-view" plain size="small" type="primary" @click="chekView">鏌ョ湅鎺堟潈缁撴灉</el-button> </template> </avue-crud> - <div> - <data-view key="dataView" :btmNode="nodeRow" :data="viewData" :readOnly="true" height="400px"></data-view> + <div style="margin-top: 15px;"> + <data-view key="dataView" :btmNode="nodeRow" :selectRow="selectRow" :actionMap="actionMap" :readOnly="true" :height="clientHeight-260-220"></data-view> </div> <!-- 鏂板 && 缂栬緫 --> <el-dialog @@ -44,13 +44,13 @@ :visible.sync="visible" append-to-body="true" class="avue-dialog" - width="75%" + width="70%" @close="addDialogClose"> <div> - <data-view key="editView" :btmNode="nodeRow" :data="viewData" :readOnly="false" height="60vh"></data-view> + <data-view ref="editView" key="editView" :btmNode="nodeRow" :selectRow="title === 'add'?{}:selectRow" :actionMap="actionMap" :readOnly="false" :height="clientHeight-260"></data-view> </div> <span slot="footer" class="dialog-footer"> - <el-button size="small" type="primary" @click="addDialogSavaHandler">纭� 瀹�</el-button> + <el-button size="small" type="primary" @click="addDialogSavaHandler">淇� 瀛�</el-button> <el-button size="small" @click="addDialogClose">鍙� 娑�</el-button> </span> </el-dialog> @@ -84,15 +84,15 @@ import {getBizTree} from "@/api/UI/uiDefine"; import basicOption from "@/util/basic-option"; import dataView from "./dataView"; -import {getTypeActionByType} from "@/api/authority/ui/typeAction"; +import {getData,saveGrand,delGrand} from "@/api/authority/ui/dataAuthor"; import func from "@/util/func"; import {getUsedEnumList} from "@/api/modeling/enumType/api"; -import {deleteTemplate, saveTemplate, updateTemplate} from "@/api/queryTemplate/queryDefine"; export default { name: "index", components:{dataView}, data:function (){ return{ + clientHeight:Math.max(document.body.clientHeight,700), treeOption: { height: 'auto', defaultExpandAll: true, @@ -107,10 +107,11 @@ nodeRow: {}, treeData: [], tableLoading: false, - selectList: [], + selectRow: {}, option: { ...basicOption, - height:260, + height:280, + highlightCurrentRow:true, addBtn: false, editBtn: false, delBtn: false, @@ -118,26 +119,32 @@ columnBtn:false, gridBtn:false, tip: false, - align: 'left', + index:false, + selection:false, menu:false, - column: [ - { - label: '瑙勫垯鍚嶇О', - prop: 'plCode', - overHidden: true - }, - { - label: '瑙勫垯绫诲瀷', - prop: 'plName', - overHidden: true - } - ] + align:'center', + column: [{ + label: '瑙勫垯鍚嶇О', + prop: 0, + overHidden: true + },{ + label: '瑙勫垯绫诲瀷', + prop: 1, + overHidden: true + }] }, data: [], - viewData:{}, title: '', visible: false, - form:{} + form:{}, + actionMap:{}, + switchDic:[{ + label:'', + value:false + },{ + label:'', + value:true + }] } }, created() { @@ -162,12 +169,40 @@ } }, getTableList() { - getTypeActionByType({ - 'typeName': this.nodeRow.attributes.name, - }).then(res => { - this.data = res.data.data; + getData(this.nodeRow.attributes.name).then(res => { + if(typeof res.data == 'string'){ + res.data=eval('('+res.data +')') + } + if(res.data.obj.tableHeader){ + this.option.column=[ { + label: '瑙勫垯鍚嶇О', + prop: 0, + overHidden: true + },{ + label: '瑙勫垯绫诲瀷', + prop: 1, + overHidden: true + }]; + res.data.obj.tableHeader.forEach((item,i)=>{ + if(i<=1) return; + if(i=='rules') return; + this.option.column.push({ + label: item, + prop: i, + overHidden: true, + width:'auto', + html:true, + formatter:(val)=> { + return '<label class="el-checkbox is-disabled ' + (val[i] == true ? 'is-checked' : '') + '"><span class="el-checkbox__input is-disabled ' + (val[i] == true ? 'is-checked' : '') + '"><span class="el-checkbox__inner"></span><input type="checkbox" aria-hidden="false" class="el-checkbox__original" value="' + val[i] + '"></span></label>' + } + }) + }) + } + this.data = res.data.obj.rowList; this.$refs.crud.clearSelection(); this.tableLoading = false; + this.actionMap=res.data.obj.actionMap; + this.selectRow={} }) }, handleRefresh() { @@ -175,39 +210,16 @@ }, // 琛岀偣鍑� rowClickHandler(row) { - func.rowClickHandler( - row, - this.$refs.crud, - this.lastIndex, - (newIndex) => { - this.lastIndex = newIndex; - }, - () => { - this.selectList = [row]; - } - ); - this.getViewData(row) - }, - // 閫夋嫨妗� - selectChange(row) { - this.selectList = row; - }, - //鑾峰彇涓嬫柟鏁版嵁 - getViewData(row){ - this.viewData={}; + this.selectRow=row }, // 鏌ョ湅鎺堟潈缁撴灉 chekView() { - if (this.selectList.length <= 0) { - this.$message.warning('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹�'); - return; - } - if (this.selectList.length > 1) { - this.$message.warning('鍙兘閫夋嫨涓�鏉℃暟鎹繘琛屾煡鐪�'); + if (this.selectRow=={}) { + this.$message.warning('璇烽�夋嫨涓�鏉℃暟鎹�'); return; } - getUsedEnumList({enumName: this.selectList[0].id}).then(res => { + getUsedEnumList({enumName: this.selectRow.id}).then(res => { if (res.data.code === 200) { this.checkViewVisible = true; this.checkViewData = res.data.data; @@ -224,7 +236,6 @@ this.checkViewData = this.checkViewDataSearch; return done(); } - ; this.checkViewData = this.checkViewData.filter(item => { return item.source && item.source.includes(source); @@ -244,8 +255,8 @@ }, //淇敼 editHandler(){ - if (func.isEmptyObject(this.nodeRow)) { - this.$message.error('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹�'); + if (func.isEmptyObject(this.selectRow)) { + this.$message.error('璇烽�夋嫨涓�鏉℃暟鎹�'); return; } this.title = 'edit'; @@ -253,13 +264,31 @@ }, // 鏂板缂栬緫淇濆瓨 addDialogSavaHandler() { - saveTemplate(this.viewData).then(res => { - if (res.data.code === 200) { - this.$message.success(res.data.obj); + let form=this.$refs.editView.form; + form.users='' + form.userGroups=''; + form.roles='' + this.$refs.editView.authData.forEach(item=>{ + let infos=item.name.split(', '); + infos[0]=infos[0].replace('{','') + if(infos[2]=='user}'){ + form.users+=infos[0]+',' + } + if(infos[2]=='userGroup}'){ + form.userGroups+=infos[0]+',' + } + if(infos[2]=='role}'){ + form.roles+=infos[0]+',' + } + }); + console.log(form) + //saveGrand(this.viewData).then(res => { + //if (res.data.code === 200) { + //this.$message.success(res.data.obj); this.getTableList(); this.addDialogClose(); - } - }) + //} + //}) }, // 鏂板缂栬緫瀵硅瘽妗嗗彇娑� addDialogClose() { @@ -267,7 +296,7 @@ }, //鍒犻櫎 delHandler(){ - if (func.isEmptyObject(this.nodeRow)) { + if (func.isEmptyObject(this.selectRow)) { this.$message.error('璇烽�夋嫨鏁版嵁'); return; } @@ -276,7 +305,7 @@ cancelButtonText: '鍙栨秷', type: 'warning' }).then(() => { - deleteTemplate({name:this.templateForm}).then(res => { + delGrand({name:this.templateForm}).then(res => { if (res.data.code === 200) { this.$message.success(res.data.obj); this.getTableList(); -- Gitblit v1.9.3