Commit d485b8289dcdca5f6a3bb1e897f817e2a247b03d

Authored by xingyu4j
1 parent c40076c5

fix

yudao-ui-admin-vue3/src/hooks/web/useVxeCrudSchemas.ts
@@ -15,12 +15,10 @@ import { FormSchema } from '@/types/form' @@ -15,12 +15,10 @@ import { FormSchema } from '@/types/form'
15 import { ComponentOptions } from '@/types/components' 15 import { ComponentOptions } from '@/types/components'
16 16
17 export type VxeCrudSchema = { 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 columns: VxeCrudColumns[] 22 columns: VxeCrudColumns[]
25 } 23 }
26 type VxeCrudColumns = Omit<VxeTableColumn, 'children'> & { 24 type VxeCrudColumns = Omit<VxeTableColumn, 'children'> & {
@@ -173,7 +171,7 @@ const filterTableSchema = (crudSchema: VxeCrudSchema): VxeGridPropTypes.Columns @@ -173,7 +171,7 @@ const filterTableSchema = (crudSchema: VxeCrudSchema): VxeGridPropTypes.Columns
173 const tableSchemaItem = { 171 const tableSchemaItem = {
174 title: t('common.index'), 172 title: t('common.index'),
175 field: crudSchema.primaryKey, 173 field: crudSchema.primaryKey,
176 - type: crudSchema.primaryType ? crudSchema.primaryType : 'seq', 174 + type: crudSchema.primaryType ? crudSchema.primaryType : null,
177 width: '50px' 175 width: '50px'
178 } 176 }
179 tableSchema.push(tableSchemaItem) 177 tableSchema.push(tableSchemaItem)
yudao-ui-admin-vue3/src/hooks/web/useVxeGrid.ts
@@ -12,7 +12,7 @@ const message = useMessage() // 消息弹窗 @@ -12,7 +12,7 @@ const message = useMessage() // 消息弹窗
12 interface UseVxeGridConfig<T = any> { 12 interface UseVxeGridConfig<T = any> {
13 allSchemas: VxeAllSchemas 13 allSchemas: VxeAllSchemas
14 getListApi: (option: any) => Promise<T> 14 getListApi: (option: any) => Promise<T>
15 - delListApi?: (option: any) => Promise<T> 15 + deleteApi?: (option: any) => Promise<T>
16 exportListApi?: (option: any) => Promise<T> 16 exportListApi?: (option: any) => Promise<T>
17 exportName?: string 17 exportName?: string
18 } 18 }
@@ -150,12 +150,12 @@ export const useVxeGrid = &lt;T = any&gt;(config?: UseVxeGridConfig&lt;T&gt;) =&gt; { @@ -150,12 +150,12 @@ export const useVxeGrid = &lt;T = any&gt;(config?: UseVxeGridConfig&lt;T&gt;) =&gt; {
150 * @param ids rowid 150 * @param ids rowid
151 * @returns 151 * @returns
152 */ 152 */
153 - const delList = async (ref, ids: string | number | string[] | number[]) => { 153 + const deleteData = async (ref, ids: string | number) => {
154 if (!ref) { 154 if (!ref) {
155 console.error('未传入gridRef') 155 console.error('未传入gridRef')
156 return 156 return
157 } 157 }
158 - if (!config?.delListApi) { 158 + if (!config?.deleteApi) {
159 console.error('未传入delListApi') 159 console.error('未传入delListApi')
160 return 160 return
161 } 161 }
@@ -164,7 +164,7 @@ export const useVxeGrid = &lt;T = any&gt;(config?: UseVxeGridConfig&lt;T&gt;) =&gt; { @@ -164,7 +164,7 @@ export const useVxeGrid = &lt;T = any&gt;(config?: UseVxeGridConfig&lt;T&gt;) =&gt; {
164 message 164 message
165 .delConfirm() 165 .delConfirm()
166 .then(() => { 166 .then(() => {
167 - config?.delListApi && config?.delListApi(ids) 167 + config?.deleteApi && config?.deleteApi(ids)
168 message.success(t('common.delSuccess')) 168 message.success(t('common.delSuccess'))
169 }) 169 })
170 .finally(async () => { 170 .finally(async () => {
@@ -216,7 +216,7 @@ export const useVxeGrid = &lt;T = any&gt;(config?: UseVxeGridConfig&lt;T&gt;) =&gt; { @@ -216,7 +216,7 @@ export const useVxeGrid = &lt;T = any&gt;(config?: UseVxeGridConfig&lt;T&gt;) =&gt; {
216 gridOptions, 216 gridOptions,
217 reloadList, 217 reloadList,
218 getSearchData, 218 getSearchData,
219 - delList, 219 + deleteData,
220 exportList, 220 exportList,
221 zoom 221 zoom
222 } 222 }
yudao-ui-admin-vue3/src/views/bpm/group/index.vue
@@ -10,7 +10,7 @@ import type { UserGroupVO } from &#39;@/api/bpm/userGroup/types&#39; @@ -10,7 +10,7 @@ import type { UserGroupVO } from &#39;@/api/bpm/userGroup/types&#39;
10 import { rules, allSchemas } from './group.data' 10 import { rules, allSchemas } from './group.data'
11 import * as UserGroupApi from '@/api/bpm/userGroup' 11 import * as UserGroupApi from '@/api/bpm/userGroup'
12 import { getListSimpleUsersApi } from '@/api/system/user' 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 const { t } = useI18n() // 国际化 15 const { t } = useI18n() // 国际化
16 16
yudao-ui-admin-vue3/src/views/system/errorCode/index.vue
@@ -83,10 +83,10 @@ const { t } = useI18n() // 国际化 @@ -83,10 +83,10 @@ const { t } = useI18n() // 国际化
83 const message = useMessage() // 消息弹窗 83 const message = useMessage() // 消息弹窗
84 // 列表相关的变量 84 // 列表相关的变量
85 const xGrid = ref<VxeGridInstance>() // grid Ref 85 const xGrid = ref<VxeGridInstance>() // grid Ref
86 -const { gridOptions, reloadList, delList } = useVxeGrid<ErrorCodeApi.ErrorCodeVO>({ 86 +const { gridOptions, reloadList, deleteData } = useVxeGrid<ErrorCodeApi.ErrorCodeVO>({
87 allSchemas: allSchemas, 87 allSchemas: allSchemas,
88 getListApi: ErrorCodeApi.getErrorCodePageApi, 88 getListApi: ErrorCodeApi.getErrorCodePageApi,
89 - delListApi: ErrorCodeApi.deleteErrorCodeApi 89 + deleteApi: ErrorCodeApi.deleteErrorCodeApi
90 }) 90 })
91 // 弹窗相关的变量 91 // 弹窗相关的变量
92 const dialogVisible = ref(false) // 是否显示弹出层 92 const dialogVisible = ref(false) // 是否显示弹出层
@@ -110,23 +110,23 @@ const handleCreate = () =&gt; { @@ -110,23 +110,23 @@ const handleCreate = () =&gt; {
110 110
111 // 修改操作 111 // 修改操作
112 const handleUpdate = async (rowId: number) => { 112 const handleUpdate = async (rowId: number) => {
113 - setDialogTile('update')  
114 // 设置数据 113 // 设置数据
115 const res = await ErrorCodeApi.getErrorCodeApi(rowId) 114 const res = await ErrorCodeApi.getErrorCodeApi(rowId)
116 unref(formRef)?.setValues(res) 115 unref(formRef)?.setValues(res)
  116 + setDialogTile('update')
117 } 117 }
118 118
119 // 详情操作 119 // 详情操作
120 const handleDetail = async (rowId: number) => { 120 const handleDetail = async (rowId: number) => {
121 - setDialogTile('detail')  
122 // 设置数据 121 // 设置数据
123 const res = await ErrorCodeApi.getErrorCodeApi(rowId) 122 const res = await ErrorCodeApi.getErrorCodeApi(rowId)
124 detailRef.value = res 123 detailRef.value = res
  124 + setDialogTile('detail')
125 } 125 }
126 126
127 // 删除操作 127 // 删除操作
128 const handleDelete = async (rowId: number) => { 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 () =&gt; { @@ -150,7 +150,7 @@ const submitForm = async () =&gt; {
150 } finally { 150 } finally {
151 actionLoading.value = false 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
@@ -59,6 +59,6 @@ const handleDetail = async (row: LoginLogVO) =&gt; { @@ -59,6 +59,6 @@ const handleDetail = async (row: LoginLogVO) =&gt; {
59 59
60 // 导出操作 60 // 导出操作
61 const handleExport = async () => { 61 const handleExport = async () => {
62 - exportList(xGrid, '登录列表.xls') 62 + await exportList(xGrid, '登录列表.xls')
63 } 63 }
64 </script> 64 </script>
yudao-ui-admin-vue3/src/views/system/notice/index.vue
@@ -82,10 +82,10 @@ const { t } = useI18n() // 国际化 @@ -82,10 +82,10 @@ const { t } = useI18n() // 国际化
82 const message = useMessage() // 消息弹窗 82 const message = useMessage() // 消息弹窗
83 // 列表相关的变量 83 // 列表相关的变量
84 const xGrid = ref<VxeGridInstance>() // 列表 Grid Ref 84 const xGrid = ref<VxeGridInstance>() // 列表 Grid Ref
85 -const { gridOptions, reloadList, delList } = useVxeGrid<NoticeApi.NoticeVO>({ 85 +const { gridOptions, reloadList, deleteData } = useVxeGrid<NoticeApi.NoticeVO>({
86 allSchemas: allSchemas, 86 allSchemas: allSchemas,
87 getListApi: NoticeApi.getNoticePageApi, 87 getListApi: NoticeApi.getNoticePageApi,
88 - delListApi: NoticeApi.deleteNoticeApi 88 + deleteApi: NoticeApi.deleteNoticeApi
89 }) 89 })
90 // 弹窗相关的变量 90 // 弹窗相关的变量
91 const dialogVisible = ref(false) // 是否显示弹出层 91 const dialogVisible = ref(false) // 是否显示弹出层
@@ -109,23 +109,23 @@ const handleCreate = () =&gt; { @@ -109,23 +109,23 @@ const handleCreate = () =&gt; {
109 109
110 // 修改操作 110 // 修改操作
111 const handleUpdate = async (rowId: number) => { 111 const handleUpdate = async (rowId: number) => {
112 - setDialogTile('update')  
113 // 设置数据 112 // 设置数据
114 const res = await NoticeApi.getNoticeApi(rowId) 113 const res = await NoticeApi.getNoticeApi(rowId)
115 unref(formRef)?.setValues(res) 114 unref(formRef)?.setValues(res)
  115 + setDialogTile('update')
116 } 116 }
117 117
118 // 详情操作 118 // 详情操作
119 const handleDetail = async (rowId: number) => { 119 const handleDetail = async (rowId: number) => {
120 - setDialogTile('detail')  
121 // 设置数据 120 // 设置数据
122 const res = await NoticeApi.getNoticeApi(rowId) 121 const res = await NoticeApi.getNoticeApi(rowId)
123 detailRef.value = res 122 detailRef.value = res
  123 + setDialogTile('detail')
124 } 124 }
125 125
126 // 删除操作 126 // 删除操作
127 const handleDelete = async (rowId: number) => { 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 () =&gt; { @@ -148,8 +148,7 @@ const submitForm = async () =&gt; {
148 dialogVisible.value = false 148 dialogVisible.value = false
149 } finally { 149 } finally {
150 actionLoading.value = false 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,10 +94,10 @@ const message = useMessage() // 消息弹窗
94 94
95 // 列表相关的变量 95 // 列表相关的变量
96 const xGrid = ref<VxeGridInstance>() // 列表 Grid Ref 96 const xGrid = ref<VxeGridInstance>() // 列表 Grid Ref
97 -const { gridOptions, reloadList, delList } = useVxeGrid<ClientApi.OAuth2ClientVO>({ 97 +const { gridOptions, reloadList, deleteData } = useVxeGrid<ClientApi.OAuth2ClientVO>({
98 allSchemas: allSchemas, 98 allSchemas: allSchemas,
99 getListApi: ClientApi.getOAuth2ClientPageApi, 99 getListApi: ClientApi.getOAuth2ClientPageApi,
100 - delListApi: ClientApi.deleteOAuth2ClientApi 100 + deleteApi: ClientApi.deleteOAuth2ClientApi
101 }) 101 })
102 // 弹窗相关的变量 102 // 弹窗相关的变量
103 const dialogVisible = ref(false) // 是否显示弹出层 103 const dialogVisible = ref(false) // 是否显示弹出层
@@ -121,22 +121,22 @@ const handleCreate = () =&gt; { @@ -121,22 +121,22 @@ const handleCreate = () =&gt; {
121 121
122 // 修改操作 122 // 修改操作
123 const handleUpdate = async (rowId: number) => { 123 const handleUpdate = async (rowId: number) => {
124 - setDialogTile('update')  
125 // 设置数据 124 // 设置数据
126 const res = await ClientApi.getOAuth2ClientApi(rowId) 125 const res = await ClientApi.getOAuth2ClientApi(rowId)
127 unref(formRef)?.setValues(res) 126 unref(formRef)?.setValues(res)
  127 + setDialogTile('update')
128 } 128 }
129 129
130 // 详情操作 130 // 详情操作
131 const handleDetail = async (rowId: number) => { 131 const handleDetail = async (rowId: number) => {
132 - setDialogTile('detail')  
133 const res = await ClientApi.getOAuth2ClientApi(rowId) 132 const res = await ClientApi.getOAuth2ClientApi(rowId)
134 detailRef.value = res 133 detailRef.value = res
  134 + setDialogTile('detail')
135 } 135 }
136 136
137 // 删除操作 137 // 删除操作
138 const handleDelete = async (rowId: number) => { 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 () =&gt; { @@ -160,7 +160,7 @@ const submitForm = async () =&gt; {
160 } finally { 160 } finally {
161 actionLoading.value = false 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) =&gt; { @@ -63,9 +63,9 @@ const handleForceLogout = (rowId: number) =&gt; {
63 await TokenApi.deleteAccessTokenApi(rowId) 63 await TokenApi.deleteAccessTokenApi(rowId)
64 message.success(t('common.success')) 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 </script> 71 </script>
yudao-ui-admin-vue3/src/views/system/operatelog/index.vue
@@ -74,7 +74,6 @@ const handleDetail = (row: OperateLogApi.OperateLogVO) =&gt; { @@ -74,7 +74,6 @@ const handleDetail = (row: OperateLogApi.OperateLogVO) =&gt; {
74 74
75 // 导出操作 75 // 导出操作
76 const handleExport = async () => { 76 const handleExport = async () => {
77 - // TODO 星语:缺少 await 噢  
78 - exportList(xGrid, '岗位列表.xls') 77 + await exportList(xGrid, '岗位列表.xls')
79 } 78 }
80 </script> 79 </script>
yudao-ui-admin-vue3/src/views/system/post/index.vue
@@ -46,7 +46,7 @@ @@ -46,7 +46,7 @@
46 </vxe-grid> 46 </vxe-grid>
47 </ContentWrap> 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 <Form 51 <Form
52 ref="formRef" 52 ref="formRef"
@@ -70,7 +70,7 @@ @@ -70,7 +70,7 @@
70 @click="submitForm()" 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 </template> 74 </template>
75 </XModal> 75 </XModal>
76 </template> 76 </template>
@@ -90,15 +90,16 @@ const { t } = useI18n() // 国际化 @@ -90,15 +90,16 @@ const { t } = useI18n() // 国际化
90 const message = useMessage() // 消息弹窗 90 const message = useMessage() // 消息弹窗
91 // 列表相关的变量 91 // 列表相关的变量
92 const xGrid = ref<VxeGridInstance>() // 列表 Grid Ref 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 allSchemas: allSchemas, 94 allSchemas: allSchemas,
95 getListApi: PostApi.getPostPageApi, 95 getListApi: PostApi.getPostPageApi,
96 - delListApi: PostApi.deletePostApi, 96 + deleteApi: PostApi.deletePostApi,
97 exportListApi: PostApi.exportPostApi 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 const actionType = ref('') // 操作按钮的类型 103 const actionType = ref('') // 操作按钮的类型
103 const actionLoading = ref(false) // 按钮 Loading 104 const actionLoading = ref(false) // 按钮 Loading
104 const formRef = ref<FormExpose>() // 表单 Ref 105 const formRef = ref<FormExpose>() // 表单 Ref
@@ -106,27 +107,29 @@ const detailData = ref() // 详情 Ref @@ -106,27 +107,29 @@ const detailData = ref() // 详情 Ref
106 107
107 // 设置标题 108 // 设置标题
108 const setDialogTile = (type: string) => { 109 const setDialogTile = (type: string) => {
109 - dialogTitle.value = t('action.' + type) 110 + modelLoading.value = true
  111 + modelTitle.value = t('action.' + type)
110 actionType.value = type 112 actionType.value = type
111 - dialogVisible.value = true 113 + modelVisible.value = true
112 } 114 }
113 115
114 // 新增操作 116 // 新增操作
115 const handleCreate = () => { 117 const handleCreate = () => {
116 setDialogTile('create') 118 setDialogTile('create')
  119 + modelLoading.value = false
117 } 120 }
118 121
119 // 导出操作 122 // 导出操作
120 const handleExport = async () => { 123 const handleExport = async () => {
121 await exportList(xGrid, '岗位列表.xls') 124 await exportList(xGrid, '岗位列表.xls')
122 } 125 }
123 -  
124 // 修改操作 126 // 修改操作
125 const handleUpdate = async (rowId: number) => { 127 const handleUpdate = async (rowId: number) => {
126 setDialogTile('update') 128 setDialogTile('update')
127 // 设置数据 129 // 设置数据
128 const res = await PostApi.getPostApi(rowId) 130 const res = await PostApi.getPostApi(rowId)
129 unref(formRef)?.setValues(res) 131 unref(formRef)?.setValues(res)
  132 + modelLoading.value = false
130 } 133 }
131 134
132 // 详情操作 135 // 详情操作
@@ -134,11 +137,12 @@ const handleDetail = async (rowId: number) =&gt; { @@ -134,11 +137,12 @@ const handleDetail = async (rowId: number) =&gt; {
134 setDialogTile('detail') 137 setDialogTile('detail')
135 const res = await PostApi.getPostApi(rowId) 138 const res = await PostApi.getPostApi(rowId)
136 detailData.value = res 139 detailData.value = res
  140 + modelLoading.value = false
137 } 141 }
138 142
139 // 删除操作 143 // 删除操作
140 const handleDelete = async (rowId: number) => { 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 () =&gt; { @@ -158,11 +162,11 @@ const submitForm = async () =&gt; {
158 await PostApi.updatePostApi(data) 162 await PostApi.updatePostApi(data)
159 message.success(t('common.updateSuccess')) 163 message.success(t('common.updateSuccess'))
160 } 164 }
161 - dialogVisible.value = false 165 + modelVisible.value = false
162 } finally { 166 } finally {
163 actionLoading.value = false 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
@@ -15,7 +15,6 @@ export const rules = reactive({ @@ -15,7 +15,6 @@ export const rules = reactive({
15 // CrudSchema 15 // CrudSchema
16 const crudSchemas = reactive<VxeCrudSchema>({ 16 const crudSchemas = reactive<VxeCrudSchema>({
17 primaryKey: 'id', 17 primaryKey: 'id',
18 - primaryType: 'seq',  
19 action: true, 18 action: true,
20 columns: [ 19 columns: [
21 { 20 {
yudao-ui-admin-vue3/src/views/system/role/index.vue
@@ -174,10 +174,10 @@ const { t } = useI18n() // 国际化 @@ -174,10 +174,10 @@ const { t } = useI18n() // 国际化
174 const message = useMessage() // 消息弹窗 174 const message = useMessage() // 消息弹窗
175 // 列表相关的变量 175 // 列表相关的变量
176 const xGrid = ref<VxeGridInstance>() // 列表 Grid Ref 176 const xGrid = ref<VxeGridInstance>() // 列表 Grid Ref
177 -const { gridOptions, reloadList, delList } = useVxeGrid<RoleApi.RoleVO>({ 177 +const { gridOptions, reloadList, deleteData } = useVxeGrid<RoleApi.RoleVO>({
178 allSchemas: allSchemas, 178 allSchemas: allSchemas,
179 getListApi: RoleApi.getRolePageApi, 179 getListApi: RoleApi.getRolePageApi,
180 - delListApi: RoleApi.deleteRoleApi 180 + deleteApi: RoleApi.deleteRoleApi
181 }) 181 })
182 182
183 // ========== CRUD 相关 ========== 183 // ========== CRUD 相关 ==========
@@ -202,15 +202,23 @@ const handleCreate = () =&gt; { @@ -202,15 +202,23 @@ const handleCreate = () =&gt; {
202 202
203 // 修改操作 203 // 修改操作
204 const handleUpdate = async (rowId: number) => { 204 const handleUpdate = async (rowId: number) => {
205 - setDialogTile('update')  
206 // 设置数据 205 // 设置数据
207 const res = await RoleApi.getRoleApi(rowId) 206 const res = await RoleApi.getRoleApi(rowId)
208 unref(formRef)?.setValues(res) 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 const handleDelete = async (rowId: number) => { 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 () =&gt; { @@ -234,20 +242,12 @@ const submitForm = async () =&gt; {
234 } finally { 242 } finally {
235 actionLoading.value = false 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 const dataScopeForm = reactive({ 252 const dataScopeForm = reactive({
253 id: 0, 253 id: 0,
yudao-ui-admin-vue3/src/views/system/sms/smsChannel/index.vue
@@ -85,10 +85,10 @@ const message = useMessage() // 消息弹窗 @@ -85,10 +85,10 @@ const message = useMessage() // 消息弹窗
85 85
86 // 列表相关的变量 86 // 列表相关的变量
87 const xGrid = ref<VxeGridInstance>() // 列表 Grid Ref 87 const xGrid = ref<VxeGridInstance>() // 列表 Grid Ref
88 -const { gridOptions, reloadList, delList } = useVxeGrid<SmsChannelApi.SmsChannelVO>({ 88 +const { gridOptions, reloadList, deleteData } = useVxeGrid<SmsChannelApi.SmsChannelVO>({
89 allSchemas: allSchemas, 89 allSchemas: allSchemas,
90 getListApi: SmsChannelApi.getSmsChannelPageApi, 90 getListApi: SmsChannelApi.getSmsChannelPageApi,
91 - delListApi: SmsChannelApi.deleteSmsChannelApi 91 + deleteApi: SmsChannelApi.deleteSmsChannelApi
92 }) 92 })
93 93
94 // 弹窗相关的变量 94 // 弹窗相关的变量
@@ -113,22 +113,22 @@ const handleCreate = () =&gt; { @@ -113,22 +113,22 @@ const handleCreate = () =&gt; {
113 113
114 // 修改操作 114 // 修改操作
115 const handleUpdate = async (rowId: number) => { 115 const handleUpdate = async (rowId: number) => {
116 - setDialogTile('update')  
117 // 设置数据 116 // 设置数据
118 const res = await SmsChannelApi.getSmsChannelApi(rowId) 117 const res = await SmsChannelApi.getSmsChannelApi(rowId)
119 unref(formRef)?.setValues(res) 118 unref(formRef)?.setValues(res)
  119 + setDialogTile('update')
120 } 120 }
121 121
122 // 详情操作 122 // 详情操作
123 const handleDetail = async (rowId: number) => { 123 const handleDetail = async (rowId: number) => {
124 - setDialogTile('detail')  
125 const res = await SmsChannelApi.getSmsChannelApi(rowId) 124 const res = await SmsChannelApi.getSmsChannelApi(rowId)
126 detailData.value = res 125 detailData.value = res
  126 + setDialogTile('detail')
127 } 127 }
128 128
129 // 删除操作 129 // 删除操作
130 const handleDelete = async (rowId: number) => { 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 () =&gt; { @@ -152,7 +152,7 @@ const submitForm = async () =&gt; {
152 } finally { 152 } finally {
153 actionLoading.value = false 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,10 +127,10 @@ const message = useMessage() // 消息弹窗
127 127
128 // 列表相关的变量 128 // 列表相关的变量
129 const xGrid = ref<VxeGridInstance>() // 列表 Grid Ref 129 const xGrid = ref<VxeGridInstance>() // 列表 Grid Ref
130 -const { gridOptions, reloadList, delList } = useVxeGrid<SmsTemplateApi.SmsTemplateVO>({ 130 +const { gridOptions, reloadList, deleteData } = useVxeGrid<SmsTemplateApi.SmsTemplateVO>({
131 allSchemas: allSchemas, 131 allSchemas: allSchemas,
132 getListApi: SmsTemplateApi.getSmsTemplatePageApi, 132 getListApi: SmsTemplateApi.getSmsTemplatePageApi,
133 - delListApi: SmsTemplateApi.deleteSmsTemplateApi 133 + deleteApi: SmsTemplateApi.deleteSmsTemplateApi
134 }) 134 })
135 135
136 // 弹窗相关的变量 136 // 弹窗相关的变量
@@ -155,23 +155,23 @@ const handleCreate = () =&gt; { @@ -155,23 +155,23 @@ const handleCreate = () =&gt; {
155 155
156 // 修改操作 156 // 修改操作
157 const handleUpdate = async (rowId: number) => { 157 const handleUpdate = async (rowId: number) => {
158 - setDialogTile('update')  
159 // 设置数据 158 // 设置数据
160 const res = await SmsTemplateApi.getSmsTemplateApi(rowId) 159 const res = await SmsTemplateApi.getSmsTemplateApi(rowId)
161 unref(formRef)?.setValues(res) 160 unref(formRef)?.setValues(res)
  161 + setDialogTile('update')
162 } 162 }
163 163
164 // 详情操作 164 // 详情操作
165 const handleDetail = async (rowId: number) => { 165 const handleDetail = async (rowId: number) => {
166 - setDialogTile('detail')  
167 // 设置数据 166 // 设置数据
168 const res = await SmsTemplateApi.getSmsTemplateApi(rowId) 167 const res = await SmsTemplateApi.getSmsTemplateApi(rowId)
169 detailData.value = res 168 detailData.value = res
  169 + setDialogTile('detail')
170 } 170 }
171 171
172 // 删除操作 172 // 删除操作
173 const handleDelete = async (rowId: number) => { 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 () =&gt; { @@ -195,7 +195,7 @@ const submitForm = async () =&gt; {
195 } finally { 195 } finally {
196 actionLoading.value = false 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,7 +72,7 @@
72 preIcon="ep:view" 72 preIcon="ep:view"
73 :title="t('action.detail')" 73 :title="t('action.detail')"
74 v-hasPermi="['system:user:update']" 74 v-hasPermi="['system:user:update']"
75 - @click="handleDetail(row)" 75 + @click="handleDetail(row.id)"
76 /> 76 />
77 <XTextButton 77 <XTextButton
78 preIcon="ep:key" 78 preIcon="ep:key"
@@ -292,12 +292,13 @@ const defaultProps = { @@ -292,12 +292,13 @@ const defaultProps = {
292 const tableTitle = ref('用户列表') 292 const tableTitle = ref('用户列表')
293 // 列表相关的变量 293 // 列表相关的变量
294 const xGrid = ref<VxeGridInstance>() // 列表 Grid Ref 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 const filterText = ref('') 303 const filterText = ref('')
303 const deptOptions = ref<any[]>([]) // 树形结构 304 const deptOptions = ref<any[]>([]) // 树形结构
@@ -360,7 +361,6 @@ const handleCreate = async () =&gt; { @@ -360,7 +361,6 @@ const handleCreate = async () =&gt; {
360 361
361 // 修改操作 362 // 修改操作
362 const handleUpdate = async (rowId: number) => { 363 const handleUpdate = async (rowId: number) => {
363 - await setDialogTile('update')  
364 unref(formRef)?.delSchema('username') 364 unref(formRef)?.delSchema('username')
365 unref(formRef)?.delSchema('password') 365 unref(formRef)?.delSchema('password')
366 // 设置数据 366 // 设置数据
@@ -368,18 +368,20 @@ const handleUpdate = async (rowId: number) =&gt; { @@ -368,18 +368,20 @@ const handleUpdate = async (rowId: number) =&gt; {
368 deptId.value = res.deptId 368 deptId.value = res.deptId
369 postIds.value = res.postIds 369 postIds.value = res.postIds
370 unref(formRef)?.setValues(res) 370 unref(formRef)?.setValues(res)
  371 + setDialogTile('update')
371 } 372 }
372 const detailData = ref() 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 await setDialogTile('detail') 380 await setDialogTile('detail')
379 } 381 }
380 // 删除操作 382 // 删除操作
381 const handleDelete = async (rowId: number) => { 383 const handleDelete = async (rowId: number) => {
382 - await delList(xGrid, rowId) 384 + await deleteData(xGrid, rowId)
383 } 385 }
384 // 提交按钮 386 // 提交按钮
385 const submitForm = async () => { 387 const submitForm = async () => {
@@ -398,9 +400,9 @@ const submitForm = async () =&gt; { @@ -398,9 +400,9 @@ const submitForm = async () =&gt; {
398 } 400 }
399 dialogVisible.value = false 401 dialogVisible.value = false
400 } finally { 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) =&gt; { @@ -414,7 +416,7 @@ const handleStatusChange = async (row: UserApi.UserVO) =&gt; {
414 await UserApi.updateUserStatusApi(row.id, row.status) 416 await UserApi.updateUserStatusApi(row.id, row.status)
415 message.success(text + '成功') 417 message.success(text + '成功')
416 // 刷新列表 418 // 刷新列表
417 - reloadList(xGrid) 419 + await reloadList(xGrid)
418 }) 420 })
419 .catch(() => { 421 .catch(() => {
420 row.status = 422 row.status =
@@ -493,7 +495,7 @@ const submitFileForm = () =&gt; { @@ -493,7 +495,7 @@ const submitFileForm = () =&gt; {
493 uploadRef.value!.submit() 495 uploadRef.value!.submit()
494 } 496 }
495 // 文件上传成功 497 // 文件上传成功
496 -const handleFileSuccess = (response: any): void => { 498 +const handleFileSuccess = async (response: any): Promise<void> => {
497 if (response.code !== 0) { 499 if (response.code !== 0) {
498 message.error(response.msg) 500 message.error(response.msg)
499 return 501 return
@@ -514,7 +516,7 @@ const handleFileSuccess = (response: any): void =&gt; { @@ -514,7 +516,7 @@ const handleFileSuccess = (response: any): void =&gt; {
514 text += '< ' + username + ': ' + data.failureUsernames[username] + ' >' 516 text += '< ' + username + ': ' + data.failureUsernames[username] + ' >'
515 } 517 }
516 message.alert(text) 518 message.alert(text)
517 - reloadList(xGrid) 519 + await reloadList(xGrid)
518 } 520 }
519 // 文件数超出提示 521 // 文件数超出提示
520 const handleExceed = (): void => { 522 const handleExceed = (): void => {
yudao-ui-admin-vue3/use.md
@@ -20,14 +20,13 @@ @@ -20,14 +20,13 @@
20 ``` 20 ```
21 21
22 - 其中api内index.ts 与 vue2 基本一致,只不过axios封装了get post put delete upload download 等方法,不用写method: 'get' 了 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 - post.data.ts 中主要是表单校验 rules 和表单 crudSchemas ,通过修改crudSchemas 就可以控制增删改查的字段、输入框还是下拉框等等 24 - post.data.ts 中主要是表单校验 rules 和表单 crudSchemas ,通过修改crudSchemas 就可以控制增删改查的字段、输入框还是下拉框等等
26 -- 本框架集成了国际化,不需要可以自己想办法移除,后期不会提供删减版 使用方式 25 +- 本框架集成了国际化,不需要可以自己想办法移除,后期不会提供删减版
27 26
28 ```bash 27 ```bash
29 import { useI18n } from '@/hooks/web/useI18n' 28 import { useI18n } from '@/hooks/web/useI18n'
30 const { t } = useI18n() 29 const { t } = useI18n()
31 t('common.createTime') 30 t('common.createTime')
32 -对应翻译文档在 src/locales 31 +并在src/locales 增加相应的中英文
33 ``` 32 ```