作者 郭盛
1 个管道 的构建 通过 耗费 15 秒

老师擅长领域

  1 +<?php
  2 +/**
  3 + * Created by PhpStorm.
  4 + * User: Administrator
  5 + * Date: 2020/3/19
  6 + * Time: 16:47
  7 + */
  8 +
  9 +namespace app\admin\controller;
  10 +
  11 +use app\common\controller\Backend;
  12 +use think\Db;
  13 +
  14 +class Hobby extends Backend
  15 +{
  16 + /**
  17 + * OrderChat模型对象
  18 + * @var \app\admin\model\Territory
  19 + */
  20 + protected $model = null;
  21 +
  22 + public function _initialize()
  23 + {
  24 + parent::_initialize();
  25 + $this->model = new \app\admin\model\Territory();
  26 + }
  27 +
  28 + public function index1($ids = null)
  29 + {
  30 + $user = Db::name('teacher')
  31 + ->where('id',$ids)
  32 + ->field('user_id,territory_id')
  33 + ->find();
  34 + if(!empty($user['territory_id'])){
  35 + $territory_id = explode(',',$user['territory_id']);
  36 + }else{
  37 + $territory_id = [];
  38 + }
  39 + //设置过滤方法
  40 + $this->request->filter(['strip_tags']);
  41 + if ($this->request->isAjax()) {
  42 + print_r($ids);die;
  43 + //如果发送的来源是Selectpage,则转发到Selectpage
  44 + if ($this->request->request('keyField')) {
  45 + return $this->selectpage();
  46 + }
  47 + list($where, $sort, $order, $offset, $limit) = $this->buildparams();
  48 + $total = $this->model
  49 + ->whereIn('id',$territory_id)
  50 + ->where($where)
  51 + ->order($sort, $order)
  52 + ->count();
  53 +
  54 + $list = $this->model
  55 + ->whereIn('id',$territory_id)
  56 + ->where('user_id',$user['user_id'])
  57 + ->order($sort, $order)
  58 + ->limit($offset, $limit)
  59 + ->select();
  60 +
  61 + $list = collection($list)->toArray();
  62 +
  63 + $result = array("total" => $total, "rows" => $list);
  64 +
  65 + return json($result);
  66 + }
  67 + return $this->view->fetch();
  68 + }
  69 +}
  1 +<div class="panel panel-default panel-intro">
  2 + {:build_heading()}
  3 +
  4 + <div class="panel-body">
  5 + <div id="myTabContent" class="tab-content">
  6 + <div class="tab-pane fade active in" id="one">
  7 + <div class="widget-body no-padding">
  8 + <div id="toolbar" class="toolbar">
  9 + <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
  10 + <!--<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('protocol/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>-->
  11 + <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('protocol/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
  12 + <!--<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('protocol/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>-->
  13 + <!--<a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('protocol/import')?'':'hide'}" title="{:__('Import')}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i> {:__('Import')}</a>-->
  14 +
  15 + <!--<div class="dropdown btn-group {:$auth->check('protocol/multi')?'':'hide'}">-->
  16 + <!--<a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>-->
  17 + <!--<ul class="dropdown-menu text-left" role="menu">-->
  18 + <!--<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>-->
  19 + <!--<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>-->
  20 + <!--</ul>-->
  21 + <!--</div>-->
  22 +
  23 +
  24 + </div>
  25 + <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
  26 + data-operate-edit="{:$auth->check('protocol/edit')}"
  27 + data-operate-del="{:$auth->check('protocol/del')}"
  28 + width="100%">
  29 + </table>
  30 + </div>
  31 + </div>
  32 +
  33 + </div>
  34 + </div>
  35 +</div>
@@ -8,8 +8,8 @@ @@ -8,8 +8,8 @@
8 <div id="toolbar" class="toolbar"> 8 <div id="toolbar" class="toolbar">
9 <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a> 9 <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
10 <!--<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('territory/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>--> 10 <!--<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('territory/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>-->
11 - <!--<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('territory/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>-->  
12 - <!--<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('territory/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>--> 11 + <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('territory/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
  12 + <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('territory/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
13 <!--<a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('territory/import')?'':'hide'}" title="{:__('Import')}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i> {:__('Import')}</a>--> 13 <!--<a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('territory/import')?'':'hide'}" title="{:__('Import')}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i> {:__('Import')}</a>-->
14 14
15 <!--<div class="dropdown btn-group {:$auth->check('territory/multi')?'':'hide'}">--> 15 <!--<div class="dropdown btn-group {:$auth->check('territory/multi')?'':'hide'}">-->
@@ -9583,7 +9583,7 @@ @@ -9583,7 +9583,7 @@
9583 9583
9584 <div class="row mt0 footer"> 9584 <div class="row mt0 footer">
9585 <div class="col-md-6" align="left"> 9585 <div class="col-md-6" align="left">
9586 - Generated on 2020-03-19 16:25:17 </div> 9586 + Generated on 2020-03-19 20:31:54 </div>
9587 <div class="col-md-6" align="right"> 9587 <div class="col-md-6" align="right">
9588 <a href="https://www.fastadmin.net" target="_blank">FastAdmin</a> 9588 <a href="https://www.fastadmin.net" target="_blank">FastAdmin</a>
9589 </div> 9589 </div>
  1 +define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
  2 +
  3 + var Controller = {
  4 + index1: function () {
  5 + // 初始化表格参数配置
  6 + Table.api.init({
  7 + extend: {
  8 + index_url: 'hobby/index1' + '/ids/'+ Config.ids +location.search,
  9 + table: 'hobby',
  10 + },
  11 + });
  12 +
  13 + var table = $("#table");
  14 +
  15 + // 初始化表格
  16 + table.bootstrapTable({
  17 + url: $.fn.bootstrapTable.defaults.extend.index_url,
  18 + pk: 'id',
  19 + sortName: 'id',
  20 + columns: [
  21 + [
  22 + {checkbox: true},
  23 + {field: 'id', title: __('Id')},
  24 + // {field: 'user.nickname', title: __('User.nickname')},
  25 + // {field: 'teacher.name', title: __('Teacher.name')},
  26 + // {field: 'teacher.thumbnail', title: __('Teacher.thumbnail'), operate:false, events: Table.api.events.image, formatter: Table.api.formatter.image},
  27 + {field: 'contype.title', title: __('擅长领域名称')},
  28 + {field: 'money', title: __('价格')},
  29 + {field: 'content', title: __('领域优势')},
  30 + // {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
  31 + // {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
  32 + {field: 'contype.type', title: __('咨询分类'),formatter: Table.api.formatter.label,searchList:{'1': '经营管理','2':'职业发展'}},
  33 + // {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  34 + ]
  35 + ]
  36 + });
  37 +
  38 + // 为表格绑定事件
  39 + Table.api.bindevent(table);
  40 + },
  41 + add: function () {
  42 + Controller.api.bindevent();
  43 + },
  44 + edit: function () {
  45 + Controller.api.bindevent();
  46 + },
  47 + api: {
  48 + bindevent: function () {
  49 + Form.api.bindevent($("form[role=form]"));
  50 + }
  51 + }
  52 + };
  53 + return Controller;
  54 +});
@@ -41,7 +41,19 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin @@ -41,7 +41,19 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
41 {field: 'is_recommend', title: __('Is_recommend'),formatter: Table.api.formatter.toggle,yes:'1',no:'0',searchList:{'0': '不推荐','1':'推荐'}}, 41 {field: 'is_recommend', title: __('Is_recommend'),formatter: Table.api.formatter.toggle,yes:'1',no:'0',searchList:{'0': '不推荐','1':'推荐'}},
42 {field: 'is_forbid', title: __('是否封禁'),formatter: Table.api.formatter.toggle,yes:'1',no:'0',searchList:{'0': '正常','1':'封禁'}}, 42 {field: 'is_forbid', title: __('是否封禁'),formatter: Table.api.formatter.toggle,yes:'1',no:'0',searchList:{'0': '正常','1':'封禁'}},
43 {field: 'is_stick', title: __('是否置顶'),formatter: Table.api.formatter.status,searchList:{'0':'不置顶','1': '置顶'}}, 43 {field: 'is_stick', title: __('是否置顶'),formatter: Table.api.formatter.status,searchList:{'0':'不置顶','1': '置顶'}},
44 - {field: 'territory_id', title: __('Territory_id'), operate:false}, 44 + // {field: 'territory_id', title: __('Territory_id'), operate:false},
  45 + {field: 'territory_id', title: __('Territory_id'), table: table, events: Table.api.events.operate, buttons:
  46 + [
  47 + {
  48 + text: '擅长领域',
  49 + title: '擅长领域',
  50 + icon: 'fa fa-list',
  51 + classname: 'btn btn-xs btn-primary btn-dialog',
  52 + url: 'hobby/index1',
  53 + extend: 'data-area=\'["80%","80%"]\''
  54 + },
  55 + ], operate:false, formatter: Table.api.formatter.buttons
  56 + },
45 {field: 'proportion', title: __('佣金比例'), operate:false}, 57 {field: 'proportion', title: __('佣金比例'), operate:false},
46 // {field: 'level', title: __('Level'), operate:false}, 58 // {field: 'level', title: __('Level'), operate:false},
47 {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime}, 59 {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
@@ -34,7 +34,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin @@ -34,7 +34,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
34 {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime}, 34 {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
35 {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime}, 35 {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
36 {field: 'contype.type', title: __('Contype.type'),formatter: Table.api.formatter.label,searchList:{'1': '经营管理','2':'职业发展'}}, 36 {field: 'contype.type', title: __('Contype.type'),formatter: Table.api.formatter.label,searchList:{'1': '经营管理','2':'职业发展'}},
37 - // {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} 37 + {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
38 ] 38 ]
39 ] 39 ]
40 }); 40 });