新增费用预算
This commit is contained in:
parent
1f3f881d2c
commit
363d278fe1
108
app/adminapi/controller/cost/CostBudgetController.php
Normal file
108
app/adminapi/controller/cost/CostBudgetController.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\cost;
|
||||
|
||||
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use app\adminapi\lists\cost\CostBudgetLists;
|
||||
use app\adminapi\logic\cost\CostBudgetLogic;
|
||||
use app\adminapi\validate\cost\CostBudgetValidate;
|
||||
|
||||
|
||||
/**
|
||||
* CostBudget控制器
|
||||
* Class CostBudgetController
|
||||
* @package app\adminapi\controller\cost
|
||||
*/
|
||||
class CostBudgetController extends BaseAdminController
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 11:26
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new CostBudgetLists());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 11:26
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$params = (new CostBudgetValidate())->post()->goCheck('add');
|
||||
$result = CostBudgetLogic::add($params);
|
||||
if (true === $result) {
|
||||
return $this->success('添加成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(CostBudgetLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 11:26
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$params = (new CostBudgetValidate())->post()->goCheck('edit');
|
||||
$result = CostBudgetLogic::edit($params);
|
||||
if (true === $result) {
|
||||
return $this->success('编辑成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(CostBudgetLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 11:26
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$params = (new CostBudgetValidate())->post()->goCheck('delete');
|
||||
CostBudgetLogic::delete($params);
|
||||
return $this->success('删除成功', [], 1, 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取详情
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 11:26
|
||||
*/
|
||||
public function detail()
|
||||
{
|
||||
$params = (new CostBudgetValidate())->goCheck('detail');
|
||||
$result = CostBudgetLogic::detail($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
|
||||
}
|
108
app/adminapi/controller/cost/CostBudgetDetailController.php
Normal file
108
app/adminapi/controller/cost/CostBudgetDetailController.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\cost;
|
||||
|
||||
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use app\adminapi\lists\cost\CostBudgetDetailLists;
|
||||
use app\adminapi\logic\cost\CostBudgetDetailLogic;
|
||||
use app\adminapi\validate\cost\CostBudgetDetailValidate;
|
||||
|
||||
|
||||
/**
|
||||
* CostBudgetDetail控制器
|
||||
* Class CostBudgetDetailController
|
||||
* @package app\adminapi\controller\cost
|
||||
*/
|
||||
class CostBudgetDetailController extends BaseAdminController
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 11:22
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new CostBudgetDetailLists());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 11:22
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$params = (new CostBudgetDetailValidate())->post()->goCheck('add');
|
||||
$result = CostBudgetDetailLogic::add($params);
|
||||
if (true === $result) {
|
||||
return $this->success('添加成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(CostBudgetDetailLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 11:22
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$params = (new CostBudgetDetailValidate())->post()->goCheck('edit');
|
||||
$result = CostBudgetDetailLogic::edit($params);
|
||||
if (true === $result) {
|
||||
return $this->success('编辑成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(CostBudgetDetailLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 11:22
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$params = (new CostBudgetDetailValidate())->post()->goCheck('delete');
|
||||
CostBudgetDetailLogic::delete($params);
|
||||
return $this->success('删除成功', [], 1, 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取详情
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 11:22
|
||||
*/
|
||||
public function detail()
|
||||
{
|
||||
$params = (new CostBudgetDetailValidate())->goCheck('detail');
|
||||
$result = CostBudgetDetailLogic::detail($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
|
||||
}
|
77
app/adminapi/lists/cost/CostBudgetDetailLists.php
Normal file
77
app/adminapi/lists/cost/CostBudgetDetailLists.php
Normal file
@ -0,0 +1,77 @@
|
||||
<?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\cost;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\cost\CostBudgetDetail;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
|
||||
|
||||
/**
|
||||
* CostBudgetDetail列表
|
||||
* Class CostBudgetDetailLists
|
||||
* @package app\adminapi\listscost
|
||||
*/
|
||||
class CostBudgetDetailLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 11:22
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['cost_subject_id', 'cost_budget_id'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 11:22
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return CostBudgetDetail::where($this->searchWhere)
|
||||
->field(['id', 'cost_subject_id', 'cost_budget_id', 'dept_id', 'month1', 'month2', 'month3', 'month4', 'month5', 'month6', 'month7', 'month8', 'month9', 'month10', 'month11', 'month12'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 11:22
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return CostBudgetDetail::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
}
|
77
app/adminapi/lists/cost/CostBudgetLists.php
Normal file
77
app/adminapi/lists/cost/CostBudgetLists.php
Normal file
@ -0,0 +1,77 @@
|
||||
<?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\cost;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\cost\CostBudget;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
|
||||
|
||||
/**
|
||||
* CostBudget列表
|
||||
* Class CostBudgetLists
|
||||
* @package app\adminapi\listscost
|
||||
*/
|
||||
class CostBudgetLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 11:26
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['years', 'document_preparation_time'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 11:26
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return CostBudget::where($this->searchWhere)
|
||||
->field(['id', 'years', 'document_preparation_time', 'total', 'remark', 'annex'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 11:26
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return CostBudget::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
}
|
134
app/adminapi/logic/cost/CostBudgetDetailLogic.php
Normal file
134
app/adminapi/logic/cost/CostBudgetDetailLogic.php
Normal file
@ -0,0 +1,134 @@
|
||||
<?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\cost;
|
||||
|
||||
|
||||
use app\common\model\cost\CostBudgetDetail;
|
||||
use app\common\logic\BaseLogic;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* CostBudgetDetail逻辑
|
||||
* Class CostBudgetDetailLogic
|
||||
* @package app\adminapi\logic\cost
|
||||
*/
|
||||
class CostBudgetDetailLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 11:22
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
CostBudgetDetail::create([
|
||||
'cost_subject_id' => $params['cost_subject_id'],
|
||||
'cost_budget_id' => $params['cost_budget_id'],
|
||||
'dept_id' => $params['dept_id'],
|
||||
'month1' => $params['month1'],
|
||||
'month2' => $params['month2'],
|
||||
'month3' => $params['month3'],
|
||||
'month4' => $params['month4'],
|
||||
'month5' => $params['month5'],
|
||||
'month6' => $params['month6'],
|
||||
'month7' => $params['month7'],
|
||||
'month8' => $params['month8'],
|
||||
'month9' => $params['month9'],
|
||||
'month10' => $params['month10'],
|
||||
'month11' => $params['month11'],
|
||||
'month12' => $params['month12'],
|
||||
]);
|
||||
|
||||
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/18 11:22
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
CostBudgetDetail::where('id', $params['id'])->update([
|
||||
'cost_subject_id' => $params['cost_subject_id'],
|
||||
'cost_budget_id' => $params['cost_budget_id'],
|
||||
'dept_id' => $params['dept_id'],
|
||||
'month1' => $params['month1'],
|
||||
'month2' => $params['month2'],
|
||||
'month3' => $params['month3'],
|
||||
'month4' => $params['month4'],
|
||||
'month5' => $params['month5'],
|
||||
'month6' => $params['month6'],
|
||||
'month7' => $params['month7'],
|
||||
'month8' => $params['month8'],
|
||||
'month9' => $params['month9'],
|
||||
'month10' => $params['month10'],
|
||||
'month11' => $params['month11'],
|
||||
'month12' => $params['month12'],
|
||||
]);
|
||||
|
||||
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/18 11:22
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
return CostBudgetDetail::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 11:22
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
return CostBudgetDetail::findOrEmpty($params['id'])->toArray();
|
||||
}
|
||||
}
|
114
app/adminapi/logic/cost/CostBudgetLogic.php
Normal file
114
app/adminapi/logic/cost/CostBudgetLogic.php
Normal file
@ -0,0 +1,114 @@
|
||||
<?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\cost;
|
||||
|
||||
|
||||
use app\common\model\cost\CostBudget;
|
||||
use app\common\logic\BaseLogic;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* CostBudget逻辑
|
||||
* Class CostBudgetLogic
|
||||
* @package app\adminapi\logic\cost
|
||||
*/
|
||||
class CostBudgetLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 11:26
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
CostBudget::create([
|
||||
'years' => $params['years'],
|
||||
'document_preparation_time' => $params['document_preparation_time'],
|
||||
'total' => $params['total'],
|
||||
'remark' => $params['remark'],
|
||||
'annex' => $params['annex'],
|
||||
]);
|
||||
|
||||
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/18 11:26
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
CostBudget::where('id', $params['id'])->update([
|
||||
'years' => $params['years'],
|
||||
'document_preparation_time' => $params['document_preparation_time'],
|
||||
'total' => $params['total'],
|
||||
'remark' => $params['remark'],
|
||||
'annex' => $params['annex'],
|
||||
]);
|
||||
|
||||
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/18 11:26
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
return CostBudget::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 11:26
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
return CostBudget::findOrEmpty($params['id'])->toArray();
|
||||
}
|
||||
}
|
98
app/adminapi/validate/cost/CostBudgetDetailValidate.php
Normal file
98
app/adminapi/validate/cost/CostBudgetDetailValidate.php
Normal file
@ -0,0 +1,98 @@
|
||||
<?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\cost;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* CostBudgetDetail验证器
|
||||
* Class CostBudgetDetailValidate
|
||||
* @package app\adminapi\validate\cost
|
||||
*/
|
||||
class CostBudgetDetailValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'cost_subject_id' => 'require',
|
||||
'gc_cost_budget_id' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'cost_subject_id' => '一级科目id',
|
||||
'gc_cost_budget_id' => '费用明细id',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return CostBudgetDetailValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 11:22
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->only(['cost_subject_id','gc_cost_budget_id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return CostBudgetDetailValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 11:22
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id','cost_subject_id','gc_cost_budget_id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return CostBudgetDetailValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 11:22
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return CostBudgetDetailValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 11:22
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
98
app/adminapi/validate/cost/CostBudgetValidate.php
Normal file
98
app/adminapi/validate/cost/CostBudgetValidate.php
Normal file
@ -0,0 +1,98 @@
|
||||
<?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\cost;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* CostBudget验证器
|
||||
* Class CostBudgetValidate
|
||||
* @package app\adminapi\validate\cost
|
||||
*/
|
||||
class CostBudgetValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'years' => 'require',
|
||||
'document_preparation_time' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'years' => '年份',
|
||||
'document_preparation_time' => '制单时间',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return CostBudgetValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 11:26
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->only(['years','document_preparation_time']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return CostBudgetValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 11:26
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id','years','document_preparation_time']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return CostBudgetValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 11:26
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return CostBudgetValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 11:26
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
45
app/common/model/cost/CostBudget.php
Normal file
45
app/common/model/cost/CostBudget.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?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\cost;
|
||||
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
|
||||
/**
|
||||
* CostBudget模型
|
||||
* Class CostBudget
|
||||
* @package app\common\model\cost
|
||||
*/
|
||||
class CostBudget extends BaseModel
|
||||
{
|
||||
use SoftDelete;
|
||||
protected $name = 'cost_budget';
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
|
||||
/**
|
||||
* @notes 关联detail
|
||||
* @return \think\model\relation\HasMany
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 11:26
|
||||
*/
|
||||
public function detail()
|
||||
{
|
||||
return $this->hasMany(\app\common\model\cost\CostBudgetDetail::class, 'cost_budget_id', 'id');
|
||||
}
|
||||
|
||||
}
|
34
app/common/model/cost/CostBudgetDetail.php
Normal file
34
app/common/model/cost/CostBudgetDetail.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?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\cost;
|
||||
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
|
||||
/**
|
||||
* CostBudgetDetail模型
|
||||
* Class CostBudgetDetail
|
||||
* @package app\common\model\cost
|
||||
*/
|
||||
class CostBudgetDetail extends BaseModel
|
||||
{
|
||||
use SoftDelete;
|
||||
protected $name = 'cost_budget_detail';
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user