优化部门、角色
This commit is contained in:
parent
3811a5c8a8
commit
1b77f96704
@ -5,7 +5,7 @@ export const columns = [
|
|||||||
{
|
{
|
||||||
title: '部门名称',
|
title: '部门名称',
|
||||||
key: 'name',
|
key: 'name',
|
||||||
width: 150,
|
width: 250,
|
||||||
align: 'left',
|
align: 'left',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -54,7 +54,7 @@ export const columns = [
|
|||||||
{
|
{
|
||||||
title: '部门备注',
|
title: '部门备注',
|
||||||
key: 'note',
|
key: 'note',
|
||||||
width: 100,
|
width: 200,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '创建人',
|
title: '创建人',
|
||||||
|
@ -135,13 +135,18 @@
|
|||||||
sort: 0,
|
sort: 0,
|
||||||
note: '',
|
note: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定义模态
|
||||||
|
*/
|
||||||
const [modalRegister, { openModal, setSubLoading }] = useModal({
|
const [modalRegister, { openModal, setSubLoading }] = useModal({
|
||||||
title: props.deptId ? '编辑部门' : '添加部门',
|
title: props.deptId ? '编辑部门' : '添加部门',
|
||||||
subBtuText: '确定',
|
subBtuText: '确定',
|
||||||
width: 600,
|
width: 600,
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 关闭窗体
|
* 执行关闭窗体
|
||||||
*/
|
*/
|
||||||
const handleClose = () => {
|
const handleClose = () => {
|
||||||
emit('update:visible', false);
|
emit('update:visible', false);
|
||||||
@ -208,7 +213,10 @@
|
|||||||
formData.parentId = props.pid;
|
formData.parentId = props.pid;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
//导出方法
|
|
||||||
|
/**
|
||||||
|
* 定义函数
|
||||||
|
*/
|
||||||
defineExpose({
|
defineExpose({
|
||||||
openModal,
|
openModal,
|
||||||
});
|
});
|
||||||
|
@ -64,8 +64,11 @@
|
|||||||
const deptId = ref(0);
|
const deptId = ref(0);
|
||||||
const pid = ref(0);
|
const pid = ref(0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定义操作栏
|
||||||
|
*/
|
||||||
const actionColumn = reactive({
|
const actionColumn = reactive({
|
||||||
width: 220,
|
width: 250,
|
||||||
title: '操作',
|
title: '操作',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
key: 'action',
|
key: 'action',
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
children-field="children"
|
children-field="children"
|
||||||
cascade
|
cascade
|
||||||
virtual-scroll
|
virtual-scroll
|
||||||
style="height: 350px"
|
style="height: 450px"
|
||||||
:checked-keys="checkedKeys"
|
:checked-keys="checkedKeys"
|
||||||
:expanded-keys="expandedKeys"
|
:expanded-keys="expandedKeys"
|
||||||
:indeterminate-keys="halfCheckedIds"
|
:indeterminate-keys="halfCheckedIds"
|
||||||
@ -42,7 +42,6 @@
|
|||||||
import { useMessage } from 'naive-ui';
|
import { useMessage } from 'naive-ui';
|
||||||
import { onMounted, ref } from 'vue';
|
import { onMounted, ref } from 'vue';
|
||||||
import { useModal } from '@/components/Modal';
|
import { useModal } from '@/components/Modal';
|
||||||
import { isArray } from '@/utils/is';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 定义接收的参数
|
* 定义接收的参数
|
||||||
@ -75,11 +74,15 @@
|
|||||||
const menuArray = ref<any[]>([]);
|
const menuArray = ref<any[]>([]);
|
||||||
const menuTree = ref<any[]>([]);
|
const menuTree = ref<any[]>([]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定义模态
|
||||||
|
*/
|
||||||
const [modalRegister, { openModal, setSubLoading }] = useModal({
|
const [modalRegister, { openModal, setSubLoading }] = useModal({
|
||||||
title: '分配权限',
|
title: '分配权限',
|
||||||
subBtuText: '确定',
|
subBtuText: '确定',
|
||||||
width: 600,
|
width: 600,
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 执行扩展、收缩
|
* 执行扩展、收缩
|
||||||
*/
|
*/
|
||||||
@ -102,7 +105,9 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 获取所有选择的节点
|
/**
|
||||||
|
* 获取所有选择的节点
|
||||||
|
*/
|
||||||
const getDeptAllCheckedKeys = () => {
|
const getDeptAllCheckedKeys = () => {
|
||||||
const checkedKeys = treeRef.value?.getCheckedData().keys;
|
const checkedKeys = treeRef.value?.getCheckedData().keys;
|
||||||
const halfCheckedKeys = treeRef.value?.getIndeterminateData().keys;
|
const halfCheckedKeys = treeRef.value?.getIndeterminateData().keys;
|
||||||
@ -137,6 +142,10 @@
|
|||||||
checkedKeys.value = node;
|
checkedKeys.value = node;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行收缩、展开
|
||||||
|
* @param node 参数
|
||||||
|
*/
|
||||||
const handleExpands = (node) => {
|
const handleExpands = (node) => {
|
||||||
expandedKeys.value = node;
|
expandedKeys.value = node;
|
||||||
};
|
};
|
||||||
@ -155,6 +164,7 @@
|
|||||||
checkedKeys.value = keys.checkedIds;
|
checkedKeys.value = keys.checkedIds;
|
||||||
halfCheckedIds.value = keys.halfCheckedIds;
|
halfCheckedIds.value = keys.halfCheckedIds;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 选中树结构
|
* 选中树结构
|
||||||
* @param nodes 节点
|
* @param nodes 节点
|
||||||
@ -210,6 +220,10 @@
|
|||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
setFormData();
|
setFormData();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定义函数
|
||||||
|
*/
|
||||||
defineExpose({
|
defineExpose({
|
||||||
openModal,
|
openModal,
|
||||||
});
|
});
|
||||||
|
@ -79,13 +79,18 @@
|
|||||||
default: 0,
|
default: 0,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定义模态
|
||||||
|
*/
|
||||||
const [modalRegister, { openModal, setSubLoading }] = useModal({
|
const [modalRegister, { openModal, setSubLoading }] = useModal({
|
||||||
title: props.roleId ? '编辑角色' : '添加角色',
|
title: props.roleId ? '编辑角色' : '添加角色',
|
||||||
subBtuText: '确定',
|
subBtuText: '确定',
|
||||||
width: 600,
|
width: 600,
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 执行提交
|
* 执行提交表单
|
||||||
*/
|
*/
|
||||||
const handleSubmit = async () => {
|
const handleSubmit = async () => {
|
||||||
formRef.value
|
formRef.value
|
||||||
@ -129,7 +134,10 @@
|
|||||||
setFormData();
|
setFormData();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
//导出方法
|
|
||||||
|
/**
|
||||||
|
* 定义函数
|
||||||
|
*/
|
||||||
defineExpose({
|
defineExpose({
|
||||||
openModal,
|
openModal,
|
||||||
});
|
});
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
</template>
|
</template>
|
||||||
新建
|
新建
|
||||||
</n-button>
|
</n-button>
|
||||||
|
|
||||||
<n-button
|
<n-button
|
||||||
type="error"
|
type="error"
|
||||||
@click="handleDelete"
|
@click="handleDelete"
|
||||||
@ -45,6 +44,7 @@
|
|||||||
</template>
|
</template>
|
||||||
</BasicTable>
|
</BasicTable>
|
||||||
</n-card>
|
</n-card>
|
||||||
|
<!-- 编辑弹窗 -->
|
||||||
<editDialog
|
<editDialog
|
||||||
ref="createModalRef"
|
ref="createModalRef"
|
||||||
:roleId="roleId"
|
:roleId="roleId"
|
||||||
@ -52,6 +52,7 @@
|
|||||||
v-model:visible="editVisible"
|
v-model:visible="editVisible"
|
||||||
@success="reloadTable('noRefresh')"
|
@success="reloadTable('noRefresh')"
|
||||||
/>
|
/>
|
||||||
|
<!-- 权限设置弹窗 -->
|
||||||
<authDialog
|
<authDialog
|
||||||
ref="authRef"
|
ref="authRef"
|
||||||
v-if="authVisible"
|
v-if="authVisible"
|
||||||
@ -70,10 +71,8 @@
|
|||||||
import { getRoleList, roleDelete, roleBatchDelete } from '@/api/system/role';
|
import { getRoleList, roleDelete, roleBatchDelete } from '@/api/system/role';
|
||||||
import { columns } from './columns';
|
import { columns } from './columns';
|
||||||
import { PlusOutlined, DeleteOutlined, FormOutlined, SettingOutlined } from '@vicons/antd';
|
import { PlusOutlined, DeleteOutlined, FormOutlined, SettingOutlined } from '@vicons/antd';
|
||||||
import CreateModal from './CreateModal.vue';
|
|
||||||
import editDialog from './edit.vue';
|
import editDialog from './edit.vue';
|
||||||
import authDialog from './auth.vue';
|
import authDialog from './auth.vue';
|
||||||
import { basicModal, useModal } from '@/components/Modal';
|
|
||||||
import { schemas } from './querySchemas';
|
import { schemas } from './querySchemas';
|
||||||
import { renderIcon } from '@/utils';
|
import { renderIcon } from '@/utils';
|
||||||
|
|
||||||
@ -86,15 +85,20 @@
|
|||||||
const authVisible = ref(false);
|
const authVisible = ref(false);
|
||||||
const roleId = ref(0);
|
const roleId = ref(0);
|
||||||
const rowKeys = ref([]);
|
const rowKeys = ref([]);
|
||||||
const exportLoading = ref(false);
|
|
||||||
|
|
||||||
const showModal = ref(false);
|
const showModal = ref(false);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定义查询参数
|
||||||
|
*/
|
||||||
const formParams = reactive({
|
const formParams = reactive({
|
||||||
name: '',
|
name: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定义操作栏
|
||||||
|
*/
|
||||||
const actionColumn = reactive({
|
const actionColumn = reactive({
|
||||||
width: 250,
|
width: 300,
|
||||||
title: '操作',
|
title: '操作',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
key: 'action',
|
key: 'action',
|
||||||
@ -129,24 +133,36 @@
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
function addTable() {
|
/**
|
||||||
showModal.value = true;
|
* 加载数据列表
|
||||||
}
|
* @param res 参数
|
||||||
|
*/
|
||||||
const loadDataTable = async (res) => {
|
const loadDataTable = async (res) => {
|
||||||
rowKeys.value = [];
|
rowKeys.value = [];
|
||||||
const result = await getRoleList({ ...formParams, ...res });
|
const result = await getRoleList({ ...formParams, ...res });
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据行选中事件
|
||||||
|
* @param keys 参数
|
||||||
|
*/
|
||||||
function onCheckedRow(keys) {
|
function onCheckedRow(keys) {
|
||||||
rowKeys.value = keys;
|
rowKeys.value = keys;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 刷新数据列表
|
||||||
|
* @param noRefresh 参数
|
||||||
|
*/
|
||||||
function reloadTable(noRefresh = '') {
|
function reloadTable(noRefresh = '') {
|
||||||
basicTableRef.value.reload(noRefresh ? {} : { pageNo: 1 });
|
basicTableRef.value.reload(noRefresh ? {} : { pageNo: 1 });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行提交表单
|
||||||
|
* @param values 参数
|
||||||
|
*/
|
||||||
function handleSubmit(values: Recordable) {
|
function handleSubmit(values: Recordable) {
|
||||||
for (const key in formParams) {
|
for (const key in formParams) {
|
||||||
formParams[key] = '';
|
formParams[key] = '';
|
||||||
@ -157,6 +173,10 @@
|
|||||||
reloadTable();
|
reloadTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行重置
|
||||||
|
* @param values 参数
|
||||||
|
*/
|
||||||
function handleReset(values: Recordable) {
|
function handleReset(values: Recordable) {
|
||||||
for (const key in formParams) {
|
for (const key in formParams) {
|
||||||
formParams[key] = '';
|
formParams[key] = '';
|
||||||
@ -167,6 +187,9 @@
|
|||||||
reloadTable();
|
reloadTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行注册
|
||||||
|
*/
|
||||||
const [register, {}] = useForm({
|
const [register, {}] = useForm({
|
||||||
gridProps: { cols: '1 s:1 m:2 l:3 xl:4 2xl:4' },
|
gridProps: { cols: '1 s:1 m:2 l:3 xl:4 2xl:4' },
|
||||||
labelWidth: 80,
|
labelWidth: 80,
|
||||||
@ -182,6 +205,7 @@
|
|||||||
await nextTick();
|
await nextTick();
|
||||||
createModalRef.value.openModal();
|
createModalRef.value.openModal();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 执行编辑
|
* 执行编辑
|
||||||
*/
|
*/
|
||||||
@ -191,6 +215,7 @@
|
|||||||
await nextTick();
|
await nextTick();
|
||||||
createModalRef.value.openModal();
|
createModalRef.value.openModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 执行分配权限
|
* 执行分配权限
|
||||||
*/
|
*/
|
||||||
@ -200,6 +225,7 @@
|
|||||||
await nextTick();
|
await nextTick();
|
||||||
authRef.value.openModal();
|
authRef.value.openModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 执行删除
|
* 执行删除
|
||||||
* @param id 参数
|
* @param id 参数
|
||||||
|
@ -131,7 +131,7 @@
|
|||||||
* 定义操作栏
|
* 定义操作栏
|
||||||
*/
|
*/
|
||||||
const actionColumn = reactive({
|
const actionColumn = reactive({
|
||||||
width: 400,
|
width: 380,
|
||||||
title: '操作',
|
title: '操作',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
key: 'action',
|
key: 'action',
|
||||||
|
Loading…
Reference in New Issue
Block a user