提交 97e83853 authored 作者: 袁伟伟's avatar 袁伟伟
...@@ -166,3 +166,14 @@ export type DoctorPageResult = PageResult<Doctor>; ...@@ -166,3 +166,14 @@ export type DoctorPageResult = PageResult<Doctor>;
export type DoctorPageResponse = ApiResponse<DoctorPageResult>; export type DoctorPageResponse = ApiResponse<DoctorPageResult>;
export type DoctorResponse = ApiResponse<Doctor>; export type DoctorResponse = ApiResponse<Doctor>;
export interface BatchVerifyParams {
/**
* id数组
*/
idList: Array<number | string>;
/**
* 状态
*/
status: string;
}
...@@ -12,6 +12,7 @@ import { ...@@ -12,6 +12,7 @@ import {
DoctorPageResult, DoctorPageResult,
DoctorPageResponse, DoctorPageResponse,
DoctorResponse, DoctorResponse,
BatchVerifyParams,
} from '../model/doctor'; } from '../model/doctor';
const baseApi = '/v1/system/doctor'; const baseApi = '/v1/system/doctor';
...@@ -19,44 +20,37 @@ const baseApi = '/v1/system/doctor'; ...@@ -19,44 +20,37 @@ const baseApi = '/v1/system/doctor';
/** /**
* 新增 * 新增
*/ */
export const add = (entity: Doctor) => export const add = (entity: Doctor) => defHttp.post<Doctor>({ url: `${baseApi}/`, data: entity });
defHttp.post<Doctor>({ url: `${baseApi}/`, data: entity });
/** /**
* 更新 * 更新
*/ */
export const update = (entity: Doctor) => export const update = (entity: Doctor) => defHttp.put<Doctor>({ url: `${baseApi}/`, data: entity });
defHttp.put<Doctor>({ url: `${baseApi}/`, data: entity });
/** /**
* 删除 * 删除
*/ */
export const remove = (id: any) => export const remove = (id: any) => defHttp.delete<Number>({ url: `${baseApi}/${id}` });
defHttp.delete<Number>({ url: `${baseApi}/${id}` });
/** /**
* 分页查询 * 分页查询
*/ */
export const search = (params?: DoctorParams) => export const search = (params?: DoctorParams) => defHttp.get<DoctorPageResult>({ url: `${baseApi}/search`, params });
defHttp.get<DoctorPageResult>({ url: `${baseApi}/search`, params });
/** /**
* 列表查询 * 列表查询
*/ */
export const all = (params?: DoctorParams) => export const all = (params?: DoctorParams) => defHttp.get<DoctorPageResult>({ url: `${baseApi}/all`, params });
defHttp.get<DoctorPageResult>({ url: `${baseApi}/all`, params });
/** /**
* 通过主键查询 * 通过主键查询
*/ */
export const getById = (id: any) => export const getById = (id: any) => defHttp.get<Doctor>({ url: `${baseApi}/${id}` });
defHttp.get<Doctor>({ url: `${baseApi}/${id}` });
/** /**
* 单个查询 * 单个查询
*/ */
export const getOne = (params?: DoctorParams) => export const getOne = (params?: DoctorParams) => defHttp.get<Doctor>({ url: `${baseApi}/one`, params });
defHttp.get<Doctor>({ url: `${baseApi}/one`, params });
/** /**
* 批量删除 * 批量删除
...@@ -79,7 +73,10 @@ export const batchUpdate = (entityList: Array<Doctor>) => ...@@ -79,7 +73,10 @@ export const batchUpdate = (entityList: Array<Doctor>) =>
/** /**
* 查询数量 * 查询数量
*/ */
export const count = (params?: DoctorParams) => export const count = (params?: DoctorParams) => defHttp.get<Number>({ url: `${baseApi}/count`, params });
defHttp.get<Number>({ url: `${baseApi}/count`, params });
/**
* @description 批量审核,
*/
export const batchVerify = (params: BatchVerifyParams) =>
defHttp.post<boolean>({ url: `${baseApi}/batch/verify`, data: params });
<template> <template>
<Card :bordered="false"> <Card :bordered="false" :loading="!data.isOver">
<template #extra>
<a-space>
<a-button type="primary" v-if="isShowHandleEdit(data.detail.status)" @click="reload">编辑</a-button>
<a-button type="primary" v-if="isShowHandlePassed(data.detail.status)">通过</a-button>
<a-button type="danger" v-if="isShowHandleReject(data.detail.status)">拒绝</a-button>
<a-button type="danger" v-if="isShowHandleForbidden(data.detail.status)">禁用</a-button>
<a-button type="danger" v-if="isShowHandleDelete()">删除</a-button>
</a-space>
</template>
<Descriptions bordered :column="3"> <Descriptions bordered :column="3">
<Descriptions.Item <Descriptions.Item
v-for="p in displayProps" v-for="p in displayProps"
...@@ -18,7 +27,15 @@ ...@@ -18,7 +27,15 @@
</Card> </Card>
</template> </template>
<script lang="ts" setup name="DeviceDetail"> <script lang="ts" setup name="DeviceDetail">
import { onMounted, computed, ref, reactive } from 'vue'; import {
isShowHandleEdit,
isShowHandlePassed,
isShowHandleForbidden,
isShowHandleReject,
isShowHandleDelete,
getVerifyParams,
} from './schema';
import { onMounted, computed, ref, reactive, toRef } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { ComputedRef } from '@vue/reactivity'; import { ComputedRef } from '@vue/reactivity';
import { Descriptions, Card } from 'ant-design-vue'; import { Descriptions, Card } from 'ant-design-vue';
...@@ -38,15 +55,25 @@ ...@@ -38,15 +55,25 @@
data.detail = res; data.detail = res;
}); });
}; };
const reload = () => {
data.isOver = false;
data.detail = {};
DoctorApi.getById(id.value).then((res: Device) => {
data.isOver = true;
data.detail = res;
});
};
onMounted(() => { onMounted(() => {
getDetail(); getDetail();
}); });
const handleVerify = (record: Recordable, status: string) => {
DoctorApi.batchVerify(getVerifyParams(record, status)).then((_) => {});
};
const displayProps: ComputedRef<Array<any>> = computed(() => { const displayProps: ComputedRef<Array<any>> = computed(() => {
if (!data.isOver) return {}; if (!data.isOver) return {};
console.log('descriptionColumns', descriptionColumns);
console.log('data.detail11', data.detail);
const display: any = descriptionColumns.map(({ title, dataIndex = '', customRender }) => ({ const display: any = descriptionColumns.map(({ title, dataIndex = '', customRender }) => ({
key: dataIndex, key: dataIndex,
title, title,
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<script lang="ts" setup name="DoctorDrawer"> <script lang="ts" setup name="DoctorDrawer">
import { defineEmits, ref, computed, unref } from 'vue'; import { defineEmits, ref, computed, unref } from 'vue';
import { BasicForm, useForm } from '/@/components/Form/index'; import { BasicForm, useForm } from '/@/components/Form/index';
import { formSchema } from './schema'; import { formSchema, StatusValEnum } from './schema';
import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; import { BasicDrawer, useDrawerInner } from '/@/components/Drawer';
import * as DoctorApi from '/@/api/system/doctorApi'; import * as DoctorApi from '/@/api/system/doctorApi';
...@@ -40,10 +40,7 @@ ...@@ -40,10 +40,7 @@
try { try {
const values = await validate(); const values = await validate();
setDrawerProps({ confirmLoading: true }); setDrawerProps({ confirmLoading: true });
const { const { hospitalId, ...rest } = values;
hospitalId,
...rest
} = values;
const action = !unref(isUpdate) ? DoctorApi.add : DoctorApi.update; const action = !unref(isUpdate) ? DoctorApi.add : DoctorApi.update;
const data = !unref(isUpdate) const data = !unref(isUpdate)
? { ? {
...@@ -51,14 +48,16 @@ ...@@ -51,14 +48,16 @@
hospitalId: hospitalId.value, hospitalId: hospitalId.value,
hospitalName: hospitalId.label, hospitalName: hospitalId.label,
} }
: Object.assign({}, : Object.assign(
{ {},
...rest, {
id: unref(entityId), ...rest,
hospitalId: hospitalId.value, id: unref(entityId),
hospitalName: hospitalId.label, hospitalId: hospitalId.value,
}, hospitalName: hospitalId.label,
); status: StatusValEnum.PENDING_REVIEW,
},
);
await action(data); await action(data);
closeDrawer(); closeDrawer();
emit('success'); emit('success');
......
...@@ -16,6 +16,15 @@ ...@@ -16,6 +16,15 @@
> >
<a href="#" class="text-red-500">删除</a> <a href="#" class="text-red-500">删除</a>
</a-popconfirm> </a-popconfirm>
<a-popconfirm
class="ml-4"
title="确定要全部通过审核吗?"
ok-text="是"
cancel-text="否"
@confirm="handleBatchPassed"
>
<a href="#" class="text-green-500">审核通过</a>
</a-popconfirm>
</template> </template>
<template v-else> <template v-else>
<span>未选中任何项目</span> <span>未选中任何项目</span>
...@@ -28,17 +37,48 @@ ...@@ -28,17 +37,48 @@
<a-button v-auth="'AUTH_SYSTEM_DOCTOR:IMPORT'" type="primary" @click="handleImport"> 批量导入医生</a-button> <a-button v-auth="'AUTH_SYSTEM_DOCTOR:IMPORT'" type="primary" @click="handleImport"> 批量导入医生</a-button>
</template> </template>
<template #bodyCell="{ column, record, text }"> <template #bodyCell="{ column, record, text }">
<template v-if="[].includes(column.dataIndex)"> <template v-if="column.dataIndex === 'status'">
<img :src="text" class="photo" alt="图片" v-if="!!text" /> <a-tag :color="StatusColorEnum[text]">{{ StatusEnum[text] }}</a-tag>
</template> </template>
<template v-if="column.dataIndex === 'action'"> <template v-if="column.dataIndex === 'action'">
<TableAction <TableAction
:actions="[ :actions="[
//待审核 才能 通过
{
label: '通过',
color: 'success',
popConfirm: {
title: '是否确认通过',
confirm: handleVerify.bind(null, record, StatusValEnum.PASSED),
},
ifShow: isShowHandlePassed(record.status),
},
//待审核 才能 拒绝
{
label: '拒绝',
color: 'error',
popConfirm: {
title: '是否确认拒绝',
confirm: handleVerify.bind(null, record, StatusValEnum.REJECT),
},
ifShow: isShowHandleReject(record.status),
},
//已通过才能禁用
{
label: '禁用',
color: 'error',
popConfirm: {
title: '是否确认禁用',
confirm: handleVerify.bind(null, record, StatusValEnum.FORBIDDEN),
},
ifShow: isShowHandleForbidden(record.status),
},
//禁用后不能再编辑
{ {
tooltip: '编辑', tooltip: '编辑',
icon: 'clarity:note-edit-line', icon: 'clarity:note-edit-line',
onClick: handleEdit.bind(null, record), onClick: handleEdit.bind(null, record),
ifShow: hasPermission('AUTH_SYSTEM_DOCTOR:EDIT'), ifShow: isShowHandleEdit(record.status),
}, },
{ {
tooltip: '详情', tooltip: '详情',
...@@ -53,7 +93,7 @@ ...@@ -53,7 +93,7 @@
title: '是否确认删除', title: '是否确认删除',
confirm: handleDelete.bind(null, record), confirm: handleDelete.bind(null, record),
}, },
ifShow: hasPermission('AUTH_SYSTEM_DOCTOR:DELETE'), ifShow: isShowHandleDelete(),
}, },
]" ]"
/> />
...@@ -64,9 +104,17 @@ ...@@ -64,9 +104,17 @@
</div> </div>
</template> </template>
<script lang="ts" setup name="DeviceIndex"> <script lang="ts" setup name="DeviceIndex">
import {
isShowHandleEdit,
isShowHandlePassed,
isShowHandleForbidden,
isShowHandleReject,
isShowHandleDelete,
getVerifyParams,
StatusValEnum,
} from './schema';
import { ref } from 'vue'; import { ref } from 'vue';
import { useGo } from '/@/hooks/web/usePage'; import { useGo } from '/@/hooks/web/usePage';
import { usePermission } from '/@/hooks/web/usePermission';
import { BasicTable, useTable, TableAction } from '/@/components/Table'; import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { isObject } from '/@/utils/is'; import { isObject } from '/@/utils/is';
import moment from 'moment'; import moment from 'moment';
...@@ -75,8 +123,8 @@ ...@@ -75,8 +123,8 @@
import componentSetting from '/@/settings/componentSetting'; import componentSetting from '/@/settings/componentSetting';
import DoctorDrawer from './drawer.vue'; import DoctorDrawer from './drawer.vue';
import { columns, searchFormSchema } from './schema'; import { columns, searchFormSchema } from './schema';
import { StatusColorEnum, StatusEnum } from './schema';
const { hasPermission } = usePermission(); import { BatchVerifyParams } from '/@/api/model/doctor';
const go = useGo(); const go = useGo();
const { formConfig, showTableSetting, bordered, showIndexColumn } = componentSetting.table; const { formConfig, showTableSetting, bordered, showIndexColumn } = componentSetting.table;
...@@ -107,7 +155,7 @@ ...@@ -107,7 +155,7 @@
canResize: false, canResize: false,
rowKey: (record: any) => record.id, rowKey: (record: any) => record.id,
actionColumn: { actionColumn: {
width: 120, width: 210,
title: '操作', title: '操作',
dataIndex: 'action', dataIndex: 'action',
...@@ -148,6 +196,22 @@ ...@@ -148,6 +196,22 @@
}); });
}; };
const handleVerify = (record: Recordable, status: string) => {
DoctorApi.batchVerify(getVerifyParams(record, status)).then((_) => {
reload();
});
};
const handleBatchPassed = () => {
const params: BatchVerifyParams = {
idList: checkedKeys.value,
status: StatusValEnum.PASSED,
};
DoctorApi.batchVerify(params).then((_) => {
reload();
});
};
const handleEdit = (record: Recordable) => { const handleEdit = (record: Recordable) => {
openDrawer(true, { openDrawer(true, {
record, record,
......
...@@ -9,7 +9,9 @@ ...@@ -9,7 +9,9 @@
import { BasicColumn } from '/@/components/Table'; import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table'; import { FormSchema } from '/@/components/Table';
import { getDistributorId, getHospitalId } from '/@/commonSchemaProperty'; import { getDistributorId, getHospitalId } from '/@/commonSchemaProperty';
import { usePermission } from '/@/hooks/web/usePermission';
import { BatchVerifyParams } from '/@/api/model/doctor';
const { hasPermission } = usePermission();
export enum SexEnum { export enum SexEnum {
MALE = '男', MALE = '男',
FEMALE = '女', FEMALE = '女',
...@@ -24,9 +26,50 @@ for (const key in SexEnum) { ...@@ -24,9 +26,50 @@ for (const key in SexEnum) {
export enum StatusEnum { export enum StatusEnum {
PENDING_REVIEW = '待审核', PENDING_REVIEW = '待审核',
PASSED = '已通过', PASSED = '已通过',
REJECT = '拒绝', REJECT = '拒绝',
FORBIDDEN = '禁用', FORBIDDEN = '禁用',
} }
export enum StatusColorEnum {
PENDING_REVIEW = 'processing',
PASSED = 'success',
REJECT = 'error',
FORBIDDEN = 'default',
}
export enum StatusValEnum {
PENDING_REVIEW = 'PENDING_REVIEW',
PASSED = 'PASSED',
REJECT = 'REJECT',
FORBIDDEN = 'FORBIDDEN',
}
export const isShowHandlePassed = (status: string): boolean => {
return hasPermission('AUTH_SYSTEM_DOCTOR:PASSED') && status === 'PENDING_REVIEW';
};
export const isShowHandleReject = (status: string): boolean => {
return hasPermission('AUTH_SYSTEM_DOCTOR:REJECT') && status === 'PENDING_REVIEW';
};
export const isShowHandleForbidden = (status: string): boolean => {
return hasPermission('AUTH_SYSTEM_DOCTOR:FORBIDDEN') && status === 'PASSED';
};
export const isShowHandleEdit = (status: string): boolean => {
return hasPermission('AUTH_SYSTEM_DOCTOR:EDIT') && status !== 'FORBIDDEN';
};
export const isShowHandleDelete = (): boolean => {
return hasPermission('AUTH_SYSTEM_DOCTOR:DELETE');
};
/**
* @description: 返回审核所需参数
* @param record
* @param status
*/
export const getVerifyParams = (record: Recordable, status: string): BatchVerifyParams => {
const params: BatchVerifyParams = {
idList: [record.id],
status,
};
return params;
};
export const StatusEnumOptions: any[] = []; export const StatusEnumOptions: any[] = [];
for (const key in StatusEnum) { for (const key in StatusEnum) {
StatusEnumOptions.push({ StatusEnumOptions.push({
...@@ -167,6 +210,7 @@ export const schema = { ...@@ -167,6 +210,7 @@ export const schema = {
rules: [{ required: true, message: '请输入状态!' }], rules: [{ required: true, message: '请输入状态!' }],
}, },
table: { table: {
fixed: 'right',
customRender: ({ text }) => { customRender: ({ text }) => {
const option = StatusEnumOptions.find((item) => item.value === text); const option = StatusEnumOptions.find((item) => item.value === text);
return option ? option.label : text; return option ? option.label : text;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论