diff --git a/Laravel/app/Http/Controllers/API/Admin/YeWu/PlanController.php b/Laravel/app/Http/Controllers/API/Admin/YeWu/PlanController.php index 1150667..c94935e 100644 --- a/Laravel/app/Http/Controllers/API/Admin/YeWu/PlanController.php +++ b/Laravel/app/Http/Controllers/API/Admin/YeWu/PlanController.php @@ -36,7 +36,7 @@ class PlanController extends Controller // $planType = DB::table('plan_type as a')->where(['a.id' => $model->plan_type, 'a.is_del' => 0, 'a.status' => 1])->first(); // if (!$planType) return \Yz::echoError1('号源类型不可用'); //查询此时间段内是否有已经生成的号源 - $cha = DB::table('plans')->whereBetween('date', $Info['dateRange'])->where(['is_del'=>0])->get(); + $cha = DB::table('plans')->whereBetween('date', $Info['dateRange'])->where(['is_del'=>0])->whereIn('status',[0,1])->get(); if (count($cha) > 0) { return \Yz::return(false, '号源重复', ['list' => $cha]); } @@ -52,6 +52,8 @@ class PlanController extends Controller while ($currentDate <= $endDate) { //循环生成 $date_ymd = $currentDate->format('Y-m-d'); + //查询这一天已经占用的号源 + $usedPlans= DB::table('plans')->where(['date'=>$date_ymd,'status'=>2])->get(); //判断节假日是否生成 $s_day = DB::table('plan_holiday')->select('*', 'type as tp')->where(['date' => $date_ymd])->first(); if (!!$s_day) { @@ -76,6 +78,14 @@ class PlanController extends Controller if (!$planType) return \Yz::echoError1('号源类型不可用'); } $cleanTime = implode('', explode(':', $time->time)); // 去除冒号的时间字符串 + $tiaoguo=false; + foreach ($usedPlans as $usekey => $usedPlan) { //如果有占用的号源则跳过 + if($usedPlan->date==$date_ymd and $usedPlan->time==$time->time){ + $tiaoguo=true; + break; + } + } + if($tiaoguo) continue; $data = [ 'model_id' => $model->id, 'date' => $date_ymd, @@ -212,7 +222,16 @@ class PlanController extends Controller public function Del() { $ids = request('ids'); - $del=DB::table('plans')->whereIn('id', $ids)->where(['status'=>1])->update(['is_del'=>1]); + $dates = request('dates'); + if(empty($ids) and empty($dates)) return \Yz::echoError1("条件不完整"); + $del=DB::table('plans'); + if(!empty($ids)){ + $del=$del ->whereIn('id', $ids); + } + if(isset($dates) and !empty($dates)){ + $del=$del->whereIn('date',$dates); + } + $del=$del->whereIn('status',[0,1])->update(['is_del'=>1]); if($del){ return \Yz::Return(true, '操作成功', []); }else{ diff --git a/Laravel/app/Http/Controllers/API/Admin/YeWu/PlanListController.php b/Laravel/app/Http/Controllers/API/Admin/YeWu/PlanListController.php new file mode 100644 index 0000000..fa26405 --- /dev/null +++ b/Laravel/app/Http/Controllers/API/Admin/YeWu/PlanListController.php @@ -0,0 +1,26 @@ +2){ + $searchInfo['dateRange']=[$today,$today]; + } + $list=DB::select("select date, + SUM(CASE WHEN type = 0 THEN 1 ELSE 0 END) as type_0_count, + SUM(CASE WHEN type =1 THEN 1 ELSE 0 END) as type_1_count, + SUM(CASE WHEN status=2 THEN 1 ELSE 0 END) as type_used_count + from plans where date >=? and date<=? and is_del=0 GROUP BY date",$searchInfo['dateRange']); + return \Yz::Return(true,"查询完成",['list'=>$list,'dateRange'=>$searchInfo['dateRange'],'count'=>0]); + } + +} diff --git a/Laravel/app/Http/Controllers/API/Internal/OrderController.php b/Laravel/app/Http/Controllers/API/Internal/OrderController.php index 92ad198..78fe3e2 100644 --- a/Laravel/app/Http/Controllers/API/Internal/OrderController.php +++ b/Laravel/app/Http/Controllers/API/Internal/OrderController.php @@ -93,6 +93,7 @@ class OrderController extends Controller 'source' => '体检推送', 'name' => $data['姓名'], 'id_number' => $data['证件号码'], + 'person_id'=>0, 'buy_info' => json_encode($buyInfo, JSON_UNESCAPED_UNICODE), 'status' => 4, 'plan_number' => $data['分诊信息'], diff --git a/Laravel/routes/api.php b/Laravel/routes/api.php index 8889467..7834830 100644 --- a/Laravel/routes/api.php +++ b/Laravel/routes/api.php @@ -92,6 +92,7 @@ Route::group(['middleware' => ['checktoken', 'log'], 'prefix' => 'v1'], function Route::post('admin/PlanSave', 'App\Http\Controllers\API\Admin\YeWu\PlanController@Save');//保存号源详情 Route::post('admin/PlanDel', 'App\Http\Controllers\API\Admin\YeWu\PlanController@Del');// Route::post('admin/PlanBatchUpdatePlanType', 'App\Http\Controllers\API\Admin\YeWu\PlanController@BatchUpdatePlanType');//保存号源详情 + Route::post('admin/PlanListGetList', 'App\Http\Controllers\API\Admin\YeWu\PlanListController@GetList');//号源列表的列表 Route::post('admin/ComboGetList', 'App\Http\Controllers\API\Admin\YeWu\ComboController@GetList');//获取套餐列表 Route::post('admin/ComboGetList', 'App\Http\Controllers\API\Admin\YeWu\ComboController@GetList');//获取套餐列表 diff --git a/admin/src/api/api.js b/admin/src/api/api.js index 036369c..208937f 100644 --- a/admin/src/api/api.js +++ b/admin/src/api/api.js @@ -421,4 +421,8 @@ export const CouponsGetDetail = (data = {}) => { //获取全部套餐 export const ComboGetAllList = (data = {}) => { return axios({ url: import.meta.env.VITE_APP_API + `v1/admin/ComboGetAllList`, data: data }) +} +//获取号源列表的列表 +export const PlanListGetList = (data = {}) => { + return axios({ url: import.meta.env.VITE_APP_API + `v1/admin/PlanListGetList`, data: data }) } \ No newline at end of file diff --git a/admin/src/router/index.js b/admin/src/router/index.js index 8b774b4..0f52cdd 100644 --- a/admin/src/router/index.js +++ b/admin/src/router/index.js @@ -120,6 +120,13 @@ const router = createRouter({ meta: { title: '号源模板' } + },{ + path: '/planMngr/planlist', + name: 'PlanMngrPlanlist', + component: () => import('../views/PlanMngr/PlanList.vue'), + meta: { + title: '号源列表' + } },{ path: '/planMngr/plan', name: 'PlanMngrPlan', diff --git a/admin/src/views/PlanMngr/Plan.vue b/admin/src/views/PlanMngr/Plan.vue index b578c6d..04d7a5f 100644 --- a/admin/src/views/PlanMngr/Plan.vue +++ b/admin/src/views/PlanMngr/Plan.vue @@ -112,6 +112,12 @@ PlanBatchUpdatePlanType, PlanDel } from '@/api/api.js' + import { + useRoute, + useRouter + } from "vue-router" + const route = useRoute() + const router = useRouter() let loading = ref(false) let searchInfo = ref({}) let list = ref([]); @@ -274,6 +280,7 @@ }) } onMounted(() => { + searchInfo.value.date=route.query.date GetList() }) diff --git a/admin/src/views/PlanMngr/PlanList.vue b/admin/src/views/PlanMngr/PlanList.vue new file mode 100644 index 0000000..60ffda9 --- /dev/null +++ b/admin/src/views/PlanMngr/PlanList.vue @@ -0,0 +1,213 @@ + + + + + \ No newline at end of file diff --git a/admin/src/views/PlanMngr/PlanModel.vue b/admin/src/views/PlanMngr/PlanModel.vue index 04e43c6..12d4294 100644 --- a/admin/src/views/PlanMngr/PlanModel.vue +++ b/admin/src/views/PlanMngr/PlanModel.vue @@ -149,16 +149,16 @@ -
当前选择的时间段和现有如下计划时间段有重叠
+
当前选择的时间段和现有如下计划时间段有重叠,请先删除
{{item.date +' '+item.time}}