Skip to content

Commit 17395a4

Browse files
YunaiVgitee-org
authored andcommitted
!66 修复了角色管理页面打不开及功能失效和其它的一些问题
Merge pull request !66 from puhui999/dev
2 parents 72ddb0c + c462bba commit 17395a4

File tree

11 files changed

+55
-56
lines changed

11 files changed

+55
-56
lines changed

src/api/system/role/index.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export interface UpdateStatusReqVO {
2323
}
2424

2525
// 查询角色列表
26-
export const getRolePageApi = async (params: RolePageReqVO) => {
26+
export const getRolePage = async (params: RolePageReqVO) => {
2727
return await request.get({ url: '/system/role/page', params })
2828
}
2929

@@ -33,26 +33,33 @@ export const getSimpleRoleList = async (): Promise<RoleVO[]> => {
3333
}
3434

3535
// 查询角色详情
36-
export const getRoleApi = async (id: number) => {
36+
export const getRole = async (id: number) => {
3737
return await request.get({ url: '/system/role/get?id=' + id })
3838
}
3939

4040
// 新增角色
41-
export const createRoleApi = async (data: RoleVO) => {
41+
export const createRole = async (data: RoleVO) => {
4242
return await request.post({ url: '/system/role/create', data })
4343
}
4444

4545
// 修改角色
46-
export const updateRoleApi = async (data: RoleVO) => {
46+
export const updateRole = async (data: RoleVO) => {
4747
return await request.put({ url: '/system/role/update', data })
4848
}
4949

5050
// 修改角色状态
51-
export const updateRoleStatusApi = async (data: UpdateStatusReqVO) => {
51+
export const updateRoleStatus = async (data: UpdateStatusReqVO) => {
5252
return await request.put({ url: '/system/role/update-status', data })
5353
}
5454

5555
// 删除角色
56-
export const deleteRoleApi = async (id: number) => {
56+
export const deleteRole = async (id: number) => {
5757
return await request.delete({ url: '/system/role/delete?id=' + id })
5858
}
59+
// 导出角色
60+
export const exportRole = (params) => {
61+
return request.download({
62+
url: '/system/role/export-excel',
63+
params
64+
})
65+
}

src/types/auto-components.d.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ declare module '@vue/runtime-core' {
5252
ElForm: typeof import('element-plus/es')['ElForm']
5353
ElFormItem: typeof import('element-plus/es')['ElFormItem']
5454
ElIcon: typeof import('element-plus/es')['ElIcon']
55-
ElImage: typeof import('element-plus/es')['ElImage']
5655
ElImageViewer: typeof import('element-plus/es')['ElImageViewer']
5756
ElInput: typeof import('element-plus/es')['ElInput']
5857
ElInputNumber: typeof import('element-plus/es')['ElInputNumber']
@@ -100,7 +99,6 @@ declare module '@vue/runtime-core' {
10099
ScriptTask: typeof import('./../components/bpmnProcessDesigner/package/penal/task/task-components/ScriptTask.vue')['default']
101100
Search: typeof import('./../components/Search/src/Search.vue')['default']
102101
SignalAndMessage: typeof import('./../components/bpmnProcessDesigner/package/penal/signal-message/SignalAndMessage.vue')['default']
103-
Src: typeof import('./../components/RightToolbar/src/index.vue')['default']
104102
Sticky: typeof import('./../components/Sticky/src/Sticky.vue')['default']
105103
Table: typeof import('./../components/Table/src/Table.vue')['default']
106104
Tooltip: typeof import('./../components/Tooltip/src/Tooltip.vue')['default']

src/views/system/role/MenuPermissionForm.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ import type { FormExpose } from '@/components/Form'
9696
import { handleTree, defaultProps } from '@/utils/tree'
9797
import { SystemDataScopeEnum } from '@/utils/constants'
9898
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
99-
import { listSimpleMenusApi } from '@/api/system/menu'
100-
import { listSimpleDeptApi } from '@/api/system/dept'
99+
import * as MenuApi from '@/api/system/menu'
100+
import * as DeptApi from '@/api/system/dept'
101101
import * as PermissionApi from '@/api/system/permission'
102102
// ========== CRUD 相关 ==========
103103
const actionLoading = ref(false) // 遮罩层
@@ -131,7 +131,7 @@ const openModal = async (type: string, row: RoleApi.RoleVO) => {
131131
actionScopeType.value = type
132132
dialogScopeVisible.value = true
133133
if (type === 'menu') {
134-
const menuRes = await listSimpleMenusApi()
134+
const menuRes = await MenuApi.getSimpleMenusList()
135135
treeOptions.value = handleTree(menuRes)
136136
const role = await PermissionApi.listRoleMenusApi(row.id)
137137
if (role) {
@@ -140,7 +140,7 @@ const openModal = async (type: string, row: RoleApi.RoleVO) => {
140140
})
141141
}
142142
} else if (type === 'data') {
143-
const deptRes = await listSimpleDeptApi()
143+
const deptRes = await DeptApi.getSimpleDeptList()
144144
treeOptions.value = handleTree(deptRes)
145145
const role = await RoleApi.getRole(row.id)
146146
dataScopeForm.dataScope = role.dataScope

src/views/system/role/RoleForm.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,11 @@
4444
<script setup lang="ts">
4545
import { getDictOptions } from '@/utils/dict'
4646
import { CommonStatusEnum } from '@/utils/constants'
47-
import type { FormExpose } from '@/components/Form'
4847
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
4948
import * as RoleApi from '@/api/system/role'
5049
// ========== CRUD 相关 ==========
5150
const dialogTitle = ref('edit') // 弹出层标题
52-
const formRef = ref<FormExpose>() // 表单 Ref
51+
const formRef = ref() // 表单 Ref
5352
const { t } = useI18n() // 国际化
5453
const dataScopeDictDatas = ref()
5554
const message = useMessage() // 消息弹窗
@@ -97,6 +96,7 @@ const resetForm = () => {
9796
formData.value = {
9897
id: undefined,
9998
name: '',
99+
type: '',
100100
code: '',
101101
sort: undefined,
102102
status: CommonStatusEnum.ENABLE,

src/views/system/role/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ const handleExport = async () => {
228228
await message.exportConfirm()
229229
// 发起导出
230230
exportLoading.value = true
231-
const data = await RoleApi.exportPostApi(queryParams)
231+
const data = await RoleApi.exportRole(queryParams)
232232
download.excel(data, '角色列表.xls')
233233
} catch {
234234
} finally {

src/views/system/sms/template/SmsTemplateForm.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
<el-radio
4545
v-for="dict in getIntDictOptions(DICT_TYPE.COMMON_STATUS)"
4646
:key="dict.value"
47-
:label="parseInt(dict.value)"
47+
:label="parseInt(dict.value as string)"
4848
>
4949
{{ dict.label }}
5050
</el-radio>
@@ -96,7 +96,7 @@ const formRules = reactive({
9696
channelId: [{ required: true, message: '短信渠道编号不能为空', trigger: 'change' }]
9797
})
9898
const formRef = ref() // 表单 Ref
99-
const channelList = ref([]) // 短信渠道列表
99+
const channelList = ref<SmsChannelApi.SmsChannelVO[]>([]) // 短信渠道列表
100100
101101
const open = async (type: string, id?: number) => {
102102
modelVisible.value = true

src/views/system/sms/template/index.vue

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,7 @@
166166
width="180"
167167
:formatter="dateFormatter"
168168
/>
169-
<el-table-column
170-
label="操作"
171-
align="center"
172-
width="210"
173-
fixed="right"
174-
>
169+
<el-table-column label="操作" align="center" width="210" fixed="right">
175170
<template #default="scope">
176171
<el-button
177172
link
@@ -241,7 +236,7 @@ const queryParams = reactive({
241236
createTime: []
242237
})
243238
const exportLoading = ref(false) // 导出的加载中
244-
const channelList = ref([]) // 短信渠道列表
239+
const channelList = ref<SmsChannelApi.SmsChannelVO[]>([]) // 短信渠道列表
245240
246241
/** 查询列表 */
247242
const getList = async () => {

src/views/system/user/index.vue

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -332,26 +332,24 @@ const getPostOptions = async () => {
332332
const res = await getSimplePostList()
333333
postOptions.value.push(...res)
334334
}
335-
const dataFormater = (val) => {
336-
return deptFormater(deptOptions.value, val)
337-
}
335+
const dataFormater = computed(() => (deptId: number) => deptFormater(deptOptions.value, deptId))
336+
338337
//部门回显
339-
const deptFormater = (ary, val: any) => {
340-
var o = ''
341-
if (ary && val) {
342-
for (const v of ary) {
343-
if (v.id == val) {
344-
o = v.name
345-
if (o) return o
346-
} else if (v.children?.length) {
347-
o = deptFormater(v.children, val)
348-
if (o) return o
338+
const deptFormater = (arr: Tree[], deptId: number) => {
339+
let deptName = ''
340+
if (arr && deptId) {
341+
for (const item of arr) {
342+
if (item.id === deptId) {
343+
deptName = item.name
344+
break
345+
}
346+
if (item.children) {
347+
deptName = deptFormater(item.children, deptId) ?? ''
348+
break
349349
}
350350
}
351-
return o
352-
} else {
353-
return val
354351
}
352+
return deptName
355353
}
356354
357355
// 设置标题

types/components.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
declare module 'vue' {
22
export interface GlobalComponents {
3-
Icon: typeof import('../components/Icon/src/Icon.vue')['default']
3+
Icon: typeof import('@/components/Icon')['Icon']
4+
DictTag: typeof import('@/components/DictTag')['DictTag']
45
}
56
}
67

types/global.d.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
export {}
22
declare global {
3-
declare interface Fn<T = any> {
3+
interface Fn<T = any> {
44
(...arg: T[]): T
55
}
66

7-
declare type Nullable<T> = T | null
7+
type Nullable<T> = T | null
88

9-
declare type ElRef<T extends HTMLElement = HTMLDivElement> = Nullable<T>
9+
type ElRef<T extends HTMLElement = HTMLDivElement> = Nullable<T>
1010

11-
declare type Recordable<T = any, K = string> = Record<K extends null | undefined ? string : K, T>
11+
type Recordable<T = any, K = string> = Record<K extends null | undefined ? string : K, T>
1212

13-
declare type ComponentRef<T> = InstanceType<T>
13+
type ComponentRef<T> = InstanceType<T>
1414

15-
declare type LocaleType = 'zh-CN' | 'en'
15+
type LocaleType = 'zh-CN' | 'en'
1616

17-
declare type AxiosHeaders =
17+
type AxiosHeaders =
1818
| 'application/json'
1919
| 'application/x-www-form-urlencoded'
2020
| 'multipart/form-data'
2121

22-
declare type AxiosMethod = 'get' | 'post' | 'delete' | 'put' | 'GET' | 'POST' | 'DELETE' | 'PUT'
22+
type AxiosMethod = 'get' | 'post' | 'delete' | 'put' | 'GET' | 'POST' | 'DELETE' | 'PUT'
2323

24-
declare type AxiosResponseType = 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream'
24+
type AxiosResponseType = 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream'
2525

26-
declare interface AxiosConfig {
26+
interface AxiosConfig {
2727
params?: any
2828
data?: any
2929
url?: string
@@ -32,17 +32,17 @@ declare global {
3232
responseType?: AxiosResponseType
3333
}
3434

35-
declare interface IResponse<T = any> {
35+
interface IResponse<T = any> {
3636
code: string
3737
data: T extends any ? T : T & any
3838
}
3939

40-
declare interface PageParam {
40+
interface PageParam {
4141
pageSize?: number
4242
pageNo?: number
4343
}
4444

45-
declare interface Tree {
45+
interface Tree {
4646
id: number
4747
name: string
4848
children?: Tree[] | any[]

0 commit comments

Comments
 (0)