| | |
| | | :check-strictly="true" |
| | | node-key="id" |
| | | @check="treeCheck" |
| | | :default-expanded-keys="[1]" |
| | | ref="treeForm" |
| | | > |
| | | </el-tree> |
| | |
| | | margin-left: 10px; |
| | | " |
| | | > |
| | | {{ $t("operatManage.UserRoleAuthorizationObj.RoleTable") }} |
| | | {{ $t('operatManage.UserRoleAuthorizationObj.RoleTable') }} |
| | | </div> |
| | | <el-divider /> |
| | | <el-table |
| | |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="id" |
| | | :label="$t('operatManage.UserRoleAuthorizationObj.serialNumber')" |
| | | > |
| | | </el-table-column> |
| | | align="center" |
| | | type="index" |
| | | :label="$t('dataManage.styleObj.index')" |
| | | width="70px" |
| | | /> |
| | | <el-table-column |
| | | prop="name" |
| | | :label="$t('operatManage.UserRoleAuthorizationObj.name')" |
| | |
| | | " |
| | | > |
| | | <span> |
| | | {{ $t("operatManage.UserRoleAuthorizationObj.userTable") }}</span |
| | | {{ $t('operatManage.UserRoleAuthorizationObj.userTable') }}</span |
| | | > |
| | | <div class="btn" style="margin-left: auto"> |
| | | <el-button |
| | | v-if="menuStatus.insert" |
| | | type="primary" |
| | | icon="el-icon-circle-plus-outline" |
| | | size="small" |
| | | :disabled="roleid == null ? true : false" |
| | | @click="adduser" |
| | | >{{ $t("operatManage.UserRoleAuthorizationObj.Added") }}</el-button |
| | | >{{ $t('operatManage.UserRoleAuthorizationObj.Added') }}</el-button |
| | | > |
| | | <el-button |
| | | v-if="menuStatus.delete" |
| | | type="danger" |
| | | icon="el-icon-delete" |
| | | size="small" |
| | | @click="deletesUser" |
| | | :disabled="roleid == null ? true : false" |
| | | >{{ $t("operatManage.UserRoleAuthorizationObj.delete") }}</el-button |
| | | >{{ $t('operatManage.UserRoleAuthorizationObj.delete') }}</el-button |
| | | > |
| | | </div> |
| | | </div> |
| | |
| | | > |
| | | <el-table-column type="selection" width="55"> </el-table-column> |
| | | <el-table-column |
| | | prop="id" |
| | | :label="$t('operatManage.UserRoleAuthorizationObj.serialNumber')" |
| | | > |
| | | </el-table-column> |
| | | align="center" |
| | | type="index" |
| | | :label="$t('dataManage.styleObj.index')" |
| | | /> |
| | | <el-table-column |
| | | prop="uname" |
| | | :label="$t('operatManage.UserRoleAuthorizationObj.name')" |
| | |
| | | > |
| | | <el-table |
| | | :data="gridData" |
| | | height="85%" |
| | | height="40vh" |
| | | @selection-change="addhandleSelectionChange" |
| | | > |
| | | <el-table-column type="selection" width="55"> </el-table-column> |
| | | <el-table-column |
| | | prop="id" |
| | | :label="$t('operatManage.UserRoleAuthorizationObj.serialNumber')" |
| | | > |
| | | </el-table-column> |
| | | align="center" |
| | | type="index" |
| | | :label="$t('dataManage.styleObj.index')" |
| | | /> |
| | | <el-table-column |
| | | prop="uname" |
| | | :label="$t('operatManage.UserRoleAuthorizationObj.name')" |
| | |
| | | </el-pagination> |
| | | </div> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button @click="dialogTableVisible = false">{{ $t("dataManage.dictionaryManageObj.cancel") }}</el-button> |
| | | <el-button type="primary" @click="addConfirm">{{ $t("dataManage.dictionaryManageObj.confirm") }}</el-button> |
| | | <el-button @click="dialogTableVisible = false">{{ |
| | | $t('dataManage.dictionaryManageObj.cancel') |
| | | }}</el-button> |
| | | <el-button type="primary" @click="addConfirm">{{ |
| | | $t('dataManage.dictionaryManageObj.confirm') |
| | | }}</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import MyBread from "../../components/MyBread.vue"; |
| | | import MyBread from '../../components/MyBread.vue'; |
| | | import { |
| | | queryDepTree, |
| | | select_Role_ByPageAndCount, |
| | |
| | | roleUserdeletes, |
| | | userselectByPageForRole, |
| | | roleUserinserts, |
| | | } from "../../api/api"; |
| | | } from '../../api/api'; |
| | | export default { |
| | | //import引入的组件需要注入到对象中才能使用 |
| | | components: { |
| | |
| | | usercount: 0, |
| | | tableData: [], |
| | | // 当前选择的行的id |
| | | templateSelection: "", |
| | | templateSelection: '', |
| | | // 当前选择的行的数据 |
| | | checkList: [], |
| | | |
| | | defaultProps: { |
| | | children: "children", |
| | | label: "name", |
| | | children: 'children', |
| | | label: 'name', |
| | | }, |
| | | oriData: [], //原始树数据 |
| | | depList: [], //el树数据 |
| | | backUpData: {}, |
| | | formLabelWidth: "170px", |
| | | formLabelWidth: '170px', |
| | | listData: { |
| | | pageIndex: 1, |
| | | pageSize: 10, |
| | |
| | | debid: null, |
| | | roleid: null, |
| | | addmultipleSelection: [], |
| | | menuStatus: { |
| | | delete: false, |
| | | insert: false, |
| | | update: false, |
| | | }, |
| | | }; |
| | | }, |
| | | methods: { |
| | | addConfirm() { |
| | | this.$confirm("确定是否新增", "提示", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | this.$confirm('确定是否新增', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | }) |
| | | .then(async () => { |
| | | let arr = []; |
| | |
| | | }); |
| | | const data = await roleUserinserts(arr); |
| | | if (data.code !== 200) { |
| | | return this.$message.error("新增失败"); |
| | | return this.$message.error('新增失败'); |
| | | } |
| | | this.$message({ |
| | | type: "success", |
| | | message: "新增成功!", |
| | | type: 'success', |
| | | message: '新增成功!', |
| | | }); |
| | | this.dialogTableVisible = false; |
| | | this.getuserList(); |
| | | }) |
| | | .catch(() => {}); |
| | | }, |
| | |
| | | }); |
| | | const data = await roleUserdeletes({ ids: arr.toString() }); |
| | | if (data.code !== 200) { |
| | | return this.$message.error("删除失败"); |
| | | return this.$message.error('删除失败'); |
| | | } |
| | | this.$message({ |
| | | message: "删除成功", |
| | | type: "success", |
| | | message: '删除成功', |
| | | type: 'success', |
| | | }); |
| | | this.getuserList(); |
| | | }, |
| | |
| | | const data = await queryDepTree(); |
| | | |
| | | if (data.code !== 200) { |
| | | return this.$message.error("请求单位报错"); |
| | | return this.$message.error('请求单位报错'); |
| | | } |
| | | this.depList = this.treeData(data.result); |
| | | }, |
| | |
| | | return cloneData.filter((father) => { |
| | | // 循环所有项 |
| | | let branchArr = cloneData.filter((child) => father.id == child.pid); // 对比ID,分别上下级菜单,并返回数据 |
| | | branchArr.length > 0 ? (father.children = branchArr) : ""; // 给父级添加一个children属性,并赋值 |
| | | branchArr.length > 0 ? (father.children = branchArr) : ''; // 给父级添加一个children属性,并赋值 |
| | | return father.pid == 0; // 返回一级菜单 |
| | | }); |
| | | }, |
| | |
| | | treeCheck(node, list) { |
| | | //node 该节点所对应的对象、list 树目前的选中状态对象 |
| | | //选中事件在选中后执行,当lis中有两个选中时,使用setCheckedKeys方法,选中一个节点 |
| | | console.log(node, list); |
| | | |
| | | if (list.checkedNodes.length > 0) { |
| | | this.listData.depid = node.id; |
| | | this.debid = node.id; |
| | |
| | | this.addlistData.debid = this.debid; |
| | | const data = await userselectByPageForRole(this.addlistData); |
| | | if (data.code !== 200) { |
| | | return this.$message.error("新增用户列表请求错误"); |
| | | return this.$message.error('新增用户列表请求错误'); |
| | | } |
| | | this.gridData = data.result; |
| | | this.addcount = data.count; |
| | |
| | | async getuserList() { |
| | | const data = await roleUserselectByPageForRole(this.userlistData); |
| | | if (data.code !== 200) { |
| | | return this.$message.error("用户列表请求错误"); |
| | | return this.$message.error('用户列表请求错误'); |
| | | } |
| | | this.usertableData = data.result; |
| | | this.usercount = data.count; |
| | |
| | | async getRole() { |
| | | const data = await select_Role_ByPageAndCount(this.listData); |
| | | if (data.code !== 200) { |
| | | return this.$message.error("用户角色请求错误"); |
| | | return this.$message.error('用户角色请求错误'); |
| | | } |
| | | this.tableData = data.result; |
| | | this.count = data.count; |
| | | }, |
| | | showPermsMenu(res) { |
| | | switch (res.tag) { |
| | | case '/delete': |
| | | this.menuStatus.delete = true; |
| | | break; |
| | | case '/insert': |
| | | this.menuStatus.insert = true; |
| | | break; |
| | | case '/update': |
| | | this.menuStatus.update = true; |
| | | break; |
| | | } |
| | | }, |
| | | }, |
| | | created() { |
| | | var val = this.$store.state.currentPerms; |
| | | var permsEntity = this.$store.state.permsEntity; |
| | | for (var i = 0; i < permsEntity.length; i++) { |
| | | if (permsEntity[i].perms == val) { |
| | | this.showPermsMenu(permsEntity[i]); |
| | | } |
| | | } |
| | | this.getMenuTree(); |
| | | }, |
| | | }; |