123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- <?php
- namespace app\api\controller\v1;
- use app\api\controller\Base;
- use app\hander\HelpHander;
- use think\Db;
- use think\response\Json;
- class AssetItems extends Base
- {
- // 新增
- public function save(){
- model('AssetItems')->add();
- HelpHander::success([],'操作成功');
- }
- // 编辑
- public function update(){
- model('AssetItems')->add();
- HelpHander::success([],'操作成功');
- }
- // 详情
- public function detail(){
- $id = input('id/d',0);
- $ret = model('AssetItems')->info($id);
- HelpHander::success($ret);
- }
- // 列表
- public function list(){
- $ret = model('AssetItems')->lists($this->orgId);
- HelpHander::success($ret);
- }
- // 导出列表
- public function exportList(){
- // $title = input('title','','trim');
- // $cateId = input('cateId/d',0);
- // $companyId = input('companyId/d',0);
- // $addId = input('addId/d',0);
- // $classId = input('classId/d',0);
- // $enable = input('enable/d',-1);
- $all = input('all/d',0);
- $selectData = input('selectData','','trim');
- $mb = input('mb','','trim');
- if($all == 0 && !$selectData){
- HelpHander::error('未选择数据');
- }
- if(!$mb){
- HelpHander::error('参数错误');
- }
- $mb = json_decode($mb,true);
- $flag = 0;
- foreach ($mb as $k=>$v){
- if($v['select']){
- $flag = 1;
- break;
- }
- }
- if($flag == 0){
- $this->error('未选择要导出的字段');
- }
- $ret = model('AssetItems')->exportLists($mb,$selectData,$this->orgId,$all);
- HelpHander::success($ret);
- }
- // 资产选择列表
- public function selectLists(){
- $page = input('page/d',1);
- $size = input('size/d',10);
- $title = input('title','','trim');
- $cateId = input('cateId/d',0);
- $companyId = input('companyId/d',0);
- $addId = input('addId/d',0);
- $classId = input('classId/d',0);
- $type = input('type/d',0);
- $ret = model('AssetItems')->selectlists($page,$size,$title,$cateId,$companyId,$addId,$classId,$this->userId,$this->orgId,$type);
- HelpHander::success($ret);
- }
- // 删除
- public function del(){
- $id = input('id/d',0);
- model('AssetItems')->del($id);
- HelpHander::success([],'操作成功');
- }
- // 拆分资产
- public function split(){
- $id = input('id/d',0);
- model('AssetItems')->split($id);
- HelpHander::success([],'操作成功');
- }
- // 申领资产列表
- public function receive(){
- $page = input('page/d',1);
- $size = input('size/d',10);
- $title = input('title','','trim');
- $start = input('startTime','','trim');
- $end = input('endTime','','trim');
- $ret = model('AssetReceive')->lists($page,$size,$title,$start,$end,$this->orgId);
- HelpHander::success($ret);
- }
- // 退库列表
- public function withdraw(){
- $page = input('page/d',1);
- $size = input('size/d',10);
- $title = input('title','','trim');
- $start = input('startTime','','trim');
- $end = input('endTime','','trim');
- $ret = model('AssetWithdraw')->lists($page,$size,$title,$start,$end,$this->orgId);
- HelpHander::success($ret);
- }
- // 维修列表
- public function repair(){
- $page = input('page/d',1);
- $size = input('size/d',10);
- $title = input('title','','trim');
- $start = input('startTime','','trim');
- $end = input('endTime','','trim');
- $ret = model('AssetRepair')->lists($page,$size,$title,$start,$end,$this->orgId);
- HelpHander::success($ret);
- }
- // 处置列表
- public function disposal(){
- $page = input('page/d',1);
- $size = input('size/d',10);
- $title = input('title','','trim');
- $start = input('startTime','','trim');
- $end = input('endTime','','trim');
- $ret = model('AssetDisposal')->lists($page,$size,$title,$start,$end,$this->orgId);
- HelpHander::success($ret);
- }
- // 我领取的资产
- public function myLists(){
- $page = input('page/d',1);
- $size = input('size/d',10);
- $title = input('title','','trim');
- $ret = model('AssetItems')->myLists($page,$size,$title,$this->userId,$this->orgId);
- HelpHander::success($ret);
- }
- }
|