From 1d6dd6c067a3ff9785e84a24b4bc279502c30745 Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Wed, 25 Jun 2025 22:21:58 +0800 Subject: [PATCH] =?UTF-8?q?[xzgl]=E4=BC=81=E4=B8=9A=E8=AF=81=E4=B9=A6?= =?UTF-8?q?=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/xzgl/Service.php | 5 +- app/xzgl/controller/CompanyCert.php | 87 ++++++++++++++++++++ app/xzgl/model/XzglCompanyCert.php | 37 +++++++++ app/xzgl/model/XzglProfile.php | 4 + app/xzgl/view/company_cert/form.html | 63 ++++++++++++++ app/xzgl/view/company_cert/index.html | 47 +++++++++++ app/xzgl/view/company_cert/index_search.html | 35 ++++++++ app/xzgl/view/user/index_search.html | 2 +- 8 files changed, 276 insertions(+), 4 deletions(-) create mode 100644 app/xzgl/controller/CompanyCert.php create mode 100644 app/xzgl/model/XzglCompanyCert.php create mode 100644 app/xzgl/view/company_cert/form.html create mode 100644 app/xzgl/view/company_cert/index.html create mode 100644 app/xzgl/view/company_cert/index_search.html diff --git a/app/xzgl/Service.php b/app/xzgl/Service.php index 9363550..a47a228 100644 --- a/app/xzgl/Service.php +++ b/app/xzgl/Service.php @@ -16,14 +16,13 @@ class Service extends Plugin 'name' => '行政管理', 'subs' => [ ['name' => '员工档案', 'icon' => 'layui-icon layui-icon-group', 'url' => 'xzgl/user/index'], - ['name' => '通知公告', 'icon' => 'layui-icon layui-icon-cols', 'url' => 'xzgl/notice/index'], ] ], [ 'name' => '证书管理', 'subs' => [ - ['name' => '证书管理', 'icon' => 'layui-icon layui-icon-auz', 'url' => 'xzgl/staff_cert/index'], - ['name' => '证书管理', 'icon' => 'layui-icon layui-icon-auz', 'url' => 'xzgl/company_cert/index'], + ['name' => '员工证书管理', 'icon' => 'layui-icon layui-icon-auz', 'url' => 'xzgl/staff_cert/index'], + ['name' => '企业证书管理', 'icon' => 'layui-icon layui-icon-auz', 'url' => 'xzgl/company_cert/index'], ] ] ]; diff --git a/app/xzgl/controller/CompanyCert.php b/app/xzgl/controller/CompanyCert.php new file mode 100644 index 0000000..ab01749 --- /dev/null +++ b/app/xzgl/controller/CompanyCert.php @@ -0,0 +1,87 @@ +title = '企业证书管理'; + XzglCompanyCert::mQuery()->layTable(function () { + $this->levels = SystemBase::items('企业证书等级'); + }, static function (QueryHelper $query) { + $query->like('name')->dateBetween('valid_before')->equal('level'); + }); + } + + /** + * 查看企业证书 + * @auth false + * @return void + */ + public function view() + { + XzglCompanyCert::mForm('view'); + } + + /** + * 添加企业证书 + * @auth true + * @return void + */ + public function add() + { + XzglCompanyCert::mForm('form'); + } + + /** + * 编辑企业证书 + * @auth true + * @return void + */ + public function edit() + { + XzglCompanyCert::mForm('form'); + } + + protected function _form_filter(&$vo) + { + if ($this->request->isPost()) { + if (empty($vo['valid_before'])) { + unset($vo['valid_before']); + } +// if (empty($vo['valid_after'])) { +// unset($vo['valid_after']); +// } + if (empty($vo['id'])) { + $vo['create_by'] = session('user.id'); + } + $vo['update_by'] = session('user.id'); + } else { + $this->levels = SystemBase::items('企业证书等级'); + } + } + + /** + * 删除企业证书 + * @return void + */ + public function remove() + { + XzglCompanyCert::mDelete(); + } +} \ No newline at end of file diff --git a/app/xzgl/model/XzglCompanyCert.php b/app/xzgl/model/XzglCompanyCert.php new file mode 100644 index 0000000..244adbd --- /dev/null +++ b/app/xzgl/model/XzglCompanyCert.php @@ -0,0 +1,37 @@ +where('is_deleted', '=', 1); + } + + public function scopeNotDeleted(Query $query): void + { + $query->where('is_deleted', '=', 0); + } + + public function getLevelNameAttr($value, $data) + { + $levels = SystemBase::items('企业证书等级'); + if (isset($levels[$data['level']])) { + return $levels[$data['level']]['name']; + } else { + return $data['level']; + } + } +} \ No newline at end of file diff --git a/app/xzgl/model/XzglProfile.php b/app/xzgl/model/XzglProfile.php index 684b441..8ece272 100644 --- a/app/xzgl/model/XzglProfile.php +++ b/app/xzgl/model/XzglProfile.php @@ -8,6 +8,10 @@ use think\model\relation\HasOne; class XzglProfile extends Model { + protected $createTime = 'create_at'; + protected $updateTime = 'update_at'; + protected $oplogName = '人员资料'; + protected $oplogType = '人员资料管理'; public function user(): HasOne { return $this->hasOne(StaffUser::class, 'id', 'id')->with(['dept', 'sys_user']); diff --git a/app/xzgl/view/company_cert/form.html b/app/xzgl/view/company_cert/form.html new file mode 100644 index 0000000..dbf7e04 --- /dev/null +++ b/app/xzgl/view/company_cert/form.html @@ -0,0 +1,63 @@ +
+ \ No newline at end of file diff --git a/app/xzgl/view/company_cert/index.html b/app/xzgl/view/company_cert/index.html new file mode 100644 index 0000000..5846875 --- /dev/null +++ b/app/xzgl/view/company_cert/index.html @@ -0,0 +1,47 @@ +{extend name='table'} + +{block name="button"} + + + +{/block} + +{block name="content"} +