From 5e62360f353d64dc82513787760b67e3c316133a Mon Sep 17 00:00:00 2001 From: sa0ChunLuyu Date: Thu, 30 Jul 2026 16:40:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=B9=E9=87=8F=E6=94=B9=E8=AE=A1=E5=88=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../API/Admin/YeWu/PlanModelController.php | 288 +++++++++++ Laravel/routes/api.php | 8 + YiJi-admin/src/api/api.js | 32 ++ .../src/views/AppointmentMngr/PlanModel.vue | 475 +++++++++++++++++- .../views/AppointmentMngr/PlanModelAdmin.vue | 475 +++++++++++++++++- 5 files changed, 1266 insertions(+), 12 deletions(-) diff --git a/Laravel/app/Http/Controllers/API/Admin/YeWu/PlanModelController.php b/Laravel/app/Http/Controllers/API/Admin/YeWu/PlanModelController.php index e717fe6..f32b4d6 100644 --- a/Laravel/app/Http/Controllers/API/Admin/YeWu/PlanModelController.php +++ b/Laravel/app/Http/Controllers/API/Admin/YeWu/PlanModelController.php @@ -509,6 +509,155 @@ public function SaveLockedCount(Request $request) } } + //批量禁用计划模板 + public function BatchDisable(Request $request) + { + $userid = $request->get('userid'); + $ids = request('ids'); + if (empty($ids) || !is_array($ids)) { + return \Yz::echoError1('请选择要禁用的记录'); + } + $userInfo = DB::table('users')->where(['id' => $userid])->first(); + if (!$userInfo) { + return \Yz::echoError1('用户信息不存在'); + } + $department_id = $userInfo->department_id; + $d = DB::table('s_source_roster') + ->where(['department_id' => $department_id, 'is_del' => 0]) + ->whereIn('id', $ids) + ->update(['status' => 0]); + if ($d) { + return \Yz::Return(true, '批量禁用成功', []); + } else { + return \Yz::echoError1('操作失败,可能数据不存在或无变化'); + } + } + + //批量启用计划模板 + public function BatchEnable(Request $request) + { + $userid = $request->get('userid'); + $ids = request('ids'); + if (empty($ids) || !is_array($ids)) { + return \Yz::echoError1('请选择要启用的记录'); + } + $userInfo = DB::table('users')->where(['id' => $userid])->first(); + if (!$userInfo) { + return \Yz::echoError1('用户信息不存在'); + } + $department_id = $userInfo->department_id; + $d = DB::table('s_source_roster') + ->where(['department_id' => $department_id, 'is_del' => 0]) + ->whereIn('id', $ids) + ->update(['status' => 1]); + if ($d) { + return \Yz::Return(true, '批量启用成功', []); + } else { + return \Yz::echoError1('操作失败,可能数据不存在或无变化'); + } + } + + //批量修改计划模板(渠道数量+病人类型) + public function BatchChange(Request $request) + { + $userid = $request->get('userid'); + $ids = request('ids'); + $max_total = request('max_total'); + $coutsInfo = request('coutsInfo'); + $patientType = request('patientType'); + + if (empty($ids) || !is_array($ids)) { + return \Yz::echoError1('请选择要修改的记录'); + } + if (empty($coutsInfo) || !is_array($coutsInfo)) { + return \Yz::echoError1('渠道数量不能为空'); + } + + $userInfo = DB::table('users')->where(['id' => $userid])->first(); + if (!$userInfo) { + return \Yz::echoError1('用户信息不存在'); + } + $department_id = $userInfo->department_id; + + DB::beginTransaction(); + try { + $patient_type_str = !empty($patientType) ? implode(',', $patientType) : ''; + + foreach ($ids as $id) { + // 更新病人类型 + if ($patient_type_str !== '') { + DB::table('s_source_roster') + ->where(['id' => $id, 'department_id' => $department_id, 'is_del' => 0]) + ->update(['patient_type' => $patient_type_str]); + } + + // 更新渠道数量 + foreach ($coutsInfo as $ci) { + DB::table('s_source_roster_count') + ->where([ + 'roster_id' => $id, + 'appointment_type_id' => $ci['appointment_type_id'] + ]) + ->update([ + 'max_total' => $max_total, + 'count' => $ci['count'] + ]); + } + } + + DB::commit(); + return \Yz::Return(true, '批量修改成功', []); + + } catch (\Exception $e) { + DB::rollBack(); + return \Yz::echoError1('批量修改失败:' . $e->getMessage()); + } + } + + //批量占用计划模板 + public function BatchOccupy(Request $request) + { + $userid = $request->get('userid'); + $ids = request('ids'); + $coutsInfo = request('coutsInfo'); + + if (empty($ids) || !is_array($ids)) { + return \Yz::echoError1('请选择要占用的记录'); + } + if (empty($coutsInfo) || !is_array($coutsInfo)) { + return \Yz::echoError1('占用数量不能为空'); + } + + $userInfo = DB::table('users')->where(['id' => $userid])->first(); + if (!$userInfo) { + return \Yz::echoError1('用户信息不存在'); + } + $department_id = $userInfo->department_id; + + DB::beginTransaction(); + try { + foreach ($ids as $id) { + foreach ($coutsInfo as $ci) { + DB::table('s_source_roster_count') + ->where([ + 'roster_id' => $id, + 'appointment_type_id' => $ci['appointment_type_id'] + ]) + ->update([ + 'locked_count' => $ci['locked_count'] + ]); + } + } + + DB::commit(); + return \Yz::Return(true, '批量占用成功', []); + + } catch (\Exception $e) { + DB::rollBack(); + return \Yz::echoError1('批量占用失败:' . $e->getMessage()); + } + } + // ===== 管理员接口(接受 department_id 参数,不依赖用户绑定科室) ===== //管理员保存计划模板 @@ -715,4 +864,143 @@ public function SaveAppointmentRatioAdmin(Request $request) return \Yz::echoError1('保存失败,无数据更新'); } } + + //管理员批量禁用计划模板 + public function BatchDisableAdmin(Request $request) + { + $department_id = request('department_id'); + if (!$department_id) { + return \Yz::echoError1('科室信息不存在'); + } + $ids = request('ids'); + if (empty($ids) || !is_array($ids)) { + return \Yz::echoError1('请选择要禁用的记录'); + } + $d = DB::table('s_source_roster') + ->where(['department_id' => $department_id, 'is_del' => 0]) + ->whereIn('id', $ids) + ->update(['status' => 0]); + if ($d) { + return \Yz::Return(true, '批量禁用成功', []); + } else { + return \Yz::echoError1('操作失败,可能数据不存在或无变化'); + } + } + + //管理员批量启用计划模板 + public function BatchEnableAdmin(Request $request) + { + $department_id = request('department_id'); + if (!$department_id) { + return \Yz::echoError1('科室信息不存在'); + } + $ids = request('ids'); + if (empty($ids) || !is_array($ids)) { + return \Yz::echoError1('请选择要启用的记录'); + } + $d = DB::table('s_source_roster') + ->where(['department_id' => $department_id, 'is_del' => 0]) + ->whereIn('id', $ids) + ->update(['status' => 1]); + if ($d) { + return \Yz::Return(true, '批量启用成功', []); + } else { + return \Yz::echoError1('操作失败,可能数据不存在或无变化'); + } + } + + //管理员批量修改计划模板(渠道数量+病人类型) + public function BatchChangeAdmin(Request $request) + { + $department_id = request('department_id'); + if (!$department_id) { + return \Yz::echoError1('科室信息不存在'); + } + $ids = request('ids'); + $max_total = request('max_total'); + $coutsInfo = request('coutsInfo'); + $patientType = request('patientType'); + + if (empty($ids) || !is_array($ids)) { + return \Yz::echoError1('请选择要修改的记录'); + } + if (empty($coutsInfo) || !is_array($coutsInfo)) { + return \Yz::echoError1('渠道数量不能为空'); + } + + DB::beginTransaction(); + try { + $patient_type_str = !empty($patientType) ? implode(',', $patientType) : ''; + + foreach ($ids as $id) { + // 更新病人类型 + if ($patient_type_str !== '') { + DB::table('s_source_roster') + ->where(['id' => $id, 'department_id' => $department_id, 'is_del' => 0]) + ->update(['patient_type' => $patient_type_str]); + } + + // 更新渠道数量 + foreach ($coutsInfo as $ci) { + DB::table('s_source_roster_count') + ->where([ + 'roster_id' => $id, + 'appointment_type_id' => $ci['appointment_type_id'] + ]) + ->update([ + 'max_total' => $max_total, + 'count' => $ci['count'] + ]); + } + } + + DB::commit(); + return \Yz::Return(true, '批量修改成功', []); + + } catch (\Exception $e) { + DB::rollBack(); + return \Yz::echoError1('批量修改失败:' . $e->getMessage()); + } + } + + //管理员批量占用计划模板 + public function BatchOccupyAdmin(Request $request) + { + $department_id = request('department_id'); + if (!$department_id) { + return \Yz::echoError1('科室信息不存在'); + } + $ids = request('ids'); + $coutsInfo = request('coutsInfo'); + + if (empty($ids) || !is_array($ids)) { + return \Yz::echoError1('请选择要占用的记录'); + } + if (empty($coutsInfo) || !is_array($coutsInfo)) { + return \Yz::echoError1('占用数量不能为空'); + } + + DB::beginTransaction(); + try { + foreach ($ids as $id) { + foreach ($coutsInfo as $ci) { + DB::table('s_source_roster_count') + ->where([ + 'roster_id' => $id, + 'appointment_type_id' => $ci['appointment_type_id'] + ]) + ->update([ + 'locked_count' => $ci['locked_count'] + ]); + } + } + + DB::commit(); + return \Yz::Return(true, '批量占用成功', []); + + } catch (\Exception $e) { + DB::rollBack(); + return \Yz::echoError1('批量占用失败:' . $e->getMessage()); + } + } } diff --git a/Laravel/routes/api.php b/Laravel/routes/api.php index 5568788..51165d8 100644 --- a/Laravel/routes/api.php +++ b/Laravel/routes/api.php @@ -108,11 +108,19 @@ Route::post('admin/PlanModelDel','App\Http\Controllers\API\Admin\YeWu\PlanModelController@Del');//删除计划模板 Route::post('admin/SaveAppointmentRatio','App\Http\Controllers\API\Admin\YeWu\PlanModelController@SaveAppointmentRatio');//保存渠道比例 Route::post('admin/SavePlanModelLockedCount','App\Http\Controllers\API\Admin\YeWu\PlanModelController@SaveLockedCount');//保存模板占位数量 + Route::post('admin/PlanModelBatchDisable','App\Http\Controllers\API\Admin\YeWu\PlanModelController@BatchDisable');//批量禁用计划模板 + Route::post('admin/PlanModelBatchEnable','App\Http\Controllers\API\Admin\YeWu\PlanModelController@BatchEnable');//批量启用计划模板 + Route::post('admin/PlanModelBatchChange','App\Http\Controllers\API\Admin\YeWu\PlanModelController@BatchChange');//批量修改计划模板 + Route::post('admin/PlanModelBatchOccupy','App\Http\Controllers\API\Admin\YeWu\PlanModelController@BatchOccupy');//批量占用计划模板 // ===== 管理员接口(接受 department_id 参数) ===== Route::post('admin/PlanModelSaveAdmin','App\Http\Controllers\API\Admin\YeWu\PlanModelController@SaveAdmin');//管理员保存计划模板 Route::post('admin/PlanModelDelAdmin','App\Http\Controllers\API\Admin\YeWu\PlanModelController@DelAdmin');//管理员删除计划模板 Route::post('admin/GetAppointmentRatioAdmin','App\Http\Controllers\API\Admin\YeWu\PlanModelController@GetAppointmentRatioAdmin');//管理员获取预约类型比例 Route::post('admin/SaveAppointmentRatioAdmin','App\Http\Controllers\API\Admin\YeWu\PlanModelController@SaveAppointmentRatioAdmin');//管理员保存渠道比例 + Route::post('admin/PlanModelBatchDisableAdmin','App\Http\Controllers\API\Admin\YeWu\PlanModelController@BatchDisableAdmin');//管理员批量禁用计划模板 + Route::post('admin/PlanModelBatchEnableAdmin','App\Http\Controllers\API\Admin\YeWu\PlanModelController@BatchEnableAdmin');//管理员批量启用计划模板 + Route::post('admin/PlanModelBatchChangeAdmin','App\Http\Controllers\API\Admin\YeWu\PlanModelController@BatchChangeAdmin');//管理员批量修改计划模板 + Route::post('admin/PlanModelBatchOccupyAdmin','App\Http\Controllers\API\Admin\YeWu\PlanModelController@BatchOccupyAdmin');//管理员批量占用计划模板 Route::post('admin/CreatePlanListAdmin','App\Http\Controllers\API\Admin\YeWu\PlanListController@CreateAdmin');//管理员生成计划明细 Route::post('admin/PlanDetailChangeInfoAdmin','App\Http\Controllers\API\Admin\YeWu\PlanListController@ChangeInfoAdmin');//管理员修改计划详情 Route::post('admin/PlanListDelAdmin','App\Http\Controllers\API\Admin\YeWu\PlanListController@DelAdmin');//管理员删除计划明细 diff --git a/YiJi-admin/src/api/api.js b/YiJi-admin/src/api/api.js index a5628b4..fa1128a 100644 --- a/YiJi-admin/src/api/api.js +++ b/YiJi-admin/src/api/api.js @@ -343,6 +343,38 @@ export const PlanModelDel = (data = {}) => { export const PlanModelDelAdmin = (data = {}) => { return axios({ url: import.meta.env.VITE_APP_API + 'v1/admin/PlanModelDelAdmin', data: data }) } +//admin批量禁用计划模板 +export const PlanModelBatchDisable = (data = {}) => { + return axios({ url: import.meta.env.VITE_APP_API + 'v1/admin/PlanModelBatchDisable', data: data }) +} +//admin批量禁用计划模板(管理员接口) +export const PlanModelBatchDisableAdmin = (data = {}) => { + return axios({ url: import.meta.env.VITE_APP_API + 'v1/admin/PlanModelBatchDisableAdmin', data: data }) +} +//admin批量启用计划模板 +export const PlanModelBatchEnable = (data = {}) => { + return axios({ url: import.meta.env.VITE_APP_API + 'v1/admin/PlanModelBatchEnable', data: data }) +} +//admin批量启用计划模板(管理员接口) +export const PlanModelBatchEnableAdmin = (data = {}) => { + return axios({ url: import.meta.env.VITE_APP_API + 'v1/admin/PlanModelBatchEnableAdmin', data: data }) +} +//admin批量修改计划模板(渠道数量+病人类型) +export const PlanModelBatchChange = (data = {}) => { + return axios({ url: import.meta.env.VITE_APP_API + 'v1/admin/PlanModelBatchChange', data: data }) +} +//admin批量修改计划模板(管理员接口) +export const PlanModelBatchChangeAdmin = (data = {}) => { + return axios({ url: import.meta.env.VITE_APP_API + 'v1/admin/PlanModelBatchChangeAdmin', data: data }) +} +//admin批量占用计划模板 +export const PlanModelBatchOccupy = (data = {}) => { + return axios({ url: import.meta.env.VITE_APP_API + 'v1/admin/PlanModelBatchOccupy', data: data }) +} +//admin批量占用计划模板(管理员接口) +export const PlanModelBatchOccupyAdmin = (data = {}) => { + return axios({ url: import.meta.env.VITE_APP_API + 'v1/admin/PlanModelBatchOccupyAdmin', data: data }) +} //admin保存预约类型(渠道)比例 export const SaveAppointmentRatio = (data = {}) => { return axios({ url: import.meta.env.VITE_APP_API + 'v1/admin/SaveAppointmentRatio', data: data }) diff --git a/YiJi-admin/src/views/AppointmentMngr/PlanModel.vue b/YiJi-admin/src/views/AppointmentMngr/PlanModel.vue index a271082..857840f 100644 --- a/YiJi-admin/src/views/AppointmentMngr/PlanModel.vue +++ b/YiJi-admin/src/views/AppointmentMngr/PlanModel.vue @@ -41,6 +41,10 @@ 添加 删除 生成选中的计划 + 批量禁用 + 批量启用 + 批量修改 + 批量占用 @@ -60,7 +64,7 @@ {{item.resources_name}} -
+
-
@@ -73,10 +77,14 @@ {{item.label}}
+ {{item2}} -
+
@@ -116,6 +124,7 @@
+
@@ -379,13 +388,85 @@ + + +
+
已选 {{ selectedPlanArr.length }} 条号源明细
+ + + 渠道名称 + 数量 + + + {{ ch.name }} + + + + + + 合计 + 数量: {{ batchTotalCount }} + + +
+
病人类型
+ + 住院 + 门诊 + 急诊 + 体检 + +
+
+ +
+ + +
+
已选 {{ selectedPlanArr.length }} 条号源明细
+ + + 渠道名称 + 占用数量 + 提示 + + + {{ ch.name }} + + + + + + + + + 合计 + 占用: {{ batchOccupyTotalLocked }} + + +
+ +
@@ -1192,6 +1631,8 @@ border-collapse: collapse; /* 合并边框 */ color: #333; + user-select: none; + -webkit-user-select: none; td { border: 1px solid #f1f1f1; @@ -1371,4 +1812,26 @@ display: flex; } + /* 拖拽框选 */ + .drag-selection-overlay { + position: absolute; + top: 0; + left: 0; + background: rgba(64, 158, 255, 0.12); + border: 1px solid rgba(64, 158, 255, 0.5); + pointer-events: none; + z-index: 10; + } + .planInfo_k_selected { + background-color: #e6f7ff; + outline: 2px solid #409eff; + outline-offset: -2px; + border-radius: 4px; + } + .planInfo_k_disabled_selected { + background-color: #f3e8ff; + outline: 2px solid #7c3aed; + outline-offset: -2px; + border-radius: 4px; + } \ No newline at end of file diff --git a/YiJi-admin/src/views/AppointmentMngr/PlanModelAdmin.vue b/YiJi-admin/src/views/AppointmentMngr/PlanModelAdmin.vue index 56a78cd..8b0281c 100644 --- a/YiJi-admin/src/views/AppointmentMngr/PlanModelAdmin.vue +++ b/YiJi-admin/src/views/AppointmentMngr/PlanModelAdmin.vue @@ -41,6 +41,10 @@ 添加 删除 生成选中的计划 + 批量禁用 + 批量启用 + 批量修改 + 批量占用
@@ -60,7 +64,7 @@ {{item.resources_name}} -
+
-
@@ -73,10 +77,14 @@ {{item.label}}
+ {{item2}} -
+
@@ -116,6 +124,7 @@
+
@@ -379,13 +388,85 @@ + + +
+
已选 {{ selectedPlanArr.length }} 条号源明细
+ + + 渠道名称 + 数量 + + + {{ ch.name }} + + + + + + 合计 + 数量: {{ batchTotalCount }} + + +
+
病人类型
+ + 住院 + 门诊 + 急诊 + 体检 + +
+
+ +
+ + +
+
已选 {{ selectedPlanArr.length }} 条号源明细
+ + + 渠道名称 + 占用数量 + 提示 + + + {{ ch.name }} + + + + + + + + + 合计 + 占用: {{ batchOccupyTotalLocked }} + + +
+ +
@@ -1206,6 +1645,8 @@ border-collapse: collapse; /* 合并边框 */ color: #333; + user-select: none; + -webkit-user-select: none; td { border: 1px solid #f1f1f1; @@ -1386,4 +1827,26 @@ display: flex; } + /* 拖拽框选 */ + .drag-selection-overlay { + position: absolute; + top: 0; + left: 0; + background: rgba(64, 158, 255, 0.12); + border: 1px solid rgba(64, 158, 255, 0.5); + pointer-events: none; + z-index: 10; + } + .planInfo_k_selected { + background-color: #e6f7ff; + outline: 2px solid #409eff; + outline-offset: -2px; + border-radius: 4px; + } + .planInfo_k_disabled_selected { + background-color: #f3e8ff; + outline: 2px solid #7c3aed; + outline-offset: -2px; + border-radius: 4px; + } \ No newline at end of file