<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                項目有個需求是,根據欄目的id,獲取到此欄目下的所有文章。本來覺得這個非常小意思嘛,然后發現如果不是自己寫的頁面,要用到fastadmin的默認的文章頁面的話,要修改的還是挺多的。做個小記錄分享一下 需求如下: ![image.png](https://cdn.fastadmin.net/uploads/20200521/0079e9b0fea65aba5583cf72352c0368.png "image.png") 這個是點擊打開的彈窗,彈窗為一個fastamin的頁面 ![image.png](https://cdn.fastadmin.net/uploads/20200521/59f7fb9e44012d376e4a513a4f41dc6e.png "image.png") 現在開始修改: 1.先在列表添加對應的彈窗,修改請求路徑 ~~~ { field: 'buttons1', width: "120px", title: __('簽到列表'), table: table, events: Table.api.events.operate, buttons: [{ name: 'detail', text: __('簽到列表'), title: __('簽到列表'), classname: 'btn btn-xs btn-success btn-dialog', url: 'meeting_sign/index', callback: function (data) { Layer.alert("接收到回傳數據:" + JSON.stringify(data), { title: "回傳數據" }); }, visible: function (row) { //返回true時按鈕顯示,返回false隱藏 return true; } }], formatter: Table.api.formatter.buttons }, ~~~ 2.因為fastadmin是先渲染頁面,然后在頁面上發起ajax獲取到數據,所以要在請求的控制器上,把id賦值到index頁面,然后重新把id用路由的方式讓ajax獲取 現在這個控制器代碼 ~~~ /** * 查看 */ public function index($ids = null) { //當前是否為關聯查詢 $this->relationSearch = true; //設置過濾方法 $this->request->filter(['strip_tags', 'trim']); $this->view->assign('ids', $ids); if ($this->request->isAjax()) { //如果發送的來源是Selectpage,則轉發到Selectpage if ($this->request->request('keyField')) { return $this->selectpage(); } $meeting_id = input("meeting_id"); //list($where, $sort, $order, $offset, $limit) = $this->buildparams(); list($subwhere, $sort, $order, $offset, $limit) = $this->buildparams(); $where = function ($query) use ($subwhere, $meeting_id) { $query->where($subwhere)->where("meeting_id", $meeting_id); }; $total = $this->model ->with(['user','meeting']) ->where($where) ->order($sort, $order) ->count(); $list = $this->model ->with(['user','meeting']) ->where($where) ->order($sort, $order) ->limit($offset, $limit) ->select(); foreach ($list as $row) { $row->visible(['id','createtime']); $row->visible(['user']); $row->getRelation('user')->visible(['nickname']); $row->visible(['meeting']); $row->getRelation('meeting')->visible(['title']); } $list = collection($list)->toArray(); $result = array("total" => $total, "rows" => $list); return json($result); } return $this->view->fetch(); } ~~~ 此處注意,需要給獲取方法添加上where條件 ~~~ $meeting_id = input("meeting_id"); //list($where, $sort, $order, $offset, $limit) = $this->buildparams(); list($subwhere, $sort, $order, $offset, $limit) = $this->buildparams(); $where = function ($query) use ($subwhere, $meeting_id) { $query->where($subwhere)->where("meeting_id", $meeting_id); }; ~~~ 3.在頁面上添加隱藏的id ~~~ <input type="hidden" name="meeting_id" id="meeting_id" value="{$ids}"> ~~~ 4.在js上添加ajax的請求路由id ~~~ var?table?\=$("#table"); var?meeting\_id?\=$('#meeting\_id').val(); table.bootstrapTable({ url: $.fn.bootstrapTable.defaults.extend.index_url + '&meeting_id=' + meeting_id, pk: 'id', sortName: 'id', columns: [ [ {checkbox: true}, {field: 'id', title: __('Id')}, {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime}, {field: 'user.nickname', title: __('用戶昵稱')}, {field: 'meeting.title', title: __('Meeting.title')}, {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} ] ] }); ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看