美文网首页
动态下拉selectPage

动态下拉selectPage

作者: xueyueshuai | 来源:发表于2023-12-04 14:47 被阅读0次
                <input id="c-base_code" data-rule="required"
                       data-source="cl/base/selectGetBaseList"
                       data-field="base_name"
                       data-primary-key="base_code"
                       data-search-field="base_name"
                       data-params='{"custom[type]":"test"}'
                       class="form-control selectpage" name="row[base_code]" type="text" value="">
    
        // 无需登录的接口,*表示全部
        protected $noNeedLogin = [];
        // 无需鉴权的接口,*表示全部
        protected $noNeedRight = ['selectGetBaseList'];
        public function selectGetBaseList(): \think\response\Json
        {
            $base_name = input('base_name/s');
    
            $where = [];
            if ($base_name) {
                $where['base_name'] = ['like', '%' . $base_name . '%'];
            }
            $my_base_codes = $this->getMyBaseCodes();
            if($my_base_codes){
                $where['base_code'] = ['in', $my_base_codes];
            }
    
    
            $list = Db::table('dz_base')->where($where)->select();
            //res
            $res = [];
            $res['list'] = $list;
            $res['total'] = count($list);
            $res['input'] = input();
            $res['base_codes'] = $this->getMyBaseCodes();
            return json($res);
        }
    

    相关文章

      网友评论

          本文标题:动态下拉selectPage

          本文链接:https://www.haomeiwen.com/subject/mqfrgdtx.html