Commit d485b8289dcdca5f6a3bb1e897f817e2a247b03d
1 parent
c40076c5
fix
Showing
16 changed files
with
95 additions
and
95 deletions
yudao-ui-admin-vue3/src/hooks/web/useVxeCrudSchemas.ts
| ... | ... | @@ -15,12 +15,10 @@ import { FormSchema } from '@/types/form' |
| 15 | 15 | import { ComponentOptions } from '@/types/components' |
| 16 | 16 | |
| 17 | 17 | export type VxeCrudSchema = { |
| 18 | - // 主键ID | |
| 19 | - primaryKey?: string | |
| 20 | - primaryType?: VxeColumnPropTypes.Type | |
| 21 | - // 是否开启操作栏插槽 | |
| 22 | - action?: boolean | |
| 23 | - actionWidth?: string | |
| 18 | + primaryKey?: string // 主键ID | |
| 19 | + primaryType?: VxeColumnPropTypes.Type // 不填写为数据库编号 还支持 "seq" | "radio" | "checkbox" | "expand" | "html" | null | |
| 20 | + action?: boolean // 是否开启操作栏插槽 | |
| 21 | + actionWidth?: string // 操作栏插槽宽度,一般1个 text 类型按钮 60-80 | |
| 24 | 22 | columns: VxeCrudColumns[] |
| 25 | 23 | } |
| 26 | 24 | type VxeCrudColumns = Omit<VxeTableColumn, 'children'> & { |
| ... | ... | @@ -173,7 +171,7 @@ const filterTableSchema = (crudSchema: VxeCrudSchema): VxeGridPropTypes.Columns |
| 173 | 171 | const tableSchemaItem = { |
| 174 | 172 | title: t('common.index'), |
| 175 | 173 | field: crudSchema.primaryKey, |
| 176 | - type: crudSchema.primaryType ? crudSchema.primaryType : 'seq', | |
| 174 | + type: crudSchema.primaryType ? crudSchema.primaryType : null, | |
| 177 | 175 | width: '50px' |
| 178 | 176 | } |
| 179 | 177 | tableSchema.push(tableSchemaItem) | ... | ... |
yudao-ui-admin-vue3/src/hooks/web/useVxeGrid.ts
| ... | ... | @@ -12,7 +12,7 @@ const message = useMessage() // 消息弹窗 |
| 12 | 12 | interface UseVxeGridConfig<T = any> { |
| 13 | 13 | allSchemas: VxeAllSchemas |
| 14 | 14 | getListApi: (option: any) => Promise<T> |
| 15 | - delListApi?: (option: any) => Promise<T> | |
| 15 | + deleteApi?: (option: any) => Promise<T> | |
| 16 | 16 | exportListApi?: (option: any) => Promise<T> |
| 17 | 17 | exportName?: string |
| 18 | 18 | } |
| ... | ... | @@ -150,12 +150,12 @@ export const useVxeGrid = <T = any>(config?: UseVxeGridConfig<T>) => { |
| 150 | 150 | * @param ids rowid |
| 151 | 151 | * @returns |
| 152 | 152 | */ |
| 153 | - const delList = async (ref, ids: string | number | string[] | number[]) => { | |
| 153 | + const deleteData = async (ref, ids: string | number) => { | |
| 154 | 154 | if (!ref) { |
| 155 | 155 | console.error('未传入gridRef') |
| 156 | 156 | return |
| 157 | 157 | } |
| 158 | - if (!config?.delListApi) { | |
| 158 | + if (!config?.deleteApi) { | |
| 159 | 159 | console.error('未传入delListApi') |
| 160 | 160 | return |
| 161 | 161 | } |
| ... | ... | @@ -164,7 +164,7 @@ export const useVxeGrid = <T = any>(config?: UseVxeGridConfig<T>) => { |
| 164 | 164 | message |
| 165 | 165 | .delConfirm() |
| 166 | 166 | .then(() => { |
| 167 | - config?.delListApi && config?.delListApi(ids) | |
| 167 | + config?.deleteApi && config?.deleteApi(ids) | |
| 168 | 168 | message.success(t('common.delSuccess')) |
| 169 | 169 | }) |
| 170 | 170 | .finally(async () => { |
| ... | ... | @@ -216,7 +216,7 @@ export const useVxeGrid = <T = any>(config?: UseVxeGridConfig<T>) => { |
| 216 | 216 | gridOptions, |
| 217 | 217 | reloadList, |
| 218 | 218 | getSearchData, |
| 219 | - delList, | |
| 219 | + deleteData, | |
| 220 | 220 | exportList, |
| 221 | 221 | zoom |
| 222 | 222 | } | ... | ... |
yudao-ui-admin-vue3/src/views/bpm/group/index.vue
| ... | ... | @@ -10,7 +10,7 @@ import type { UserGroupVO } from '@/api/bpm/userGroup/types' |
| 10 | 10 | import { rules, allSchemas } from './group.data' |
| 11 | 11 | import * as UserGroupApi from '@/api/bpm/userGroup' |
| 12 | 12 | import { getListSimpleUsersApi } from '@/api/system/user' |
| 13 | -import { UserVO } from '@/api/system/user/types' | |
| 13 | +import { UserVO } from '@/api/system/user' | |
| 14 | 14 | |
| 15 | 15 | const { t } = useI18n() // 国际化 |
| 16 | 16 | ... | ... |
yudao-ui-admin-vue3/src/views/system/errorCode/index.vue
| ... | ... | @@ -83,10 +83,10 @@ const { t } = useI18n() // 国际化 |
| 83 | 83 | const message = useMessage() // 消息弹窗 |
| 84 | 84 | // 列表相关的变量 |
| 85 | 85 | const xGrid = ref<VxeGridInstance>() // grid Ref |
| 86 | -const { gridOptions, reloadList, delList } = useVxeGrid<ErrorCodeApi.ErrorCodeVO>({ | |
| 86 | +const { gridOptions, reloadList, deleteData } = useVxeGrid<ErrorCodeApi.ErrorCodeVO>({ | |
| 87 | 87 | allSchemas: allSchemas, |
| 88 | 88 | getListApi: ErrorCodeApi.getErrorCodePageApi, |
| 89 | - delListApi: ErrorCodeApi.deleteErrorCodeApi | |
| 89 | + deleteApi: ErrorCodeApi.deleteErrorCodeApi | |
| 90 | 90 | }) |
| 91 | 91 | // 弹窗相关的变量 |
| 92 | 92 | const dialogVisible = ref(false) // 是否显示弹出层 |
| ... | ... | @@ -110,23 +110,23 @@ const handleCreate = () => { |
| 110 | 110 | |
| 111 | 111 | // 修改操作 |
| 112 | 112 | const handleUpdate = async (rowId: number) => { |
| 113 | - setDialogTile('update') | |
| 114 | 113 | // 设置数据 |
| 115 | 114 | const res = await ErrorCodeApi.getErrorCodeApi(rowId) |
| 116 | 115 | unref(formRef)?.setValues(res) |
| 116 | + setDialogTile('update') | |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | // 详情操作 |
| 120 | 120 | const handleDetail = async (rowId: number) => { |
| 121 | - setDialogTile('detail') | |
| 122 | 121 | // 设置数据 |
| 123 | 122 | const res = await ErrorCodeApi.getErrorCodeApi(rowId) |
| 124 | 123 | detailRef.value = res |
| 124 | + setDialogTile('detail') | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | // 删除操作 |
| 128 | 128 | const handleDelete = async (rowId: number) => { |
| 129 | - delList(xGrid, rowId) | |
| 129 | + await deleteData(xGrid, rowId) | |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | // 提交新增/修改的表单 |
| ... | ... | @@ -150,7 +150,7 @@ const submitForm = async () => { |
| 150 | 150 | } finally { |
| 151 | 151 | actionLoading.value = false |
| 152 | 152 | // 刷新列表 |
| 153 | - reloadList(xGrid) | |
| 153 | + await reloadList(xGrid) | |
| 154 | 154 | } |
| 155 | 155 | } |
| 156 | 156 | }) | ... | ... |
yudao-ui-admin-vue3/src/views/system/loginlog/index.vue
yudao-ui-admin-vue3/src/views/system/notice/index.vue
| ... | ... | @@ -82,10 +82,10 @@ const { t } = useI18n() // 国际化 |
| 82 | 82 | const message = useMessage() // 消息弹窗 |
| 83 | 83 | // 列表相关的变量 |
| 84 | 84 | const xGrid = ref<VxeGridInstance>() // 列表 Grid Ref |
| 85 | -const { gridOptions, reloadList, delList } = useVxeGrid<NoticeApi.NoticeVO>({ | |
| 85 | +const { gridOptions, reloadList, deleteData } = useVxeGrid<NoticeApi.NoticeVO>({ | |
| 86 | 86 | allSchemas: allSchemas, |
| 87 | 87 | getListApi: NoticeApi.getNoticePageApi, |
| 88 | - delListApi: NoticeApi.deleteNoticeApi | |
| 88 | + deleteApi: NoticeApi.deleteNoticeApi | |
| 89 | 89 | }) |
| 90 | 90 | // 弹窗相关的变量 |
| 91 | 91 | const dialogVisible = ref(false) // 是否显示弹出层 |
| ... | ... | @@ -109,23 +109,23 @@ const handleCreate = () => { |
| 109 | 109 | |
| 110 | 110 | // 修改操作 |
| 111 | 111 | const handleUpdate = async (rowId: number) => { |
| 112 | - setDialogTile('update') | |
| 113 | 112 | // 设置数据 |
| 114 | 113 | const res = await NoticeApi.getNoticeApi(rowId) |
| 115 | 114 | unref(formRef)?.setValues(res) |
| 115 | + setDialogTile('update') | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | // 详情操作 |
| 119 | 119 | const handleDetail = async (rowId: number) => { |
| 120 | - setDialogTile('detail') | |
| 121 | 120 | // 设置数据 |
| 122 | 121 | const res = await NoticeApi.getNoticeApi(rowId) |
| 123 | 122 | detailRef.value = res |
| 123 | + setDialogTile('detail') | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | // 删除操作 |
| 127 | 127 | const handleDelete = async (rowId: number) => { |
| 128 | - delList(xGrid, rowId) | |
| 128 | + await deleteData(xGrid, rowId) | |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | // 提交新增/修改的表单 |
| ... | ... | @@ -148,8 +148,7 @@ const submitForm = async () => { |
| 148 | 148 | dialogVisible.value = false |
| 149 | 149 | } finally { |
| 150 | 150 | actionLoading.value = false |
| 151 | - // 刷新列表 TODO 星语:这里要有个 await | |
| 152 | - reloadList(xGrid) | |
| 151 | + await reloadList(xGrid) | |
| 153 | 152 | } |
| 154 | 153 | } |
| 155 | 154 | }) | ... | ... |
yudao-ui-admin-vue3/src/views/system/oauth2/client/index.vue
| ... | ... | @@ -94,10 +94,10 @@ const message = useMessage() // 消息弹窗 |
| 94 | 94 | |
| 95 | 95 | // 列表相关的变量 |
| 96 | 96 | const xGrid = ref<VxeGridInstance>() // 列表 Grid Ref |
| 97 | -const { gridOptions, reloadList, delList } = useVxeGrid<ClientApi.OAuth2ClientVO>({ | |
| 97 | +const { gridOptions, reloadList, deleteData } = useVxeGrid<ClientApi.OAuth2ClientVO>({ | |
| 98 | 98 | allSchemas: allSchemas, |
| 99 | 99 | getListApi: ClientApi.getOAuth2ClientPageApi, |
| 100 | - delListApi: ClientApi.deleteOAuth2ClientApi | |
| 100 | + deleteApi: ClientApi.deleteOAuth2ClientApi | |
| 101 | 101 | }) |
| 102 | 102 | // 弹窗相关的变量 |
| 103 | 103 | const dialogVisible = ref(false) // 是否显示弹出层 |
| ... | ... | @@ -121,22 +121,22 @@ const handleCreate = () => { |
| 121 | 121 | |
| 122 | 122 | // 修改操作 |
| 123 | 123 | const handleUpdate = async (rowId: number) => { |
| 124 | - setDialogTile('update') | |
| 125 | 124 | // 设置数据 |
| 126 | 125 | const res = await ClientApi.getOAuth2ClientApi(rowId) |
| 127 | 126 | unref(formRef)?.setValues(res) |
| 127 | + setDialogTile('update') | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | // 详情操作 |
| 131 | 131 | const handleDetail = async (rowId: number) => { |
| 132 | - setDialogTile('detail') | |
| 133 | 132 | const res = await ClientApi.getOAuth2ClientApi(rowId) |
| 134 | 133 | detailRef.value = res |
| 134 | + setDialogTile('detail') | |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | // 删除操作 |
| 138 | 138 | const handleDelete = async (rowId: number) => { |
| 139 | - delList(xGrid, rowId) | |
| 139 | + await deleteData(xGrid, rowId) | |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | // 提交新增/修改的表单 |
| ... | ... | @@ -160,7 +160,7 @@ const submitForm = async () => { |
| 160 | 160 | } finally { |
| 161 | 161 | actionLoading.value = false |
| 162 | 162 | // 刷新列表 |
| 163 | - reloadList(xGrid) | |
| 163 | + await reloadList(xGrid) | |
| 164 | 164 | } |
| 165 | 165 | } |
| 166 | 166 | }) | ... | ... |
yudao-ui-admin-vue3/src/views/system/oauth2/token/index.vue
| ... | ... | @@ -63,9 +63,9 @@ const handleForceLogout = (rowId: number) => { |
| 63 | 63 | await TokenApi.deleteAccessTokenApi(rowId) |
| 64 | 64 | message.success(t('common.success')) |
| 65 | 65 | }) |
| 66 | - .finally(() => { | |
| 66 | + .finally(async () => { | |
| 67 | 67 | // 刷新列表 |
| 68 | - reloadList(xGrid) | |
| 68 | + await reloadList(xGrid) | |
| 69 | 69 | }) |
| 70 | 70 | } |
| 71 | 71 | </script> | ... | ... |
yudao-ui-admin-vue3/src/views/system/operatelog/index.vue
yudao-ui-admin-vue3/src/views/system/post/index.vue
| ... | ... | @@ -46,7 +46,7 @@ |
| 46 | 46 | </vxe-grid> |
| 47 | 47 | </ContentWrap> |
| 48 | 48 | <!-- 弹窗 --> |
| 49 | - <XModal id="postModel" v-model="dialogVisible" :title="dialogTitle"> | |
| 49 | + <XModal id="postModel" :loading="modelLoading" v-model="modelVisible" :title="modelTitle"> | |
| 50 | 50 | <!-- 表单:添加/修改 --> |
| 51 | 51 | <Form |
| 52 | 52 | ref="formRef" |
| ... | ... | @@ -70,7 +70,7 @@ |
| 70 | 70 | @click="submitForm()" |
| 71 | 71 | /> |
| 72 | 72 | <!-- 按钮:关闭 --> |
| 73 | - <XButton :loading="actionLoading" :title="t('dialog.close')" @click="dialogVisible = false" /> | |
| 73 | + <XButton :loading="actionLoading" :title="t('dialog.close')" @click="modelVisible = false" /> | |
| 74 | 74 | </template> |
| 75 | 75 | </XModal> |
| 76 | 76 | </template> |
| ... | ... | @@ -90,15 +90,16 @@ const { t } = useI18n() // 国际化 |
| 90 | 90 | const message = useMessage() // 消息弹窗 |
| 91 | 91 | // 列表相关的变量 |
| 92 | 92 | const xGrid = ref<VxeGridInstance>() // 列表 Grid Ref |
| 93 | -const { gridOptions, reloadList, delList, exportList } = useVxeGrid<PostApi.PostVO>({ | |
| 93 | +const { gridOptions, reloadList, deleteData, exportList } = useVxeGrid<PostApi.PostVO>({ | |
| 94 | 94 | allSchemas: allSchemas, |
| 95 | 95 | getListApi: PostApi.getPostPageApi, |
| 96 | - delListApi: PostApi.deletePostApi, | |
| 96 | + deleteApi: PostApi.deletePostApi, | |
| 97 | 97 | exportListApi: PostApi.exportPostApi |
| 98 | 98 | }) |
| 99 | 99 | // 弹窗相关的变量 |
| 100 | -const dialogVisible = ref(false) // 是否显示弹出层 | |
| 101 | -const dialogTitle = ref('edit') // 弹出层标题 | |
| 100 | +const modelVisible = ref(false) // 是否显示弹出层 | |
| 101 | +const modelTitle = ref('edit') // 弹出层标题 | |
| 102 | +const modelLoading = ref(false) // 弹出层loading | |
| 102 | 103 | const actionType = ref('') // 操作按钮的类型 |
| 103 | 104 | const actionLoading = ref(false) // 按钮 Loading |
| 104 | 105 | const formRef = ref<FormExpose>() // 表单 Ref |
| ... | ... | @@ -106,27 +107,29 @@ const detailData = ref() // 详情 Ref |
| 106 | 107 | |
| 107 | 108 | // 设置标题 |
| 108 | 109 | const setDialogTile = (type: string) => { |
| 109 | - dialogTitle.value = t('action.' + type) | |
| 110 | + modelLoading.value = true | |
| 111 | + modelTitle.value = t('action.' + type) | |
| 110 | 112 | actionType.value = type |
| 111 | - dialogVisible.value = true | |
| 113 | + modelVisible.value = true | |
| 112 | 114 | } |
| 113 | 115 | |
| 114 | 116 | // 新增操作 |
| 115 | 117 | const handleCreate = () => { |
| 116 | 118 | setDialogTile('create') |
| 119 | + modelLoading.value = false | |
| 117 | 120 | } |
| 118 | 121 | |
| 119 | 122 | // 导出操作 |
| 120 | 123 | const handleExport = async () => { |
| 121 | 124 | await exportList(xGrid, '岗位列表.xls') |
| 122 | 125 | } |
| 123 | - | |
| 124 | 126 | // 修改操作 |
| 125 | 127 | const handleUpdate = async (rowId: number) => { |
| 126 | 128 | setDialogTile('update') |
| 127 | 129 | // 设置数据 |
| 128 | 130 | const res = await PostApi.getPostApi(rowId) |
| 129 | 131 | unref(formRef)?.setValues(res) |
| 132 | + modelLoading.value = false | |
| 130 | 133 | } |
| 131 | 134 | |
| 132 | 135 | // 详情操作 |
| ... | ... | @@ -134,11 +137,12 @@ const handleDetail = async (rowId: number) => { |
| 134 | 137 | setDialogTile('detail') |
| 135 | 138 | const res = await PostApi.getPostApi(rowId) |
| 136 | 139 | detailData.value = res |
| 140 | + modelLoading.value = false | |
| 137 | 141 | } |
| 138 | 142 | |
| 139 | 143 | // 删除操作 |
| 140 | 144 | const handleDelete = async (rowId: number) => { |
| 141 | - await delList(xGrid, rowId) | |
| 145 | + await deleteData(xGrid, rowId) | |
| 142 | 146 | } |
| 143 | 147 | |
| 144 | 148 | // 提交新增/修改的表单 |
| ... | ... | @@ -158,11 +162,11 @@ const submitForm = async () => { |
| 158 | 162 | await PostApi.updatePostApi(data) |
| 159 | 163 | message.success(t('common.updateSuccess')) |
| 160 | 164 | } |
| 161 | - dialogVisible.value = false | |
| 165 | + modelVisible.value = false | |
| 162 | 166 | } finally { |
| 163 | 167 | actionLoading.value = false |
| 164 | 168 | // 刷新列表 |
| 165 | - reloadList(xGrid) | |
| 169 | + await reloadList(xGrid) | |
| 166 | 170 | } |
| 167 | 171 | } |
| 168 | 172 | }) | ... | ... |
yudao-ui-admin-vue3/src/views/system/post/post.data.ts
yudao-ui-admin-vue3/src/views/system/role/index.vue
| ... | ... | @@ -174,10 +174,10 @@ const { t } = useI18n() // 国际化 |
| 174 | 174 | const message = useMessage() // 消息弹窗 |
| 175 | 175 | // 列表相关的变量 |
| 176 | 176 | const xGrid = ref<VxeGridInstance>() // 列表 Grid Ref |
| 177 | -const { gridOptions, reloadList, delList } = useVxeGrid<RoleApi.RoleVO>({ | |
| 177 | +const { gridOptions, reloadList, deleteData } = useVxeGrid<RoleApi.RoleVO>({ | |
| 178 | 178 | allSchemas: allSchemas, |
| 179 | 179 | getListApi: RoleApi.getRolePageApi, |
| 180 | - delListApi: RoleApi.deleteRoleApi | |
| 180 | + deleteApi: RoleApi.deleteRoleApi | |
| 181 | 181 | }) |
| 182 | 182 | |
| 183 | 183 | // ========== CRUD 相关 ========== |
| ... | ... | @@ -202,15 +202,23 @@ const handleCreate = () => { |
| 202 | 202 | |
| 203 | 203 | // 修改操作 |
| 204 | 204 | const handleUpdate = async (rowId: number) => { |
| 205 | - setDialogTile('update') | |
| 206 | 205 | // 设置数据 |
| 207 | 206 | const res = await RoleApi.getRoleApi(rowId) |
| 208 | 207 | unref(formRef)?.setValues(res) |
| 208 | + setDialogTile('update') | |
| 209 | +} | |
| 210 | + | |
| 211 | +// 详情操作 | |
| 212 | +const handleDetail = async (rowId: number) => { | |
| 213 | + // 设置数据 | |
| 214 | + const res = await RoleApi.getRoleApi(rowId) | |
| 215 | + detailRef.value = res | |
| 216 | + setDialogTile('detail') | |
| 209 | 217 | } |
| 210 | 218 | |
| 211 | 219 | // 删除操作 |
| 212 | 220 | const handleDelete = async (rowId: number) => { |
| 213 | - await delList(xGrid, rowId) | |
| 221 | + await deleteData(xGrid, rowId) | |
| 214 | 222 | } |
| 215 | 223 | |
| 216 | 224 | // 提交按钮 |
| ... | ... | @@ -234,20 +242,12 @@ const submitForm = async () => { |
| 234 | 242 | } finally { |
| 235 | 243 | actionLoading.value = false |
| 236 | 244 | // 刷新列表 |
| 237 | - reloadList(xGrid) | |
| 245 | + await reloadList(xGrid) | |
| 238 | 246 | } |
| 239 | 247 | } |
| 240 | 248 | }) |
| 241 | 249 | } |
| 242 | 250 | |
| 243 | -// 详情操作 | |
| 244 | -const handleDetail = async (rowId: number) => { | |
| 245 | - setDialogTile('detail') | |
| 246 | - // 设置数据 | |
| 247 | - const res = await RoleApi.getRoleApi(rowId) | |
| 248 | - detailRef.value = res | |
| 249 | -} | |
| 250 | - | |
| 251 | 251 | // ========== 数据权限 ========== |
| 252 | 252 | const dataScopeForm = reactive({ |
| 253 | 253 | id: 0, | ... | ... |
yudao-ui-admin-vue3/src/views/system/sms/smsChannel/index.vue
| ... | ... | @@ -85,10 +85,10 @@ const message = useMessage() // 消息弹窗 |
| 85 | 85 | |
| 86 | 86 | // 列表相关的变量 |
| 87 | 87 | const xGrid = ref<VxeGridInstance>() // 列表 Grid Ref |
| 88 | -const { gridOptions, reloadList, delList } = useVxeGrid<SmsChannelApi.SmsChannelVO>({ | |
| 88 | +const { gridOptions, reloadList, deleteData } = useVxeGrid<SmsChannelApi.SmsChannelVO>({ | |
| 89 | 89 | allSchemas: allSchemas, |
| 90 | 90 | getListApi: SmsChannelApi.getSmsChannelPageApi, |
| 91 | - delListApi: SmsChannelApi.deleteSmsChannelApi | |
| 91 | + deleteApi: SmsChannelApi.deleteSmsChannelApi | |
| 92 | 92 | }) |
| 93 | 93 | |
| 94 | 94 | // 弹窗相关的变量 |
| ... | ... | @@ -113,22 +113,22 @@ const handleCreate = () => { |
| 113 | 113 | |
| 114 | 114 | // 修改操作 |
| 115 | 115 | const handleUpdate = async (rowId: number) => { |
| 116 | - setDialogTile('update') | |
| 117 | 116 | // 设置数据 |
| 118 | 117 | const res = await SmsChannelApi.getSmsChannelApi(rowId) |
| 119 | 118 | unref(formRef)?.setValues(res) |
| 119 | + setDialogTile('update') | |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | // 详情操作 |
| 123 | 123 | const handleDetail = async (rowId: number) => { |
| 124 | - setDialogTile('detail') | |
| 125 | 124 | const res = await SmsChannelApi.getSmsChannelApi(rowId) |
| 126 | 125 | detailData.value = res |
| 126 | + setDialogTile('detail') | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | // 删除操作 |
| 130 | 130 | const handleDelete = async (rowId: number) => { |
| 131 | - await delList(xGrid, rowId) | |
| 131 | + await deleteData(xGrid, rowId) | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | // 提交按钮 |
| ... | ... | @@ -152,7 +152,7 @@ const submitForm = async () => { |
| 152 | 152 | } finally { |
| 153 | 153 | actionLoading.value = false |
| 154 | 154 | // 刷新列表 |
| 155 | - reloadList(xGrid) | |
| 155 | + await reloadList(xGrid) | |
| 156 | 156 | } |
| 157 | 157 | } |
| 158 | 158 | }) | ... | ... |
yudao-ui-admin-vue3/src/views/system/sms/smsTemplate/index.vue
| ... | ... | @@ -127,10 +127,10 @@ const message = useMessage() // 消息弹窗 |
| 127 | 127 | |
| 128 | 128 | // 列表相关的变量 |
| 129 | 129 | const xGrid = ref<VxeGridInstance>() // 列表 Grid Ref |
| 130 | -const { gridOptions, reloadList, delList } = useVxeGrid<SmsTemplateApi.SmsTemplateVO>({ | |
| 130 | +const { gridOptions, reloadList, deleteData } = useVxeGrid<SmsTemplateApi.SmsTemplateVO>({ | |
| 131 | 131 | allSchemas: allSchemas, |
| 132 | 132 | getListApi: SmsTemplateApi.getSmsTemplatePageApi, |
| 133 | - delListApi: SmsTemplateApi.deleteSmsTemplateApi | |
| 133 | + deleteApi: SmsTemplateApi.deleteSmsTemplateApi | |
| 134 | 134 | }) |
| 135 | 135 | |
| 136 | 136 | // 弹窗相关的变量 |
| ... | ... | @@ -155,23 +155,23 @@ const handleCreate = () => { |
| 155 | 155 | |
| 156 | 156 | // 修改操作 |
| 157 | 157 | const handleUpdate = async (rowId: number) => { |
| 158 | - setDialogTile('update') | |
| 159 | 158 | // 设置数据 |
| 160 | 159 | const res = await SmsTemplateApi.getSmsTemplateApi(rowId) |
| 161 | 160 | unref(formRef)?.setValues(res) |
| 161 | + setDialogTile('update') | |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | // 详情操作 |
| 165 | 165 | const handleDetail = async (rowId: number) => { |
| 166 | - setDialogTile('detail') | |
| 167 | 166 | // 设置数据 |
| 168 | 167 | const res = await SmsTemplateApi.getSmsTemplateApi(rowId) |
| 169 | 168 | detailData.value = res |
| 169 | + setDialogTile('detail') | |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | // 删除操作 |
| 173 | 173 | const handleDelete = async (rowId: number) => { |
| 174 | - await delList(xGrid, rowId) | |
| 174 | + await deleteData(xGrid, rowId) | |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | // 提交按钮 |
| ... | ... | @@ -195,7 +195,7 @@ const submitForm = async () => { |
| 195 | 195 | } finally { |
| 196 | 196 | actionLoading.value = false |
| 197 | 197 | // 刷新列表 |
| 198 | - reloadList(xGrid) | |
| 198 | + await reloadList(xGrid) | |
| 199 | 199 | } |
| 200 | 200 | } |
| 201 | 201 | }) | ... | ... |
yudao-ui-admin-vue3/src/views/system/user/index.vue
| ... | ... | @@ -72,7 +72,7 @@ |
| 72 | 72 | preIcon="ep:view" |
| 73 | 73 | :title="t('action.detail')" |
| 74 | 74 | v-hasPermi="['system:user:update']" |
| 75 | - @click="handleDetail(row)" | |
| 75 | + @click="handleDetail(row.id)" | |
| 76 | 76 | /> |
| 77 | 77 | <XTextButton |
| 78 | 78 | preIcon="ep:key" |
| ... | ... | @@ -292,12 +292,13 @@ const defaultProps = { |
| 292 | 292 | const tableTitle = ref('用户列表') |
| 293 | 293 | // 列表相关的变量 |
| 294 | 294 | const xGrid = ref<VxeGridInstance>() // 列表 Grid Ref |
| 295 | -const { gridOptions, reloadList, delList, exportList, getSearchData } = useVxeGrid<UserApi.UserVO>({ | |
| 296 | - allSchemas: allSchemas, | |
| 297 | - getListApi: UserApi.getUserPageApi, | |
| 298 | - delListApi: UserApi.deleteUserApi, | |
| 299 | - exportListApi: UserApi.exportUserApi | |
| 300 | -}) | |
| 295 | +const { gridOptions, reloadList, deleteData, exportList, getSearchData } = | |
| 296 | + useVxeGrid<UserApi.UserVO>({ | |
| 297 | + allSchemas: allSchemas, | |
| 298 | + getListApi: UserApi.getUserPageApi, | |
| 299 | + deleteApi: UserApi.deleteUserApi, | |
| 300 | + exportListApi: UserApi.exportUserApi | |
| 301 | + }) | |
| 301 | 302 | // ========== 创建部门树结构 ========== |
| 302 | 303 | const filterText = ref('') |
| 303 | 304 | const deptOptions = ref<any[]>([]) // 树形结构 |
| ... | ... | @@ -360,7 +361,6 @@ const handleCreate = async () => { |
| 360 | 361 | |
| 361 | 362 | // 修改操作 |
| 362 | 363 | const handleUpdate = async (rowId: number) => { |
| 363 | - await setDialogTile('update') | |
| 364 | 364 | unref(formRef)?.delSchema('username') |
| 365 | 365 | unref(formRef)?.delSchema('password') |
| 366 | 366 | // 设置数据 |
| ... | ... | @@ -368,18 +368,20 @@ const handleUpdate = async (rowId: number) => { |
| 368 | 368 | deptId.value = res.deptId |
| 369 | 369 | postIds.value = res.postIds |
| 370 | 370 | unref(formRef)?.setValues(res) |
| 371 | + setDialogTile('update') | |
| 371 | 372 | } |
| 372 | 373 | const detailData = ref() |
| 373 | 374 | |
| 374 | 375 | // 详情操作 |
| 375 | -const handleDetail = async (row: UserApi.UserVO) => { | |
| 376 | +const handleDetail = async (rowId: number) => { | |
| 376 | 377 | // 设置数据 |
| 377 | - detailData.value = row | |
| 378 | + const res = await UserApi.getUserApi(rowId) | |
| 379 | + detailData.value = res | |
| 378 | 380 | await setDialogTile('detail') |
| 379 | 381 | } |
| 380 | 382 | // 删除操作 |
| 381 | 383 | const handleDelete = async (rowId: number) => { |
| 382 | - await delList(xGrid, rowId) | |
| 384 | + await deleteData(xGrid, rowId) | |
| 383 | 385 | } |
| 384 | 386 | // 提交按钮 |
| 385 | 387 | const submitForm = async () => { |
| ... | ... | @@ -398,9 +400,9 @@ const submitForm = async () => { |
| 398 | 400 | } |
| 399 | 401 | dialogVisible.value = false |
| 400 | 402 | } finally { |
| 401 | - loading.value = false | |
| 402 | 403 | // 刷新列表 |
| 403 | - reloadList(xGrid) | |
| 404 | + await reloadList(xGrid) | |
| 405 | + loading.value = false | |
| 404 | 406 | } |
| 405 | 407 | } |
| 406 | 408 | // 改变用户状态操作 |
| ... | ... | @@ -414,7 +416,7 @@ const handleStatusChange = async (row: UserApi.UserVO) => { |
| 414 | 416 | await UserApi.updateUserStatusApi(row.id, row.status) |
| 415 | 417 | message.success(text + '成功') |
| 416 | 418 | // 刷新列表 |
| 417 | - reloadList(xGrid) | |
| 419 | + await reloadList(xGrid) | |
| 418 | 420 | }) |
| 419 | 421 | .catch(() => { |
| 420 | 422 | row.status = |
| ... | ... | @@ -493,7 +495,7 @@ const submitFileForm = () => { |
| 493 | 495 | uploadRef.value!.submit() |
| 494 | 496 | } |
| 495 | 497 | // 文件上传成功 |
| 496 | -const handleFileSuccess = (response: any): void => { | |
| 498 | +const handleFileSuccess = async (response: any): Promise<void> => { | |
| 497 | 499 | if (response.code !== 0) { |
| 498 | 500 | message.error(response.msg) |
| 499 | 501 | return |
| ... | ... | @@ -514,7 +516,7 @@ const handleFileSuccess = (response: any): void => { |
| 514 | 516 | text += '< ' + username + ': ' + data.failureUsernames[username] + ' >' |
| 515 | 517 | } |
| 516 | 518 | message.alert(text) |
| 517 | - reloadList(xGrid) | |
| 519 | + await reloadList(xGrid) | |
| 518 | 520 | } |
| 519 | 521 | // 文件数超出提示 |
| 520 | 522 | const handleExceed = (): void => { | ... | ... |
yudao-ui-admin-vue3/use.md
| ... | ... | @@ -20,14 +20,13 @@ |
| 20 | 20 | ``` |
| 21 | 21 | |
| 22 | 22 | - 其中api内index.ts 与 vue2 基本一致,只不过axios封装了get post put delete upload download 等方法,不用写method: 'get' 了 |
| 23 | -- api内types.ts,是接口中的类型声明,与java中vo等保持一致, java中long int => ts 中 number | |
| 24 | -- views中,index.vue 与 vue2 基本一致,本框架封装了Search Table Form Descriptions等组件,也可以按照vue2方式去写,参考menu | |
| 23 | +- views中,index.vue 与 vue2 基本一致,本框架使用了vxe-table并封装了Search Table Form Descriptions等组件,当然也继续支持vue2的写法 | |
| 25 | 24 | - post.data.ts 中主要是表单校验 rules 和表单 crudSchemas ,通过修改crudSchemas 就可以控制增删改查的字段、输入框还是下拉框等等 |
| 26 | -- 本框架集成了国际化,不需要可以自己想办法移除,后期不会提供删减版 使用方式 | |
| 25 | +- 本框架集成了国际化,不需要可以自己想办法移除,后期不会提供删减版 | |
| 27 | 26 | |
| 28 | 27 | ```bash |
| 29 | 28 | import { useI18n } from '@/hooks/web/useI18n' |
| 30 | 29 | const { t } = useI18n() |
| 31 | 30 | t('common.createTime') |
| 32 | -对应翻译文档在 src/locales | |
| 31 | +并在src/locales 增加相应的中英文 | |
| 33 | 32 | ``` | ... | ... |