【删除】删除所有和部门角色相关的代码
【fix】修复部门和角色处用户查询不能模糊匹配用户名的问题
This commit is contained in:
@@ -1,213 +1,213 @@
|
||||
<template>
|
||||
<a-drawer
|
||||
:title="title"
|
||||
:maskClosable="true"
|
||||
width=650
|
||||
placement="right"
|
||||
:closable="true"
|
||||
@close="close"
|
||||
:visible="visible"
|
||||
style="overflow: auto;padding-bottom: 53px;">
|
||||
<!--<template>-->
|
||||
<!-- <a-drawer-->
|
||||
<!-- :title="title"-->
|
||||
<!-- :maskClosable="true"-->
|
||||
<!-- width=650-->
|
||||
<!-- placement="right"-->
|
||||
<!-- :closable="true"-->
|
||||
<!-- @close="close"-->
|
||||
<!-- :visible="visible"-->
|
||||
<!-- style="overflow: auto;padding-bottom: 53px;">-->
|
||||
|
||||
<a-form>
|
||||
<a-form-item label='所拥有的部门权限'>
|
||||
<!-- <a-form>-->
|
||||
<!-- <a-form-item label='所拥有的部门权限'>-->
|
||||
|
||||
<a-tree
|
||||
v-if="treeData.length>0"
|
||||
checkable
|
||||
@check="onCheck"
|
||||
:checkedKeys="checkedKeys"
|
||||
:treeData="treeData"
|
||||
@expand="onExpand"
|
||||
@select="onTreeNodeSelect"
|
||||
:selectedKeys="selectedKeys"
|
||||
:expandedKeys="expandedKeysss"
|
||||
:checkStrictly="checkStrictly">
|
||||
<span slot="hasDatarule" slot-scope="{slotTitle,ruleFlag}">
|
||||
{{ slotTitle }}<a-icon v-if="ruleFlag" type="align-left" style="margin-left:5px;color: red;"></a-icon>
|
||||
</span>
|
||||
</a-tree>
|
||||
<div v-else><h3>无可配置部门权限!</h3></div>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
<!-- <a-tree-->
|
||||
<!-- v-if="treeData.length>0"-->
|
||||
<!-- checkable-->
|
||||
<!-- @check="onCheck"-->
|
||||
<!-- :checkedKeys="checkedKeys"-->
|
||||
<!-- :treeData="treeData"-->
|
||||
<!-- @expand="onExpand"-->
|
||||
<!-- @select="onTreeNodeSelect"-->
|
||||
<!-- :selectedKeys="selectedKeys"-->
|
||||
<!-- :expandedKeys="expandedKeysss"-->
|
||||
<!-- :checkStrictly="checkStrictly">-->
|
||||
<!-- <span slot="hasDatarule" slot-scope="{slotTitle,ruleFlag}">-->
|
||||
<!-- {{ slotTitle }}<a-icon v-if="ruleFlag" type="align-left" style="margin-left:5px;color: red;"></a-icon>-->
|
||||
<!-- </span>-->
|
||||
<!-- </a-tree>-->
|
||||
<!-- <div v-else><h3>无可配置部门权限!</h3></div>-->
|
||||
<!-- </a-form-item>-->
|
||||
<!-- </a-form>-->
|
||||
|
||||
<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-item key="3" @click="checkALL">全部勾选</a-menu-item>
|
||||
<a-menu-item key="4" @click="cancelCheckALL">取消全选</a-menu-item>
|
||||
<a-menu-item key="5" @click="expandAll">展开所有</a-menu-item>
|
||||
<a-menu-item key="6" @click="closeAll">合并所有</a-menu-item>
|
||||
</a-menu>
|
||||
<a-button>
|
||||
树操作 <a-icon type="up" />
|
||||
</a-button>
|
||||
</a-dropdown>
|
||||
<a-popconfirm title="确定放弃编辑?" @confirm="close" okText="确定" cancelText="取消">
|
||||
<a-button style="margin-right: .8rem">取消</a-button>
|
||||
</a-popconfirm>
|
||||
<a-button @click="handleSubmit(false)" type="primary" :loading="loading" ghost style="margin-right: 0.8rem">仅保存</a-button>
|
||||
<a-button @click="handleSubmit(true)" type="primary" :loading="loading">保存并关闭</a-button>
|
||||
</div>
|
||||
<dept-role-datarule-modal ref="datarule"></dept-role-datarule-modal>
|
||||
</a-drawer>
|
||||
<!-- <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-item key="3" @click="checkALL">全部勾选</a-menu-item>-->
|
||||
<!-- <a-menu-item key="4" @click="cancelCheckALL">取消全选</a-menu-item>-->
|
||||
<!-- <a-menu-item key="5" @click="expandAll">展开所有</a-menu-item>-->
|
||||
<!-- <a-menu-item key="6" @click="closeAll">合并所有</a-menu-item>-->
|
||||
<!-- </a-menu>-->
|
||||
<!-- <a-button>-->
|
||||
<!-- 树操作 <a-icon type="up" />-->
|
||||
<!-- </a-button>-->
|
||||
<!-- </a-dropdown>-->
|
||||
<!-- <a-popconfirm title="确定放弃编辑?" @confirm="close" okText="确定" cancelText="取消">-->
|
||||
<!-- <a-button style="margin-right: .8rem">取消</a-button>-->
|
||||
<!-- </a-popconfirm>-->
|
||||
<!-- <a-button @click="handleSubmit(false)" type="primary" :loading="loading" ghost style="margin-right: 0.8rem">仅保存</a-button>-->
|
||||
<!-- <a-button @click="handleSubmit(true)" type="primary" :loading="loading">保存并关闭</a-button>-->
|
||||
<!-- </div>-->
|
||||
<!--<!– <dept-role-datarule-modal ref="datarule"></dept-role-datarule-modal>–>-->
|
||||
<!-- </a-drawer>-->
|
||||
|
||||
</template>
|
||||
<script>
|
||||
import {queryTreeListForDeptRole,queryDeptRolePermission,saveDeptRolePermission} from '@/api/api'
|
||||
import RoleDataruleModal from './RoleDataruleModal.vue'
|
||||
import DeptRoleDataruleModal from './DeptRoleDataruleModal'
|
||||
<!--</template>-->
|
||||
<!--<script>-->
|
||||
<!-- import {queryTreeListForDeptRole,queryDeptRolePermission,saveDeptRolePermission} from '@/api/api'-->
|
||||
<!-- import RoleDataruleModal from './RoleDataruleModal.vue'-->
|
||||
<!-- // import DeptRoleDataruleModal from './DeptRoleDataruleModal'-->
|
||||
|
||||
export default {
|
||||
name: "DeptRoleAuthModal",
|
||||
components:{
|
||||
DeptRoleDataruleModal,
|
||||
RoleDataruleModal
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
departId:"",
|
||||
roleId:"",
|
||||
treeData: [],
|
||||
defaultCheckedKeys:[],
|
||||
checkedKeys:[],
|
||||
halfCheckedKeys:[],
|
||||
expandedKeysss:[],
|
||||
allTreeKeys:[],
|
||||
autoExpandParent: true,
|
||||
checkStrictly: true,
|
||||
title:"部门角色权限配置",
|
||||
visible: false,
|
||||
loading: false,
|
||||
selectedKeys:[]
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
switchCheckStrictly (v) {
|
||||
if(v==1){
|
||||
this.checkStrictly = false
|
||||
}else if(v==2){
|
||||
this.checkStrictly = true
|
||||
}
|
||||
},
|
||||
onTreeNodeSelect(id){
|
||||
if(id && id.length>0){
|
||||
this.selectedKeys = id
|
||||
}
|
||||
this.$refs.datarule.show(this.selectedKeys[0],this.departId,this.roleId)
|
||||
},
|
||||
onCheck (o) {
|
||||
if(this.checkStrictly){
|
||||
this.checkedKeys = o.checked;
|
||||
}else{
|
||||
this.checkedKeys = o
|
||||
}
|
||||
},
|
||||
show(roleId,departId){
|
||||
this.departId = departId
|
||||
this.roleId=roleId
|
||||
this.visible = true;
|
||||
},
|
||||
close () {
|
||||
this.reset()
|
||||
this.$emit('close');
|
||||
this.visible = false;
|
||||
},
|
||||
onExpand(expandedKeys){
|
||||
this.expandedKeysss = expandedKeys;
|
||||
this.autoExpandParent = false
|
||||
},
|
||||
reset () {
|
||||
this.expandedKeysss = []
|
||||
this.checkedKeys = []
|
||||
this.defaultCheckedKeys = []
|
||||
this.loading = false
|
||||
},
|
||||
expandAll () {
|
||||
this.expandedKeysss = this.allTreeKeys
|
||||
},
|
||||
closeAll () {
|
||||
this.expandedKeysss = []
|
||||
},
|
||||
checkALL () {
|
||||
this.checkedKeys = this.allTreeKeys
|
||||
},
|
||||
cancelCheckALL () {
|
||||
this.checkedKeys = []
|
||||
},
|
||||
handleCancel () {
|
||||
this.close()
|
||||
},
|
||||
handleSubmit(exit) {
|
||||
let that = this;
|
||||
let params = {
|
||||
roleId:that.roleId,
|
||||
permissionIds:that.checkedKeys.join(","),
|
||||
lastpermissionIds:that.defaultCheckedKeys.join(","),
|
||||
};
|
||||
that.loading = true;
|
||||
console.log("请求参数:",params);
|
||||
saveDeptRolePermission(params).then((res)=>{
|
||||
if(res.success){
|
||||
that.$message.success(res.message);
|
||||
that.loading = false;
|
||||
if (exit) {
|
||||
that.close()
|
||||
}
|
||||
}else {
|
||||
that.$message.error(res.message);
|
||||
that.loading = false;
|
||||
if (exit) {
|
||||
that.close()
|
||||
}
|
||||
}
|
||||
this.loadData();
|
||||
})
|
||||
},
|
||||
convertTreeListToKeyLeafPairs(treeList, keyLeafPair = []) {
|
||||
for(const {key, isLeaf, children} of treeList) {
|
||||
keyLeafPair.push({key, isLeaf})
|
||||
if(children && children.length > 0) {
|
||||
this.convertTreeListToKeyLeafPairs(children, keyLeafPair)
|
||||
}
|
||||
}
|
||||
return keyLeafPair;
|
||||
},
|
||||
loadData(){
|
||||
queryTreeListForDeptRole({departId:this.departId}).then((res) => {
|
||||
this.treeData = res.result.treeList
|
||||
this.allTreeKeys = res.result.ids
|
||||
queryDeptRolePermission({roleId:this.roleId}).then((res)=>{
|
||||
this.checkedKeys = [...res.result];
|
||||
this.defaultCheckedKeys = [...res.result];
|
||||
this.expandedKeysss = this.allTreeKeys;
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
visible () {
|
||||
if (this.visible ) {
|
||||
this.loadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
<!-- export default {-->
|
||||
<!-- name: "DeptRoleAuthModal",-->
|
||||
<!-- components:{-->
|
||||
<!-- // DeptRoleDataruleModal,-->
|
||||
<!-- RoleDataruleModal-->
|
||||
<!-- },-->
|
||||
<!-- data(){-->
|
||||
<!-- return {-->
|
||||
<!-- departId:"",-->
|
||||
<!-- roleId:"",-->
|
||||
<!-- treeData: [],-->
|
||||
<!-- defaultCheckedKeys:[],-->
|
||||
<!-- checkedKeys:[],-->
|
||||
<!-- halfCheckedKeys:[],-->
|
||||
<!-- expandedKeysss:[],-->
|
||||
<!-- allTreeKeys:[],-->
|
||||
<!-- autoExpandParent: true,-->
|
||||
<!-- checkStrictly: true,-->
|
||||
<!-- title:"部门角色权限配置",-->
|
||||
<!-- visible: false,-->
|
||||
<!-- loading: false,-->
|
||||
<!-- selectedKeys:[]-->
|
||||
<!-- }-->
|
||||
<!-- },-->
|
||||
<!-- methods: {-->
|
||||
<!-- switchCheckStrictly (v) {-->
|
||||
<!-- if(v==1){-->
|
||||
<!-- this.checkStrictly = false-->
|
||||
<!-- }else if(v==2){-->
|
||||
<!-- this.checkStrictly = true-->
|
||||
<!-- }-->
|
||||
<!-- },-->
|
||||
<!-- onTreeNodeSelect(id){-->
|
||||
<!-- if(id && id.length>0){-->
|
||||
<!-- this.selectedKeys = id-->
|
||||
<!-- }-->
|
||||
<!-- this.$refs.datarule.show(this.selectedKeys[0],this.departId,this.roleId)-->
|
||||
<!-- },-->
|
||||
<!-- onCheck (o) {-->
|
||||
<!-- if(this.checkStrictly){-->
|
||||
<!-- this.checkedKeys = o.checked;-->
|
||||
<!-- }else{-->
|
||||
<!-- this.checkedKeys = o-->
|
||||
<!-- }-->
|
||||
<!-- },-->
|
||||
<!-- show(roleId,departId){-->
|
||||
<!-- this.departId = departId-->
|
||||
<!-- this.roleId=roleId-->
|
||||
<!-- this.visible = true;-->
|
||||
<!-- },-->
|
||||
<!-- close () {-->
|
||||
<!-- this.reset()-->
|
||||
<!-- this.$emit('close');-->
|
||||
<!-- this.visible = false;-->
|
||||
<!-- },-->
|
||||
<!-- onExpand(expandedKeys){-->
|
||||
<!-- this.expandedKeysss = expandedKeys;-->
|
||||
<!-- this.autoExpandParent = false-->
|
||||
<!-- },-->
|
||||
<!-- reset () {-->
|
||||
<!-- this.expandedKeysss = []-->
|
||||
<!-- this.checkedKeys = []-->
|
||||
<!-- this.defaultCheckedKeys = []-->
|
||||
<!-- this.loading = false-->
|
||||
<!-- },-->
|
||||
<!-- expandAll () {-->
|
||||
<!-- this.expandedKeysss = this.allTreeKeys-->
|
||||
<!-- },-->
|
||||
<!-- closeAll () {-->
|
||||
<!-- this.expandedKeysss = []-->
|
||||
<!-- },-->
|
||||
<!-- checkALL () {-->
|
||||
<!-- this.checkedKeys = this.allTreeKeys-->
|
||||
<!-- },-->
|
||||
<!-- cancelCheckALL () {-->
|
||||
<!-- this.checkedKeys = []-->
|
||||
<!-- },-->
|
||||
<!-- handleCancel () {-->
|
||||
<!-- this.close()-->
|
||||
<!-- },-->
|
||||
<!-- handleSubmit(exit) {-->
|
||||
<!-- let that = this;-->
|
||||
<!-- let params = {-->
|
||||
<!-- roleId:that.roleId,-->
|
||||
<!-- permissionIds:that.checkedKeys.join(","),-->
|
||||
<!-- lastpermissionIds:that.defaultCheckedKeys.join(","),-->
|
||||
<!-- };-->
|
||||
<!-- that.loading = true;-->
|
||||
<!-- console.log("请求参数:",params);-->
|
||||
<!-- saveDeptRolePermission(params).then((res)=>{-->
|
||||
<!-- if(res.success){-->
|
||||
<!-- that.$message.success(res.message);-->
|
||||
<!-- that.loading = false;-->
|
||||
<!-- if (exit) {-->
|
||||
<!-- that.close()-->
|
||||
<!-- }-->
|
||||
<!-- }else {-->
|
||||
<!-- that.$message.error(res.message);-->
|
||||
<!-- that.loading = false;-->
|
||||
<!-- if (exit) {-->
|
||||
<!-- that.close()-->
|
||||
<!-- }-->
|
||||
<!-- }-->
|
||||
<!-- this.loadData();-->
|
||||
<!-- })-->
|
||||
<!-- },-->
|
||||
<!-- convertTreeListToKeyLeafPairs(treeList, keyLeafPair = []) {-->
|
||||
<!-- for(const {key, isLeaf, children} of treeList) {-->
|
||||
<!-- keyLeafPair.push({key, isLeaf})-->
|
||||
<!-- if(children && children.length > 0) {-->
|
||||
<!-- this.convertTreeListToKeyLeafPairs(children, keyLeafPair)-->
|
||||
<!-- }-->
|
||||
<!-- }-->
|
||||
<!-- return keyLeafPair;-->
|
||||
<!-- },-->
|
||||
<!-- loadData(){-->
|
||||
<!-- queryTreeListForDeptRole({departId:this.departId}).then((res) => {-->
|
||||
<!-- this.treeData = res.result.treeList-->
|
||||
<!-- this.allTreeKeys = res.result.ids-->
|
||||
<!-- queryDeptRolePermission({roleId:this.roleId}).then((res)=>{-->
|
||||
<!-- this.checkedKeys = [...res.result];-->
|
||||
<!-- this.defaultCheckedKeys = [...res.result];-->
|
||||
<!-- this.expandedKeysss = this.allTreeKeys;-->
|
||||
<!-- })-->
|
||||
<!-- })-->
|
||||
<!-- }-->
|
||||
<!-- },-->
|
||||
<!-- watch: {-->
|
||||
<!-- visible () {-->
|
||||
<!-- if (this.visible ) {-->
|
||||
<!-- this.loadData();-->
|
||||
<!-- }-->
|
||||
<!-- }-->
|
||||
<!-- }-->
|
||||
<!-- }-->
|
||||
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
.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;
|
||||
}
|
||||
<!--</script>-->
|
||||
<!--<style lang="less" scoped>-->
|
||||
<!-- .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>
|
||||
<!--</style>-->
|
||||
@@ -1,122 +1,122 @@
|
||||
<template>
|
||||
<a-drawer
|
||||
title="数据规则/按钮权限配置"
|
||||
width="365"
|
||||
:closable="false"
|
||||
@close="onClose"
|
||||
:visible="visible"
|
||||
>
|
||||
<!--<template>-->
|
||||
<!-- <a-drawer-->
|
||||
<!-- title="数据规则/按钮权限配置"-->
|
||||
<!-- width="365"-->
|
||||
<!-- :closable="false"-->
|
||||
<!-- @close="onClose"-->
|
||||
<!-- :visible="visible"-->
|
||||
<!-- >-->
|
||||
|
||||
<a-tabs defaultActiveKey="1">
|
||||
<a-tab-pane tab="数据规则" key="1">
|
||||
<!-- <a-tabs defaultActiveKey="1">-->
|
||||
<!-- <a-tab-pane tab="数据规则" key="1">-->
|
||||
|
||||
<a-checkbox-group v-model="dataruleChecked" v-if="dataruleList.length>0">
|
||||
<a-row>
|
||||
<a-col :span="24" v-for="(item,index) in dataruleList" :key=" 'dr'+index ">
|
||||
<a-checkbox :value="item.id">{{ item.ruleName }}</a-checkbox>
|
||||
</a-col>
|
||||
<!-- <a-checkbox-group v-model="dataruleChecked" v-if="dataruleList.length>0">-->
|
||||
<!-- <a-row>-->
|
||||
<!-- <a-col :span="24" v-for="(item,index) in dataruleList" :key=" 'dr'+index ">-->
|
||||
<!-- <a-checkbox :value="item.id">{{ item.ruleName }}</a-checkbox>-->
|
||||
<!-- </a-col>-->
|
||||
|
||||
<a-col :span="24">
|
||||
<div style="width: 100%;margin-top: 15px">
|
||||
<a-button @click="saveDataruleForRole" type="primary" size="small" icon="save">点击保存</a-button>
|
||||
</div>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-checkbox-group>
|
||||
<div v-else><h3>无配置信息!</h3></div>
|
||||
<!-- <a-col :span="24">-->
|
||||
<!-- <div style="width: 100%;margin-top: 15px">-->
|
||||
<!-- <a-button @click="saveDataruleForRole" type="primary" size="small" icon="save">点击保存</a-button>-->
|
||||
<!-- </div>-->
|
||||
<!-- </a-col>-->
|
||||
<!-- </a-row>-->
|
||||
<!-- </a-checkbox-group>-->
|
||||
<!-- <div v-else><h3>无配置信息!</h3></div>-->
|
||||
|
||||
</a-tab-pane>
|
||||
<!--<a-tab-pane tab="按钮权限" key="2">敬请期待!!!</a-tab-pane>-->
|
||||
</a-tabs>
|
||||
<!-- </a-tab-pane>-->
|
||||
<!-- <!–<a-tab-pane tab="按钮权限" key="2">敬请期待!!!</a-tab-pane>–>-->
|
||||
<!-- </a-tabs>-->
|
||||
|
||||
</a-drawer>
|
||||
</template>
|
||||
<!-- </a-drawer>-->
|
||||
<!--</template>-->
|
||||
|
||||
<script>
|
||||
import ARow from 'ant-design-vue/es/grid/Row'
|
||||
import ACol from 'ant-design-vue/es/grid/Col'
|
||||
import { getAction,postAction } from '@/api/manage'
|
||||
<!--<script>-->
|
||||
<!-- import ARow from 'ant-design-vue/es/grid/Row'-->
|
||||
<!-- import ACol from 'ant-design-vue/es/grid/Col'-->
|
||||
<!-- import { getAction,postAction } from '@/api/manage'-->
|
||||
|
||||
export default {
|
||||
name: 'DeptRoleDataruleModal',
|
||||
components: { ACol, ARow },
|
||||
data(){
|
||||
return {
|
||||
departId:'',
|
||||
functionId:'',
|
||||
roleId:'',
|
||||
visible:false,
|
||||
tabList: [{
|
||||
key: '1',
|
||||
tab: '数据规则',
|
||||
}, {
|
||||
key: '2',
|
||||
tab: '按钮权限',
|
||||
}],
|
||||
activeTabKey: '1',
|
||||
url:{
|
||||
datarule:"/sys/sysDepartRole/datarule",
|
||||
},
|
||||
dataruleList:[],
|
||||
dataruleChecked:[]
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
loadData(){
|
||||
getAction(`${this.url.datarule}/${this.functionId}/${this.departId}/${this.roleId}`).then(res=>{
|
||||
console.log(res)
|
||||
if(res.success){
|
||||
this.dataruleList = res.result.datarule
|
||||
let drChecked = res.result.drChecked
|
||||
if(drChecked){
|
||||
this.dataruleChecked = drChecked.split(",")
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
saveDataruleForRole(){
|
||||
if(!this.dataruleChecked || this.dataruleChecked.length==0){
|
||||
this.$message.warning("请注意,现未勾选任何数据权限!")
|
||||
}
|
||||
let params = {
|
||||
permissionId:this.functionId,
|
||||
roleId:this.roleId,
|
||||
dataRuleIds:this.dataruleChecked.join(",")
|
||||
}
|
||||
console.log("保存数据权限",params)
|
||||
postAction(this.url.datarule,params).then(res=>{
|
||||
if(res.success){
|
||||
this.$message.success(res.message)
|
||||
}else{
|
||||
this.$message.error(res.message)
|
||||
}
|
||||
})
|
||||
},
|
||||
show(functionId,departId,roleId){
|
||||
this.onReset()
|
||||
this.departId = departId
|
||||
this.functionId = functionId
|
||||
this.roleId = roleId
|
||||
this.visible=true
|
||||
this.loadData()
|
||||
},
|
||||
onClose(){
|
||||
this.visible=false
|
||||
this.onReset()
|
||||
},
|
||||
onTabChange (key) {
|
||||
this.activeTabKey = key
|
||||
},
|
||||
onReset(){
|
||||
this.functionId=''
|
||||
this.roleId=''
|
||||
this.dataruleList=[]
|
||||
this.dataruleChecked=[]
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<!-- export default {-->
|
||||
<!-- name: 'DeptRoleDataruleModal',-->
|
||||
<!-- components: { ACol, ARow },-->
|
||||
<!-- data(){-->
|
||||
<!-- return {-->
|
||||
<!-- departId:'',-->
|
||||
<!-- functionId:'',-->
|
||||
<!-- roleId:'',-->
|
||||
<!-- visible:false,-->
|
||||
<!-- tabList: [{-->
|
||||
<!-- key: '1',-->
|
||||
<!-- tab: '数据规则',-->
|
||||
<!-- }, {-->
|
||||
<!-- key: '2',-->
|
||||
<!-- tab: '按钮权限',-->
|
||||
<!-- }],-->
|
||||
<!-- activeTabKey: '1',-->
|
||||
<!-- url:{-->
|
||||
<!-- datarule:"/sys/sysDepartRole/datarule",-->
|
||||
<!-- },-->
|
||||
<!-- dataruleList:[],-->
|
||||
<!-- dataruleChecked:[]-->
|
||||
<!-- }-->
|
||||
<!-- },-->
|
||||
<!-- methods:{-->
|
||||
<!-- loadData(){-->
|
||||
<!-- getAction(`${this.url.datarule}/${this.functionId}/${this.departId}/${this.roleId}`).then(res=>{-->
|
||||
<!-- console.log(res)-->
|
||||
<!-- if(res.success){-->
|
||||
<!-- this.dataruleList = res.result.datarule-->
|
||||
<!-- let drChecked = res.result.drChecked-->
|
||||
<!-- if(drChecked){-->
|
||||
<!-- this.dataruleChecked = drChecked.split(",")-->
|
||||
<!-- }-->
|
||||
<!-- }-->
|
||||
<!-- })-->
|
||||
<!-- },-->
|
||||
<!-- saveDataruleForRole(){-->
|
||||
<!-- if(!this.dataruleChecked || this.dataruleChecked.length==0){-->
|
||||
<!-- this.$message.warning("请注意,现未勾选任何数据权限!")-->
|
||||
<!-- }-->
|
||||
<!-- let params = {-->
|
||||
<!-- permissionId:this.functionId,-->
|
||||
<!-- roleId:this.roleId,-->
|
||||
<!-- dataRuleIds:this.dataruleChecked.join(",")-->
|
||||
<!-- }-->
|
||||
<!-- console.log("保存数据权限",params)-->
|
||||
<!-- postAction(this.url.datarule,params).then(res=>{-->
|
||||
<!-- if(res.success){-->
|
||||
<!-- this.$message.success(res.message)-->
|
||||
<!-- }else{-->
|
||||
<!-- this.$message.error(res.message)-->
|
||||
<!-- }-->
|
||||
<!-- })-->
|
||||
<!-- },-->
|
||||
<!-- show(functionId,departId,roleId){-->
|
||||
<!-- this.onReset()-->
|
||||
<!-- this.departId = departId-->
|
||||
<!-- this.functionId = functionId-->
|
||||
<!-- this.roleId = roleId-->
|
||||
<!-- this.visible=true-->
|
||||
<!-- this.loadData()-->
|
||||
<!-- },-->
|
||||
<!-- onClose(){-->
|
||||
<!-- this.visible=false-->
|
||||
<!-- this.onReset()-->
|
||||
<!-- },-->
|
||||
<!-- onTabChange (key) {-->
|
||||
<!-- this.activeTabKey = key-->
|
||||
<!-- },-->
|
||||
<!-- onReset(){-->
|
||||
<!-- this.functionId=''-->
|
||||
<!-- this.roleId=''-->
|
||||
<!-- this.dataruleList=[]-->
|
||||
<!-- this.dataruleChecked=[]-->
|
||||
<!-- }-->
|
||||
<!-- }-->
|
||||
<!-- }-->
|
||||
<!--</script>-->
|
||||
|
||||
<style scoped>
|
||||
<!--<style scoped>-->
|
||||
|
||||
</style>
|
||||
<!--</style>-->
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
<a-col :span="10">
|
||||
<a-form-item label="用户账号">
|
||||
<a-input placeholder="请输入用户账号" v-model="queryParam.username"></a-input>
|
||||
<j-input placeholder="请输入用户账号" v-model="queryParam.username"></j-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
|
||||
@@ -1,157 +1,157 @@
|
||||
<template>
|
||||
<a-modal
|
||||
:title="title"
|
||||
:width="800"
|
||||
:visible="visible"
|
||||
:confirmLoading="confirmLoading"
|
||||
@ok="handleOk"
|
||||
@cancel="handleCancel"
|
||||
cancelText="关闭">
|
||||
<!--<template>-->
|
||||
<!-- <a-modal-->
|
||||
<!-- :title="title"-->
|
||||
<!-- :width="800"-->
|
||||
<!-- :visible="visible"-->
|
||||
<!-- :confirmLoading="confirmLoading"-->
|
||||
<!-- @ok="handleOk"-->
|
||||
<!-- @cancel="handleCancel"-->
|
||||
<!-- cancelText="关闭">-->
|
||||
|
||||
<a-spin :spinning="confirmLoading">
|
||||
<a-form-model ref="form" :model="model" :rules="validatorRules">
|
||||
<!-- <a-spin :spinning="confirmLoading">-->
|
||||
<!-- <a-form-model ref="form" :model="model" :rules="validatorRules">-->
|
||||
|
||||
<a-form-model-item
|
||||
:labelCol="labelCol"
|
||||
:wrapperCol="wrapperCol"
|
||||
prop="roleName"
|
||||
label="部门角色名称">
|
||||
<a-input placeholder="请输入部门角色名称" v-model="model.roleName"/>
|
||||
</a-form-model-item>
|
||||
<a-form-model-item
|
||||
:labelCol="labelCol"
|
||||
:wrapperCol="wrapperCol"
|
||||
prop="roleCode"
|
||||
label="部门角色编码">
|
||||
<a-input placeholder="请输入部门角色编码" v-model="model.roleCode"/>
|
||||
</a-form-model-item>
|
||||
<a-form-model-item
|
||||
:labelCol="labelCol"
|
||||
:wrapperCol="wrapperCol"
|
||||
prop="description"
|
||||
label="描述">
|
||||
<a-input placeholder="请输入描述" v-model="model.description"/>
|
||||
</a-form-model-item>
|
||||
<!-- <a-form-model-item-->
|
||||
<!-- :labelCol="labelCol"-->
|
||||
<!-- :wrapperCol="wrapperCol"-->
|
||||
<!-- prop="roleName"-->
|
||||
<!-- label="部门角色名称">-->
|
||||
<!-- <a-input placeholder="请输入部门角色名称" v-model="model.roleName"/>-->
|
||||
<!-- </a-form-model-item>-->
|
||||
<!-- <a-form-model-item-->
|
||||
<!-- :labelCol="labelCol"-->
|
||||
<!-- :wrapperCol="wrapperCol"-->
|
||||
<!-- prop="roleCode"-->
|
||||
<!-- label="部门角色编码">-->
|
||||
<!-- <a-input placeholder="请输入部门角色编码" v-model="model.roleCode"/>-->
|
||||
<!-- </a-form-model-item>-->
|
||||
<!-- <a-form-model-item-->
|
||||
<!-- :labelCol="labelCol"-->
|
||||
<!-- :wrapperCol="wrapperCol"-->
|
||||
<!-- prop="description"-->
|
||||
<!-- label="描述">-->
|
||||
<!-- <a-input placeholder="请输入描述" v-model="model.description"/>-->
|
||||
<!-- </a-form-model-item>-->
|
||||
|
||||
</a-form-model>
|
||||
</a-spin>
|
||||
</a-modal>
|
||||
</template>
|
||||
<!-- </a-form-model>-->
|
||||
<!-- </a-spin>-->
|
||||
<!-- </a-modal>-->
|
||||
<!--</template>-->
|
||||
|
||||
<script>
|
||||
import { httpAction } from '@/api/manage'
|
||||
import {duplicateCheck } from '@/api/api'
|
||||
<!--<script>-->
|
||||
<!-- import { httpAction } from '@/api/manage'-->
|
||||
<!-- import {duplicateCheck } from '@/api/api'-->
|
||||
|
||||
export default {
|
||||
name: "SysDepartRoleModal",
|
||||
data () {
|
||||
return {
|
||||
title:"操作",
|
||||
visible: false,
|
||||
model: {},
|
||||
labelCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 5 },
|
||||
},
|
||||
wrapperCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 16 },
|
||||
},
|
||||
confirmLoading: false,
|
||||
validatorRules:{
|
||||
roleName:[
|
||||
{ required: true, message: '请输入部门角色名称!' },
|
||||
{ min: 2, max: 30, message: '长度在 2 到 30 个字符', trigger: 'blur' }
|
||||
],
|
||||
roleCode: [
|
||||
{ required: true, message: '请输入部门角色编码!'},
|
||||
{ min: 0, max: 64, message: '长度不超过 64 个字符', trigger: 'blur' },
|
||||
{ validator: this.validateRoleCode}
|
||||
],
|
||||
description: [
|
||||
{ min: 0, max: 126, message: '长度不超过 126 个字符', trigger: 'blur' }
|
||||
]
|
||||
},
|
||||
url: {
|
||||
add: "/sys/sysDepartRole/add",
|
||||
edit: "/sys/sysDepartRole/edit",
|
||||
},
|
||||
}
|
||||
},
|
||||
created () {
|
||||
},
|
||||
methods: {
|
||||
add (departId) {
|
||||
this.edit({},departId);
|
||||
},
|
||||
edit (record,departId) {
|
||||
this.departId = departId;
|
||||
this.model = Object.assign({}, record);
|
||||
this.visible = true;
|
||||
},
|
||||
close () {
|
||||
this.$emit('close');
|
||||
this.visible = false;
|
||||
this.$refs.form.resetFields()
|
||||
},
|
||||
handleOk () {
|
||||
const that = this;
|
||||
// 触发表单验证
|
||||
this.$refs.form.validate(valid => {
|
||||
if (valid) {
|
||||
that.confirmLoading = true;
|
||||
let httpurl = '';
|
||||
let method = '';
|
||||
if(!this.model.id){
|
||||
httpurl+=this.url.add;
|
||||
method = 'post';
|
||||
}else{
|
||||
httpurl+=this.url.edit;
|
||||
method = 'put';
|
||||
}
|
||||
this.model.departId = this.departId;
|
||||
httpAction(httpurl,this.model,method).then((res)=>{
|
||||
if(res.success){
|
||||
that.$message.success(res.message);
|
||||
that.$emit('ok');
|
||||
}else{
|
||||
that.$message.warning(res.message);
|
||||
}
|
||||
}).finally(() => {
|
||||
that.confirmLoading = false;
|
||||
that.close();
|
||||
})
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
})
|
||||
},
|
||||
handleCancel () {
|
||||
this.close()
|
||||
},
|
||||
validateRoleCode(rule, value, callback){
|
||||
if(/[\u4E00-\u9FA5]/g.test(value)){
|
||||
callback("部门角色编码不可输入汉字!");
|
||||
}else{
|
||||
var params = {
|
||||
tableName: "sys_depart_role",
|
||||
fieldName: "role_code",
|
||||
fieldVal: value,
|
||||
dataId: this.model.id,
|
||||
};
|
||||
duplicateCheck(params).then((res)=>{
|
||||
if(res.success){
|
||||
callback();
|
||||
}else{
|
||||
callback(res.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<!-- export default {-->
|
||||
<!-- name: "SysDepartRoleModal",-->
|
||||
<!-- data () {-->
|
||||
<!-- return {-->
|
||||
<!-- title:"操作",-->
|
||||
<!-- visible: false,-->
|
||||
<!-- model: {},-->
|
||||
<!-- labelCol: {-->
|
||||
<!-- xs: { span: 24 },-->
|
||||
<!-- sm: { span: 5 },-->
|
||||
<!-- },-->
|
||||
<!-- wrapperCol: {-->
|
||||
<!-- xs: { span: 24 },-->
|
||||
<!-- sm: { span: 16 },-->
|
||||
<!-- },-->
|
||||
<!-- confirmLoading: false,-->
|
||||
<!-- validatorRules:{-->
|
||||
<!-- roleName:[-->
|
||||
<!-- { required: true, message: '请输入部门角色名称!' },-->
|
||||
<!-- { min: 2, max: 30, message: '长度在 2 到 30 个字符', trigger: 'blur' }-->
|
||||
<!-- ],-->
|
||||
<!-- roleCode: [-->
|
||||
<!-- { required: true, message: '请输入部门角色编码!'},-->
|
||||
<!-- { min: 0, max: 64, message: '长度不超过 64 个字符', trigger: 'blur' },-->
|
||||
<!-- { validator: this.validateRoleCode}-->
|
||||
<!-- ],-->
|
||||
<!-- description: [-->
|
||||
<!-- { min: 0, max: 126, message: '长度不超过 126 个字符', trigger: 'blur' }-->
|
||||
<!-- ]-->
|
||||
<!-- },-->
|
||||
<!-- url: {-->
|
||||
<!-- add: "/sys/sysDepartRole/add",-->
|
||||
<!-- edit: "/sys/sysDepartRole/edit",-->
|
||||
<!-- },-->
|
||||
<!-- }-->
|
||||
<!-- },-->
|
||||
<!-- created () {-->
|
||||
<!-- },-->
|
||||
<!-- methods: {-->
|
||||
<!-- add (departId) {-->
|
||||
<!-- this.edit({},departId);-->
|
||||
<!-- },-->
|
||||
<!-- edit (record,departId) {-->
|
||||
<!-- this.departId = departId;-->
|
||||
<!-- this.model = Object.assign({}, record);-->
|
||||
<!-- this.visible = true;-->
|
||||
<!-- },-->
|
||||
<!-- close () {-->
|
||||
<!-- this.$emit('close');-->
|
||||
<!-- this.visible = false;-->
|
||||
<!-- this.$refs.form.resetFields()-->
|
||||
<!-- },-->
|
||||
<!-- handleOk () {-->
|
||||
<!-- const that = this;-->
|
||||
<!-- // 触发表单验证-->
|
||||
<!-- this.$refs.form.validate(valid => {-->
|
||||
<!-- if (valid) {-->
|
||||
<!-- that.confirmLoading = true;-->
|
||||
<!-- let httpurl = '';-->
|
||||
<!-- let method = '';-->
|
||||
<!-- if(!this.model.id){-->
|
||||
<!-- httpurl+=this.url.add;-->
|
||||
<!-- method = 'post';-->
|
||||
<!-- }else{-->
|
||||
<!-- httpurl+=this.url.edit;-->
|
||||
<!-- method = 'put';-->
|
||||
<!-- }-->
|
||||
<!-- this.model.departId = this.departId;-->
|
||||
<!-- httpAction(httpurl,this.model,method).then((res)=>{-->
|
||||
<!-- if(res.success){-->
|
||||
<!-- that.$message.success(res.message);-->
|
||||
<!-- that.$emit('ok');-->
|
||||
<!-- }else{-->
|
||||
<!-- that.$message.warning(res.message);-->
|
||||
<!-- }-->
|
||||
<!-- }).finally(() => {-->
|
||||
<!-- that.confirmLoading = false;-->
|
||||
<!-- that.close();-->
|
||||
<!-- })-->
|
||||
<!-- }else{-->
|
||||
<!-- return false;-->
|
||||
<!-- }-->
|
||||
<!-- })-->
|
||||
<!-- },-->
|
||||
<!-- handleCancel () {-->
|
||||
<!-- this.close()-->
|
||||
<!-- },-->
|
||||
<!-- validateRoleCode(rule, value, callback){-->
|
||||
<!-- if(/[\u4E00-\u9FA5]/g.test(value)){-->
|
||||
<!-- callback("部门角色编码不可输入汉字!");-->
|
||||
<!-- }else{-->
|
||||
<!-- var params = {-->
|
||||
<!-- tableName: "sys_depart_role",-->
|
||||
<!-- fieldName: "role_code",-->
|
||||
<!-- fieldVal: value,-->
|
||||
<!-- dataId: this.model.id,-->
|
||||
<!-- };-->
|
||||
<!-- duplicateCheck(params).then((res)=>{-->
|
||||
<!-- if(res.success){-->
|
||||
<!-- callback();-->
|
||||
<!-- }else{-->
|
||||
<!-- callback(res.message);-->
|
||||
<!-- }-->
|
||||
<!-- });-->
|
||||
<!-- }-->
|
||||
<!-- }-->
|
||||
<!-- }-->
|
||||
<!-- }-->
|
||||
<!--</script>-->
|
||||
|
||||
<style lang="less" scoped>
|
||||
<!--<style lang="less" scoped>-->
|
||||
|
||||
</style>
|
||||
<!--</style>-->
|
||||
Reference in New Issue
Block a user