diff --git a/src/api/platform/common/controller/boxcard.ts b/src/api/platform/common/controller/boxcard.ts deleted file mode 100644 index a3729da..0000000 --- a/src/api/platform/common/controller/boxcard.ts +++ /dev/null @@ -1,51 +0,0 @@ -import {BoxCardParams, BoxCardListItem, BoxCardListGetListResult} from '/@/api/platform/common/entity/boxCard'; -import { defHttp } from '/@/utils/http/axios'; -import {isDef} from '/@/utils/is'; - -const prefix = '/iot/equip'; - -enum Api { - GetCardById = '/boxcard/getById', - List = '/boxcard/list', - ListForSelect = '/boxcard/listForSelect', - Add = '/boxcard/add', - Update = '/boxcard/update', - Remove = '/boxcard/remove' -} - -/** - * 查询根据id - * @param params - */ -export const getCardById = (params: { id: String } ) => - defHttp.get({ url: prefix + Api.GetCardById, params }); - -/** - * 条件查询list - * @param params - */ -export const cardList = (params: BoxCardParams) => - defHttp.get({ url: prefix + Api.List, params }); - -/** - * 获取下拉列表的list - * @param params - */ -export const listForSelect = (params: {isUsed: number}) => - defHttp.get({url: prefix + Api.ListForSelect}); - -/** - * 新增或修改 - * @param params - */ -export const set = (params: BoxCardListItem) =>{ - if (isDef(params.id)) { - return defHttp.put({ url: prefix + Api.Update, params }); - } else { - return defHttp.post({ url: prefix + Api.Add, params }); - } -}; - - -export const remove = (params: {ids: String}) => - defHttp.delete({url: prefix + Api.Remove + `/${params.ids}`}); diff --git a/src/api/platform/common/controller/doctor.ts b/src/api/platform/common/controller/doctor.ts index 9e6a566..b112865 100644 --- a/src/api/platform/common/controller/doctor.ts +++ b/src/api/platform/common/controller/doctor.ts @@ -1,33 +1,25 @@ -import {DoctorParams,DoctorItem,DoctorItemListResult} from '/@/api/platform/common/entity/doctor'; +/** + * 提供api模板规范代码参考,请尽量保证编写代码风格跟模板规范代码一致 + * Copyright © 2020-2022 entfrm All rights reserved. + * author entfrm开发团队-王翔 + */ +import { DoctorParams, Doctor, DoctorResult } from '/@/api/platform/common/entity/doctor'; import { defHttp } from '/@/utils/http/axios'; -import {isDef} from '/@/utils/is'; - - - enum Api { - QueryById = '/system_proxy/system/doctor/query', - list = '/system_proxy/system/doctor/list', - add = '/system_proxy/system/doctor/add', - edit = '/system_proxy/system/doctor/update', - del = '/system_proxy/system/doctor/remove', - get = '/system_proxy/system/doctor' + list = '/common_proxy/common/doctor/list', + get = '/common_proxy/common/doctor', + save = '/common_proxy/common/doctor/save', + edit = '/common_proxy/common/doctor/update', + del = '/common_proxy/common/doctor/remove' } -export const queryById = (params: { id: String }) => - defHttp.get({url: Api.QueryById + `/${params.id}`}); - -/** 查询医生列表 */ -export const listDoctor = (params?: Partial) => defHttp.get({ url: Api.list, params }, { isReturnResultResponse: true }); +export const listDoctor = (params?: Partial) => defHttp.get({ url: Api.list, params }, { isReturnResultResponse: true }); -/** 新增医生*/ -export const addDoctor = (params: Partial) => defHttp.post({ url: Api.add, data: params }); +export const addDoctor = (params: Partial) => defHttp.post({ url: Api.save, data: params }); -/** 修改医生 */ -export const editDoctor = (params: Partial) => defHttp.put({ url: Api.edit, data: params }); +export const editDoctor = (params: Partial) => defHttp.put({ url: Api.edit, data: params }); -/** 查询医生详细 */ -export const getDoctor = (id: string) => defHttp.get({ url: `${Api.get}/${id}` }); +export const getDoctor = (id: string) => defHttp.get({ url: `${Api.get}/${id}` }); -/** 删除医生 */ -export const delDoctor = (id: string) => defHttp.delete({ url: `${Api.del}/${id}` }); +export const delDoctor = (ids: string) => defHttp.delete({ url: `${Api.del}/${ids}` }); diff --git a/src/api/platform/common/controller/hospital.ts b/src/api/platform/common/controller/hospital.ts index 16bd62a..8bf1a64 100644 --- a/src/api/platform/common/controller/hospital.ts +++ b/src/api/platform/common/controller/hospital.ts @@ -1,46 +1,25 @@ -import {HospitalParams,HospitalItem,HospitalItemListResult} from '/@/api/platform/common/entity/hospital'; +/** + * 提供api模板规范代码参考,请尽量保证编写代码风格跟模板规范代码一致 + * Copyright © 2020-2022 entfrm All rights reserved. + * author entfrm开发团队-王翔 + */ +import { HospitalParams, Hospital, HospitalResult } from '/@/api/platform/common/entity/hospital'; import { defHttp } from '/@/utils/http/axios'; -import {isDef} from '/@/utils/is'; - - enum Api { - QueryById = '/system_proxy/system/hospital/query', - list = '/system_proxy/system/hospital/list', - add = '/system_proxy/system/hospital/add', - edit = '/system_proxy/system/hospital/update', - del = '/system_proxy/system/hospital/remove', - get = '/system_proxy/system/hospital' + list = '/common_proxy/common/hospital/list', + get = '/common_proxy/common/hospital', + save = '/common_proxy/common/hospital/save', + edit = '/common_proxy/common/hospital/update', + del = '/common_proxy/common/hospital/remove' } -// export const queryById = (params: { id: String }) => -// defHttp.get({url: Api.QueryById, params}); -// -// export const list = (params: HospitalParams) => -// defHttp.get({url: Api.list, params}); -// -// export const set = (params: HospitalItem) => { -// if (isDef(params.id)){ -// defHttp.put({url: Api.edit, params}); -// }else { -// defHttp.post({url: Api.add, params}); -// } -// }; +export const listHospital = (params: Partial) => defHttp.get({url: Api.list, params}, { isReturnResultResponse: true }); + +export const addHospital = (params: Partial)=> defHttp.post({url: Api.save ,data: params}); + +export const editHospital = (params: Partial) => defHttp.put({url: Api.edit, data: params}); + +export const getHospital = (id: string) => defHttp.get({url: `${Api.get}/${id}` }); -// export const remove = (params: {ids: String}) => -// defHttp.delete({url: Api.Remove + `/${params.ids}`}); -// export const remove = (id: string) => defHttp.delete({ url: `${Api.del}/${id}` }); -export const queryById = (params: { id: String }) => - defHttp.get({url: Api.QueryById, params}); -/** 查询医院列表*/ -export const list = (params: HospitalParams) => - defHttp.get({url: Api.list, params}); -// export const list = (params?:Partial) =>defHttp.get({url: Api.list, params},{isReturnResultResponse: true}); -/** 新增医院*/ -export const addHospital = (params: Partial)=> defHttp.post({url: Api.add ,data: params}); -/** 修改医院*/ -export const editHospital = (params: Partial) => defHttp.put({url: Api.edit, data: params}); -/** 查询医院详细*/ -export const getHospital = (id: string) => defHttp.get({url: `${Api.get}/${id}` }); -/** 删除项目 */ -export const delHospital = (id: string) => defHttp.delete({ url: `${Api.del}/${id}` }); +export const delHospital = (ids: string) => defHttp.delete({ url: `${Api.del}/${ids}` }); diff --git a/src/api/platform/common/controller/institution.ts b/src/api/platform/common/controller/institution.ts deleted file mode 100644 index 3e0441c..0000000 --- a/src/api/platform/common/controller/institution.ts +++ /dev/null @@ -1,52 +0,0 @@ - -import {InstitutionParams,InstitutionItem,InstitutionItemListResult} from '/@/api/platform/common/entity/institution'; -import { defHttp } from '/@/utils/http/axios'; -import {isDef} from '/@/utils/is'; - - - - -enum Api { - QueryById = '/system_proxy/system/institution/query', - list = '/system_proxy/system/institution/list', - add = '/system_proxy/system/institution/add', - edit = '/system_proxy/system/institution/update', - del = '/system_proxy/system/institution/remove', - get = '/system_proxy/system/institution' -} - -// export const queryById = (params: { id: String }) => -// defHttp.get({url: prefix + Api.QueryById, params}); -// -// export const list = (params: InstitutionParams) => -// defHttp.get({url: prefix + Api.List, params}); -// -// export const set = (params: InstitutionItem) => { -// if (isDef(params.id)){ -// defHttp.put({url: prefix + Api.Update, params}); -// }else { -// defHttp.post({url: prefix + Api.Add, params}); -// } -// }; -// -// export const remove = (params: {ids: String}) => -// defHttp.delete({url: prefix + Api.Remove + `/${params.ids}`}); - -export const queryById = (params: { id: String }) => - defHttp.get({url: Api.QueryById + `/${params.id}`}); - -/** 查询机构列表 */ -// export const list = (params?: Partial) => defHttp.get({ url: Api.list, params }, { isReturnResultResponse: true }); -export const list = (params: InstitutionParams) => - defHttp.get({url: Api.list, params}); -/** 新增机构*/ -export const addInstitution = (params: Partial) => defHttp.post({ url: Api.add, data: params }); - -/** 修改机构 */ -export const editInstitution = (params: Partial) => defHttp.put({ url: Api.edit, data: params }); - -/** 查询机构详细 */ -export const getInstitution = (id: string) => defHttp.get({ url: `${Api.get}/${id}` }); - -/** 删除机构 */ -export const delInstitution= (id: string) => defHttp.delete({ url: `${Api.del}/${id}` }); diff --git a/src/api/platform/common/controller/office.ts b/src/api/platform/common/controller/office.ts index b69fa1f..98c53d2 100644 --- a/src/api/platform/common/controller/office.ts +++ b/src/api/platform/common/controller/office.ts @@ -1,50 +1,25 @@ -import {OfficeParams,OfficeItem,OfficeItemListResult} from '/@/api/platform/common/entity/office'; +/** + * 提供api模板规范代码参考,请尽量保证编写代码风格跟模板规范代码一致 + * Copyright © 2020-2022 entfrm All rights reserved. + * author entfrm开发团队-王翔 + */ +import { OfficeParams, Office, OfficeResult } from '/@/api/platform/common/entity/office'; import { defHttp } from '/@/utils/http/axios'; -import {isDef} from '/@/utils/is'; -import {HospitalItemListResult, HospitalParams} from "/@/api/platform/common/entity/hospital"; - - enum Api { - QueryById = '/system_proxy/system/office/getById', - list = '/system_proxy/system/office/list', - add = '/system_proxy/system/office/add', - edit = '/system_proxy/system/office/update', - del = '/system_proxy/system/office/remove', - get = '/system_proxy/system/office' + list = '/common_proxy/common/office/list', + save = '/common_proxy/common/office/save', + edit = '/common_proxy/common/office/update', + del = '/common_proxy/common/office/remove', + get = '/common_proxy/common/office' } -// -// export const queryById = (params: { id: String }) => -// defHttp.get({url:Api.QueryById, params}); -// -// export const list = (params: OfficeParams) => -// defHttp.get({url: Api.List, params}); -// -// export const set = (params: OfficeItem) => { -// if (isDef(params.id)){ -// defHttp.put({url:Api.Update, params}); -// }else { -// defHttp.post({url: Api.Add, params}); -// } -// }; -// -// export const remove = (params: {ids: String}) => -// defHttp.delete({url:Api.Remove + `/${params.ids}`}); -export const queryById = (params: { id: String }) => - defHttp.get({url: Api.QueryById + `/${params.id}`}); -/** 查询科室列表 */ -// export const listOffice = (params?: Partial) => defHttp.get({ url: Api.list, params }, { isReturnResultResponse: true }); -export const listOffice = (params: OfficeItem) => - defHttp.get({url: Api.list, params}); -/** 新增科室*/ -export const addOffice = (params: Partial) => defHttp.post({ url: Api.add, data: params }); +export const listOffice = (params?: Partial) => defHttp.get({url: Api.list, params}, { isReturnResultResponse: true }); + +export const addOffice = (params: Partial) => defHttp.post({ url: Api.save, data: params }); -/** 修改科室 */ -export const editOffice = (params: Partial) => defHttp.put({ url: Api.edit, data: params }); +export const editOffice = (params: Partial) => defHttp.put({ url: Api.edit, data: params }); -/** 查询科室详细 */ -export const getOffice = (id: string) => defHttp.get({ url: `${Api.get}/${id}` }); +export const getOffice = (id: string) => defHttp.get({ url: `${Api.get}/${id}` }); -/** 删除科室 */ -export const delOffice = (id: string) => defHttp.delete({ url: `${Api.del}/${id}` }); +export const delOffice = (ids: string) => defHttp.delete({ url: `${Api.del}/${ids}` }); diff --git a/src/api/platform/common/controller/org.ts b/src/api/platform/common/controller/org.ts new file mode 100644 index 0000000..dde00cf --- /dev/null +++ b/src/api/platform/common/controller/org.ts @@ -0,0 +1,20 @@ +import { OrgParams, Org, OrgResult } from '/@/api/platform/common/entity/org'; +import { defHttp } from '/@/utils/http/axios'; + +enum Api { + list = '/common_proxy/common/org/list', + get = '/common_proxy/common/org', + save = '/common_proxy/common/org/save', + edit = '/common_proxy/common/org/update', + del = '/common_proxy/common/org/remove' +} + +export const listOrg = (params: OrgParams) => defHttp.get({url: Api.list, params}, { isReturnResultResponse: true }); + +export const addOrg = (params: Partial) => defHttp.post({ url: Api.save, data: params }); + +export const editOrg = (params: Partial) => defHttp.put({ url: Api.edit, data: params }); + +export const getOrg = (id: string) => defHttp.get({ url: `${Api.get}/${id}` }); + +export const delOrg = (ids: string) => defHttp.delete({ url: `${Api.del}/${ids}` }); diff --git a/src/api/platform/system/controller/project.ts b/src/api/platform/common/controller/project.ts similarity index 58% rename from src/api/platform/system/controller/project.ts rename to src/api/platform/common/controller/project.ts index 42c9476..090897d 100644 --- a/src/api/platform/system/controller/project.ts +++ b/src/api/platform/common/controller/project.ts @@ -3,28 +3,23 @@ * Copyright © 2020-2022 entfrm All rights reserved. * author entfrm开发团队-王翔 */ -import type { ProjectParams, Project } from '../entity/project'; +import type { ProjectParams, Project, ProjectResult } 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', + list = '/common_proxy/common/project/list', + get = '/common_proxy/common/project', + add = '/common_proxy/common/project/save', + edit = '/common_proxy/common/project/update', + del = '/common_proxy/common/project/remove' } -/** 查询项目列表 */ export const listProject = (params?: Partial) => defHttp.get({ url: Api.list, params }); -/** 新增项目 */ export const addProject = (params: Partial) => defHttp.post({ url: Api.add, data: params }); -/** 修改项目 */ export const editProject = (params: Partial) => defHttp.put({ url: Api.edit, data: params }); -/** 查询项目详细 */ export const getProject = (id: string) => defHttp.get({ url: `${Api.get}/${id}` }); -/** 删除项目 */ -export const delProject = (id: string) => defHttp.delete({ url: `${Api.del}/${id}` }); +export const delProject = (ids: string) => defHttp.delete({ url: `${Api.del}/${ids}` }); diff --git a/src/api/platform/common/controller/report.ts b/src/api/platform/common/controller/report.ts deleted file mode 100644 index b7b37b0..0000000 --- a/src/api/platform/common/controller/report.ts +++ /dev/null @@ -1,33 +0,0 @@ -import {DoctorParams,DoctorItem,DoctorItemListResult} from '/@/api/platform/common/entity/doctor'; -import { defHttp } from '/@/utils/http/axios'; -import {isDef} from '/@/utils/is'; - - - - -enum Api { - QueryById = '/system_proxy/system/doctor/query', - list = '/system_proxy/system/doctor/list', - add = '/system_proxy/system/doctor/add', - edit = '/system_proxy/system/doctor/update', - del = '/system_proxy/system/doctor/remove', - get = '/system_proxy/system/doctor' -} - -export const queryById = (params: { id: String }) => - defHttp.get({url: Api.QueryById + `/${params.id}`}); - -/** 查询医生列表 */ -export const listReport = (params?: Partial) => defHttp.get({ url: Api.list, params }, { isReturnResultResponse: true }); - -/** 新增医生*/ -export const addReport = (params: Partial) => defHttp.post({ url: Api.add, data: params }); - -/** 修改医生 */ -export const editReport = (params: Partial) => defHttp.put({ url: Api.edit, data: params }); - -/** 查询医生详细 */ -export const getReport = (id: string) => defHttp.get({ url: `${Api.get}/${id}` }); - -/** 删除医生 */ -export const delReport = (id: string) => defHttp.delete({ url: `${Api.del}/${id}` }); diff --git a/src/api/platform/common/entity/doctor.ts b/src/api/platform/common/entity/doctor.ts index ecf7b95..39d6c9b 100644 --- a/src/api/platform/common/entity/doctor.ts +++ b/src/api/platform/common/entity/doctor.ts @@ -1,49 +1,26 @@ -// 引入基础包 import type { R } from '/#/axios'; import type { Page } from '/@/api/common/data/entity'; +import { CommonEntity } from '/@/api/common/data/entity'; -export type DoctorParams = { - name?: string; - beginTime?: string; - endTime?: string; -} & Page; +/** 医生查询参数 */ +export type DoctorParams = Page & Doctor; - -export interface DoctorItem { - - /**医生ID*/ +/** 医生对象 */ +export interface Doctor extends CommonEntity { id: string; - /**医生姓名*/ name: string; - /**医生职称*/ title: string; - /**医生性别*/ sex: string; - /**医生电话*/ phone: string; - /**医生邮箱*/ email: string; - /**地址(门牌号)*/ detailAddress: string; - /**组织类型*/ - organType: string; - /**组织id*/ - organId: string; - /**组织名称*/ - organName: string; - /**科室ID*/ + orgType: string; + orgId: string; + orgName: string; officeId: string; - /**科室名称*/ officeName: string; - /**医生状态*/ status: string; - - createById: string; - - createByName: string; - - createTime: string; - } -export type DoctorItemListResult = R; \ No newline at end of file +/** 医生响应对象 */ +export type DoctorResult = R; diff --git a/src/api/platform/common/entity/hospital.ts b/src/api/platform/common/entity/hospital.ts index 1357965..031bedc 100644 --- a/src/api/platform/common/entity/hospital.ts +++ b/src/api/platform/common/entity/hospital.ts @@ -1,44 +1,28 @@ -// 引入基础包 import type { R } from '/#/axios'; -import type { CommonEntity,Page } from '/@/api/common/data/entity'; +import type { Page } from '/@/api/common/data/entity'; +import { CommonEntity } from '/@/api/common/data/entity'; -export type HospitalParams = { - name?: string; - beginTime?: string; - endTime?: string; -} & Page; - - -export interface HospitalItem extends CommonEntity{ +/** 医院查询参数 */ +export type HospitalParams = Hospital & Page; +/** 医院对象 */ +export interface Hospital extends CommonEntity { id: string; - name: string; - - type: number; - - contactsName: string; - - contactsTel: string; - - contactsTitle: string; - + type: string; + contactName: string; + contactPhone: string; + contactTitle: string; payment: string; - addressIds: string; - detailAddress: string; - status: string; - - createById: string; - - createByName: string; - - createTime: string; - - remarks: string; - + mapOrientation: number; + mapLng: number; + mapLat: number; + mapNotify: string; + orgIds: string[]; } -export type HospitalItemListResult = R; \ No newline at end of file +/** 医院响应对象 */ +export type HospitalResult = R; diff --git a/src/api/platform/common/entity/institution.ts b/src/api/platform/common/entity/institution.ts deleted file mode 100644 index 97f5d95..0000000 --- a/src/api/platform/common/entity/institution.ts +++ /dev/null @@ -1,39 +0,0 @@ -// 引入基础包 -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: string; - - contactsName: string; - - contactsTel: string; - - contactsTitle: string; - - addressId: string; - - detailAddress: string; - - status: string; - - createById: string; - - createByName: string; - - createTime: string; -} - -export type InstitutionItemListResult = R; \ No newline at end of file diff --git a/src/api/platform/common/entity/office.ts b/src/api/platform/common/entity/office.ts index d41c85e..14fe6dd 100644 --- a/src/api/platform/common/entity/office.ts +++ b/src/api/platform/common/entity/office.ts @@ -1,41 +1,18 @@ -// 引入基础包 import type { R } from '/#/axios'; -import type { CommonEntity,Page } from '/@/api/common/data/entity'; +import { CommonEntity, Page } from '/@/api/common/data/entity'; -export type OfficeParams = { - name?: string; - beginTime?: string; - endTime?: string; -} & Page; - - -export interface OfficeItem extends CommonEntity{ +export type OfficeParams = Office & Page; +export interface Office extends CommonEntity { id: string; - name: string; - - organType: string; - - organId: string; - - organName: string; - - directorName: string; - - directorTel: string; - + orgType: string; + orgId: string; + orgName: string; + manageName: string; + managePhone: string; detailAddress: string; - status: string; - - createById: string; - - createByName: string; - - createTime: string; - - remarks: string; } -export type OfficeItemListResult = R; \ No newline at end of file +export type OfficeResult = R; diff --git a/src/api/platform/common/entity/org.ts b/src/api/platform/common/entity/org.ts new file mode 100644 index 0000000..a181c67 --- /dev/null +++ b/src/api/platform/common/entity/org.ts @@ -0,0 +1,22 @@ +import type { R } from '/#/axios'; +import type { CommonEntity, Page } from '/@/api/common/data/entity'; + +export type OrgParams = Org & Page; + +export interface Org extends CommonEntity{ + id: string; + name: string; + type: string; + contactName: string; + contactPhone: string; + contactTitle: string; + addressNames: string; + addressIds: string; + detailAddress: string; + status: string; + mapLng: number; + mapLat: number; + mapNotify: string; +} + +export type OrgResult = R; diff --git a/src/api/platform/common/entity/project.ts b/src/api/platform/common/entity/project.ts new file mode 100644 index 0000000..760cbd0 --- /dev/null +++ b/src/api/platform/common/entity/project.ts @@ -0,0 +1,15 @@ +import type { R } from '/#/axios'; +import type { TreeEntity, Page } from '/@/api/common/data/entity'; + +export type ProjectParams = Page & Project; + +export interface Project extends TreeEntity { + code: string; + contact: string; + phone: string; + address: string; + email: string; + status: string; +} + +export type ProjectResult = R; diff --git a/src/api/platform/common/entity/report.ts b/src/api/platform/common/entity/report.ts deleted file mode 100644 index ecf7b95..0000000 --- a/src/api/platform/common/entity/report.ts +++ /dev/null @@ -1,49 +0,0 @@ -// 引入基础包 -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: string; - /**组织id*/ - organId: string; - /**组织名称*/ - organName: string; - /**科室ID*/ - officeId: string; - /**科室名称*/ - officeName: string; - /**医生状态*/ - status: string; - - createById: string; - - createByName: string; - - createTime: string; - -} - -export type DoctorItemListResult = R; \ No newline at end of file diff --git a/src/api/platform/system/entity/project.ts b/src/api/platform/system/entity/project.ts deleted file mode 100644 index 1a1d4a1..0000000 --- a/src/api/platform/system/entity/project.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * @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; \ No newline at end of file diff --git a/src/components/Form/index.ts b/src/components/Form/index.ts index f9cce5e..3144dae 100644 --- a/src/components/Form/index.ts +++ b/src/components/Form/index.ts @@ -9,5 +9,8 @@ export { useForm } from './src/hooks/useForm'; export { default as ApiSelect } from './src/components/ApiSelect.vue'; export { default as RadioButtonGroup } from './src/components/RadioButtonGroup.vue'; export { default as ApiTreeSelect } from './src/components/ApiTreeSelect.vue'; +export { default as ApiTree } from './src/components/ApiTree.vue'; +export { default as ApiRadioGroup } from './src/components/ApiRadioGroup.vue'; +export { default as ApiCascader } from './src/components/ApiCascader.vue'; export { BasicForm }; diff --git a/src/components/Form/src/BasicForm.vue b/src/components/Form/src/BasicForm.vue index 9e53916..d396c77 100644 --- a/src/components/Form/src/BasicForm.vue +++ b/src/components/Form/src/BasicForm.vue @@ -24,12 +24,12 @@ - + @@ -53,15 +53,16 @@ import { createFormContext } from './hooks/useFormContext'; import { useAutoFocus } from './hooks/useAutoFocus'; import { useModalContext } from '/@/components/Modal'; + import { useDebounceFn } from '@vueuse/core'; import { basicProps } from './props'; import { useDesign } from '/@/hooks/web/useDesign'; - import type { RowProps } from 'ant-design-vue/lib/grid/Row'; + import { cloneDeep } from 'lodash-es'; export default defineComponent({ name: 'BasicForm', components: { FormItem, Form, Row, FormAction }, props: basicProps, - emits: ['advanced-change', 'reset', 'submit', 'register'], + emits: ['advanced-change', 'reset', 'submit', 'register', 'field-value-change'], setup(props, { emit, attrs }) { const formModel = reactive({}); const modalFn = useModalContext(); @@ -96,7 +97,7 @@ }); // Get uniform row style and Row configuration for the entire form - const getRow = computed(() => { + const getRow = computed((): Recordable => { const { baseRowStyle = {}, rowProps } = unref(getProps); return { style: baseRowStyle, @@ -105,7 +106,7 @@ }); const getBindValue = computed( - () => ({ ...attrs, ...props, ...unref(getProps) } as Recordable) + () => ({ ...attrs, ...props, ...unref(getProps) } as Recordable), ); const getSchema = computed((): FormSchema[] => { @@ -117,7 +118,7 @@ if (!Array.isArray(defaultValue)) { schema.defaultValue = dateUtil(defaultValue); } else { - const def: moment.Moment[] = []; + const def: any[] = []; defaultValue.forEach((item) => { def.push(dateUtil(item)); }); @@ -125,7 +126,13 @@ } } } - return schemas as FormSchema[]; + if (unref(getProps).showAdvancedButton) { + return cloneDeep( + schemas.filter((schema) => schema.component !== 'Divider') as FormSchema[], + ); + } else { + return cloneDeep(schemas as FormSchema[]); + } }); const { handleToggleAdvanced } = useAdvanced({ @@ -181,39 +188,47 @@ }); watch( - () => unref(getProps).model, - () => { - const { model } = unref(getProps); - if (!model) return; - setFieldsValue(model); - }, - { - immediate: true, - } + () => unref(getProps).model, + () => { + const { model } = unref(getProps); + if (!model) return; + setFieldsValue(model); + }, + { + immediate: true, + }, ); watch( - () => unref(getProps).schemas, - (schemas) => { - resetSchema(schemas ?? []); - } + () => unref(getProps).schemas, + (schemas) => { + resetSchema(schemas ?? []); + }, ); watch( - () => getSchema.value, - (schema) => { - nextTick(() => { - // Solve the problem of modal adaptive height calculation when the form is placed in the modal - modalFn?.redoModalHeight?.(); - }); - if (unref(isInitedDefaultRef)) { - return; - } - if (schema?.length) { - initDefault(); - isInitedDefaultRef.value = true; - } - } + () => getSchema.value, + (schema) => { + nextTick(() => { + // Solve the problem of modal adaptive height calculation when the form is placed in the modal + modalFn?.redoModalHeight?.(); + }); + if (unref(isInitedDefaultRef)) { + return; + } + if (schema?.length) { + initDefault(); + isInitedDefaultRef.value = true; + } + }, + ); + + watch( + () => formModel, + useDebounceFn(() => { + unref(getProps).submitOnChange && handleSubmit(); + }, 300), + { deep: true }, ); async function setProps(formProps: Partial): Promise { @@ -226,6 +241,7 @@ if (!validateTrigger || validateTrigger === 'change') { validateFields([key]).catch((_) => {}); } + emit('field-value-change', key, value); } function handleEnterPress(e: KeyboardEvent) { @@ -271,59 +287,61 @@ getProps, formElRef, getSchema, - formActionType, + formActionType: formActionType as any, setFormModel, - prefixCls, getFormClass, + getFormActionBindProps: computed( + (): Recordable => ({ ...getProps.value, ...advanceState }), + ), ...formActionType, }; }, }); diff --git a/src/components/Form/src/componentMap.ts b/src/components/Form/src/componentMap.ts index 5b51241..52739a6 100644 --- a/src/components/Form/src/componentMap.ts +++ b/src/components/Form/src/componentMap.ts @@ -18,11 +18,15 @@ import { TreeSelect, Slider, Rate, + Divider, } from 'ant-design-vue'; +import ApiRadioGroup from './components/ApiRadioGroup.vue'; import RadioButtonGroup from './components/RadioButtonGroup.vue'; import ApiSelect from './components/ApiSelect.vue'; +import ApiTree from './components/ApiTree.vue'; import ApiTreeSelect from './components/ApiTreeSelect.vue'; +import ApiCascader from './components/ApiCascader.vue'; import { BasicUpload } from '/@/components/Upload'; import { StrengthMeter } from '/@/components/StrengthMeter'; import { IconPicker } from '/@/components/Icon'; @@ -40,13 +44,16 @@ componentMap.set('AutoComplete', AutoComplete); componentMap.set('Select', Select); componentMap.set('ApiSelect', ApiSelect); +componentMap.set('ApiTree', ApiTree); componentMap.set('TreeSelect', TreeSelect); componentMap.set('ApiTreeSelect', ApiTreeSelect); +componentMap.set('ApiRadioGroup', ApiRadioGroup); componentMap.set('Switch', Switch); componentMap.set('RadioButtonGroup', RadioButtonGroup); componentMap.set('RadioGroup', Radio.Group); componentMap.set('Checkbox', Checkbox); componentMap.set('CheckboxGroup', Checkbox.Group); +componentMap.set('ApiCascader', ApiCascader); componentMap.set('Cascader', Cascader); componentMap.set('Slider', Slider); componentMap.set('Rate', Rate); @@ -61,6 +68,7 @@ componentMap.set('IconPicker', IconPicker); componentMap.set('InputCountDown', CountdownInput); componentMap.set('Upload', BasicUpload); +componentMap.set('Divider', Divider); export function add(compName: ComponentType, component: Component) { componentMap.set(compName, component); diff --git a/src/components/Form/src/components/ApiCascader.vue b/src/components/Form/src/components/ApiCascader.vue new file mode 100644 index 0000000..d7565e2 --- /dev/null +++ b/src/components/Form/src/components/ApiCascader.vue @@ -0,0 +1,198 @@ + + diff --git a/src/components/Form/src/components/ApiRadioGroup.vue b/src/components/Form/src/components/ApiRadioGroup.vue new file mode 100644 index 0000000..7b24386 --- /dev/null +++ b/src/components/Form/src/components/ApiRadioGroup.vue @@ -0,0 +1,134 @@ + + + diff --git a/src/components/Form/src/components/ApiSelect.vue b/src/components/Form/src/components/ApiSelect.vue index 29e9cf3..2d5a51f 100644 --- a/src/components/Form/src/components/ApiSelect.vue +++ b/src/components/Form/src/components/ApiSelect.vue @@ -1,9 +1,9 @@