Commit 3b107f56a0212eaa0e56fdce39124f3e4fdf6411

Authored by xingyu4j
1 parent 042c4e83

fix: todo

yudao-ui-admin-vue3/src/components/Descriptions/src/Descriptions.vue
@@ -116,7 +116,7 @@ const toggleClick = () => { @@ -116,7 +116,7 @@ const toggleClick = () => {
116 {{ dayjs(data[item.field]).format(item.dateFormat) }} 116 {{ dayjs(data[item.field]).format(item.dateFormat) }}
117 </slot> 117 </slot>
118 <slot v-else-if="item.dictType"> 118 <slot v-else-if="item.dictType">
119 - <DictTag :type="item.dictType" :value="data[item.field]" /> 119 + <DictTag :type="item.dictType" :value="data[item.field] + ''" />
120 </slot> 120 </slot>
121 <slot v-else :name="item.field" :row="data">{{ data[item.field] }}</slot> 121 <slot v-else :name="item.field" :row="data">{{ data[item.field] }}</slot>
122 </template> 122 </template>
yudao-ui-admin-vue3/src/hooks/web/useVxeCrudSchemas.ts
@@ -24,20 +24,20 @@ export type VxeCrudSchema = { @@ -24,20 +24,20 @@ export type VxeCrudSchema = {
24 columns: VxeCrudColumns[] 24 columns: VxeCrudColumns[]
25 } 25 }
26 type VxeCrudColumns = Omit<VxeTableColumn, 'children'> & { 26 type VxeCrudColumns = Omit<VxeTableColumn, 'children'> & {
27 - field: string  
28 - title?: string  
29 - formatter?: VxeColumnPropTypes.Formatter  
30 - isSearch?: boolean  
31 - search?: CrudSearchParams  
32 - isTable?: boolean  
33 - table?: CrudTableParams  
34 - isForm?: boolean  
35 - form?: CrudFormParams  
36 - isDetail?: boolean  
37 - detail?: CrudDescriptionsParams  
38 - print?: CrudPrintParams  
39 - children?: VxeCrudColumns[]  
40 - dictType?: string 27 + field: string // 字段名
  28 + title?: string // 标题名
  29 + formatter?: VxeColumnPropTypes.Formatter // vxe formatter格式化
  30 + isSearch?: boolean // 是否在查询显示
  31 + search?: CrudSearchParams // 查询的详细配置
  32 + isTable?: boolean // 是否在列表显示
  33 + table?: CrudTableParams // 列表的详细配置
  34 + isForm?: boolean // 是否在表单显示
  35 + form?: CrudFormParams // 表单的详细配置
  36 + isDetail?: boolean // 是否在详情显示
  37 + detail?: CrudDescriptionsParams // 详情的详细配置
  38 + print?: CrudPrintParams // vxe 打印的字段
  39 + children?: VxeCrudColumns[] // 子级
  40 + dictType?: string // 字典类型
41 } 41 }
42 42
43 type CrudSearchParams = { 43 type CrudSearchParams = {
@@ -189,6 +189,7 @@ const filterTableSchema = (crudSchema: VxeCrudSchema): VxeGridPropTypes.Columns @@ -189,6 +189,7 @@ const filterTableSchema = (crudSchema: VxeCrudSchema): VxeGridPropTypes.Columns
189 tableSchemaItem.showOverflow = 'tooltip' 189 tableSchemaItem.showOverflow = 'tooltip'
190 if (schemaItem?.formatter) { 190 if (schemaItem?.formatter) {
191 tableSchemaItem.formatter = schemaItem.formatter 191 tableSchemaItem.formatter = schemaItem.formatter
  192 + tableSchemaItem.width = 160
192 } 193 }
193 if (schemaItem?.dictType) { 194 if (schemaItem?.dictType) {
194 tableSchemaItem.cellRender = { 195 tableSchemaItem.cellRender = {
@@ -222,6 +223,7 @@ const filterFormSchema = (crudSchema: VxeCrudSchema): FormSchema[] =&gt; { @@ -222,6 +223,7 @@ const filterFormSchema = (crudSchema: VxeCrudSchema): FormSchema[] =&gt; {
222 eachTree(crudSchema.columns, (schemaItem: VxeCrudColumns) => { 223 eachTree(crudSchema.columns, (schemaItem: VxeCrudColumns) => {
223 // 判断是否显示 224 // 判断是否显示
224 if (schemaItem?.isForm !== false) { 225 if (schemaItem?.isForm !== false) {
  226 + // 默认为 input
225 let component = schemaItem?.form?.component || 'Input' 227 let component = schemaItem?.form?.component || 'Input'
226 const options: ComponentOptions[] = [] 228 const options: ComponentOptions[] = []
227 let comonentProps = {} 229 let comonentProps = {}
@@ -232,15 +234,14 @@ const filterFormSchema = (crudSchema: VxeCrudSchema): FormSchema[] =&gt; { @@ -232,15 +234,14 @@ const filterFormSchema = (crudSchema: VxeCrudSchema): FormSchema[] =&gt; {
232 comonentProps = { 234 comonentProps = {
233 options: options 235 options: options
234 } 236 }
235 - if (!(schemaItem.form && schemaItem.form.component)) component = 'Select' 237 + if (!(schemaItem.form && schemaItem.form.component)) component = 'SelectV2'
236 } 238 }
237 const formSchemaItem = { 239 const formSchemaItem = {
238 - // 默认为 input  
239 - component: component,  
240 - componentProps: comonentProps,  
241 ...schemaItem.form, 240 ...schemaItem.form,
242 field: schemaItem.field, 241 field: schemaItem.field,
243 - label: schemaItem.form?.label || schemaItem.title 242 + label: schemaItem.form?.label || schemaItem.title,
  243 + component: component,
  244 + componentProps: comonentProps
244 } 245 }
245 246
246 formSchema.push(formSchemaItem) 247 formSchema.push(formSchemaItem)
yudao-ui-admin-vue3/src/locales/en.ts
@@ -17,6 +17,7 @@ export default { @@ -17,6 +17,7 @@ export default {
17 cancel: 'Cancel', 17 cancel: 'Cancel',
18 close: 'Close', 18 close: 'Close',
19 reload: 'Reload current', 19 reload: 'Reload current',
  20 + success: 'Success',
20 closeTab: 'Close current', 21 closeTab: 'Close current',
21 closeTheLeftTab: 'Close left', 22 closeTheLeftTab: 'Close left',
22 closeTheRightTab: 'Close right', 23 closeTheRightTab: 'Close right',
yudao-ui-admin-vue3/src/locales/zh-CN.ts
@@ -17,6 +17,7 @@ export default { @@ -17,6 +17,7 @@ export default {
17 cancel: '取消', 17 cancel: '取消',
18 close: '关闭', 18 close: '关闭',
19 reload: '重新加载', 19 reload: '重新加载',
  20 + success: '成功',
20 closeTab: '关闭标签页', 21 closeTab: '关闭标签页',
21 closeTheLeftTab: '关闭左侧标签页', 22 closeTheLeftTab: '关闭左侧标签页',
22 closeTheRightTab: '关闭右侧标签页', 23 closeTheRightTab: '关闭右侧标签页',
yudao-ui-admin-vue3/src/utils/dict.ts
@@ -16,8 +16,8 @@ export interface DictDataType { @@ -16,8 +16,8 @@ export interface DictDataType {
16 dictType: string 16 dictType: string
17 label: string 17 label: string
18 value: string | number | boolean 18 value: string | number | boolean
19 - colorType: ElementPlusInfoType | '' | 'default' | 'primary'  
20 - cssClass: string 19 + colorType?: ElementPlusInfoType | '' | 'default' | 'primary'
  20 + cssClass?: string
21 } 21 }
22 22
23 export const getDictOptions = (dictType: string) => { 23 export const getDictOptions = (dictType: string) => {
@@ -41,10 +41,11 @@ export const getIntDictOptions = (dictType: string) =&gt; { @@ -41,10 +41,11 @@ export const getIntDictOptions = (dictType: string) =&gt; {
41 }) 41 })
42 } 42 }
43 }) 43 })
  44 + console.log(dictOptions)
44 return dictOptions 45 return dictOptions
45 } 46 }
46 47
47 -export const getDictObj = (dictType: string, value: string) => { 48 +export const getDictObj = (dictType: string, value: string | number | boolean) => {
48 const dictOptions: DictDataType[] = getDictOptions(dictType) 49 const dictOptions: DictDataType[] = getDictOptions(dictType)
49 dictOptions.forEach((dict: DictDataType) => { 50 dictOptions.forEach((dict: DictDataType) => {
50 if (dict.value === value) { 51 if (dict.value === value) {
yudao-ui-admin-vue3/src/views/system/oauth2/client/client.data.ts
@@ -45,18 +45,24 @@ const crudSchemas = reactive&lt;VxeCrudSchema&gt;({ @@ -45,18 +45,24 @@ const crudSchemas = reactive&lt;VxeCrudSchema&gt;({
45 }, 45 },
46 { 46 {
47 title: '访问令牌的有效期', 47 title: '访问令牌的有效期',
48 - field: 'accessTokenValiditySeconds' // TODO @星语:数字输入框 48 + field: 'accessTokenValiditySeconds',
  49 + form: {
  50 + component: 'InputNumber'
  51 + }
49 }, 52 },
50 { 53 {
51 title: '刷新令牌的有效期', 54 title: '刷新令牌的有效期',
52 - field: 'refreshTokenValiditySeconds' // TODO @星语:数字输入框 55 + field: 'refreshTokenValiditySeconds',
  56 + form: {
  57 + component: 'InputNumber'
  58 + }
53 }, 59 },
54 { 60 {
55 title: '授权类型', 61 title: '授权类型',
56 field: 'authorizedGrantTypes', 62 field: 'authorizedGrantTypes',
57 dictType: DICT_TYPE.SYSTEM_OAUTH2_GRANT_TYPE, 63 dictType: DICT_TYPE.SYSTEM_OAUTH2_GRANT_TYPE,
58 form: { 64 form: {
59 - component: 'Select' // TODO @星语:多选 65 + component: 'SelectV2' // TODO @星语:多选
60 } 66 }
61 }, 67 },
62 { 68 {
@@ -102,7 +108,7 @@ const crudSchemas = reactive&lt;VxeCrudSchema&gt;({ @@ -102,7 +108,7 @@ const crudSchemas = reactive&lt;VxeCrudSchema&gt;({
102 { 108 {
103 title: t('common.createTime'), 109 title: t('common.createTime'),
104 field: 'createTime', 110 field: 'createTime',
105 - formatter: 'formatDate', // TODO @星语:宽度,保证时间可以展示出来 111 + formatter: 'formatDate',
106 isForm: false 112 isForm: false
107 } 113 }
108 ] 114 ]
yudao-ui-admin-vue3/src/views/system/oauth2/client/index.vue
@@ -57,7 +57,6 @@ @@ -57,7 +57,6 @@
57 :rules="rules" 57 :rules="rules"
58 /> 58 />
59 <!-- 表单:详情 --> 59 <!-- 表单:详情 -->
60 - <!-- TODO @星语:展示详情时,有点小丑,可额能得看看 -->  
61 <Descriptions 60 <Descriptions
62 v-if="actionType === 'detail'" 61 v-if="actionType === 'detail'"
63 :schema="allSchemas.detailSchema" 62 :schema="allSchemas.detailSchema"
yudao-ui-admin-vue3/src/views/system/oauth2/token/index.vue
@@ -58,10 +58,10 @@ const handleDetail = async (row: TokenApi.OAuth2TokenVO) =&gt; { @@ -58,10 +58,10 @@ const handleDetail = async (row: TokenApi.OAuth2TokenVO) =&gt; {
58 // 强退操作 58 // 强退操作
59 const handleForceLogout = (rowId: number) => { 59 const handleForceLogout = (rowId: number) => {
60 message 60 message
61 - .delConfirm() 61 + .confirm('是否要强制退出用户')
62 .then(async () => { 62 .then(async () => {
63 await TokenApi.deleteAccessTokenApi(rowId) 63 await TokenApi.deleteAccessTokenApi(rowId)
64 - message.success(t('common.delSuccess')) // TODO 星语:提示内容不对 64 + message.success(t('common.success'))
65 }) 65 })
66 .finally(() => { 66 .finally(() => {
67 // 刷新列表 67 // 刷新列表
yudao-ui-admin-vue3/src/views/system/operatelog/index.vue
@@ -45,6 +45,7 @@ @@ -45,6 +45,7 @@
45 // 全局相关的 import 45 // 全局相关的 import
46 import { ref } from 'vue' 46 import { ref } from 'vue'
47 import { useI18n } from '@/hooks/web/useI18n' 47 import { useI18n } from '@/hooks/web/useI18n'
  48 +import { useMessage } from '@/hooks/web/useMessage'
48 import { useVxeGrid } from '@/hooks/web/useVxeGrid' 49 import { useVxeGrid } from '@/hooks/web/useVxeGrid'
49 import { VxeGridInstance } from 'vxe-table' 50 import { VxeGridInstance } from 'vxe-table'
50 // 业务相关的 import 51 // 业务相关的 import
@@ -53,6 +54,7 @@ import { allSchemas } from &#39;./operatelog.data&#39; @@ -53,6 +54,7 @@ import { allSchemas } from &#39;./operatelog.data&#39;
53 import download from '@/utils/download' 54 import download from '@/utils/download'
54 55
55 const { t } = useI18n() // 国际化 56 const { t } = useI18n() // 国际化
  57 +const message = useMessage() // 消息弹窗
56 // 列表相关的变量 58 // 列表相关的变量
57 const xGrid = ref<VxeGridInstance>() // 列表 Grid Ref 59 const xGrid = ref<VxeGridInstance>() // 列表 Grid Ref
58 const { gridOptions } = useVxeGrid<OperateLogApi.OperateLogVO>({ 60 const { gridOptions } = useVxeGrid<OperateLogApi.OperateLogVO>({
@@ -73,13 +75,14 @@ const handleDetail = (row: OperateLogApi.OperateLogVO) =&gt; { @@ -73,13 +75,14 @@ const handleDetail = (row: OperateLogApi.OperateLogVO) =&gt; {
73 } 75 }
74 76
75 // 导出操作 77 // 导出操作
76 -// TODO @星语:导出需要有二次确认哈  
77 const handleExport = async () => { 78 const handleExport = async () => {
78 - const queryParams = Object.assign(  
79 - {},  
80 - JSON.parse(JSON.stringify(xGrid.value?.getRefMaps().refForm.value.data)) // TODO @星语:这个有没办法,封装个 util 获取哈?  
81 - )  
82 - const res = await OperateLogApi.exportOperateLogApi(queryParams)  
83 - download.excel(res, '岗位列表.xls') 79 + message.exportConfirm().then(async () => {
  80 + const queryParams = Object.assign(
  81 + {},
  82 + JSON.parse(JSON.stringify(xGrid.value?.getRefMaps().refForm.value.data)) // TODO @星语:这个有没办法,封装个 util 获取哈?
  83 + )
  84 + const res = await OperateLogApi.exportOperateLogApi(queryParams)
  85 + download.excel(res, '岗位列表.xls')
  86 + })
84 } 87 }
85 </script> 88 </script>