123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas'
- import { getTenantPackageList, TenantPackageVO } from '@/api/system/tenantPackage'
- import { ComponentOptions } from '@/types/components'
- const { t } = useI18n() // 国际化
- export const tenantPackageOption: ComponentOptions[] = []
- const getTenantPackageOptions = async () => {
- const res = await getTenantPackageList()
- res.forEach((tenantPackage: TenantPackageVO) => {
- tenantPackageOption.push({
- key: tenantPackage.id,
- value: tenantPackage.id,
- label: tenantPackage.name
- })
- })
- return tenantPackageOption
- }
- getTenantPackageOptions()
- // 表单校验
- export const rules = reactive({
- name: [required],
- packageId: [required],
- contactName: [required],
- contactMobile: [required],
- accountCount: [required],
- expireTime: [required],
- username: [
- required,
- {
- min: 4,
- max: 30,
- trigger: 'blur',
- message: '用户名称长度为 4-30 个字符'
- }
- ],
- password: [
- required,
- {
- min: 4,
- max: 16,
- trigger: 'blur',
- message: '密码长度为 4-16 位'
- }
- ],
- domain: [required],
- status: [required]
- })
- // CrudSchema.
- const crudSchemas = reactive<VxeCrudSchema>({
- primaryKey: 'id',
- primaryTitle: '租户编号',
- primaryType: 'id',
- action: true,
- columns: [
- {
- title: '租户名称',
- field: 'name',
- isSearch: true
- },
- {
- title: '租户套餐',
- field: 'packageId',
- table: {
- slots: {
- default: 'packageId_default'
- }
- },
- form: {
- component: 'Select',
- componentProps: {
- options: tenantPackageOption
- }
- }
- },
- {
- title: '联系人',
- field: 'contactName',
- isSearch: true
- },
- {
- title: '联系手机',
- field: 'contactMobile',
- isSearch: true
- },
- {
- title: '用户名称',
- field: 'username',
- isTable: false,
- isDetail: false
- },
- {
- title: '用户密码',
- field: 'password',
- isTable: false,
- isDetail: false,
- form: {
- component: 'InputPassword'
- }
- },
- {
- title: '账号额度',
- field: 'accountCount',
- table: {
- slots: {
- default: 'accountCount_default'
- }
- },
- form: {
- component: 'InputNumber'
- }
- },
- {
- title: '过期时间',
- field: 'expireTime',
- formatter: 'formatDate',
- form: {
- component: 'DatePicker',
- componentProps: {
- type: 'datetime',
- valueFormat: 'x'
- }
- }
- },
- {
- title: '绑定域名',
- field: 'domain'
- },
- {
- title: '租户状态',
- field: 'status',
- dictType: DICT_TYPE.COMMON_STATUS,
- dictClass: 'number',
- isSearch: true
- },
- {
- title: t('table.createTime'),
- field: 'createTime',
- formatter: 'formatDate',
- isForm: false,
- search: {
- show: true,
- itemRender: {
- name: 'XDataTimePicker'
- }
- }
- }
- ]
- })
- export const { allSchemas } = useVxeCrudSchemas(crudSchemas)
|