This commit is contained in:
2024-08-06 15:23:18 +08:00
parent f7a88b9f36
commit b286bf195f
6 changed files with 150 additions and 22 deletions

View File

@@ -22,7 +22,10 @@ class Hdrquestionnairequestion extends Backend
{
parent::_initialize();
$this->model = new \app\admin\model\Hdrquestionnairequestion;
$this->view->assign("fitSexList", $this->model->getFitSexList());
$this->view->assign("isCommonList", $this->model->getIsCommonList());
$this->view->assign("isOnlyBoyList", $this->model->getIsOnlyBoyList());
$this->view->assign("isOnlyGirlList", $this->model->getIsOnlyGirlList());
$this->view->assign("typeList", $this->model->getTypeList());
}
@@ -57,7 +60,7 @@ class Hdrquestionnairequestion extends Backend
->paginate($limit);
foreach ($list as $row) {
$row->visible(['id','question','fit_sex','create_time']);
$row->visible(['id','question','is_common','is_only_boy','is_only_girl','type','create_time']);
$row->visible(['hdrdepartment']);
$row->getRelation('hdrdepartment')->visible(['name']);
}

View File

@@ -4,10 +4,18 @@ return [
'Id' => 'ID',
'Hdrdepartment_id' => '所属科室',
'Question' => '问卷问题',
'Fit_sex' => '适合对象',
'Fit_sex all' => '全部',
'Fit_sex gg' => '',
'Fit_sex mm' => '',
'Is_common' => '是否通用',
'Is_common yes' => '',
'Is_common no' => '',
'Is_only_boy' => '只适合男',
'Is_only_boy yes' => '是',
'Is_only_boy no' => '否',
'Is_only_girl' => '只适合女',
'Is_only_girl yes' => '是',
'Is_only_girl no' => '否',
'Type' => '选项类型',
'Type one' => '单选',
'Type more' => '多选',
'Create_time' => '创建时间',
'Update_time' => '更新时间',
'Hdrdepartment.name' => '科室名称'

View File

@@ -25,21 +25,63 @@ class Hdrquestionnairequestion extends Model
// 追加属性
protected $append = [
'fit_sex_text'
'is_common_text',
'is_only_boy_text',
'is_only_girl_text',
'type_text'
];
public function getFitSexList()
public function getIsCommonList()
{
return ['all' => __('Fit_sex all'), 'gg' => __('Fit_sex gg'), 'mm' => __('Fit_sex mm')];
return ['yes' => __('Is_common yes'), 'no' => __('Is_common no')];
}
public function getIsOnlyBoyList()
{
return ['yes' => __('Is_only_boy yes'), 'no' => __('Is_only_boy no')];
}
public function getIsOnlyGirlList()
{
return ['yes' => __('Is_only_girl yes'), 'no' => __('Is_only_girl no')];
}
public function getTypeList()
{
return ['one' => __('Type one'), 'more' => __('Type more')];
}
public function getFitSexTextAttr($value, $data)
public function getIsCommonTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['fit_sex']) ? $data['fit_sex'] : '');
$list = $this->getFitSexList();
$value = $value ? $value : (isset($data['is_common']) ? $data['is_common'] : '');
$list = $this->getIsCommonList();
return isset($list[$value]) ? $list[$value] : '';
}
public function getIsOnlyBoyTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['is_only_boy']) ? $data['is_only_boy'] : '');
$list = $this->getIsOnlyBoyList();
return isset($list[$value]) ? $list[$value] : '';
}
public function getIsOnlyGirlTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['is_only_girl']) ? $data['is_only_girl'] : '');
$list = $this->getIsOnlyGirlList();
return isset($list[$value]) ? $list[$value] : '';
}
public function getTypeTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['type']) ? $data['type'] : '');
$list = $this->getTypeList();
return isset($list[$value]) ? $list[$value] : '';
}

View File

@@ -13,12 +13,48 @@
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Fit_sex')}:</label>
<label class="control-label col-xs-12 col-sm-2">{:__('Is_common')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-fit_sex" data-rule="required" class="form-control selectpicker" name="row[fit_sex]">
{foreach name="fitSexList" item="vo"}
<option value="{$key}" {in name="key" value="all"}selected{/in}>{$vo}</option>
<select id="c-is_common" data-rule="required" class="form-control selectpicker" name="row[is_common]">
{foreach name="isCommonList" item="vo"}
<option value="{$key}" {in name="key" value="yes"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Is_only_boy')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-is_only_boy" data-rule="required" class="form-control selectpicker" name="row[is_only_boy]">
{foreach name="isOnlyBoyList" item="vo"}
<option value="{$key}" {in name="key" value="no"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Is_only_girl')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-is_only_girl" data-rule="required" class="form-control selectpicker" name="row[is_only_girl]">
{foreach name="isOnlyGirlList" item="vo"}
<option value="{$key}" {in name="key" value="no"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-type" class="form-control selectpicker" name="row[type]">
{foreach name="typeList" item="vo"}
<option value="{$key}" {in name="key" value="more"}selected{/in}>{$vo}</option>
{/foreach}
</select>

View File

@@ -13,12 +13,48 @@
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Fit_sex')}:</label>
<label class="control-label col-xs-12 col-sm-2">{:__('Is_common')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-fit_sex" data-rule="required" class="form-control selectpicker" name="row[fit_sex]">
{foreach name="fitSexList" item="vo"}
<option value="{$key}" {in name="key" value="$row.fit_sex"}selected{/in}>{$vo}</option>
<select id="c-is_common" data-rule="required" class="form-control selectpicker" name="row[is_common]">
{foreach name="isCommonList" item="vo"}
<option value="{$key}" {in name="key" value="$row.is_common"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Is_only_boy')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-is_only_boy" data-rule="required" class="form-control selectpicker" name="row[is_only_boy]">
{foreach name="isOnlyBoyList" item="vo"}
<option value="{$key}" {in name="key" value="$row.is_only_boy"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Is_only_girl')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-is_only_girl" data-rule="required" class="form-control selectpicker" name="row[is_only_girl]">
{foreach name="isOnlyGirlList" item="vo"}
<option value="{$key}" {in name="key" value="$row.is_only_girl"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-type" class="form-control selectpicker" name="row[type]">
{foreach name="typeList" item="vo"}
<option value="{$key}" {in name="key" value="$row.type"}selected{/in}>{$vo}</option>
{/foreach}
</select>

View File

@@ -27,9 +27,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'question', title: __('Question'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'fit_sex', title: __('Fit_sex'), searchList: {"all":__('Fit_sex all'),"gg":__('Fit_sex gg'),"mm":__('Fit_sex mm')}, formatter: Table.api.formatter.normal},
{field: 'hdrdepartment.name', title: __('Hdrdepartment.name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'is_common', title: __('Is_common'), searchList: {"yes":__('Is_common yes'),"no":__('Is_common no')}, formatter: Table.api.formatter.normal},
{field: 'is_only_boy', title: __('Is_only_boy'), searchList: {"yes":__('Is_only_boy yes'),"no":__('Is_only_boy no')}, formatter: Table.api.formatter.normal},
{field: 'is_only_girl', title: __('Is_only_girl'), searchList: {"yes":__('Is_only_girl yes'),"no":__('Is_only_girl no')}, formatter: Table.api.formatter.normal},
{field: 'type', title: __('Type'), searchList: {"one":__('Type one'),"more":__('Type more')}, formatter: Table.api.formatter.normal},
{field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'hdrdepartment.name', title: __('Hdrdepartment.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,
buttons: [