|
|
@@ -83,173 +83,173 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- import RoleSearch from './components/role-search.vue';
|
|
|
- import RoleEdit from './components/role-edit.vue';
|
|
|
- import RoleAuth from './components/role-auth.vue';
|
|
|
- import {
|
|
|
- pageRoles,
|
|
|
- removeRole,
|
|
|
- removeRoles,
|
|
|
- putRoles
|
|
|
- } from '@/api/system/role';
|
|
|
+import RoleSearch from './components/role-search.vue';
|
|
|
+import RoleEdit from './components/role-edit.vue';
|
|
|
+import RoleAuth from './components/role-auth.vue';
|
|
|
+import {
|
|
|
+ pageRoles,
|
|
|
+ removeRole,
|
|
|
+ removeRoles,
|
|
|
+ putRoles
|
|
|
+} from '@/api/system/role';
|
|
|
|
|
|
- export default {
|
|
|
- name: 'SystemRole',
|
|
|
- components: {
|
|
|
- RoleSearch,
|
|
|
- RoleEdit,
|
|
|
- RoleAuth
|
|
|
- },
|
|
|
- data() {
|
|
|
- return {
|
|
|
- // 表格列配置
|
|
|
- columns: [
|
|
|
- {
|
|
|
- columnKey: 'selection',
|
|
|
- type: 'selection',
|
|
|
- width: 45,
|
|
|
- align: 'center',
|
|
|
- fixed: 'left'
|
|
|
- },
|
|
|
- {
|
|
|
- columnKey: 'index',
|
|
|
- label: '#',
|
|
|
- type: 'index',
|
|
|
- width: 45,
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
- fixed: 'left'
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'name',
|
|
|
- label: '角色名称',
|
|
|
- align: 'center',
|
|
|
+export default {
|
|
|
+ name: 'SystemRole',
|
|
|
+ components: {
|
|
|
+ RoleSearch,
|
|
|
+ RoleEdit,
|
|
|
+ RoleAuth
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ // 表格列配置
|
|
|
+ columns: [
|
|
|
+ {
|
|
|
+ columnKey: 'selection',
|
|
|
+ type: 'selection',
|
|
|
+ width: 45,
|
|
|
+ align: 'center',
|
|
|
+ fixed: 'left'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ columnKey: 'index',
|
|
|
+ label: '#',
|
|
|
+ type: 'index',
|
|
|
+ width: 45,
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ fixed: 'left'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'name',
|
|
|
+ label: '角色名称',
|
|
|
+ align: 'center',
|
|
|
|
|
|
- showOverflowTooltip: true,
|
|
|
- minWidth: 110
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'groupId',
|
|
|
- label: '组织ID',
|
|
|
- align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 110
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'groupId',
|
|
|
+ label: '组织ID',
|
|
|
+ align: 'center',
|
|
|
|
|
|
- showOverflowTooltip: true,
|
|
|
- minWidth: 110
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'enable',
|
|
|
- label: '启用状态',
|
|
|
- align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ 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);
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- columnKey: 'action',
|
|
|
- label: '操作',
|
|
|
- width: 230,
|
|
|
- align: 'center',
|
|
|
- resizable: false,
|
|
|
- slot: 'action',
|
|
|
- showOverflowTooltip: true
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 110,
|
|
|
+ formatter: (_row, _column, cellValue) => {
|
|
|
+ return this.$util.toDateString(cellValue);
|
|
|
}
|
|
|
- ],
|
|
|
- // 表格选中数据
|
|
|
- selection: [],
|
|
|
- // 当前编辑数据
|
|
|
- current: null,
|
|
|
- // 是否显示编辑弹窗
|
|
|
- showEdit: false,
|
|
|
- // 是否显示导入弹窗
|
|
|
- showAuth: false
|
|
|
- };
|
|
|
+ },
|
|
|
+ {
|
|
|
+ columnKey: 'action',
|
|
|
+ label: '操作',
|
|
|
+ width: 230,
|
|
|
+ align: 'center',
|
|
|
+ resizable: false,
|
|
|
+ slot: 'action',
|
|
|
+ showOverflowTooltip: true
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ // 表格选中数据
|
|
|
+ selection: [],
|
|
|
+ // 当前编辑数据
|
|
|
+ current: null,
|
|
|
+ // 是否显示编辑弹窗
|
|
|
+ showEdit: false,
|
|
|
+ // 是否显示导入弹窗
|
|
|
+ showAuth: false
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {},
|
|
|
+ methods: {
|
|
|
+ /* 表格数据源 */
|
|
|
+ datasource({ page, limit, where, order }) {
|
|
|
+ console.log(where);
|
|
|
+ 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 });
|
|
|
+ },
|
|
|
+ /* 显示编辑 */
|
|
|
+ openEdit(row) {
|
|
|
+ this.current = row;
|
|
|
+ this.showEdit = true;
|
|
|
},
|
|
|
- created() {},
|
|
|
- methods: {
|
|
|
- /* 表格数据源 */
|
|
|
- datasource({ page, limit, where, order }) {
|
|
|
- console.log(where);
|
|
|
- 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'
|
|
|
- });
|
|
|
+ /* 显示分配权限 */
|
|
|
+ openAuth(row) {
|
|
|
+ this.current = row;
|
|
|
+ this.showAuth = true;
|
|
|
+ },
|
|
|
+ /* 删除 */
|
|
|
+ remove(row) {
|
|
|
+ const loading = this.$loading({ lock: true });
|
|
|
+ removeRole(row.id)
|
|
|
+ .then((msg) => {
|
|
|
+ loading.close();
|
|
|
+ this.$message.success(msg);
|
|
|
this.reload();
|
|
|
- }
|
|
|
- },
|
|
|
- /* 刷新表格 */
|
|
|
- reload(where) {
|
|
|
- this.$refs.table.reload({ page: 1, where });
|
|
|
- },
|
|
|
- /* 显示编辑 */
|
|
|
- openEdit(row) {
|
|
|
- this.current = row;
|
|
|
- this.showEdit = true;
|
|
|
- },
|
|
|
- /* 显示分配权限 */
|
|
|
- openAuth(row) {
|
|
|
- this.current = row;
|
|
|
- this.showAuth = true;
|
|
|
- },
|
|
|
- /* 删除 */
|
|
|
- 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'
|
|
|
})
|
|
|
- .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(() => {});
|
|
|
+ .catch((e) => {
|
|
|
+ loading.close();
|
|
|
+ this.$message.error(e.message);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /* 批量删除 */
|
|
|
+ removeBatch() {
|
|
|
+ if (!this.selection.length) {
|
|
|
+ this.$message.error('请至少选择一条数据');
|
|
|
+ return;
|
|
|
}
|
|
|
+ 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>
|