28 changed files with 2265 additions and 2 deletions
@ -0,0 +1,46 @@ |
|||||||
|
import {AddressParams,AddressItem,AddressItemListResult} from '/@/api/platform/system/entity/addressModel'; |
||||||
|
import { defHttp } from '/@/utils/http/axios'; |
||||||
|
import {isDef} from '/@/utils/is'; |
||||||
|
import {listToTree} from '/@/utils/helper/treeHelper'; |
||||||
|
|
||||||
|
const prefix = '/system_proxy/system'; |
||||||
|
|
||||||
|
enum Api { |
||||||
|
QueryById = '/address/query', |
||||||
|
List = '/address/list', |
||||||
|
QueryByParentIds = '/address/queryByParentIds', |
||||||
|
Add = '/address/add', |
||||||
|
Update = '/address/update', |
||||||
|
Remove = '/address/remove' |
||||||
|
} |
||||||
|
|
||||||
|
export const queryById = (params: { id: String }) => |
||||||
|
defHttp.get<AddressItem>({url: prefix + Api.QueryById + `/${params.id}`}); |
||||||
|
|
||||||
|
export const treeList = (params: AddressParams) => { |
||||||
|
return defHttp.get({url: prefix + Api.List, params}).then(data =>{ |
||||||
|
return listToTree(data, { |
||||||
|
id: 'code', |
||||||
|
parentId: 'parentId' |
||||||
|
}); |
||||||
|
}); |
||||||
|
}; |
||||||
|
|
||||||
|
export const list = (params: AddressParams) => |
||||||
|
defHttp.get({url: prefix + Api.List, params}); |
||||||
|
|
||||||
|
|
||||||
|
export const queryByParentIds = (params) => |
||||||
|
defHttp.get({url: prefix + Api.QueryByParentIds + `/${params}`}); |
||||||
|
|
||||||
|
|
||||||
|
export const set = (params: AddressItem) => { |
||||||
|
if (isDef(params.code)){ |
||||||
|
defHttp.put<AddressItem>({url: prefix + Api.Update, params}); |
||||||
|
}else { |
||||||
|
defHttp.post<AddressItem>({url: prefix + Api.Add, params}); |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
export const remove = (params: {ids: String}) => |
||||||
|
defHttp.delete<boolean>({url: prefix + Api.Remove + `/${params.ids}`}); |
@ -0,0 +1,30 @@ |
|||||||
|
import {DoctorParams,DoctorItem,DoctorItemListResult} from '/@/api/platform/system/entity/doctorModel'; |
||||||
|
import { defHttp } from '/@/utils/http/axios'; |
||||||
|
import {isDef} from '/@/utils/is'; |
||||||
|
|
||||||
|
const prefix = '/system_proxy/system'; |
||||||
|
|
||||||
|
enum Api { |
||||||
|
QueryById = '/doctor/query', |
||||||
|
List = '/doctor/list', |
||||||
|
Add = '/doctor/add', |
||||||
|
Update = '/doctor/update', |
||||||
|
Remove = '/doctor/remove' |
||||||
|
} |
||||||
|
|
||||||
|
export const queryById = (params: { id: String }) => |
||||||
|
defHttp.get<DoctorItem>({url: prefix + Api.QueryById + `/${params.id}`}); |
||||||
|
|
||||||
|
export const list = (params: DoctorParams) => |
||||||
|
defHttp.get<DoctorItemListResult>({url: prefix + Api.List, params}); |
||||||
|
|
||||||
|
export const set = (params: DoctorItem) => { |
||||||
|
if (isDef(params.id)){ |
||||||
|
defHttp.put<DoctorItem>({url: prefix + Api.Update, params}); |
||||||
|
}else { |
||||||
|
defHttp.post<DoctorItem>({url: prefix + Api.Add, params}); |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
export const remove = (params: {ids: String}) => |
||||||
|
defHttp.delete<boolean>({url: prefix + Api.Remove + `/${params.ids}`}); |
@ -0,0 +1,30 @@ |
|||||||
|
import {HospitalParams,HospitalItem,HospitalItemListResult} from '/@/api/platform/system/entity/hospitalModel'; |
||||||
|
import { defHttp } from '/@/utils/http/axios'; |
||||||
|
import {isDef} from '/@/utils/is'; |
||||||
|
|
||||||
|
const prefix = '/system_proxy/system'; |
||||||
|
|
||||||
|
enum Api { |
||||||
|
QueryById = '/hospital/query', |
||||||
|
List = '/hospital/list', |
||||||
|
Add = '/hospital/add', |
||||||
|
Update = '/hospital/update', |
||||||
|
Remove = '/hospital/remove' |
||||||
|
} |
||||||
|
|
||||||
|
export const queryById = (params: { id: String }) => |
||||||
|
defHttp.get<HospitalItem>({url: prefix + Api.QueryById, params}); |
||||||
|
|
||||||
|
export const list = (params: HospitalParams) => |
||||||
|
defHttp.get<HospitalItemListResult>({url: prefix + Api.List, params}); |
||||||
|
|
||||||
|
export const set = (params: HospitalItem) => { |
||||||
|
if (isDef(params.id)){ |
||||||
|
defHttp.put<HospitalItem>({url: prefix + Api.Update, params}); |
||||||
|
}else { |
||||||
|
defHttp.post<HospitalItem>({url: prefix + Api.Add, params}); |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
export const remove = (params: {ids: String}) => |
||||||
|
defHttp.delete<boolean>({url: prefix + Api.Remove + `/${params.ids}`}); |
@ -0,0 +1,31 @@ |
|||||||
|
|
||||||
|
import {InstitutionParams,InstitutionItem,InstitutionItemListResult} from '/@/api/platform/system/entity/institutionModel'; |
||||||
|
import { defHttp } from '/@/utils/http/axios'; |
||||||
|
import {isDef} from '/@/utils/is'; |
||||||
|
|
||||||
|
const prefix = '/system_proxy/system'; |
||||||
|
|
||||||
|
enum Api { |
||||||
|
QueryById = '/institution/query', |
||||||
|
List = '/institution/list', |
||||||
|
Add = '/institution/add', |
||||||
|
Update = '/institution/update', |
||||||
|
Remove = '/institution/remove' |
||||||
|
} |
||||||
|
|
||||||
|
export const queryById = (params: { id: String }) => |
||||||
|
defHttp.get<InstitutionItem>({url: prefix + Api.QueryById, params}); |
||||||
|
|
||||||
|
export const list = (params: InstitutionParams) => |
||||||
|
defHttp.get<InstitutionItemListResult>({url: prefix + Api.List, params}); |
||||||
|
|
||||||
|
export const set = (params: InstitutionItem) => { |
||||||
|
if (isDef(params.id)){ |
||||||
|
defHttp.put<InstitutionItem>({url: prefix + Api.Update, params}); |
||||||
|
}else { |
||||||
|
defHttp.post<InstitutionItem>({url: prefix + Api.Add, params}); |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
export const remove = (params: {ids: String}) => |
||||||
|
defHttp.delete<boolean>({url: prefix + Api.Remove + `/${params.ids}`}); |
@ -0,0 +1,30 @@ |
|||||||
|
import {OfficeParams,OfficeItem,OfficeItemListResult} from '/@/api/platform/system/entity/officeModel'; |
||||||
|
import { defHttp } from '/@/utils/http/axios'; |
||||||
|
import {isDef} from '/@/utils/is'; |
||||||
|
|
||||||
|
const prefix = '/system_proxy/system'; |
||||||
|
|
||||||
|
enum Api { |
||||||
|
QueryById = '/office/getById', |
||||||
|
List = '/office/list', |
||||||
|
Add = '/office/add', |
||||||
|
Update = '/office/update', |
||||||
|
Remove = '/office/remove' |
||||||
|
} |
||||||
|
|
||||||
|
export const queryById = (params: { id: String }) => |
||||||
|
defHttp.get<OfficeItem>({url: prefix + Api.QueryById, params}); |
||||||
|
|
||||||
|
export const list = (params: OfficeParams) => |
||||||
|
defHttp.get<OfficeItemListResult>({url: prefix + Api.List, params}); |
||||||
|
|
||||||
|
export const set = (params: OfficeItem) => { |
||||||
|
if (isDef(params.id)){ |
||||||
|
defHttp.put<OfficeItem>({url: prefix + Api.Update, params}); |
||||||
|
}else { |
||||||
|
defHttp.post<OfficeItem>({url: prefix + Api.Add, params}); |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
export const remove = (params: {ids: String}) => |
||||||
|
defHttp.delete<boolean>({url: prefix + Api.Remove + `/${params.ids}`}); |
@ -0,0 +1,30 @@ |
|||||||
|
/** |
||||||
|
* 提供api模板规范代码参考,请尽量保证编写代码风格跟模板规范代码一致 |
||||||
|
* Copyright © 2020-2022 <a href="http://www.entfrm.com/">entfrm</a> All rights reserved. |
||||||
|
* author entfrm开发团队-王翔 |
||||||
|
*/ |
||||||
|
import type { ProjectParams, Project } from '../entity/project'; |
||||||
|
import { defHttp } from '/@/utils/http/axios'; |
||||||
|
|
||||||
|
enum Api { |
||||||
|
list = '/system_proxy/system/project/list', |
||||||
|
add = '/system_proxy/system/project/save', |
||||||
|
get = '/system_proxy/system/project', |
||||||
|
edit = '/system_proxy/system/project/update', |
||||||
|
del = '/system_proxy/system/project/remove', |
||||||
|
} |
||||||
|
|
||||||
|
/** 查询项目列表 */ |
||||||
|
export const listProject = (params?: Partial<ProjectParams>) => defHttp.get({ url: Api.list, params }); |
||||||
|
|
||||||
|
/** 新增项目 */ |
||||||
|
export const addProject = (params: Partial<Project>) => defHttp.post({ url: Api.add, data: params }); |
||||||
|
|
||||||
|
/** 修改项目 */ |
||||||
|
export const editProject = (params: Partial<Project>) => defHttp.put({ url: Api.edit, data: params }); |
||||||
|
|
||||||
|
/** 查询项目详细 */ |
||||||
|
export const getProject = (id: string) => defHttp.get<Project>({ url: `${Api.get}/${id}` }); |
||||||
|
|
||||||
|
/** 删除项目 */ |
||||||
|
export const delProject = (id: string) => defHttp.delete({ url: `${Api.del}/${id}` }); |
@ -0,0 +1,26 @@ |
|||||||
|
// 引入基础包
|
||||||
|
import type { R } from '/#/axios'; |
||||||
|
import type { TreeEntity,Page } from '/@/api/common/data/entity'; |
||||||
|
|
||||||
|
export type AddressParams = { |
||||||
|
parentId?: string; |
||||||
|
code?: string; |
||||||
|
level?:string; |
||||||
|
name?: string; |
||||||
|
beginTime?: string; |
||||||
|
endTime?: string; |
||||||
|
} & Page; |
||||||
|
|
||||||
|
|
||||||
|
export interface AddressItem extends TreeEntity{ |
||||||
|
|
||||||
|
code: string; |
||||||
|
|
||||||
|
level: number; |
||||||
|
|
||||||
|
lastLevel: boolean; |
||||||
|
|
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
export type AddressItemListResult = R<AddressItem>; |
@ -0,0 +1,49 @@ |
|||||||
|
// 引入基础包
|
||||||
|
import type { R } from '/#/axios'; |
||||||
|
import type { Page } from '/@/api/common/data/entity'; |
||||||
|
|
||||||
|
export type DoctorParams = { |
||||||
|
name?: string; |
||||||
|
beginTime?: string; |
||||||
|
endTime?: string; |
||||||
|
} & Page; |
||||||
|
|
||||||
|
|
||||||
|
export interface DoctorItem { |
||||||
|
|
||||||
|
/**医生ID*/ |
||||||
|
id: string; |
||||||
|
/**医生姓名*/ |
||||||
|
name: string; |
||||||
|
/**医生职称*/ |
||||||
|
title: string; |
||||||
|
/**医生性别*/ |
||||||
|
sex: string; |
||||||
|
/**医生电话*/ |
||||||
|
phone: string; |
||||||
|
/**医生邮箱*/ |
||||||
|
email: string; |
||||||
|
/**地址(门牌号)*/ |
||||||
|
detailAddress: string; |
||||||
|
/**组织类型*/ |
||||||
|
organType: number; |
||||||
|
/**组织id*/ |
||||||
|
organId: string; |
||||||
|
/**组织名称*/ |
||||||
|
organName: string; |
||||||
|
/**科室ID*/ |
||||||
|
officeId: string; |
||||||
|
/**科室名称*/ |
||||||
|
officeName: string; |
||||||
|
/**医生状态*/ |
||||||
|
status: string; |
||||||
|
|
||||||
|
createById: string; |
||||||
|
|
||||||
|
createByName: string; |
||||||
|
|
||||||
|
createTime: string; |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
export type DoctorItemListResult = R<DoctorItem>; |
@ -0,0 +1,44 @@ |
|||||||
|
// 引入基础包
|
||||||
|
import type { R } from '/#/axios'; |
||||||
|
import type { CommonEntity,Page } from '/@/api/common/data/entity'; |
||||||
|
|
||||||
|
export type HospitalParams = { |
||||||
|
name?: string; |
||||||
|
beginTime?: string; |
||||||
|
endTime?: string; |
||||||
|
} & Page; |
||||||
|
|
||||||
|
|
||||||
|
export interface HospitalItem extends CommonEntity{ |
||||||
|
|
||||||
|
id: string; |
||||||
|
|
||||||
|
name: string; |
||||||
|
|
||||||
|
type: number; |
||||||
|
|
||||||
|
contactsName: string; |
||||||
|
|
||||||
|
contactsTel: string; |
||||||
|
|
||||||
|
contactsTitle: string; |
||||||
|
|
||||||
|
payment: string; |
||||||
|
|
||||||
|
addressIds: string; |
||||||
|
|
||||||
|
detailAddress: string; |
||||||
|
|
||||||
|
status: string; |
||||||
|
|
||||||
|
createById: string; |
||||||
|
|
||||||
|
createByName: string; |
||||||
|
|
||||||
|
createTime: string; |
||||||
|
|
||||||
|
remarks: string; |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
export type HospitalItemListResult = R<HospitalItem>; |
@ -0,0 +1,39 @@ |
|||||||
|
// 引入基础包
|
||||||
|
import type { R } from '/#/axios'; |
||||||
|
import type { CommonEntity,Page } from '/@/api/common/data/entity'; |
||||||
|
|
||||||
|
export type InstitutionParams = { |
||||||
|
name?: string; |
||||||
|
beginTime?: string; |
||||||
|
endTime?: string; |
||||||
|
} & Page; |
||||||
|
|
||||||
|
|
||||||
|
export interface InstitutionItem extends CommonEntity{ |
||||||
|
|
||||||
|
id: string; |
||||||
|
|
||||||
|
name: string; |
||||||
|
|
||||||
|
type: number; |
||||||
|
|
||||||
|
contactsName: string; |
||||||
|
|
||||||
|
contactsTel: string; |
||||||
|
|
||||||
|
contactsTitle: string; |
||||||
|
|
||||||
|
addressId: string; |
||||||
|
|
||||||
|
detailAddress: string; |
||||||
|
|
||||||
|
status: string; |
||||||
|
|
||||||
|
createById: string; |
||||||
|
|
||||||
|
createByName: string; |
||||||
|
|
||||||
|
createTime: string; |
||||||
|
} |
||||||
|
|
||||||
|
export type InstitutionItemListResult = R<InstitutionItem>; |
@ -0,0 +1,41 @@ |
|||||||
|
// 引入基础包
|
||||||
|
import type { R } from '/#/axios'; |
||||||
|
import type { CommonEntity,Page } from '/@/api/common/data/entity'; |
||||||
|
|
||||||
|
export type OfficeParams = { |
||||||
|
name?: string; |
||||||
|
beginTime?: string; |
||||||
|
endTime?: string; |
||||||
|
} & Page; |
||||||
|
|
||||||
|
|
||||||
|
export interface OfficeItem extends CommonEntity{ |
||||||
|
|
||||||
|
id: string; |
||||||
|
|
||||||
|
name: string; |
||||||
|
|
||||||
|
organType: number; |
||||||
|
|
||||||
|
organId: string; |
||||||
|
|
||||||
|
organName: string; |
||||||
|
|
||||||
|
directorName: string; |
||||||
|
|
||||||
|
directorTel: string; |
||||||
|
|
||||||
|
detailAddress: string; |
||||||
|
|
||||||
|
status: string; |
||||||
|
|
||||||
|
createById: string; |
||||||
|
|
||||||
|
createByName: string; |
||||||
|
|
||||||
|
createTime: string; |
||||||
|
|
||||||
|
remarks: string; |
||||||
|
} |
||||||
|
|
||||||
|
export type OfficeItemListResult = R<OfficeItem>; |
@ -0,0 +1,30 @@ |
|||||||
|
/** |
||||||
|
* @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 ProjectParams = Page & Project; |
||||||
|
|
||||||
|
/** 部门对象 */ |
||||||
|
export interface Project extends CommonEntity { |
||||||
|
projectId: string; |
||||||
|
code: string; |
||||||
|
name: string; |
||||||
|
parentId: string; |
||||||
|
sort: number; |
||||||
|
contacts: string; |
||||||
|
phone: string; |
||||||
|
address: string; |
||||||
|
email: string; |
||||||
|
status: string; |
||||||
|
[key: string]: any; |
||||||
|
} |
||||||
|
|
||||||
|
/** 项目响应对象 */ |
||||||
|
export type ProjectResult = R<Project[]>; |
@ -0,0 +1,53 @@ |
|||||||
|
<template> |
||||||
|
<BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit"> |
||||||
|
<BasicForm @register="registerForm"/> |
||||||
|
</BasicModal> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script lang="ts" setup> |
||||||
|
import {ref, computed, unref} from 'vue'; |
||||||
|
import {BasicModal, useModalInner} from '/@/components/Modal'; |
||||||
|
import {doctorFormSchema} from './doctor.data'; |
||||||
|
import {BasicForm, useForm} from '/@/components/Form'; |
||||||
|
import {set} from '/@/api/platform/system/controller/doctor'; |
||||||
|
const isUpdate = ref(true); |
||||||
|
// 定义emit |
||||||
|
const emit = defineEmits(['success', 'register']); |
||||||
|
/** |
||||||
|
* 表单 |
||||||
|
*/ |
||||||
|
const [registerForm, {resetFields, setFieldsValue, validate}] = useForm({ |
||||||
|
labelWidth: 100, |
||||||
|
schemas: doctorFormSchema, |
||||||
|
showActionButtonGroup: false, |
||||||
|
actionColOptions: { |
||||||
|
span: 23, |
||||||
|
}, |
||||||
|
}); |
||||||
|
/** |
||||||
|
* 表单参数 |
||||||
|
*/ |
||||||
|
const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => { |
||||||
|
resetFields(); |
||||||
|
setModalProps({confirmLoading: false}); |
||||||
|
isUpdate.value = !!data?.isUpdate; |
||||||
|
if (unref(isUpdate)) { |
||||||
|
setFieldsValue({ |
||||||
|
...data.record, |
||||||
|
}); |
||||||
|
} |
||||||
|
}) |
||||||
|
//表单标题 |
||||||
|
const getTitle = computed(() => (!unref(isUpdate) ? '新增医生' : '编辑医生')); |
||||||
|
async function handleSubmit() { |
||||||
|
try { |
||||||
|
const values = await validate(); |
||||||
|
setModalProps({confirmLoading: true}); |
||||||
|
await set(values);//保存网卡 |
||||||
|
closeModal(); |
||||||
|
emit('success'); |
||||||
|
} finally { |
||||||
|
setModalProps({confirmLoading: false}); |
||||||
|
} |
||||||
|
} |
||||||
|
</script> |
@ -0,0 +1,232 @@ |
|||||||
|
import { BasicColumn } from '/@/components/Table'; |
||||||
|
import { FormSchema } from '/@/components/Table'; |
||||||
|
import {h} from "vue"; |
||||||
|
import {Tag} from "ant-design-vue"; |
||||||
|
import { list as hospitalList } from "/@/api/platform/system/controller/hospital"; |
||||||
|
import {list as institutionList, list as institutalList} from "/@/api/platform/system/controller/institution"; |
||||||
|
import { list as officeList } from "/@/api/platform/system/controller/office"; |
||||||
|
|
||||||
|
|
||||||
|
export const columns: BasicColumn[] = [ |
||||||
|
{ |
||||||
|
title: 'ID', |
||||||
|
dataIndex: 'id', |
||||||
|
width: 120, |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: '医生姓名', |
||||||
|
dataIndex: 'name', |
||||||
|
width: 120, |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: '医生职称', |
||||||
|
dataIndex: 'title', |
||||||
|
width: 120, |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: '医生性别', |
||||||
|
dataIndex: 'sex', |
||||||
|
width: 120, |
||||||
|
customRender: ({ record }) => { |
||||||
|
switch (record.sex) { |
||||||
|
case 'M': return '男'; |
||||||
|
case 'F': return '女'; |
||||||
|
default: return '未知'; |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: '医生电话', |
||||||
|
dataIndex: 'phone', |
||||||
|
width: 120, |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: '医生邮箱', |
||||||
|
dataIndex: 'email', |
||||||
|
width: 120, |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: '地址', |
||||||
|
dataIndex: 'detailAddress', |
||||||
|
width: 120, |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: '所属组织类型', |
||||||
|
dataIndex: 'organType', |
||||||
|
width: 120, |
||||||
|
customRender: ({ record }) => { |
||||||
|
const organType = record.organType; |
||||||
|
let text = ''; |
||||||
|
let color = ''; |
||||||
|
switch (organType) { |
||||||
|
case '1': |
||||||
|
text = '医院'; |
||||||
|
color = 'green'; |
||||||
|
break; |
||||||
|
case '2': |
||||||
|
text = '医检'; |
||||||
|
color = 'blue'; |
||||||
|
break; |
||||||
|
default: |
||||||
|
text = '未知'; |
||||||
|
color = 'gray'; |
||||||
|
break; |
||||||
|
} |
||||||
|
return h(Tag, { color: color }, () => text); |
||||||
|
} |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: '组织名称', |
||||||
|
dataIndex: 'organName', |
||||||
|
width: 120, |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: '科室名称', |
||||||
|
dataIndex: 'officeName', |
||||||
|
width: 120, |
||||||
|
}, |
||||||
|
{ |
||||||
|
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: 'beginTime', |
||||||
|
label: '起始时间', |
||||||
|
component: 'DatePicker', |
||||||
|
colProps: { span: 5 }, |
||||||
|
}, |
||||||
|
{ |
||||||
|
field: 'endTime', |
||||||
|
label: '截止时间', |
||||||
|
component: 'DatePicker', |
||||||
|
colProps: { span: 5 }, |
||||||
|
}, |
||||||
|
]; |
||||||
|
|
||||||
|
export const doctorFormSchema: FormSchema[] = [ |
||||||
|
{ |
||||||
|
field: 'id', |
||||||
|
label: 'ID', |
||||||
|
component: 'Input', |
||||||
|
show: false, |
||||||
|
}, |
||||||
|
{ |
||||||
|
field: 'name', |
||||||
|
label: '医生姓名', |
||||||
|
component: 'Input', |
||||||
|
required: true |
||||||
|
}, |
||||||
|
{ |
||||||
|
field: 'title', |
||||||
|
label: '医生职称', |
||||||
|
component: 'Input', |
||||||
|
required: false, |
||||||
|
}, |
||||||
|
{ |
||||||
|
field: 'sex', |
||||||
|
label: '医生性别', |
||||||
|
component: 'Select', |
||||||
|
required: false, |
||||||
|
defaultValue: 'M', |
||||||
|
componentProps: { |
||||||
|
options: [ |
||||||
|
{ label: '男', value: 'M' }, |
||||||
|
{ label: '女', value: 'F' }, |
||||||
|
] |
||||||
|
} |
||||||
|
}, |
||||||
|
{ |
||||||
|
field: 'phone', |
||||||
|
label: '医生电话', |
||||||
|
component: 'Input', |
||||||
|
required: false, |
||||||
|
}, |
||||||
|
{ |
||||||
|
field: 'email', |
||||||
|
label: '医生邮箱', |
||||||
|
component: 'Input', |
||||||
|
required: false, |
||||||
|
}, |
||||||
|
{ |
||||||
|
field: 'detailAddress', |
||||||
|
label: '地址', |
||||||
|
component: 'Input', |
||||||
|
required: false, |
||||||
|
}, |
||||||
|
{ |
||||||
|
field: 'organType', |
||||||
|
label: '所属组织类型', |
||||||
|
component: 'Select', |
||||||
|
componentProps: { |
||||||
|
options: [ |
||||||
|
{ label: '医院', value: 1 }, |
||||||
|
{ label: '医检', value: 2 } |
||||||
|
] |
||||||
|
}, |
||||||
|
required: true, |
||||||
|
}, |
||||||
|
{ |
||||||
|
field: 'organId', |
||||||
|
label: '所属组织', |
||||||
|
component: 'ApiSelect', |
||||||
|
required: true, |
||||||
|
renderComponentContent: renderCallbackParams => { |
||||||
|
const organType = renderCallbackParams.model.organType; |
||||||
|
const dataApi = organType==1 ? hospitalList : institutionList; |
||||||
|
|
||||||
|
renderCallbackParams.schema.componentProps = { |
||||||
|
resultField: 'list', |
||||||
|
labelField: 'name', |
||||||
|
valueField: 'id', |
||||||
|
api: dataApi |
||||||
|
} |
||||||
|
}, |
||||||
|
}, |
||||||
|
{ |
||||||
|
field: 'status', |
||||||
|
label: '状态', |
||||||
|
component: 'RadioButtonGroup', |
||||||
|
defaultValue: '0', |
||||||
|
componentProps: { |
||||||
|
options: [ |
||||||
|
{ label: '启用', value: '0' }, |
||||||
|
{ label: '禁用', value: '1' }, |
||||||
|
], |
||||||
|
}, |
||||||
|
}, |
||||||
|
{ |
||||||
|
label: '备注', |
||||||
|
field: 'remarks', |
||||||
|
component: 'InputTextArea', |
||||||
|
} |
||||||
|
]; |
@ -0,0 +1,94 @@ |
|||||||
|
<template> |
||||||
|
<div> |
||||||
|
<BasicTable @register="registerTable"> |
||||||
|
<template #toolbar> |
||||||
|
<a-button type="primary" @click="handleCreate">新增医生</a-button> |
||||||
|
</template> |
||||||
|
<template #action="{ record }"> |
||||||
|
<TableAction |
||||||
|
:actions="[ |
||||||
|
{ |
||||||
|
icon: 'clarity:note-edit-line', |
||||||
|
onClick: handleEdit.bind(null, record), |
||||||
|
}, |
||||||
|
{ |
||||||
|
icon: 'ant-design:delete-outlined', |
||||||
|
color: 'error', |
||||||
|
popConfirm: { |
||||||
|
title: '是否确认删除', |
||||||
|
confirm: handleDelete.bind(null, record), |
||||||
|
}, |
||||||
|
}, |
||||||
|
]" |
||||||
|
/> |
||||||
|
</template> |
||||||
|
</BasicTable> |
||||||
|
|
||||||
|
<DoctorModal @register="registerModal" @success="handleSuccess"></DoctorModal> |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script lang="ts" setup> |
||||||
|
import {BasicTable, useTable, TableAction} from '/@/components/Table'; |
||||||
|
import {useModal} from '/@/components/Modal'; |
||||||
|
import DoctorModal from './DoctorModal.vue'; |
||||||
|
import {columns, searchFormSchema} from './doctor.data' |
||||||
|
import {useMessage} from '/@/hooks/web/useMessage'; |
||||||
|
import {list, remove} from '/@/api/platform/system/controller/doctor'; |
||||||
|
const {createMessage} = useMessage(); |
||||||
|
const [registerModal, {openModal}] = useModal(); |
||||||
|
const [registerTable, {reload}] = useTable({ |
||||||
|
title: '医生列表', |
||||||
|
api: list, |
||||||
|
columns, |
||||||
|
formConfig: { |
||||||
|
labelWidth: 120, |
||||||
|
schemas: searchFormSchema, |
||||||
|
}, |
||||||
|
pagination: true, |
||||||
|
striped: true, |
||||||
|
useSearchForm: true, |
||||||
|
showTableSetting: true, |
||||||
|
bordered: true, |
||||||
|
showIndexColumn: true, |
||||||
|
canResize: false, |
||||||
|
actionColumn: { |
||||||
|
width: 80, |
||||||
|
title: '操作', |
||||||
|
dataIndex: 'action', |
||||||
|
slots: {customRender: 'action'}, |
||||||
|
fixed: undefined, |
||||||
|
}, |
||||||
|
}); |
||||||
|
/** |
||||||
|
* 创建菜单 |
||||||
|
*/ |
||||||
|
function handleCreate() { |
||||||
|
openModal(true, { |
||||||
|
isUpdate: false, |
||||||
|
}); |
||||||
|
} |
||||||
|
/** |
||||||
|
* 编辑菜单 |
||||||
|
*/ |
||||||
|
function handleEdit(record: Recordable) { |
||||||
|
openModal(true, { |
||||||
|
record, |
||||||
|
isUpdate: true, |
||||||
|
}); |
||||||
|
} |
||||||
|
/** |
||||||
|
* 删除菜单 |
||||||
|
*/ |
||||||
|
async function handleDelete(record: Recordable) { |
||||||
|
await remove({ids: record.id}); |
||||||
|
createMessage.success('删除成功!'); |
||||||
|
handleSuccess(); |
||||||
|
} |
||||||
|
/** |
||||||
|
* 成功后重载表格 |
||||||
|
*/ |
||||||
|
function handleSuccess() { |
||||||
|
reload(); |
||||||
|
} |
||||||
|
</script> |
@ -0,0 +1,61 @@ |
|||||||
|
<template> |
||||||
|
<BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit"> |
||||||
|
<BasicForm @register="registerForm"/> |
||||||
|
</BasicModal> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script lang="ts" setup> |
||||||
|
import {ref, computed, unref, toRaw} from 'vue'; |
||||||
|
import {BasicModal, useModalInner} from '/@/components/Modal'; |
||||||
|
import {hospitalFormSchema} from './hospital.data'; |
||||||
|
import {BasicForm, useForm} from '/@/components/Form'; |
||||||
|
import {set} from '/@/api/platform/system/controller/hospital'; |
||||||
|
import {HospitalItem} from "/@/api/platform/system/entity/hospitalModel"; |
||||||
|
const isUpdate = ref(true); |
||||||
|
// 定义emit |
||||||
|
const emit = defineEmits(['success', 'register']); |
||||||
|
/** |
||||||
|
* 表单 |
||||||
|
*/ |
||||||
|
const [registerForm, {resetFields, setFieldsValue, validate}] = useForm({ |
||||||
|
labelWidth: 120, |
||||||
|
schemas: hospitalFormSchema, |
||||||
|
showActionButtonGroup: false, |
||||||
|
actionColOptions: { |
||||||
|
span: 23, |
||||||
|
}, |
||||||
|
}); |
||||||
|
/** |
||||||
|
* 表单参数 |
||||||
|
*/ |
||||||
|
const [registerModal, {setModalProps, closeModal}] = useModalInner( (data) => { |
||||||
|
resetFields(); |
||||||
|
setModalProps({confirmLoading: false}); |
||||||
|
isUpdate.value = !!data?.isUpdate; |
||||||
|
if (unref(isUpdate)) { |
||||||
|
if(typeof data.record.addressIds == "string"){ |
||||||
|
let addressIdsStr: string = data.record.addressIds; |
||||||
|
const addressIds:String[] = addressIdsStr.split(","); |
||||||
|
data.record.addressIds = addressIds; |
||||||
|
} |
||||||
|
setFieldsValue({ |
||||||
|
...data.record, |
||||||
|
}); |
||||||
|
} |
||||||
|
}) |
||||||
|
//表单标题 |
||||||
|
const getTitle = computed(() => (!unref(isUpdate) ? '新增医院' : '编辑医院')); |
||||||
|
async function handleSubmit() { |
||||||
|
try { |
||||||
|
const values = await validate(); |
||||||
|
setModalProps({confirmLoading: true}); |
||||||
|
let val = toRaw<HospitalItem>(values); |
||||||
|
values.addressIds = toRaw(val.addressIds).toString(); |
||||||
|
await set(values); |
||||||
|
closeModal(); |
||||||
|
emit('success'); |
||||||
|
} finally { |
||||||
|
setModalProps({confirmLoading: false}); |
||||||
|
} |
||||||
|
} |
||||||
|
</script> |
@ -0,0 +1,230 @@ |
|||||||
|
import { BasicColumn } from '/@/components/Table'; |
||||||
|
import { FormSchema } from '/@/components/Table'; |
||||||
|
import {h} from "vue"; |
||||||
|
import {Tag} from "ant-design-vue"; |
||||||
|
import {list as addressList} from "/@/api/platform/system/controller/address"; |
||||||
|
import {list as institutionList} from "/@/api/platform/system/controller/institution" |
||||||
|
|
||||||
|
|
||||||
|
export const columns: BasicColumn[] = [ |
||||||
|
{ |
||||||
|
title: 'ID', |
||||||
|
dataIndex: 'id', |
||||||
|
width: 120, |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: '医院名', |
||||||
|
dataIndex: 'name', |
||||||
|
width: 120, |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: '医院类型', |
||||||
|
dataIndex: 'card', |
||||||
|
width: 120, |
||||||
|
customRender: ({ record }) =>{ |
||||||
|
const type = record.type; |
||||||
|
let text = ''; |
||||||
|
let color = ''; |
||||||
|
switch (type) { |
||||||
|
case '1': |
||||||
|
text = '合作医院'; |
||||||
|
color = 'green'; |
||||||
|
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: 'payment', |
||||||
|
width: 120, |
||||||
|
customRender: ({ record }) => { |
||||||
|
const com = record.payment; |
||||||
|
switch (com) { |
||||||
|
case '0': return '月付'; |
||||||
|
case '1': return '预约付款'; |
||||||
|
case '2': return '采样付款'; |
||||||
|
default: return '月付'; |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
{ |
||||||
|
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: 'beginTime', |
||||||
|
label: '起始时间', |
||||||
|
component: 'DatePicker', |
||||||
|
colProps: { span: 5 }, |
||||||
|
}, |
||||||
|
{ |
||||||
|
field: 'endTime', |
||||||
|
label: '截止时间', |
||||||
|
component: 'DatePicker', |
||||||
|
colProps: { span: 5 }, |
||||||
|
}, |
||||||
|
]; |
||||||
|
|
||||||
|
export const hospitalFormSchema: 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: '0'}, |
||||||
|
] |
||||||
|
}, |
||||||
|
required: true, |
||||||
|
}, |
||||||
|
{ |
||||||
|
field: 'contactsName', |
||||||
|
label: '联系人名称', |
||||||
|
component: 'Input', |
||||||
|
required: true |
||||||
|
}, |
||||||
|
{ |
||||||
|
field: 'contactsTel', |
||||||
|
label: '联系人电话', |
||||||
|
component: 'Input', |
||||||
|
required: true |
||||||
|
}, |
||||||
|
{ |
||||||
|
field: 'contactsTitle', |
||||||
|
label: '联系人职称', |
||||||
|
component: 'Input', |
||||||
|
required: true |
||||||
|
}, |
||||||
|
|
||||||
|
{ |
||||||
|
field: 'payment', |
||||||
|
label: '支付方式', |
||||||
|
component: 'Select', |
||||||
|
required: true, |
||||||
|
defaultValue: '0', |
||||||
|
componentProps: { |
||||||
|
options: [ |
||||||
|
{ label: '月付', value: '0' }, |
||||||
|
{ label: '预约付款', value: '1' }, |
||||||
|
{ label: '采样付款', value: '2' }, |
||||||
|
], |
||||||
|
} |
||||||
|
}, |
||||||
|
/* { |
||||||
|
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' }, |
||||||
|
], |
||||||
|
}, |
||||||
|
}, |
||||||
|
{ |
||||||
|
field: 'institutionIds', |
||||||
|
label: '关联机构', |
||||||
|
component: 'ApiSelect', |
||||||
|
componentProps: { |
||||||
|
mode: "multiple", |
||||||
|
resultField: 'list', |
||||||
|
labelField: 'name', |
||||||
|
valueField: 'id', |
||||||
|
api: institutionList, |
||||||
|
} |
||||||
|
}, |
||||||
|
{ |
||||||
|
label: '备注', |
||||||
|
field: 'remarks', |
||||||
|
component: 'InputTextArea', |
||||||
|
} |
||||||
|
]; |
@ -0,0 +1,94 @@ |
|||||||
|
<template> |
||||||
|
<div> |
||||||
|
<BasicTable @register="registerTable"> |
||||||
|
<template #toolbar> |
||||||
|
<a-button type="primary" @click="handleCreate">新增医院</a-button> |
||||||
|
</template> |
||||||
|
<template #action="{ record }"> |
||||||
|
<TableAction |
||||||
|
:actions="[ |
||||||
|
{ |
||||||
|
icon: 'clarity:note-edit-line', |
||||||
|
onClick: handleEdit.bind(null, record), |
||||||
|
}, |
||||||
|
{ |
||||||
|
icon: 'ant-design:delete-outlined', |
||||||
|
color: 'error', |
||||||
|
popConfirm: { |
||||||
|
title: '是否确认删除', |
||||||
|
confirm: handleDelete.bind(null, record), |
||||||
|
}, |
||||||
|
}, |
||||||
|
]" |
||||||
|
/> |
||||||
|
</template> |
||||||
|
</BasicTable> |
||||||
|
|
||||||
|
<HospitalModal @register="registerModal" @success="handleSuccess"></HospitalModal> |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script lang="ts" setup> |
||||||
|
import {BasicTable, useTable, TableAction} from '/@/components/Table'; |
||||||
|
import {useModal} from '/@/components/Modal'; |
||||||
|
import HospitalModal from './HospitalModal.vue'; |
||||||
|
import {columns, searchFormSchema} from './hospital.data' |
||||||
|
import {useMessage} from '/@/hooks/web/useMessage'; |
||||||
|
import {list, remove} from '/@/api/platform/system/controller/hospital'; |
||||||
|
const {createMessage} = useMessage(); |
||||||
|
const [registerModal, {openModal}] = useModal(); |
||||||
|
const [registerTable, {reload}] = useTable({ |
||||||
|
title: '医院列表', |
||||||
|
api: list, |
||||||
|
columns, |
||||||
|
formConfig: { |
||||||
|
labelWidth: 120, |
||||||
|
schemas: searchFormSchema, |
||||||
|
}, |
||||||
|
pagination: true, |
||||||
|
striped: true, |
||||||
|
useSearchForm: true, |
||||||
|
showTableSetting: true, |
||||||
|
bordered: true, |
||||||
|
showIndexColumn: true, |
||||||
|
canResize: false, |
||||||
|
actionColumn: { |
||||||
|
width: 80, |
||||||
|
title: '操作', |
||||||
|
dataIndex: 'action', |
||||||
|
slots: {customRender: 'action'}, |
||||||
|
fixed: undefined, |
||||||
|
}, |
||||||
|
}); |
||||||
|
/** |
||||||
|
* 创建菜单 |
||||||
|
*/ |
||||||
|
function handleCreate() { |
||||||
|
openModal(true, { |
||||||
|
isUpdate: false, |
||||||
|
}); |
||||||
|
} |
||||||
|
/** |
||||||
|
* 编辑菜单 |
||||||
|
*/ |
||||||
|
function handleEdit(record: Recordable) { |
||||||
|
openModal(true, { |
||||||
|
record, |
||||||
|
isUpdate: true, |
||||||
|
}); |
||||||
|
} |
||||||
|
/** |
||||||
|
* 删除菜单 |
||||||
|
*/ |
||||||
|
async function handleDelete(record: Recordable) { |
||||||
|
await remove({ids: record.id}); |
||||||
|
createMessage.success('删除成功!'); |
||||||
|
handleSuccess(); |
||||||
|
} |
||||||
|
/** |
||||||
|
* 成功后重载表格 |
||||||
|
*/ |
||||||
|
function handleSuccess() { |
||||||
|
reload(); |
||||||
|
} |
||||||
|
</script> |
@ -0,0 +1,53 @@ |
|||||||
|
<template> |
||||||
|
<BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit"> |
||||||
|
<BasicForm @register="registerForm"/> |
||||||
|
</BasicModal> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script lang="ts" setup> |
||||||
|
import {ref, computed, unref} from 'vue'; |
||||||
|
import {BasicModal, useModalInner} from '/@/components/Modal'; |
||||||
|
import {institutionFormSchema} from './institution.data' |
||||||
|
import {BasicForm, useForm} from '/@/components/Form'; |
||||||
|
import {set} from '/@/api/platform/system/controller/institution' |
||||||
|
const isUpdate = ref(true); |
||||||
|
// 定义emit |
||||||
|
const emit = defineEmits(['success', 'register']); |
||||||
|
/** |
||||||
|
* 表单 |
||||||
|
*/ |
||||||
|
const [registerForm, {resetFields, setFieldsValue, validate}] = useForm({ |
||||||
|
labelWidth: 100, |
||||||
|
schemas: institutionFormSchema, |
||||||
|
showActionButtonGroup: false, |
||||||
|
actionColOptions: { |
||||||
|
span: 23, |
||||||
|
}, |
||||||
|
}); |
||||||
|
/** |
||||||
|
* 表单参数 |
||||||
|
*/ |
||||||
|
const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => { |
||||||
|
resetFields(); |
||||||
|
setModalProps({confirmLoading: false}); |
||||||
|
isUpdate.value = !!data?.isUpdate; |
||||||
|
if (unref(isUpdate)) { |
||||||
|
setFieldsValue({ |
||||||
|
...data.record, |
||||||
|
}); |
||||||
|
} |
||||||
|
}) |
||||||
|
//表单标题 |
||||||
|
const getTitle = computed(() => (!unref(isUpdate) ? '新增机构' : '编辑机构')); |
||||||
|
async function handleSubmit() { |
||||||
|
try { |
||||||
|
const values = await validate(); |
||||||
|
setModalProps({confirmLoading: true}); |
||||||
|
await set(values); |
||||||
|
closeModal(); |
||||||
|
emit('success'); |
||||||
|
} finally { |
||||||
|
setModalProps({confirmLoading: false}); |
||||||
|
} |
||||||
|
} |
||||||
|
</script> |
@ -0,0 +1,94 @@ |
|||||||
|
<template> |
||||||
|
<div> |
||||||
|
<BasicTable @register="registerTable"> |
||||||
|
<template #toolbar> |
||||||
|
<a-button type="primary" @click="handleCreate">新增医检机构</a-button> |
||||||
|
</template> |
||||||
|
<template #action="{ record }"> |
||||||
|
<TableAction |
||||||
|
:actions="[ |
||||||
|
{ |
||||||
|
icon: 'clarity:note-edit-line', |
||||||
|
onClick: handleEdit.bind(null, record), |
||||||
|
}, |
||||||
|
{ |
||||||
|
icon: 'ant-design:delete-outlined', |
||||||
|
color: 'error', |
||||||
|
popConfirm: { |
||||||
|
title: '是否确认删除', |
||||||
|
confirm: handleDelete.bind(null, record), |
||||||
|
}, |
||||||
|
}, |
||||||
|
]" |
||||||
|
/> |
||||||
|
</template> |
||||||
|
</BasicTable> |
||||||
|
|
||||||
|
<BoxCardModal @register="registerModal" @success="handleSuccess"></BoxCardModal> |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script lang="ts" setup> |
||||||
|
import {BasicTable, useTable, TableAction} from '/@/components/Table'; |
||||||
|
import {useModal} from '/@/components/Modal'; |
||||||
|
import BoxCardModal from './InstitutionModal.vue'; |
||||||
|
import {columns, searchFormSchema} from './institution.data' |
||||||
|
import {useMessage} from '/@/hooks/web/useMessage'; |
||||||
|
import {list, remove} from '/@/api/platform/system/controller/institution'; |
||||||
|
const {createMessage} = useMessage(); |
||||||
|
const [registerModal, {openModal}] = useModal(); |
||||||
|
const [registerTable, {reload}] = useTable({ |
||||||
|
title: '医检列表', |
||||||
|
api: list, |
||||||
|
columns, |
||||||
|
formConfig: { |
||||||
|
labelWidth: 120, |
||||||
|
schemas: searchFormSchema, |
||||||
|
}, |
||||||
|
pagination: true, |
||||||
|
striped: true, |
||||||
|
useSearchForm: true, |
||||||
|
showTableSetting: true, |
||||||
|
bordered: true, |
||||||
|
showIndexColumn: true, |
||||||
|
canResize: false, |
||||||
|
actionColumn: { |
||||||
|
width: 80, |
||||||
|
title: '操作', |
||||||
|
dataIndex: 'action', |
||||||
|
slots: {customRender: 'action'}, |
||||||
|
fixed: undefined, |
||||||
|
}, |
||||||
|
}); |
||||||
|
/** |
||||||
|
* 创建菜单 |
||||||
|
*/ |
||||||
|
function handleCreate() { |
||||||
|
openModal(true, { |
||||||
|
isUpdate: false, |
||||||
|
}); |
||||||
|
} |
||||||
|
/** |
||||||
|
* 编辑菜单 |
||||||
|
*/ |
||||||
|
function handleEdit(record: Recordable) { |
||||||
|
openModal(true, { |
||||||
|
record, |
||||||
|
isUpdate: true, |
||||||
|
}); |
||||||
|
} |
||||||
|
/** |
||||||
|
* 删除菜单 |
||||||
|
*/ |
||||||
|
async function handleDelete(record: Recordable) { |
||||||
|
await remove({ids: record.id}); |
||||||
|
createMessage.success('删除成功!'); |
||||||
|
handleSuccess(); |
||||||
|
} |
||||||
|
/** |
||||||
|
* 成功后重载表格 |
||||||
|
*/ |
||||||
|
function handleSuccess() { |
||||||
|
reload(); |
||||||
|
} |
||||||
|
</script> |
@ -0,0 +1,193 @@ |
|||||||
|
import { BasicColumn } from '/@/components/Table'; |
||||||
|
import { FormSchema } from '/@/components/Table'; |
||||||
|
import {h} from "vue"; |
||||||
|
import {Tag} from "ant-design-vue"; |
||||||
|
import {list as addressList} from "/@/api/platform/system/controller/address"; |
||||||
|
|
||||||
|
|
||||||
|
export const columns: BasicColumn[] = [ |
||||||
|
{ |
||||||
|
title: 'ID', |
||||||
|
dataIndex: 'id', |
||||||
|
width: 120, |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: '医检名', |
||||||
|
dataIndex: 'name', |
||||||
|
width: 120, |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: '医检类型', |
||||||
|
dataIndex: 'card', |
||||||
|
width: 120, |
||||||
|
customRender: ({ 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, |
||||||
|
} |
||||||
|
]; |
||||||
|
|
||||||
|
export const searchFormSchema: FormSchema[] = [ |
||||||
|
{ |
||||||
|
field: 'name', |
||||||
|
label: '医院名称', |
||||||
|
component: 'Input', |
||||||
|
componentProps: { |
||||||
|
placeholder: '请输入医院名称', |
||||||
|
}, |
||||||
|
colProps: { span: 5 }, |
||||||
|
}, |
||||||
|
{ |
||||||
|
field: 'beginTime', |
||||||
|
label: '起始时间', |
||||||
|
component: 'DatePicker', |
||||||
|
colProps: { span: 5 }, |
||||||
|
}, |
||||||
|
{ |
||||||
|
field: 'endTime', |
||||||
|
label: '截止时间', |
||||||
|
component: 'DatePicker', |
||||||
|
colProps: { span: 5 }, |
||||||
|
}, |
||||||
|
]; |
||||||
|
|
||||||
|
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', |
||||||
|
required: true |
||||||
|
}, |
||||||
|
{ |
||||||
|
field: 'contactsTitle', |
||||||
|
label: '联系人职称', |
||||||
|
component: 'Input', |
||||||
|
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', |
||||||
|
} |
||||||
|
]; |
@ -0,0 +1,53 @@ |
|||||||
|
<template> |
||||||
|
<BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit"> |
||||||
|
<BasicForm @register="registerForm"/> |
||||||
|
</BasicModal> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script lang="ts" setup> |
||||||
|
import {ref, computed, unref} from 'vue'; |
||||||
|
import {BasicModal, useModalInner} from '/@/components/Modal'; |
||||||
|
import {officeFormSchema} from './office.data'; |
||||||
|
import {BasicForm, useForm} from '/@/components/Form'; |
||||||
|
import {set} from '/@/api/platform/system/controller/office'; |
||||||
|
const isUpdate = ref(true); |
||||||
|
// 定义emit |
||||||
|
const emit = defineEmits(['success', 'register']); |
||||||
|
/** |
||||||
|
* 表单 |
||||||
|
*/ |
||||||
|
const [registerForm, {resetFields, setFieldsValue, validate}] = useForm({ |
||||||
|
labelWidth: 100, |
||||||
|
schemas: officeFormSchema, |
||||||
|
showActionButtonGroup: false, |
||||||
|
actionColOptions: { |
||||||
|
span: 23, |
||||||
|
}, |
||||||
|
}); |
||||||
|
/** |
||||||
|
* 表单参数 |
||||||
|
*/ |
||||||
|
const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => { |
||||||
|
resetFields(); |
||||||
|
setModalProps({confirmLoading: false}); |
||||||
|
isUpdate.value = !!data?.isUpdate; |
||||||
|
if (unref(isUpdate)) { |
||||||
|
setFieldsValue({ |
||||||
|
...data.record, |
||||||
|
}); |
||||||
|
} |
||||||
|
}) |
||||||
|
//表单标题 |
||||||
|
const getTitle = computed(() => (!unref(isUpdate) ? '新增科室' : '编辑科室')); |
||||||
|
async function handleSubmit() { |
||||||
|
try { |
||||||
|
const values = await validate(); |
||||||
|
setModalProps({confirmLoading: true}); |
||||||
|
await set(values); |
||||||
|
closeModal(); |
||||||
|
emit('success'); |
||||||
|
} finally { |
||||||
|
setModalProps({confirmLoading: false}); |
||||||
|
} |
||||||
|
} |
||||||
|
</script> |
@ -0,0 +1,94 @@ |
|||||||
|
<template> |
||||||
|
<div> |
||||||
|
<BasicTable @register="registerTable"> |
||||||
|
<template #toolbar> |
||||||
|
<a-button type="primary" @click="handleCreate">新增科室</a-button> |
||||||
|
</template> |
||||||
|
<template #action="{ record }"> |
||||||
|
<TableAction |
||||||
|
:actions="[ |
||||||
|
{ |
||||||
|
icon: 'clarity:note-edit-line', |
||||||
|
onClick: handleEdit.bind(null, record), |
||||||
|
}, |
||||||
|
{ |
||||||
|
icon: 'ant-design:delete-outlined', |
||||||
|
color: 'error', |
||||||
|
popConfirm: { |
||||||
|
title: '是否确认删除', |
||||||
|
confirm: handleDelete.bind(null, record), |
||||||
|
}, |
||||||
|
}, |
||||||
|
]" |
||||||
|
/> |
||||||
|
</template> |
||||||
|
</BasicTable> |
||||||
|
|
||||||
|
<OfficeModal @register="registerModal" @success="handleSuccess"></OfficeModal> |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script lang="ts" setup> |
||||||
|
import {BasicTable, useTable, TableAction} from '/@/components/Table'; |
||||||
|
import {useModal} from '/@/components/Modal'; |
||||||
|
import OfficeModal from './OfficeModal.vue'; |
||||||
|
import {columns, searchFormSchema} from './office.data' |
||||||
|
import {useMessage} from '/@/hooks/web/useMessage'; |
||||||
|
import {list, remove} from '/@/api/platform/system/controller/office'; |
||||||
|
const {createMessage} = useMessage(); |
||||||
|
const [registerModal, {openModal}] = useModal(); |
||||||
|
const [registerTable, {reload}] = useTable({ |
||||||
|
title: '科室列表', |
||||||
|
api: list, |
||||||
|
columns, |
||||||
|
formConfig: { |
||||||
|
labelWidth: 120, |
||||||
|
schemas: searchFormSchema, |
||||||
|
}, |
||||||
|
pagination: true, |
||||||
|
striped: true, |
||||||
|
useSearchForm: true, |
||||||
|
showTableSetting: true, |
||||||
|
bordered: true, |
||||||
|
showIndexColumn: true, |
||||||
|
canResize: false, |
||||||
|
actionColumn: { |
||||||
|
width: 80, |
||||||
|
title: '操作', |
||||||
|
dataIndex: 'action', |
||||||
|
slots: {customRender: 'action'}, |
||||||
|
fixed: undefined, |
||||||
|
}, |
||||||
|
}); |
||||||
|
/** |
||||||
|
* 创建菜单 |
||||||
|
*/ |
||||||
|
function handleCreate() { |
||||||
|
openModal(true, { |
||||||
|
isUpdate: false, |
||||||
|
}); |
||||||
|
} |
||||||
|
/** |
||||||
|
* 编辑菜单 |
||||||
|
*/ |
||||||
|
function handleEdit(record: Recordable) { |
||||||
|
openModal(true, { |
||||||
|
record, |
||||||
|
isUpdate: true, |
||||||
|
}); |
||||||
|
} |
||||||
|
/** |
||||||
|
* 删除菜单 |
||||||
|
*/ |
||||||
|
async function handleDelete(record: Recordable) { |
||||||
|
await remove({ids: record.id}); |
||||||
|
createMessage.success('删除成功!'); |
||||||
|
handleSuccess(); |
||||||
|
} |
||||||
|
/** |
||||||
|
* 成功后重载表格 |
||||||
|
*/ |
||||||
|
function handleSuccess() { |
||||||
|
reload(); |
||||||
|
} |
||||||
|
</script> |
@ -0,0 +1,190 @@ |
|||||||
|
import { BasicColumn } from '/@/components/Table'; |
||||||
|
import { FormSchema } from '/@/components/Table'; |
||||||
|
import {h} from "vue"; |
||||||
|
import {Tag} from "ant-design-vue"; |
||||||
|
import { list as hospitalList } from "/@/api/platform/system/controller/hospital"; |
||||||
|
import { list as institutionList } from "/@/api/platform/system/controller/institution"; |
||||||
|
|
||||||
|
|
||||||
|
export const columns: BasicColumn[] = [ |
||||||
|
{ |
||||||
|
title: 'ID', |
||||||
|
dataIndex: 'id', |
||||||
|
width: 120, |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: '科室名称', |
||||||
|
dataIndex: 'name', |
||||||
|
width: 120, |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: '所属组织类型', |
||||||
|
dataIndex: 'organType', |
||||||
|
width: 120, |
||||||
|
customRender: ({ record }) => { |
||||||
|
const organType = record.organType; |
||||||
|
let text = ''; |
||||||
|
let color = ''; |
||||||
|
switch (organType) { |
||||||
|
case '1': |
||||||
|
text = '医院'; |
||||||
|
color = 'green'; |
||||||
|
break; |
||||||
|
case '2': |
||||||
|
text = '医检'; |
||||||
|
color = 'blue'; |
||||||
|
break; |
||||||
|
default: |
||||||
|
text = '未知'; |
||||||
|
color = 'gray'; |
||||||
|
break; |
||||||
|
} |
||||||
|
return h(Tag, { color: color }, () => text); |
||||||
|
} |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: '组织名称', |
||||||
|
dataIndex: 'organName', |
||||||
|
width: 120, |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: '主任名称', |
||||||
|
dataIndex: 'directorName', |
||||||
|
width: 120, |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: '主任电话', |
||||||
|
dataIndex: 'directorTel', |
||||||
|
width: 120, |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: '地址', |
||||||
|
dataIndex: 'detailAddress', |
||||||
|
width: 120, |
||||||
|
}, |
||||||
|
{ |
||||||
|
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: 'beginTime', |
||||||
|
label: '起始时间', |
||||||
|
component: 'DatePicker', |
||||||
|
colProps: { span: 5 }, |
||||||
|
}, |
||||||
|
{ |
||||||
|
field: 'endTime', |
||||||
|
label: '截止时间', |
||||||
|
component: 'DatePicker', |
||||||
|
colProps: { span: 5 }, |
||||||
|
}, |
||||||
|
]; |
||||||
|
|
||||||
|
export const officeFormSchema: FormSchema[] = [ |
||||||
|
{ |
||||||
|
field: 'id', |
||||||
|
label: 'ID', |
||||||
|
component: 'Input', |
||||||
|
show: false, |
||||||
|
}, |
||||||
|
{ |
||||||
|
field: 'name', |
||||||
|
label: '科室名称', |
||||||
|
component: 'Input', |
||||||
|
required: true |
||||||
|
}, |
||||||
|
{ |
||||||
|
field: 'organType', |
||||||
|
label: '所属组织类型', |
||||||
|
component: 'Select', |
||||||
|
componentProps: { |
||||||
|
options: [ |
||||||
|
{ label: '医院', value: 1 }, |
||||||
|
{ label: '医检', value: 2 } |
||||||
|
] |
||||||
|
}, |
||||||
|
required: true, |
||||||
|
}, |
||||||
|
{ |
||||||
|
field: 'organId', |
||||||
|
label: '所属组织', |
||||||
|
component: 'ApiSelect', |
||||||
|
required: true, |
||||||
|
renderComponentContent: renderCallbackParams => { |
||||||
|
const organType = renderCallbackParams.model.organType; |
||||||
|
const dataApi = organType==1 ? hospitalList : institutionList; |
||||||
|
|
||||||
|
renderCallbackParams.schema.componentProps = { |
||||||
|
resultField: 'list', |
||||||
|
labelField: 'name', |
||||||
|
valueField: 'id', |
||||||
|
api: dataApi |
||||||
|
} |
||||||
|
}, |
||||||
|
}, |
||||||
|
{ |
||||||
|
field: 'directorName', |
||||||
|
label: '主任名称', |
||||||
|
component: 'Input', |
||||||
|
required: false |
||||||
|
}, |
||||||
|
{ |
||||||
|
field: 'directorTel', |
||||||
|
label: '主任电话', |
||||||
|
component: 'Input', |
||||||
|
required: false |
||||||
|
}, |
||||||
|
{ |
||||||
|
field: 'detailAddress', |
||||||
|
label: '科室地址', |
||||||
|
component: 'Input', |
||||||
|
required: false |
||||||
|
}, |
||||||
|
{ |
||||||
|
field: 'status', |
||||||
|
label: '状态', |
||||||
|
component: 'RadioButtonGroup', |
||||||
|
defaultValue: '0', |
||||||
|
componentProps: { |
||||||
|
options: [ |
||||||
|
{ label: '启用', value: '0' }, |
||||||
|
{ label: '禁用', value: '1' }, |
||||||
|
], |
||||||
|
}, |
||||||
|
}, |
||||||
|
{ |
||||||
|
label: '备注', |
||||||
|
field: 'remarks', |
||||||
|
component: 'InputTextArea', |
||||||
|
} |
||||||
|
]; |
@ -0,0 +1,89 @@ |
|||||||
|
<template> |
||||||
|
<BasicModal v-bind="$attrs" |
||||||
|
width="720px" |
||||||
|
@ok="handleSubmit" |
||||||
|
@register="registerModal" |
||||||
|
> |
||||||
|
<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 './project.data'; |
||||||
|
import { BasicModal, ModalProps, useModalInner } from '/@/components/Modal'; |
||||||
|
import {listProject, addProject, editProject, getProject} from '/@/api/platform/system/controller/project'; |
||||||
|
import { listToTree } from '/@/utils/helper/treeHelper'; |
||||||
|
|
||||||
|
/** 通用变量统一声明区域 */ |
||||||
|
const tag = ref<Nullable<string>>(''); |
||||||
|
/** https://v3.cn.vuejs.org/api/options-data.html#emits */ |
||||||
|
const emit = defineEmits(['success', 'register']); |
||||||
|
const [registerForm, { resetFields, setFieldsValue, updateSchema, 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 topProject = { projectId: '0', name: '顶级项目', children: [] }; |
||||||
|
topProject.children = listToTree(await listProject()); |
||||||
|
await updateSchema({ |
||||||
|
field: 'parentId', |
||||||
|
componentProps: { |
||||||
|
treeData: [topProject] |
||||||
|
} |
||||||
|
}); |
||||||
|
const projectId = data.record?.projectId; |
||||||
|
const props: Partial<ModalProps> = { confirmLoading: false }; |
||||||
|
// 采用tag标签区分操作 |
||||||
|
switch (unref(tag)) { |
||||||
|
case 'add': |
||||||
|
props.title = '新增项目'; |
||||||
|
projectId && await setFieldsValue({ parentId: projectId }); |
||||||
|
break; |
||||||
|
case 'edit': |
||||||
|
props.title = '编辑项目'; |
||||||
|
await setFieldsValue(await getProject(projectId)); |
||||||
|
break; |
||||||
|
} |
||||||
|
// 尾部:设置处理后的最终配置数据 |
||||||
|
setModalProps(props); |
||||||
|
}); |
||||||
|
|
||||||
|
/** 处理弹出框提交 */ |
||||||
|
async function handleSubmit() { |
||||||
|
try { |
||||||
|
// 提取验证数据 |
||||||
|
const formData = await validate(); |
||||||
|
// 处理提交之前逻辑 |
||||||
|
setModalProps({ confirmLoading: true }); |
||||||
|
// 采用tag标签区分操作 |
||||||
|
switch (unref(tag)) { |
||||||
|
case 'add': |
||||||
|
await addProject(formData); |
||||||
|
break; |
||||||
|
case 'edit': |
||||||
|
await editProject(formData); |
||||||
|
break; |
||||||
|
} |
||||||
|
// 处理提交完成之后逻辑 |
||||||
|
closeModal(); |
||||||
|
emit('success'); |
||||||
|
} finally { |
||||||
|
setModalProps({ confirmLoading: false }); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
</script> |
@ -0,0 +1,116 @@ |
|||||||
|
|
||||||
|
<template> |
||||||
|
<div> |
||||||
|
<BasicTable @register="registerTable"> |
||||||
|
<template #toolbar> |
||||||
|
<a-button |
||||||
|
type="primary" |
||||||
|
@click="handleAdd()" |
||||||
|
>新增项目</a-button> |
||||||
|
<a-button type="default" |
||||||
|
@click="expandAll" |
||||||
|
>展开全部</a-button> |
||||||
|
<a-button type="default" |
||||||
|
@click="collapseAll" |
||||||
|
>折叠全部</a-button> |
||||||
|
</template> |
||||||
|
<template #action="{ record }"> |
||||||
|
<TableAction :actions="[ |
||||||
|
{ |
||||||
|
label: '编辑', |
||||||
|
icon: 'fa6-regular:pen-to-square', |
||||||
|
|
||||||
|
onClick: handleEdit.bind(null, record) |
||||||
|
}, |
||||||
|
{ |
||||||
|
label: '新增', |
||||||
|
icon: 'ant-design:plus-circle-outlined', |
||||||
|
|
||||||
|
onClick: handleAdd.bind(null, record) |
||||||
|
}, |
||||||
|
{ |
||||||
|
label: '删除', |
||||||
|
icon: 'ant-design:delete-outlined', |
||||||
|
|
||||||
|
color: 'error', |
||||||
|
popConfirm: { |
||||||
|
title: '是否确认删除', |
||||||
|
confirm: handleDel.bind(null, record) |
||||||
|
} |
||||||
|
}]" |
||||||
|
/> |
||||||
|
</template> |
||||||
|
</BasicTable> |
||||||
|
<DeptModal @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 { BasicTable, useTable, TableAction } from '/@/components/Table'; |
||||||
|
import { useModal } from '/@/components/Modal'; |
||||||
|
import DeptModal from './ProjectModal.vue'; |
||||||
|
import { columns, searchFormSchema } from './project.data'; |
||||||
|
import {delProject, getProject, listProject} from '/@/api/platform/system/controller/project'; |
||||||
|
import { useMessage } from '/@/hooks/web/useMessage'; |
||||||
|
import { listToTree } from '/@/utils/helper/treeHelper'; |
||||||
|
|
||||||
|
/** 通用变量统一声明区域 */ |
||||||
|
const { createMessage } = useMessage(); |
||||||
|
const [registerModal, { openModal }] = useModal(); |
||||||
|
const [registerTable, { reload, expandAll, collapseAll }] = useTable({ |
||||||
|
title: '项目列表', |
||||||
|
api: listProject, |
||||||
|
rowKey: 'projectId', |
||||||
|
columns, |
||||||
|
formConfig: { |
||||||
|
labelWidth: 120, |
||||||
|
schemas: searchFormSchema, |
||||||
|
autoSubmitOnEnter: true, |
||||||
|
fieldMapToTime: [['dateRange', ['beginTime', 'endTime'], 'YYYY-MM-DD']] |
||||||
|
}, |
||||||
|
isTreeTable: true, |
||||||
|
pagination: false, |
||||||
|
striped: false, |
||||||
|
useSearchForm: true, |
||||||
|
showTableSetting: true, |
||||||
|
bordered: true, |
||||||
|
showIndexColumn: false, |
||||||
|
canResize: false, |
||||||
|
actionColumn: { |
||||||
|
width: 250, |
||||||
|
title: '操作', |
||||||
|
dataIndex: 'action', |
||||||
|
slots: { customRender: 'action' }, |
||||||
|
fixed: false |
||||||
|
}, |
||||||
|
afterFetch: (result) => listToTree(result, { id: 'projectId' }) |
||||||
|
}); |
||||||
|
|
||||||
|
/** 新增按钮操作,行内新增与工具栏局域新增通用 */ |
||||||
|
function handleAdd(record?: Recordable) { |
||||||
|
openModal(true,{ _tag: 'add', record }); |
||||||
|
} |
||||||
|
|
||||||
|
/** 编辑按钮操作,行内编辑 */ |
||||||
|
function handleEdit(record: Recordable) { |
||||||
|
openModal(true, { _tag: 'edit', record }); |
||||||
|
} |
||||||
|
|
||||||
|
/** 删除按钮操作,行内删除 */ |
||||||
|
async function handleDel(record: Recordable) { |
||||||
|
await delProject(record.projectId); |
||||||
|
createMessage.success('删除成功!'); |
||||||
|
handleRefreshTable(); |
||||||
|
} |
||||||
|
|
||||||
|
/** 处理表格刷新 */ |
||||||
|
function handleRefreshTable() { |
||||||
|
reload(); |
||||||
|
} |
||||||
|
|
||||||
|
</script> |
@ -0,0 +1,191 @@ |
|||||||
|
/** |
||||||
|
* @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', |
||||||
|
align: 'left' |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: '项目编码', |
||||||
|
dataIndex: 'code' |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: '排序', |
||||||
|
dataIndex: 'sort' |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: '状态', |
||||||
|
dataIndex: 'status', |
||||||
|
width: 80, |
||||||
|
customRender: ({record}) => { |
||||||
|
const status = record.status; |
||||||
|
// 采用二进制~~取反,只要为null或者0等等一些其他的空元素都会转为0
|
||||||
|
// 第一次取反会运算为-1,在后一次取反会运算为0
|
||||||
|
const enable = ~~status === 0; |
||||||
|
const color = enable ? 'green' : 'red'; |
||||||
|
const text = enable ? '正常' : '停用'; |
||||||
|
return h(Tag, { color: color }, () => text); |
||||||
|
} |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: '创建时间', |
||||||
|
dataIndex: 'createTime' |
||||||
|
} |
||||||
|
]; |
||||||
|
|
||||||
|
/** 搜索表单配置 */ |
||||||
|
export const searchFormSchema: FormSchema[] = [ |
||||||
|
{ |
||||||
|
field: 'name', |
||||||
|
label: '项目名称', |
||||||
|
component: 'Input', |
||||||
|
componentProps: { |
||||||
|
placeholder: '请输入项目名称' |
||||||
|
}, |
||||||
|
colProps: {span: 8} |
||||||
|
}, |
||||||
|
{ |
||||||
|
field: 'status', |
||||||
|
label: '状态', |
||||||
|
component: 'Select', |
||||||
|
componentProps: { |
||||||
|
options: [ |
||||||
|
{ label: '正常', value: '0' }, |
||||||
|
{ label: '停用', value: '1' } |
||||||
|
] |
||||||
|
}, |
||||||
|
colProps: { span: 7 } |
||||||
|
}, |
||||||
|
{ |
||||||
|
field: 'dateRange', |
||||||
|
label: '创建时间', |
||||||
|
component: 'RangePicker', |
||||||
|
componentProps: { |
||||||
|
style: { width:'100%' }, |
||||||
|
valueFormat: 'YYYY-MM-DD', |
||||||
|
placeholder: ['开始日期','结束日期'] |
||||||
|
}, |
||||||
|
colProps: { span: 8 } |
||||||
|
} |
||||||
|
]; |
||||||
|
|
||||||
|
/** 表单配置 */ |
||||||
|
export const formSchema: FormSchema[] = [ |
||||||
|
{ |
||||||
|
field: 'projectId', |
||||||
|
label: 'ID', |
||||||
|
component: 'Input', |
||||||
|
show: false |
||||||
|
}, |
||||||
|
{ |
||||||
|
field: 'parentId', |
||||||
|
label: '上级项目', |
||||||
|
component: 'TreeSelect', |
||||||
|
defaultValue: '0', |
||||||
|
componentProps: { |
||||||
|
replaceFields: { |
||||||
|
title: 'name', |
||||||
|
key: 'projectId', |
||||||
|
value: 'projectId', |
||||||
|
}, |
||||||
|
getPopupContainer: () => document.body, |
||||||
|
} |
||||||
|
}, |
||||||
|
{ |
||||||
|
field: 'name', |
||||||
|
label: '项目名称', |
||||||
|
component: 'Input', |
||||||
|
required: true, |
||||||
|
colProps: { |
||||||
|
span: 12 |
||||||
|
} |
||||||
|
}, |
||||||
|
{ |
||||||
|
field: 'code', |
||||||
|
label: '项目代码', |
||||||
|
component: 'Input', |
||||||
|
required: true, |
||||||
|
colProps: { |
||||||
|
span: 12 |
||||||
|
} |
||||||
|
}, |
||||||
|
{ |
||||||
|
field: 'contacts', |
||||||
|
label: '联系人', |
||||||
|
component: 'Input', |
||||||
|
colProps: { |
||||||
|
span: 12 |
||||||
|
} |
||||||
|
}, |
||||||
|
{ |
||||||
|
field: 'phone', |
||||||
|
label: '联系人电话', |
||||||
|
component: 'Input', |
||||||
|
rules: [ |
||||||
|
{ |
||||||
|
pattern: new RegExp('^1[3|4|5|6|7|8|9][0-9]\\d{8}$'), |
||||||
|
message: '请输入正确的手机号码!', |
||||||
|
validateTrigger: 'change' |
||||||
|
} |
||||||
|
], |
||||||
|
colProps: { |
||||||
|
span: 12 |
||||||
|
} |
||||||
|
}, |
||||||
|
{ |
||||||
|
field: 'sort', |
||||||
|
label: '项目排序', |
||||||
|
component: 'InputNumber', |
||||||
|
componentProps: { |
||||||
|
style: { width:'100%' }, |
||||||
|
min: 0 |
||||||
|
}, |
||||||
|
required: true, |
||||||
|
colProps: { |
||||||
|
span: 12 |
||||||
|
} |
||||||
|
}, |
||||||
|
{ |
||||||
|
field: 'email', |
||||||
|
label: '邮箱', |
||||||
|
component: 'Input', |
||||||
|
rules: [ |
||||||
|
{ |
||||||
|
type: 'email', |
||||||
|
message: '请输入正确的邮箱地址!', |
||||||
|
validateTrigger: 'change' |
||||||
|
} |
||||||
|
], |
||||||
|
colProps: { |
||||||
|
span: 12 |
||||||
|
} |
||||||
|
}, |
||||||
|
{ |
||||||
|
field: 'status', |
||||||
|
label: '状态', |
||||||
|
component: 'RadioGroup', |
||||||
|
defaultValue: '0', |
||||||
|
componentProps: { |
||||||
|
options: [ |
||||||
|
{ label: '正常', value: '0' }, |
||||||
|
{ label: '停用', value: '1' } |
||||||
|
] |
||||||
|
}, |
||||||
|
required: true, |
||||||
|
colProps: { |
||||||
|
span: 12 |
||||||
|
} |
||||||
|
} |
||||||
|
]; |
Loading…
Reference in new issue