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