|
@@ -5,151 +5,157 @@
|
|
<div style="margin-bottom: 10px">
|
|
<div style="margin-bottom: 10px">
|
|
<el-form :inline="true" label-width="80px">
|
|
<el-form :inline="true" label-width="80px">
|
|
<el-form-item>
|
|
<el-form-item>
|
|
- <el-input v-model="keyword" placeholder="请输入权限组名称"></el-input>
|
|
|
|
|
|
+ <el-input v-model="keyword" placeholder="请输入职位名称"></el-input>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-form-item>
|
|
<el-button @click="search" type="success">搜索</el-button>
|
|
<el-button @click="search" type="success">搜索</el-button>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-form-item>
|
|
- <el-button type="primary" v-if="hasPerm('auth:add')" @click="dialogVisible = true">新增权限组</el-button>
|
|
|
|
|
|
+ <el-button
|
|
|
|
+ type="primary"
|
|
|
|
+ v-if="hasPerm('auth:add')"
|
|
|
|
+ @click="dialogVisible = true"
|
|
|
|
+ >新增职位</el-button
|
|
|
|
+ >
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-form>
|
|
</el-form>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div>
|
|
- <el-table
|
|
|
|
- :data="tableData"
|
|
|
|
- border
|
|
|
|
- :height="720 + 'px'">
|
|
|
|
- <el-table-column
|
|
|
|
- prop="id"
|
|
|
|
- label="权限组id">
|
|
|
|
- </el-table-column>
|
|
|
|
- <el-table-column
|
|
|
|
- prop="groupName"
|
|
|
|
- label="权限组名称">
|
|
|
|
- </el-table-column>
|
|
|
|
- <el-table-column
|
|
|
|
- prop="remark"
|
|
|
|
- label="备注">
|
|
|
|
- </el-table-column>
|
|
|
|
|
|
+ <el-table :data="tableData" border :height="720 + 'px'">
|
|
|
|
+ <el-table-column prop="id" label="职位id"> </el-table-column>
|
|
|
|
+ <el-table-column prop="groupName" label="职位名称"> </el-table-column>
|
|
|
|
+ <el-table-column prop="remark" label="备注"> </el-table-column>
|
|
<el-table-column label="操作">
|
|
<el-table-column label="操作">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
<el-button
|
|
<el-button
|
|
- size="mini"
|
|
|
|
- type="primary"
|
|
|
|
- v-if="hasPerm('auth:edit')"
|
|
|
|
- @click="handleEdit(scope.row)">编辑</el-button>
|
|
|
|
|
|
+ size="mini"
|
|
|
|
+ type="primary"
|
|
|
|
+ v-if="hasPerm('auth:edit')"
|
|
|
|
+ @click="handleEdit(scope.row)"
|
|
|
|
+ >编辑</el-button
|
|
|
|
+ >
|
|
<el-button
|
|
<el-button
|
|
- size="mini"
|
|
|
|
- type="warning"
|
|
|
|
- v-if="hasPerm('auth:Limits')"
|
|
|
|
- @click="handleLimits(scope.row)">权限分配</el-button>
|
|
|
|
|
|
+ size="mini"
|
|
|
|
+ type="warning"
|
|
|
|
+ v-if="hasPerm('auth:Limits')"
|
|
|
|
+ @click="handleLimits(scope.row)"
|
|
|
|
+ >权限分配</el-button
|
|
|
|
+ >
|
|
<el-button
|
|
<el-button
|
|
- size="mini"
|
|
|
|
- type="danger"
|
|
|
|
- v-if="hasPerm('auth:User')"
|
|
|
|
- @click="handleUser(scope.row)">用户分配</el-button>
|
|
|
|
|
|
+ size="mini"
|
|
|
|
+ type="danger"
|
|
|
|
+ v-if="hasPerm('auth:User')"
|
|
|
|
+ @click="handleUser(scope.row)"
|
|
|
|
+ >用户分配</el-button
|
|
|
|
+ >
|
|
<el-button
|
|
<el-button
|
|
- size="mini"
|
|
|
|
- type="danger"
|
|
|
|
- v-if="hasPerm('auth:del')"
|
|
|
|
- @click="del(scope.row)">删除</el-button>
|
|
|
|
|
|
+ size="mini"
|
|
|
|
+ type="danger"
|
|
|
|
+ v-if="hasPerm('auth:del')"
|
|
|
|
+ @click="del(scope.row)"
|
|
|
|
+ >删除</el-button
|
|
|
|
+ >
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
</el-table>
|
|
</el-table>
|
|
<table-footer
|
|
<table-footer
|
|
- :totals="total"
|
|
|
|
- :size="size"
|
|
|
|
- @sizeChange="sizeChange"
|
|
|
|
- @pageChange="pageChange"></table-footer>
|
|
|
|
|
|
+ :totals="total"
|
|
|
|
+ :size="size"
|
|
|
|
+ @sizeChange="sizeChange"
|
|
|
|
+ @pageChange="pageChange"
|
|
|
|
+ ></table-footer>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- // 新增-->
|
|
<!-- // 新增-->
|
|
<el-dialog
|
|
<el-dialog
|
|
- :title="showType ? '编辑权限组' : '新增权限组'"
|
|
|
|
- :visible.sync="dialogVisible"
|
|
|
|
- width="30%">
|
|
|
|
|
|
+ :title="showType ? '编辑职位' : '新增职位'"
|
|
|
|
+ :visible.sync="dialogVisible"
|
|
|
|
+ width="30%"
|
|
|
|
+ >
|
|
<div>
|
|
<div>
|
|
<el-form ref="form" :model="form" label-width="100px">
|
|
<el-form ref="form" :model="form" label-width="100px">
|
|
- <el-form-item label="权限组名称">
|
|
|
|
|
|
+ <el-form-item label="职位名称">
|
|
<el-input v-model="form.groupName"></el-input>
|
|
<el-input v-model="form.groupName"></el-input>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="备注">
|
|
<el-form-item label="备注">
|
|
- <el-input v-model="form.remark" ></el-input>
|
|
|
|
|
|
+ <el-input v-model="form.remark"></el-input>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-form>
|
|
</el-form>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<span slot="footer" class="dialog-footer">
|
|
<span slot="footer" class="dialog-footer">
|
|
- <el-button @click="reset">取 消</el-button>
|
|
|
|
- <el-button v-if="showType" type="primary" @click="setUpdate">更 新</el-button>
|
|
|
|
- <el-button v-else type="primary" @click="onSubmit">新 增</el-button>
|
|
|
|
- </span>
|
|
|
|
|
|
+ <el-button @click="reset">取 消</el-button>
|
|
|
|
+ <el-button v-if="showType" type="primary" @click="setUpdate"
|
|
|
|
+ >更 新</el-button
|
|
|
|
+ >
|
|
|
|
+ <el-button v-else type="primary" @click="onSubmit">新 增</el-button>
|
|
|
|
+ </span>
|
|
</el-dialog>
|
|
</el-dialog>
|
|
<!-- 权限分配 -->
|
|
<!-- 权限分配 -->
|
|
<a-modal
|
|
<a-modal
|
|
- title="权限分配"
|
|
|
|
- :width="600"
|
|
|
|
- :visible="dialogLimits"
|
|
|
|
- @ok="limitSave"
|
|
|
|
- ok-text="确认"
|
|
|
|
- cancel-text="取消"
|
|
|
|
- @cancel="dialogLimits = false"
|
|
|
|
- :destroyOnClose="true">
|
|
|
|
|
|
+ title="权限分配"
|
|
|
|
+ :width="600"
|
|
|
|
+ :visible="dialogLimits"
|
|
|
|
+ @ok="limitSave"
|
|
|
|
+ ok-text="确认"
|
|
|
|
+ cancel-text="取消"
|
|
|
|
+ @cancel="dialogLimits = false"
|
|
|
|
+ :destroyOnClose="true"
|
|
|
|
+ >
|
|
<a-tree
|
|
<a-tree
|
|
- v-model="checkedKeys"
|
|
|
|
- multiple
|
|
|
|
- checkable
|
|
|
|
- :auto-expand-parent="autoExpandParent"
|
|
|
|
- :expanded-keys="expandedKeys"
|
|
|
|
- :tree-data="menuTreeData"
|
|
|
|
- :selected-keys="selectedKeys"
|
|
|
|
- :replaceFields="replaceFields"
|
|
|
|
- @expand="onExpand"
|
|
|
|
- @check="onCheck"
|
|
|
|
|
|
+ v-model="checkedKeys"
|
|
|
|
+ multiple
|
|
|
|
+ checkable
|
|
|
|
+ :auto-expand-parent="autoExpandParent"
|
|
|
|
+ :expanded-keys="expandedKeys"
|
|
|
|
+ :tree-data="menuTreeData"
|
|
|
|
+ :selected-keys="selectedKeys"
|
|
|
|
+ :replaceFields="replaceFields"
|
|
|
|
+ @expand="onExpand"
|
|
|
|
+ @check="onCheck"
|
|
/>
|
|
/>
|
|
</a-modal>
|
|
</a-modal>
|
|
- <el-dialog
|
|
|
|
- title="用户分配"
|
|
|
|
- :visible.sync="dialogUsers"
|
|
|
|
- width="50%">
|
|
|
|
|
|
+ <el-dialog title="用户分配" :visible.sync="dialogUsers" width="50%">
|
|
<div>
|
|
<div>
|
|
<el-table
|
|
<el-table
|
|
- :data="userList"
|
|
|
|
- ref="multipleTable"
|
|
|
|
- tooltip-effect="dark"
|
|
|
|
- @selection-change="handleSelectionChange">
|
|
|
|
- <el-table-column
|
|
|
|
- type="selection"
|
|
|
|
- width="55">
|
|
|
|
- </el-table-column>
|
|
|
|
- <el-table-column
|
|
|
|
- prop="id"
|
|
|
|
- label="用户ID">
|
|
|
|
- </el-table-column>
|
|
|
|
- <el-table-column
|
|
|
|
- prop="account"
|
|
|
|
- label="用户姓名">
|
|
|
|
- </el-table-column>
|
|
|
|
|
|
+ :data="userList"
|
|
|
|
+ ref="multipleTable"
|
|
|
|
+ tooltip-effect="dark"
|
|
|
|
+ @selection-change="handleSelectionChange"
|
|
|
|
+ >
|
|
|
|
+ <el-table-column type="selection" width="55"> </el-table-column>
|
|
|
|
+ <el-table-column prop="id" label="用户ID"> </el-table-column>
|
|
|
|
+ <el-table-column prop="account" label="用户姓名"> </el-table-column>
|
|
</el-table>
|
|
</el-table>
|
|
</div>
|
|
</div>
|
|
<span slot="footer" class="dialog-footer">
|
|
<span slot="footer" class="dialog-footer">
|
|
- <el-button @click="dialogUsers = false">取 消</el-button>
|
|
|
|
- <el-button type="primary" @click="userSave">保存</el-button>
|
|
|
|
- </span>
|
|
|
|
|
|
+ <el-button @click="dialogUsers = false">取 消</el-button>
|
|
|
|
+ <el-button type="primary" @click="userSave">保存</el-button>
|
|
|
|
+ </span>
|
|
</el-dialog>
|
|
</el-dialog>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
-import { Tree } from 'ant-design-vue';
|
|
|
|
|
|
+import { Tree } from "ant-design-vue";
|
|
import TableFooter from "../../components/TableFooter";
|
|
import TableFooter from "../../components/TableFooter";
|
|
-import { getUserMenu, getAuth, delAuth, addAuth, editAuth, getMenuByGroup, saveGroupMenu, getAcountByGroup, saveAccountGroup, getUserList } from '../../utils/api';
|
|
|
|
|
|
+import {
|
|
|
|
+ getUserMenu,
|
|
|
|
+ getAuth,
|
|
|
|
+ delAuth,
|
|
|
|
+ addAuth,
|
|
|
|
+ editAuth,
|
|
|
|
+ getMenuByGroup,
|
|
|
|
+ saveGroupMenu,
|
|
|
|
+ getAcountByGroup,
|
|
|
|
+ saveAccountGroup,
|
|
|
|
+ getUserList,
|
|
|
|
+} from "../../utils/api";
|
|
export default {
|
|
export default {
|
|
name: "AuthAdmin",
|
|
name: "AuthAdmin",
|
|
components: {
|
|
components: {
|
|
TableFooter,
|
|
TableFooter,
|
|
- ATree: Tree
|
|
|
|
|
|
+ ATree: Tree,
|
|
},
|
|
},
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
@@ -157,16 +163,16 @@ export default {
|
|
showType: false,
|
|
showType: false,
|
|
dialogVisible: false,
|
|
dialogVisible: false,
|
|
form: {
|
|
form: {
|
|
- id: '',
|
|
|
|
- groupName: '',
|
|
|
|
- remark: '',
|
|
|
|
|
|
+ id: "",
|
|
|
|
+ groupName: "",
|
|
|
|
+ remark: "",
|
|
},
|
|
},
|
|
dialogLimits: false,
|
|
dialogLimits: false,
|
|
// 权限分配list
|
|
// 权限分配list
|
|
limitList: [],
|
|
limitList: [],
|
|
defaultProps: {
|
|
defaultProps: {
|
|
- children: 'children',
|
|
|
|
- label: 'title'
|
|
|
|
|
|
+ children: "children",
|
|
|
|
+ label: "title",
|
|
},
|
|
},
|
|
autoExpandParent: true,
|
|
autoExpandParent: true,
|
|
// 默认选择的参数
|
|
// 默认选择的参数
|
|
@@ -174,13 +180,13 @@ export default {
|
|
expandedKeys: [],
|
|
expandedKeys: [],
|
|
checkedKeys: [],
|
|
checkedKeys: [],
|
|
replaceFields: {
|
|
replaceFields: {
|
|
- key: 'id'
|
|
|
|
|
|
+ key: "id",
|
|
},
|
|
},
|
|
- keyword: '',
|
|
|
|
|
|
+ keyword: "",
|
|
total: 0,
|
|
total: 0,
|
|
size: 20,
|
|
size: 20,
|
|
pageNum: 1,
|
|
pageNum: 1,
|
|
- selectId: '',
|
|
|
|
|
|
+ selectId: "",
|
|
// 用户列表
|
|
// 用户列表
|
|
userList: [],
|
|
userList: [],
|
|
dialogUsers: false,
|
|
dialogUsers: false,
|
|
@@ -189,7 +195,7 @@ export default {
|
|
commitKeys: [],
|
|
commitKeys: [],
|
|
selectedKeys: [],
|
|
selectedKeys: [],
|
|
menuTreeData: [],
|
|
menuTreeData: [],
|
|
- }
|
|
|
|
|
|
+ };
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
// 搜索
|
|
// 搜索
|
|
@@ -203,7 +209,7 @@ export default {
|
|
},
|
|
},
|
|
// 修改页数
|
|
// 修改页数
|
|
pageChange(val) {
|
|
pageChange(val) {
|
|
- this.pageNum= val;
|
|
|
|
|
|
+ this.pageNum = val;
|
|
this.init();
|
|
this.init();
|
|
},
|
|
},
|
|
handleEdit(data) {
|
|
handleEdit(data) {
|
|
@@ -217,29 +223,31 @@ export default {
|
|
handleUser(data) {
|
|
handleUser(data) {
|
|
this.dialogUsers = true;
|
|
this.dialogUsers = true;
|
|
this.selectId = data.id;
|
|
this.selectId = data.id;
|
|
- getAcountByGroup({groupId: data.id})
|
|
|
|
- .then(res => {
|
|
|
|
- if(res.code === 10006) {
|
|
|
|
- this.userSelect = [];
|
|
|
|
- this.$nextTick(() => {
|
|
|
|
- this.$refs.multipleTable.clearSelection();
|
|
|
|
- this.$forceUpdate();
|
|
|
|
- });
|
|
|
|
- } else {
|
|
|
|
- let arr = res.data.split(',');
|
|
|
|
- console.log(arr);
|
|
|
|
- this.$nextTick(() => {
|
|
|
|
- this.$refs.multipleTable.clearSelection();
|
|
|
|
- for (let key in this.userList) {
|
|
|
|
- for(let i in arr) {
|
|
|
|
- if(this.userList[key]['id'] == arr[i]) {
|
|
|
|
- this.$refs.multipleTable.toggleRowSelection(this.userList[key], true);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ getAcountByGroup({ groupId: data.id }).then((res) => {
|
|
|
|
+ if (res.code === 10006) {
|
|
|
|
+ this.userSelect = [];
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
+ this.$refs.multipleTable.clearSelection();
|
|
|
|
+ this.$forceUpdate();
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ let arr = res.data.split(",");
|
|
|
|
+ console.log(arr);
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
+ this.$refs.multipleTable.clearSelection();
|
|
|
|
+ for (let key in this.userList) {
|
|
|
|
+ for (let i in arr) {
|
|
|
|
+ if (this.userList[key]["id"] == arr[i]) {
|
|
|
|
+ this.$refs.multipleTable.toggleRowSelection(
|
|
|
|
+ this.userList[key],
|
|
|
|
+ true
|
|
|
|
+ );
|
|
}
|
|
}
|
|
- })
|
|
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- })
|
|
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ });
|
|
},
|
|
},
|
|
// 用户分配选择
|
|
// 用户分配选择
|
|
handleSelectionChange(val) {
|
|
handleSelectionChange(val) {
|
|
@@ -248,39 +256,39 @@ export default {
|
|
// 用户分配保存
|
|
// 用户分配保存
|
|
userSave() {
|
|
userSave() {
|
|
let users = [];
|
|
let users = [];
|
|
- this.userSelect.forEach(item => {
|
|
|
|
|
|
+ this.userSelect.forEach((item) => {
|
|
users.push(item.id);
|
|
users.push(item.id);
|
|
});
|
|
});
|
|
- let str = users.join(',');
|
|
|
|
- saveAccountGroup({accountId: str, groupIds: this.selectId})
|
|
|
|
- .then(res => {
|
|
|
|
- if(res.code === 10001) {
|
|
|
|
- this.$message.success(res.message);
|
|
|
|
- } else {
|
|
|
|
- this.userSelect = [];
|
|
|
|
- this.selectId = '';
|
|
|
|
- this.$message(res.message);
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
|
|
+ let str = users.join(",");
|
|
|
|
+ saveAccountGroup({ accountId: str, groupIds: this.selectId }).then(
|
|
|
|
+ (res) => {
|
|
|
|
+ if (res.code === 10001) {
|
|
|
|
+ this.$message.success(res.message);
|
|
|
|
+ } else {
|
|
|
|
+ this.userSelect = [];
|
|
|
|
+ this.selectId = "";
|
|
|
|
+ this.$message(res.message);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ );
|
|
this.dialogUsers = false;
|
|
this.dialogUsers = false;
|
|
},
|
|
},
|
|
// 新增角色
|
|
// 新增角色
|
|
onSubmit() {
|
|
onSubmit() {
|
|
let params = {
|
|
let params = {
|
|
groupName: this.form.groupName,
|
|
groupName: this.form.groupName,
|
|
- remark: this.form.remark
|
|
|
|
|
|
+ remark: this.form.remark,
|
|
};
|
|
};
|
|
- addAuth(params)
|
|
|
|
- .then(res => {
|
|
|
|
- if(res.code === 10000) {
|
|
|
|
- this.init();
|
|
|
|
- this.$message.success(res.message);
|
|
|
|
- } else {
|
|
|
|
- this.$message.error(res.message);
|
|
|
|
- }
|
|
|
|
- this.dialogVisible = false;
|
|
|
|
- this.reset();
|
|
|
|
- })
|
|
|
|
|
|
+ addAuth(params).then((res) => {
|
|
|
|
+ if (res.code === 10000) {
|
|
|
|
+ this.init();
|
|
|
|
+ this.$message.success(res.message);
|
|
|
|
+ } else {
|
|
|
|
+ this.$message.error(res.message);
|
|
|
|
+ }
|
|
|
|
+ this.dialogVisible = false;
|
|
|
|
+ this.reset();
|
|
|
|
+ });
|
|
},
|
|
},
|
|
// handleCheckChange() {
|
|
// handleCheckChange() {
|
|
// // console.log(data, ls, lg)
|
|
// // console.log(data, ls, lg)
|
|
@@ -289,85 +297,84 @@ export default {
|
|
// this.selectList = this.$refs.tree.getCheckedKeys().concat(this.$refs.tree.getHalfCheckedKeys());
|
|
// this.selectList = this.$refs.tree.getCheckedKeys().concat(this.$refs.tree.getHalfCheckedKeys());
|
|
// },
|
|
// },
|
|
onExpand(expandedKeys) {
|
|
onExpand(expandedKeys) {
|
|
- this.expandedKeys = expandedKeys
|
|
|
|
- this.autoExpandParent = false
|
|
|
|
|
|
+ this.expandedKeys = expandedKeys;
|
|
|
|
+ this.autoExpandParent = false;
|
|
},
|
|
},
|
|
|
|
|
|
onCheck(checkedKeys, info) {
|
|
onCheck(checkedKeys, info) {
|
|
this.checkedKeys = checkedKeys;
|
|
this.checkedKeys = checkedKeys;
|
|
- this.commitKeys = checkedKeys.concat(info.halfCheckedKeys)
|
|
|
|
|
|
+ this.commitKeys = checkedKeys.concat(info.halfCheckedKeys);
|
|
},
|
|
},
|
|
pickCheckedKeys(data) {
|
|
pickCheckedKeys(data) {
|
|
for (let i = 0; i < data.length; i++) {
|
|
for (let i = 0; i < data.length; i++) {
|
|
if (this.leastChilds.includes(data[i])) {
|
|
if (this.leastChilds.includes(data[i])) {
|
|
- this.checkedKeys.push(data[i])
|
|
|
|
|
|
+ this.checkedKeys.push(data[i]);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
},
|
|
onSelect(selectedKeys) {
|
|
onSelect(selectedKeys) {
|
|
- this.selectedKeys = selectedKeys
|
|
|
|
|
|
+ this.selectedKeys = selectedKeys;
|
|
},
|
|
},
|
|
// 权限分配
|
|
// 权限分配
|
|
handleLimits(data) {
|
|
handleLimits(data) {
|
|
this.dialogLimits = true;
|
|
this.dialogLimits = true;
|
|
this.selectId = data.id;
|
|
this.selectId = data.id;
|
|
this.defaultList = [];
|
|
this.defaultList = [];
|
|
- getMenuByGroup({groupId: data.id})
|
|
|
|
- .then(res => {
|
|
|
|
- let arr;
|
|
|
|
- if(res.code === 10000) {
|
|
|
|
- arr = res.data.split(',');
|
|
|
|
- this.defaultList = arr.map(Number);
|
|
|
|
- this.pickCheckedKeys(this.defaultList);
|
|
|
|
- this.selectList = this.defaultList;
|
|
|
|
- } else {
|
|
|
|
- arr = [];
|
|
|
|
- this.defaultList = [];
|
|
|
|
- this.selectList = [];
|
|
|
|
- this.selectedKeys = [];
|
|
|
|
- this.checkedKeys = [];
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
|
|
+ getMenuByGroup({ groupId: data.id }).then((res) => {
|
|
|
|
+ let arr;
|
|
|
|
+ if (res.code === 10000) {
|
|
|
|
+ arr = res.data.split(",");
|
|
|
|
+ this.defaultList = arr.map(Number);
|
|
|
|
+ this.pickCheckedKeys(this.defaultList);
|
|
|
|
+ this.selectList = this.defaultList;
|
|
|
|
+ } else {
|
|
|
|
+ arr = [];
|
|
|
|
+ this.defaultList = [];
|
|
|
|
+ this.selectList = [];
|
|
|
|
+ this.selectedKeys = [];
|
|
|
|
+ this.checkedKeys = [];
|
|
|
|
+ }
|
|
|
|
+ });
|
|
},
|
|
},
|
|
// 权限分配保存
|
|
// 权限分配保存
|
|
limitSave() {
|
|
limitSave() {
|
|
// this.selectList = this.$refs.tree.getCheckedKeys();
|
|
// this.selectList = this.$refs.tree.getCheckedKeys();
|
|
let menuIds;
|
|
let menuIds;
|
|
- if(this.commitKeys.length > 0) {
|
|
|
|
- menuIds = this.commitKeys.join(',');
|
|
|
|
|
|
+ if (this.commitKeys.length > 0) {
|
|
|
|
+ menuIds = this.commitKeys.join(",");
|
|
} else {
|
|
} else {
|
|
- menuIds = '';
|
|
|
|
|
|
+ menuIds = "";
|
|
}
|
|
}
|
|
- saveGroupMenu( {groupId: this.selectId, menuIds: menuIds})
|
|
|
|
- .then(res => {
|
|
|
|
- if(res.code === 10001) {
|
|
|
|
- this.$message.success(res.message);
|
|
|
|
- }
|
|
|
|
- this.selectId = '';
|
|
|
|
- this.dialogLimits = false;
|
|
|
|
- this.selectList = [];
|
|
|
|
- });
|
|
|
|
|
|
+ saveGroupMenu({ groupId: this.selectId, menuIds: menuIds }).then(
|
|
|
|
+ (res) => {
|
|
|
|
+ if (res.code === 10001) {
|
|
|
|
+ this.$message.success(res.message);
|
|
|
|
+ }
|
|
|
|
+ this.selectId = "";
|
|
|
|
+ this.dialogLimits = false;
|
|
|
|
+ this.selectList = [];
|
|
|
|
+ }
|
|
|
|
+ );
|
|
},
|
|
},
|
|
init() {
|
|
init() {
|
|
// 后端分页
|
|
// 后端分页
|
|
let params = {
|
|
let params = {
|
|
pageNum: this.pageNum,
|
|
pageNum: this.pageNum,
|
|
pageSize: this.size,
|
|
pageSize: this.size,
|
|
- searchStr: this.keyword
|
|
|
|
|
|
+ searchStr: this.keyword,
|
|
};
|
|
};
|
|
- getAuth(params)
|
|
|
|
- .then(res => {
|
|
|
|
- this.tableData = res.records;
|
|
|
|
- this.total = res.total;
|
|
|
|
- })
|
|
|
|
|
|
+ getAuth(params).then((res) => {
|
|
|
|
+ this.tableData = res.records;
|
|
|
|
+ this.total = res.total;
|
|
|
|
+ });
|
|
},
|
|
},
|
|
// 重置
|
|
// 重置
|
|
- reset(){
|
|
|
|
- this.form.id = '';
|
|
|
|
- this.form.groupName = '';
|
|
|
|
- this.form.remark = '';
|
|
|
|
|
|
+ reset() {
|
|
|
|
+ this.form.id = "";
|
|
|
|
+ this.form.groupName = "";
|
|
|
|
+ this.form.remark = "";
|
|
this.pageNum = 1;
|
|
this.pageNum = 1;
|
|
- this.keyword = '';
|
|
|
|
|
|
+ this.keyword = "";
|
|
this.showType = false;
|
|
this.showType = false;
|
|
this.dialogVisible = false;
|
|
this.dialogVisible = false;
|
|
},
|
|
},
|
|
@@ -376,88 +383,87 @@ export default {
|
|
let params = {
|
|
let params = {
|
|
groupName: this.form.groupName,
|
|
groupName: this.form.groupName,
|
|
remark: this.form.remark,
|
|
remark: this.form.remark,
|
|
- id: this.form.id
|
|
|
|
|
|
+ id: this.form.id,
|
|
};
|
|
};
|
|
- editAuth(params)
|
|
|
|
- .then(res => {
|
|
|
|
- if(res.code === 10000) {
|
|
|
|
|
|
+ editAuth(params).then((res) => {
|
|
|
|
+ if (res.code === 10000) {
|
|
|
|
+ this.init();
|
|
|
|
+ this.$message.success(res.message);
|
|
|
|
+ }
|
|
|
|
+ this.dialogVisible = false;
|
|
|
|
+ this.reset();
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ // 删除
|
|
|
|
+ del(data) {
|
|
|
|
+ this.$confirm("此操作将永久删除批量删除, 是否继续?", "提示", {
|
|
|
|
+ confirmButtonText: "确定",
|
|
|
|
+ cancelButtonText: "取消",
|
|
|
|
+ type: "warning",
|
|
|
|
+ })
|
|
|
|
+ .then(() => {
|
|
|
|
+ delAuth({ groupId: data.id }).then((res) => {
|
|
|
|
+ if (res.code === 10000) {
|
|
this.init();
|
|
this.init();
|
|
this.$message.success(res.message);
|
|
this.$message.success(res.message);
|
|
}
|
|
}
|
|
- this.dialogVisible = false;
|
|
|
|
- this.reset();
|
|
|
|
});
|
|
});
|
|
- },
|
|
|
|
- // 删除
|
|
|
|
- del(data) {
|
|
|
|
- this.$confirm('此操作将永久删除批量删除, 是否继续?', '提示', {
|
|
|
|
- confirmButtonText: '确定',
|
|
|
|
- cancelButtonText: '取消',
|
|
|
|
- type: 'warning'
|
|
|
|
- }).then(() => {
|
|
|
|
- delAuth({groupId: data.id})
|
|
|
|
- .then(res => {
|
|
|
|
- if(res.code === 10000) {
|
|
|
|
- this.init();
|
|
|
|
- this.$message.success(res.message);
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- }).catch(() => {
|
|
|
|
- this.$message({
|
|
|
|
- type: 'info',
|
|
|
|
- message: '已取消删除'
|
|
|
|
|
|
+ })
|
|
|
|
+ .catch(() => {
|
|
|
|
+ this.$message({
|
|
|
|
+ type: "info",
|
|
|
|
+ message: "已取消删除",
|
|
|
|
+ });
|
|
});
|
|
});
|
|
- });
|
|
|
|
},
|
|
},
|
|
// 菜单列表
|
|
// 菜单列表
|
|
authInit() {
|
|
authInit() {
|
|
let params = {
|
|
let params = {
|
|
- userId: localStorage.getItem('UserId')
|
|
|
|
- }
|
|
|
|
- getUserMenu(params).then(res => {
|
|
|
|
- if(res.code === 10000) {
|
|
|
|
- this.menuTreeData = res.data;
|
|
|
|
- this.getLeastChilds(res.data)
|
|
|
|
- this.menuTreeData.forEach(item => {
|
|
|
|
- this.expandedKeys.push(item.id)
|
|
|
|
- })
|
|
|
|
- // this.expandedMenuKeys(this.roleEntity)
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
|
|
+ userId: localStorage.getItem("UserId"),
|
|
|
|
+ };
|
|
|
|
+ getUserMenu(params).then((res) => {
|
|
|
|
+ if (res.code === 10000) {
|
|
|
|
+ this.menuTreeData = res.data;
|
|
|
|
+ this.getLeastChilds(res.data);
|
|
|
|
+ this.menuTreeData.forEach((item) => {
|
|
|
|
+ this.expandedKeys.push(item.id);
|
|
|
|
+ });
|
|
|
|
+ // this.expandedMenuKeys(this.roleEntity)
|
|
|
|
+ }
|
|
|
|
+ });
|
|
},
|
|
},
|
|
getLeastChilds(data) {
|
|
getLeastChilds(data) {
|
|
for (let i = 0; i < data.length; i++) {
|
|
for (let i = 0; i < data.length; i++) {
|
|
- this.pushLeastChilds(data[i])
|
|
|
|
|
|
+ this.pushLeastChilds(data[i]);
|
|
}
|
|
}
|
|
},
|
|
},
|
|
pushLeastChilds(e) {
|
|
pushLeastChilds(e) {
|
|
if (e.children.length > 0) {
|
|
if (e.children.length > 0) {
|
|
- this.getLeastChilds(e.children)
|
|
|
|
- return
|
|
|
|
|
|
+ this.getLeastChilds(e.children);
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
- this.leastChilds.push(e.id)
|
|
|
|
|
|
+ this.leastChilds.push(e.id);
|
|
},
|
|
},
|
|
// 用户列表
|
|
// 用户列表
|
|
userInit() {
|
|
userInit() {
|
|
let params = {
|
|
let params = {
|
|
pageNum: 1,
|
|
pageNum: 1,
|
|
pageSize: 200,
|
|
pageSize: 200,
|
|
- searchStr: ''
|
|
|
|
|
|
+ searchStr: "",
|
|
};
|
|
};
|
|
- getUserList(params)
|
|
|
|
- .then(res => {
|
|
|
|
- if(res.code === 10000) {
|
|
|
|
- this.userList = res.data.records;
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
|
|
+ getUserList(params).then((res) => {
|
|
|
|
+ if (res.code === 10000) {
|
|
|
|
+ this.userList = res.data.records;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
},
|
|
},
|
|
mounted() {
|
|
mounted() {
|
|
this.init();
|
|
this.init();
|
|
this.authInit();
|
|
this.authInit();
|
|
this.userInit();
|
|
this.userInit();
|
|
- }
|
|
|
|
-}
|
|
|
|
|
|
+ },
|
|
|
|
+};
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style scoped>
|
|
<style scoped>
|