修改基础管理中的基础内容

This commit is contained in:
meimei
2025-04-18 14:22:17 +08:00
parent b6a947ba0b
commit 0a83799b2d
18 changed files with 98 additions and 47 deletions

View File

@@ -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();
}
} }

View File

@@ -40,7 +40,7 @@ class Firmcustomerorigin extends Backend
public function index() public function index()
{ {
//当前是否为关联查询 //当前是否为关联查询
$this->relationSearch = false; $this->relationSearch = true;
//设置过滤方法 //设置过滤方法
$this->request->filter(['strip_tags', 'trim']); $this->request->filter(['strip_tags', 'trim']);
if ($this->request->isAjax()) { if ($this->request->isAjax()) {
@@ -51,14 +51,15 @@ class Firmcustomerorigin extends Backend
list($where, $sort, $order, $offset, $limit) = $this->buildparams(); list($where, $sort, $order, $offset, $limit) = $this->buildparams();
$list = $this->model $list = $this->model
->with(['firm'])
->where($where) ->where($where)
->order($sort, $order) ->order($sort, $order)
->paginate($limit); ->paginate($limit);
foreach ($list as $row) { foreach ($list as $row) {
$row->visible(['id','name']); $row->visible(['id','name']);
$row->visible(['firm']);
$row->getRelation('firm')->visible(['name']);
} }
$result = array("total" => $list->total(), "rows" => $list->items()); $result = array("total" => $list->total(), "rows" => $list->items());

View File

@@ -22,6 +22,7 @@ class Firmduty extends Backend
{ {
parent::_initialize(); parent::_initialize();
$this->model = new \app\admin\model\Firmduty; $this->model = new \app\admin\model\Firmduty;
} }
@@ -39,7 +40,7 @@ class Firmduty extends Backend
public function index() public function index()
{ {
//当前是否为关联查询 //当前是否为关联查询
$this->relationSearch = false; $this->relationSearch = true;
//设置过滤方法 //设置过滤方法
$this->request->filter(['strip_tags', 'trim']); $this->request->filter(['strip_tags', 'trim']);
if ($this->request->isAjax()) { if ($this->request->isAjax()) {
@@ -50,14 +51,17 @@ class Firmduty extends Backend
list($where, $sort, $order, $offset, $limit) = $this->buildparams(); list($where, $sort, $order, $offset, $limit) = $this->buildparams();
$list = $this->model $list = $this->model
->with(['firm','firmstore'])
->where($where) ->where($where)
->order($sort, $order) ->order($sort, $order)
->paginate($limit); ->paginate($limit);
foreach ($list as $row) { foreach ($list as $row) {
$row->visible(['id','name']); $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()); $result = array("total" => $list->total(), "rows" => $list->items());

View File

@@ -1,7 +1,8 @@
<?php <?php
return [ return [
'Id' => 'ID', 'Id' => 'ID',
'Name' => '大类名称', 'Name' => '大类名称',
'Firm_id' => '所属企业' 'Firm_id' => '所属企业',
'Firm.name' => '企业简称'
]; ];

View File

@@ -1,7 +1,8 @@
<?php <?php
return [ return [
'Id' => 'ID', 'Id' => 'ID',
'Name' => '来源', 'Name' => '来源',
'Firm_id' => '所属企业' 'Firm_id' => '所属企业',
'Firm.name' => '企业简称'
]; ];

View File

@@ -1,8 +1,10 @@
<?php <?php
return [ return [
'Id' => 'ID', 'Id' => 'ID',
'Name' => '职务名称', 'Name' => '职务名称',
'Firm_id' => '所属企业', 'Firm_id' => '所属企业',
'Firmstore_id' => '所属店铺' 'Firmstore_id' => '所属店铺',
'Firm.name' => '企业简称',
'Firmstore.name' => '门店名称'
]; ];

View File

@@ -37,4 +37,8 @@ class Firmbigcategory extends Model
public function firm()
{
return $this->belongsTo('Firm', 'firm_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
} }

View File

@@ -37,4 +37,8 @@ class Firmcustomerorigin extends Model
public function firm()
{
return $this->belongsTo('Firm', 'firm_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
} }

View File

@@ -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);
}
} }

View File

@@ -9,10 +9,9 @@
<div class="form-group"> <div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Firm_id')}:</label> <label class="control-label col-xs-12 col-sm-2">{:__('Firm_id')}:</label>
<div class="col-xs-12 col-sm-8"> <div class="col-xs-12 col-sm-8">
<input id="c-firm_id" min="0" data-rule="required" disabled <input id="c-firm_id" min="0" data-rule="required" data-source="firm/index" class="form-control selectpage" name="row[firm_id]" type="text" value="1">
data-source="firm/index" class="form-control selectpage"
name="row[firm_id]" type="text" value="{:session_admin_firm_id()}">
</div> </div>
<span style="color: red">不选择为基础模版</span>
</div> </div>
<div class="form-group layer-footer"> <div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label> <label class="control-label col-xs-12 col-sm-2"></label>

View File

@@ -9,10 +9,9 @@
<div class="form-group"> <div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Firm_id')}:</label> <label class="control-label col-xs-12 col-sm-2">{:__('Firm_id')}:</label>
<div class="col-xs-12 col-sm-8"> <div class="col-xs-12 col-sm-8">
<input id="c-firm_id" min="0" data-rule="required" disabled <input id="c-firm_id" min="0" data-rule="required" data-source="firm/index" class="form-control selectpage" name="row[firm_id]" type="text" value="{$row.firm_id|htmlentities}">
data-source="firm/index" class="form-control selectpage" name="row[firm_id]"
type="text" value="{$row.firm_id|htmlentities}">
</div> </div>
<span style="color: red">不选择为基础模版</span>
</div> </div>
<div class="form-group layer-footer"> <div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label> <label class="control-label col-xs-12 col-sm-2"></label>

View File

@@ -9,11 +9,9 @@
<div class="form-group"> <div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Firm_id')}:</label> <label class="control-label col-xs-12 col-sm-2">{:__('Firm_id')}:</label>
<div class="col-xs-12 col-sm-8"> <div class="col-xs-12 col-sm-8">
<input id="c-firm_id" min="0" data-rule="required" <input id="c-firm_id" min="0" data-rule="required" data-source="firm/index" class="form-control selectpage" name="row[firm_id]" type="text" value="1">
disabled
data-source="firm/index" class="form-control selectpage"
name="row[firm_id]" type="text" value="{:session_admin_firm_id()}">
</div> </div>
<span style="color: red">不选择为基础模版</span>
</div> </div>
<div class="form-group layer-footer"> <div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label> <label class="control-label col-xs-12 col-sm-2"></label>

View File

@@ -9,11 +9,9 @@
<div class="form-group"> <div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Firm_id')}:</label> <label class="control-label col-xs-12 col-sm-2">{:__('Firm_id')}:</label>
<div class="col-xs-12 col-sm-8"> <div class="col-xs-12 col-sm-8">
<input id="c-firm_id" min="0" data-rule="required" <input id="c-firm_id" min="0" data-rule="required" data-source="firm/index" class="form-control selectpage" name="row[firm_id]" type="text" value="{$row.firm_id|htmlentities}">
disabled
data-source="firm/index" class="form-control selectpage"
name="row[firm_id]" type="text" value="{$row.firm_id|htmlentities}">
</div> </div>
<span style="color: red">不选择为基础模版</span>
</div> </div>
<div class="form-group layer-footer"> <div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label> <label class="control-label col-xs-12 col-sm-2"></label>

View File

@@ -9,20 +9,16 @@
<div class="form-group"> <div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Firm_id')}:</label> <label class="control-label col-xs-12 col-sm-2">{:__('Firm_id')}:</label>
<div class="col-xs-12 col-sm-8"> <div class="col-xs-12 col-sm-8">
<input id="c-firm_id" min="0" data-rule="required" <input id="c-firm_id" min="0" data-rule="required" data-source="firm/index" class="form-control selectpage" name="row[firm_id]" type="text" value="1">
disabled
data-source="firm/index" class="form-control selectpage"
name="row[firm_id]" type="text" value="{:session_admin_firm_id()}">
</div> </div>
<span style="color: red">不选择为基础模版</span>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Firmstore_id')}:</label> <label class="control-label col-xs-12 col-sm-2">{:__('Firmstore_id')}:</label>
<div class="col-xs-12 col-sm-8"> <div class="col-xs-12 col-sm-8">
<input id="c-firmstore_id" min="0" data-rule="required" <input id="c-firmstore_id" min="0" data-rule="required" data-source="firmstore/index" class="form-control selectpage" name="row[firmstore_id]" type="text" value="1">
disabled
data-source="firmstore/index" class="form-control selectpage"
name="row[firmstore_id]" type="text" value="{:session_admin_firmstore_id()}">
</div> </div>
<span style="color: red">不选择为基础模版</span>
</div> </div>
<div class="form-group layer-footer"> <div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label> <label class="control-label col-xs-12 col-sm-2"></label>

View File

@@ -9,20 +9,16 @@
<div class="form-group"> <div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Firm_id')}:</label> <label class="control-label col-xs-12 col-sm-2">{:__('Firm_id')}:</label>
<div class="col-xs-12 col-sm-8"> <div class="col-xs-12 col-sm-8">
<input id="c-firm_id" min="0" data-rule="required" <input id="c-firm_id" min="0" data-rule="required" data-source="firm/index" class="form-control selectpage" name="row[firm_id]" type="text" value="{$row.firm_id|htmlentities}">
disabled
data-source="firm/index" class="form-control selectpage"
name="row[firm_id]" type="text" value="{$row.firm_id|htmlentities}">
</div> </div>
<span style="color: red">不选择为基础模版</span>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Firmstore_id')}:</label> <label class="control-label col-xs-12 col-sm-2">{:__('Firmstore_id')}:</label>
<div class="col-xs-12 col-sm-8"> <div class="col-xs-12 col-sm-8">
<input id="c-firmstore_id" min="0" data-rule="required" <input id="c-firmstore_id" min="0" data-rule="required" data-source="firmstore/index" class="form-control selectpage" name="row[firmstore_id]" type="text" value="{$row.firmstore_id|htmlentities}">
disabled
data-source="firmstore/index" class="form-control selectpage"
name="row[firmstore_id]" type="text" value="{$row.firmstore_id|htmlentities}">
</div> </div>
<span style="color: red">不选择为基础模版</span>
</div> </div>
<div class="form-group layer-footer"> <div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label> <label class="control-label col-xs-12 col-sm-2"></label>

View File

@@ -27,7 +27,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{checkbox: true}, {checkbox: true},
{field: 'id', title: __('Id')}, {field: 'id', title: __('Id')},
{field: 'name', title: __('Name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, {field: 'name', title: __('Name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'firm_id', title: __('Firm_id')}, // {field: 'firm_id', title: __('Firm_id')},
{field: 'firm.name', title: __('Firm.name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
] ]
] ]

View File

@@ -27,6 +27,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{checkbox: true}, {checkbox: true},
{field: 'id', title: __('Id')}, {field: 'id', title: __('Id')},
{field: 'name', title: __('Name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, {field: 'name', title: __('Name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'firm.name', title: __('Firm.name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
] ]
] ]

View File

@@ -27,6 +27,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{checkbox: true}, {checkbox: true},
{field: 'id', title: __('Id')}, {field: 'id', title: __('Id')},
{field: 'name', title: __('Name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, {field: 'name', title: __('Name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'firm.name', title: __('Firm.name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'firmstore.name', title: __('Firmstore.name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
] ]
] ]