diff --git a/Laravel/app/Http/Controllers/API/Admin/YeWu/PlanListController.php b/Laravel/app/Http/Controllers/API/Admin/YeWu/PlanListController.php
index 9c60642..6a14839 100644
--- a/Laravel/app/Http/Controllers/API/Admin/YeWu/PlanListController.php
+++ b/Laravel/app/Http/Controllers/API/Admin/YeWu/PlanListController.php
@@ -905,4 +905,200 @@ public function BatchDisableAdmin(Request $request)
return \Yz::echoError1('批量禁用失败');
}
}
+
+ //批量启用计划明细
+ public function BatchEnable(Request $request)
+ {
+ $userid = $request->get('userid');
+ $userInfo = DB::table('users')->where(['id' => $userid])->get();
+ $department_id = $userInfo[0]->department_id;
+ $ids = request('ids');
+ $u1 = DB::table('s_source_roster_detail')->where(['department_id' => $department_id])->whereIn('id', $ids)->update([
+ 'status' => 1
+ ]);
+ if ($u1) {
+ $firstId = !empty($ids) ? $ids[0] : 0;
+ DB::table('s_source_roster_detail_log')->insert([
+ 'roster_detail_id' => $firstId,
+ 'type' => '批量启用',
+ 'content' => json_encode(['ids' => $ids, 'count' => count($ids)], JSON_UNESCAPED_UNICODE),
+ 'userid' => $userid
+ ]);
+ return \Yz::Return(true, '批量启用成功', []);
+ } else {
+ return \Yz::echoError1('批量启用失败');
+ }
+ }
+
+ //管理员批量启用计划明细
+ public function BatchEnableAdmin(Request $request)
+ {
+ $userid = $request->get('userid');
+ $department_id = request('department_id');
+ if (!$department_id) {
+ return \Yz::echoError1('科室信息不存在');
+ }
+ $ids = request('ids');
+ $u1 = DB::table('s_source_roster_detail')->where(['department_id' => $department_id])->whereIn('id', $ids)->update([
+ 'status' => 1
+ ]);
+ if ($u1) {
+ $firstId = !empty($ids) ? $ids[0] : 0;
+ DB::table('s_source_roster_detail_log')->insert([
+ 'roster_detail_id' => $firstId,
+ 'type' => '批量启用',
+ 'content' => json_encode(['ids' => $ids, 'count' => count($ids)], JSON_UNESCAPED_UNICODE),
+ 'userid' => $userid
+ ]);
+ return \Yz::Return(true, '批量启用成功', []);
+ } else {
+ return \Yz::echoError1('批量启用失败');
+ }
+ }
+
+ //批量修改单个号源明细
+ public function DetailBatchUpdate(Request $request)
+ {
+ $userid = $request->get('userid');
+ $userInfo = DB::table('users')->where(['id' => $userid])->get();
+ $department_id = $userInfo[0]->department_id;
+ $id = request('id');
+ $max_total = request('max_total');
+ $coutsInfo = request('coutsInfo');
+ $check = DB::table('s_source_roster_detail')->where(['id' => $id])
+ ->where('department_id', $department_id)
+ ->where('is_del', 0)
+ ->first();
+ if (!$check) return \Yz::echoError1('没有权限');
+ $i = 0;
+ foreach ($coutsInfo as $value) {
+ $u2 = DB::table('s_source_roster_detail_count')
+ ->where('roster_detail_id', $id)
+ ->where('appointment_type_id', $value['appointment_type_id'])
+ ->update([
+ 'count' => $value['count'] ?? 0,
+ 'locked_count' => $value['locked_count'] ?? 0,
+ 'max_total' => $max_total
+ ]);
+ if ($u2) $i++;
+ }
+ if ($i > 0) {
+ return \Yz::Return(true, '修改成功', []);
+ } else {
+ return \Yz::echoError1('修改失败');
+ }
+ }
+
+ //管理员批量修改单个号源明细
+ public function DetailBatchUpdateAdmin(Request $request)
+ {
+ $userid = $request->get('userid');
+ $department_id = request('department_id');
+ if (!$department_id) {
+ return \Yz::echoError1('科室信息不存在');
+ }
+ $id = request('id');
+ $max_total = request('max_total');
+ $coutsInfo = request('coutsInfo');
+ $check = DB::table('s_source_roster_detail')->where(['id' => $id])
+ ->where('department_id', $department_id)
+ ->where('is_del', 0)
+ ->first();
+ if (!$check) return \Yz::echoError1('没有权限');
+ $i = 0;
+ foreach ($coutsInfo as $value) {
+ $u2 = DB::table('s_source_roster_detail_count')
+ ->where('roster_detail_id', $id)
+ ->where('appointment_type_id', $value['appointment_type_id'])
+ ->update([
+ 'count' => $value['count'] ?? 0,
+ 'locked_count' => $value['locked_count'] ?? 0,
+ 'max_total' => $max_total
+ ]);
+ if ($u2) $i++;
+ }
+ if ($i > 0) {
+ return \Yz::Return(true, '修改成功', []);
+ } else {
+ return \Yz::echoError1('修改失败');
+ }
+ }
+
+ //批量修改号源(统一提交)
+ public function BatchChangeInfo(Request $request)
+ {
+ $userid = $request->get('userid');
+ $userInfo = DB::table('users')->where(['id' => $userid])->get();
+ $department_id = $userInfo[0]->department_id;
+ $ids = request('ids');
+ $max_total = request('max_total');
+ $coutsInfo = request('coutsInfo');
+ if (empty($ids) || empty($coutsInfo)) {
+ return \Yz::echoError1('参数错误');
+ }
+ // 用 CASE WHEN 一次更新所有渠道
+ $appointmentTypeIds = array_column($coutsInfo, 'appointment_type_id');
+ $countSql = 'CASE appointment_type_id ';
+ $lockedSql = 'CASE appointment_type_id ';
+ foreach ($coutsInfo as $v) {
+ $countSql .= 'WHEN ' . intval($v['appointment_type_id']) . ' THEN ' . intval($v['count'] ?? 0) . ' ';
+ $lockedSql .= 'WHEN ' . intval($v['appointment_type_id']) . ' THEN ' . intval($v['locked_count'] ?? 0) . ' ';
+ }
+ $countSql .= 'END';
+ $lockedSql .= 'END';
+ $idsStr = implode(',', array_map('intval', $ids));
+ $atypeIdsStr = implode(',', array_map('intval', $appointmentTypeIds));
+ $sql = "UPDATE s_source_roster_detail_count
+ SET count = {$countSql},
+ locked_count = {$lockedSql},
+ max_total = {$max_total}
+ WHERE roster_detail_id IN ({$idsStr})
+ AND appointment_type_id IN ({$atypeIdsStr})";
+ $u2 = DB::update($sql);
+ if ($u2 > 0) {
+ return \Yz::Return(true, '批量修改成功', []);
+ } else {
+ return \Yz::echoError1('批量修改失败');
+ }
+ }
+
+ //管理员批量修改号源(统一提交)
+ public function BatchChangeInfoAdmin(Request $request)
+ {
+ $userid = $request->get('userid');
+ $department_id = request('department_id');
+ if (!$department_id) {
+ return \Yz::echoError1('科室信息不存在');
+ }
+ $ids = request('ids');
+ $max_total = request('max_total');
+ $coutsInfo = request('coutsInfo');
+ if (empty($ids) || empty($coutsInfo)) {
+ return \Yz::echoError1('参数错误');
+ }
+ // 用 CASE WHEN 一次更新所有渠道
+ $appointmentTypeIds = array_column($coutsInfo, 'appointment_type_id');
+ $countSql = 'CASE appointment_type_id ';
+ $lockedSql = 'CASE appointment_type_id ';
+ foreach ($coutsInfo as $v) {
+ $countSql .= 'WHEN ' . intval($v['appointment_type_id']) . ' THEN ' . intval($v['count'] ?? 0) . ' ';
+ $lockedSql .= 'WHEN ' . intval($v['appointment_type_id']) . ' THEN ' . intval($v['locked_count'] ?? 0) . ' ';
+ }
+ $countSql .= 'END';
+ $lockedSql .= 'END';
+ $idsStr = implode(',', array_map('intval', $ids));
+ $atypeIdsStr = implode(',', array_map('intval', $appointmentTypeIds));
+ $sql = "UPDATE s_source_roster_detail_count
+ SET count = {$countSql},
+ locked_count = {$lockedSql},
+ max_total = {$max_total}
+ WHERE roster_detail_id IN ({$idsStr})
+ AND appointment_type_id IN ({$atypeIdsStr})";
+ $u2 = DB::update($sql);
+ if ($u2 > 0) {
+ return \Yz::Return(true, '批量修改成功', []);
+ } else {
+ return \Yz::echoError1('批量修改失败');
+ }
+ }
}
diff --git a/Laravel/routes/api.php b/Laravel/routes/api.php
index 09e65d7..be35016 100644
--- a/Laravel/routes/api.php
+++ b/Laravel/routes/api.php
@@ -123,6 +123,12 @@
Route::post('admin/PlanListDel','App\Http\Controllers\API\Admin\YeWu\PlanListController@Del');//删除计划详情
Route::post('admin/PlanListBatchDisable','App\Http\Controllers\API\Admin\YeWu\PlanListController@BatchDisable');//批量禁用
Route::post('admin/PlanListBatchDisableAdmin','App\Http\Controllers\API\Admin\YeWu\PlanListController@BatchDisableAdmin');//管理员批量禁用
+ Route::post('admin/PlanListBatchEnable','App\Http\Controllers\API\Admin\YeWu\PlanListController@BatchEnable');//批量启用
+ Route::post('admin/PlanListBatchEnableAdmin','App\Http\Controllers\API\Admin\YeWu\PlanListController@BatchEnableAdmin');//管理员批量启用
+ Route::post('admin/PlanDetailBatchUpdate','App\Http\Controllers\API\Admin\YeWu\PlanListController@DetailBatchUpdate');//批量修改单个号源明细
+ Route::post('admin/PlanDetailBatchUpdateAdmin','App\Http\Controllers\API\Admin\YeWu\PlanListController@DetailBatchUpdateAdmin');//管理员批量修改单个号源明细
+ Route::post('admin/PlanListBatchChangeInfo','App\Http\Controllers\API\Admin\YeWu\PlanListController@BatchChangeInfo');//批量修改号源(统一提交)
+ Route::post('admin/PlanListBatchChangeInfoAdmin','App\Http\Controllers\API\Admin\YeWu\PlanListController@BatchChangeInfoAdmin');//管理员批量修改号源(统一提交)
Route::post('admin/SaveLockedCount','App\Http\Controllers\API\Admin\YeWu\PlanListController@SaveLockedCount');//保存占位数量
Route::post('admin/GetMainList','App\Http\Controllers\API\Admin\YeWu\WorkMainController@GetList');//获取主表列表
Route::post('admin/GetMainListByDept','App\Http\Controllers\API\Admin\YeWu\WorkMainController@GetListByDept');//管理员获取主表列表(支持科室切换)
diff --git a/YiJi-admin/src/api/api.js b/YiJi-admin/src/api/api.js
index eace81e..0f3f54f 100644
--- a/YiJi-admin/src/api/api.js
+++ b/YiJi-admin/src/api/api.js
@@ -375,6 +375,30 @@ export const PlanListBatchDisable = (data = {}) => {
export const PlanListBatchDisableAdmin = (data = {}) => {
return axios({ url: import.meta.env.VITE_APP_API + 'v1/admin/PlanListBatchDisableAdmin', data: data })
}
+//批量启用计划明细
+export const PlanListBatchEnable = (data = {}) => {
+ return axios({ url: import.meta.env.VITE_APP_API + 'v1/admin/PlanListBatchEnable', data: data })
+}
+//批量启用计划明细(管理员接口)
+export const PlanListBatchEnableAdmin = (data = {}) => {
+ return axios({ url: import.meta.env.VITE_APP_API + 'v1/admin/PlanListBatchEnableAdmin', data: data })
+}
+//批量修改单个号源明细
+export const PlanDetailBatchUpdate = (data = {}) => {
+ return axios({ url: import.meta.env.VITE_APP_API + 'v1/admin/PlanDetailBatchUpdate', data: data })
+}
+//批量修改单个号源明细(管理员接口)
+export const PlanDetailBatchUpdateAdmin = (data = {}) => {
+ return axios({ url: import.meta.env.VITE_APP_API + 'v1/admin/PlanDetailBatchUpdateAdmin', data: data })
+}
+//批量修改号源(统一提交)
+export const PlanListBatchChangeInfo = (data = {}) => {
+ return axios({ url: import.meta.env.VITE_APP_API + 'v1/admin/PlanListBatchChangeInfo', data: data })
+}
+//批量修改号源(管理员统一提交)
+export const PlanListBatchChangeInfoAdmin = (data = {}) => {
+ return axios({ url: import.meta.env.VITE_APP_API + 'v1/admin/PlanListBatchChangeInfoAdmin', data: data })
+}
//admin获取主表列表
export const GetMainList = (data = {}) => {
return axios({ url: import.meta.env.VITE_APP_API + 'v1/admin/GetMainList', data: data })
diff --git a/YiJi-admin/src/views/AppointmentMngr/PlanList.vue b/YiJi-admin/src/views/AppointmentMngr/PlanList.vue
index d1646d4..8ab0bd7 100644
--- a/YiJi-admin/src/views/AppointmentMngr/PlanList.vue
+++ b/YiJi-admin/src/views/AppointmentMngr/PlanList.vue
@@ -47,6 +47,8 @@