This commit is contained in:
meimei
2025-04-16 14:10:39 +08:00
parent 536cc44069
commit db0efbfc30
5 changed files with 24 additions and 3 deletions

View File

@@ -52,19 +52,21 @@ class Mattertemplatecategorization extends Backend
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
$list = $this->model
->with(['mattertemplate','firmstoreprojectsone','firmstoreprojectstwo'])
->with(['mattertemplate','firmstoreprojectsone','firmstoreprojectstwo','firm'])
->where($where)
->order($sort, $order)
->paginate($limit);
foreach ($list as $row) {
$row->visible(['id','name','create_time','update_time']);
$row->visible(['id','name','create_time','update_time','firmstoreprojectsone_id','firmstoreprojectstwo_id','firm_id']);
$row->visible(['mattertemplate']);
$row->getRelation('mattertemplate')->visible(['name']);
$row->visible(['firmstoreprojectsone']);
$row->getRelation('firmstoreprojectsone')->visible(['name']);
$row->visible(['firmstoreprojectstwo']);
$row->getRelation('firmstoreprojectstwo')->visible(['name']);
$row->visible(['firm']);
$row->getRelation('firm')->visible(['full_name']);
}
$result = array("total" => $list->total(), "rows" => $list->items());

View File

@@ -51,6 +51,12 @@ class Mattertemplatecategorization extends Model
public function firmstoreprojectstwo()
{
return $this->belongsTo('Firmstoreprojectstwo', 'id', 'id', [], 'LEFT')->setEagerlyType(0);
return $this->belongsTo('Firmstoreprojectstwo', 'firmstoreprojectstwo_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
public function firm()
{
return $this->belongsTo('Firm', 'firm_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
}

View File

@@ -12,6 +12,12 @@
<input id="c-name" class="form-control" name="row[name]" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">企业:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-firm_id" data-source="firm/index" class="form-control selectpage" name="row[firm_id]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Firmstoreprojectsone_id')}:</label>
<div class="col-xs-12 col-sm-8">

View File

@@ -12,6 +12,12 @@
<input id="c-name" class="form-control" name="row[name]" type="text" value="{$row.name|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">企业:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-firm_id" data-source="firm/index" class="form-control selectpage" name="row[firm_id]" type="text" value="{$row.firm_id|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Firmstoreprojectsone_id')}:</label>
<div class="col-xs-12 col-sm-8">

View File

@@ -28,6 +28,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'id', title: __('Id')},
{field: 'name', title: __('Name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'mattertemplate.name', title: __('Mattertemplate.name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'firm.full_name', title: '企业名称', operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'firmstoreprojectsone.name', title: __('Firmstoreprojectsone.name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'firmstoreprojectstwo.name', title: __('Firmstoreprojectstwo.name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},