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 | 249 | const renderOptions = (item: FormSchema) => { |
| 250 | 250 | switch (item.component) { |
| 251 | 251 | case 'Select': |
| 252 | + case 'SelectV2': | |
| 252 | 253 | const { renderSelectOptions } = useRenderSelect(slots) |
| 253 | 254 | return renderSelectOptions(item) |
| 254 | 255 | case 'Radio': | ... | ... |
yudao-ui-admin-vue3/src/components/Form/src/helper.ts
| ... | ... | @@ -14,7 +14,7 @@ import { ColProps } from '@/types/components' |
| 14 | 14 | export const setTextPlaceholder = (schema: FormSchema): PlaceholderMoel => { |
| 15 | 15 | const { t } = useI18n() |
| 16 | 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 | 18 | if (textMap.includes(schema?.component as string)) { |
| 19 | 19 | return { |
| 20 | 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 | 206 | const tableSchemaItem = { |
| 207 | 207 | title: t('table.action'), |
| 208 | 208 | field: 'actionbtns', |
| 209 | - width: crudSchema.actionWidth ? crudSchema.actionWidth : '240px', | |
| 209 | + width: crudSchema.actionWidth ? crudSchema.actionWidth : '200px', | |
| 210 | 210 | slots: { |
| 211 | 211 | default: 'actionbtns_default' |
| 212 | 212 | } |
| ... | ... | @@ -234,7 +234,7 @@ const filterFormSchema = (crudSchema: VxeCrudSchema): FormSchema[] => { |
| 234 | 234 | comonentProps = { |
| 235 | 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 | 239 | const formSchemaItem = { |
| 240 | 240 | ...schemaItem.form, |
| ... | ... | @@ -267,10 +267,9 @@ const filterDescriptionsSchema = (crudSchema: VxeCrudSchema): DescriptionsSchema |
| 267 | 267 | descriptionsSchemaItem.dictType = schemaItem.dictType |
| 268 | 268 | } |
| 269 | 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 | 275 | descriptionsSchema.push(descriptionsSchemaItem) | ... | ... |
yudao-ui-admin-vue3/src/plugins/vxeTable/index.ts
| ... | ... | @@ -139,10 +139,6 @@ VXETable.formats.mixin({ |
| 139 | 139 | formatDate({ cellValue }, format) { |
| 140 | 140 | return XEUtils.toDateString(cellValue, format || 'yyyy-MM-dd HH:mm:ss') |
| 141 | 141 | }, |
| 142 | - // 格式字典 | |
| 143 | - formatDict() { | |
| 144 | - return 'cellValue 123' | |
| 145 | - }, | |
| 146 | 142 | // 四舍五入金额,每隔3位逗号分隔,默认2位数 |
| 147 | 143 | formatAmount({ cellValue }, digits = 2) { |
| 148 | 144 | return XEUtils.commafy(Number(cellValue), { digits }) |
| ... | ... | @@ -158,6 +154,10 @@ VXETable.formats.mixin({ |
| 158 | 154 | // 向下舍入,默认两位数 |
| 159 | 155 | formatCutNumber({ cellValue }, digits = 2) { |
| 160 | 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 | 163 | export const setupVxeTable = (app: App<Element>) => { | ... | ... |
yudao-ui-admin-vue3/src/utils/dict.ts
| ... | ... | @@ -15,19 +15,16 @@ const dictStore = useDictStoreWithOut() |
| 15 | 15 | export interface DictDataType { |
| 16 | 16 | dictType: string |
| 17 | 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 | 23 | export const getDictOptions = (dictType: string) => { |
| 24 | 24 | const dictOptions: DictDataType[] = [] |
| 25 | 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 | 30 | return dictOptions | ... | ... |
yudao-ui-admin-vue3/src/views/system/notice/notice.data.ts
yudao-ui-admin-vue3/src/views/system/oauth2/client/client.data.ts
| ... | ... | @@ -35,12 +35,16 @@ const crudSchemas = reactive<VxeCrudSchema>({ |
| 35 | 35 | }, |
| 36 | 36 | { |
| 37 | 37 | title: '应用图标', |
| 38 | - field: 'logo' | |
| 38 | + field: 'logo', | |
| 39 | + table: { | |
| 40 | + type: 'html', | |
| 41 | + formatter: 'formatImg' | |
| 42 | + } | |
| 39 | 43 | }, |
| 40 | 44 | { |
| 41 | 45 | title: t('common.status'), |
| 42 | 46 | field: 'status', |
| 43 | - dictType: DICT_TYPE.COMMON_STATUS, // TODO @星语:编辑时,status 展示为 0 或者 1 了 | |
| 47 | + dictType: DICT_TYPE.COMMON_STATUS, | |
| 44 | 48 | isSearch: true |
| 45 | 49 | }, |
| 46 | 50 | { |
| ... | ... | @@ -60,9 +64,11 @@ const crudSchemas = reactive<VxeCrudSchema>({ |
| 60 | 64 | { |
| 61 | 65 | title: '授权类型', |
| 62 | 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