Browse Source

🧬更新菜单模块

master
wangxiang 3 years ago
parent
commit
9626187f12
  1. 11
      src/api/platform/system/controller/region.ts
  2. 7
      src/components/Form/src/BasicForm.vue
  3. 2
      src/components/Form/src/components/ApiCascader.vue
  4. 26
      src/views/common/doctor/DoctorModal.vue
  5. 20
      src/views/common/doctor/doctor.data.ts
  6. 5
      src/views/common/hospital/index.vue
  7. 139
      src/views/common/office/OfficeModal.vue
  8. 179
      src/views/common/office/index.vue
  9. 20
      src/views/common/office/office.data.ts
  10. 117
      src/views/common/org/OrgModal.vue
  11. 5
      src/views/common/org/index.vue
  12. 400
      src/views/common/org/org.data.ts

11
src/api/platform/system/controller/region.ts

@ -22,9 +22,16 @@ export const listRegion = (params?: Partial<RegionParams>) => { @@ -22,9 +22,16 @@ export const listRegion = (params?: Partial<RegionParams>) => {
return defHttp.get({ url: url, params });
};
export const addRegion =(params:Partial<Region>) => defHttp.post({ url: Api.add,data:params });
export const listRegionCascade = (params?: Partial<RegionParams>) => defHttp.get({ url: Api.lazyList, params }).then(res => {
return res.map(item => {
const { children, ...result } = item;
return { ...result, isLeaf: !!!children };
});
});
export const editRegion =(params:Partial<Region>) => defHttp.put({ url: Api.edit,data:params });
export const addRegion = (params:Partial<Region>) => defHttp.post({ url: Api.add,data:params });
export const editRegion = (params:Partial<Region>) => defHttp.put({ url: Api.edit,data:params });
export const getRegion = (id: string) => defHttp.get<ResultVo<Region>>({ url: `${Api.get}/${id}` });

7
src/components/Form/src/BasicForm.vue

@ -56,7 +56,6 @@ @@ -56,7 +56,6 @@
import { useDebounceFn } from '@vueuse/core';
import { basicProps } from './props';
import { useDesign } from '/@/hooks/web/useDesign';
import { cloneDeep } from 'lodash-es';
export default defineComponent({
name: 'BasicForm',
@ -127,11 +126,9 @@ @@ -127,11 +126,9 @@
}
}
if (unref(getProps).showAdvancedButton) {
return cloneDeep(
schemas.filter((schema) => schema.component !== 'Divider') as FormSchema[],
);
return schemas.filter((schema) => schema.component !== 'Divider') as FormSchema[];
} else {
return cloneDeep(schemas as FormSchema[]);
return schemas as FormSchema[];
}
});

2
src/components/Form/src/components/ApiCascader.vue

@ -95,10 +95,10 @@ @@ -95,10 +95,10 @@
if (next) {
const value = next[valueField];
const item = {
isLeaf: isLeaf && typeof isLeaf === 'function' ? isLeaf(next) : false,
...omit(next, [labelField, valueField]),
label: next[labelField],
value: numberToString ? `${value}` : value,
isLeaf: isLeaf && typeof isLeaf === 'function' ? isLeaf(next) : false,
};
const children = Reflect.get(next, childrenField);
if (children) {

26
src/views/common/doctor/DoctorModal.vue

@ -17,14 +17,16 @@ @@ -17,14 +17,16 @@
import { ref, unref } from 'vue';
import { BasicForm, useForm } from '/@/components/Form';
import { formSchema } from './doctor.data';
import {addDoctor, delDoctor, getDoctor, editDoctor} from '/@/api/platform/common/controller/doctor';
import { addDoctor, getDoctor, editDoctor} from '/@/api/platform/common/controller/doctor';
import { BasicModal, ModalProps, useModalInner } from '/@/components/Modal';
import { listHospital } from '/@/api/platform/common/controller/hospital';
import { listOrg } from '/@/api/platform/common/controller/org';
/** 通用变量统一声明区域 */
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, updateSchema }] = useForm({
const [registerForm, { resetFields, setFieldsValue, validate, clearValidate, updateSchema, getFieldsValue }] = useForm({
labelWidth: 100,
schemas: formSchema,
showActionButtonGroup: false,
@ -48,6 +50,26 @@ @@ -48,6 +50,26 @@
await setFieldsValue(await getDoctor(id));
break;
}
const model = getFieldsValue();
await updateSchema([{
field: 'orgType',
componentProps: {
onChange: (value: string) => {
setFieldsValue({ orgId: '' });
updateSchema({
field: 'orgId',
componentProps: {
api: ~~value == 1 ? listHospital : listOrg
}
});
}
},
}, {
field: 'orgId',
componentProps: {
api: ~~model?.orgType == 1 ? listHospital : listOrg
}
}]);
// :
setModalProps(props);
});

20
src/views/common/doctor/doctor.data.ts

@ -2,9 +2,6 @@ import { BasicColumn } from '/@/components/Table'; @@ -2,9 +2,6 @@ import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { h } from 'vue';
import { Tag } from 'ant-design-vue';
import { listHospital } from '/@/api/platform/common/controller/hospital';
import { listOrg } from '/@/api/platform/common/controller/org';
import { listOffice } from '/@/api/platform/common/controller/office';
export const columns: BasicColumn[] = [
{
@ -193,17 +190,12 @@ export const formSchema: FormSchema[] = [ @@ -193,17 +190,12 @@ export const formSchema: FormSchema[] = [
field: 'orgId',
label: '所属组织',
component: 'ApiSelect',
required: true,
renderComponentContent: ({ schema, values, model, field }) => {
const organType = model.orgType;
const dataApi = ~~organType === 1 ? listHospital : listOrg;
schema.componentProps = {
api: dataApi,
labelField: 'name',
valueField: 'id',
resultField: 'data'
};
}
componentProps: {
resultField: 'data',
labelField: 'name',
valueField: 'id'
},
required: true
},
{
field: 'status',

5
src/views/common/hospital/index.vue

@ -4,9 +4,8 @@ @@ -4,9 +4,8 @@
@selection-change="handleSelectionChange"
>
<template #toolbar>
<a-button
type="primary"
@click="handleAdd()"
<a-button type="primary"
@click="handleAdd()"
>新增医院</a-button>
<a-button type="primary"
:disabled="state.single"

139
src/views/common/office/OfficeModal.vue

@ -8,72 +8,93 @@ @@ -8,72 +8,93 @@
</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';
import { formSchema } from './office.data';
import {addOffice, delOffice,getOffice,editOffice} from '/@/api/platform/common/controller/office';
import { BasicModal, ModalProps, useModalInner } from '/@/components/Modal';
import { isEmpty } from '/@/utils/is';
/**
* 提供模板规范代码参考,请尽量保证编写代码风格跟模板规范代码一致
* 采用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';
import { formSchema } from './office.data';
import { addOffice, editOffice, getOffice } from '/@/api/platform/common/controller/office';
import { BasicModal, ModalProps, useModalInner } from '/@/components/Modal';
import { listHospital } from '/@/api/platform/common/controller/hospital';
import { listOrg } from '/@/api/platform/common/controller/org';
/** 通用变量统一声明区域 */
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, updateSchema }] = 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 id = 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 getOffice(id));
break;
}
// :
setModalProps(props);
});
/** 处理弹出框提交 */
async function handleSubmit() {
try {
//
const formData = await validate();
//
setModalProps({ confirmLoading: true });
/** 通用变量统一声明区域 */
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, updateSchema, getFieldsValue }] = 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 id = data.record?.id;
const props: Partial<ModalProps> = { confirmLoading: false };
// tag
switch (unref(tag)) {
case 'add':
await addOffice(formData);
props.title = '新增科室';
break;
case 'edit':
await editOffice(formData);
props.title = '编辑科室';
await setFieldsValue(await getOffice(id));
break;
}
//
closeModal();
emit('success');
} finally {
setModalProps({ confirmLoading: false });
const model = getFieldsValue();
await updateSchema([{
field: 'orgType',
componentProps: {
onChange: (value: string) => {
setFieldsValue({ orgId: '' });
updateSchema({
field: 'orgId',
componentProps: {
api: ~~value == 1 ? listHospital : listOrg
}
});
}
},
}, {
field: 'orgId',
componentProps: {
api: ~~model?.orgType == 1 ? listHospital : listOrg
}
}]);
// :
setModalProps(props);
});
/** 处理弹出框提交 */
async function handleSubmit() {
try {
//
const formData = await validate();
//
setModalProps({ confirmLoading: true });
// tag
switch (unref(tag)) {
case 'add':
await addOffice(formData);
break;
case 'edit':
await editOffice(formData);
break;
}
//
closeModal();
emit('success');
} finally {
setModalProps({ confirmLoading: false });
}
}
}
</script>

179
src/views/common/office/index.vue

@ -4,9 +4,8 @@ @@ -4,9 +4,8 @@
@selection-change="handleSelectionChange"
>
<template #toolbar>
<a-button
type="primary"
@click="handleAdd()"
<a-button type="primary"
@click="handleAdd()"
>新增科室</a-button>
<a-button type="primary"
:disabled="state.single"
@ -39,98 +38,98 @@ @@ -39,98 +38,98 @@
</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 {listOffice, delOffice} from '/@/api/platform/common/controller/office';
import { useModal } from '/@/components/Modal';
import { columns, searchFormSchema } from './office.data';
import { useMessage } from '/@/hooks/web/useMessage';
import OfficeModal from './OfficeModal.vue';
/**
* 提供模板规范代码参考,请尽量保证编写代码风格跟模板规范代码一致
* 采用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 {listOffice, delOffice} from '/@/api/platform/common/controller/office';
import { useModal } from '/@/components/Modal';
import { columns, searchFormSchema } from './office.data';
import { useMessage } from '/@/hooks/web/useMessage';
import OfficeModal from './OfficeModal.vue';
/** 类型规范统一声明定义区域 */
interface TableState {
single: boolean;
multiple: boolean;
}
/** 类型规范统一声明定义区域 */
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: listOffice,
rowKey: 'id',
columns,
formConfig: {
labelWidth: 120,
schemas: searchFormSchema,
autoSubmitOnEnter: true,
fieldMapToTime: [['dateRange', ['beginTime', 'endTime'], 'YYYY-MM-DD']]
},
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()
});
/** 通用变量统一声明区域 */
const state = reactive<TableState>({
//
single: true,
//
multiple: true
});
const { createConfirm, createMessage } = useMessage();
const [registerModal, { openModal }] = useModal();
const [registerTable, { reload, clearSelectedRowKeys, getSelectRowKeys }] = useTable({
title: '医生列表',
api: listOffice,
rowKey: 'id',
columns,
formConfig: {
labelWidth: 120,
schemas: searchFormSchema,
autoSubmitOnEnter: true,
fieldMapToTime: [['dateRange', ['beginTime', 'endTime'], 'YYYY-MM-DD']]
},
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 handleSelectionChange(selection?: Recordable) {
const rowSelection = toRaw(selection?.keys) || [];
state.single = rowSelection.length != 1;
state.multiple = !rowSelection.length;
}
/** 新增按钮操作,行内新增与工具栏局域新增通用 */
function handleAdd() {
openModal(true,{ _tag: 'add' });
}
/** 新增按钮操作,行内新增与工具栏局域新增通用 */
function handleAdd() {
openModal(true,{ _tag: 'add' });
}
/** 编辑按钮操作,行内编辑 */
function handleEdit(record?: Recordable) {
record = record || { id: getSelectRowKeys() };
openModal(true, { _tag: 'edit', record });
}
/** 编辑按钮操作,行内编辑 */
function handleEdit(record?: Recordable) {
record = record || { id: getSelectRowKeys() };
openModal(true, { _tag: 'edit', record });
}
/** 删除按钮操作,行内删除 */
async function handleDel(record?: Recordable) {
const id = record?.id || getSelectRowKeys();
createConfirm({
iconType: 'warning',
title: '警告',
content: `是否确认删除科室编号为${id}科室吗?`,
onOk: async () => {
await delOffice(id);
createMessage.success('删除成功!');
handleRefreshTable();
}
});
}
/** 删除按钮操作,行内删除 */
async function handleDel(record?: Recordable) {
const id = record?.id || getSelectRowKeys();
createConfirm({
iconType: 'warning',
title: '警告',
content: `是否确认删除科室编号为${id}科室吗?`,
onOk: async () => {
await delOffice(id);
createMessage.success('删除成功!');
handleRefreshTable();
}
});
}
/** 处理表格刷新 */
function handleRefreshTable() {
clearSelectedRowKeys();
reload();
}
/** 处理表格刷新 */
function handleRefreshTable() {
clearSelectedRowKeys();
reload();
}
</script>

20
src/views/common/office/office.data.ts

@ -2,8 +2,6 @@ import { BasicColumn } from '/@/components/Table'; @@ -2,8 +2,6 @@ import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { h } from 'vue';
import { Tag } from 'ant-design-vue';
import { listHospital } from '/@/api/platform/common/controller/hospital';
import { listOrg } from '/@/api/platform/common/controller/org';
export const columns: BasicColumn[] = [
{
@ -127,6 +125,7 @@ export const formSchema: FormSchema[] = [ @@ -127,6 +125,7 @@ export const formSchema: FormSchema[] = [
field: 'orgType',
label: '所属组织类型',
component: 'Select',
defaultValue: '1',
componentProps: {
options: [
{ label: '医院', value: '1' },
@ -139,17 +138,12 @@ export const formSchema: FormSchema[] = [ @@ -139,17 +138,12 @@ export const formSchema: FormSchema[] = [
field: 'orgId',
label: '所属组织',
component: 'ApiSelect',
required: true,
renderComponentContent: ({ schema, values, model, field }) => {
const organType = model.orgType;
const dataApi = ~~organType === 1 ? listHospital : listOrg;
schema.componentProps = {
api: dataApi,
labelField: 'name',
valueField: 'id',
resultField: 'data'
};
}
componentProps: {
resultField: 'data',
labelField: 'name',
valueField: 'id'
},
required: true
},
{
field: 'manageName',

117
src/views/common/org/OrgModal.vue

@ -8,72 +8,71 @@ @@ -8,72 +8,71 @@
</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';
import { institutionFormSchema } from './org.data';
import {addOrg, delOrg,getOrg,editOrg} from '/@/api/platform/common/controller/org';
import { BasicModal, ModalProps, useModalInner } from '/@/components/Modal';
import { isEmpty } from '/@/utils/is';
/**
* 提供模板规范代码参考,请尽量保证编写代码风格跟模板规范代码一致
* 采用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';
import { institutionFormSchema } from './org.data';
import { addOrg, getOrg, editOrg } from '/@/api/platform/common/controller/org';
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, updateSchema }] = useForm({
labelWidth: 100,
schemas: institutionFormSchema,
showActionButtonGroup: false,
baseColProps: { span: 24 }
});
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data: WindowInnerData = { _tag: '' }) => {
//
await resetFields();
await clearValidate();
//
tag.value = data._tag;
const id = 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 getOrg(id));
break;
}
// :
setModalProps(props);
});
/** 处理弹出框提交 */
async function handleSubmit() {
try {
//
const formData = await validate();
//
setModalProps({ confirmLoading: true });
/** 通用变量统一声明区域 */
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, updateSchema }] = useForm({
labelWidth: 100,
schemas: institutionFormSchema,
showActionButtonGroup: false,
baseColProps: { span: 24 }
});
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data: WindowInnerData = { _tag: '' }) => {
//
await resetFields();
await clearValidate();
//
tag.value = data._tag;
const id = data.record?.id;
const props: Partial<ModalProps> = { confirmLoading: false };
// tag
switch (unref(tag)) {
case 'add':
await addOrg(formData);
props.title = '新增机构';
break;
case 'edit':
await editOrg(formData);
props.title = '编辑机构';
await setFieldsValue(await getOrg(id));
break;
}
//
closeModal();
emit('success');
} finally {
setModalProps({ confirmLoading: false });
// :
setModalProps(props);
});
/** 处理弹出框提交 */
async function handleSubmit() {
try {
//
const formData = await validate();
//
setModalProps({ confirmLoading: true });
// tag
switch (unref(tag)) {
case 'add':
await addOrg(formData);
break;
case 'edit':
await editOrg(formData);
break;
}
//
closeModal();
emit('success');
} finally {
setModalProps({ confirmLoading: false });
}
}
}
</script>

5
src/views/common/org/index.vue

@ -4,9 +4,8 @@ @@ -4,9 +4,8 @@
@selection-change="handleSelectionChange"
>
<template #toolbar>
<a-button
type="primary"
@click="handleAdd()"
<a-button type="primary"
@click="handleAdd()"
>新增机构</a-button>
<a-button type="primary"
:disabled="state.single"

400
src/views/common/org/org.data.ts

@ -1,216 +1,212 @@ @@ -1,216 +1,212 @@
import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import {h} from 'vue';
import {Tag} from 'ant-design-vue';
import { h } from 'vue';
import { Tag } from 'ant-design-vue';
import { listRegionCascade } from '/@/api/platform/system/controller/region';
export const columns: BasicColumn[] = [
{
title: 'ID',
dataIndex: 'id',
width: 120,
},
{
title: '机构名称',
dataIndex: 'name',
width: 120,
},
{
title: '机构类型',
dataIndex: 'type',
width: 120,
customRender: ({ record }) =>{
console.log(record);
const type = record.type;
let text = '';
let color = '';
switch (type) {
case '1':
text = '医检机构';
color = 'green';
break;
case '2':
text = '三甲机构';
color = 'blue';
break;
case '0':
text = '其他机构';
color = 'gray';
break;
default:
text = '其他医院';
color = 'gray';
break;
}
return h(Tag, { color: color }, () => text);
}
},
{
title: '联系人',
dataIndex: 'contactsName',
width: 120,
},
{
title: '联系人电话',
dataIndex: 'contactsTel',
width: 120,
},
{
title: '联系人职称',
dataIndex: 'contactsTitle',
width: 120,
},
{
title: '详细地址',
dataIndex: 'detailAddress',
width: 180,
},
{
title: '状态',
dataIndex: 'status',
width: 100,
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: 'createByName',
width: 180,
},
{
title: '创建时间',
dataIndex: 'createTime',
width: 180,
{
title: 'ID',
dataIndex: 'id',
width: 120,
},
{
title: '机构名称',
dataIndex: 'name',
width: 120,
},
{
title: '机构类型',
dataIndex: 'type',
width: 120,
customRender: ({ record }) =>{
const type = record.type;
let text = '', color = '';
switch (type) {
case '1':
text = '医检机构';
color = 'green';
break;
case '2':
text = '三甲机构';
color = 'blue';
break;
case '0':
text = '其他机构';
color = 'gray';
break;
}
return h(Tag, { color: color }, () => text);
}
},
{
title: '联系人',
dataIndex: 'contactName',
width: 120,
},
{
title: '联系人电话',
dataIndex: 'contactPhone',
width: 120,
},
{
title: '联系人职称',
dataIndex: 'contactTitle',
width: 120,
},
{
title: '详细地址',
dataIndex: 'detailAddress',
width: 180,
},
{
title: '状态',
dataIndex: 'status',
width: 100,
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: 'createByName',
width: 180,
},
{
title: '创建时间',
dataIndex: 'createTime',
width: 180,
}
];
export const searchFormSchema: FormSchema[] = [
{
field: 'name',
label: '机构名称' ,
component: 'Input',
componentProps: {
placeholder: '请输入机构名称',
},
colProps: { span: 5 },
},
{
field: 'type',
label: '机构类型',
component: 'Select',
componentProps: {
options: [
{label: '医检机构',value: '1'},
{label: '三甲机构',value: '2'},
{label: '其他机构',value: '0'},
]
},
colProps: {span: 5}
},
{
field: 'dateRange',
label: '创建时间',
component: 'RangePicker',
componentProps: {
style: { width:'100%' },
valueFormat: 'YYYY-MM-DD',
placeholder: ['开始日期','结束日期']
},
colProps: { span: 8 }
}
{
field: 'name',
label: '机构名称' ,
component: 'Input',
componentProps: {
placeholder: '请输入机构名称',
},
colProps: { span: 5 },
},
{
field: 'type',
label: '机构类型',
component: 'Select',
defaultValue: '1',
componentProps: {
options: [
{label: '医检机构',value: '1'},
{label: '三甲机构',value: '2'},
{label: '其他机构',value: '0'}
]
},
colProps: {span: 5}
},
{
field: 'dateRange',
label: '创建时间',
component: 'RangePicker',
componentProps: {
style: { width:'100%' },
valueFormat: 'YYYY-MM-DD',
placeholder: ['开始日期','结束日期']
},
colProps: { span: 8 }
}
];
export const institutionFormSchema: FormSchema[] = [
{
field: 'id',
label: 'ID',
component: 'Input',
show: false,
},
{
field: 'name',
label: '机构名称',
component: 'Input',
required: true
},
{
field: 'type',
label: '机构类型',
component: 'Select',
defaultValue: '0',
componentProps: {
options: [
{label: '医检机构',value: '1'},
{label: '三甲机构',value: '2'},
{label: '其他机构',value: '0'},
]
},
required: true,
},
{
field: 'contactsName',
label: '联系人名称',
component: 'Input',
required: true
},
{
field: 'contactsTel',
label: '联系人电话',
component: 'Input',
rules: [
{
pattern: new RegExp('^1[3|4|5|6|7|8|9][0-9]\\d{8}$'),
message: '请输入正确的手机号',
validateTrigger: 'change',
required: true
}
],
},
{
field: 'contactsTitle',
label: '联系人职称',
component: 'Input',
{
field: 'id',
label: 'ID',
component: 'Input',
show: false,
},
{
field: 'name',
label: '机构名称',
component: 'Input',
required: true
},
{
field: 'type',
label: '机构类型',
component: 'Select',
defaultValue: '0',
componentProps: {
options: [
{ label: '医检机构', value: '1' },
{ label: '三甲机构', value: '2' },
{ label: '其他机构', value: '0' },
]
},
required: true
},
{
field: 'contactName',
label: '联系人名称',
component: 'Input',
required: true
},
{
field: 'contactPhone',
label: '联系人电话',
component: 'Input',
rules: [
{
pattern: new RegExp('^1[3|4|5|6|7|8|9][0-9]\\d{8}$'),
message: '请输入正确的手机号',
validateTrigger: 'change',
required: true
},
/* {
field: 'addressIds',
label: '地址',
component: 'ApiAddressCascader',
componentProps: {
api: addressList
}
},*/
{
field: 'detailAddress',
label: '详细地址',
component: 'Input',
required: true
},
{
field: 'status',
label: '状态',
component: 'RadioButtonGroup',
defaultValue: '0',
componentProps: {
options: [
{ label: '启用', value: '0' },
{ label: '禁用', value: '1' },
],
},
},
{
label: '备注',
field: 'remarks',
component: 'InputTextArea',
}
],
},
{
field: 'contactTitle',
label: '联系人职称',
component: 'Input',
required: true
},
{
field: 'addressIds',
label: '城市地址',
component: 'ApiCascader',
componentProps: {
api: listRegionCascade,
asyncFetchParamKey: 'parentId',
labelField: 'name',
valueField: 'id',
initFetchParams: {
parentId: '0'
}
}
},
{
field: 'detailAddress',
label: '详细地址',
component: 'Input',
required: true
},
{
field: 'status',
label: '状态',
component: 'RadioButtonGroup',
defaultValue: '0',
componentProps: {
options: [
{ label: '启用', value: '0' },
{ label: '禁用', value: '1' },
],
},
},
{
label: '备注',
field: 'remarks',
component: 'InputTextArea',
}
];
Loading…
Cancel
Save