diff --git a/Laravel/app/Http/Controllers/API/Admin/YeWu/PlanModelController.php b/Laravel/app/Http/Controllers/API/Admin/YeWu/PlanModelController.php index afc4ad5..f71e6ad 100644 --- a/Laravel/app/Http/Controllers/API/Admin/YeWu/PlanModelController.php +++ b/Laravel/app/Http/Controllers/API/Admin/YeWu/PlanModelController.php @@ -99,6 +99,18 @@ class PlanModelController extends Controller return \Yz::echoError1('查询失败'); } } + public function Del() + { + $id =request('id'); + $d=DB::table('plan_model')->where(['id'=>$id])->update([ + 'is_del'=>1 + ]); + if($d){ + return \Yz::Return(true,'操作完成',[]); + }else{ + return \Yz::echoError1('操作失败'); + } + } function timeArr($start_time, $end_time, $interval_time, $arr = []) { @@ -106,4 +118,5 @@ class PlanModelController extends Controller $arr[] = date('H:i', strtotime($start_time)); return $this->timeArr(date('Y-m-d H:i:s', strtotime($start_time) + ($interval_time * 60)), $end_time, $interval_time, $arr); } + } diff --git a/Laravel/routes/api.php b/Laravel/routes/api.php index 7bd9239..7700904 100644 --- a/Laravel/routes/api.php +++ b/Laravel/routes/api.php @@ -53,12 +53,13 @@ Route::group(['middleware'=>['checktoken','log'],'prefix'=>'v1'],function () { Route::post('admin/PlanTypeGetList','App\Http\Controllers\API\Admin\YeWu\PlanTypeController@GetList');//号源类型列表 Route::post('admin/PlanTypeSave','App\Http\Controllers\API\Admin\YeWu\PlanTypeController@Save');//号源类型保存 Route::post('admin/PlanTypeGetDetail','App\Http\Controllers\API\Admin\YeWu\PlanTypeController@GetDetail');//号源类型详情 - Route::post('admin/PlanTypeDel','App\Http\Controllers\API\Admin\YeWu\PlanTypeController@Del');//号源类型详情 + Route::post('admin/PlanTypeDel','App\Http\Controllers\API\Admin\YeWu\PlanTypeController@Del');//号源类型删除 Route::post('admin/CheckUpTypeGetEnableList','App\Http\Controllers\API\Admin\YeWu\CheckUpTypeController@GetEnableList');//可用体检类型列表 Route::post('admin/PlanModelTimeList','App\Http\Controllers\API\Admin\YeWu\PlanModelController@timeList');//获取时间点列表 Route::post('admin/PlanModelSave','App\Http\Controllers\API\Admin\YeWu\PlanModelController@Save');//保存号源模板 Route::post('admin/PlanModelGetList','App\Http\Controllers\API\Admin\YeWu\PlanModelController@GetList');//号源模板列表 Route::post('admin/PlanModelGetDetail','App\Http\Controllers\API\Admin\YeWu\PlanModelController@GetDetail');//号源模板详情 + Route::post('admin/PlanModelDel','App\Http\Controllers\API\Admin\YeWu\PlanModelController@Del');//号源模板删除 }); diff --git a/admin/src/api/api.js b/admin/src/api/api.js index e049154..db734b8 100644 --- a/admin/src/api/api.js +++ b/admin/src/api/api.js @@ -128,7 +128,7 @@ export const PlanTypeSave = (data={}) => { export const PlanTypeGetDetail = (data={}) => { return axios({url:import.meta.env.VITE_APP_API+'v1/admin/PlanTypeGetDetail',data:data}) } -//号源类型详情 +//删除号源类型 export const PlanTypeDel = (data={}) => { return axios({url:import.meta.env.VITE_APP_API+'v1/admin/PlanTypeDel',data:data}) } @@ -147,4 +147,8 @@ export const PlanModelGetList = (data={}) => { //号源模板详情 export const PlanModelGetDetail = (data={}) => { return axios({url:import.meta.env.VITE_APP_API+'v1/admin/PlanModelGetDetail',data:data}) +} +//删除号源模板 +export const PlanModelDel = (data={}) => { + return axios({url:import.meta.env.VITE_APP_API+'v1/admin/PlanModelDel',data:data}) } \ No newline at end of file diff --git a/admin/src/views/PlanMngr/PlanModel.vue b/admin/src/views/PlanMngr/PlanModel.vue index be17065..aa367ac 100644 --- a/admin/src/views/PlanMngr/PlanModel.vue +++ b/admin/src/views/PlanMngr/PlanModel.vue @@ -52,7 +52,7 @@ + range-separator="至" start-placeholder="开始时间" end-placeholder="结束时间" @change="TimeRangeChange()"/> @@ -73,8 +73,9 @@ {{item.time}} - + + 未选中则为预留号源 @@ -102,7 +103,8 @@ PlanModelTimeList, PlanModelSave, PlanModelGetList, - PlanModelGetDetail + PlanModelGetDetail, + PlanModelDel } from '@/api/api.js' let loading = ref(false) let searchInfo = ref({}) @@ -164,14 +166,19 @@ } const handle = (e) => { Info.value.interval_time = e + setTimeout(() => { GetTimeList() }, 500) } + //改变时间段选择 + const TimeRangeChange=()=>{ + GetTimeList() + } //获取时间段列表 let timeList = ref([]) - const GetTimeList = () => { + const GetTimeList = (type='') => { timeList.value = [] loading.value = true PlanModelTimeList({ @@ -180,11 +187,29 @@ }).then(res => { loading.value = false if (res.status) { + let time_obj = {} res.data.list.forEach((v, i) => { - timeList.value.push({ - time: v - }) - }); + + if (type=='detail' ) { //如果是 编辑模式,回显详情 + if (Info.value.y_number.includes(i)) { + time_obj = { + time: v + } + } else { + time_obj = { + time: v, + class: "timelist_button_selected" + } + + } + + }else{ + time_obj = { + time: v + } + } + timeList.value.push(time_obj) + }) } else { ElMessage.error(res.msg) } @@ -220,21 +245,33 @@ } }) } - const Edit=(row)=>{ + const Edit = (row) => { dialogVisible.value = true GetPlanTypeList() GetDetail(row.id) - } - const GetDetail=(id)=>{ + const GetDetail = (id) => { loading.value = true PlanModelGetDetail({ id: id }).then(res => { loading.value = false if (res.status) { - Info.value=res.data - GetTimeList() + Info.value = res.data + GetTimeList('detail') + } else { + ElMessage.error(res.msg) + } + }) + } + const Del=(id)=>{ + loading.value = true + PlanModelDel({ + id: id + }).then(res => { + loading.value = false + if (res.status) { + GetList() } else { ElMessage.error(res.msg) }