Commit c7972f9a0664631d715eb6784cceaf07988ddcc1
1 parent
a701c1d7
fix: error
Showing
8 changed files
with
31 additions
and
25 deletions
yudao-ui-admin-vue3/src/components/Form/src/Form.vue
| @@ -249,6 +249,7 @@ export default defineComponent({ | @@ -249,6 +249,7 @@ export default defineComponent({ | ||
| 249 | const renderOptions = (item: FormSchema) => { | 249 | const renderOptions = (item: FormSchema) => { |
| 250 | switch (item.component) { | 250 | switch (item.component) { |
| 251 | case 'Select': | 251 | case 'Select': |
| 252 | + case 'SelectV2': | ||
| 252 | const { renderSelectOptions } = useRenderSelect(slots) | 253 | const { renderSelectOptions } = useRenderSelect(slots) |
| 253 | return renderSelectOptions(item) | 254 | return renderSelectOptions(item) |
| 254 | case 'Radio': | 255 | case 'Radio': |
yudao-ui-admin-vue3/src/components/Form/src/helper.ts
| @@ -14,7 +14,7 @@ import { ColProps } from '@/types/components' | @@ -14,7 +14,7 @@ import { ColProps } from '@/types/components' | ||
| 14 | export const setTextPlaceholder = (schema: FormSchema): PlaceholderMoel => { | 14 | export const setTextPlaceholder = (schema: FormSchema): PlaceholderMoel => { |
| 15 | const { t } = useI18n() | 15 | const { t } = useI18n() |
| 16 | const textMap = ['Input', 'Autocomplete', 'InputNumber', 'InputPassword'] | 16 | const textMap = ['Input', 'Autocomplete', 'InputNumber', 'InputPassword'] |
| 17 | - const selectMap = ['Select', 'TimePicker', 'DatePicker', 'TimeSelect', 'TimeSelect'] | 17 | + const selectMap = ['Select', 'SelectV2', 'TimePicker', 'DatePicker', 'TimeSelect', 'TimeSelect'] |
| 18 | if (textMap.includes(schema?.component as string)) { | 18 | if (textMap.includes(schema?.component as string)) { |
| 19 | return { | 19 | return { |
| 20 | placeholder: t('common.inputText') | 20 | placeholder: t('common.inputText') |
yudao-ui-admin-vue3/src/hooks/web/useVxeCrudSchemas.ts
| @@ -206,7 +206,7 @@ const filterTableSchema = (crudSchema: VxeCrudSchema): VxeGridPropTypes.Columns | @@ -206,7 +206,7 @@ const filterTableSchema = (crudSchema: VxeCrudSchema): VxeGridPropTypes.Columns | ||
| 206 | const tableSchemaItem = { | 206 | const tableSchemaItem = { |
| 207 | title: t('table.action'), | 207 | title: t('table.action'), |
| 208 | field: 'actionbtns', | 208 | field: 'actionbtns', |
| 209 | - width: crudSchema.actionWidth ? crudSchema.actionWidth : '240px', | 209 | + width: crudSchema.actionWidth ? crudSchema.actionWidth : '200px', |
| 210 | slots: { | 210 | slots: { |
| 211 | default: 'actionbtns_default' | 211 | default: 'actionbtns_default' |
| 212 | } | 212 | } |
| @@ -234,7 +234,7 @@ const filterFormSchema = (crudSchema: VxeCrudSchema): FormSchema[] => { | @@ -234,7 +234,7 @@ const filterFormSchema = (crudSchema: VxeCrudSchema): FormSchema[] => { | ||
| 234 | comonentProps = { | 234 | comonentProps = { |
| 235 | options: options | 235 | options: options |
| 236 | } | 236 | } |
| 237 | - if (!(schemaItem.form && schemaItem.form.component)) component = 'SelectV2' | 237 | + if (!(schemaItem.form && schemaItem.form.component)) component = 'Select' |
| 238 | } | 238 | } |
| 239 | const formSchemaItem = { | 239 | const formSchemaItem = { |
| 240 | ...schemaItem.form, | 240 | ...schemaItem.form, |
| @@ -267,10 +267,9 @@ const filterDescriptionsSchema = (crudSchema: VxeCrudSchema): DescriptionsSchema | @@ -267,10 +267,9 @@ const filterDescriptionsSchema = (crudSchema: VxeCrudSchema): DescriptionsSchema | ||
| 267 | descriptionsSchemaItem.dictType = schemaItem.dictType | 267 | descriptionsSchemaItem.dictType = schemaItem.dictType |
| 268 | } | 268 | } |
| 269 | if (schemaItem.detail?.dateFormat || schemaItem.formatter == 'formatDate') { | 269 | if (schemaItem.detail?.dateFormat || schemaItem.formatter == 'formatDate') { |
| 270 | - // descriptionsSchemaItem.dateFormat = schemaItem.detail.dateFormat | ||
| 271 | - // ? schemaItem?.detail?.dateFormat | ||
| 272 | - // : 'YYYY-MM-DD HH:mm:ss' | ||
| 273 | - descriptionsSchemaItem.dateFormat = 'YYYY-MM-DD HH:mm:ss' | 270 | + descriptionsSchemaItem.dateFormat = schemaItem.dateFormat |
| 271 | + ? schemaItem?.detail?.dateFormat | ||
| 272 | + : 'YYYY-MM-DD HH:mm:ss' | ||
| 274 | } | 273 | } |
| 275 | 274 | ||
| 276 | descriptionsSchema.push(descriptionsSchemaItem) | 275 | descriptionsSchema.push(descriptionsSchemaItem) |
yudao-ui-admin-vue3/src/plugins/vxeTable/index.ts
| @@ -139,10 +139,6 @@ VXETable.formats.mixin({ | @@ -139,10 +139,6 @@ VXETable.formats.mixin({ | ||
| 139 | formatDate({ cellValue }, format) { | 139 | formatDate({ cellValue }, format) { |
| 140 | return XEUtils.toDateString(cellValue, format || 'yyyy-MM-dd HH:mm:ss') | 140 | return XEUtils.toDateString(cellValue, format || 'yyyy-MM-dd HH:mm:ss') |
| 141 | }, | 141 | }, |
| 142 | - // 格式字典 | ||
| 143 | - formatDict() { | ||
| 144 | - return 'cellValue 123' | ||
| 145 | - }, | ||
| 146 | // 四舍五入金额,每隔3位逗号分隔,默认2位数 | 142 | // 四舍五入金额,每隔3位逗号分隔,默认2位数 |
| 147 | formatAmount({ cellValue }, digits = 2) { | 143 | formatAmount({ cellValue }, digits = 2) { |
| 148 | return XEUtils.commafy(Number(cellValue), { digits }) | 144 | return XEUtils.commafy(Number(cellValue), { digits }) |
| @@ -158,6 +154,10 @@ VXETable.formats.mixin({ | @@ -158,6 +154,10 @@ VXETable.formats.mixin({ | ||
| 158 | // 向下舍入,默认两位数 | 154 | // 向下舍入,默认两位数 |
| 159 | formatCutNumber({ cellValue }, digits = 2) { | 155 | formatCutNumber({ cellValue }, digits = 2) { |
| 160 | return XEUtils.toFixed(XEUtils.floor(cellValue, digits), digits) | 156 | return XEUtils.toFixed(XEUtils.floor(cellValue, digits), digits) |
| 157 | + }, | ||
| 158 | + // 格式化图片,将图片链接转换为html标签 | ||
| 159 | + formatImg({ cellValue }) { | ||
| 160 | + return '<img height="40" src="' + cellValue + '"> ' | ||
| 161 | } | 161 | } |
| 162 | }) | 162 | }) |
| 163 | export const setupVxeTable = (app: App<Element>) => { | 163 | export const setupVxeTable = (app: App<Element>) => { |
yudao-ui-admin-vue3/src/utils/dict.ts
| @@ -15,19 +15,16 @@ const dictStore = useDictStoreWithOut() | @@ -15,19 +15,16 @@ const dictStore = useDictStoreWithOut() | ||
| 15 | export interface DictDataType { | 15 | export interface DictDataType { |
| 16 | dictType: string | 16 | dictType: string |
| 17 | label: string | 17 | label: string |
| 18 | - value: string | number | boolean | ||
| 19 | - colorType?: ElementPlusInfoType | '' | 'default' | 'primary' | ||
| 20 | - cssClass?: string | 18 | + value: string | number |
| 19 | + colorType: ElementPlusInfoType | '' | 'default' | 'primary' | ||
| 20 | + cssClass: string | ||
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | export const getDictOptions = (dictType: string) => { | 23 | export const getDictOptions = (dictType: string) => { |
| 24 | const dictOptions: DictDataType[] = [] | 24 | const dictOptions: DictDataType[] = [] |
| 25 | dictStore.getDictMap.forEach((dict: DictDataType) => { | 25 | dictStore.getDictMap.forEach((dict: DictDataType) => { |
| 26 | - if (dict.dictType.toString() === dictType) { | ||
| 27 | - dictOptions.push({ | ||
| 28 | - ...dict, | ||
| 29 | - value: dict.value | ||
| 30 | - }) | 26 | + if (dict.dictType + '' === dictType) { |
| 27 | + dictOptions.push(dict) | ||
| 31 | } | 28 | } |
| 32 | }) | 29 | }) |
| 33 | return dictOptions | 30 | return dictOptions |
yudao-ui-admin-vue3/src/views/system/notice/notice.data.ts
| @@ -36,6 +36,9 @@ const crudSchemas = reactive<VxeCrudSchema>({ | @@ -36,6 +36,9 @@ const crudSchemas = reactive<VxeCrudSchema>({ | ||
| 36 | { | 36 | { |
| 37 | title: '公告内容', | 37 | title: '公告内容', |
| 38 | field: 'content', | 38 | field: 'content', |
| 39 | + table: { | ||
| 40 | + type: 'html' | ||
| 41 | + }, | ||
| 39 | form: { | 42 | form: { |
| 40 | component: 'Editor', | 43 | component: 'Editor', |
| 41 | colProps: { | 44 | colProps: { |
yudao-ui-admin-vue3/src/views/system/oauth2/client/client.data.ts
| @@ -35,12 +35,16 @@ const crudSchemas = reactive<VxeCrudSchema>({ | @@ -35,12 +35,16 @@ const crudSchemas = reactive<VxeCrudSchema>({ | ||
| 35 | }, | 35 | }, |
| 36 | { | 36 | { |
| 37 | title: '应用图标', | 37 | title: '应用图标', |
| 38 | - field: 'logo' | 38 | + field: 'logo', |
| 39 | + table: { | ||
| 40 | + type: 'html', | ||
| 41 | + formatter: 'formatImg' | ||
| 42 | + } | ||
| 39 | }, | 43 | }, |
| 40 | { | 44 | { |
| 41 | title: t('common.status'), | 45 | title: t('common.status'), |
| 42 | field: 'status', | 46 | field: 'status', |
| 43 | - dictType: DICT_TYPE.COMMON_STATUS, // TODO @星语:编辑时,status 展示为 0 或者 1 了 | 47 | + dictType: DICT_TYPE.COMMON_STATUS, |
| 44 | isSearch: true | 48 | isSearch: true |
| 45 | }, | 49 | }, |
| 46 | { | 50 | { |
| @@ -60,9 +64,11 @@ const crudSchemas = reactive<VxeCrudSchema>({ | @@ -60,9 +64,11 @@ const crudSchemas = reactive<VxeCrudSchema>({ | ||
| 60 | { | 64 | { |
| 61 | title: '授权类型', | 65 | title: '授权类型', |
| 62 | field: 'authorizedGrantTypes', | 66 | field: 'authorizedGrantTypes', |
| 63 | - dictType: DICT_TYPE.SYSTEM_OAUTH2_GRANT_TYPE, | ||
| 64 | - form: { | ||
| 65 | - component: 'SelectV2' // TODO @星语:多选 | 67 | + table: { |
| 68 | + width: 300, | ||
| 69 | + slots: { | ||
| 70 | + default: 'authorizedGrantTypes_default' | ||
| 71 | + } | ||
| 66 | } | 72 | } |
| 67 | }, | 73 | }, |
| 68 | { | 74 | { |
yudao-ui-admin-vue3/src/views/system/oauth2/client/index.vue
| @@ -12,7 +12,7 @@ | @@ -12,7 +12,7 @@ | ||
| 12 | @click="handleCreate()" | 12 | @click="handleCreate()" |
| 13 | /> | 13 | /> |
| 14 | </template> | 14 | </template> |
| 15 | - <template #authorizedGrantTypes="{ row }"> | 15 | + <template #authorizedGrantTypes_default="{ row }"> |
| 16 | <el-tag | 16 | <el-tag |
| 17 | :disable-transitions="true" | 17 | :disable-transitions="true" |
| 18 | :key="index" | 18 | :key="index" |