Files
ipms-sjy/yudao-ui-admin-vue3/src/views/system/sms/smsTemplate/sms.template.data.ts

83 lines
1.7 KiB
TypeScript
Raw Normal View History

2022-07-18 19:06:37 +08:00
import { reactive } from 'vue'
import { useI18n } from '@/hooks/web/useI18n'
import { required } from '@/utils/formRules'
import { DICT_TYPE } from '@/utils/dict'
2022-11-15 20:43:02 +08:00
import { VxeCrudSchema, useVxeCrudSchemas } from '@/hooks/web/useVxeCrudSchemas'
2022-07-18 19:06:37 +08:00
const { t } = useI18n() // 国际化
// 表单校验
export const rules = reactive({
type: [required],
status: [required],
code: [required],
2022-07-18 19:06:37 +08:00
name: [required],
content: [required],
apiTemplateId: [required],
channelId: [required]
2022-07-18 19:06:37 +08:00
})
// CrudSchema
2022-11-15 20:43:02 +08:00
const crudSchemas = reactive<VxeCrudSchema>({
primaryKey: 'id',
primaryType: 'seq',
action: true,
2022-11-16 17:03:32 +08:00
actionWidth: '280',
2022-11-15 20:43:02 +08:00
columns: [
{
2022-11-16 17:03:32 +08:00
title: '模板编码',
2022-11-15 20:43:02 +08:00
field: 'code',
isSearch: true
2022-07-18 19:06:37 +08:00
},
2022-11-15 20:43:02 +08:00
{
2022-11-16 17:03:32 +08:00
title: '模板名称',
2022-11-15 20:43:02 +08:00
field: 'name',
isSearch: true
2022-07-18 19:06:37 +08:00
},
2022-11-15 20:43:02 +08:00
{
2022-11-16 17:03:32 +08:00
title: '模板内容',
2022-11-15 20:43:02 +08:00
field: 'content'
2022-07-18 19:06:37 +08:00
},
2022-11-15 20:43:02 +08:00
{
2022-11-16 17:03:32 +08:00
title: '短信 API 的模板编号',
2022-11-15 20:43:02 +08:00
field: 'apiTemplateId',
isSearch: true
},
{
2022-11-16 17:03:32 +08:00
title: '短信类型',
2022-11-15 20:43:02 +08:00
field: 'type',
2022-11-16 17:03:32 +08:00
dictType: DICT_TYPE.SYSTEM_SMS_TEMPLATE_TYPE,
2022-11-16 23:15:14 +08:00
dictData: 'number',
2022-11-16 17:03:32 +08:00
table: {
width: 80
}
2022-11-15 20:43:02 +08:00
},
{
2022-11-16 17:03:32 +08:00
title: t('common.status'),
2022-11-15 20:43:02 +08:00
field: 'status',
2022-11-16 17:03:32 +08:00
dictType: DICT_TYPE.COMMON_STATUS,
2022-11-16 23:15:14 +08:00
dictData: 'number',
2022-11-16 17:03:32 +08:00
table: {
width: 80
}
2022-11-15 20:43:02 +08:00
},
{
2022-11-16 17:03:32 +08:00
title: t('form.remark'),
2022-11-15 20:43:02 +08:00
field: 'remark',
isTable: false
},
{
title: t('common.createTime'),
field: 'createTime',
formatter: 'formatDate',
isForm: false,
search: {
show: true,
itemRender: {
name: 'XDataTimePicker'
}
}
2022-07-18 19:06:37 +08:00
}
2022-11-15 20:43:02 +08:00
]
})
export const { allSchemas } = useVxeCrudSchemas(crudSchemas)