12 changed files with 640 additions and 1 deletions
@ -0,0 +1,58 @@ |
|||||||
|
package com.cloud.kicc.system.api.entity; |
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty; |
||||||
|
import com.baomidou.mybatisplus.annotation.TableId; |
||||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||||
|
import com.cloud.kicc.common.data.entity.CommonEntity; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.EqualsAndHashCode; |
||||||
|
import lombok.experimental.Accessors; |
||||||
|
|
||||||
|
import java.time.LocalDateTime; |
||||||
|
|
||||||
|
/** |
||||||
|
*<p> |
||||||
|
* 多租户实体类 |
||||||
|
*</p> |
||||||
|
* |
||||||
|
* @Author: entfrm开发团队-王翔 |
||||||
|
* @Date: 2022/5/9 |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
@EqualsAndHashCode(callSuper = false) |
||||||
|
@Accessors(chain = true) |
||||||
|
@TableName("sys_tenant") |
||||||
|
public class Tenant extends CommonEntity { |
||||||
|
|
||||||
|
/** |
||||||
|
* 租户ID |
||||||
|
*/ |
||||||
|
@TableId |
||||||
|
private String id; |
||||||
|
|
||||||
|
/** |
||||||
|
* 租户名称 |
||||||
|
*/ |
||||||
|
private String name; |
||||||
|
|
||||||
|
/** |
||||||
|
* 租户编码 |
||||||
|
*/ |
||||||
|
private String code; |
||||||
|
|
||||||
|
/** |
||||||
|
* 租户开始时间 |
||||||
|
*/ |
||||||
|
private LocalDateTime startTime; |
||||||
|
|
||||||
|
/** |
||||||
|
* 租户结束时间 |
||||||
|
*/ |
||||||
|
private LocalDateTime endTime; |
||||||
|
|
||||||
|
/** |
||||||
|
* 租户状态 |
||||||
|
*/ |
||||||
|
private String status; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,86 @@ |
|||||||
|
package com.cloud.kicc.system.controller; |
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil; |
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import com.cloud.kicc.common.core.api.R; |
||||||
|
import com.cloud.kicc.common.core.constant.AppConstants; |
||||||
|
import com.cloud.kicc.common.core.constant.CacheConstants; |
||||||
|
import com.cloud.kicc.common.core.constant.SecurityConstants; |
||||||
|
import com.cloud.kicc.common.log.annotation.SysLog; |
||||||
|
import com.cloud.kicc.common.security.annotation.Inner; |
||||||
|
import com.cloud.kicc.system.api.entity.DictData; |
||||||
|
import com.cloud.kicc.system.api.entity.Tenant; |
||||||
|
import com.cloud.kicc.system.api.feign.RemoteDictService; |
||||||
|
import com.cloud.kicc.system.service.DictDataService; |
||||||
|
import com.cloud.kicc.system.service.TenantService; |
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import org.springframework.cache.annotation.Cacheable; |
||||||
|
import org.springframework.security.access.prepost.PreAuthorize; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import java.util.Arrays; |
||||||
|
|
||||||
|
/** |
||||||
|
*<p> |
||||||
|
* 多租户控制类 |
||||||
|
*</p> |
||||||
|
* |
||||||
|
* @Author: entfrm开发团队-王翔 |
||||||
|
* @Date: 2022/5/9 |
||||||
|
*/ |
||||||
|
@RestController |
||||||
|
@RequiredArgsConstructor |
||||||
|
@RequestMapping(AppConstants.APP_SYSTEM + "/tenant") |
||||||
|
public class TenantController { |
||||||
|
|
||||||
|
private final TenantService tenantService; |
||||||
|
|
||||||
|
private LambdaQueryWrapper<Tenant> getQueryWrapper(Tenant tenant) { |
||||||
|
return new LambdaQueryWrapper<Tenant>() |
||||||
|
.like(StrUtil.isNotBlank(tenant.getName()), Tenant::getName, tenant.getName()) |
||||||
|
.eq(StrUtil.isNotBlank(tenant.getCode()), Tenant::getCode, tenant.getCode()) |
||||||
|
.eq(StrUtil.isNotBlank(tenant.getStatus()), Tenant::getStatus, tenant.getStatus()); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("/list") |
||||||
|
@PreAuthorize("@pms.hasPermission('tenant_view')") |
||||||
|
public R list(Page page, Tenant tenant) { |
||||||
|
IPage<Tenant> tenantPage = tenantService.page(page, getQueryWrapper(tenant)); |
||||||
|
return R.ok(tenantPage.getRecords(), tenantPage.getTotal()); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("/{id:\\w+}") |
||||||
|
public R getById(@PathVariable("id") String id) { |
||||||
|
return R.ok(tenantService.getById(id)); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@SysLog("多租户新增") |
||||||
|
@PostMapping("/save") |
||||||
|
@PreAuthorize("@pms.hasPermission('tenant_add')") |
||||||
|
public R save(@RequestBody Tenant tenant) { |
||||||
|
tenantService.save(tenant); |
||||||
|
return R.ok(); |
||||||
|
} |
||||||
|
|
||||||
|
@SysLog("多租户修改") |
||||||
|
@PutMapping("/update") |
||||||
|
@PreAuthorize("@pms.hasPermission('tenant_edit')") |
||||||
|
public R update(@RequestBody Tenant tenant) { |
||||||
|
tenantService.updateById(tenant); |
||||||
|
return R.ok(); |
||||||
|
} |
||||||
|
|
||||||
|
@SysLog("多租户删除") |
||||||
|
@DeleteMapping("/remove/{ids:[\\w,]+}") |
||||||
|
@PreAuthorize("@pms.hasPermission('tenant_del')") |
||||||
|
public R remove(@PathVariable String[] ids) { |
||||||
|
tenantService.removeByIds(Arrays.asList(ids)); |
||||||
|
return R.ok(); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,16 @@ |
|||||||
|
package com.cloud.kicc.system.mapper; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import com.cloud.kicc.system.api.entity.Tenant; |
||||||
|
|
||||||
|
/** |
||||||
|
*<p> |
||||||
|
* 多租户 Mapper 接口 |
||||||
|
*</p> |
||||||
|
* |
||||||
|
* @Author: entfrm开发团队-王翔 |
||||||
|
* @Date: 2022/5/9 |
||||||
|
*/ |
||||||
|
public interface TenantMapper extends BaseMapper<Tenant> { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,16 @@ |
|||||||
|
package com.cloud.kicc.system.service; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||||
|
import com.cloud.kicc.system.api.entity.Tenant; |
||||||
|
|
||||||
|
/** |
||||||
|
*<p> |
||||||
|
* 多租户服务类 |
||||||
|
*</p> |
||||||
|
* |
||||||
|
* @Author: entfrm开发团队-王翔 |
||||||
|
* @Date: 2022/5/9 |
||||||
|
*/ |
||||||
|
public interface TenantService extends IService<Tenant> { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,20 @@ |
|||||||
|
package com.cloud.kicc.system.service.impl; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||||
|
import com.cloud.kicc.system.api.entity.Tenant; |
||||||
|
import com.cloud.kicc.system.mapper.TenantMapper; |
||||||
|
import com.cloud.kicc.system.service.TenantService; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
/** |
||||||
|
*<p> |
||||||
|
* 多租户服务实现类 |
||||||
|
*</p> |
||||||
|
* |
||||||
|
* @Author: entfrm开发团队-王翔 |
||||||
|
* @Date: 2022/5/9 |
||||||
|
*/ |
||||||
|
@Service |
||||||
|
public class TenantServiceImpl extends ServiceImpl<TenantMapper, Tenant> implements TenantService { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,5 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||||
|
<mapper namespace="com.cloud.kicc.system.mapper.TenantMapper"> |
||||||
|
|
||||||
|
</mapper> |
@ -0,0 +1,30 @@ |
|||||||
|
/** |
||||||
|
* 提供api模板规范代码参考,请尽量保证编写代码风格跟模板规范代码一致 |
||||||
|
* Copyright © 2020-2022 <a href="http://www.entfrm.com/">entfrm</a> All rights reserved. |
||||||
|
* author entfrm开发团队-王翔 |
||||||
|
*/ |
||||||
|
import type { Tenant, TenantParams, TenantResult } from '/@/api/platform/system/entity/tenant'; |
||||||
|
import { defHttp } from '/@/utils/http/axios'; |
||||||
|
|
||||||
|
enum Api { |
||||||
|
list = '/system_proxy/system/tenant/list', |
||||||
|
add = '/system_proxy/system/tenant/save', |
||||||
|
get = '/system_proxy/system/tenant', |
||||||
|
edit = '/system_proxy/system/tenant/update', |
||||||
|
del = '/system_proxy/system/tenant/remove' |
||||||
|
} |
||||||
|
|
||||||
|
/** 查询多租户列表 */ |
||||||
|
export const listTenant = (params?: Partial<TenantParams>) => defHttp.get<TenantResult>({ url: Api.list, params }, { isReturnResultResponse: true }); |
||||||
|
|
||||||
|
/** 新增多租户 */ |
||||||
|
export const addTenant = (params: Partial<Tenant>) => defHttp.post({ url: Api.add, data: params }); |
||||||
|
|
||||||
|
/** 修改多租户 */ |
||||||
|
export const editTenant = (params: Partial<Tenant>) => defHttp.put({ url: Api.edit, data: params }); |
||||||
|
|
||||||
|
/** 查询多租户详细 */ |
||||||
|
export const getTenant = (id: string) => defHttp.get<Tenant>({ url: `${Api.get}/${id}` }); |
||||||
|
|
||||||
|
/** 删除多租户 */ |
||||||
|
export const delTenant = (ids: string) => defHttp.delete({ url: `${Api.del}/${ids}` }); |
@ -0,0 +1,26 @@ |
|||||||
|
/** |
||||||
|
* @program: kicc-ui |
||||||
|
* @description: 多租户实体类 |
||||||
|
* 类型定义 |
||||||
|
* @author: entfrm开发团队-王翔 |
||||||
|
* @create: 2022/4/8 |
||||||
|
*/ |
||||||
|
import type { R } from '/#/axios'; |
||||||
|
import type { CommonEntity, Page } from '/@/api/common/data/entity'; |
||||||
|
|
||||||
|
/** 多租户查询参数 */ |
||||||
|
export type TenantParams = Page & Tenant; |
||||||
|
|
||||||
|
/** 多租户对象 */ |
||||||
|
export interface Tenant extends CommonEntity { |
||||||
|
id: string; |
||||||
|
name: string; |
||||||
|
code: string; |
||||||
|
startTime: string; |
||||||
|
endTime: string; |
||||||
|
status: string; |
||||||
|
[key: string]: any; |
||||||
|
} |
||||||
|
|
||||||
|
/** 多租户响应对象 */ |
||||||
|
export type TenantResult = R<Tenant[]>; |
@ -0,0 +1,78 @@ |
|||||||
|
<template> |
||||||
|
<BasicModal v-bind="$attrs" |
||||||
|
width="720px" |
||||||
|
@register="registerModal" |
||||||
|
@ok="handleSubmit" |
||||||
|
> |
||||||
|
<BasicForm @register="registerForm"/> |
||||||
|
</BasicModal> |
||||||
|
</template> |
||||||
|
<script lang="ts" setup> |
||||||
|
/** |
||||||
|
* 提供模板规范代码参考,请尽量保证编写代码风格跟模板规范代码一致 |
||||||
|
* 采用vben-动态表格表单封装组件编写,采用 setup 写法 |
||||||
|
* Copyright © 2020-2022 <a href="http://www.entfrm.com/">entfrm</a> All rights reserved. |
||||||
|
* author entfrm开发团队-王翔 |
||||||
|
*/ |
||||||
|
import { ref, unref } from 'vue'; |
||||||
|
import { BasicForm, useForm } from '/@/components/Form/index'; |
||||||
|
import { formSchema } from './tenant.data'; |
||||||
|
import { addTenant, editTenant, getTenant } from '/@/api/platform/system/controller/tenant'; |
||||||
|
import { BasicModal, ModalProps, useModalInner } from '/@/components/Modal'; |
||||||
|
|
||||||
|
/** 通用变量统一声明区域 */ |
||||||
|
const tag = ref<Nullable<string>>(''); |
||||||
|
/** https://v3.cn.vuejs.org/api/options-data.html#emits */ |
||||||
|
const emit = defineEmits(['success', 'register']); |
||||||
|
const [registerForm, { resetFields, setFieldsValue, validate, clearValidate }] = useForm({ |
||||||
|
labelWidth: 100, |
||||||
|
schemas: formSchema, |
||||||
|
showActionButtonGroup: false, |
||||||
|
baseColProps: { span: 24 } |
||||||
|
}); |
||||||
|
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data: WindowInnerData = { _tag: '' }) => { |
||||||
|
// 处理清除脏数据 |
||||||
|
await resetFields(); |
||||||
|
await clearValidate(); |
||||||
|
// 处理设置数据 |
||||||
|
tag.value = data._tag; |
||||||
|
const tenantId = data.record?.id; |
||||||
|
const props: Partial<ModalProps> = { confirmLoading: false }; |
||||||
|
// 采用tag标签区分操作 |
||||||
|
switch (unref(tag)) { |
||||||
|
case 'add': |
||||||
|
props.title = '新增多租户'; |
||||||
|
break; |
||||||
|
case 'edit': |
||||||
|
props.title = '编辑多租户'; |
||||||
|
await setFieldsValue(await getTenant(tenantId)); |
||||||
|
break; |
||||||
|
} |
||||||
|
// 尾部:设置处理后的最终配置数据 |
||||||
|
setModalProps(props); |
||||||
|
}); |
||||||
|
|
||||||
|
/** 处理弹出框提交 */ |
||||||
|
async function handleSubmit() { |
||||||
|
try { |
||||||
|
// 提取验证数据 |
||||||
|
const formData = await validate(); |
||||||
|
// 处理提交之前逻辑 |
||||||
|
setModalProps({ confirmLoading: true }); |
||||||
|
// 采用tag标签区分操作 |
||||||
|
switch (unref(tag)) { |
||||||
|
case 'add': |
||||||
|
await addTenant(formData); |
||||||
|
break; |
||||||
|
case 'edit': |
||||||
|
await editTenant(formData); |
||||||
|
break; |
||||||
|
} |
||||||
|
// 处理提交完成之后逻辑 |
||||||
|
closeModal(); |
||||||
|
emit('success'); |
||||||
|
} finally { |
||||||
|
setModalProps({ confirmLoading: false }); |
||||||
|
} |
||||||
|
} |
||||||
|
</script> |
@ -0,0 +1,140 @@ |
|||||||
|
<template> |
||||||
|
<div> |
||||||
|
<BasicTable @register="registerTable" |
||||||
|
@selection-change="handleSelectionChange" |
||||||
|
> |
||||||
|
<template #toolbar> |
||||||
|
<a-button v-auth="['tenant_add']" |
||||||
|
type="primary" |
||||||
|
@click="handleAdd()" |
||||||
|
>新增多租户</a-button> |
||||||
|
<a-button v-auth="['tenant_edit']" |
||||||
|
type="primary" |
||||||
|
:disabled="state.single" |
||||||
|
@click="handleEdit()" |
||||||
|
>修改多租户</a-button> |
||||||
|
<a-button v-auth="['tenant_del']" |
||||||
|
type="primary" |
||||||
|
:disabled="state.multiple" |
||||||
|
@click="handleDel()" |
||||||
|
>删除多租户</a-button> |
||||||
|
</template> |
||||||
|
<template #action="{ record }"> |
||||||
|
<TableAction :actions="[ |
||||||
|
{ |
||||||
|
label: '编辑', |
||||||
|
icon: 'fa6-regular:pen-to-square', |
||||||
|
auth: ['tenant_edit'], |
||||||
|
onClick: handleEdit.bind(null, record) |
||||||
|
}, |
||||||
|
{ |
||||||
|
label: '删除', |
||||||
|
icon: 'ant-design:delete-outlined', |
||||||
|
color: 'error', |
||||||
|
auth: ['tenant_del'], |
||||||
|
onClick: handleDel.bind(null, record) |
||||||
|
}]" |
||||||
|
/> |
||||||
|
</template> |
||||||
|
</BasicTable> |
||||||
|
<!--弹出窗体区域--> |
||||||
|
<TenantModal @register="registerModal" @success="handleRefreshTable"/> |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script lang="ts" setup> |
||||||
|
/** |
||||||
|
* 提供模板规范代码参考,请尽量保证编写代码风格跟模板规范代码一致 |
||||||
|
* 采用vben-动态表格表单封装组件编写,采用 setup 写法 |
||||||
|
* Copyright © 2020-2022 <a href="http://www.entfrm.com/">entfrm</a> All rights reserved. |
||||||
|
* author entfrm开发团队-王翔 |
||||||
|
*/ |
||||||
|
import { reactive, toRaw } from 'vue'; |
||||||
|
import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
||||||
|
import { listTenant, delTenant } from '/@/api/platform/system/controller/tenant'; |
||||||
|
import { useModal } from '/@/components/Modal'; |
||||||
|
import TenantModal from './TenantModal.vue'; |
||||||
|
import { columns, searchFormSchema } from './tenant.data'; |
||||||
|
import { useMessage } from '/@/hooks/web/useMessage'; |
||||||
|
|
||||||
|
/** 类型规范统一声明定义区域 */ |
||||||
|
interface TableState { |
||||||
|
single: boolean; |
||||||
|
multiple: boolean; |
||||||
|
} |
||||||
|
|
||||||
|
/** 通用变量统一声明区域 */ |
||||||
|
const state = reactive<TableState>({ |
||||||
|
// 非单个禁用 |
||||||
|
single: true, |
||||||
|
// 非多个禁用 |
||||||
|
multiple: true |
||||||
|
}); |
||||||
|
const { createConfirm, createMessage } = useMessage(); |
||||||
|
const [registerModal, { openModal }] = useModal(); |
||||||
|
const [registerTable, { reload, clearSelectedRowKeys, getSelectRowKeys }] = useTable({ |
||||||
|
title: '多租户列表', |
||||||
|
api: listTenant, |
||||||
|
rowKey: 'id', |
||||||
|
columns, |
||||||
|
formConfig: { |
||||||
|
labelWidth: 120, |
||||||
|
schemas: searchFormSchema, |
||||||
|
autoSubmitOnEnter: true |
||||||
|
}, |
||||||
|
rowSelection: { type: 'checkbox' }, |
||||||
|
useSearchForm: true, |
||||||
|
showTableSetting: true, |
||||||
|
bordered: true, |
||||||
|
clickToRowSelect: false, |
||||||
|
showIndexColumn: false, |
||||||
|
actionColumn: { |
||||||
|
width: 220, |
||||||
|
title: '操作', |
||||||
|
dataIndex: 'action', |
||||||
|
slots: { customRender: 'action' }, |
||||||
|
fixed: false |
||||||
|
}, |
||||||
|
handleSearchInfoFn: () => clearSelectedRowKeys() |
||||||
|
}); |
||||||
|
|
||||||
|
/** 处理多选框选中数据 */ |
||||||
|
function handleSelectionChange(selection?: Recordable) { |
||||||
|
const rowSelection = toRaw(selection?.keys) || []; |
||||||
|
state.single = rowSelection.length != 1; |
||||||
|
state.multiple = !rowSelection.length; |
||||||
|
} |
||||||
|
|
||||||
|
/** 新增按钮操作,行内新增与工具栏局域新增通用 */ |
||||||
|
function handleAdd() { |
||||||
|
openModal(true,{ _tag: 'add' }); |
||||||
|
} |
||||||
|
|
||||||
|
/** 编辑按钮操作,行内编辑 */ |
||||||
|
function handleEdit(record?: Recordable) { |
||||||
|
record = record || { id: getSelectRowKeys() }; |
||||||
|
openModal(true, { _tag: 'edit', record }); |
||||||
|
} |
||||||
|
|
||||||
|
/** 删除按钮操作,行内删除 */ |
||||||
|
async function handleDel(record?: Recordable) { |
||||||
|
const ids = record?.id || getSelectRowKeys(); |
||||||
|
createConfirm({ |
||||||
|
iconType: 'warning', |
||||||
|
title: '警告', |
||||||
|
content: `是否确认删除多租户编号为${ids}多租户吗?`, |
||||||
|
onOk: async () => { |
||||||
|
await delTenant(ids); |
||||||
|
createMessage.success('删除成功!'); |
||||||
|
handleRefreshTable(); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** 处理表格刷新 */ |
||||||
|
function handleRefreshTable() { |
||||||
|
clearSelectedRowKeys(); |
||||||
|
reload(); |
||||||
|
} |
||||||
|
|
||||||
|
</script> |
@ -0,0 +1,164 @@ |
|||||||
|
/** |
||||||
|
* @program: kicc-ui |
||||||
|
* @description: 多租户模块动态渲染配置 |
||||||
|
* @author: entfrm开发团队-王翔 |
||||||
|
* @create: 2022/4/21 |
||||||
|
*/ |
||||||
|
|
||||||
|
import { BasicColumn } from '/@/components/Table'; |
||||||
|
import { FormSchema } from '/@/components/Table'; |
||||||
|
import { h } from 'vue'; |
||||||
|
import { Tag } from 'ant-design-vue'; |
||||||
|
|
||||||
|
/** 表格列配置 */ |
||||||
|
export const columns: BasicColumn[] = [ |
||||||
|
{ |
||||||
|
title: '多租户名称', |
||||||
|
dataIndex: 'name' |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: '多租户编码', |
||||||
|
dataIndex: 'code', |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: '开始时间', |
||||||
|
dataIndex: 'startTime', |
||||||
|
width: 200 |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: '结束时间', |
||||||
|
dataIndex: 'endTime', |
||||||
|
width: 200 |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: '状态', |
||||||
|
dataIndex: 'status', |
||||||
|
width: 120, |
||||||
|
customRender: ({record}) => { |
||||||
|
const status = record.status; |
||||||
|
const enable = ~~status === 0; |
||||||
|
const color = enable ? 'green' : 'red'; |
||||||
|
const text = enable ? '启动' : '冻结'; |
||||||
|
return h(Tag, { color: color }, () => text); |
||||||
|
} |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: '备注', |
||||||
|
dataIndex: 'remarks', |
||||||
|
customRender: ({record}) => { |
||||||
|
return record.remarks || h(Tag, { color: 'red' }, () => '暂无数据'); |
||||||
|
} |
||||||
|
} |
||||||
|
]; |
||||||
|
|
||||||
|
/** 搜索表单配置 */ |
||||||
|
export const searchFormSchema: FormSchema[] = [ |
||||||
|
{ |
||||||
|
field: 'name', |
||||||
|
label: '多租户名称', |
||||||
|
component: 'Input', |
||||||
|
componentProps: { |
||||||
|
placeholder: '请输入多租户名称', |
||||||
|
}, |
||||||
|
colProps: { span: 8 } |
||||||
|
}, |
||||||
|
{ |
||||||
|
field: 'code', |
||||||
|
label: '多租户编码', |
||||||
|
component: 'Input', |
||||||
|
componentProps: { |
||||||
|
placeholder: '请输入多租户编码', |
||||||
|
}, |
||||||
|
colProps: { span: 7 } |
||||||
|
}, |
||||||
|
{ |
||||||
|
field: 'status', |
||||||
|
label: '状态', |
||||||
|
component: 'Select', |
||||||
|
componentProps: { |
||||||
|
options: [ |
||||||
|
{ label: '启动', value: '0' }, |
||||||
|
{ label: '冻结', value: '1' } |
||||||
|
] |
||||||
|
}, |
||||||
|
colProps: { span: 8 } |
||||||
|
} |
||||||
|
]; |
||||||
|
|
||||||
|
/** 用户表单配置 */ |
||||||
|
export const formSchema: FormSchema[] = [ |
||||||
|
{ |
||||||
|
field: 'id', |
||||||
|
label: 'ID', |
||||||
|
component: 'Input', |
||||||
|
show: false |
||||||
|
}, |
||||||
|
{ |
||||||
|
field: 'name', |
||||||
|
label: '多租户名称', |
||||||
|
component: 'Input', |
||||||
|
required: true, |
||||||
|
colProps: { |
||||||
|
span: 12 |
||||||
|
} |
||||||
|
}, |
||||||
|
{ |
||||||
|
field: 'code', |
||||||
|
label: '多租户编码', |
||||||
|
component: 'Input', |
||||||
|
required: true, |
||||||
|
colProps: { |
||||||
|
span: 12 |
||||||
|
} |
||||||
|
}, |
||||||
|
{ |
||||||
|
field: 'startTime', |
||||||
|
label: '开始时间', |
||||||
|
component: 'DatePicker', |
||||||
|
required: true, |
||||||
|
componentProps: { |
||||||
|
style: { width:'100%' }, |
||||||
|
valueFormat: 'YYYY-MM-DD', |
||||||
|
placeholder: '请选择开始日期' |
||||||
|
}, |
||||||
|
colProps: { span: 12 } |
||||||
|
}, |
||||||
|
{ |
||||||
|
field: 'endTime', |
||||||
|
label: '结束时间', |
||||||
|
component: 'DatePicker', |
||||||
|
required: true, |
||||||
|
componentProps: { |
||||||
|
style: { width:'100%' }, |
||||||
|
valueFormat: 'YYYY-MM-DD', |
||||||
|
placeholder: '请选择开始日期' |
||||||
|
}, |
||||||
|
colProps: { span: 12 } |
||||||
|
}, |
||||||
|
{ |
||||||
|
field: 'status', |
||||||
|
label: '状态', |
||||||
|
component: 'RadioGroup', |
||||||
|
defaultValue: '0', |
||||||
|
componentProps: { |
||||||
|
options: [ |
||||||
|
{ label: '启动', value: '0' }, |
||||||
|
{ label: '冻结', value: '1' } |
||||||
|
] |
||||||
|
}, |
||||||
|
colProps: { |
||||||
|
span: 12 |
||||||
|
} |
||||||
|
}, |
||||||
|
{ |
||||||
|
label: '备注', |
||||||
|
field: 'remarks', |
||||||
|
component: 'InputTextArea', |
||||||
|
componentProps: { |
||||||
|
rows: 6 |
||||||
|
}, |
||||||
|
colProps: { |
||||||
|
span: 24 |
||||||
|
} |
||||||
|
} |
||||||
|
]; |
Loading…
Reference in new issue