diff --git a/superadmin/application/admin/controller/Firmbigcategory.php b/superadmin/application/admin/controller/Firmbigcategory.php index 3679f30..e296c77 100755 --- a/superadmin/application/admin/controller/Firmbigcategory.php +++ b/superadmin/application/admin/controller/Firmbigcategory.php @@ -34,4 +34,38 @@ class Firmbigcategory extends Backend */ + /** + * 查看 + */ + public function index() + { + //当前是否为关联查询 + $this->relationSearch = true; + //设置过滤方法 + $this->request->filter(['strip_tags', 'trim']); + if ($this->request->isAjax()) { + //如果发送的来源是Selectpage,则转发到Selectpage + if ($this->request->request('keyField')) { + return $this->selectpage(); + } + list($where, $sort, $order, $offset, $limit) = $this->buildparams(); + + $list = $this->model + ->with(['firm']) + ->where($where) + ->order($sort, $order) + ->paginate($limit); + + foreach ($list as $row) { + + $row->getRelation('firm')->visible(['name']); + } + + $result = array("total" => $list->total(), "rows" => $list->items()); + + return json($result); + } + return $this->view->fetch(); + } + } diff --git a/superadmin/application/admin/controller/Firmcustomerorigin.php b/superadmin/application/admin/controller/Firmcustomerorigin.php index 8e9ad3a..710eafb 100755 --- a/superadmin/application/admin/controller/Firmcustomerorigin.php +++ b/superadmin/application/admin/controller/Firmcustomerorigin.php @@ -40,7 +40,7 @@ class Firmcustomerorigin extends Backend public function index() { //当前是否为关联查询 - $this->relationSearch = false; + $this->relationSearch = true; //设置过滤方法 $this->request->filter(['strip_tags', 'trim']); if ($this->request->isAjax()) { @@ -51,14 +51,15 @@ class Firmcustomerorigin extends Backend list($where, $sort, $order, $offset, $limit) = $this->buildparams(); $list = $this->model - + ->with(['firm']) ->where($where) ->order($sort, $order) ->paginate($limit); foreach ($list as $row) { $row->visible(['id','name']); - + $row->visible(['firm']); + $row->getRelation('firm')->visible(['name']); } $result = array("total" => $list->total(), "rows" => $list->items()); diff --git a/superadmin/application/admin/controller/Firmduty.php b/superadmin/application/admin/controller/Firmduty.php index 162d62b..94c7b39 100755 --- a/superadmin/application/admin/controller/Firmduty.php +++ b/superadmin/application/admin/controller/Firmduty.php @@ -22,6 +22,7 @@ class Firmduty extends Backend { parent::_initialize(); $this->model = new \app\admin\model\Firmduty; + } @@ -39,7 +40,7 @@ class Firmduty extends Backend public function index() { //当前是否为关联查询 - $this->relationSearch = false; + $this->relationSearch = true; //设置过滤方法 $this->request->filter(['strip_tags', 'trim']); if ($this->request->isAjax()) { @@ -50,14 +51,17 @@ class Firmduty extends Backend list($where, $sort, $order, $offset, $limit) = $this->buildparams(); $list = $this->model - + ->with(['firm','firmstore']) ->where($where) ->order($sort, $order) ->paginate($limit); foreach ($list as $row) { $row->visible(['id','name']); - + $row->visible(['firm']); + $row->getRelation('firm')->visible(['name']); + $row->visible(['firmstore']); + $row->getRelation('firmstore')->visible(['name']); } $result = array("total" => $list->total(), "rows" => $list->items()); diff --git a/superadmin/application/admin/lang/zh-cn/firmbigcategory.php b/superadmin/application/admin/lang/zh-cn/firmbigcategory.php index 23e5a74..7741c2d 100755 --- a/superadmin/application/admin/lang/zh-cn/firmbigcategory.php +++ b/superadmin/application/admin/lang/zh-cn/firmbigcategory.php @@ -1,7 +1,8 @@ 'ID', - 'Name' => '大类名称', - 'Firm_id' => '所属企业' + 'Id' => 'ID', + 'Name' => '大类名称', + 'Firm_id' => '所属企业', + 'Firm.name' => '企业简称' ]; diff --git a/superadmin/application/admin/lang/zh-cn/firmcustomerorigin.php b/superadmin/application/admin/lang/zh-cn/firmcustomerorigin.php index e71560c..1ad2b10 100755 --- a/superadmin/application/admin/lang/zh-cn/firmcustomerorigin.php +++ b/superadmin/application/admin/lang/zh-cn/firmcustomerorigin.php @@ -1,7 +1,8 @@ 'ID', - 'Name' => '来源', - 'Firm_id' => '所属企业' + 'Id' => 'ID', + 'Name' => '来源', + 'Firm_id' => '所属企业', + 'Firm.name' => '企业简称' ]; diff --git a/superadmin/application/admin/lang/zh-cn/firmduty.php b/superadmin/application/admin/lang/zh-cn/firmduty.php index bf1bb5b..2827cb1 100755 --- a/superadmin/application/admin/lang/zh-cn/firmduty.php +++ b/superadmin/application/admin/lang/zh-cn/firmduty.php @@ -1,8 +1,10 @@ 'ID', - 'Name' => '职务名称', - 'Firm_id' => '所属企业', - 'Firmstore_id' => '所属店铺' + 'Id' => 'ID', + 'Name' => '职务名称', + 'Firm_id' => '所属企业', + 'Firmstore_id' => '所属店铺', + 'Firm.name' => '企业简称', + 'Firmstore.name' => '门店名称' ]; diff --git a/superadmin/application/admin/model/Firmbigcategory.php b/superadmin/application/admin/model/Firmbigcategory.php index be37146..a933271 100755 --- a/superadmin/application/admin/model/Firmbigcategory.php +++ b/superadmin/application/admin/model/Firmbigcategory.php @@ -37,4 +37,8 @@ class Firmbigcategory extends Model + public function firm() + { + return $this->belongsTo('Firm', 'firm_id', 'id', [], 'LEFT')->setEagerlyType(0); + } } diff --git a/superadmin/application/admin/model/Firmcustomerorigin.php b/superadmin/application/admin/model/Firmcustomerorigin.php index ded2425..dbfb323 100755 --- a/superadmin/application/admin/model/Firmcustomerorigin.php +++ b/superadmin/application/admin/model/Firmcustomerorigin.php @@ -37,4 +37,8 @@ class Firmcustomerorigin extends Model + public function firm() + { + return $this->belongsTo('Firm', 'firm_id', 'id', [], 'LEFT')->setEagerlyType(0); + } } diff --git a/superadmin/application/admin/model/Firmduty.php b/superadmin/application/admin/model/Firmduty.php index 73bc477..e0ca5af 100755 --- a/superadmin/application/admin/model/Firmduty.php +++ b/superadmin/application/admin/model/Firmduty.php @@ -37,4 +37,14 @@ class Firmduty extends Model + public function firm() + { + return $this->belongsTo('Firm', 'firm_id', 'id', [], 'LEFT')->setEagerlyType(0); + } + + + public function firmstore() + { + return $this->belongsTo('Firmstore', 'firmstore_id', 'id', [], 'LEFT')->setEagerlyType(0); + } } diff --git a/superadmin/application/admin/view/firmbigcategory/add.html b/superadmin/application/admin/view/firmbigcategory/add.html index a8c7730..bd3bd6d 100755 --- a/superadmin/application/admin/view/firmbigcategory/add.html +++ b/superadmin/application/admin/view/firmbigcategory/add.html @@ -9,10 +9,9 @@
- +
+ 不选择为基础模版