2
This commit is contained in:
+39
-16
@@ -7,7 +7,7 @@ import request from '@/utils/request';
|
|||||||
*/
|
*/
|
||||||
export function getDoctorPharmacyList(doctor_id) {
|
export function getDoctorPharmacyList(doctor_id) {
|
||||||
return request({
|
return request({
|
||||||
url: `/admin/doctor/${doctor_id}/pharmacy`,
|
url: `/admin/doctor/pharmacy/${doctor_id}`,
|
||||||
method: 'get',
|
method: 'get',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -20,7 +20,7 @@ export function getDoctorPharmacyList(doctor_id) {
|
|||||||
*/
|
*/
|
||||||
export function setDoctorPharmacies(doctor_id, data) {
|
export function setDoctorPharmacies(doctor_id, data) {
|
||||||
return request({
|
return request({
|
||||||
url: `/admin/doctor/${doctor_id}/pharmacy`,
|
url: `/admin/doctor/pharmacy/${doctor_id}`,
|
||||||
method: 'put',
|
method: 'put',
|
||||||
data,
|
data,
|
||||||
});
|
});
|
||||||
@@ -28,40 +28,63 @@ export function setDoctorPharmacies(doctor_id, data) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 3. 为医生新增单个药房绑定
|
* 3. 为医生新增单个药房绑定
|
||||||
* @param {String} doctor_id - 医生 ID
|
* @param {Object} data - { doctor_id: string, pharmacy_id: string, is_default?: number }
|
||||||
* @param {Object} data - { pharmacy_id: string, is_default?: number }
|
|
||||||
* @returns {Promise}
|
* @returns {Promise}
|
||||||
*/
|
*/
|
||||||
export function addDoctorPharmacy(doctor_id, data) {
|
export function addDoctorPharmacy(data) {
|
||||||
return request({
|
return request({
|
||||||
url: `/admin/doctor/${doctor_id}/pharmacy`,
|
url: '/admin/doctor/pharmacy',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data,
|
data,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 4. 解除单个药房绑定
|
* 4. 解除单个药房绑定 (DELETE 方式,传入绑定记录 ID)
|
||||||
* @param {String} doctor_id - 医生 ID
|
* @param {String} doctor_pharmacy_id - 绑定记录 ID
|
||||||
* @param {String} pharmacy_id - 药房 ID
|
|
||||||
* @returns {Promise}
|
* @returns {Promise}
|
||||||
*/
|
*/
|
||||||
export function removeDoctorPharmacy(doctor_id, pharmacy_id) {
|
export function removeDoctorPharmacy(doctor_pharmacy_id) {
|
||||||
return request({
|
return request({
|
||||||
url: `/admin/doctor/${doctor_id}/pharmacy/${pharmacy_id}`,
|
url: `/admin/doctor/pharmacy/${doctor_pharmacy_id}`,
|
||||||
method: 'delete',
|
method: 'delete',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 5. 设为医生的默认药房
|
* 4.1 快捷解除绑定 (POST 方式,Body 传参)
|
||||||
* @param {String} doctor_id - 医生 ID
|
* @param {Object} data - { doctor_pharmacy_id?: string, doctor_id?: string, pharmacy_id?: string }
|
||||||
* @param {String} pharmacy_id - 药房 ID
|
|
||||||
* @returns {Promise}
|
* @returns {Promise}
|
||||||
*/
|
*/
|
||||||
export function setDefaultDoctorPharmacy(doctor_id, pharmacy_id) {
|
export function unbindDoctorPharmacy(data) {
|
||||||
return request({
|
return request({
|
||||||
url: `/admin/doctor/${doctor_id}/pharmacy/default/${pharmacy_id}`,
|
url: '/admin/doctor/pharmacy/unbind',
|
||||||
|
method: 'post',
|
||||||
|
data,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 5. 设为医生的默认药房 (PUT 方式,传入绑定记录 ID)
|
||||||
|
* @param {String} doctor_pharmacy_id - 绑定记录 ID
|
||||||
|
* @returns {Promise}
|
||||||
|
*/
|
||||||
|
export function setDefaultDoctorPharmacy(doctor_pharmacy_id) {
|
||||||
|
return request({
|
||||||
|
url: `/admin/doctor/pharmacy/default/${doctor_pharmacy_id}`,
|
||||||
method: 'put',
|
method: 'put',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 5.1 快捷设为默认药房 (PUT 方式,Body 传参)
|
||||||
|
* @param {Object} data - { doctor_pharmacy_id?: string, doctor_id?: string, pharmacy_id?: string }
|
||||||
|
* @returns {Promise}
|
||||||
|
*/
|
||||||
|
export function setDefaultDoctorPharmacyByBody(data) {
|
||||||
|
return request({
|
||||||
|
url: '/admin/doctor/pharmacy/default',
|
||||||
|
method: 'put',
|
||||||
|
data,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|||||||
@@ -319,7 +319,8 @@ const handleAddSubmit = async () => {
|
|||||||
|
|
||||||
addSubmitLoading.value = true;
|
addSubmitLoading.value = true;
|
||||||
try {
|
try {
|
||||||
const res = await addDoctorPharmacy(currentDoctor.value.doctor_id, {
|
const res = await addDoctorPharmacy({
|
||||||
|
doctor_id: String(currentDoctor.value.doctor_id),
|
||||||
pharmacy_id: String(addForm.pharmacy_id),
|
pharmacy_id: String(addForm.pharmacy_id),
|
||||||
is_default: Number(addForm.is_default),
|
is_default: Number(addForm.is_default),
|
||||||
});
|
});
|
||||||
@@ -342,8 +343,7 @@ const handleSetDefault = async (record) => {
|
|||||||
record._defaultLoading = true;
|
record._defaultLoading = true;
|
||||||
try {
|
try {
|
||||||
const res = await setDefaultDoctorPharmacy(
|
const res = await setDefaultDoctorPharmacy(
|
||||||
currentDoctor.value.doctor_id,
|
record.doctor_pharmacy_id || record.pharmacy_id
|
||||||
record.pharmacy_id
|
|
||||||
);
|
);
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
Message.success(`已将【${record.pharmacy_name}】设为默认药房`);
|
Message.success(`已将【${record.pharmacy_name}】设为默认药房`);
|
||||||
@@ -362,8 +362,7 @@ const handleSetDefault = async (record) => {
|
|||||||
const handleRemove = async (record) => {
|
const handleRemove = async (record) => {
|
||||||
try {
|
try {
|
||||||
const res = await removeDoctorPharmacy(
|
const res = await removeDoctorPharmacy(
|
||||||
currentDoctor.value.doctor_id,
|
record.doctor_pharmacy_id || record.pharmacy_id
|
||||||
record.pharmacy_id
|
|
||||||
);
|
);
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
Message.success('已解除药房绑定');
|
Message.success('已解除药房绑定');
|
||||||
|
|||||||
@@ -1166,7 +1166,7 @@ const columns = [
|
|||||||
|
|
||||||
{ title: '状态', dataIndex: 'status', slotName: 'status' },
|
{ title: '状态', dataIndex: 'status', slotName: 'status' },
|
||||||
// { title: '创建时间', dataIndex: 'created_at', slotName: 'created_at' },
|
// { title: '创建时间', dataIndex: 'created_at', slotName: 'created_at' },
|
||||||
{ title: '操作', slotName: 'action', fixed: "right", width: 260 },
|
{ title: '操作', slotName: 'action', fixed: "right", width: 280 },
|
||||||
];
|
];
|
||||||
|
|
||||||
// Table Data
|
// Table Data
|
||||||
|
|||||||
Reference in New Issue
Block a user