Commit 3b107f56a0212eaa0e56fdce39124f3e4fdf6411
1 parent
042c4e83
fix: todo
Showing
9 changed files
with
49 additions
and
37 deletions
yudao-ui-admin-vue3/src/components/Descriptions/src/Descriptions.vue
| ... | ... | @@ -116,7 +116,7 @@ const toggleClick = () => { |
| 116 | 116 | {{ dayjs(data[item.field]).format(item.dateFormat) }} |
| 117 | 117 | </slot> |
| 118 | 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 | 120 | </slot> |
| 121 | 121 | <slot v-else :name="item.field" :row="data">{{ data[item.field] }}</slot> |
| 122 | 122 | </template> | ... | ... |
yudao-ui-admin-vue3/src/hooks/web/useVxeCrudSchemas.ts
| ... | ... | @@ -24,20 +24,20 @@ export type VxeCrudSchema = { |
| 24 | 24 | columns: VxeCrudColumns[] |
| 25 | 25 | } |
| 26 | 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 | 43 | type CrudSearchParams = { |
| ... | ... | @@ -189,6 +189,7 @@ const filterTableSchema = (crudSchema: VxeCrudSchema): VxeGridPropTypes.Columns |
| 189 | 189 | tableSchemaItem.showOverflow = 'tooltip' |
| 190 | 190 | if (schemaItem?.formatter) { |
| 191 | 191 | tableSchemaItem.formatter = schemaItem.formatter |
| 192 | + tableSchemaItem.width = 160 | |
| 192 | 193 | } |
| 193 | 194 | if (schemaItem?.dictType) { |
| 194 | 195 | tableSchemaItem.cellRender = { |
| ... | ... | @@ -222,6 +223,7 @@ const filterFormSchema = (crudSchema: VxeCrudSchema): FormSchema[] => { |
| 222 | 223 | eachTree(crudSchema.columns, (schemaItem: VxeCrudColumns) => { |
| 223 | 224 | // 判断是否显示 |
| 224 | 225 | if (schemaItem?.isForm !== false) { |
| 226 | + // 默认为 input | |
| 225 | 227 | let component = schemaItem?.form?.component || 'Input' |
| 226 | 228 | const options: ComponentOptions[] = [] |
| 227 | 229 | let comonentProps = {} |
| ... | ... | @@ -232,15 +234,14 @@ const filterFormSchema = (crudSchema: VxeCrudSchema): FormSchema[] => { |
| 232 | 234 | comonentProps = { |
| 233 | 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 | 239 | const formSchemaItem = { |
| 238 | - // 默认为 input | |
| 239 | - component: component, | |
| 240 | - componentProps: comonentProps, | |
| 241 | 240 | ...schemaItem.form, |
| 242 | 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 | 247 | formSchema.push(formSchemaItem) | ... | ... |
yudao-ui-admin-vue3/src/locales/en.ts
yudao-ui-admin-vue3/src/locales/zh-CN.ts
yudao-ui-admin-vue3/src/utils/dict.ts
| ... | ... | @@ -16,8 +16,8 @@ export interface DictDataType { |
| 16 | 16 | dictType: string |
| 17 | 17 | label: string |
| 18 | 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 | 23 | export const getDictOptions = (dictType: string) => { |
| ... | ... | @@ -41,10 +41,11 @@ export const getIntDictOptions = (dictType: string) => { |
| 41 | 41 | }) |
| 42 | 42 | } |
| 43 | 43 | }) |
| 44 | + console.log(dictOptions) | |
| 44 | 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 | 49 | const dictOptions: DictDataType[] = getDictOptions(dictType) |
| 49 | 50 | dictOptions.forEach((dict: DictDataType) => { |
| 50 | 51 | if (dict.value === value) { | ... | ... |
yudao-ui-admin-vue3/src/views/system/oauth2/client/client.data.ts
| ... | ... | @@ -45,18 +45,24 @@ const crudSchemas = reactive<VxeCrudSchema>({ |
| 45 | 45 | }, |
| 46 | 46 | { |
| 47 | 47 | title: '访问令牌的有效期', |
| 48 | - field: 'accessTokenValiditySeconds' // TODO @星语:数字输入框 | |
| 48 | + field: 'accessTokenValiditySeconds', | |
| 49 | + form: { | |
| 50 | + component: 'InputNumber' | |
| 51 | + } | |
| 49 | 52 | }, |
| 50 | 53 | { |
| 51 | 54 | title: '刷新令牌的有效期', |
| 52 | - field: 'refreshTokenValiditySeconds' // TODO @星语:数字输入框 | |
| 55 | + field: 'refreshTokenValiditySeconds', | |
| 56 | + form: { | |
| 57 | + component: 'InputNumber' | |
| 58 | + } | |
| 53 | 59 | }, |
| 54 | 60 | { |
| 55 | 61 | title: '授权类型', |
| 56 | 62 | field: 'authorizedGrantTypes', |
| 57 | 63 | dictType: DICT_TYPE.SYSTEM_OAUTH2_GRANT_TYPE, |
| 58 | 64 | form: { |
| 59 | - component: 'Select' // TODO @星语:多选 | |
| 65 | + component: 'SelectV2' // TODO @星语:多选 | |
| 60 | 66 | } |
| 61 | 67 | }, |
| 62 | 68 | { |
| ... | ... | @@ -102,7 +108,7 @@ const crudSchemas = reactive<VxeCrudSchema>({ |
| 102 | 108 | { |
| 103 | 109 | title: t('common.createTime'), |
| 104 | 110 | field: 'createTime', |
| 105 | - formatter: 'formatDate', // TODO @星语:宽度,保证时间可以展示出来 | |
| 111 | + formatter: 'formatDate', | |
| 106 | 112 | isForm: false |
| 107 | 113 | } |
| 108 | 114 | ] | ... | ... |
yudao-ui-admin-vue3/src/views/system/oauth2/client/index.vue
yudao-ui-admin-vue3/src/views/system/oauth2/token/index.vue
| ... | ... | @@ -58,10 +58,10 @@ const handleDetail = async (row: TokenApi.OAuth2TokenVO) => { |
| 58 | 58 | // 强退操作 |
| 59 | 59 | const handleForceLogout = (rowId: number) => { |
| 60 | 60 | message |
| 61 | - .delConfirm() | |
| 61 | + .confirm('是否要强制退出用户') | |
| 62 | 62 | .then(async () => { |
| 63 | 63 | await TokenApi.deleteAccessTokenApi(rowId) |
| 64 | - message.success(t('common.delSuccess')) // TODO 星语:提示内容不对 | |
| 64 | + message.success(t('common.success')) | |
| 65 | 65 | }) |
| 66 | 66 | .finally(() => { |
| 67 | 67 | // 刷新列表 | ... | ... |
yudao-ui-admin-vue3/src/views/system/operatelog/index.vue
| ... | ... | @@ -45,6 +45,7 @@ |
| 45 | 45 | // 全局相关的 import |
| 46 | 46 | import { ref } from 'vue' |
| 47 | 47 | import { useI18n } from '@/hooks/web/useI18n' |
| 48 | +import { useMessage } from '@/hooks/web/useMessage' | |
| 48 | 49 | import { useVxeGrid } from '@/hooks/web/useVxeGrid' |
| 49 | 50 | import { VxeGridInstance } from 'vxe-table' |
| 50 | 51 | // 业务相关的 import |
| ... | ... | @@ -53,6 +54,7 @@ import { allSchemas } from './operatelog.data' |
| 53 | 54 | import download from '@/utils/download' |
| 54 | 55 | |
| 55 | 56 | const { t } = useI18n() // 国际化 |
| 57 | +const message = useMessage() // 消息弹窗 | |
| 56 | 58 | // 列表相关的变量 |
| 57 | 59 | const xGrid = ref<VxeGridInstance>() // 列表 Grid Ref |
| 58 | 60 | const { gridOptions } = useVxeGrid<OperateLogApi.OperateLogVO>({ |
| ... | ... | @@ -73,13 +75,14 @@ const handleDetail = (row: OperateLogApi.OperateLogVO) => { |
| 73 | 75 | } |
| 74 | 76 | |
| 75 | 77 | // 导出操作 |
| 76 | -// TODO @星语:导出需要有二次确认哈 | |
| 77 | 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 | 88 | </script> | ... | ... |