From 0a83799b2db2df04db656cdbaf11dfec9862271a Mon Sep 17 00:00:00 2001 From: meimei <102865034@qq.com> Date: Fri, 18 Apr 2025 14:22:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=9F=BA=E7=A1=80=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E4=B8=AD=E7=9A=84=E5=9F=BA=E7=A1=80=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/controller/Firmbigcategory.php | 34 +++++++++++++++++++ .../admin/controller/Firmcustomerorigin.php | 7 ++-- .../application/admin/controller/Firmduty.php | 10 ++++-- .../admin/lang/zh-cn/firmbigcategory.php | 7 ++-- .../admin/lang/zh-cn/firmcustomerorigin.php | 7 ++-- .../application/admin/lang/zh-cn/firmduty.php | 10 +++--- .../admin/model/Firmbigcategory.php | 4 +++ .../admin/model/Firmcustomerorigin.php | 4 +++ .../application/admin/model/Firmduty.php | 10 ++++++ .../admin/view/firmbigcategory/add.html | 5 ++- .../admin/view/firmbigcategory/edit.html | 5 ++- .../admin/view/firmcustomerorigin/add.html | 6 ++-- .../admin/view/firmcustomerorigin/edit.html | 6 ++-- .../application/admin/view/firmduty/add.html | 12 +++---- .../application/admin/view/firmduty/edit.html | 12 +++---- .../assets/js/backend/firmbigcategory.js | 3 +- .../assets/js/backend/firmcustomerorigin.js | 1 + .../public/assets/js/backend/firmduty.js | 2 ++ 18 files changed, 98 insertions(+), 47 deletions(-) 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 @@
- +
+ 不选择为基础模版