17 changed files with 1438 additions and 2 deletions
@ -0,0 +1,31 @@
@@ -0,0 +1,31 @@
|
||||
<?php |
||||
|
||||
namespace App\Admin\Actions\Form\Follow; |
||||
|
||||
use App\Models\UsersMember; |
||||
use Dcat\Admin\Traits\LazyWidget; |
||||
use Dcat\Admin\Widgets\Form; |
||||
|
||||
class EditEnrollStatusForm extends Form |
||||
{ |
||||
use LazyWidget; |
||||
|
||||
|
||||
public function handle(array $input) |
||||
{ |
||||
$input['update_time'] = time(); |
||||
$unique_number = $this->payload['unique_number']; |
||||
$editSql = UsersMember::query()->where(['unique_number' => $unique_number])->update($input); |
||||
if (!$editSql) { |
||||
return $this->response()->error('修改录取状态失败'); |
||||
} |
||||
|
||||
return $this->response()->success('修改录取状态成功')->refresh(); |
||||
} |
||||
|
||||
|
||||
public function form(): void |
||||
{ |
||||
$this->select("enroll_status", "录取状态")->options(['1' => '已录取', '2' => '取消录取'])->default($unique_number = $this->payload['enroll_status'])->required(); |
||||
} |
||||
} |
@ -0,0 +1,83 @@
@@ -0,0 +1,83 @@
|
||||
<?php |
||||
|
||||
namespace App\Admin\Actions\Form\Follow; |
||||
|
||||
use App\Models\AdminFollowShow; |
||||
use App\Models\SecondaryCollege; |
||||
use App\Models\Speciality; |
||||
use Dcat\Admin\Traits\LazyWidget; |
||||
use Dcat\Admin\Widgets\Form; |
||||
|
||||
class FollowAdminShowForm extends Form |
||||
{ |
||||
use LazyWidget; |
||||
|
||||
public function handle(array $input) |
||||
{ |
||||
$user_id = $this->payload['user_id']; |
||||
$data = array_filter($input); |
||||
$data['updated_at'] = date('Y-m-d H:i:s', time()); |
||||
|
||||
if (AdminFollowShow::query()->where('user_id', $user_id)->exists()) { |
||||
if ($data['type'] == '1') { |
||||
$data['speciality_id'] = []; |
||||
} else { |
||||
$data['secondary_college_id'] = []; |
||||
} |
||||
$sql = AdminFollowShow::query()->where('user_id', $user_id)->update($data); |
||||
} else { |
||||
$data['user_id'] = $user_id; |
||||
$data['created_at'] = date('Y-m-d H:i:s', time()); |
||||
$sql = AdminFollowShow::query()->insert($data); |
||||
} |
||||
|
||||
if (!$sql) { |
||||
return $this->response()->error('绑定数据失败'); |
||||
} |
||||
|
||||
return $this->response()->success('绑定数据成功')->refresh(); |
||||
} |
||||
|
||||
|
||||
public function form(): void |
||||
{ |
||||
$user_id = $this->payload['user_id']; |
||||
|
||||
$info = AdminFollowShow::query()->where('user_id', $user_id)->first(); |
||||
|
||||
$this->select("type", "类型") |
||||
->options([1 => '二级学院', 2 => '专业']) |
||||
->default($info['type'] ?? '') |
||||
->when('=', 1, function (Form $form) use ($info) { |
||||
$this->multipleSelect("secondary_college_id", "二级学院") |
||||
->options(function () { |
||||
return SecondaryCollege::query()->pluck("name", "id"); |
||||
}) |
||||
->default($info['secondary_college_id'] ?? '') |
||||
->saving(function ($value) { |
||||
return json_encode($value); |
||||
}); |
||||
}) |
||||
->when('=', 2, function (Form $form) use ($info) { |
||||
$this->multipleSelect("speciality_id", "专业") |
||||
->options(function () { |
||||
$list = Speciality::query()->where("status", Speciality::STATUS_YES)->get()->toArray(); |
||||
if (empty($list)) { |
||||
return []; |
||||
} |
||||
$select = []; |
||||
foreach ($list as $item) { |
||||
$college = SecondaryCollege::query()->where("id", $item["secondary_college_id"])->first(); |
||||
$select[$item["id"]] = $item["speciality_name"] . "({$college->name})"; |
||||
} |
||||
|
||||
return $select; |
||||
}) |
||||
->default($info['speciality_id'] ?? '') |
||||
->saving(function ($value) { |
||||
return json_encode($value); |
||||
}); |
||||
}) |
||||
->required(); |
||||
} |
||||
} |
@ -0,0 +1,43 @@
@@ -0,0 +1,43 @@
|
||||
<?php |
||||
|
||||
namespace App\Admin\Actions\Form\Follow; |
||||
|
||||
use App\Models\UserFollowRecord; |
||||
use App\Models\UserFollowStatus; |
||||
use Dcat\Admin\Widgets\Form; |
||||
use Dcat\Admin\Traits\LazyWidget; |
||||
|
||||
class FollowRecordForm extends Form |
||||
{ |
||||
use LazyWidget; |
||||
|
||||
|
||||
public function handle(array $input) |
||||
{ |
||||
$unique_number = $this->payload['unique_number']; |
||||
|
||||
UserFollowRecord::query()->where(['unique_number' => $unique_number, 'is_abandon' => '1'])->update(['is_abandon' => '2', 'updated_at' => date('Y-m-d H:i:s', time())]); |
||||
$addSql = UserFollowRecord::query()->insert([ |
||||
'unique_number' => $unique_number, |
||||
'follow_id' => $input['status'], |
||||
'theme' => $input['theme'], |
||||
'follow_time' => $input['follow_time'], |
||||
'user_id' => \Admin::user()['id'], |
||||
'created_at' => date('Y-m-d H:i:s', time()), |
||||
'updated_at' => date('Y-m-d H:i:s', time()) |
||||
]); |
||||
if (!$addSql) { |
||||
return $this->response()->error('新增回访记录失败'); |
||||
} |
||||
|
||||
return $this->response()->success('新增回访记录成功')->refresh(); |
||||
} |
||||
|
||||
|
||||
public function form(): void |
||||
{ |
||||
$this->select("status", "回访状态")->options(UserFollowStatus::query()->orderByDesc('id')->pluck('name', 'id'))->required(); |
||||
$this->textarea("theme", "回访内容")->required(); |
||||
$this->datetime("follow_time", '回访时间')->required(); |
||||
} |
||||
} |
@ -0,0 +1,66 @@
@@ -0,0 +1,66 @@
|
||||
<?php |
||||
|
||||
namespace App\Admin\Controllers; |
||||
|
||||
use App\Admin\Actions\Form\Follow\FollowAdminShowForm; |
||||
use App\Models\AdminFollowShow; |
||||
use App\Models\SecondaryCollege; |
||||
use App\Models\Speciality; |
||||
use Dcat\Admin\Grid; |
||||
use Dcat\Admin\Http\Controllers\AdminController; |
||||
use Dcat\Admin\Http\Repositories\Administrator; |
||||
use Dcat\Admin\Widgets\Modal; |
||||
|
||||
class AdminFollowShowController extends AdminController |
||||
{ |
||||
public $title = '数据分配'; |
||||
|
||||
protected function grid(): Grid |
||||
{ |
||||
return Grid::make(new Administrator(), function (Grid $grid) { |
||||
$grid->column('id')->sortable(); |
||||
$grid->column('username'); |
||||
$grid->column('name'); |
||||
$grid->column('roles')->pluck('name')->label('primary', 3); |
||||
$grid->column('展示的数据')->display(function () { |
||||
$info = AdminFollowShow::query()->where(['user_id' => $this['id']])->first(); |
||||
if (!$info) { |
||||
return ""; |
||||
} else if ($info['type'] == '1') { |
||||
return SecondaryCollege::query()->whereIn('id', $info['secondary_college_id'])->pluck("name", "id")->toArray(); |
||||
} else if ($info['type'] == '2') { |
||||
$list = Speciality::query()->whereIn('id', $info['speciality_id'])->get()->toArray(); |
||||
if (empty($list)) { |
||||
return []; |
||||
} |
||||
$select = []; |
||||
foreach ($list as $item) { |
||||
$college = SecondaryCollege::query()->where("id", $item["secondary_college_id"])->first(); |
||||
$select[$item["id"]] = $item["speciality_name"] . "({$college->name})"; |
||||
} |
||||
|
||||
return $select; |
||||
} |
||||
})->label('primary'); |
||||
|
||||
$grid->filter(function (Grid\Filter $filter) { |
||||
$filter->panel(); |
||||
$filter->expand(); |
||||
$filter->equal('username')->width(2); |
||||
$filter->equal('name')->width(2); |
||||
}); |
||||
$grid->disableCreateButton(); |
||||
$grid->disableViewButton(); |
||||
$grid->disableEditButton(); |
||||
$grid->disableDeleteButton(); |
||||
|
||||
$grid->actions(function (Grid\Displayers\Actions $actions) { |
||||
$actions->append(Modal::make() |
||||
->xl() |
||||
->title('绑定数据') |
||||
->button('<i class="feather icon-plus btn-sm"> 绑定数据</i> ') |
||||
->body(FollowAdminShowForm::make()->payload(['user_id' => $actions->row['id']]))); |
||||
}); |
||||
}); |
||||
} |
||||
} |
@ -0,0 +1,141 @@
@@ -0,0 +1,141 @@
|
||||
<?php |
||||
|
||||
namespace App\Admin\Controllers; |
||||
|
||||
use App\Admin\Metrics\Examples\Follow\AllEnrollCollege; |
||||
use App\Admin\Metrics\Examples\Follow\AllEnrollSpeciality; |
||||
use App\Admin\Metrics\Examples\Follow\AllNewFollowCollege; |
||||
use App\Admin\Metrics\Examples\Follow\AllNewFollowSpeciality; |
||||
use App\Http\Controllers\Controller; |
||||
use App\Models\AdminFollowShow; |
||||
use App\Models\SecondaryCollege; |
||||
use App\Models\Speciality; |
||||
use App\Models\UserFollowStatus; |
||||
use App\Models\UsersMember; |
||||
use Dcat\Admin\Admin; |
||||
use Dcat\Admin\Grid; |
||||
use Dcat\Admin\Layout\Column; |
||||
use Dcat\Admin\Layout\Content; |
||||
use Dcat\Admin\Layout\Row; |
||||
use Illuminate\Http\Request; |
||||
|
||||
|
||||
class UserFollowOverviewController extends Controller |
||||
{ |
||||
public $showInfo; |
||||
// 回访状态 |
||||
public $followStatusList = []; |
||||
// 回访状态选项框默认值 |
||||
public $lastElement; |
||||
// 学院select选项 |
||||
public $secondaryCollegeList = []; |
||||
// 专业select选项 |
||||
public $specialityList = []; |
||||
|
||||
|
||||
public function index(Content $content): Content |
||||
{ |
||||
$this->showInfo = AdminFollowShow::query()->where(['user_id' => Admin::user()['id']])->first(); |
||||
$this->followStatusList = UserFollowStatus::query()->orderByDesc('id')->pluck('name', 'id')->toArray(); |
||||
$this->lastElement = array_slice($this->followStatusList, -1, 1, true); |
||||
$this->secondaryCollegeList = SecondaryCollege::query()->whereIn('id', $this->showInfo['secondary_college_id'] ?? [])->pluck("name", "id"); |
||||
|
||||
$list = Speciality::query()->whereIn("id", $this->showInfo['speciality_id'] ?? [])->get()->toArray(); |
||||
foreach ($list as $item) { |
||||
$college = SecondaryCollege::query()->where("id", $item["secondary_college_id"])->first(); |
||||
$this->specialityList[$item["id"]] = $item["speciality_name"] . "({$college->name})"; |
||||
} |
||||
|
||||
return $content |
||||
->header('新生数据概览') |
||||
->description('各项数据统计详情') |
||||
->body(function (Row $row) { |
||||
$row->column(12, function (Column $column) { |
||||
$getData = [ |
||||
'secondary_college_id' => request()->get('secondary_college_id', ''), |
||||
'speciality_id' => request()->get('speciality_id', ''), |
||||
'follow_id' => request()->get('follow_id', ''), |
||||
]; |
||||
if (empty($getData['secondary_college_id'])) { |
||||
$getData['secondary_college_id'] = $this->showInfo['secondary_college_id'] ?? ""; |
||||
} |
||||
|
||||
$column->row(function (Row $row) use ($getData) { |
||||
$row->column(12, $this->table($getData)); |
||||
}); |
||||
$column->row(function (Row $row) use ($getData) { |
||||
$row->column(4, new AllEnrollCollege($getData)); |
||||
$row->column(4, new AllNewFollowCollege($getData)); |
||||
}); |
||||
$column->row(function (Row $row) use ($getData) { |
||||
$row->column(4, new AllEnrollSpeciality($getData)); |
||||
$row->column(4, new AllNewFollowSpeciality($getData)); |
||||
}); |
||||
|
||||
Admin::script(<<<JS |
||||
var table = document.getElementsByClassName("data-table") |
||||
for (var i = 0; i < table.length; i++) { |
||||
table[i].style.display = "none"; |
||||
} |
||||
JS |
||||
); |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
|
||||
protected function table($getData): Grid |
||||
{ |
||||
return Grid::make(new UsersMember(), function (Grid $grid) use ($getData) { |
||||
// 禁用 |
||||
$grid->disableToolbar(); |
||||
// 禁用 |
||||
$grid->disablePagination(); |
||||
// 禁用操作 |
||||
$grid->disableActions(); |
||||
// 禁用批量操作 |
||||
$grid->disableBatchActions(); |
||||
// 禁用行选择 |
||||
$grid->disableRowSelector(); |
||||
// 禁用创建 |
||||
$grid->disableCreateButton(); |
||||
|
||||
$grid->filter(function (Grid\Filter $filter) { |
||||
$filter->panel(); |
||||
$filter->expand(); |
||||
|
||||
$filter->equal('secondary_college_id', '学院') |
||||
->select($this->secondaryCollegeList) |
||||
->load('speciality_id', '/api/getSpecialityList') |
||||
->ignore() |
||||
->width(2); |
||||
$filter->equal('speciality_id', '专业') |
||||
->select($this->specialityList) |
||||
->ignore() |
||||
->width(3); |
||||
$filter->equal('follow_id', '回访状态') |
||||
->select($this->followStatusList) |
||||
->ignore() |
||||
->width(2); |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* @desc 二级联动:学院下面的专业数据 |
||||
* @author 何鸠鸠 |
||||
*/ |
||||
public function getSpecialityList(Request $request): array |
||||
{ |
||||
$provinceId = $request->get('q'); |
||||
|
||||
$list = Speciality::query()->where("secondary_college_id", $provinceId)->get()->toArray(); |
||||
$select = []; |
||||
foreach ($list as $item) { |
||||
$college = SecondaryCollege::query()->where("id", $item["secondary_college_id"])->first(); |
||||
$select[] = ['id' => $item["id"], 'text' => $item["speciality_name"] . "({$college->name})"]; |
||||
} |
||||
return $select; |
||||
} |
||||
} |
@ -0,0 +1,197 @@
@@ -0,0 +1,197 @@
|
||||
<?php |
||||
|
||||
namespace App\Admin\Controllers; |
||||
|
||||
use App\Admin\Actions\Form\Follow\EditEnrollStatusForm; |
||||
use App\Admin\Actions\Form\Follow\FollowRecordForm; |
||||
use App\Admin\Renderable\UserFamilyMeberTable; |
||||
use App\Admin\Renderable\UserFamilyTable; |
||||
use App\Models\AdminFollowShow; |
||||
use App\Models\AdmissionNewStudents; |
||||
use App\Models\SecondaryCollege; |
||||
use App\Models\Speciality; |
||||
use App\Models\UserFollowRecord; |
||||
use App\Models\UserFollowStatus; |
||||
use App\Models\UsersMember; |
||||
use App\Services\PublicServices; |
||||
use Dcat\Admin\Admin; |
||||
use Dcat\Admin\Http\Controllers\AdminController; |
||||
use Dcat\Admin\Grid; |
||||
use Dcat\Admin\Widgets\Modal; |
||||
use Dcat\Admin\Widgets\Table; |
||||
use Illuminate\Support\Facades\DB; |
||||
|
||||
class UserFollowRecordController extends AdminController |
||||
{ |
||||
public $title = '新生名单管理'; |
||||
|
||||
|
||||
protected function grid(): Grid |
||||
{ |
||||
return Grid::make(new UsersMember(), function (Grid $grid) { |
||||
$grid->model()->with(['followRecordHasOne']); |
||||
|
||||
$showInfo = AdminFollowShow::query()->where(['user_id' => Admin::user()['id']])->first(); |
||||
$followList = UserFollowStatus::query()->pluck('name', 'id')->toArray(); |
||||
$followList[0] = '未联系'; |
||||
|
||||
// 设置学生类型默认值 |
||||
$req = request()->merge(['identity' => !empty(request()->get('identity', 1)) ? request()->get('identity', 1) : 1]); |
||||
// 显示该显示的数据 |
||||
$speciality_id = []; |
||||
if ($showInfo) { |
||||
if ($showInfo['type'] == '1') { |
||||
$speciality_id = Speciality::query()->whereIn("secondary_college_id", $showInfo['secondary_college_id'])->pluck('id')->toArray();; |
||||
} else { |
||||
$speciality_id = $showInfo['speciality_id']; |
||||
} |
||||
} |
||||
$grid->model()->whereIn('speciality_id', $speciality_id); |
||||
|
||||
$grid->column('id')->sortable(); |
||||
$grid->column('identity', '学生类型')->display(function () { |
||||
$iden = PublicServices::getInstance()->checkIsNewOldStudent($this->idcard); |
||||
return $iden == 1 ? "新生" : "老生"; |
||||
}); |
||||
$grid->column('mobile', '手机'); |
||||
$grid->column('unique_number', '用户唯一识别码'); |
||||
$grid->column('name', '姓名'); |
||||
$grid->column('idcard', '身份证'); |
||||
$grid->column('sex', '性别')->display(function () { |
||||
return $this->sex == 0 ? "未知" : ($this->sex == 1 ? "男" : "女"); |
||||
}); |
||||
$grid->column('secondary_college_id', '二级学院')->display(function () { |
||||
$info = Speciality::query()->where("id", $this->speciality_id)->first(); |
||||
if (!empty($info)) { |
||||
$secondaryInfo = SecondaryCollege::query()->where("id", $info->secondary_college_id)->first(); |
||||
if (!empty($secondaryInfo)) { |
||||
return $secondaryInfo->name; |
||||
} |
||||
} |
||||
})->help("未显示学院时请检查是否已经分配专业"); |
||||
$grid->column('speciality_id', '专业')->display(function () { |
||||
$info = Speciality::where("id", $this->speciality_id)->first(); |
||||
if (!empty($info)) { |
||||
return $info->speciality_name; |
||||
} |
||||
})->help("未显示专业时请检查是否已经分配专业"); |
||||
$grid->column('status', '状态')->using([1 => "正常", 2 => "禁用"]); |
||||
$grid->column('enroll_status', "录取状态")->using(['1' => '已录取', '2' => '取消录取']); |
||||
$grid->column('followRecordHasOne.follow_id', "回访状态")->display(function ($val) { |
||||
return (int)$val; |
||||
})->using($followList)->expand(function () use ($followList) { |
||||
$titles = ['ID', '回访状态', '回访状态', '回访时间', '用户ID']; |
||||
$data = UserFollowRecord::query() |
||||
->where(['unique_number' => $this['unique_number']]) |
||||
->orderByDesc('id') |
||||
->get(['id', 'follow_id', 'theme', 'follow_time', 'user_id']) |
||||
->map(function ($val) use ($followList) { |
||||
$val->follow_id = $followList[$val->follow_id] ?? ''; |
||||
return $val; |
||||
}) |
||||
->toArray(); |
||||
return Table::make($titles, $data); |
||||
}); |
||||
$grid->column('is_test', " 测试账号 ")->display(function () { |
||||
if ($this->is_test == UsersMember::IS_TEST_YES) { |
||||
return "是"; |
||||
} |
||||
return ""; |
||||
})->help("为测试账号时则不受系统开放时间限制"); |
||||
$grid->column('create_time', '注册时间')->display(function () { |
||||
if (!empty($this->create_time)) { |
||||
return date("Y-m-d H:i:s", $this->create_time); |
||||
} |
||||
})->sortable(); |
||||
|
||||
$grid->filter(function (Grid\Filter $filter) use ($followList, $showInfo) { |
||||
$filter->panel(); |
||||
$filter->expand(); |
||||
$filter->equal('id', 'ID')->width(2); |
||||
$filter->equal('mobile', '手机')->width(2); |
||||
$filter->equal('name', '姓名')->width(2); |
||||
$filter->equal('idcard', '身份证')->width(2); |
||||
$filter->equal('enroll_status', '录取状态')->select(['1' => '已录取', '2' => '取消录取'])->width(2); |
||||
$filter->where('follow_status', function ($query) { |
||||
$table1 = UsersMember::query()->getModel()->getTable(); |
||||
$table2 = UserFollowRecord::query()->getModel()->getTable(); |
||||
$all = DB::table("{$table1} as aa") |
||||
->leftJoin("{$table2} as bb", function ($join) { |
||||
$join->on("aa.unique_number", "=", "bb.unique_number")->where(["bb.is_abandon" => "1"]); |
||||
}) |
||||
->where(function ($query) { |
||||
if ($this->input == 0) { |
||||
$query->whereNull("bb.id"); |
||||
} else { |
||||
$query->where(["bb.follow_id" => $this->input]); |
||||
} |
||||
}) |
||||
->pluck('aa.unique_number') |
||||
->toArray(); |
||||
$query->whereIn('unique_number', $all); |
||||
}, '回访状态')->select($followList)->width(2); |
||||
$filter->where("identity", function ($query) { |
||||
$studentsIds = AdmissionNewStudents::query()->where([ |
||||
"is_new_student" => $this->input |
||||
])->get()->toArray(); |
||||
if (!empty($studentsIds)) { |
||||
$studentsIds = array_column($studentsIds, "idCard"); |
||||
} |
||||
|
||||
$query->whereIn('idcard', $studentsIds); |
||||
}, '学生类型')->select([ |
||||
"1" => "新生", |
||||
"2" => "老生" |
||||
])->default("1")->width(2); |
||||
$filter->where("secondary_college_id", function ($query) { |
||||
|
||||
$specialityIds = Speciality::query()->where("secondary_college_id", $this->input)->get()->toArray(); |
||||
if (!empty($specialityIds)) { |
||||
$specialityIds = array_column($specialityIds, "id"); |
||||
} |
||||
|
||||
$query->whereIn('speciality_id', $specialityIds); |
||||
|
||||
}, '二级学院')->select(function () use ($showInfo) { |
||||
return SecondaryCollege::query()->whereIn('id', $showInfo['secondary_college_id'] ?? [])->pluck("name", "id")->toArray(); |
||||
})->load('speciality_id', '/api/getSpecialityList')->width(3); |
||||
$filter->equal('speciality_id', '专业')->select(function () use ($showInfo) { |
||||
$list = Speciality::query()->whereIn('id', $showInfo['speciality_id'] ?? [])->get()->toArray(); |
||||
if (empty($list)) { |
||||
return []; |
||||
} |
||||
$select = []; |
||||
foreach ($list as $item) { |
||||
$college = SecondaryCollege::query()->where("id", $item["secondary_college_id"])->first(); |
||||
$select[$item["id"]] = $item["speciality_name"] . "({$college->name})"; |
||||
} |
||||
|
||||
return $select; |
||||
})->width(3); |
||||
$filter->between('create_time', '注册时间')->datetime()->toTimestamp()->width(3); |
||||
}); |
||||
|
||||
$grid->withBorder(); |
||||
$grid->disableCreateButton(); |
||||
$grid->disableEditButton(); |
||||
$grid->disableViewButton(); |
||||
$grid->disableDeleteButton(); |
||||
$grid->actions(function (Grid\Displayers\Actions $actions) { |
||||
if (Admin::user()->isRole('fuDaoYuan') || Admin::user()->isRole('administrator') || Admin::user()->isRole('System')) { |
||||
$actions->append(Modal::make() |
||||
->xl() |
||||
->title('新增回访记录') |
||||
->button('<i class="feather icon-plus btn-sm"> 新增回访记录</i> ') |
||||
->body(FollowRecordForm::make()->payload(['unique_number' => $actions->row['unique_number']]))); |
||||
} |
||||
if (Admin::user()->isRole('AdmissionOffice') || Admin::user()->isRole('administrator') || Admin::user()->isRole('System')) { |
||||
$actions->append(Modal::make() |
||||
->xl() |
||||
->title('修改录取状态') |
||||
->button('<i class="feather icon-edit-2 btn-sm"> 修改录取状态</i> ') |
||||
->body(EditEnrollStatusForm::make()->payload(['unique_number' => $actions->row['unique_number'], 'enroll_status' => $this['enroll_status']]))); |
||||
} |
||||
}); |
||||
}); |
||||
} |
||||
} |
@ -0,0 +1,62 @@
@@ -0,0 +1,62 @@
|
||||
<?php |
||||
|
||||
namespace App\Admin\Controllers; |
||||
|
||||
use App\Models\UserFollowStatus; |
||||
use Dcat\Admin\Form; |
||||
use Dcat\Admin\Grid; |
||||
use Dcat\Admin\Show; |
||||
use Dcat\Admin\Http\Controllers\AdminController; |
||||
|
||||
class UserFollowStatusController extends AdminController |
||||
{ |
||||
public $title = "回访状态管理"; |
||||
|
||||
|
||||
protected function grid() |
||||
{ |
||||
return Grid::make(new UserFollowStatus(), function (Grid $grid) { |
||||
$grid->model()->orderByDesc('id'); |
||||
|
||||
$grid->column('id')->sortable(); |
||||
$grid->column('name', '名称'); |
||||
$grid->column('created_at'); |
||||
$grid->column('updated_at')->sortable(); |
||||
|
||||
$grid->disableViewButton(); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* Make a show builder. |
||||
* |
||||
* @param mixed $id |
||||
* |
||||
* @return Show |
||||
*/ |
||||
protected function detail($id) |
||||
{ |
||||
return Show::make($id, new UserFollowStatus(), function (Show $show) { |
||||
$show->field('id'); |
||||
$show->field('name'); |
||||
$show->field('created_at'); |
||||
$show->field('updated_at'); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* Make a form builder. |
||||
* |
||||
* @return Form |
||||
*/ |
||||
protected function form() |
||||
{ |
||||
return Form::make(new UserFollowStatus(), function (Form $form) { |
||||
$form->display('id'); |
||||
$form->text('name'); |
||||
|
||||
$form->display('created_at'); |
||||
$form->display('updated_at'); |
||||
}); |
||||
} |
||||
} |
@ -0,0 +1,98 @@
@@ -0,0 +1,98 @@
|
||||
<?php |
||||
|
||||
namespace App\Admin\Metrics\Examples\Follow; |
||||
|
||||
use App\Models\SecondaryCollege; |
||||
use Dcat\Admin\Widgets\Metrics\Round; |
||||
use Illuminate\Http\Request; |
||||
|
||||
class AllColleges extends Round |
||||
{ |
||||
/** |
||||
* 初始化卡片内容 |
||||
*/ |
||||
protected function init() |
||||
{ |
||||
parent::init(); |
||||
|
||||
$this->title('全校录取人数'); |
||||
$this->chartLabels(['男生', '女生']); |
||||
|
||||
// 图表数据 |
||||
$this->withChart([0, 0]); |
||||
|
||||
// 总数 |
||||
$this->chartTotal('全部', 344); |
||||
|
||||
// $this->dropdown($data); |
||||
} |
||||
|
||||
/** |
||||
* 处理请求 |
||||
* @param Request $request |
||||
* @return void |
||||
*/ |
||||
public function handle(Request $request) |
||||
{ |
||||
// 卡片内容 |
||||
$this->withContent(0, 0, 0); |
||||
} |
||||
|
||||
/** |
||||
* 设置图表数据. |
||||
* @param array $data |
||||
* @return $this |
||||
*/ |
||||
public function withChart(array $data): AllColleges |
||||
{ |
||||
return $this->chart([ |
||||
'series' => $data, |
||||
]); |
||||
} |
||||
|
||||
/** |
||||
* 卡片内容. |
||||
* @param int $finished |
||||
* @param int $pending |
||||
* @param int $rejected |
||||
* @return $this |
||||
*/ |
||||
public function withContent(int $finished, int $pending, int $rejected): AllColleges |
||||
{ |
||||
return $this->content( |
||||
<<<HTML |
||||
<div class="col-12 d-flex flex-column flex-wrap text-center" style="max-width: 220px"> |
||||
<div class="chart-info d-flex justify-content-between mb-1 mt-2" > |
||||
<div class="series-info d-flex align-items-center"> |
||||
<i class="fa fa-circle-o text-bold-700 text-primary"></i> |
||||
<span class="text-bold-600 ml-50">全部</span> |
||||
</div> |
||||
<div class="product-result"> |
||||
<span>{$finished}</span> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="chart-info d-flex justify-content-between mb-1"> |
||||
<div class="series-info d-flex align-items-center"> |
||||
<i class="fa fa-circle-o text-bold-700 text-warning"></i> |
||||
<span class="text-bold-600 ml-50">男生</span> |
||||
</div> |
||||
<div class="product-result"> |
||||
<span>{$pending}</span> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="chart-info d-flex justify-content-between mb-1"> |
||||
<div class="series-info d-flex align-items-center"> |
||||
<i class="fa fa-circle-o text-bold-700 text-danger"></i> |
||||
<span class="text-bold-600 ml-50">女生</span> |
||||
</div> |
||||
<div class="product-result"> |
||||
<span>{$rejected}</span> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
HTML |
||||
); |
||||
} |
||||
} |
@ -0,0 +1,135 @@
@@ -0,0 +1,135 @@
|
||||
<?php |
||||
|
||||
namespace App\Admin\Metrics\Examples\Follow; |
||||
|
||||
use App\Models\AdmissionNewStudents; |
||||
use App\Models\SecondaryCollege; |
||||
use App\Models\Speciality; |
||||
use App\Models\UsersMember; |
||||
use Dcat\Admin\Widgets\Metrics\Round; |
||||
use Illuminate\Support\Facades\DB; |
||||
|
||||
|
||||
class AllEnrollCollege extends Round |
||||
{ |
||||
// 保存自定义参数 |
||||
protected $data = []; |
||||
|
||||
// 构造方法参数必须设置默认值 |
||||
public function __construct(array $data = []) |
||||
{ |
||||
$this->data = $data; |
||||
|
||||
parent::__construct(); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 初始化卡片内容 |
||||
*/ |
||||
protected function init() |
||||
{ |
||||
parent::init(); |
||||
|
||||
$this->title('各院总录取统计'); |
||||
if (is_string($this->data['secondary_college_id']) && !empty($this->data['secondary_college_id'])) { |
||||
$this->subTitle(SecondaryCollege::query()->where('id', $this->data['secondary_college_id'])->value('name')); |
||||
} else { |
||||
$this->subTitle("当前学院:全校"); |
||||
} |
||||
|
||||
// 新生数据 |
||||
$studentsIds = AdmissionNewStudents::query()->where(["is_new_student" => "1"])->pluck('idCard')->toArray(); |
||||
$all = UsersMember::query() |
||||
->whereIn("idcard", $studentsIds) |
||||
->where(function ($query) { |
||||
if (is_array($this->data['secondary_college_id'])) { |
||||
$ids = $this->data['secondary_college_id']; |
||||
} else { |
||||
$ids = explode(',', $this->data['secondary_college_id']); |
||||
} |
||||
|
||||
$specialityIds = Speciality::query()->whereIn("secondary_college_id", array_filter($ids))->pluck('id')->toArray(); |
||||
$query->whereIn('speciality_id', $specialityIds); |
||||
}) |
||||
->select('sex', DB::raw('count(*) as total')) |
||||
->groupBy('sex') |
||||
->pluck('total', 'sex') |
||||
->toArray(); |
||||
|
||||
// 总人数 |
||||
$total = array_sum($all); |
||||
// 男生 |
||||
$man = $all[1] ?? 0; |
||||
// 女生 |
||||
$girl = $all[2] ?? 0; |
||||
|
||||
$this->chartLabels(['总人数', '男生', '女生']); |
||||
$this->withContent($total, $man, $girl)->height('220px'); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 设置图表数据. |
||||
* |
||||
* @param array $data |
||||
* |
||||
* @return $this |
||||
*/ |
||||
public function withChart(array $data) |
||||
{ |
||||
return $this->chart([ |
||||
'series' => $data, |
||||
]); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 卡片内容. |
||||
* |
||||
* @param int $finished |
||||
* @param int $pending |
||||
* @param int $rejected |
||||
* |
||||
* @return $this |
||||
*/ |
||||
public function withContent($finished, $pending, $rejected) |
||||
{ |
||||
return $this->content( |
||||
<<<HTML |
||||
<div class="col-12 d-flex flex-column flex-wrap text-center" style="max-width: 220px"> |
||||
<div class="chart-info d-flex justify-content-between mb-1 mt-2" > |
||||
<div class="series-info d-flex align-items-center"> |
||||
<i class="fa fa-circle-o text-bold-700 text-primary"></i> |
||||
<span class="text-bold-600 ml-50">总人数</span> |
||||
</div> |
||||
<div class="product-result"> |
||||
<span>{$finished}</span> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="chart-info d-flex justify-content-between mb-1"> |
||||
<div class="series-info d-flex align-items-center"> |
||||
<i class="fa fa-circle-o text-bold-700 text-warning"></i> |
||||
<span class="text-bold-600 ml-50">男生</span> |
||||
</div> |
||||
<div class="product-result"> |
||||
<span>{$pending}</span> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="chart-info d-flex justify-content-between mb-1"> |
||||
<div class="series-info d-flex align-items-center"> |
||||
<i class="fa fa-circle-o text-bold-700 text-danger"></i> |
||||
<span class="text-bold-600 ml-50">女生</span> |
||||
</div> |
||||
<div class="product-result"> |
||||
<span>{$rejected}</span> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
HTML |
||||
); |
||||
} |
||||
} |
||||
|
@ -0,0 +1,149 @@
@@ -0,0 +1,149 @@
|
||||
<?php |
||||
|
||||
namespace App\Admin\Metrics\Examples\Follow; |
||||
|
||||
use App\Models\AdminFollowShow; |
||||
use App\Models\AdmissionNewStudents; |
||||
use App\Models\SecondaryCollege; |
||||
use App\Models\Speciality; |
||||
use App\Models\UsersMember; |
||||
use Dcat\Admin\Admin; |
||||
use Dcat\Admin\Widgets\Metrics\Round; |
||||
use Illuminate\Support\Facades\DB; |
||||
|
||||
class AllEnrollSpeciality extends Round |
||||
{ |
||||
// 保存自定义参数 |
||||
protected $data = []; |
||||
|
||||
// 构造方法参数必须设置默认值 |
||||
public function __construct(array $data = []) |
||||
{ |
||||
$this->data = $data; |
||||
|
||||
parent::__construct(); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 初始化卡片内容 |
||||
*/ |
||||
protected function init() |
||||
{ |
||||
parent::init(); |
||||
|
||||
$this->title('各专业录取统计'); |
||||
if (!empty($this->data['speciality_id'])) { |
||||
$specialityInfo = Speciality::query()->where('id', $this->data['speciality_id'])->first(['speciality_name', 'secondary_college_id']); |
||||
$name = ""; |
||||
if ($specialityInfo) { |
||||
$name .= $specialityInfo['speciality_name']; |
||||
$collegeName = SecondaryCollege::query()->where('id', $specialityInfo['secondary_college_id'])->value('name'); |
||||
if ($collegeName) { |
||||
$name .= "({$collegeName})"; |
||||
} |
||||
} |
||||
} else { |
||||
$name = "当前专业:无"; |
||||
} |
||||
$this->subTitle($name); |
||||
|
||||
// 新生数据 |
||||
$studentsIds = AdmissionNewStudents::query()->where(["is_new_student" => "1"])->pluck('idCard')->toArray(); |
||||
$all = UsersMember::query() |
||||
->where(['enroll_status' => '1']) |
||||
->whereIn("idcard", $studentsIds) |
||||
->where('speciality_id', $this->data['speciality_id']) |
||||
->select('sex', DB::raw('count(*) as total')) |
||||
->groupBy('sex') |
||||
->pluck('total', 'sex') |
||||
->toArray(); |
||||
|
||||
// 总人数 |
||||
$total = array_sum($all); |
||||
// 男生 |
||||
$man = $all[1] ?? 0; |
||||
// 女生 |
||||
$girl = $all[2] ?? 0; |
||||
|
||||
$this->chartLabels(['总人数', '男生', '女生']); |
||||
$this->withContent($total, $man, $girl); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 设置图表数据. |
||||
* |
||||
* @param array $data |
||||
* |
||||
* @return $this |
||||
*/ |
||||
public function withChart(array $data) |
||||
{ |
||||
return $this->chart([ |
||||
'series' => $data, |
||||
]); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* @param int $percent |
||||
* |
||||
* @return $this |
||||
*/ |
||||
public function up($percent) |
||||
{ |
||||
return $this->footer( |
||||
"<i class=\"feather icon-trending-up text-success\" style=\"padding-left: 15px;\"></i> {$percent}人 为当前年份已导入新生人数" |
||||
); |
||||
} |
||||
|
||||
/** |
||||
* 卡片内容. |
||||
* |
||||
* @param int $finished |
||||
* @param int $pending |
||||
* @param int $rejected |
||||
* |
||||
* @return $this |
||||
*/ |
||||
public function withContent($finished, $pending, $rejected) |
||||
{ |
||||
return $this->content( |
||||
<<<HTML |
||||
<div class="col-12 d-flex flex-column flex-wrap text-center" style="max-width: 220px"> |
||||
<div class="chart-info d-flex justify-content-between mb-1 mt-2" > |
||||
<div class="series-info d-flex align-items-center"> |
||||
<i class="fa fa-circle-o text-bold-700 text-primary"></i> |
||||
<span class="text-bold-600 ml-50">总人数</span> |
||||
</div> |
||||
<div class="product-result"> |
||||
<span>{$finished}</span> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="chart-info d-flex justify-content-between mb-1"> |
||||
<div class="series-info d-flex align-items-center"> |
||||
<i class="fa fa-circle-o text-bold-700 text-warning"></i> |
||||
<span class="text-bold-600 ml-50">男生</span> |
||||
</div> |
||||
<div class="product-result"> |
||||
<span>{$pending}</span> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="chart-info d-flex justify-content-between mb-1"> |
||||
<div class="series-info d-flex align-items-center"> |
||||
<i class="fa fa-circle-o text-bold-700 text-danger"></i> |
||||
<span class="text-bold-600 ml-50">女生</span> |
||||
</div> |
||||
<div class="product-result"> |
||||
<span>{$rejected}</span> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
HTML |
||||
); |
||||
} |
||||
} |
||||
|
@ -0,0 +1,147 @@
@@ -0,0 +1,147 @@
|
||||
<?php |
||||
|
||||
namespace App\Admin\Metrics\Examples\Follow; |
||||
|
||||
use App\Models\AdmissionNewStudents; |
||||
use App\Models\Speciality; |
||||
use App\Models\UserFollowRecord; |
||||
use App\Models\UserFollowStatus; |
||||
use App\Models\UsersMember; |
||||
use Dcat\Admin\Widgets\Metrics\Round; |
||||
use Illuminate\Support\Facades\DB; |
||||
|
||||
class AllNewFollowCollege extends Round |
||||
{ |
||||
// 保存自定义参数 |
||||
protected $data = []; |
||||
|
||||
// 构造方法参数必须设置默认值 |
||||
public function __construct(array $data = []) |
||||
{ |
||||
$this->data = $data; |
||||
|
||||
parent::__construct(); |
||||
} |
||||
|
||||
/** |
||||
* 初始化卡片内容 |
||||
*/ |
||||
protected function init() |
||||
{ |
||||
parent::init(); |
||||
|
||||
$this->title('各院最新回访结果'); |
||||
if (empty($this->data['follow_id'])) { |
||||
$this->subTitle('当前回访状态:未联系'); |
||||
} else { |
||||
$this->subTitle('当前回访状态:' . UserFollowStatus::query()->where(['id' => $this->data['follow_id']])->value('name')); |
||||
} |
||||
$this->chartLabels(['女生', '男生']); |
||||
$table1 = UsersMember::query()->getModel()->getTable(); |
||||
$table2 = UserFollowRecord::query()->getModel()->getTable(); |
||||
|
||||
// 新生数据 |
||||
$studentsIds = AdmissionNewStudents::query()->where(["is_new_student" => "1"])->pluck('idCard')->toArray(); |
||||
$all = DB::table("{$table1} as aa") |
||||
->leftJoin("{$table2} as bb", function ($join) { |
||||
$join->on("aa.unique_number", "=", "bb.unique_number")->where(["bb.is_abandon" => "1"]); |
||||
}) |
||||
->whereIn("aa.idcard", $studentsIds) |
||||
->where(function ($query) { |
||||
if (is_array($this->data['secondary_college_id'])) { |
||||
$ids = $this->data['secondary_college_id']; |
||||
} else { |
||||
$ids = explode(',', $this->data['secondary_college_id']); |
||||
} |
||||
|
||||
$specialityIds = Speciality::query()->whereIn("secondary_college_id", array_filter($ids))->pluck('id')->toArray(); |
||||
$query->whereIn('speciality_id', $specialityIds); |
||||
}) |
||||
->where(function ($query) { |
||||
if (empty($this->data['follow_id'])) { |
||||
$query->whereNull("bb.id"); |
||||
} else { |
||||
$query->where(["bb.follow_id" => $this->data['follow_id']]); |
||||
} |
||||
}) |
||||
->select('aa.sex', DB::raw('count(*) as total')) |
||||
->groupBy('aa.sex') |
||||
->pluck('total', 'sex') |
||||
->toArray(); |
||||
|
||||
// 总人数 |
||||
$total = array_sum($all); |
||||
// 男生 |
||||
$man = $all[1] ?? 0; |
||||
// 女生 |
||||
$girl = $all[2] ?? 0; |
||||
|
||||
// 图表数据 |
||||
$this->withChart([$man, $girl]); |
||||
// 总数 |
||||
$this->chartTotal('总人数', $girl + $man); |
||||
// 卡片内容 |
||||
$this->withContent($girl + $man, $man, $girl)->height('220px'); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 设置图表数据. |
||||
* @param array $data |
||||
* @return $this |
||||
*/ |
||||
public function withChart(array $data) |
||||
{ |
||||
$this->chartColors(['#586cb1', '#dda451', '#ea5455']); |
||||
return $this->chart([ |
||||
'series' => $data, |
||||
]); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 卡片内容. |
||||
* @param int $finished |
||||
* @param int $pending |
||||
* @param int $rejected |
||||
* @return $this |
||||
*/ |
||||
public function withContent($finished, $pending, $rejected) |
||||
{ |
||||
return $this->content( |
||||
<<<HTML |
||||
<div class="col-12 d-flex flex-column flex-wrap text-center" style="max-width: 220px"> |
||||
<div class="chart-info d-flex justify-content-between mb-1 mt-2" > |
||||
<div class="series-info d-flex align-items-center"> |
||||
<i class="fa fa-circle-o text-bold-700 text-primary"></i> |
||||
<span class="text-bold-600 ml-50">总人数</span> |
||||
</div> |
||||
<div class="product-result"> |
||||
<span>{$finished}</span> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="chart-info d-flex justify-content-between mb-1"> |
||||
<div class="series-info d-flex align-items-center"> |
||||
<i class="fa fa-circle-o text-bold-700 text-warning"></i> |
||||
<span class="text-bold-600 ml-50">男生</span> |
||||
</div> |
||||
<div class="product-result"> |
||||
<span>{$pending}</span> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="chart-info d-flex justify-content-between mb-1"> |
||||
<div class="series-info d-flex align-items-center"> |
||||
<i class="fa fa-circle-o text-bold-700 text-danger"></i> |
||||
<span class="text-bold-600 ml-50">女生</span> |
||||
</div> |
||||
<div class="product-result"> |
||||
<span>{$rejected}</span> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
HTML |
||||
); |
||||
} |
||||
} |
@ -0,0 +1,131 @@
@@ -0,0 +1,131 @@
|
||||
<?php |
||||
|
||||
namespace App\Admin\Metrics\Examples\Follow; |
||||
|
||||
use App\Models\AdmissionNewStudents; |
||||
use App\Models\Speciality; |
||||
use App\Models\UserFollowRecord; |
||||
use App\Models\UserFollowStatus; |
||||
use App\Models\UsersMember; |
||||
use Dcat\Admin\Widgets\Metrics\Round; |
||||
use Illuminate\Support\Facades\DB; |
||||
|
||||
class AllNewFollowSpeciality extends Round |
||||
{ |
||||
// 保存自定义参数 |
||||
protected $data = []; |
||||
|
||||
// 构造方法参数必须设置默认值 |
||||
public function __construct(array $data = []) |
||||
{ |
||||
$this->data = $data; |
||||
|
||||
parent::__construct(); |
||||
} |
||||
|
||||
/** |
||||
* 初始化卡片内容 |
||||
*/ |
||||
protected function init() |
||||
{ |
||||
parent::init(); |
||||
|
||||
$this->title('各专业最新回访结果'); |
||||
if (empty($this->data['follow_id'])) { |
||||
$this->subTitle('当前回访状态:未联系'); |
||||
} else { |
||||
$this->subTitle('当前回访状态:' . UserFollowStatus::query()->where(['id' => $this->data['follow_id']])->value('name')); |
||||
} |
||||
$this->chartLabels(['女生', '男生']); |
||||
$table1 = UsersMember::query()->getModel()->getTable(); |
||||
$table2 = UserFollowRecord::query()->getModel()->getTable(); |
||||
|
||||
// 新生数据 |
||||
$studentsIds = AdmissionNewStudents::query()->where(["is_new_student" => "1"])->pluck('idCard')->toArray(); |
||||
$all = DB::table("{$table1} as aa") |
||||
->leftJoin("{$table2} as bb", function ($join) { |
||||
$join->on("aa.unique_number", "=", "bb.unique_number")->where("bb.is_abandon", "=", "1"); |
||||
}) |
||||
->whereIn("aa.idcard", $studentsIds) |
||||
->where(['bb.follow_id' => $this->data['follow_id']]) |
||||
->where(['aa.speciality_id' => $this->data['speciality_id']]) |
||||
->select('sex', DB::raw('count(*) as total')) |
||||
->groupBy('sex') |
||||
->pluck('total', 'sex') |
||||
->toArray(); |
||||
|
||||
// 总人数 |
||||
$total = array_sum($all); |
||||
// 男生 |
||||
$man = $all[1] ?? 0; |
||||
// 女生 |
||||
$girl = $all[2] ?? 0; |
||||
|
||||
// 图表数据 |
||||
$this->withChart([$man, $girl]); |
||||
// 总数 |
||||
$this->chartTotal('总人数', $total); |
||||
// 卡片内容 |
||||
$this->withContent($total, $man, $girl); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 设置图表数据. |
||||
* @param array $data |
||||
* @return $this |
||||
*/ |
||||
public function withChart(array $data) |
||||
{ |
||||
$this->chartColors(['#586cb1', '#dda451', '#ea5455']); |
||||
return $this->chart([ |
||||
'series' => $data, |
||||
]); |
||||
} |
||||
|
||||
/** |
||||
* 卡片内容. |
||||
* @param int $finished |
||||
* @param int $pending |
||||
* @param int $rejected |
||||
* @return $this |
||||
*/ |
||||
public function withContent($finished, $pending, $rejected) |
||||
{ |
||||
return $this->content( |
||||
<<<HTML |
||||
<div class="col-12 d-flex flex-column flex-wrap text-center" style="max-width: 220px"> |
||||
<div class="chart-info d-flex justify-content-between mb-1 mt-2" > |
||||
<div class="series-info d-flex align-items-center"> |
||||
<i class="fa fa-circle-o text-bold-700 text-primary"></i> |
||||
<span class="text-bold-600 ml-50">总人数</span> |
||||
</div> |
||||
<div class="product-result"> |
||||
<span>{$finished}</span> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="chart-info d-flex justify-content-between mb-1"> |
||||
<div class="series-info d-flex align-items-center"> |
||||
<i class="fa fa-circle-o text-bold-700 text-warning"></i> |
||||
<span class="text-bold-600 ml-50">男生</span> |
||||
</div> |
||||
<div class="product-result"> |
||||
<span>{$pending}</span> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="chart-info d-flex justify-content-between mb-1"> |
||||
<div class="series-info d-flex align-items-center"> |
||||
<i class="fa fa-circle-o text-bold-700 text-danger"></i> |
||||
<span class="text-bold-600 ml-50">女生</span> |
||||
</div> |
||||
<div class="product-result"> |
||||
<span>{$rejected}</span> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
HTML |
||||
); |
||||
} |
||||
} |
@ -0,0 +1,99 @@
@@ -0,0 +1,99 @@
|
||||
<?php |
||||
|
||||
namespace App\Admin\Metrics\Examples\Follow; |
||||
|
||||
use App\Models\SecondaryCollege; |
||||
use App\Models\Speciality; |
||||
use Dcat\Admin\Widgets\Metrics\Round; |
||||
use Illuminate\Http\Request; |
||||
|
||||
class Allspeciality extends Round |
||||
{ |
||||
/** |
||||
* 初始化卡片内容 |
||||
*/ |
||||
protected function init() |
||||
{ |
||||
parent::init(); |
||||
|
||||
$this->title('各专业录取人数'); |
||||
$this->chartLabels(['男生', '女生']); |
||||
|
||||
// 图表数据 |
||||
$this->withChart([0, 0]); |
||||
|
||||
// 总数 |
||||
$this->chartTotal('全部', 0); |
||||
|
||||
// $this->dropdown($data); |
||||
} |
||||
|
||||
/** |
||||
* 处理请求 |
||||
* @param Request $request |
||||
* @return void |
||||
*/ |
||||
public function handle(Request $request) |
||||
{ |
||||
// 卡片内容 |
||||
$this->withContent(0, 0, 0); |
||||
} |
||||
|
||||
/** |
||||
* 设置图表数据. |
||||
* @param array $data |
||||
* @return $this |
||||
*/ |
||||
public function withChart(array $data): Allspeciality |
||||
{ |
||||
return $this->chart([ |
||||
'series' => $data, |
||||
]); |
||||
} |
||||
|
||||
/** |
||||
* 卡片内容. |
||||
* @param int $finished |
||||
* @param int $pending |
||||
* @param int $rejected |
||||
* @return $this |
||||
*/ |
||||
public function withContent(int $finished, int $pending, int $rejected): Allspeciality |
||||
{ |
||||
return $this->content( |
||||
<<<HTML |
||||
<div class="col-12 d-flex flex-column flex-wrap text-center" style="max-width: 220px"> |
||||
<div class="chart-info d-flex justify-content-between mb-1 mt-2" > |
||||
<div class="series-info d-flex align-items-center"> |
||||
<i class="fa fa-circle-o text-bold-700 text-primary"></i> |
||||
<span class="text-bold-600 ml-50">全部</span> |
||||
</div> |
||||
<div class="product-result"> |
||||
<span>{$finished}</span> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="chart-info d-flex justify-content-between mb-1"> |
||||
<div class="series-info d-flex align-items-center"> |
||||
<i class="fa fa-circle-o text-bold-700 text-warning"></i> |
||||
<span class="text-bold-600 ml-50">男生</span> |
||||
</div> |
||||
<div class="product-result"> |
||||
<span>{$pending}</span> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="chart-info d-flex justify-content-between mb-1"> |
||||
<div class="series-info d-flex align-items-center"> |
||||
<i class="fa fa-circle-o text-bold-700 text-danger"></i> |
||||
<span class="text-bold-600 ml-50">女生</span> |
||||
</div> |
||||
<div class="product-result"> |
||||
<span>{$rejected}</span> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
HTML |
||||
); |
||||
} |
||||
} |
@ -0,0 +1,18 @@
@@ -0,0 +1,18 @@
|
||||
<?php |
||||
|
||||
namespace App\Models; |
||||
|
||||
use Dcat\Admin\Traits\HasDateTimeFormatter; |
||||
|
||||
use Illuminate\Database\Eloquent\Model; |
||||
|
||||
class AdminFollowShow extends Model |
||||
{ |
||||
use HasDateTimeFormatter; |
||||
protected $table = 'admin_follow_show'; |
||||
|
||||
protected $casts = [ |
||||
'secondary_college_id' => 'array', |
||||
'speciality_id'=>'array' |
||||
]; |
||||
} |
@ -0,0 +1,14 @@
@@ -0,0 +1,14 @@
|
||||
<?php |
||||
|
||||
namespace App\Models; |
||||
|
||||
use Dcat\Admin\Traits\HasDateTimeFormatter; |
||||
|
||||
use Illuminate\Database\Eloquent\Model; |
||||
|
||||
class UserFollowRecord extends Model |
||||
{ |
||||
use HasDateTimeFormatter; |
||||
protected $table = 'user_follow_record'; |
||||
|
||||
} |
@ -0,0 +1,14 @@
@@ -0,0 +1,14 @@
|
||||
<?php |
||||
|
||||
namespace App\Models; |
||||
|
||||
use Dcat\Admin\Traits\HasDateTimeFormatter; |
||||
|
||||
use Illuminate\Database\Eloquent\Model; |
||||
|
||||
class UserFollowStatus extends Model |
||||
{ |
||||
use HasDateTimeFormatter; |
||||
protected $table = 'user_follow_status'; |
||||
|
||||
} |
Loading…
Reference in new issue