PDM更新数据结构后,基础数据查询和BOM初始查询等基本功能都已经OK,待完善和细化相关的上传和下载服务等。
This commit is contained in:
83
app/admin/controller/PdmPartitemView.php
Normal file
83
app/admin/controller/PdmPartitemView.php
Normal file
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\AdminController;
|
||||
use Webman\Http\Request;
|
||||
use app\admin\model\PdmPartitemView as PdmPartitemViewModel;
|
||||
|
||||
/**
|
||||
* pdm_partitem_view
|
||||
* PN查询
|
||||
* <!--partview-->
|
||||
* Class PdmPartitemView
|
||||
* @package app\admin\controller
|
||||
*/
|
||||
class PdmPartitemView extends AdminController
|
||||
{
|
||||
/**
|
||||
* PdmPartitemView模型对象
|
||||
* @var \app\admin\model\PdmPartitemView
|
||||
*/
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->model = new PdmPartitemViewModel;
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的方法为index/add/edit/del/status 五个方法
|
||||
* 当创建CURD的时候,DIY的函数体和模板为空,请自行编写代码
|
||||
*/
|
||||
|
||||
|
||||
public function index(): \support\Response
|
||||
{
|
||||
// $post = input();
|
||||
// $post = request()->post();
|
||||
$post = request()->all();
|
||||
// $post['partnumber'] = input('partnumber');
|
||||
$pid = input('pid');
|
||||
$limit = input('limit') ?? 10;
|
||||
$page = input('page') ?? 1;
|
||||
// if ($pid == null) {
|
||||
// $pid = (string)$this->model->minId();
|
||||
// }
|
||||
|
||||
if (request()->isAjax()) {
|
||||
|
||||
// 生成查询数据
|
||||
// $pid = !str_contains($pid, ',') ? $pid : explode(',',$pid);
|
||||
// $where[] = ['pid','in',$pid];
|
||||
// $where[] = [];
|
||||
if (!empty($post['keyword'])) {
|
||||
$where[] = ['partnumber|purchasecode|parttype|value|description|mpn|mfgname|symbol|footprint|datasheet|usernickname|department','like','%'.$post['keyword'].'%'];
|
||||
// $where[] = ['reference','like','%'.$post['keyword'].'%'];
|
||||
// $where[] = ['content','like','%'.$post['keyword'].'%'];
|
||||
// $where[] = ['item','like','%'.$post['keyword'].'%'];
|
||||
}else{
|
||||
// $where[] = ['pid','in',$pid];
|
||||
// $where[] = ['partnumber','like','%'.$post['partnumber'].'%'];
|
||||
$where[] = ['partnumber|purchasecode|parttype|value|description|mpn|mfgname|symbol|footprint|datasheet|usernickname|department','like','%'.'%'];
|
||||
}
|
||||
|
||||
$count = $this->model->where($where)->count();
|
||||
// $list = $this->model->where($where)->limit((int)$limit)->page((int)$page)->select()
|
||||
// ->each(function($item,$key) use ($pid){
|
||||
// if ($key == 0 && $pid == '0') {
|
||||
// $item['LAY_CHECKED'] = true;
|
||||
// }
|
||||
|
||||
// return $item;
|
||||
// });
|
||||
$list = $this->model->where($where)->limit((int)$limit)->page((int)$page)->select();
|
||||
|
||||
return $this->success('查询成功', null, $list, $count);
|
||||
}
|
||||
|
||||
return view('/pdm_partitem_view/index',[ ]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user