diff --git a/src/api/system/tenantPackage/index.ts b/src/api/system/tenantPackage/index.ts index 823d2990..a427286f 100644 --- a/src/api/system/tenantPackage/index.ts +++ b/src/api/system/tenantPackage/index.ts @@ -20,7 +20,7 @@ export interface TenantPackagePageReqVO extends PageParam { } // 查询租户套餐列表 -export const getTenantPackageTypePageApi = (params: TenantPackagePageReqVO) => { +export const getTenantPackagePageApi = (params: TenantPackagePageReqVO) => { return defHttp.get({ url: '/system/tenant-package/page', params }) } @@ -30,17 +30,17 @@ export const getTenantPackageApi = (id: number) => { } // 新增租户套餐 -export const createTenantPackageTypeApi = (data: TenantPackageVO) => { +export const createTenantPackageApi = (data: TenantPackageVO) => { return defHttp.post({ url: '/system/tenant-package/create', data }) } // 修改租户套餐 -export const updateTenantPackageTypeApi = (data: TenantPackageVO) => { +export const updateTenantPackageApi = (data: TenantPackageVO) => { return defHttp.put({ url: '/system/tenant-package/update', data }) } // 删除租户套餐 -export const deleteTenantPackageTypeApi = (id: number) => { +export const deleteTenantPackageApi = (id: number) => { return defHttp.delete({ url: '/system/tenant-package/delete?id=' + id }) } // 获取租户套餐精简信息列表 diff --git a/src/components/Form/src/components/ApiTree.vue b/src/components/Form/src/components/ApiTree.vue index 8f3e7e77..ca534e4f 100644 --- a/src/components/Form/src/components/ApiTree.vue +++ b/src/components/Form/src/components/ApiTree.vue @@ -15,13 +15,15 @@ import { isArray, isFunction } from '@/utils/is' import { get } from 'lodash-es' import { propTypes } from '@/utils/propTypes' import { LoadingOutlined } from '@ant-design/icons-vue' +import { handleTree } from '@/utils/tree' const props = defineProps({ api: { type: Function as PropType<(arg?: Recordable) => Promise> }, params: { type: Object }, immediate: { type: Boolean, default: true }, resultField: propTypes.string.def(''), - afterFetch: { type: Function as PropType } + afterFetch: { type: Function as PropType }, + handleTree: { type: String, default: '' } }) const emit = defineEmits(['options-change', 'change']) const attrs = useAttrs() @@ -76,6 +78,9 @@ async function fetch() { } loading.value = false if (!result) return + if (props.handleTree) { + result = handleTree(result, props.handleTree) + } if (!isArray(result)) { result = get(result, props.resultField) } diff --git a/src/views/system/tenant/TenantModel.vue b/src/views/system/tenant/TenantModel.vue new file mode 100644 index 00000000..5a1e649d --- /dev/null +++ b/src/views/system/tenant/TenantModel.vue @@ -0,0 +1,58 @@ + + diff --git a/src/views/system/tenant/index.vue b/src/views/system/tenant/index.vue index 3b64cfc4..913c63af 100644 --- a/src/views/system/tenant/index.vue +++ b/src/views/system/tenant/index.vue @@ -1,3 +1,96 @@ + diff --git a/src/views/system/tenant/tenant.data.ts b/src/views/system/tenant/tenant.data.ts new file mode 100644 index 00000000..5a913a66 --- /dev/null +++ b/src/views/system/tenant/tenant.data.ts @@ -0,0 +1,185 @@ +import { getTenantPackageList } from '@/api/system/tenantPackage' +import { BasicColumn, FormSchema, useRender } from '@/components/Table' +import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' + +export const columns: BasicColumn[] = [ + { + title: '租户编号', + dataIndex: 'id', + width: 100 + }, + { + title: '租户名', + dataIndex: 'name', + width: 180 + }, + { + title: '租户套餐', + dataIndex: 'packageId', + width: 100 + }, + { + title: '联系人', + dataIndex: 'contactName', + width: 120 + }, + { + title: '联系手机', + dataIndex: 'contactMobile', + width: 120 + }, + { + title: '账号额度', + dataIndex: 'accountCount', + width: 120, + customRender: ({ text }) => { + return useRender.renderTag(text) + } + }, + { + title: '过期时间', + dataIndex: 'expireTime', + width: 180, + customRender: ({ text }) => { + return useRender.renderDate(text) + } + }, + { + title: '绑定域名', + dataIndex: 'domain', + width: 120 + }, + { + title: '租户状态', + dataIndex: 'status', + width: 180, + customRender: ({ text }) => { + return useRender.renderDict(text, DICT_TYPE.COMMON_STATUS) + } + }, + { + title: '备注', + dataIndex: 'remark', + width: 180 + }, + { + title: '创建时间', + dataIndex: 'createTime', + width: 180, + customRender: ({ text }) => { + return useRender.renderDate(text) + } + } +] + +export const searchFormSchema: FormSchema[] = [ + { + label: '租户名', + field: 'name', + component: 'Input', + colProps: { span: 8 } + }, + { + label: '联系人', + field: 'contactName', + component: 'Input', + colProps: { span: 8 } + }, + { + label: '联系手机', + field: 'contactMobile', + component: 'Input', + colProps: { span: 8 } + }, + { + label: '状态', + field: 'status', + component: 'Select', + componentProps: { + options: getIntDictOptions(DICT_TYPE.COMMON_STATUS) + }, + colProps: { span: 8 } + }, + { + label: '创建时间', + field: 'createTime', + component: 'RangePicker', + colProps: { span: 8 } + } +] + +export const formSchema: FormSchema[] = [ + { + label: '编号', + field: 'id', + show: false, + component: 'Input' + }, + { + label: '租户名', + field: 'name', + required: true, + component: 'Input' + }, + { + label: '租户套餐', + field: 'packageId', + required: true, + component: 'ApiSelect', + componentProps: { + api: () => getTenantPackageList(), + labelField: 'name', + valueField: 'id' + } + }, + { + label: '联系人', + field: 'contactName', + required: true, + component: 'Input' + }, + { + label: '联系手机', + field: 'contactMobile', + component: 'Input' + }, + { + label: '用户名称', + field: 'username', + component: 'Input', + dynamicDisabled: ({ values }) => values.id !== undefined + }, + { + label: '用户密码', + field: 'password', + component: 'InputPassword', + ifShow: ({ values }) => values.id === undefined + }, + { + label: '账号额度', + field: 'accountCount', + required: true, + component: 'InputNumber' + }, + { + label: '过期时间', + field: 'expireTime', + required: true, + component: 'TimePicker' + }, + { + label: '绑定域名', + field: 'domain', + required: true, + component: 'Input' + }, + { + label: '租户状态', + field: 'status', + component: 'Select', + defaultValue: 0, + componentProps: { + options: getIntDictOptions(DICT_TYPE.COMMON_STATUS) + } + } +] diff --git a/src/views/system/tenantPackage/TenantPackageModel.vue b/src/views/system/tenantPackage/TenantPackageModel.vue new file mode 100644 index 00000000..f5b1ac3a --- /dev/null +++ b/src/views/system/tenantPackage/TenantPackageModel.vue @@ -0,0 +1,58 @@ + + diff --git a/src/views/system/tenantPackage/index.vue b/src/views/system/tenantPackage/index.vue index 3b64cfc4..0c38e02f 100644 --- a/src/views/system/tenantPackage/index.vue +++ b/src/views/system/tenantPackage/index.vue @@ -1,3 +1,81 @@ + diff --git a/src/views/system/tenantPackage/tenantPackage.data.ts b/src/views/system/tenantPackage/tenantPackage.data.ts new file mode 100644 index 00000000..fd6e7df0 --- /dev/null +++ b/src/views/system/tenantPackage/tenantPackage.data.ts @@ -0,0 +1,104 @@ +import { listSimpleMenusApi } from '@/api/system/menu' +import { BasicColumn, FormSchema, useRender } from '@/components/Table' +import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' + +export const columns: BasicColumn[] = [ + { + title: '套餐编号', + dataIndex: 'id', + width: 100 + }, + { + title: '套餐名', + dataIndex: 'name', + width: 180 + }, + { + title: '状态', + dataIndex: 'status', + width: 180, + customRender: ({ text }) => { + return useRender.renderDict(text, DICT_TYPE.COMMON_STATUS) + } + }, + { + title: '备注', + dataIndex: 'remark', + width: 180 + }, + { + title: '创建时间', + dataIndex: 'createTime', + width: 180, + customRender: ({ text }) => { + return useRender.renderDate(text) + } + } +] + +export const searchFormSchema: FormSchema[] = [ + { + label: '套餐名', + field: 'name', + component: 'Input', + colProps: { span: 8 } + }, + { + label: '状态', + field: 'status', + component: 'Select', + componentProps: { + options: getIntDictOptions(DICT_TYPE.COMMON_STATUS) + }, + colProps: { span: 8 } + }, + { + label: '创建时间', + field: 'createTime', + component: 'RangePicker', + colProps: { span: 8 } + } +] + +export const formSchema: FormSchema[] = [ + { + label: '编号', + field: 'id', + show: false, + component: 'Input' + }, + { + label: '套餐名', + field: 'name', + required: true, + component: 'Input' + }, + { + label: '菜单权限', + field: 'packageId', + required: true, + component: 'ApiTree', + // TODO + componentProps: { + api: () => listSimpleMenusApi(), + fieldNames: { + title: 'name', + key: 'id', + children: 'children' + }, + handleTree: 'id', + checkable: true, + multiple: true, + checkedKeys: [] + } + }, + { + label: '状态', + field: 'status', + component: 'Select', + defaultValue: 0, + componentProps: { + options: getIntDictOptions(DICT_TYPE.COMMON_STATUS) + } + } +]