完成号源类型

wenjuan
yanzai 1 year ago
parent b37b3adbe2
commit cf1eb92d8d

@ -19,8 +19,9 @@ class PlanTypeController extends Controller
'checkup_type_id' => isset($Info['checkup_type_id']) ? json_encode($Info['checkup_type_id']) : null, 'checkup_type_id' => isset($Info['checkup_type_id']) ? json_encode($Info['checkup_type_id']) : null,
'amount_limit1' => isset($Info['amount_limit1']) ? $Info['amount_limit1'] : 0, 'amount_limit1' => isset($Info['amount_limit1']) ? $Info['amount_limit1'] : 0,
'amount_limit2' => isset($Info['amount_limit2']) ? $Info['amount_limit2'] : 0, 'amount_limit2' => isset($Info['amount_limit2']) ? $Info['amount_limit2'] : 0,
'status'=>isset($Info['status']) ? $Info['status'] : 0,
]; ];
$requiredFields = ['name'=>'姓名','is_vip'=>'vip类型','use_type'=>'个检/团检类型','checkup_type_id'=>'体检类型']; $requiredFields = ['name'=>'姓名','is_vip'=>'vip类型','use_type'=>'个检/团检类型','checkup_type_id'=>'体检类型','status'=>'状态'];
// 判断是否为空 // 判断是否为空
foreach ($requiredFields as $key=> $field) { foreach ($requiredFields as $key=> $field) {
if (!isset($params[$key]) || $params[$key] === null) { if (!isset($params[$key]) || $params[$key] === null) {
@ -33,7 +34,7 @@ class PlanTypeController extends Controller
$do=$table->insert($params); $do=$table->insert($params);
} }
if($Info['id']>0){ if($Info['id']>0){
$do=$table->update($params); $do=$table->where(['id'=>$Info['id']])->update($params);
} }
if($do){ if($do){
return \Yz::Return(true,'操作成功',[]); return \Yz::Return(true,'操作成功',[]);
@ -48,8 +49,54 @@ class PlanTypeController extends Controller
$pageSize =request('pageSize'); $pageSize =request('pageSize');
$searchInfo=request('searchInfo'); $searchInfo=request('searchInfo');
$list=DB::table('plan_type')->where(['is_del'=>0]); $list=DB::table('plan_type')->where(['is_del'=>0]);
if(isset($searchInfo['name'])){
$list = $list->where('name', 'like','%'.$searchInfo['name'].'%');
}
if(isset($searchInfo['status'])){
$list = $list->where('status',$searchInfo['status']);
}
$count=$list->count(); $count=$list->count();
if(isset($page) and isset($pageSize)){
$list=$list->orderBy('id', 'desc')->limit($pageSize)->skip(($page - 1) * $pageSize)->take($pageSize);
}
$list=$list ->get(); $list=$list ->get();
//匹配检查类型
$check=DB::table('checkup_type')->where(['is_del'=>0])->get();
foreach ($list as $key => $l){
$checkup_type_id=json_decode($l->checkup_type_id,true);
$CheckTypeName=[];
foreach($check as $k2=>$l2){
if(in_array($l2->id,$checkup_type_id)){
$CheckTypeName[]=$l2->name;
}
}
$l->check_type_name=$CheckTypeName;
}
return \Yz::Return(true,'查询完成',['list'=>$list,'count'=>$count]); return \Yz::Return(true,'查询完成',['list'=>$list,'count'=>$count]);
} }
public function GetDetail()
{
$id =request('id');
$info=DB::table('plan_type')->where(['id'=>$id,'is_del'=>0])->first();
if(!!$info){
$info->checkup_type_id=json_decode($info->checkup_type_id,true);
return \Yz::Return(true,'查询完成',$info);
}else{
return \Yz::echoError1('查询失败');
}
}
public function Del()
{
$id =request('id');
$d=DB::table('plan_type')->where(['id'=>$id])->update([
'is_del'=>1
]);
if($d){
return \Yz::Return(true,'操作完成',[]);
}else{
return \Yz::echoError1('操作失败');
}
}
} }

@ -52,7 +52,10 @@ Route::group(['middleware'=>['checktoken','log'],'prefix'=>'v1'],function () {
Route::post('admin/CalendarChangeInfo','App\Http\Controllers\API\Admin\YeWu\healthCalendarController@ChangeInfo'); //admin后台更新日历 Route::post('admin/CalendarChangeInfo','App\Http\Controllers\API\Admin\YeWu\healthCalendarController@ChangeInfo'); //admin后台更新日历
Route::post('admin/PlanTypeGetList','App\Http\Controllers\API\Admin\YeWu\PlanTypeController@GetList');//号源类型列表 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/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/CheckUpTypeGetEnableList','App\Http\Controllers\API\Admin\YeWu\CheckUpTypeController@GetEnableList');//可用体检类型列表 Route::post('admin/CheckUpTypeGetEnableList','App\Http\Controllers\API\Admin\YeWu\CheckUpTypeController@GetEnableList');//可用体检类型列表
Route::post('admin/PlanModelTimeList','App\Http\Controllers\API\Admin\YeWu\PlanModelController@timeList');//可用体检类型列表
}); });

@ -124,3 +124,15 @@ export const CheckUpTypeGetEnableList = (data={}) => {
export const PlanTypeSave = (data={}) => { export const PlanTypeSave = (data={}) => {
return axios({url:import.meta.env.VITE_APP_API+'v1/admin/PlanTypeSave',data:data}) return axios({url:import.meta.env.VITE_APP_API+'v1/admin/PlanTypeSave',data: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})
}
//号源模板获取时间段列表
export const PlanModelTimeList = (data={}) => {
return axios({url:import.meta.env.VITE_APP_API+'v1/admin/PlanModelTimeList',data:data})
}

@ -113,6 +113,13 @@ const router = createRouter({
meta: { meta: {
title: '号源类型' title: '号源类型'
} }
},{
path: '/planMngr/planmodel',
name: 'PlanMngrPlanModel',
component: () => import('../views/PlanMngr/PlanModel.vue'),
meta: {
title: '号源模板'
}
}] }]
}, },

@ -11,20 +11,50 @@
</el-row> </el-row>
</div> </div>
</div> </div>
<el-table :data="tableData" style="width: 100%;" row-key="id"> <el-table :data="tableData" style="width: 100%;" row-key="id" v-loading="loading">
<el-table-column prop="id" label="Id" width="100" v-if="false" /> <el-table-column prop="id" label="Id" width="100" v-if="false" />
<el-table-column prop="name" label="类型名称" /> <el-table-column prop="name" label="类型名称" />
<el-table-column prop="describe" label="描述" /> <el-table-column prop="is_vip" label="Vip">
<el-table-column prop="limosis" label="要求空腹" width="100"> <template #default="scope">
<el-tag v-if="scope.row.is_vip==0" class="ml-2" type="info"></el-tag>
<el-tag v-if="scope.row.is_vip==1" class="ml-2" type="warning">VIP</el-tag>
</template>
</el-table-column>
<el-table-column prop="use_type" label="个检/团检">
<template #default="scope">
<el-tag v-if="scope.row.use_type==0" class="ml-2"></el-tag>
<el-tag v-if="scope.row.use_type==1" class="ml-2" type="info"></el-tag>
<el-tag v-if="scope.row.use_type==2" class="ml-2" type="warning"></el-tag>
</template>
</el-table-column>
<el-table-column prop="sex" label="性别">
<template #default="scope">
<el-tag v-if="scope.row.sex==0" class="ml-2"></el-tag>
<el-tag v-if="scope.row.sex==1" class="ml-2" type="info"></el-tag>
<el-tag v-if="scope.row.sex==2" class="ml-2" type="warning"></el-tag>
</template>
</el-table-column>
<el-table-column prop="" label="体检类型" show-overflow-tooltip>
<template #default="scope">
<el-tag type="info" v-for="(item,index) in scope.row.check_type_name" :key="index" class="ml-2">{{item}}</el-tag>
</template>
</el-table-column>
<el-table-column prop="limosis" label="状态" width="100">
<template #default="scope"> <template #default="scope">
<el-tag v-if="scope.row.status==0" class="ml-2" type="danger"></el-tag> <el-tag v-if="scope.row.status==0" class="ml-2" type="danger"></el-tag>
<el-tag v-if="scope.row.status==1" class="ml-2" type="success"></el-tag> <el-tag v-if="scope.row.status==1" class="ml-2" type="success"></el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="updated_at" label="更新时间" /> <el-table-column prop="" label="更新时间">
<template #default="scope">
<span v-if="scope.row.updated_at">{{scope.row.updated_at}}</span>
<span v-else>{{scope.row.created_at}}</span>
</template>
</el-table-column>
<el-table-column prop="" label="操作" width="150"> <el-table-column prop="" label="操作" width="150">
<template #default="scope"> <template #default="scope">
<el-button type="primary" @click="EditItem(scope.row)" size="small">修改</el-button> <el-button type="primary" @click="Edit(scope.row)" size="small">修改</el-button>
<el-button type="danger" @click="Del(scope.row.id)" size="small">删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -33,48 +63,48 @@
:page-sizes="[15, 50, 100, 200]" layout="total,sizes, prev, pager, next" :total="total" :page-sizes="[15, 50, 100, 200]" layout="total,sizes, prev, pager, next" :total="total"
@size-change="PageSizeChange" @current-change="PageCurrentChange" /> @size-change="PageSizeChange" @current-change="PageCurrentChange" />
</div> </div>
<el-dialog v-model="dialogVisible" title="号源类型设置" > <el-dialog v-model="dialogVisible" title="号源类型设置">
<div class="chuansuokuang"> <div class="chuansuokuang" v-loading="loading">
<el-form :model="Info" label-width="150" style="max-width: 600px"> <el-form :model="Info" label-width="150" style="max-width: 600px">
<el-form-item label="名称"> <el-form-item label="名称">
<el-input v-model="Info.name" /> <el-input v-model="Info.name" />
</el-form-item> </el-form-item>
<el-form-item label="是否 VIP"> <el-form-item label="是否 VIP">
<el-radio-group v-model="Info.is_vip"> <el-radio-group v-model="Info.is_vip">
<el-radio label="1"></el-radio> <el-radio :label="1"></el-radio>
<el-radio label="0"></el-radio> <el-radio :label="0"></el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="个检/团检"> <el-form-item label="个检/团检">
<el-select :filterable="true" clearable v-model="Info.use_type" @change="UseTypeChange()" placeholder="选择个检/团检" <el-select :filterable="true" clearable v-model="Info.use_type"
style="margin-left: 8px;width: 150px;"> placeholder="选择个检/团检" >
<el-option label="不限" :value="0" /> <el-option label="不限" :value="0" />
<el-option label="个检" :value="1" /> <el-option label="个检" :value="1" />
<el-option label="团检" :value="2" /> <el-option label="团检" :value="2" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="性别"> <el-form-item label="性别">
<el-select :filterable="true" clearable v-model="Info.sex" placeholder="选择性别" <el-select :filterable="true" clearable v-model="Info.sex" placeholder="选择性别"
style="margin-left: 8px;width: 150px;"> >
<el-option label="不限" :value="0" /> <el-option label="不限" :value="0" />
<el-option label="男" :value="1" /> <el-option label="男" :value="1" />
<el-option label="女" :value="2" /> <el-option label="女" :value="2" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="体检类型"> <el-form-item label="体检类型">
<el-checkbox-group v-model="Info.checkup_type_id"> <el-checkbox-group v-model="Info.checkup_type_id">
<el-checkbox v-for="(item,index) in CheckUpTypeEnableList" :label="item.id"> <el-checkbox v-for="(item,index) in CheckUpTypeEnableList" :label="item.id">
{{item.name}} {{item.name}}
</el-checkbox> </el-checkbox>
</el-checkbox-group> </el-checkbox-group>
</el-form-item> </el-form-item>
<el-form-item label="体检金额限制" v-if="Info.use_type===0 || Info.use_type===1 ||Info.use_type===2"> <el-form-item label="体检金额限制" v-if="Info.use_type===0 || Info.use_type===1 ||Info.use_type===2">
<el-form-item v-if="Info.use_type===0 || Info.use_type===1" label="个检限额 0为不限" > <el-form-item v-if="Info.use_type===0 || Info.use_type===1" label="个检限额 0为不限">
<el-input v-model="Info.amount_limit1" placeholder="0"/> <el-input v-model="Info.amount_limit1" placeholder="0" />
</el-form-item> </el-form-item>
<el-form-item v-if="Info.use_type===0 || Info.use_type===2" label="团检限额 0为不限" placeholder="0"> <el-form-item v-if="Info.use_type===0 || Info.use_type===2" label="团检限额 0为不限" placeholder="0">
<el-input v-model="Info.amount_limit2" placeholder="0"/> <el-input v-model="Info.amount_limit2" placeholder="0" />
</el-form-item> </el-form-item>
</el-form-item> </el-form-item>
<el-form-item label="状态:"> <el-form-item label="状态:">
<el-switch v-model="Info.status" size="large" active-text="" inactive-text="" <el-switch v-model="Info.status" size="large" active-text="" inactive-text=""
@ -104,7 +134,11 @@
ElMessageBox ElMessageBox
} from 'element-plus' } from 'element-plus'
import { import {
PlanTypeGetList,CheckUpTypeGetEnableList,PlanTypeSave PlanTypeGetList,
CheckUpTypeGetEnableList,
PlanTypeSave,
PlanTypeGetDetail,
PlanTypeDel
} from '@/api/api.js' } from '@/api/api.js'
let loading = ref(false) let loading = ref(false)
let searchInfo = ref({}) let searchInfo = ref({})
@ -121,13 +155,13 @@
GetList() GetList()
} }
// //
let CheckUpTypeEnableList=ref([]); let CheckUpTypeEnableList = ref([]);
const GetCheckUpTypeEnableList_Func = () => { const GetCheckUpTypeEnableList_Func = () => {
loading.value = true loading.value = true
CheckUpTypeGetEnableList().then(res => { CheckUpTypeGetEnableList().then(res => {
loading.value = false loading.value = false
if (res.status) { if (res.status) {
CheckUpTypeEnableList.value=res.data.list CheckUpTypeEnableList.value = res.data.list
} else { } else {
ElMessage.error(res.msg) ElMessage.error(res.msg)
} }
@ -152,9 +186,9 @@
let Info = ref({}); let Info = ref({});
let dialogVisible = ref(false); let dialogVisible = ref(false);
const Add = () => { const Add = () => {
Info.value={} Info.value = {}
Info.value.id=0 Info.value.id = 0
Info.value.status=1 Info.value.status = 1
dialogVisible.value = true dialogVisible.value = true
GetCheckUpTypeEnableList_Func() GetCheckUpTypeEnableList_Func()
} }
@ -165,14 +199,44 @@
}).then(res => { }).then(res => {
loading.value = false loading.value = false
if (res.status) { if (res.status) {
dialogVisible.value = false
GetList()
} else { } else {
ElMessage.error(res.msg) ElMessage.error(res.msg)
} }
}) })
} }
const UseTypeChange=()=>{ const Edit=(row)=>{
dialogVisible.value = true
Info.value = {}
GetDetailFunc(row.id)
}
//
const GetDetailFunc=(id)=>{
loading.value = true
PlanTypeGetDetail({
id: id
}).then(res => {
loading.value = false
if (res.status) {
Info.value=res.data
} else {
ElMessage.error(res.msg)
}
})
}
const Del=(id)=>{
loading.value = true
PlanTypeDel({
id: id
}).then(res => {
loading.value = false
if (res.status) {
GetList()
} else {
ElMessage.error(res.msg)
}
})
} }
onMounted(() => { onMounted(() => {
GetList() GetList()

Loading…
Cancel
Save