diff --git a/Laravel/app/Http/Controllers/API/Admin/YeWu/PlanController.php b/Laravel/app/Http/Controllers/API/Admin/YeWu/PlanController.php index 9d85eaf..1150667 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'])->get(); + $cha = DB::table('plans')->whereBetween('date', $Info['dateRange'])->where(['is_del'=>0])->get(); if (count($cha) > 0) { return \Yz::return(false, '号源重复', ['list' => $cha]); } @@ -133,7 +133,7 @@ class PlanController extends Controller public function GetDetail() { $id = request('id'); - $info = DB::table('plans')->where(['id' => $id])->first(); + $info = DB::table('plans')->where(['id' => $id,'is_del'=>0])->first(); if (!!$info) { if(empty($info->checkup_type_id)){ $info->checkup_type_id='[]'; @@ -209,4 +209,15 @@ class PlanController extends Controller } } + public function Del() + { + $ids = request('ids'); + $del=DB::table('plans')->whereIn('id', $ids)->where(['status'=>1])->update(['is_del'=>1]); + if($del){ + return \Yz::Return(true, '操作成功', []); + }else{ + return \Yz::echoError1('操作失败'); + } + + } } diff --git a/Laravel/routes/api.php b/Laravel/routes/api.php index 49bdc02..bfabef9 100644 --- a/Laravel/routes/api.php +++ b/Laravel/routes/api.php @@ -90,6 +90,7 @@ Route::group(['middleware' => ['checktoken', 'log'], 'prefix' => 'v1'], function Route::post('admin/PlanGetList', 'App\Http\Controllers\API\Admin\YeWu\PlanController@GetList');//号源列表 Route::post('admin/PlanGetDetail', 'App\Http\Controllers\API\Admin\YeWu\PlanController@GetDetail');//号源详情 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/ComboGetList', 'App\Http\Controllers\API\Admin\YeWu\ComboController@GetList');//获取套餐列表 diff --git a/admin/src/api/api.js b/admin/src/api/api.js index b2cc229..f573537 100644 --- a/admin/src/api/api.js +++ b/admin/src/api/api.js @@ -171,6 +171,10 @@ export const PlanGetDetail = (data = {}) => { export const PlanSave = (data = {}) => { return axios({ url: import.meta.env.VITE_APP_API + 'v1/admin/PlanSave', data: data }) } +//号源del +export const PlanDel = (data = {}) => { + return axios({ url: import.meta.env.VITE_APP_API + 'v1/admin/PlanDel', data: data }) +} //号源批量更新 export const PlanBatchUpdatePlanType = (data = {}) => { return axios({ url: import.meta.env.VITE_APP_API + 'v1/admin/PlanBatchUpdatePlanType', data: data }) diff --git a/admin/src/views/PlanMngr/Plan.vue b/admin/src/views/PlanMngr/Plan.vue index 0301ca6..b578c6d 100644 --- a/admin/src/views/PlanMngr/Plan.vue +++ b/admin/src/views/PlanMngr/Plan.vue @@ -105,7 +105,12 @@ ElMessageBox } from 'element-plus' import { - PlanGetList,PlanGetDetail,CheckUpTypeGetEnableList,PlanSave,PlanBatchUpdatePlanType + PlanGetList, + PlanGetDetail, + CheckUpTypeGetEnableList, + PlanSave, + PlanBatchUpdatePlanType, + PlanDel } from '@/api/api.js' let loading = ref(false) let searchInfo = ref({}) @@ -215,6 +220,36 @@ BatchUpdateFunc(type) } + } + const Del=()=>{ + ElMessageBox.confirm( + '确认删除所选号源吗(已被占用号源不会删除)?', + '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'error', + } + ) + .then(() => { + loading.value = true + let selected_list=[] + list.value.forEach((v,i)=>{ + if(v.selected!=undefined && v.selected==true){ + selected_list.push(v.id) + } + }) + PlanDel({ + ids: selected_list + }).then(res => { + loading.value = false + if (res.status) { + GetList() + } else { + ElMessage.error(res.msg) + } + }) + }) + } const BatchUpdateFunc=(type,info=null)=>{ loading.value = true