98 lines
3.1 KiB
PHP
98 lines
3.1 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\controller\material;
|
||
|
||
|
||
use app\adminapi\controller\BaseAdminController;
|
||
use app\adminapi\lists\material\MaterialPurchaseRequestLists;
|
||
use app\adminapi\logic\material\MaterialPurchaseRequestLogic;
|
||
use app\adminapi\validate\material\MaterialPurchaseRequestValidate;
|
||
use app\common\model\oa\Flow;
|
||
use app\common\model\oa\FlowType;
|
||
|
||
|
||
/**
|
||
* 材料采购申请控制器
|
||
* Class MaterialPurchaseRequestController
|
||
* @package app\adminapi\controller\material
|
||
*/
|
||
class MaterialPurchaseRequestController extends BaseAdminController
|
||
{
|
||
|
||
|
||
/**
|
||
* @notes 获取材料采购申请列表
|
||
* @return \think\response\Json
|
||
* @author likeadmin
|
||
* @date 2024/01/09 13:47
|
||
*/
|
||
public function lists()
|
||
{
|
||
return $this->dataLists(new MaterialPurchaseRequestLists());
|
||
}
|
||
|
||
|
||
/**
|
||
* @notes 添加材料采购申请
|
||
* @return \think\response\Json
|
||
* @author likeadmin
|
||
* @date 2024/01/09 13:47
|
||
*/
|
||
public function add()
|
||
{
|
||
$params = (new MaterialPurchaseRequestValidate())->post()->goCheck('add');
|
||
$result = MaterialPurchaseRequestLogic::add($params,$this->adminId);
|
||
if (true === $result) {
|
||
return $this->success('添加成功', [], 1, 1);
|
||
}
|
||
return $this->fail(MaterialPurchaseRequestLogic::getError());
|
||
}
|
||
|
||
|
||
|
||
/**
|
||
* @notes 获取材料采购申请详情
|
||
* @return \think\response\Json
|
||
* @author likeadmin
|
||
* @date 2024/01/09 13:47
|
||
*/
|
||
public function detail()
|
||
{
|
||
$params = (new MaterialPurchaseRequestValidate())->goCheck('detail');
|
||
$result = MaterialPurchaseRequestLogic::detail($params);
|
||
return $this->data($result);
|
||
}
|
||
|
||
public function flows(): \think\response\Json
|
||
{
|
||
$flow_type = FlowType::where('type',5)->where('name','cgsq')->findOrEmpty();
|
||
$data = Flow::field('id,name')->where('flow_cate',$flow_type['id'])->where('status',2)->select();
|
||
return $this->success('请求成功',$data->toArray());
|
||
}
|
||
|
||
//添加审批
|
||
public function approve(): \think\response\Json
|
||
{
|
||
$params = (new MaterialPurchaseRequestValidate())->post()->goCheck('approve');
|
||
$result = MaterialPurchaseRequestLogic::approve($params,$this->adminId);
|
||
if (true === $result) {
|
||
return $this->success('提交审核信息成功', [], 1, 1);
|
||
}
|
||
return $this->fail(MaterialPurchaseRequestLogic::getError());
|
||
}
|
||
|
||
|
||
} |