新增投标预算
This commit is contained in:
parent
eefdab587c
commit
7f3fc99309
108
app/adminapi/controller/bid/BidSecurityApplyController.php
Normal file
108
app/adminapi/controller/bid/BidSecurityApplyController.php
Normal file
@ -0,0 +1,108 @@
|
||||
<?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\controller\bid;
|
||||
|
||||
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use app\adminapi\lists\bid\BidSecurityApplyLists;
|
||||
use app\adminapi\logic\bid\BidSecurityApplyLogic;
|
||||
use app\adminapi\validate\bid\BidSecurityApplyValidate;
|
||||
|
||||
|
||||
/**
|
||||
* BidSecurityApply控制器
|
||||
* Class BidSecurityApplyController
|
||||
* @package app\adminapi\controller\bid
|
||||
*/
|
||||
class BidSecurityApplyController extends BaseAdminController
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/12/16 10:46
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new BidSecurityApplyLists());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/12/16 10:46
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$params = (new BidSecurityApplyValidate())->post()->goCheck('add');
|
||||
$result = BidSecurityApplyLogic::add($params);
|
||||
if (true === $result) {
|
||||
return $this->success('添加成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(BidSecurityApplyLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/12/16 10:46
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$params = (new BidSecurityApplyValidate())->post()->goCheck('edit');
|
||||
$result = BidSecurityApplyLogic::edit($params);
|
||||
if (true === $result) {
|
||||
return $this->success('编辑成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(BidSecurityApplyLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/12/16 10:46
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$params = (new BidSecurityApplyValidate())->post()->goCheck('delete');
|
||||
BidSecurityApplyLogic::delete($params);
|
||||
return $this->success('删除成功', [], 1, 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取详情
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/12/16 10:46
|
||||
*/
|
||||
public function detail()
|
||||
{
|
||||
$params = (new BidSecurityApplyValidate())->goCheck('detail');
|
||||
$result = BidSecurityApplyLogic::detail($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
|
||||
}
|
91
app/adminapi/lists/bid/BidSecurityApplyLists.php
Normal file
91
app/adminapi/lists/bid/BidSecurityApplyLists.php
Normal file
@ -0,0 +1,91 @@
|
||||
<?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\bid;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\bid\BidSecurityApply;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use think\facade\Db;
|
||||
|
||||
/**
|
||||
* BidSecurityApply列表
|
||||
* Class BidSecurityApplyLists
|
||||
* @package app\adminapi\listsbid
|
||||
*/
|
||||
class BidSecurityApplyLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/12/16 10:46
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['bsa.bidding_decision_id', 'bsa.applier', 'bsa.pay_type'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2023/12/16 10:46
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return Db::name('BidSecurityApply')->alias('bsa')
|
||||
->where($this->searchWhere)
|
||||
->leftJoin('bid_bidding_decision bbd','bbd.id = bsa.bidding_decision_id')
|
||||
->leftJoin('project p','p.id = bbd.project_id')
|
||||
->leftJoin('custom ct','ct.id = p.custom_id')
|
||||
->field('bsa.*, bbd.project_id, p.name as project_name, ct.name as customer_name')
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['bsa.id' => 'desc'])
|
||||
->select()->each(function($item, $key){
|
||||
//关联数据 供应商后续添加
|
||||
$item['approve_no'] = '付款单号';
|
||||
$item['approve_step'] = '流程步骤';
|
||||
$item['approve_settle_status'] = 1;
|
||||
return $item;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2023/12/16 10:46
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return Db::name('BidSecurityApply')->alias('bsa')
|
||||
->where($this->searchWhere)
|
||||
->leftJoin('bid_bidding_decision bbd','bbd.id = bsa.bidding_decision_id')
|
||||
->leftJoin('project p','p.id = bbd.project_id')
|
||||
->leftJoin('custom ct','ct.id = p.custom_id')->count();
|
||||
}
|
||||
|
||||
}
|
@ -38,7 +38,7 @@ class ContractLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['contract_name', 'contract_type', 'contract_code'],
|
||||
'=' => ['c.contract_name', 'c.contract_type', 'c.contract_code'],
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -38,14 +38,14 @@ class ProcurementContractLists extends BaseAdminDataLists implements ListsSearch
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['supplier_id', 'project_id', 'contract_no'],
|
||||
'=' => ['pc.supplier_id', 'pc.project_id', 'pc.contract_no'],
|
||||
];
|
||||
}
|
||||
|
||||
public function querySearch(): array
|
||||
{
|
||||
$queryWhere = [];
|
||||
$queryWhere['contract_cate'] = 1;
|
||||
$queryWhere['pc.contract_cate'] = 1;
|
||||
if (!empty($this->params['all'])) {
|
||||
unset($queryWhere['contract_cate']);
|
||||
}
|
||||
|
@ -40,14 +40,14 @@ class SubcontractingContractLists extends BaseAdminDataLists implements ListsSea
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['project_id', 'contract_no', 'contract_name', 'supplier_id', 'contract_type'],
|
||||
'=' => ['pc.project_id', 'pc.contract_no', 'pc.contract_name', 'pc.supplier_id', 'pc.contract_type'],
|
||||
];
|
||||
}
|
||||
|
||||
public function querySearch(): array
|
||||
{
|
||||
$queryWhere = [];
|
||||
$queryWhere['contract_cate'] = 2;
|
||||
$queryWhere['pc.contract_cate'] = 2;
|
||||
if (!empty($this->params['all'])) {
|
||||
unset($queryWhere['contract_cate']);
|
||||
}
|
||||
|
135
app/adminapi/logic/bid/BidSecurityApplyLogic.php
Normal file
135
app/adminapi/logic/bid/BidSecurityApplyLogic.php
Normal file
@ -0,0 +1,135 @@
|
||||
<?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\logic\bid;
|
||||
|
||||
|
||||
use app\common\model\bid\BidSecurityApply;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\model\custom\Custom;
|
||||
use app\common\logic\BaseLogic;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* BidSecurityApply逻辑
|
||||
* Class BidSecurityApplyLogic
|
||||
* @package app\adminapi\logic\bid
|
||||
*/
|
||||
class BidSecurityApplyLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2023/12/16 10:46
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
BidSecurityApply::create([
|
||||
'approve_id' => $params['approve_id'] ?? 0,
|
||||
'bidding_decision_id' => $params['bidding_decision_id'] ?? 0,
|
||||
'applier' => $params['applier'] ?? '',
|
||||
'pay_type' => $params['pay_type'] ?? 0,
|
||||
'refund_date' => $params['refund_date'] ?? '',
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ?? '',
|
||||
'deposit_bank' => $params['deposit_bank'] ?? '',
|
||||
'account_name' => $params['account_name'] ?? '',
|
||||
'account' => $params['account'] ?? '',
|
||||
]);
|
||||
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2023/12/16 10:46
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
BidSecurityApply::where('id', $params['id'])->update([
|
||||
'approve_id' => $params['approve_id'] ?? 0,
|
||||
'bidding_decision_id' => $params['bidding_decision_id'] ?? 0,
|
||||
'applier' => $params['applier'] ?? '',
|
||||
'pay_type' => $params['pay_type'] ?? 0,
|
||||
'refund_date' => $params['refund_date'] ?? '',
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ?? '',
|
||||
'deposit_bank' => $params['deposit_bank'] ?? '',
|
||||
'account_name' => $params['account_name'] ?? '',
|
||||
'account' => $params['account'] ?? '',
|
||||
]);
|
||||
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2023/12/16 10:46
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
return BidSecurityApply::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2023/12/16 10:46
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
$bidSecurityApply = BidSecurityApply::findOrEmpty($params['id']);
|
||||
$bidSecurityApply->project = null;
|
||||
$bidSecurityApply->custom = null;
|
||||
if (!empty($bidSecurityApply->decision->project_id)) {
|
||||
$bidSecurityApply->project = Project::findOrEmpty($bidSecurityApply->decision->project_id);
|
||||
}
|
||||
if (!empty($bidSecurityApply->project->custom_id)) {
|
||||
$bidSecurityApply->custom = Custom::findOrEmpty($bidSecurityApply->project->custom_id);
|
||||
}
|
||||
return $bidSecurityApply->toArray();
|
||||
}
|
||||
}
|
107
app/adminapi/validate/bid/BidSecurityApplyValidate.php
Normal file
107
app/adminapi/validate/bid/BidSecurityApplyValidate.php
Normal file
@ -0,0 +1,107 @@
|
||||
<?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\validate\bid;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* BidSecurityApply验证器
|
||||
* Class BidSecurityApplyValidate
|
||||
* @package app\adminapi\validate\bid
|
||||
*/
|
||||
class BidSecurityApplyValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'approve_id' => 'require',
|
||||
'bidding_decision_id' => 'require',
|
||||
'applier' => 'require',
|
||||
'pay_type' => 'require',
|
||||
'deposit_bank' => 'require',
|
||||
'account_name' => 'require',
|
||||
'account' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'bidding_decision_id' => '投标决策id',
|
||||
'applier' => '申请人',
|
||||
'pay_type' => '付款方式',
|
||||
'deposit_bank' => '开户银行',
|
||||
'account_name' => '开户名称',
|
||||
'account' => '账号',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return BidSecurityApplyValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/12/16 10:46
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->only(['approve_id','bidding_decision_id','applier','pay_type','deposit_bank','account_name','account']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return BidSecurityApplyValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/12/16 10:46
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id','approve_id','bidding_decision_id','applier','pay_type','deposit_bank','account_name','account']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return BidSecurityApplyValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/12/16 10:46
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return BidSecurityApplyValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/12/16 10:46
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
39
app/common/model/bid/BidSecurityApply.php
Normal file
39
app/common/model/bid/BidSecurityApply.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?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\common\model\bid;
|
||||
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
|
||||
/**
|
||||
* BidSecurityApply模型
|
||||
* Class BidSecurityApply
|
||||
* @package app\common\model\bid
|
||||
*/
|
||||
class BidSecurityApply extends BaseModel
|
||||
{
|
||||
|
||||
use SoftDelete;
|
||||
protected $name = 'bid_security_apply';
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
|
||||
public function decision()
|
||||
{
|
||||
return $this->belongsTo(\app\common\model\bid\BidBiddingDecision::class, 'bidding_decision_id');
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user