feat(班组): 原分包单位改为班组,修改对应逻辑 接口部分完成

master
yin5th 2023-02-09 11:08:13 +08:00
parent 2bb62a767d
commit c3b1bc0773
3 changed files with 28 additions and 2 deletions

View File

@ -5,6 +5,7 @@ namespace app\controller\api\v1;
use app\controller\api\Base; use app\controller\api\Base;
use app\model\Account; use app\model\Account;
use app\model\CheckLog; use app\model\CheckLog;
use app\model\Outsource;
use app\model\OvertimeLog; use app\model\OvertimeLog;
use app\model\Position; use app\model\Position;
use app\model\Worksite; use app\model\Worksite;
@ -27,6 +28,7 @@ class Common extends Base
'worksiteList', 'worksiteList',
'positionList', 'positionList',
'notice', 'notice',
'team',
]; ];
/** /**
@ -246,4 +248,26 @@ class Common extends Base
return $this->json(0, 'success', ['notice' => 1, 'msg' => $checkLog['refund_reason'], 'id' => $checkLog['id']]); return $this->json(0, 'success', ['notice' => 1, 'msg' => $checkLog['refund_reason'], 'id' => $checkLog['id']]);
} }
// 班组列表
public function team(): Json
{
$worksiteId = input('worksite_id/d');
$keyword = input('keyword/s');
$where = [];
if (!isset($worksiteId) || $worksiteId <= 0) {
return $this->json(4001, '请选择工地');
}
$where[] = ['worksite_id', '=', $worksiteId];
if (!empty($keyword)) {
$where[] = ['keyword', 'like', '%'.$keyword.'%'];
}
$res = Outsource::where($where)->order('sort', 'desc')->order('id', 'desc')->select();
return $this->json(0, 'success', $res);
}
} }

View File

@ -79,6 +79,7 @@ class Worker extends Base
'bank_card_img|银行卡拍照' => 'require', 'bank_card_img|银行卡拍照' => 'require',
'id_front|身份证正面' => 'require', 'id_front|身份证正面' => 'require',
'id_back|身份证反面' => 'require', 'id_back|身份证反面' => 'require',
'outsource_id|班组' => 'require',
'address_now|现住址' => 'require', 'address_now|现住址' => 'require',
]; ];
@ -97,7 +98,7 @@ class Worker extends Base
$fields = [ $fields = [
'real_name', 'mobile', 'pay', 'emergency_contact', 'emergency_phone', 'bank_card_name', 'bank_card_number', 'real_name', 'mobile', 'pay', 'emergency_contact', 'emergency_phone', 'bank_card_name', 'bank_card_number',
'bank_name', 'card_number', 'position', 'worksite_id', 'certificate', 'address_now', 'province', 'city', 'area', 'bank_name', 'card_number', 'position', 'worksite_id', 'certificate', 'address_now', 'province', 'city', 'area',
'id_front', 'id_back', 'bank_card_img', 'work_experience' 'id_front', 'id_back', 'bank_card_img', 'work_experience', 'outsource_id'
]; ];
$post = array_filter($post, function ($item, $key) use ($fields) { $post = array_filter($post, function ($item, $key) use ($fields) {
return in_array($key, $fields); return in_array($key, $fields);

View File

@ -56,8 +56,9 @@ class Account extends Base
{ {
$user = self::alias('a') $user = self::alias('a')
->leftJoin('position p', 'a.position = p.id') ->leftJoin('position p', 'a.position = p.id')
->leftJoin('outsource o', 'a.outsource_id = o.id')
->where('a.id', $accountId) ->where('a.id', $accountId)
->field('a.*,p.name as position_name') ->field('a.*,p.name as position_name,o.name as team_name')
->find(); ->find();
if (empty($user)) { if (empty($user)) {