更新下拉列表的功能以及增加下拉列表的筛选功能
This commit is contained in:
@@ -59,7 +59,7 @@ class PdmPartitemIndex extends AdminController
|
||||
* @throws DbException
|
||||
* @throws ModelNotFoundException
|
||||
*/
|
||||
public function dataList(array $params): array
|
||||
public static function dataList(array $params): array
|
||||
{
|
||||
// $where = array();
|
||||
// if (!empty($params['partnumber'])) {
|
||||
@@ -91,14 +91,17 @@ class PdmPartitemIndex extends AdminController
|
||||
|
||||
$page = (int)input('page', 1);
|
||||
$limit = (int)input('limit', 18);
|
||||
$where = $this->buildSelectParams();
|
||||
$count = $this->model->where($where)->count();
|
||||
$fieldList = $this->model->getFields();
|
||||
|
||||
$controller = new PdmPartitemIndex();
|
||||
|
||||
$where = $controller->buildSelectParams();
|
||||
$count = $controller->model->where($where)->count();
|
||||
$fieldList = $controller->model->getFields();
|
||||
$order = !array_key_exists('sort', $fieldList) ? 'id' : 'sort';
|
||||
$subQuery = $this->model->field('id')->where($where)->order($order, 'desc')->limit($limit)->page($page)->buildSql();
|
||||
$subQuery = $controller->model->field('id')->where($where)->order($order, 'desc')->limit($limit)->page($page)->buildSql();
|
||||
$subQuery = '( SELECT object.id FROM ' . $subQuery . ' AS object )';
|
||||
// $list = $this->model->with($this->relationModel)->where('id in' . $subQuery)->order($order, 'asc')->select()->toArray(); // 如果是'desc' list_to_tree 函数返回为空!
|
||||
$list = $this->model->with($this->relationModel)->where('id in' . $subQuery)->order($order, 'asc')->select(); // 如果是'desc' list_to_tree 函数返回为空!
|
||||
$list = $controller->model->with($controller->relationModel)->where('id in' . $subQuery)->order($order, 'asc')->select(); // 如果是'desc' list_to_tree 函数返回为空!
|
||||
|
||||
foreach($list as $key => $value){
|
||||
// throw new \Exception(json_encode($value));
|
||||
@@ -127,8 +130,8 @@ class PdmPartitemIndex extends AdminController
|
||||
foreach($list as $key => $value){
|
||||
if(!in_array($value['pid'],$nodeid) && $value['pid'] > 0){
|
||||
$nodeid[] = $value['pid'];
|
||||
$nodevalue = $this->model->find($value['pid']);
|
||||
$nodevalue = $this->model->find($value['pid'])->toArray();
|
||||
$nodevalue = $controller->model->find($value['pid']);
|
||||
$nodevalue = $controller->model->find($value['pid'])->toArray();
|
||||
|
||||
if(!empty($nodevalue)){
|
||||
$list[] = &$nodevalue;
|
||||
|
||||
Reference in New Issue
Block a user