Vue3 重构:流程分配规则

This commit is contained in:
YunaiV 2023-03-26 19:32:19 +08:00
parent 3c6bf37879
commit f5d900db29
12 changed files with 331 additions and 363 deletions

View File

@ -42,6 +42,6 @@ export const getUserGroupPage = async (params) => {
} }
// 获取用户组精简信息列表 // 获取用户组精简信息列表
export const listSimpleUserGroup = async () => { export const getSimpleUserGroupList = async (): Promise<UserGroupVO[]> => {
return await request.get({ url: '/bpm/user-group/list-all-simple' }) return await request.get({ url: '/bpm/user-group/list-all-simple' })
} }

View File

@ -18,7 +18,7 @@ export interface DeptPageReqVO {
} }
// 查询部门(精简)列表 // 查询部门(精简)列表
export const listSimpleDeptApi = async () => { export const getSimpleDeptList = async (): Promise<DeptVO[]> => {
return await request.get({ url: '/system/dept/list-all-simple' }) return await request.get({ url: '/system/dept/list-all-simple' })
} }

View File

@ -16,7 +16,7 @@ export const getPostPage = async (params: PageParam) => {
} }
// 获取岗位精简信息列表 // 获取岗位精简信息列表
export const getSimplePostList = async () => { export const getSimplePostList = async (): Promise<PostVO[]> => {
return await request.get({ url: '/system/post/list-all-simple' }) return await request.get({ url: '/system/post/list-all-simple' })
} }

View File

@ -28,7 +28,7 @@ export const getRolePageApi = async (params: RolePageReqVO) => {
} }
// 查询角色(精简)列表 // 查询角色(精简)列表
export const listSimpleRolesApi = async () => { export const getSimpleRoleList = async (): Promise<RoleVO[]> => {
return await request.get({ url: '/system/role/list-all-simple' }) return await request.get({ url: '/system/role/list-all-simple' })
} }

View File

@ -86,6 +86,6 @@ export const updateUserStatusApi = (id: number, status: number) => {
} }
// 获取用户精简信息列表 // 获取用户精简信息列表
export const getSimpleUserList = () => { export const getSimpleUserList = (): Promise<UserVO[]> => {
return request.get({ url: '/system/user/list-all-simple' }) return request.get({ url: '/system/user/list-all-simple' })
} }

View File

@ -256,7 +256,7 @@ const remainingRouter: AppRouteRecordRaw[] = [
hidden: true, hidden: true,
canTo: true, canTo: true,
title: '流程定义', title: '流程定义',
activeMenu: 'bpm/definition/index' activeMenu: '/bpm/manager/model'
} }
}, },
{ {

View File

@ -0,0 +1,247 @@
<template>
<Dialog title="修改任务规则" v-model="modelVisible" width="600">
<el-form ref="formRef" :model="formData" :rules="formRules" label-width="80px">
<el-form-item label="任务名称" prop="taskDefinitionName">
<el-input v-model="formData.taskDefinitionName" placeholder="请输入流标标识" disabled />
</el-form-item>
<el-form-item label="任务标识" prop="taskDefinitionKey">
<el-input v-model="formData.taskDefinitionKey" placeholder="请输入任务标识" disabled />
</el-form-item>
<el-form-item label="规则类型" prop="type">
<el-select v-model="formData.type" clearable style="width: 100%">
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.BPM_TASK_ASSIGN_RULE_TYPE)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item v-if="formData.type === 10" label="指定角色" prop="roleIds">
<el-select v-model="formData.roleIds" multiple clearable style="width: 100%">
<el-option
v-for="item in roleOptions"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item
label="指定部门"
prop="deptIds"
span="24"
v-if="formData.type === 20 || formData.type === 21"
>
<el-tree-select
ref="treeRef"
v-model="formData.deptIds"
node-key="id"
show-checkbox
:props="defaultProps"
:data="deptTreeOptions"
empty-text="加载中,请稍后"
multiple
/>
</el-form-item>
<el-form-item label="指定岗位" prop="postIds" span="24" v-if="formData.type === 22">
<el-select v-model="formData.postIds" multiple clearable style="width: 100%">
<el-option
v-for="item in postOptions"
:key="parseInt(item.id)"
:label="item.name"
:value="parseInt(item.id)"
/>
</el-select>
</el-form-item>
<el-form-item
label="指定用户"
prop="userIds"
span="24"
v-if="formData.type === 30 || formData.type === 31 || formData.type === 32"
>
<el-select v-model="formData.userIds" multiple clearable style="width: 100%">
<el-option
v-for="item in userOptions"
:key="parseInt(item.id)"
:label="item.nickname"
:value="parseInt(item.id)"
/>
</el-select>
</el-form-item>
<el-form-item label="指定用户组" prop="userGroupIds" v-if="formData.type === 40">
<el-select v-model="formData.userGroupIds" multiple clearable style="width: 100%">
<el-option
v-for="item in userGroupOptions"
:key="parseInt(item.id)"
:label="item.name"
:value="parseInt(item.id)"
/>
</el-select>
</el-form-item>
<el-form-item label="指定脚本" prop="scripts" v-if="formData.type === 50">
<el-select v-model="formData.scripts" multiple clearable style="width: 100%">
<el-option
v-for="dict in taskAssignScriptDictDatas"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-form>
<!-- 操作按钮 -->
<template #footer>
<el-button @click="submitForm" type="primary" :disabled="formLoading"> </el-button>
<el-button @click="modelVisible = false"> </el-button>
</template>
</Dialog>
</template>
<script setup lang="ts">
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import { handleTree, defaultProps } from '@/utils/tree'
import * as TaskAssignRuleApi from '@/api/bpm/taskAssignRule'
import * as RoleApi from '@/api/system/role'
import * as DeptApi from '@/api/system/dept'
import * as PostApi from '@/api/system/post'
import * as UserApi from '@/api/system/user'
import * as UserGroupApi from '@/api/bpm/userGroup'
const { t } = useI18n() //
const message = useMessage() //
const modelVisible = ref(false) //
const formLoading = ref(false) // 12
const formData = ref({
type: Number(undefined),
modelId: '',
options: [],
roleIds: [],
deptIds: [],
postIds: [],
userIds: [],
userGroupIds: [],
scripts: []
})
const formRules = reactive({
type: [{ required: true, message: '规则类型不能为空', trigger: 'change' }],
roleIds: [{ required: true, message: '指定角色不能为空', trigger: 'change' }],
deptIds: [{ required: true, message: '指定部门不能为空', trigger: 'change' }],
postIds: [{ required: true, message: '指定岗位不能为空', trigger: 'change' }],
userIds: [{ required: true, message: '指定用户不能为空', trigger: 'change' }],
userGroupIds: [{ required: true, message: '指定用户组不能为空', trigger: 'change' }],
scripts: [{ required: true, message: '指定脚本不能为空', trigger: 'change' }]
})
const formRef = ref() // Ref
const roleOptions = ref<RoleApi.RoleVO[]>([]) //
const deptOptions = ref<DeptApi.DeptVO[]>([]) //
const deptTreeOptions = ref() //
const postOptions = ref<PostApi.PostVO[]>([]) //
const userOptions = ref<UserApi.UserVO[]>([]) //
const userGroupOptions = ref<UserGroupApi.UserGroupVO[]>([]) //
const taskAssignScriptDictDatas = getIntDictOptions(DICT_TYPE.BPM_TASK_ASSIGN_SCRIPT)
/** 打开弹窗 */
const open = async (modelId: string, row: TaskAssignRuleApi.TaskAssignVO) => {
// 1.
resetForm()
// 2.
formData.value = {
...row,
modelId: modelId,
options: [],
roleIds: [],
deptIds: [],
postIds: [],
userIds: [],
userGroupIds: [],
scripts: []
}
// options roleIds
if (row.type === 10) {
formData.value.roleIds.push(...row.options)
} else if (row.type === 20 || row.type === 21) {
formData.value.deptIds.push(...row.options)
} else if (row.type === 22) {
formData.value.postIds.push(...row.options)
} else if (row.type === 30 || row.type === 31 || row.type === 32) {
formData.value.userIds.push(...row.options)
} else if (row.type === 40) {
formData.value.userGroupIds.push(...row.options)
} else if (row.type === 50) {
formData.value.scripts.push(...row.options)
}
//
modelVisible.value = true
//
roleOptions.value = await RoleApi.getSimpleRoleList()
//
deptOptions.value = await DeptApi.getSimpleDeptList()
deptTreeOptions.value = handleTree(deptOptions.value, 'id')
//
postOptions.value = await PostApi.getSimplePostList()
//
userOptions.value = await UserApi.getSimpleUserList()
//
userGroupOptions.value = await UserGroupApi.getSimpleUserGroupList()
}
defineExpose({ open }) // open
/** 提交表单 */
const emit = defineEmits(['success']) // success
const submitForm = async () => {
//
if (!formRef) return
const valid = await formRef.value.validate()
if (!valid) return
//
const form = {
...formData.value,
taskDefinitionName: undefined
}
// roleIds options
if (form.type === 10) {
form.options = form.roleIds
} else if (form.type === 20 || form.type === 21) {
form.options = form.deptIds
} else if (form.type === 22) {
form.options = form.postIds
} else if (form.type === 30 || form.type === 31 || form.type === 32) {
form.options = form.userIds
} else if (form.type === 40) {
form.options = form.userGroupIds
} else if (form.type === 50) {
form.options = form.scripts
}
form.roleIds = undefined
form.deptIds = undefined
form.postIds = undefined
form.userIds = undefined
form.userGroupIds = undefined
form.scripts = undefined
//
formLoading.value = true
try {
const data = form as unknown as TaskAssignRuleApi.TaskAssignVO
if (!data.id) {
await TaskAssignRuleApi.createTaskAssignRule(data)
message.success(t('common.createSuccess'))
} else {
await TaskAssignRuleApi.updateTaskAssignRule(data)
message.success(t('common.updateSuccess'))
}
modelVisible.value = false
//
emit('success')
} finally {
formLoading.value = false
}
}
/** 重置表单 */
const resetForm = () => {
formRef.value?.resetFields()
}
</script>

View File

@ -1,186 +1,73 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 列表 --> <el-table v-loading="loading" :data="list">
<XTable @register="registerTable" ref="xGrid"> <el-table-column label="任务名" align="center" prop="taskDefinitionName" />
<template #options_default="{ row }"> <el-table-column label="任务标识" align="center" prop="taskDefinitionKey" />
<span :key="option" v-for="option in row.options"> <el-table-column label="规则类型" align="center" prop="type">
<el-tag> <template #default="scope">
{{ getAssignRuleOptionName(row.type, option) }} <dict-tag :type="DICT_TYPE.BPM_TASK_ASSIGN_RULE_TYPE" :value="scope.row.type" />
</template>
</el-table-column>
<el-table-column label="规则范围" align="center" prop="options">
<template #default="scope">
<el-tag class="mr-5px" :key="option" v-for="option in scope.row.options">
{{ getAssignRuleOptionName(scope.row.type, option) }}
</el-tag> </el-tag>
&nbsp; </template>
</span> </el-table-column>
</template> <el-table-column v-if="queryParams.modelId" label="操作" align="center">
<!-- 操作 --> <template #default="scope">
<template #actionbtns_default="{ row }" v-if="modelId"> <el-button
<!-- 操作修改 --> link
<XTextButton type="primary"
preIcon="ep:edit" @click="openForm(scope.row)"
:title="t('action.edit')" v-hasPermi="['bpm:task-assign-rule:update']"
v-hasPermi="['bpm:task-assign-rule:update']" >
@click="handleUpdate(row)" 修改
/> </el-button>
</template> </template>
</XTable> </el-table-column>
</el-table>
<!-- 添加/修改弹窗 -->
<XModal v-model="dialogVisible" title="修改任务规则" width="800" height="35%">
<el-form ref="formRef" :model="formData" :rules="rules" label-width="80px">
<el-form-item label="任务名称" prop="taskDefinitionName">
<el-input v-model="formData.taskDefinitionName" placeholder="请输入流标标识" disabled />
</el-form-item>
<el-form-item label="任务标识" prop="taskDefinitionKey">
<el-input v-model="formData.taskDefinitionKey" placeholder="请输入任务标识" disabled />
</el-form-item>
<el-form-item label="规则类型" prop="type">
<el-select v-model="formData.type" clearable style="width: 100%">
<el-option
v-for="dict in getDictOptions(DICT_TYPE.BPM_TASK_ASSIGN_RULE_TYPE)"
:key="parseInt(dict.value)"
:label="dict.label"
:value="parseInt(dict.value)"
/>
</el-select>
</el-form-item>
<el-form-item v-if="formData.type === 10" label="指定角色" prop="roleIds">
<el-select v-model="formData.roleIds" multiple clearable style="width: 100%">
<el-option
v-for="item in roleOptions"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item
label="指定部门"
prop="deptIds"
span="24"
v-if="formData.type === 20 || formData.type === 21"
>
<el-tree-select
ref="treeRef"
v-model="formData.deptIds"
node-key="id"
show-checkbox
:props="defaultProps"
:data="deptTreeOptions"
empty-text="加载中,请稍后"
multiple
/>
</el-form-item>
<el-form-item label="指定岗位" prop="postIds" span="24" v-if="formData.type === 22">
<el-select v-model="formData.postIds" multiple clearable style="width: 100%">
<el-option
v-for="item in postOptions"
:key="parseInt(item.id)"
:label="item.name"
:value="parseInt(item.id)"
/>
</el-select>
</el-form-item>
<el-form-item
label="指定用户"
prop="userIds"
span="24"
v-if="formData.type === 30 || formData.type === 31 || formData.type === 32"
>
<el-select v-model="formData.userIds" multiple clearable style="width: 100%">
<el-option
v-for="item in userOptions"
:key="parseInt(item.id)"
:label="item.nickname"
:value="parseInt(item.id)"
/>
</el-select>
</el-form-item>
<el-form-item label="指定用户组" prop="userGroupIds" v-if="formData.type === 40">
<el-select v-model="formData.userGroupIds" multiple clearable style="width: 100%">
<el-option
v-for="item in userGroupOptions"
:key="parseInt(item.id)"
:label="item.name"
:value="parseInt(item.id)"
/>
</el-select>
</el-form-item>
<el-form-item label="指定脚本" prop="scripts" v-if="formData.type === 50">
<el-select v-model="formData.scripts" multiple clearable style="width: 100%">
<el-option
v-for="dict in taskAssignScriptDictDatas"
:key="parseInt(dict.value)"
:label="dict.label"
:value="parseInt(dict.value)"
/>
</el-select>
</el-form-item>
</el-form>
<!-- 操作按钮 -->
<template #footer>
<!-- 按钮保存 -->
<XButton
type="primary"
:title="t('action.save')"
:loading="actionLoading"
@click="submitForm"
/>
<!-- 按钮关闭 -->
<XButton
:loading="actionLoading"
:title="t('dialog.close')"
@click="dialogVisible = false"
/>
</template>
</XModal>
</ContentWrap> </ContentWrap>
<!-- 添加/修改弹窗 -->
<TaskAssignRuleForm ref="formRef" @success="getList" />
</template> </template>
<script setup lang="ts" name="TaskAssignRule"> <script setup lang="ts" name="TaskAssignRule">
// import import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import { FormInstance } from 'element-plus'
// import
import * as TaskAssignRuleApi from '@/api/bpm/taskAssignRule' import * as TaskAssignRuleApi from '@/api/bpm/taskAssignRule'
import { listSimpleRolesApi } from '@/api/system/role' import * as RoleApi from '@/api/system/role'
import { getSimplePostList } from '@/api/system/post' import * as DeptApi from '@/api/system/dept'
import { getSimpleUserList } from '@/api/system/user' import * as PostApi from '@/api/system/post'
import { listSimpleUserGroup } from '@/api/bpm/userGroup' import * as UserApi from '@/api/system/user'
import { listSimpleDeptApi } from '@/api/system/dept' import * as UserGroupApi from '@/api/bpm/userGroup'
import { DICT_TYPE, getDictOptions } from '@/utils/dict' import TaskAssignRuleForm from './TaskAssignRuleForm.vue'
import { handleTree, defaultProps } from '@/utils/tree' const { query } = useRoute() //
import { allSchemas, rules, idShowActionClick } from './taskAssignRule.data'
const { t } = useI18n() // const loading = ref(true) //
const message = useMessage() // const list = ref([]) //
const { query } = useRoute()
const xGrid = ref()
// ========== ==========
const roleOptions = ref() //
const deptOptions = ref() //
const deptTreeOptions = ref()
const postOptions = ref() //
const userOptions = ref() //
const userGroupOptions = ref() //
const taskAssignScriptDictDatas = getDictOptions(DICT_TYPE.BPM_TASK_ASSIGN_SCRIPT)
// modelId
const modelId = query.modelId
// processDefinitionId
const processDefinitionId = query.processDefinitionId
let isShow = idShowActionClick(modelId)
//
const queryParams = reactive({ const queryParams = reactive({
modelId: modelId, modelId: query.modelId, // modelId
processDefinitionId: processDefinitionId processDefinitionId: query.processDefinitionId // processDefinitionId
})
const [registerTable, { reload }] = useXTable({
allSchemas: allSchemas,
params: queryParams,
getListApi: TaskAssignRuleApi.getTaskAssignRuleList,
isList: true
}) })
const roleOptions = ref<RoleApi.RoleVO[]>([]) //
const deptOptions = ref<DeptApi.DeptVO[]>([]) //
const postOptions = ref<PostApi.PostVO[]>([]) //
const userOptions = ref<UserApi.UserVO[]>([]) //
const userGroupOptions = ref<UserGroupApi.UserGroupVO[]>([]) //
const taskAssignScriptDictDatas = getIntDictOptions(DICT_TYPE.BPM_TASK_ASSIGN_SCRIPT)
// /** 查询参数列表 */
const getList = async () => {
loading.value = true
try {
list.value = await TaskAssignRuleApi.getTaskAssignRuleList(queryParams)
} finally {
loading.value = false
}
}
/** 翻译规则范围 */
// TODO ts
const getAssignRuleOptionName = (type, option) => { const getAssignRuleOptionName = (type, option) => {
if (type === 10) { if (type === 10) {
for (const roleOption of roleOptions.value) { for (const roleOption of roleOptions.value) {
@ -223,136 +110,24 @@ const getAssignRuleOptionName = (type, option) => {
return '未知(' + option + ')' return '未知(' + option + ')'
} }
// ========== ========== /** 添加/修改操作 */
const formRef = ref()
// const openForm = (row: TaskAssignRuleApi.TaskAssignVO) => {
const actionLoading = ref(false) // formRef.value.open(queryParams.modelId, row)
const dialogVisible = ref(false) //
const formRef = ref<FormInstance>()
const formData = ref() //
//
const submitForm = async () => {
//
const elForm = unref(formRef)
if (!elForm) return
const valid = await elForm.validate()
if (!valid) return
//
let form = {
...formData.value,
taskDefinitionName: undefined
}
// roleIds options
if (form.type === 10) {
form.options = form.roleIds
} else if (form.type === 20 || form.type === 21) {
form.options = form.deptIds
} else if (form.type === 22) {
form.options = form.postIds
} else if (form.type === 30 || form.type === 31 || form.type === 32) {
form.options = form.userIds
} else if (form.type === 40) {
form.options = form.userGroupIds
} else if (form.type === 50) {
form.options = form.scripts
}
form.roleIds = undefined
form.deptIds = undefined
form.postIds = undefined
form.userIds = undefined
form.userGroupIds = undefined
form.scripts = undefined
//
actionLoading.value = true
//
try {
const data = form as TaskAssignRuleApi.TaskAssignVO
//
if (!data.id) {
await TaskAssignRuleApi.createTaskAssignRule(data)
message.success(t('common.createSuccess'))
//
} else {
await TaskAssignRuleApi.updateTaskAssignRule(data)
message.success(t('common.updateSuccess'))
}
dialogVisible.value = false
} finally {
actionLoading.value = false
//
await reload()
}
} }
// /** 初始化 */
const handleUpdate = (row) => { onMounted(async () => {
// 1. await getList()
formData.value = {}
// 2.
formData.value = {
...row,
modelId: modelId,
options: [],
roleIds: [],
deptIds: [],
postIds: [],
userIds: [],
userGroupIds: [],
scripts: []
}
// options roleIds
if (row.type === 10) {
formData.value.roleIds.push(...row.options)
} else if (row.type === 20 || row.type === 21) {
formData.value.deptIds.push(...row.options)
} else if (row.type === 22) {
formData.value.postIds.push(...row.options)
} else if (row.type === 30 || row.type === 31 || row.type === 32) {
formData.value.userIds.push(...row.options)
} else if (row.type === 40) {
formData.value.userGroupIds.push(...row.options)
} else if (row.type === 50) {
formData.value.scripts.push(...row.options)
}
//
dialogVisible.value = true
actionLoading.value = false
}
// ========== ==========
onMounted(() => {
// //
roleOptions.value = [] roleOptions.value = await RoleApi.getSimpleRoleList()
listSimpleRolesApi().then((data) => {
roleOptions.value.push(...data)
})
// //
deptOptions.value = [] deptOptions.value = await DeptApi.getSimpleDeptList()
deptTreeOptions.value = []
listSimpleDeptApi().then((data) => {
deptOptions.value.push(...data)
deptTreeOptions.value.push(...handleTree(data, 'id'))
})
// //
postOptions.value = [] postOptions.value = await PostApi.getSimplePostList()
getSimplePostList().then((data) => {
postOptions.value.push(...data)
})
// //
userOptions.value = [] userOptions.value = await UserApi.getSimpleUserList()
getSimpleUserList().then((data) => {
userOptions.value.push(...data)
})
// //
userGroupOptions.value = [] userGroupOptions.value = await UserGroupApi.getSimpleUserGroupList()
listSimpleUserGroup().then((data) => {
userGroupOptions.value.push(...data)
})
if (!isShow) {
setTimeout(() => {
xGrid.value.Ref.hideColumn('actionbtns')
}, 100)
}
}) })
</script> </script>

View File

@ -1,54 +0,0 @@
import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas'
// 表单校验
export const rules = reactive({
type: [{ required: true, message: '规则类型不能为空', trigger: 'change' }],
roleIds: [{ required: true, message: '指定角色不能为空', trigger: 'change' }],
deptIds: [{ required: true, message: '指定部门不能为空', trigger: 'change' }],
postIds: [{ required: true, message: '指定岗位不能为空', trigger: 'change' }],
userIds: [{ required: true, message: '指定用户不能为空', trigger: 'change' }],
userGroupIds: [{ required: true, message: '指定用户组不能为空', trigger: 'change' }],
scripts: [{ required: true, message: '指定脚本不能为空', trigger: 'change' }]
})
// CrudSchema
const crudSchemas = reactive<VxeCrudSchema>({
primaryKey: 'id',
primaryType: null,
action: true,
actionWidth: '200px',
columns: [
{
title: '任务名',
field: 'taskDefinitionName'
},
{
title: '任务标识',
field: 'taskDefinitionKey'
},
{
title: '规则类型',
field: 'type',
dictType: DICT_TYPE.BPM_TASK_ASSIGN_RULE_TYPE,
dictClass: 'number'
},
{
title: '规则范围',
field: 'options',
table: {
slots: {
default: 'options_default'
}
}
}
]
})
export const idShowActionClick = (modelId?: any) => {
if (modelId) {
return true
} else {
return false
}
}
export const { allSchemas } = useVxeCrudSchemas(crudSchemas)

View File

@ -166,7 +166,7 @@ const resetForm = () => {
/** 获得部门树 */ /** 获得部门树 */
const getTree = async () => { const getTree = async () => {
deptTree.value = [] deptTree.value = []
const data = await DeptApi.listSimpleDeptApi() const data = await DeptApi.getSimpleDeptList()
let dept: Tree = { id: 0, name: '顶级部门', children: [] } let dept: Tree = { id: 0, name: '顶级部门', children: [] }
dept.children = handleTree(data) dept.children = handleTree(data)
deptTree.value.push(dept) deptTree.value.push(dept)

View File

@ -165,7 +165,7 @@ import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import { rules, allSchemas } from './role.data' import { rules, allSchemas } from './role.data'
import * as RoleApi from '@/api/system/role' import * as RoleApi from '@/api/system/role'
import { listSimpleMenusApi } from '@/api/system/menu' import { listSimpleMenusApi } from '@/api/system/menu'
import { listSimpleDeptApi } from '@/api/system/dept' import { getSimpleDeptList } from '@/api/system/dept'
import * as PermissionApi from '@/api/system/permission' import * as PermissionApi from '@/api/system/permission'
const { t } = useI18n() // const { t } = useI18n() //
@ -278,7 +278,7 @@ const handleScope = async (type: string, row: RoleApi.RoleVO) => {
}) })
} }
} else if (type === 'data') { } else if (type === 'data') {
const deptRes = await listSimpleDeptApi() const deptRes = await getSimpleDeptList()
treeOptions.value = handleTree(deptRes) treeOptions.value = handleTree(deptRes)
const role = await RoleApi.getRoleApi(row.id) const role = await RoleApi.getRoleApi(row.id)
dataScopeForm.dataScope = role.dataScope dataScopeForm.dataScope = role.dataScope

View File

@ -271,8 +271,8 @@ import { getAccessToken, getTenantId } from '@/utils/auth'
import type { FormExpose } from '@/components/Form' import type { FormExpose } from '@/components/Form'
import { rules, allSchemas } from './user.data' import { rules, allSchemas } from './user.data'
import * as UserApi from '@/api/system/user' import * as UserApi from '@/api/system/user'
import { listSimpleDeptApi } from '@/api/system/dept' import { getSimpleDeptList } from '@/api/system/dept'
import { listSimpleRolesApi } from '@/api/system/role' import { getSimpleRoleList } from '@/api/system/role'
import { getSimplePostList, PostVO } from '@/api/system/post' import { getSimplePostList, PostVO } from '@/api/system/post'
import { import {
aassignUserRoleApi, aassignUserRoleApi,
@ -301,7 +301,7 @@ const filterText = ref('')
const deptOptions = ref<Tree[]>([]) // const deptOptions = ref<Tree[]>([]) //
const treeRef = ref<InstanceType<typeof ElTree>>() const treeRef = ref<InstanceType<typeof ElTree>>()
const getTree = async () => { const getTree = async () => {
const res = await listSimpleDeptApi() const res = await getSimpleDeptList()
deptOptions.value.push(...handleTree(res)) deptOptions.value.push(...handleTree(res))
} }
const filterNode = (value: string, data: Tree) => { const filterNode = (value: string, data: Tree) => {
@ -477,7 +477,7 @@ const handleRole = async (row: UserApi.UserVO) => {
const roles = await listUserRolesApi(row.id) const roles = await listUserRolesApi(row.id)
userRole.roleIds = roles userRole.roleIds = roles
// //
const roleOpt = await listSimpleRolesApi() const roleOpt = await getSimpleRoleList()
roleOptions.value = roleOpt roleOptions.value = roleOpt
roleDialogVisible.value = true roleDialogVisible.value = true
} }