fix: error

This commit is contained in:
xingyu4j 2022-11-15 13:59:22 +08:00
parent a701c1d76c
commit c7972f9a06
8 changed files with 31 additions and 25 deletions

View File

@ -249,6 +249,7 @@ export default defineComponent({
const renderOptions = (item: FormSchema) => {
switch (item.component) {
case 'Select':
case 'SelectV2':
const { renderSelectOptions } = useRenderSelect(slots)
return renderSelectOptions(item)
case 'Radio':

View File

@ -14,7 +14,7 @@ import { ColProps } from '@/types/components'
export const setTextPlaceholder = (schema: FormSchema): PlaceholderMoel => {
const { t } = useI18n()
const textMap = ['Input', 'Autocomplete', 'InputNumber', 'InputPassword']
const selectMap = ['Select', 'TimePicker', 'DatePicker', 'TimeSelect', 'TimeSelect']
const selectMap = ['Select', 'SelectV2', 'TimePicker', 'DatePicker', 'TimeSelect', 'TimeSelect']
if (textMap.includes(schema?.component as string)) {
return {
placeholder: t('common.inputText')

View File

@ -206,7 +206,7 @@ const filterTableSchema = (crudSchema: VxeCrudSchema): VxeGridPropTypes.Columns
const tableSchemaItem = {
title: t('table.action'),
field: 'actionbtns',
width: crudSchema.actionWidth ? crudSchema.actionWidth : '240px',
width: crudSchema.actionWidth ? crudSchema.actionWidth : '200px',
slots: {
default: 'actionbtns_default'
}
@ -234,7 +234,7 @@ const filterFormSchema = (crudSchema: VxeCrudSchema): FormSchema[] => {
comonentProps = {
options: options
}
if (!(schemaItem.form && schemaItem.form.component)) component = 'SelectV2'
if (!(schemaItem.form && schemaItem.form.component)) component = 'Select'
}
const formSchemaItem = {
...schemaItem.form,
@ -267,10 +267,9 @@ const filterDescriptionsSchema = (crudSchema: VxeCrudSchema): DescriptionsSchema
descriptionsSchemaItem.dictType = schemaItem.dictType
}
if (schemaItem.detail?.dateFormat || schemaItem.formatter == 'formatDate') {
// descriptionsSchemaItem.dateFormat = schemaItem.detail.dateFormat
// ? schemaItem?.detail?.dateFormat
// : 'YYYY-MM-DD HH:mm:ss'
descriptionsSchemaItem.dateFormat = 'YYYY-MM-DD HH:mm:ss'
descriptionsSchemaItem.dateFormat = schemaItem.dateFormat
? schemaItem?.detail?.dateFormat
: 'YYYY-MM-DD HH:mm:ss'
}
descriptionsSchema.push(descriptionsSchemaItem)

View File

@ -139,10 +139,6 @@ VXETable.formats.mixin({
formatDate({ cellValue }, format) {
return XEUtils.toDateString(cellValue, format || 'yyyy-MM-dd HH:mm:ss')
},
// 格式字典
formatDict() {
return 'cellValue 123'
},
// 四舍五入金额每隔3位逗号分隔默认2位数
formatAmount({ cellValue }, digits = 2) {
return XEUtils.commafy(Number(cellValue), { digits })
@ -158,6 +154,10 @@ VXETable.formats.mixin({
// 向下舍入,默认两位数
formatCutNumber({ cellValue }, digits = 2) {
return XEUtils.toFixed(XEUtils.floor(cellValue, digits), digits)
},
// 格式化图片将图片链接转换为html标签
formatImg({ cellValue }) {
return '<img height="40" src="' + cellValue + '"> '
}
})
export const setupVxeTable = (app: App<Element>) => {

View File

@ -15,19 +15,16 @@ const dictStore = useDictStoreWithOut()
export interface DictDataType {
dictType: string
label: string
value: string | number | boolean
colorType?: ElementPlusInfoType | '' | 'default' | 'primary'
cssClass?: string
value: string | number
colorType: ElementPlusInfoType | '' | 'default' | 'primary'
cssClass: string
}
export const getDictOptions = (dictType: string) => {
const dictOptions: DictDataType[] = []
dictStore.getDictMap.forEach((dict: DictDataType) => {
if (dict.dictType.toString() === dictType) {
dictOptions.push({
...dict,
value: dict.value
})
if (dict.dictType + '' === dictType) {
dictOptions.push(dict)
}
})
return dictOptions

View File

@ -36,6 +36,9 @@ const crudSchemas = reactive<VxeCrudSchema>({
{
title: '公告内容',
field: 'content',
table: {
type: 'html'
},
form: {
component: 'Editor',
colProps: {

View File

@ -35,12 +35,16 @@ const crudSchemas = reactive<VxeCrudSchema>({
},
{
title: '应用图标',
field: 'logo'
field: 'logo',
table: {
type: 'html',
formatter: 'formatImg'
}
},
{
title: t('common.status'),
field: 'status',
dictType: DICT_TYPE.COMMON_STATUS, // TODO @星语编辑时status 展示为 0 或者 1 了
dictType: DICT_TYPE.COMMON_STATUS,
isSearch: true
},
{
@ -60,9 +64,11 @@ const crudSchemas = reactive<VxeCrudSchema>({
{
title: '授权类型',
field: 'authorizedGrantTypes',
dictType: DICT_TYPE.SYSTEM_OAUTH2_GRANT_TYPE,
form: {
component: 'SelectV2' // TODO @星语:多选
table: {
width: 300,
slots: {
default: 'authorizedGrantTypes_default'
}
}
},
{

View File

@ -12,7 +12,7 @@
@click="handleCreate()"
/>
</template>
<template #authorizedGrantTypes="{ row }">
<template #authorizedGrantTypes_default="{ row }">
<el-tag
:disable-transitions="true"
:key="index"