|
|
@@ -1,11 +1,13 @@
|
|
|
<script setup lang="tsx">
|
|
|
+import { nextTick } from 'vue';
|
|
|
import { NButton, NPopconfirm, NTag } from 'naive-ui';
|
|
|
import {
|
|
|
fetchAddTenant,
|
|
|
fetchDeleteTenant,
|
|
|
fetchEditTenant,
|
|
|
fetchGetTenantList,
|
|
|
- fetchGetTenantPackageList
|
|
|
+ fetchGetTenantPackageList,
|
|
|
+ fetchTenantDetail
|
|
|
} from '@/service/api/tenant';
|
|
|
import { useTable } from '@/components/zt/Table/hooks/useTable';
|
|
|
import { $t } from '@/locales';
|
|
|
@@ -107,137 +109,138 @@ async function handleDelete(row: Recordable) {
|
|
|
refresh();
|
|
|
}
|
|
|
|
|
|
-const [registerModalForm, { openModal, closeModal, getFieldsValue, setFieldsValue, setModalLoading }] = useModalFrom({
|
|
|
- modalConfig: {
|
|
|
- title: '租户',
|
|
|
- width: 800,
|
|
|
- isShowHeaderText: true
|
|
|
- },
|
|
|
- formConfig: {
|
|
|
- schemas: [
|
|
|
- {
|
|
|
- field: 'id',
|
|
|
- label: '',
|
|
|
- component: 'NInput',
|
|
|
- show: false
|
|
|
- },
|
|
|
- // 基本信息
|
|
|
- {
|
|
|
- field: 'tenantName',
|
|
|
- label: '企业名称',
|
|
|
- component: 'NInput',
|
|
|
- required: true,
|
|
|
- componentProps: {
|
|
|
- placeholder: '请输入企业名称'
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- field: 'contactName',
|
|
|
- label: '联系人',
|
|
|
- component: 'NInput',
|
|
|
- required: true,
|
|
|
- componentProps: {
|
|
|
- placeholder: '请输入联系人'
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- field: 'contactMobile',
|
|
|
- label: '联系电话',
|
|
|
- component: 'NInput',
|
|
|
- required: true,
|
|
|
- componentProps: {
|
|
|
- placeholder: '请输入联系电话',
|
|
|
- maxlength: 11
|
|
|
- }
|
|
|
- },
|
|
|
- // 管理员信息
|
|
|
- {
|
|
|
- field: 'adminUsername',
|
|
|
- label: '管理员账号',
|
|
|
- component: 'NInput',
|
|
|
- required: true,
|
|
|
- componentProps: {
|
|
|
- placeholder: '请输入管理员账号'
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- field: 'adminPassword',
|
|
|
- label: '管理员密码',
|
|
|
- component: 'NInput',
|
|
|
- required: true,
|
|
|
- componentProps: {
|
|
|
- placeholder: '请输入管理员密码',
|
|
|
- type: 'password',
|
|
|
- showPasswordOn: 'click'
|
|
|
- }
|
|
|
- },
|
|
|
- // 租户设置
|
|
|
- {
|
|
|
- field: 'packageId',
|
|
|
- label: '租户套餐',
|
|
|
- component: 'ApiSelect',
|
|
|
- required: true,
|
|
|
- componentProps: {
|
|
|
- api: () => fetchGetTenantPackageList({ pageNum: 1, pageSize: 100 }),
|
|
|
- labelFeild: 'packageName',
|
|
|
- valueFeild: 'id',
|
|
|
- resultFeild: 'data.list',
|
|
|
- placeholder: '请选择租户套餐'
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- field: 'tenantCode',
|
|
|
- label: '租户编号',
|
|
|
- component: 'NInput',
|
|
|
- required: true,
|
|
|
- componentProps: {
|
|
|
- placeholder: '请输入租户编号'
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- field: 'expireTime',
|
|
|
- label: '过期时间',
|
|
|
- component: 'NDatePicker',
|
|
|
- componentProps: {
|
|
|
- type: 'datetime',
|
|
|
- placeholder: '选择日期时间'
|
|
|
- } as any
|
|
|
- },
|
|
|
- // {
|
|
|
- // field: 'tenantDomain',
|
|
|
- // label: '绑定域名',
|
|
|
- // component: 'NInput',
|
|
|
- // required: true,
|
|
|
- // componentProps: {
|
|
|
- // placeholder: '请输入'
|
|
|
- // }
|
|
|
- // },
|
|
|
- {
|
|
|
- field: 'status',
|
|
|
- label: '租户状态',
|
|
|
- component: 'NRadioGroup',
|
|
|
- required: true,
|
|
|
- componentProps: {
|
|
|
- options: [
|
|
|
- {
|
|
|
- label: '正常',
|
|
|
- value: 1
|
|
|
- },
|
|
|
- {
|
|
|
- label: '停用',
|
|
|
- value: 0
|
|
|
- }
|
|
|
- ]
|
|
|
+const [registerModalForm, { openModal, closeModal, getFieldsValue, setFieldsValue, setModalLoading, updateSchema }] =
|
|
|
+ useModalFrom({
|
|
|
+ modalConfig: {
|
|
|
+ title: '租户',
|
|
|
+ width: 800,
|
|
|
+ isShowHeaderText: true
|
|
|
+ },
|
|
|
+ formConfig: {
|
|
|
+ schemas: [
|
|
|
+ {
|
|
|
+ field: 'id',
|
|
|
+ label: '',
|
|
|
+ component: 'NInput',
|
|
|
+ show: false
|
|
|
+ },
|
|
|
+ // 基本信息
|
|
|
+ {
|
|
|
+ field: 'tenantName',
|
|
|
+ label: '企业名称',
|
|
|
+ component: 'NInput',
|
|
|
+ required: true,
|
|
|
+ componentProps: {
|
|
|
+ placeholder: '请输入企业名称'
|
|
|
+ }
|
|
|
},
|
|
|
- defaultValue: 1
|
|
|
+ {
|
|
|
+ field: 'contactName',
|
|
|
+ label: '联系人',
|
|
|
+ component: 'NInput',
|
|
|
+ required: true,
|
|
|
+ componentProps: {
|
|
|
+ placeholder: '请输入联系人'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'contactMobile',
|
|
|
+ label: '联系电话',
|
|
|
+ component: 'NInput',
|
|
|
+ required: true,
|
|
|
+ componentProps: {
|
|
|
+ placeholder: '请输入联系电话',
|
|
|
+ maxlength: 11
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 管理员信息
|
|
|
+ {
|
|
|
+ field: 'adminUsername',
|
|
|
+ label: '管理员账号',
|
|
|
+ component: 'NInput',
|
|
|
+ required: true,
|
|
|
+ componentProps: {
|
|
|
+ placeholder: '请输入管理员账号'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'adminPassword',
|
|
|
+ label: '管理员密码',
|
|
|
+ component: 'NInput',
|
|
|
+ required: true,
|
|
|
+ componentProps: {
|
|
|
+ placeholder: '请输入管理员密码',
|
|
|
+ type: 'password',
|
|
|
+ showPasswordOn: 'click'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 租户设置
|
|
|
+ {
|
|
|
+ field: 'packageId',
|
|
|
+ label: '租户套餐',
|
|
|
+ component: 'ApiSelect',
|
|
|
+ required: true,
|
|
|
+ componentProps: {
|
|
|
+ api: () => fetchGetTenantPackageList({ pageNum: 1, pageSize: 100 }),
|
|
|
+ labelFeild: 'packageName',
|
|
|
+ valueFeild: 'id',
|
|
|
+ resultFeild: 'data.list',
|
|
|
+ placeholder: '请选择租户套餐'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'tenantCode',
|
|
|
+ label: '租户编号',
|
|
|
+ component: 'NInput',
|
|
|
+ required: true,
|
|
|
+ componentProps: {
|
|
|
+ placeholder: '请输入租户编号'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'expireTime',
|
|
|
+ label: '过期时间',
|
|
|
+ component: 'NDatePicker',
|
|
|
+ componentProps: {
|
|
|
+ type: 'datetime',
|
|
|
+ placeholder: '选择日期时间'
|
|
|
+ } as any
|
|
|
+ },
|
|
|
+ // {
|
|
|
+ // field: 'tenantDomain',
|
|
|
+ // label: '绑定域名',
|
|
|
+ // component: 'NInput',
|
|
|
+ // required: true,
|
|
|
+ // componentProps: {
|
|
|
+ // placeholder: '请输入'
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ {
|
|
|
+ field: 'status',
|
|
|
+ label: '租户状态',
|
|
|
+ component: 'NRadioGroup',
|
|
|
+ required: true,
|
|
|
+ componentProps: {
|
|
|
+ options: [
|
|
|
+ {
|
|
|
+ label: '正常',
|
|
|
+ value: 1
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '停用',
|
|
|
+ value: 0
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ defaultValue: 1
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ labelWidth: 120,
|
|
|
+ gridProps: {
|
|
|
+ cols: '1'
|
|
|
}
|
|
|
- ],
|
|
|
- labelWidth: 120,
|
|
|
- gridProps: {
|
|
|
- cols: '1'
|
|
|
}
|
|
|
- }
|
|
|
-});
|
|
|
+ });
|
|
|
|
|
|
async function handleSubmit() {
|
|
|
const form = await getFieldsValue();
|
|
|
@@ -259,8 +262,13 @@ async function handleSubmit() {
|
|
|
async function edit(row: Recordable) {
|
|
|
setModalLoading(true);
|
|
|
openModal(row);
|
|
|
- setFieldsValue({ ...row });
|
|
|
- setModalLoading(false);
|
|
|
+ const { data } = await fetchTenantDetail(row.id);
|
|
|
+
|
|
|
+ nextTick(async () => {
|
|
|
+ await setFieldsValue(data);
|
|
|
+ updateSchema([{ field: 'adminUsername', componentProps: { disabled: true } }]);
|
|
|
+ setModalLoading(false);
|
|
|
+ });
|
|
|
}
|
|
|
</script>
|
|
|
|