parent
93a25b6b38
commit
852ae82bf1
|
|
@ -1,6 +1,6 @@
|
|||
<script lang="ts">
|
||||
export default {
|
||||
name: 'dept',
|
||||
name: 'dept'
|
||||
};
|
||||
</script>
|
||||
|
||||
|
|
@ -13,7 +13,7 @@ import {
|
|||
updateDept,
|
||||
addDept,
|
||||
listDeptOptions,
|
||||
listDepartments,
|
||||
listDepartments
|
||||
} from '@/api/dept';
|
||||
|
||||
import { Search, Plus, Refresh, Delete } from '@element-plus/icons-vue';
|
||||
|
|
@ -34,15 +34,15 @@ const state = reactive({
|
|||
queryParams: {} as DeptQuery,
|
||||
formData: {
|
||||
sort: 1,
|
||||
status: 1,
|
||||
status: 1
|
||||
} as DeptForm,
|
||||
rules: {
|
||||
parentId: [
|
||||
{ required: true, message: '上级部门不能为空', trigger: 'blur' },
|
||||
{ required: true, message: '上级部门不能为空', trigger: 'blur' }
|
||||
],
|
||||
name: [{ required: true, message: '部门名称不能为空', trigger: 'blur' }],
|
||||
sort: [{ required: true, message: '显示排序不能为空', trigger: 'blur' }],
|
||||
},
|
||||
sort: [{ required: true, message: '显示排序不能为空', trigger: 'blur' }]
|
||||
}
|
||||
});
|
||||
|
||||
const {
|
||||
|
|
@ -53,7 +53,7 @@ const {
|
|||
queryParams,
|
||||
formData,
|
||||
rules,
|
||||
dialog,
|
||||
dialog
|
||||
} = toRefs(state);
|
||||
|
||||
/**
|
||||
|
|
@ -84,11 +84,11 @@ function handleSelectionChange(selection: any) {
|
|||
*/
|
||||
async function getDeptOptions() {
|
||||
const deptOptions: any[] = [];
|
||||
listDeptOptions().then((response) => {
|
||||
listDeptOptions().then(response => {
|
||||
const rootDeptOption = {
|
||||
value: '0',
|
||||
label: '顶级部门',
|
||||
children: response.data,
|
||||
children: response.data
|
||||
};
|
||||
deptOptions.push(rootDeptOption);
|
||||
state.deptOptions = deptOptions;
|
||||
|
|
@ -104,7 +104,7 @@ function handleAdd(row: any) {
|
|||
formData.value.parentId = row.id;
|
||||
dialog.value = {
|
||||
title: '添加部门',
|
||||
visible: true,
|
||||
visible: true
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -116,7 +116,7 @@ async function handleUpdate(row: any) {
|
|||
const deptId = row.id || state.ids;
|
||||
state.dialog = {
|
||||
title: '修改部门',
|
||||
visible: true,
|
||||
visible: true
|
||||
};
|
||||
getDeptForm(deptId).then((response: any) => {
|
||||
state.formData = response.data;
|
||||
|
|
@ -159,7 +159,7 @@ function handleDelete(row: any) {
|
|||
ElMessageBox.confirm(`确认删除已选中的数据项?`, '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
deleteDept(ids)
|
||||
|
|
@ -263,26 +263,14 @@ onMounted(() => {
|
|||
|
||||
<el-table-column label="操作" align="center" width="150">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
type="primary"
|
||||
link
|
||||
@click.stop="handleUpdate(scope.row)"
|
||||
>新增
|
||||
<el-button type="primary" link @click.stop="handleAdd(scope.row)"
|
||||
>新增
|
||||
</el-button>
|
||||
<el-button
|
||||
type="success"
|
||||
link
|
||||
@click.stop="handleAdd(scope.row)"
|
||||
>
|
||||
修改
|
||||
<el-button type="success" link @click.stop="handleUpdate(scope.row)"
|
||||
>编辑
|
||||
</el-button>
|
||||
|
||||
<el-button
|
||||
type="danger"
|
||||
link
|
||||
@click.stop="handleDelete(scope.row)"
|
||||
>
|
||||
删除
|
||||
<el-button type="danger" link @click.stop="handleDelete(scope.row)">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
|
|
|||
|
|
@ -102,26 +102,21 @@
|
|||
type="success"
|
||||
link
|
||||
@click.stop="handleAdd(scope.row)"
|
||||
|
||||
v-if="scope.row.type=='CATALOG' ||scope.row.type=='MENU'"
|
||||
v-if="scope.row.type == 'CATALOG' || scope.row.type == 'MENU'"
|
||||
>
|
||||
新增
|
||||
</el-button>
|
||||
新增
|
||||
</el-button>
|
||||
|
||||
<el-button
|
||||
type="primary"
|
||||
link
|
||||
@click.stop="handleUpdate(scope.row)"
|
||||
>
|
||||
修改
|
||||
</el-button>
|
||||
<el-button
|
||||
type="danger"
|
||||
link
|
||||
@click.stop="handleDelete(scope.row)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button type="danger" link @click.stop="handleDelete(scope.row)">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
|
@ -287,7 +282,7 @@ import {
|
|||
listMenuOptions,
|
||||
addMenu,
|
||||
deleteMenus,
|
||||
updateMenu,
|
||||
updateMenu
|
||||
} from '@/api/menu';
|
||||
|
||||
import SvgIcon from '@/components/SvgIcon/index.vue';
|
||||
|
|
@ -315,7 +310,7 @@ const state = reactive({
|
|||
visible: 1,
|
||||
sort: 1,
|
||||
component: undefined,
|
||||
type: 'MENU',
|
||||
type: 'MENU'
|
||||
} as MenuForm,
|
||||
rules: {
|
||||
parentId: [{ required: true, message: '请选择顶级菜单', trigger: 'blur' }],
|
||||
|
|
@ -323,8 +318,8 @@ const state = reactive({
|
|||
type: [{ required: true, message: '请选择菜单类型', trigger: 'blur' }],
|
||||
path: [{ required: true, message: '请输入路由路径', trigger: 'blur' }],
|
||||
component: [
|
||||
{ required: true, message: '请输入组件完整路径', trigger: 'blur' },
|
||||
],
|
||||
{ required: true, message: '请输入组件完整路径', trigger: 'blur' }
|
||||
]
|
||||
},
|
||||
menuOptions: [] as OptionType[],
|
||||
currentRow: undefined,
|
||||
|
|
@ -332,8 +327,8 @@ const state = reactive({
|
|||
iconSelectVisible: false,
|
||||
cacheData: {
|
||||
menuType: '',
|
||||
menuPath: '',
|
||||
},
|
||||
menuPath: ''
|
||||
}
|
||||
});
|
||||
|
||||
const {
|
||||
|
|
@ -345,7 +340,7 @@ const {
|
|||
rules,
|
||||
menuOptions,
|
||||
iconSelectVisible,
|
||||
cacheData,
|
||||
cacheData
|
||||
} = toRefs(state);
|
||||
|
||||
/**
|
||||
|
|
@ -394,7 +389,7 @@ async function handleAdd(row: any) {
|
|||
await loadMenuData();
|
||||
dialog.value = {
|
||||
title: '添加菜单',
|
||||
visible: true,
|
||||
visible: true
|
||||
};
|
||||
|
||||
if (row.id) {
|
||||
|
|
@ -421,7 +416,7 @@ async function handleUpdate(row: MenuForm) {
|
|||
await loadMenuData();
|
||||
state.dialog = {
|
||||
title: '编辑菜单',
|
||||
visible: true,
|
||||
visible: true
|
||||
};
|
||||
const id = row.id as string;
|
||||
getMenuDetail(id).then(({ data }) => {
|
||||
|
|
@ -475,7 +470,7 @@ function handleDelete(row: any) {
|
|||
ElMessageBox.confirm('确认删除已选中的数据项?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
deleteMenus(ids).then(() => {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<script lang="ts">
|
||||
export default {
|
||||
name: 'role',
|
||||
name: 'role'
|
||||
};
|
||||
</script>
|
||||
|
||||
|
|
@ -13,7 +13,7 @@ import {
|
|||
addRole,
|
||||
deleteRoles,
|
||||
getRoleMenuIds,
|
||||
updateRoleMenus,
|
||||
updateRoleMenus
|
||||
} from '@/api/role';
|
||||
import { listResources } from '@/api/menu';
|
||||
|
||||
|
|
@ -32,20 +32,20 @@ const state = reactive({
|
|||
ids: [] as number[],
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
pageSize: 10
|
||||
} as RoleQuery,
|
||||
roleList: [] as Role[],
|
||||
total: 0,
|
||||
dialog: {
|
||||
title: '',
|
||||
visible: false,
|
||||
visible: false
|
||||
} as DialogType,
|
||||
formData: {} as RoleForm,
|
||||
rules: {
|
||||
name: [{ required: true, message: '请输入角色名称', trigger: 'blur' }],
|
||||
code: [{ required: true, message: '请输入角色编码', trigger: 'blur' }],
|
||||
dataScope: [{ required: true, message: '请选择数据权限', trigger: 'blur' }],
|
||||
status: [{ required: true, message: '请选择状态', trigger: 'blur' }],
|
||||
status: [{ required: true, message: '请选择状态', trigger: 'blur' }]
|
||||
},
|
||||
menuDialogVisible: false,
|
||||
resourceOptions: [] as OptionType[],
|
||||
|
|
@ -56,8 +56,8 @@ const state = reactive({
|
|||
// 选中的角色
|
||||
checkedRole: {
|
||||
id: '',
|
||||
name: '',
|
||||
},
|
||||
name: ''
|
||||
}
|
||||
});
|
||||
|
||||
const {
|
||||
|
|
@ -71,7 +71,7 @@ const {
|
|||
rules,
|
||||
menuDialogVisible,
|
||||
checkedRole,
|
||||
resourceOptions,
|
||||
resourceOptions
|
||||
} = toRefs(state);
|
||||
|
||||
/**
|
||||
|
|
@ -105,14 +105,14 @@ function handleRowClick(row: any) {
|
|||
function handleAdd() {
|
||||
dialog.value = {
|
||||
title: '添加角色',
|
||||
visible: true,
|
||||
visible: true
|
||||
};
|
||||
}
|
||||
|
||||
function handleUpdate(row: any) {
|
||||
dialog.value = {
|
||||
title: '修改角色',
|
||||
visible: true,
|
||||
visible: true
|
||||
};
|
||||
const roleId = row.id || state.ids;
|
||||
getRoleFormDetail(roleId).then(({ data }) => {
|
||||
|
|
@ -160,7 +160,7 @@ function handleDelete(row: any) {
|
|||
ElMessageBox.confirm('确认删除已选中的数据项?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
deleteRoles(ids).then(() => {
|
||||
|
|
@ -181,17 +181,17 @@ function showRoleMenuDialog(row: Role) {
|
|||
const roleId: any = row.id;
|
||||
checkedRole.value = {
|
||||
id: roleId,
|
||||
name: row.name,
|
||||
name: row.name
|
||||
};
|
||||
|
||||
// 获取所有的资源
|
||||
listResources().then((response) => {
|
||||
listResources().then(response => {
|
||||
resourceOptions.value = response.data;
|
||||
// 角色拥有的资源
|
||||
getRoleMenuIds(roleId).then(({ data }) => {
|
||||
// 勾选回显
|
||||
const checkedMenuIds = data;
|
||||
checkedMenuIds.forEach((menuId) =>
|
||||
checkedMenuIds.forEach(menuId =>
|
||||
resourceRef.value.setChecked(menuId, true)
|
||||
);
|
||||
|
||||
|
|
@ -207,7 +207,7 @@ function handleRoleResourceSubmit() {
|
|||
.getCheckedNodes(false, true)
|
||||
.map((node: any) => node.value);
|
||||
|
||||
updateRoleMenus(checkedRole.value.id, checkedMenuIds).then((res) => {
|
||||
updateRoleMenus(checkedRole.value.id, checkedMenuIds).then(res => {
|
||||
ElMessage.success('分配权限成功');
|
||||
menuDialogVisible.value = false;
|
||||
handleQuery();
|
||||
|
|
@ -286,7 +286,7 @@ onMounted(() => {
|
|||
<el-table-column prop="createTime" label="创建时间" width="160" />
|
||||
<el-table-column prop="updateTime" label="修改时间" width="160" />
|
||||
|
||||
<el-table-column label="操作" align="left" >
|
||||
<el-table-column label="操作" align="left">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
type="success"
|
||||
|
|
@ -301,7 +301,7 @@ onMounted(() => {
|
|||
link
|
||||
@click.stop="handleUpdate(scope.row)"
|
||||
>
|
||||
修改
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button type="danger" link @click.stop="handleDelete(scope.row)">
|
||||
删除
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<script lang="ts">
|
||||
export default {
|
||||
name: 'user',
|
||||
name: 'user'
|
||||
};
|
||||
</script>
|
||||
|
||||
|
|
@ -11,7 +11,7 @@ import {
|
|||
watchEffect,
|
||||
onMounted,
|
||||
getCurrentInstance,
|
||||
toRefs,
|
||||
toRefs
|
||||
} from 'vue';
|
||||
|
||||
// api
|
||||
|
|
@ -25,7 +25,7 @@ import {
|
|||
updateUserPassword,
|
||||
downloadTemplate,
|
||||
exportUser,
|
||||
importUser,
|
||||
importUser
|
||||
} from '@/api/user';
|
||||
import { listDeptOptions } from '@/api/dept';
|
||||
import { listRoleOptions } from '@/api/role';
|
||||
|
|
@ -35,7 +35,7 @@ import {
|
|||
ElForm,
|
||||
ElMessageBox,
|
||||
ElMessage,
|
||||
UploadFile,
|
||||
UploadFile
|
||||
} from 'element-plus';
|
||||
import {
|
||||
Search,
|
||||
|
|
@ -44,13 +44,13 @@ import {
|
|||
Delete,
|
||||
Download,
|
||||
Top,
|
||||
UploadFilled,
|
||||
UploadFilled
|
||||
} from '@element-plus/icons-vue';
|
||||
import {
|
||||
UserForm,
|
||||
UserImportData,
|
||||
UserQuery,
|
||||
UserType,
|
||||
UserType
|
||||
} from '@/api/user/types';
|
||||
|
||||
const deptTreeRef = ref(ElTree); // 部门树
|
||||
|
|
@ -69,7 +69,7 @@ const state = reactive({
|
|||
total: 0,
|
||||
userList: [] as UserType[],
|
||||
dialog: {
|
||||
visible: false,
|
||||
visible: false
|
||||
} as DialogType,
|
||||
deptName: undefined,
|
||||
// 部门下拉项
|
||||
|
|
@ -79,16 +79,16 @@ const state = reactive({
|
|||
// 角色下拉项
|
||||
roleOptions: [] as OptionType[],
|
||||
formData: {
|
||||
status: 1,
|
||||
status: 1
|
||||
} as UserForm,
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
pageSize: 10
|
||||
} as UserQuery,
|
||||
rules: {
|
||||
username: [{ required: true, message: '用户名不能为空', trigger: 'blur' }],
|
||||
nickname: [
|
||||
{ required: true, message: '用户昵称不能为空', trigger: 'blur' },
|
||||
{ required: true, message: '用户昵称不能为空', trigger: 'blur' }
|
||||
],
|
||||
deptId: [{ required: true, message: '所属部门不能为空', trigger: 'blur' }],
|
||||
roleIds: [{ required: true, message: '用户角色不能为空', trigger: 'blur' }],
|
||||
|
|
@ -96,25 +96,25 @@ const state = reactive({
|
|||
{
|
||||
pattern: /\w[-\w.+]*@([A-Za-z0-9][-A-Za-z0-9]+\.)+[A-Za-z]{2,14}/,
|
||||
message: '请输入正确的邮箱地址',
|
||||
trigger: 'blur',
|
||||
},
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
mobile: [
|
||||
{
|
||||
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
|
||||
message: '请输入正确的手机号码',
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
importDialog: {
|
||||
title: '用户搭配',
|
||||
visible: false,
|
||||
title: '用户导入',
|
||||
visible: false
|
||||
} as DialogType,
|
||||
importFormData: {} as UserImportData,
|
||||
excelFile: undefined as any,
|
||||
excelFilelist: [] as File[],
|
||||
excelFilelist: [] as File[]
|
||||
});
|
||||
|
||||
const {
|
||||
|
|
@ -131,7 +131,7 @@ const {
|
|||
roleOptions,
|
||||
importDialog,
|
||||
importFormData,
|
||||
excelFilelist,
|
||||
excelFilelist
|
||||
} = toRefs(state);
|
||||
|
||||
watchEffect(
|
||||
|
|
@ -139,7 +139,7 @@ watchEffect(
|
|||
deptTreeRef.value.filter(state.deptName);
|
||||
},
|
||||
{
|
||||
flush: 'post', // watchEffect会在DOM挂载或者更新之前就会触发,此属性控制在DOM元素更新后运行
|
||||
flush: 'post' // watchEffect会在DOM挂载或者更新之前就会触发,此属性控制在DOM元素更新后运行
|
||||
}
|
||||
);
|
||||
|
||||
|
|
@ -165,7 +165,7 @@ function handleDeptNodeClick(data: { [key: string]: any }) {
|
|||
* 获取角色下拉项
|
||||
*/
|
||||
async function getRoleOptions() {
|
||||
listRoleOptions().then((response) => {
|
||||
listRoleOptions().then(response => {
|
||||
state.roleOptions = response.data;
|
||||
});
|
||||
}
|
||||
|
|
@ -181,7 +181,7 @@ function handleStatusChange(row: { [key: string]: any }) {
|
|||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
type: 'warning'
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
|
|
@ -231,7 +231,7 @@ function resetPassword(row: { [key: string]: any }) {
|
|||
'重置密码',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
cancelButtonText: '取消'
|
||||
}
|
||||
)
|
||||
.then(({ value }) => {
|
||||
|
|
@ -252,7 +252,7 @@ function resetPassword(row: { [key: string]: any }) {
|
|||
async function handleAdd() {
|
||||
state.dialog = {
|
||||
title: '添加用户',
|
||||
visible: true,
|
||||
visible: true
|
||||
};
|
||||
await getDeptOptions();
|
||||
await getRoleOptions();
|
||||
|
|
@ -264,7 +264,7 @@ async function handleAdd() {
|
|||
async function handleUpdate(row: { [key: string]: any }) {
|
||||
dialog.value = {
|
||||
title: '修改用户',
|
||||
visible: true,
|
||||
visible: true
|
||||
};
|
||||
|
||||
const userId = row.id || state.ids;
|
||||
|
|
@ -310,7 +310,7 @@ function handleDelete(row: { [key: string]: any }) {
|
|||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
type: 'warning'
|
||||
}
|
||||
)
|
||||
.then(function () {
|
||||
|
|
@ -335,7 +335,7 @@ function closeDialog() {
|
|||
* 获取部门下拉项
|
||||
*/
|
||||
async function getDeptOptions() {
|
||||
listDeptOptions().then((response) => {
|
||||
listDeptOptions().then(response => {
|
||||
state.deptOptions = response.data;
|
||||
});
|
||||
}
|
||||
|
|
@ -355,7 +355,7 @@ function getGenderOptions() {
|
|||
function handleDownloadTemplate() {
|
||||
downloadTemplate().then((response: any) => {
|
||||
const blob = new Blob([response.data], {
|
||||
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8',
|
||||
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'
|
||||
});
|
||||
const a = document.createElement('a');
|
||||
const href = window.URL.createObjectURL(blob); // 下载链接
|
||||
|
|
@ -407,7 +407,7 @@ function submitImportForm() {
|
|||
|
||||
const deptId = state.importFormData.deptId;
|
||||
const roleIds = state.importFormData.roleIds.join(',');
|
||||
importUser(deptId, roleIds, state.excelFile).then((response) => {
|
||||
importUser(deptId, roleIds, state.excelFile).then(response => {
|
||||
ElMessage.success(response.data);
|
||||
closeImportDialog();
|
||||
handleQuery();
|
||||
|
|
@ -432,7 +432,7 @@ function closeImportDialog() {
|
|||
function handleExport() {
|
||||
exportUser(queryParams.value).then((response: any) => {
|
||||
const blob = new Blob([response.data], {
|
||||
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8',
|
||||
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'
|
||||
});
|
||||
const a = document.createElement('a');
|
||||
const href = window.URL.createObjectURL(blob); // 下载的链接
|
||||
|
|
@ -580,11 +580,26 @@ onMounted(() => {
|
|||
align="center"
|
||||
prop="username"
|
||||
/>
|
||||
<el-table-column label="用户昵称" width="120" align="center" prop="nickname" />
|
||||
<el-table-column
|
||||
label="用户昵称"
|
||||
width="120"
|
||||
align="center"
|
||||
prop="nickname"
|
||||
/>
|
||||
|
||||
<el-table-column label="性别" width="100" align="center" prop="genderLabel" />
|
||||
<el-table-column
|
||||
label="性别"
|
||||
width="100"
|
||||
align="center"
|
||||
prop="genderLabel"
|
||||
/>
|
||||
|
||||
<el-table-column label="部门" width="120" align="center" prop="deptName" />
|
||||
<el-table-column
|
||||
label="部门"
|
||||
width="120"
|
||||
align="center"
|
||||
prop="deptName"
|
||||
/>
|
||||
<el-table-column
|
||||
label="手机号码"
|
||||
align="center"
|
||||
|
|
@ -618,7 +633,7 @@ onMounted(() => {
|
|||
link
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPerm="['sys:user:edit']"
|
||||
>修改</el-button
|
||||
>编辑</el-button
|
||||
>
|
||||
<el-button
|
||||
type="danger"
|
||||
|
|
|
|||
Loading…
Reference in New Issue