diff --git a/app/xzgl/controller/StaffCert.php b/app/xzgl/controller/StaffCert.php new file mode 100644 index 0000000..ed0e776 --- /dev/null +++ b/app/xzgl/controller/StaffCert.php @@ -0,0 +1,89 @@ +title = '员工证书管理'; + XzglStaffCert::mQuery()->layTable(function () { + $this->zclb = SystemBase::items('员工注册类别'); + $this->zczy = SystemBase::items('员工注册专业'); + $this->zsjb = SystemBase::items('员工证书级别'); + }, static function (QueryHelper $query) { + $query->with('staff'); + $query->equal('status,zclb,zczy,zsjb')->dateBetween('create_at,valid_before'); + }); + } + + /** + * 添加员工证书 + * @auth true + */ + public function add() + { + XzglStaffCert::mForm('form'); + } + + /** + * 编辑员工证书 + * @auth true + */ + public function edit() + { + XzglStaffCert::mForm('form'); + } + + protected function _form_filter(&$vo) + { + if ($this->request->isPost()) { + $data = $this->_vali([ + 'staff_id.require' => '员工ID不能为空!', +// 'zclb.require' => '员工注册类别不能为空!', +// 'zczy.require' => '员工注册专业不能为空!', +// 'zsjb.require' => '员工证书级别不能为空!', +// 'zsxq.require' => '员工证书详情不能为空!', + ]); + 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'); + } + } else { + $this->zclb = SystemBase::items('员工注册类别'); + $this->zczy = SystemBase::items('员工注册专业'); + $this->zsjb = SystemBase::items('员工证书级别'); + $this->staffs = StaffUser::mk()->field("id, name")->select(); + } + } + + /** + * 删除员工证书 + * @auth true + */ + public function remove() + { + XzglStaffCert::mDelete(); + } +} \ No newline at end of file diff --git a/app/xzgl/model/XzglStaffCert.php b/app/xzgl/model/XzglStaffCert.php new file mode 100644 index 0000000..7c6ca27 --- /dev/null +++ b/app/xzgl/model/XzglStaffCert.php @@ -0,0 +1,67 @@ +where('is_deleted', '=', 1); + } + + public function scopeNotDeleted(Query $query): void + { + $query->where('is_deleted', '=', 0); + } + + public function staff() + { + return $this->hasOne(StaffUser::class, 'id', 'staff_id'); + } + + public function getStaffNameAttr($value, $data) + { + return $this->staff ? $this->staff['name'] : ''; + } + + public function getZclbNameAttr($value, $data) + { + $zclb = SystemBase::items('员工注册类别'); + if (isset($zclb[$data['zclb']])) { + return $zclb[$data['zclb']]['name']; + } else { + return $data['zclb']; + } + } + + public function getZczyNameAttr($value, $data) + { + $zczy = SystemBase::items('员工注册专业'); + if (isset($zczy[$data['zczy']])) { + return $zczy[$data['zczy']]['name']; + } else { + return $data['zczy']; + } + } + + public function getZsjbNameAttr($value, $data) + { + $zsjb = SystemBase::items('员工证书级别'); + if (isset($zsjb[$data['zsjb']])) { + return $zsjb[$data['zsjb']]['name']; + } else { + return $data['zsjb']; + } + } +} \ No newline at end of file diff --git a/app/xzgl/view/staff_cert/form.html b/app/xzgl/view/staff_cert/form.html new file mode 100644 index 0000000..446f4f9 --- /dev/null +++ b/app/xzgl/view/staff_cert/form.html @@ -0,0 +1,120 @@ +
+
+
+ 基础信息 +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ 备注 +
+ +
+ +
+
+
+
+
+ {notempty name='$get.id'}{/notempty} + +
+ + +
+
+ \ No newline at end of file diff --git a/app/xzgl/view/staff_cert/index.html b/app/xzgl/view/staff_cert/index.html new file mode 100644 index 0000000..9ab97d9 --- /dev/null +++ b/app/xzgl/view/staff_cert/index.html @@ -0,0 +1,50 @@ +{extend name='table'} + +{block name="button"} + + + +{/block} + +{block name="content"} +
+ {include file="staff_cert/index_search"} +
+
+ + +{/block} \ No newline at end of file diff --git a/app/xzgl/view/staff_cert/index_search.html b/app/xzgl/view/staff_cert/index_search.html new file mode 100644 index 0000000..5f90464 --- /dev/null +++ b/app/xzgl/view/staff_cert/index_search.html @@ -0,0 +1,61 @@ +
+ {:lang('条件搜索')} + +
\ No newline at end of file