16 changed files with 798 additions and 452 deletions
@ -1,30 +1,50 @@ |
|||||||
import {OfficeParams,OfficeItem,OfficeItemListResult} from '/@/api/platform/system/entity/officeModel'; |
import {OfficeParams,OfficeItem,OfficeItemListResult} from '/@/api/platform/system/entity/officeModel'; |
||||||
import { defHttp } from '/@/utils/http/axios'; |
import { defHttp } from '/@/utils/http/axios'; |
||||||
import {isDef} from '/@/utils/is'; |
import {isDef} from '/@/utils/is'; |
||||||
|
import {HospitalItemListResult, HospitalParams} from "/@/api/platform/system/entity/hospitalModel"; |
||||||
|
|
||||||
|
|
||||||
const prefix = '/system_proxy/system'; |
|
||||||
|
|
||||||
enum Api { |
enum Api { |
||||||
QueryById = '/office/getById', |
QueryById = '/system_proxy/system/office/getById', |
||||||
List = '/office/list', |
list = '/system_proxy/system/office/list', |
||||||
Add = '/office/add', |
add = '/system_proxy/system/office/add', |
||||||
Update = '/office/update', |
edit = '/system_proxy/system/office/update', |
||||||
Remove = '/office/remove' |
del = '/system_proxy/system/office/remove', |
||||||
|
get = '/system_proxy/system/office' |
||||||
} |
} |
||||||
|
//
|
||||||
|
// export const queryById = (params: { id: String }) =>
|
||||||
|
// defHttp.get<OfficeItem>({url:Api.QueryById, params});
|
||||||
|
//
|
||||||
|
// export const list = (params: OfficeParams) =>
|
||||||
|
// defHttp.get<OfficeItemListResult>({url: Api.List, params});
|
||||||
|
//
|
||||||
|
// export const set = (params: OfficeItem) => {
|
||||||
|
// if (isDef(params.id)){
|
||||||
|
// defHttp.put<OfficeItem>({url:Api.Update, params});
|
||||||
|
// }else {
|
||||||
|
// defHttp.post<OfficeItem>({url: Api.Add, params});
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// export const remove = (params: {ids: String}) =>
|
||||||
|
// defHttp.delete<boolean>({url:Api.Remove + `/${params.ids}`});
|
||||||
export const queryById = (params: { id: String }) => |
export const queryById = (params: { id: String }) => |
||||||
defHttp.get<OfficeItem>({url: prefix + Api.QueryById, params}); |
defHttp.get<OfficeItem>({url: Api.QueryById + `/${params.id}`}); |
||||||
|
|
||||||
export const list = (params: OfficeParams) => |
/** 查询科室列表 */ |
||||||
defHttp.get<OfficeItemListResult>({url: prefix + Api.List, params}); |
// export const listOffice = (params?: Partial<OfficeItem>) => defHttp.get<OfficeItemListResult>({ url: Api.list, params }, { isReturnResultResponse: true });
|
||||||
|
export const listOffice = (params: OfficeItem) => |
||||||
|
defHttp.get<OfficeItemListResult>({url: Api.list, params}); |
||||||
|
/** 新增科室*/ |
||||||
|
export const addOffice = (params: Partial<OfficeParams>) => defHttp.post({ url: Api.add, data: params }); |
||||||
|
|
||||||
export const set = (params: OfficeItem) => { |
/** 修改科室 */ |
||||||
if (isDef(params.id)){ |
export const editOffice = (params: Partial<OfficeParams>) => defHttp.put({ url: Api.edit, data: params }); |
||||||
defHttp.put<OfficeItem>({url: prefix + Api.Update, params}); |
|
||||||
}else { |
/** 查询科室详细 */ |
||||||
defHttp.post<OfficeItem>({url: prefix + Api.Add, params}); |
export const getOffice = (id: string) => defHttp.get<OfficeItem>({ url: `${Api.get}/${id}` }); |
||||||
} |
|
||||||
}; |
|
||||||
|
|
||||||
export const remove = (params: {ids: String}) => |
/** 删除科室 */ |
||||||
defHttp.delete<boolean>({url: prefix + Api.Remove + `/${params.ids}`}); |
export const delOffice = (id: string) => defHttp.delete({ url: `${Api.del}/${id}` }); |
@ -1,94 +1,136 @@ |
|||||||
<template> |
<template> |
||||||
<div> |
<div> |
||||||
<BasicTable @register="registerTable"> |
<BasicTable @register="registerTable" |
||||||
|
@selection-change="handleSelectionChange" |
||||||
|
> |
||||||
<template #toolbar> |
<template #toolbar> |
||||||
<a-button type="primary" @click="handleCreate">新增医院</a-button> |
<a-button |
||||||
|
type="primary" |
||||||
|
@click="handleAdd()" |
||||||
|
>新增医院</a-button> |
||||||
|
<a-button type="primary" |
||||||
|
:disabled="state.single" |
||||||
|
@click="handleEdit()" |
||||||
|
>修改医院</a-button> |
||||||
|
<a-button type="primary" |
||||||
|
:disabled="state.multiple" |
||||||
|
@click="handleDel()" |
||||||
|
>删除医院</a-button> |
||||||
</template> |
</template> |
||||||
<template #action="{ record }"> |
<template #action="{ record }"> |
||||||
<TableAction |
<TableAction :actions="[ |
||||||
:actions="[ |
|
||||||
{ |
{ |
||||||
icon: 'clarity:note-edit-line', |
label: '编辑', |
||||||
onClick: handleEdit.bind(null, record), |
icon: 'fa6-regular:pen-to-square', |
||||||
|
onClick: handleEdit.bind(null, record) |
||||||
}, |
}, |
||||||
{ |
{ |
||||||
|
label: '删除', |
||||||
icon: 'ant-design:delete-outlined', |
icon: 'ant-design:delete-outlined', |
||||||
color: 'error', |
color: 'error', |
||||||
popConfirm: { |
onClick: handleDel.bind(null, record) |
||||||
title: '是否确认删除', |
}]" |
||||||
confirm: handleDelete.bind(null, record), |
|
||||||
}, |
|
||||||
}, |
|
||||||
]" |
|
||||||
/> |
/> |
||||||
</template> |
</template> |
||||||
</BasicTable> |
</BasicTable> |
||||||
|
<!--弹出窗体区域--> |
||||||
<HospitalModal @register="registerModal" @success="handleSuccess"/> |
<HospitalModal @register="registerModal" @success="handleRefreshTable"/> |
||||||
</div> |
</div> |
||||||
</template> |
</template> |
||||||
|
|
||||||
<script lang="ts" setup> |
<script lang="ts" setup> |
||||||
|
/** |
||||||
|
* 提供模板规范代码参考,请尽量保证编写代码风格跟模板规范代码一致 |
||||||
|
* 采用vben-动态表格表单封装组件编写,采用 setup 写法 |
||||||
|
* Copyright © 2020-2022 <a href="http://www.entfrm.com/">entfrm</a> All rights reserved. |
||||||
|
* author entfrm开发团队-王翔 |
||||||
|
*/ |
||||||
|
import { reactive, toRaw } from 'vue'; |
||||||
import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
||||||
|
import {list, delHospital} from '/@/api/platform/system/controller/hospital'; |
||||||
import { useModal } from '/@/components/Modal'; |
import { useModal } from '/@/components/Modal'; |
||||||
import HospitalModal from './HospitalModal.vue'; |
|
||||||
import { columns, searchFormSchema } from './hospital.data'; |
import { columns, searchFormSchema } from './hospital.data'; |
||||||
import { useMessage } from '/@/hooks/web/useMessage'; |
import { useMessage } from '/@/hooks/web/useMessage'; |
||||||
import {list, remove} from '/@/api/platform/system/controller/hospital'; |
import HospitalModal from './HospitalModal.vue'; |
||||||
const {createMessage} = useMessage(); |
|
||||||
|
/** 类型规范统一声明定义区域 */ |
||||||
|
interface TableState { |
||||||
|
single: boolean; |
||||||
|
multiple: boolean; |
||||||
|
} |
||||||
|
|
||||||
|
/** 通用变量统一声明区域 */ |
||||||
|
const state = reactive<TableState>({ |
||||||
|
// 非单个禁用 |
||||||
|
single: true, |
||||||
|
// 非多个禁用 |
||||||
|
multiple: true |
||||||
|
}); |
||||||
|
const { createConfirm, createMessage } = useMessage(); |
||||||
const [registerModal, { openModal }] = useModal(); |
const [registerModal, { openModal }] = useModal(); |
||||||
const [registerTable, {reload}] = useTable({ |
const [registerTable, { reload, clearSelectedRowKeys, getSelectRowKeys }] = useTable({ |
||||||
title: '医院列表', |
title: '医院', |
||||||
api: list, |
api: list, |
||||||
|
rowKey: 'id', |
||||||
columns, |
columns, |
||||||
formConfig: { |
formConfig: { |
||||||
labelWidth: 120, |
labelWidth: 120, |
||||||
schemas: searchFormSchema, |
schemas: searchFormSchema, |
||||||
|
autoSubmitOnEnter: true, |
||||||
|
fieldMapToTime: [['dateRange', ['beginTime', 'endTime'], 'YYYY-MM-DD']] |
||||||
}, |
}, |
||||||
pagination: true, |
rowSelection: { type: 'checkbox' }, |
||||||
striped: true, |
|
||||||
useSearchForm: true, |
useSearchForm: true, |
||||||
showTableSetting: true, |
showTableSetting: true, |
||||||
bordered: true, |
bordered: true, |
||||||
showIndexColumn: true, |
clickToRowSelect: false, |
||||||
canResize: false, |
showIndexColumn: false, |
||||||
actionColumn: { |
actionColumn: { |
||||||
width: 80, |
width: 220, |
||||||
title: '操作', |
title: '操作', |
||||||
dataIndex: 'action', |
dataIndex: 'action', |
||||||
slots: { customRender: 'action' }, |
slots: { customRender: 'action' }, |
||||||
fixed: undefined, |
fixed: false |
||||||
}, |
}, |
||||||
|
handleSearchInfoFn: () => clearSelectedRowKeys() |
||||||
}); |
}); |
||||||
/** |
|
||||||
* 创建菜单 |
/** 处理多选框选中数据 */ |
||||||
*/ |
function handleSelectionChange(selection?: Recordable) { |
||||||
function handleCreate() { |
const rowSelection = toRaw(selection?.keys) || []; |
||||||
openModal(true, { |
state.single = rowSelection.length != 1; |
||||||
isUpdate: false, |
state.multiple = !rowSelection.length; |
||||||
}); |
|
||||||
} |
} |
||||||
/** |
|
||||||
* 编辑菜单 |
/** 新增按钮操作,行内新增与工具栏局域新增通用 */ |
||||||
*/ |
function handleAdd() { |
||||||
function handleEdit(record: Recordable) { |
openModal(true,{ _tag: 'add' }); |
||||||
openModal(true, { |
|
||||||
record, |
|
||||||
isUpdate: true, |
|
||||||
}); |
|
||||||
} |
} |
||||||
/** |
|
||||||
* 删除菜单 |
/** 编辑按钮操作,行内编辑 */ |
||||||
*/ |
function handleEdit(record?: Recordable) { |
||||||
async function handleDelete(record: Recordable) { |
record = record || { id: getSelectRowKeys() }; |
||||||
await remove({ids: record.id}); |
openModal(true, { _tag: 'edit', record }); |
||||||
|
} |
||||||
|
|
||||||
|
/** 删除按钮操作,行内删除 */ |
||||||
|
async function handleDel(record?: Recordable) { |
||||||
|
const id = record?.id || getSelectRowKeys(); |
||||||
|
createConfirm({ |
||||||
|
iconType: 'warning', |
||||||
|
title: '警告', |
||||||
|
content: `是否确认删除医院编号为${id}医院吗?`, |
||||||
|
onOk: async () => { |
||||||
|
await delHospital(id); |
||||||
createMessage.success('删除成功!'); |
createMessage.success('删除成功!'); |
||||||
handleSuccess(); |
handleRefreshTable(); |
||||||
} |
} |
||||||
/** |
}); |
||||||
* 成功后重载表格 |
} |
||||||
*/ |
|
||||||
function handleSuccess() { |
/** 处理表格刷新 */ |
||||||
|
function handleRefreshTable() { |
||||||
|
clearSelectedRowKeys(); |
||||||
reload(); |
reload(); |
||||||
} |
} |
||||||
</script> |
</script> |
@ -1,94 +1,136 @@ |
|||||||
<template> |
<template> |
||||||
<div> |
<div> |
||||||
<BasicTable @register="registerTable"> |
<BasicTable @register="registerTable" |
||||||
|
@selection-change="handleSelectionChange" |
||||||
|
> |
||||||
<template #toolbar> |
<template #toolbar> |
||||||
<a-button type="primary" @click="handleCreate">新增医检机构</a-button> |
<a-button |
||||||
|
type="primary" |
||||||
|
@click="handleAdd()" |
||||||
|
>新增机构</a-button> |
||||||
|
<a-button type="primary" |
||||||
|
:disabled="state.single" |
||||||
|
@click="handleEdit()" |
||||||
|
>修改机构</a-button> |
||||||
|
<a-button type="primary" |
||||||
|
:disabled="state.multiple" |
||||||
|
@click="handleDel()" |
||||||
|
>删除机构</a-button> |
||||||
</template> |
</template> |
||||||
<template #action="{ record }"> |
<template #action="{ record }"> |
||||||
<TableAction |
<TableAction :actions="[ |
||||||
:actions="[ |
|
||||||
{ |
{ |
||||||
icon: 'clarity:note-edit-line', |
label: '编辑', |
||||||
onClick: handleEdit.bind(null, record), |
icon: 'fa6-regular:pen-to-square', |
||||||
|
onClick: handleEdit.bind(null, record) |
||||||
}, |
}, |
||||||
{ |
{ |
||||||
|
label: '删除', |
||||||
icon: 'ant-design:delete-outlined', |
icon: 'ant-design:delete-outlined', |
||||||
color: 'error', |
color: 'error', |
||||||
popConfirm: { |
onClick: handleDel.bind(null, record) |
||||||
title: '是否确认删除', |
}]" |
||||||
confirm: handleDelete.bind(null, record), |
|
||||||
}, |
|
||||||
}, |
|
||||||
]" |
|
||||||
/> |
/> |
||||||
</template> |
</template> |
||||||
</BasicTable> |
</BasicTable> |
||||||
|
<!--弹出窗体区域--> |
||||||
<BoxCardModal @register="registerModal" @success="handleSuccess"/> |
<InstitutionModal @register="registerModal" @success="handleRefreshTable"/> |
||||||
</div> |
</div> |
||||||
</template> |
</template> |
||||||
|
|
||||||
<script lang="ts" setup> |
<script lang="ts" setup> |
||||||
|
/** |
||||||
|
* 提供模板规范代码参考,请尽量保证编写代码风格跟模板规范代码一致 |
||||||
|
* 采用vben-动态表格表单封装组件编写,采用 setup 写法 |
||||||
|
* Copyright © 2020-2022 <a href="http://www.entfrm.com/">entfrm</a> All rights reserved. |
||||||
|
* author entfrm开发团队-王翔 |
||||||
|
*/ |
||||||
|
import { reactive, toRaw } from 'vue'; |
||||||
import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
||||||
|
import {list, delInstitution} from '/@/api/platform/system/controller/institution'; |
||||||
import { useModal } from '/@/components/Modal'; |
import { useModal } from '/@/components/Modal'; |
||||||
import BoxCardModal from './InstitutionModal.vue'; |
|
||||||
import { columns, searchFormSchema } from './institution.data'; |
import { columns, searchFormSchema } from './institution.data'; |
||||||
import { useMessage } from '/@/hooks/web/useMessage'; |
import { useMessage } from '/@/hooks/web/useMessage'; |
||||||
import {list, remove} from '/@/api/platform/system/controller/institution'; |
import InstitutionModal from './InstitutionModal.vue'; |
||||||
const {createMessage} = useMessage(); |
|
||||||
|
/** 类型规范统一声明定义区域 */ |
||||||
|
interface TableState { |
||||||
|
single: boolean; |
||||||
|
multiple: boolean; |
||||||
|
} |
||||||
|
|
||||||
|
/** 通用变量统一声明区域 */ |
||||||
|
const state = reactive<TableState>({ |
||||||
|
// 非单个禁用 |
||||||
|
single: true, |
||||||
|
// 非多个禁用 |
||||||
|
multiple: true |
||||||
|
}); |
||||||
|
const { createConfirm, createMessage } = useMessage(); |
||||||
const [registerModal, { openModal }] = useModal(); |
const [registerModal, { openModal }] = useModal(); |
||||||
const [registerTable, {reload}] = useTable({ |
const [registerTable, { reload, clearSelectedRowKeys, getSelectRowKeys }] = useTable({ |
||||||
title: '医检列表', |
title: '医生列表', |
||||||
api: list, |
api: list, |
||||||
|
rowKey: 'id', |
||||||
columns, |
columns, |
||||||
formConfig: { |
formConfig: { |
||||||
labelWidth: 120, |
labelWidth: 120, |
||||||
schemas: searchFormSchema, |
schemas: searchFormSchema, |
||||||
|
autoSubmitOnEnter: true, |
||||||
|
fieldMapToTime: [['dateRange', ['beginTime', 'endTime'], 'YYYY-MM-DD']] |
||||||
}, |
}, |
||||||
pagination: true, |
rowSelection: { type: 'checkbox' }, |
||||||
striped: true, |
|
||||||
useSearchForm: true, |
useSearchForm: true, |
||||||
showTableSetting: true, |
showTableSetting: true, |
||||||
bordered: true, |
bordered: true, |
||||||
showIndexColumn: true, |
clickToRowSelect: false, |
||||||
canResize: false, |
showIndexColumn: false, |
||||||
actionColumn: { |
actionColumn: { |
||||||
width: 80, |
width: 220, |
||||||
title: '操作', |
title: '操作', |
||||||
dataIndex: 'action', |
dataIndex: 'action', |
||||||
slots: { customRender: 'action' }, |
slots: { customRender: 'action' }, |
||||||
fixed: undefined, |
fixed: false |
||||||
}, |
}, |
||||||
|
handleSearchInfoFn: () => clearSelectedRowKeys() |
||||||
}); |
}); |
||||||
/** |
|
||||||
* 创建菜单 |
/** 处理多选框选中数据 */ |
||||||
*/ |
function handleSelectionChange(selection?: Recordable) { |
||||||
function handleCreate() { |
const rowSelection = toRaw(selection?.keys) || []; |
||||||
openModal(true, { |
state.single = rowSelection.length != 1; |
||||||
isUpdate: false, |
state.multiple = !rowSelection.length; |
||||||
}); |
|
||||||
} |
} |
||||||
/** |
|
||||||
* 编辑菜单 |
/** 新增按钮操作,行内新增与工具栏局域新增通用 */ |
||||||
*/ |
function handleAdd() { |
||||||
function handleEdit(record: Recordable) { |
openModal(true,{ _tag: 'add' }); |
||||||
openModal(true, { |
|
||||||
record, |
|
||||||
isUpdate: true, |
|
||||||
}); |
|
||||||
} |
} |
||||||
/** |
|
||||||
* 删除菜单 |
/** 编辑按钮操作,行内编辑 */ |
||||||
*/ |
function handleEdit(record?: Recordable) { |
||||||
async function handleDelete(record: Recordable) { |
record = record || { id: getSelectRowKeys() }; |
||||||
await remove({ids: record.id}); |
openModal(true, { _tag: 'edit', record }); |
||||||
|
} |
||||||
|
|
||||||
|
/** 删除按钮操作,行内删除 */ |
||||||
|
async function handleDel(record?: Recordable) { |
||||||
|
const id = record?.id || getSelectRowKeys(); |
||||||
|
createConfirm({ |
||||||
|
iconType: 'warning', |
||||||
|
title: '警告', |
||||||
|
content: `是否确认删除机构编号为${id}机构吗?`, |
||||||
|
onOk: async () => { |
||||||
|
await delInstitution(id); |
||||||
createMessage.success('删除成功!'); |
createMessage.success('删除成功!'); |
||||||
handleSuccess(); |
handleRefreshTable(); |
||||||
} |
} |
||||||
/** |
}); |
||||||
* 成功后重载表格 |
} |
||||||
*/ |
|
||||||
function handleSuccess() { |
/** 处理表格刷新 */ |
||||||
|
function handleRefreshTable() { |
||||||
|
clearSelectedRowKeys(); |
||||||
reload(); |
reload(); |
||||||
} |
} |
||||||
</script> |
</script> |
@ -1,95 +1,136 @@ |
|||||||
<template> |
<template> |
||||||
<div> |
<div> |
||||||
<BasicTable @register="registerTable"> |
<BasicTable @register="registerTable" |
||||||
|
@selection-change="handleSelectionChange" |
||||||
|
> |
||||||
<template #toolbar> |
<template #toolbar> |
||||||
<a-button type="primary" @click="handleCreate">新增科室</a-button> |
<a-button |
||||||
|
type="primary" |
||||||
|
@click="handleAdd()" |
||||||
|
>新增科室</a-button> |
||||||
|
<a-button type="primary" |
||||||
|
:disabled="state.single" |
||||||
|
@click="handleEdit()" |
||||||
|
>修改科室</a-button> |
||||||
|
<a-button type="primary" |
||||||
|
:disabled="state.multiple" |
||||||
|
@click="handleDel()" |
||||||
|
>删除科室</a-button> |
||||||
</template> |
</template> |
||||||
<template #action="{ record }"> |
<template #action="{ record }"> |
||||||
<TableAction |
<TableAction :actions="[ |
||||||
:actions="[ |
|
||||||
{ |
{ |
||||||
icon: 'clarity:note-edit-line', |
label: '编辑', |
||||||
onClick: handleEdit.bind(null, record), |
icon: 'fa6-regular:pen-to-square', |
||||||
|
onClick: handleEdit.bind(null, record) |
||||||
}, |
}, |
||||||
{ |
{ |
||||||
|
label: '删除', |
||||||
icon: 'ant-design:delete-outlined', |
icon: 'ant-design:delete-outlined', |
||||||
color: 'error', |
color: 'error', |
||||||
popConfirm: { |
onClick: handleDel.bind(null, record) |
||||||
title: '是否确认删除', |
}]" |
||||||
confirm: handleDelete.bind(null, record), |
|
||||||
}, |
|
||||||
}, |
|
||||||
]" |
|
||||||
/> |
/> |
||||||
</template> |
</template> |
||||||
</BasicTable> |
</BasicTable> |
||||||
|
<!--弹出窗体区域--> |
||||||
<OfficeModal @register="registerModal" @success="handleSuccess"/> |
<OfficeModal @register="registerModal" @success="handleRefreshTable"/> |
||||||
</div> |
</div> |
||||||
</template> |
</template> |
||||||
|
|
||||||
<script lang="ts" setup> |
<script lang="ts" setup> |
||||||
|
/** |
||||||
|
* 提供模板规范代码参考,请尽量保证编写代码风格跟模板规范代码一致 |
||||||
|
* 采用vben-动态表格表单封装组件编写,采用 setup 写法 |
||||||
|
* Copyright © 2020-2022 <a href="http://www.entfrm.com/">entfrm</a> All rights reserved. |
||||||
|
* author entfrm开发团队-王翔 |
||||||
|
*/ |
||||||
|
import { reactive, toRaw } from 'vue'; |
||||||
import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
||||||
|
import {listOffice, delOffice} from '/@/api/platform/system/controller/office'; |
||||||
import { useModal } from '/@/components/Modal'; |
import { useModal } from '/@/components/Modal'; |
||||||
import OfficeModal from './OfficeModal.vue'; |
|
||||||
import { columns, searchFormSchema } from './office.data'; |
import { columns, searchFormSchema } from './office.data'; |
||||||
import { useMessage } from '/@/hooks/web/useMessage'; |
import { useMessage } from '/@/hooks/web/useMessage'; |
||||||
import {list, remove} from '/@/api/platform/system/controller/office'; |
import OfficeModal from './OfficeModal.vue'; |
||||||
const {createMessage} = useMessage(); |
|
||||||
|
/** 类型规范统一声明定义区域 */ |
||||||
|
interface TableState { |
||||||
|
single: boolean; |
||||||
|
multiple: boolean; |
||||||
|
} |
||||||
|
|
||||||
|
/** 通用变量统一声明区域 */ |
||||||
|
const state = reactive<TableState>({ |
||||||
|
// 非单个禁用 |
||||||
|
single: true, |
||||||
|
// 非多个禁用 |
||||||
|
multiple: true |
||||||
|
}); |
||||||
|
const { createConfirm, createMessage } = useMessage(); |
||||||
const [registerModal, { openModal }] = useModal(); |
const [registerModal, { openModal }] = useModal(); |
||||||
const [registerTable, {reload}] = useTable({ |
const [registerTable, { reload, clearSelectedRowKeys, getSelectRowKeys }] = useTable({ |
||||||
title: '科室列表', |
title: '医生列表', |
||||||
api: list, |
api: listOffice, |
||||||
|
rowKey: 'id', |
||||||
columns, |
columns, |
||||||
formConfig: { |
formConfig: { |
||||||
labelWidth: 120, |
labelWidth: 120, |
||||||
schemas: searchFormSchema, |
schemas: searchFormSchema, |
||||||
|
autoSubmitOnEnter: true, |
||||||
|
fieldMapToTime: [['dateRange', ['beginTime', 'endTime'], 'YYYY-MM-DD']] |
||||||
}, |
}, |
||||||
pagination: true, |
rowSelection: { type: 'checkbox' }, |
||||||
striped: true, |
|
||||||
useSearchForm: true, |
useSearchForm: true, |
||||||
showTableSetting: true, |
showTableSetting: true, |
||||||
bordered: true, |
bordered: true, |
||||||
showIndexColumn: true, |
clickToRowSelect: false, |
||||||
canResize: false, |
showIndexColumn: false, |
||||||
actionColumn: { |
actionColumn: { |
||||||
width: 80, |
width: 220, |
||||||
title: '操作', |
title: '操作', |
||||||
dataIndex: 'action', |
dataIndex: 'action', |
||||||
slots: { customRender: 'action' }, |
slots: { customRender: 'action' }, |
||||||
fixed: undefined, |
fixed: false |
||||||
}, |
}, |
||||||
|
handleSearchInfoFn: () => clearSelectedRowKeys() |
||||||
}); |
}); |
||||||
/** |
|
||||||
* 创建菜单 |
/** 处理多选框选中数据 */ |
||||||
*/ |
function handleSelectionChange(selection?: Recordable) { |
||||||
function handleCreate() { |
const rowSelection = toRaw(selection?.keys) || []; |
||||||
debugger; |
state.single = rowSelection.length != 1; |
||||||
openModal(true, { |
state.multiple = !rowSelection.length; |
||||||
isUpdate: false, |
|
||||||
}); |
|
||||||
} |
} |
||||||
/** |
|
||||||
* 编辑菜单 |
/** 新增按钮操作,行内新增与工具栏局域新增通用 */ |
||||||
*/ |
function handleAdd() { |
||||||
function handleEdit(record: Recordable) { |
openModal(true,{ _tag: 'add' }); |
||||||
openModal(true, { |
|
||||||
record, |
|
||||||
isUpdate: true, |
|
||||||
}); |
|
||||||
} |
} |
||||||
/** |
|
||||||
* 删除菜单 |
/** 编辑按钮操作,行内编辑 */ |
||||||
*/ |
function handleEdit(record?: Recordable) { |
||||||
async function handleDelete(record: Recordable) { |
record = record || { id: getSelectRowKeys() }; |
||||||
await remove({ids: record.id}); |
openModal(true, { _tag: 'edit', record }); |
||||||
|
} |
||||||
|
|
||||||
|
/** 删除按钮操作,行内删除 */ |
||||||
|
async function handleDel(record?: Recordable) { |
||||||
|
const id = record?.id || getSelectRowKeys(); |
||||||
|
createConfirm({ |
||||||
|
iconType: 'warning', |
||||||
|
title: '警告', |
||||||
|
content: `是否确认删除科室编号为${id}科室吗?`, |
||||||
|
onOk: async () => { |
||||||
|
await delOffice(id); |
||||||
createMessage.success('删除成功!'); |
createMessage.success('删除成功!'); |
||||||
handleSuccess(); |
handleRefreshTable(); |
||||||
} |
} |
||||||
/** |
}); |
||||||
* 成功后重载表格 |
} |
||||||
*/ |
|
||||||
function handleSuccess() { |
/** 处理表格刷新 */ |
||||||
|
function handleRefreshTable() { |
||||||
|
clearSelectedRowKeys(); |
||||||
reload(); |
reload(); |
||||||
} |
} |
||||||
</script> |
</script> |
Loading…
Reference in new issue