|
|
@@ -96,12 +96,7 @@
|
|
|
v-if="$hasPermission('sys:role:delete')"
|
|
|
>
|
|
|
<template v-slot:reference>
|
|
|
- <el-link
|
|
|
- type="danger"
|
|
|
-
|
|
|
- :underline="false"
|
|
|
- icon="el-icon-delete"
|
|
|
- >
|
|
|
+ <el-link type="danger" :underline="false" icon="el-icon-delete">
|
|
|
删除
|
|
|
</el-link>
|
|
|
</template>
|
|
|
@@ -124,225 +119,226 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import tabMixins from '@/mixins/tableColumnsMixin';
|
|
|
-import RoleSearch from './components/role-search.vue';
|
|
|
-import RoleEdit from './components/role-edit.vue';
|
|
|
-import RoleAuth from './components/role-auth.vue';
|
|
|
-import roleDataAuth from './components/role-data-auth.vue';
|
|
|
-import {
|
|
|
- pageRoles,
|
|
|
- removeRole,
|
|
|
- removeRoles,
|
|
|
- putRoles,
|
|
|
- copyRole
|
|
|
-} from '@/api/system/role';
|
|
|
-import { secretLevelList } from '@/enum/dict';
|
|
|
+ import tabMixins from '@/mixins/tableColumnsMixin';
|
|
|
+ import RoleSearch from './components/role-search.vue';
|
|
|
+ import RoleEdit from './components/role-edit.vue';
|
|
|
+ import RoleAuth from './components/role-auth.vue';
|
|
|
+ import roleDataAuth from './components/role-data-auth.vue';
|
|
|
+ import {
|
|
|
+ pageRoles,
|
|
|
+ removeRole,
|
|
|
+ removeRoles,
|
|
|
+ putRoles,
|
|
|
+ copyRole
|
|
|
+ } from '@/api/system/role';
|
|
|
+ import { secretLevelList } from '@/enum/dict';
|
|
|
|
|
|
-export default {
|
|
|
- name: 'SystemRole',
|
|
|
- mixins: [tabMixins],
|
|
|
- components: {
|
|
|
- RoleSearch,
|
|
|
- RoleEdit,
|
|
|
- RoleAuth,
|
|
|
- roleDataAuth
|
|
|
- },
|
|
|
- data() {
|
|
|
- return {
|
|
|
- // 表格列配置
|
|
|
- columns: [
|
|
|
- {
|
|
|
- columnKey: 'selection',
|
|
|
- type: 'selection',
|
|
|
- width: 45,
|
|
|
- align: 'center',
|
|
|
- fixed: 'left'
|
|
|
- },
|
|
|
- {
|
|
|
- columnKey: 'index',
|
|
|
- label: '序号',
|
|
|
- type: 'index',
|
|
|
- width: 55,
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
- fixed: 'left'
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'name',
|
|
|
- label: '角色名称',
|
|
|
- align: 'center',
|
|
|
+ export default {
|
|
|
+ name: 'SystemRole',
|
|
|
+ mixins: [tabMixins],
|
|
|
+ components: {
|
|
|
+ RoleSearch,
|
|
|
+ RoleEdit,
|
|
|
+ RoleAuth,
|
|
|
+ roleDataAuth
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ // 表格列配置
|
|
|
+ columns: [
|
|
|
+ {
|
|
|
+ columnKey: 'selection',
|
|
|
+ type: 'selection',
|
|
|
+ width: 45,
|
|
|
+ align: 'center',
|
|
|
+ fixed: 'left'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ columnKey: 'index',
|
|
|
+ label: '序号',
|
|
|
+ type: 'index',
|
|
|
+ width: 55,
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ fixed: 'left'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 120,
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ prop: 'code',
|
|
|
+ label: '编码'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'name',
|
|
|
+ label: '角色名称',
|
|
|
+ align: 'center',
|
|
|
+
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 110
|
|
|
+ },
|
|
|
|
|
|
- showOverflowTooltip: true,
|
|
|
- minWidth: 110
|
|
|
- },
|
|
|
- // {
|
|
|
- // prop: 'groupName',
|
|
|
- // label: '组织名称',
|
|
|
- // align: 'center',
|
|
|
- // showOverflowTooltip: true,
|
|
|
- // minWidth: 110
|
|
|
- // },
|
|
|
- {
|
|
|
- prop: 'secretLevel',
|
|
|
- label: '密级',
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
- slot: 'secretLevel',
|
|
|
- minWidth: 110
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'enable',
|
|
|
- label: '启用状态',
|
|
|
- align: 'center',
|
|
|
+ {
|
|
|
+ prop: 'secretLevel',
|
|
|
+ label: '密级',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ slot: 'secretLevel',
|
|
|
+ minWidth: 110
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'enable',
|
|
|
+ label: '启用状态',
|
|
|
+ align: 'center',
|
|
|
|
|
|
- showOverflowTooltip: true,
|
|
|
- slot: 'enable',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ slot: 'enable',
|
|
|
|
|
|
- minWidth: 110
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'createTime',
|
|
|
- label: '创建时间',
|
|
|
- align: 'center',
|
|
|
+ minWidth: 110
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'createTime',
|
|
|
+ label: '创建时间',
|
|
|
+ align: 'center',
|
|
|
|
|
|
- showOverflowTooltip: true,
|
|
|
- minWidth: 110,
|
|
|
- formatter: (_row, _column, cellValue) => {
|
|
|
- return this.$util.toDateString(cellValue);
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 110,
|
|
|
+ formatter: (_row, _column, cellValue) => {
|
|
|
+ return this.$util.toDateString(cellValue);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ columnKey: 'action',
|
|
|
+ label: '操作',
|
|
|
+ width: 380,
|
|
|
+ align: 'center',
|
|
|
+ resizable: false,
|
|
|
+ slot: 'action',
|
|
|
+ showOverflowTooltip: true
|
|
|
}
|
|
|
- },
|
|
|
- {
|
|
|
- columnKey: 'action',
|
|
|
- label: '操作',
|
|
|
- width: 380,
|
|
|
- align: 'center',
|
|
|
- resizable: false,
|
|
|
- slot: 'action',
|
|
|
- showOverflowTooltip: true
|
|
|
- }
|
|
|
- ],
|
|
|
- // 表格选中数据
|
|
|
- selection: [],
|
|
|
- // 当前编辑数据
|
|
|
- current: null,
|
|
|
- // 是否显示编辑弹窗
|
|
|
- showEdit: false,
|
|
|
- // 是否显示导入弹窗
|
|
|
- showAuth: false,
|
|
|
- isUpdate: false,
|
|
|
- roleDataAuthDialogFlag: false,
|
|
|
- pageSize: this.$store.state.tablePageSize,
|
|
|
- cacheKeyUrl: '477af4f1-system-role'
|
|
|
- };
|
|
|
- },
|
|
|
- created() {},
|
|
|
- methods: {
|
|
|
- /* 表格数据源 */
|
|
|
- datasource({ page, limit, where, order }) {
|
|
|
- return pageRoles({ pageNum: page, size: limit, ...where });
|
|
|
- },
|
|
|
- async changeEnable(row) {
|
|
|
- const res = await putRoles(row);
|
|
|
- if (res.code == 0) {
|
|
|
- this.$message({
|
|
|
- type: 'success',
|
|
|
- message: '修改成功',
|
|
|
- customClass: 'ele-message-border'
|
|
|
- });
|
|
|
- this.reload();
|
|
|
- }
|
|
|
- },
|
|
|
- /* 刷新表格 */
|
|
|
- reload(where) {
|
|
|
- this.$refs.table.reload({ page: 1, where });
|
|
|
+ ],
|
|
|
+ // 表格选中数据
|
|
|
+ selection: [],
|
|
|
+ // 当前编辑数据
|
|
|
+ current: null,
|
|
|
+ // 是否显示编辑弹窗
|
|
|
+ showEdit: false,
|
|
|
+ // 是否显示导入弹窗
|
|
|
+ showAuth: false,
|
|
|
+ isUpdate: false,
|
|
|
+ roleDataAuthDialogFlag: false,
|
|
|
+ pageSize: this.$store.state.tablePageSize,
|
|
|
+ cacheKeyUrl: '477af4f1-system-role'
|
|
|
+ };
|
|
|
},
|
|
|
- getSecretLevel(i) {
|
|
|
- let find = secretLevelList.find((item) => item.value == i) || {};
|
|
|
- return find.label;
|
|
|
- },
|
|
|
- /* 显示编辑 */
|
|
|
- openEdit(row) {
|
|
|
- if (row) {
|
|
|
- this.current = Object.assign({}, row);
|
|
|
- } else {
|
|
|
- this.current = null;
|
|
|
- }
|
|
|
- this.showEdit = true;
|
|
|
- },
|
|
|
- /* 显示分配权限 */
|
|
|
- openAuth(row) {
|
|
|
- if (row) {
|
|
|
- this.isUpdate = true;
|
|
|
- this.current = Object.assign({}, row);
|
|
|
- } else {
|
|
|
- this.isUpdate = false;
|
|
|
- }
|
|
|
+ created() {},
|
|
|
+ methods: {
|
|
|
+ /* 表格数据源 */
|
|
|
+ datasource({ page, limit, where, order }) {
|
|
|
+ return pageRoles({ pageNum: page, size: limit, ...where });
|
|
|
+ },
|
|
|
+ async changeEnable(row) {
|
|
|
+ const res = await putRoles(row);
|
|
|
+ if (res.code == 0) {
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: '修改成功',
|
|
|
+ customClass: 'ele-message-border'
|
|
|
+ });
|
|
|
+ this.reload();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /* 刷新表格 */
|
|
|
+ reload(where) {
|
|
|
+ this.$refs.table.reload({ page: 1, where });
|
|
|
+ },
|
|
|
+ getSecretLevel(i) {
|
|
|
+ let find = secretLevelList.find((item) => item.value == i) || {};
|
|
|
+ return find.label;
|
|
|
+ },
|
|
|
+ /* 显示编辑 */
|
|
|
+ openEdit(row) {
|
|
|
+ if (row) {
|
|
|
+ this.current = Object.assign({}, row);
|
|
|
+ } else {
|
|
|
+ this.current = null;
|
|
|
+ }
|
|
|
+ this.showEdit = true;
|
|
|
+ },
|
|
|
+ /* 显示分配权限 */
|
|
|
+ openAuth(row) {
|
|
|
+ if (row) {
|
|
|
+ this.isUpdate = true;
|
|
|
+ this.current = Object.assign({}, row);
|
|
|
+ } else {
|
|
|
+ this.isUpdate = false;
|
|
|
+ }
|
|
|
|
|
|
- this.showAuth = true;
|
|
|
- },
|
|
|
- /* 显示分配权限 */
|
|
|
- openDataAuth(row) {
|
|
|
- this.roleDataAuthDialogFlag = true;
|
|
|
+ this.showAuth = true;
|
|
|
+ },
|
|
|
+ /* 显示分配权限 */
|
|
|
+ openDataAuth(row) {
|
|
|
+ this.roleDataAuthDialogFlag = true;
|
|
|
|
|
|
- this.$nextTick(() => {
|
|
|
- this.$refs.roleDataAuthDialogRef.init({ ...row });
|
|
|
- });
|
|
|
- },
|
|
|
- //复制
|
|
|
- async copyRole(row) {
|
|
|
- const loading = this.$loading({ lock: true });
|
|
|
- copyRole(row.id)
|
|
|
- .then((msg) => {
|
|
|
- loading.close();
|
|
|
- this.$message.success(msg);
|
|
|
- this.reload();
|
|
|
- })
|
|
|
- .catch((e) => {
|
|
|
- loading.close();
|
|
|
- this.$message.error(e.message);
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.roleDataAuthDialogRef.init({ ...row });
|
|
|
});
|
|
|
- },
|
|
|
- /* 删除 */
|
|
|
- remove(row) {
|
|
|
- const loading = this.$loading({ lock: true });
|
|
|
- removeRole(row.id)
|
|
|
- .then((msg) => {
|
|
|
- loading.close();
|
|
|
- this.$message.success(msg);
|
|
|
- this.reload();
|
|
|
+ },
|
|
|
+ //复制
|
|
|
+ async copyRole(row) {
|
|
|
+ const loading = this.$loading({ lock: true });
|
|
|
+ copyRole(row.id)
|
|
|
+ .then((msg) => {
|
|
|
+ loading.close();
|
|
|
+ this.$message.success(msg);
|
|
|
+ this.reload();
|
|
|
+ })
|
|
|
+ .catch((e) => {
|
|
|
+ loading.close();
|
|
|
+ this.$message.error(e.message);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /* 删除 */
|
|
|
+ remove(row) {
|
|
|
+ const loading = this.$loading({ lock: true });
|
|
|
+ removeRole(row.id)
|
|
|
+ .then((msg) => {
|
|
|
+ loading.close();
|
|
|
+ this.$message.success(msg);
|
|
|
+ this.reload();
|
|
|
+ })
|
|
|
+ .catch((e) => {
|
|
|
+ loading.close();
|
|
|
+ this.$message.error(e.message);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /* 批量删除 */
|
|
|
+ removeBatch() {
|
|
|
+ if (!this.selection.length) {
|
|
|
+ this.$message.error('请至少选择一条数据');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.$confirm('确定要删除选中的角色吗?', '提示', {
|
|
|
+ type: 'warning'
|
|
|
})
|
|
|
- .catch((e) => {
|
|
|
- loading.close();
|
|
|
- this.$message.error(e.message);
|
|
|
- });
|
|
|
- },
|
|
|
- /* 批量删除 */
|
|
|
- removeBatch() {
|
|
|
- if (!this.selection.length) {
|
|
|
- this.$message.error('请至少选择一条数据');
|
|
|
- return;
|
|
|
+ .then(() => {
|
|
|
+ const loading = this.$loading({ lock: true });
|
|
|
+ removeRole(
|
|
|
+ this.selection.map((d) => d.id),
|
|
|
+ true
|
|
|
+ )
|
|
|
+ .then((msg) => {
|
|
|
+ loading.close();
|
|
|
+ this.$message.success(msg);
|
|
|
+ this.reload();
|
|
|
+ })
|
|
|
+ .catch((e) => {
|
|
|
+ loading.close();
|
|
|
+ this.$message.error(e.message);
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
}
|
|
|
- this.$confirm('确定要删除选中的角色吗?', '提示', {
|
|
|
- type: 'warning'
|
|
|
- })
|
|
|
- .then(() => {
|
|
|
- const loading = this.$loading({ lock: true });
|
|
|
- removeRole(
|
|
|
- this.selection.map((d) => d.id),
|
|
|
- true
|
|
|
- )
|
|
|
- .then((msg) => {
|
|
|
- loading.close();
|
|
|
- this.$message.success(msg);
|
|
|
- this.reload();
|
|
|
- })
|
|
|
- .catch((e) => {
|
|
|
- loading.close();
|
|
|
- this.$message.error(e.message);
|
|
|
- });
|
|
|
- })
|
|
|
- .catch(() => {});
|
|
|
}
|
|
|
- }
|
|
|
-};
|
|
|
+ };
|
|
|
</script>
|