112 lines
4.2 KiB
PHP
112 lines
4.2 KiB
PHP
<?php
|
||
// +----------------------------------------------------------------------
|
||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||
// +----------------------------------------------------------------------
|
||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||
// | 开源版本可自由商用,可去除界面版权logo
|
||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||
// | 访问官网:https://www.likeadmin.cn
|
||
// | likeadmin团队 版权所有 拥有最终解释权
|
||
// +----------------------------------------------------------------------
|
||
// | author: likeadminTeam
|
||
// +----------------------------------------------------------------------
|
||
|
||
namespace app\adminapi\lists\marketing;
|
||
|
||
use app\adminapi\lists\BaseAdminDataLists;
|
||
use app\common\lists\ListsSearchInterface;
|
||
use app\common\model\auth\Admin;
|
||
use app\common\model\dept\Dept;
|
||
use app\common\model\marketing\MarketingContract;
|
||
use app\common\model\marketing\MarketingCustom;
|
||
use app\common\model\oa\FlowApprove;
|
||
|
||
|
||
/**
|
||
* 市场经营--补充协议列表
|
||
* Class MarketingSupplementaryAgreementLists
|
||
* @package app\adminapi\listsmarketing
|
||
*/
|
||
class MarketingSupplementaryAgreementLists extends BaseAdminDataLists implements ListsSearchInterface
|
||
{
|
||
|
||
|
||
/**
|
||
* @notes 设置搜索条件
|
||
* @return \string[][]
|
||
* @author likeadmin
|
||
* @date 2024/04/01 14:26
|
||
*/
|
||
public function setSearch(): array
|
||
{
|
||
return [
|
||
'=' => ['business_nature', 'signed_dept', 'part_a', 'related_contract_id'],
|
||
'%like%' => ['contract_name'],
|
||
];
|
||
}
|
||
|
||
|
||
/**
|
||
* @notes 获取市场经营--补充协议列表
|
||
* @return array
|
||
* @throws \think\db\exception\DataNotFoundException
|
||
* @throws \think\db\exception\DbException
|
||
* @throws \think\db\exception\ModelNotFoundException
|
||
* @author likeadmin
|
||
* @date 2024/04/01 14:26
|
||
*/
|
||
public function lists(): array
|
||
{
|
||
return MarketingContract::withoutField('update_time,delete_time')->where($this->searchWhere)->where('contract_type', 1)
|
||
->limit($this->limitOffset, $this->limitLength)
|
||
->order(['id' => 'desc'])
|
||
->select()->each(function ($data) {
|
||
$contract = MarketingContract::field('contract_name')->where('id', $data['related_contract_id'])->findOrEmpty();
|
||
$custom = MarketingCustom::field('name')->where('id', $data['part_a'])->findOrEmpty();
|
||
$dept = Dept::field('name')->where('id', $data['signed_dept'])->findOrEmpty();
|
||
$admin = Admin::where('id', 'in', [$data['part_b_signatory'], $data['signed_head'], $data['seal_user']])->column('name', 'id');
|
||
$data['supplementary_agreement_name'] = $contract['contract_name'];
|
||
$data['part_a_name'] = $custom['name'];
|
||
$data['part_b_signatory_name'] = $admin[$data['part_b_signatory']];
|
||
$data['signed_dept_name'] = $dept['name'];
|
||
$data['signed_head_name'] = $admin[$data['signed_head']];
|
||
$data['seal_user_name'] = $admin[$data['seal_user']];
|
||
$data['business_nature_text'] = $data->business_nature_text;
|
||
$data['agreement_nature_text'] = $data->agreement_nature_text;
|
||
$data['seal_name_text'] = $data->seal_name_text;
|
||
$data['is_limit_text'] = $data->is_limit_text;
|
||
$data['file_type_text'] = $data->file_type_text;
|
||
$data['contract_type_text'] = $data->contract_type_text;
|
||
$data['review_status_text'] = $data->review_status_text;
|
||
if (!empty($data['approve_id'])) {
|
||
$approve = FlowApprove::field('check_status')->where('content_id', $data['id'])->where('content_model', 'app\common\model\marketing\MarketingContract')->findOrEmpty();
|
||
$data['approve_status'] = $approve['check_status'];
|
||
$data['approve_status_text'] = match ($approve['check_status']) {
|
||
0 => '待审核',
|
||
1 => '审核中',
|
||
2 => '审核通过',
|
||
3 => '审核不通过',
|
||
4 => '撤销审核',
|
||
};
|
||
} else {
|
||
$data['approve_status'] = 0;
|
||
$data['approve_status_text'] = '待审核';
|
||
}
|
||
})
|
||
->toArray();
|
||
}
|
||
|
||
|
||
/**
|
||
* @notes 获取市场经营--补充协议数量
|
||
* @return int
|
||
* @author likeadmin
|
||
* @date 2024/04/01 14:26
|
||
*/
|
||
public function count(): int
|
||
{
|
||
return MarketingContract::where($this->searchWhere)->where('contract_type', 1)->count();
|
||
}
|
||
|
||
} |