mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-01 15:32:48 +08:00
feat: 完成基本的详情生成
This commit is contained in:
@@ -27,29 +27,13 @@ class Goods extends AdminController
|
||||
|
||||
$this->model = new \app\admin\model\TestGoods();
|
||||
|
||||
$select_list_status_list = [];
|
||||
foreach ($this->model::SELECT_LIST_STATUS as $key => $value) {
|
||||
$select_list_status_list[] = ['value' => $key, 'label' => $value];
|
||||
}
|
||||
$this->assign('select_list_status', $select_list_status_list, true);
|
||||
$this->assign('select_list_status', $this->model::SELECT_LIST_STATUS, true);
|
||||
|
||||
$select_list_time_status_list = [];
|
||||
foreach ($this->model::SELECT_LIST_TIME_STATUS as $key => $value) {
|
||||
$select_list_time_status_list[] = ['value' => $key, 'label' => $value];
|
||||
}
|
||||
$this->assign('select_list_time_status', $select_list_time_status_list, true);
|
||||
$this->assign('select_list_time_status', $this->model::SELECT_LIST_TIME_STATUS, true);
|
||||
|
||||
$select_list_is_recommend_list = [];
|
||||
foreach ($this->model::SELECT_LIST_IS_RECOMMEND as $key => $value) {
|
||||
$select_list_is_recommend_list[] = ['value' => $key, 'label' => $value];
|
||||
}
|
||||
$this->assign('select_list_is_recommend', $select_list_is_recommend_list, true);
|
||||
$this->assign('select_list_is_recommend', $this->model::SELECT_LIST_IS_RECOMMEND, true);
|
||||
|
||||
$select_list_shop_type_list = [];
|
||||
foreach ($this->model::SELECT_LIST_SHOP_TYPE as $key => $value) {
|
||||
$select_list_shop_type_list[] = ['value' => $key, 'label' => $value];
|
||||
}
|
||||
$this->assign('select_list_shop_type', $select_list_shop_type_list, true);
|
||||
$this->assign('select_list_shop_type', $this->model::SELECT_LIST_SHOP_TYPE, true);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -73,6 +73,18 @@ class TestGoods extends TimeModel
|
||||
}
|
||||
return explode('|', $data['verfiy_file']);
|
||||
}
|
||||
/**
|
||||
* 商品类型获取器
|
||||
* @param $value
|
||||
* @return array
|
||||
*/
|
||||
public function getShopTypeListAttr($value, $data)
|
||||
{
|
||||
if (empty($data['shop_type'])) {
|
||||
return [];
|
||||
}
|
||||
return explode(',', $data['shop_type']);
|
||||
}
|
||||
|
||||
|
||||
public function mallCate()
|
||||
|
||||
@@ -8,14 +8,13 @@
|
||||
<div class="detail-id">ID: {$row.id}</div>
|
||||
</div>
|
||||
<div class="layui-col-md3 text-right detail-actions">
|
||||
<button class="layui-btn layui-btn-primary" onclick="window.history.back()">返回</button>
|
||||
<button class="layui-btn" onclick="location.href='{{:url("edit", ["id" => $row.id])}}'">编辑</button>
|
||||
<button class="layui-btn layui-btn-danger" onclick="deleteData({{$row.id}})">删除</button>
|
||||
<button class="layui-btn layui-btn-primary" layuimini-content-href="{$Request.param.backTagId}" data-back="1">返回</button>
|
||||
<button class="layui-btn" onclick="location.href='{:url("edit", ["id" => $row.id])}'">编辑</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-card-body detail-content">
|
||||
<div class="layui-row">
|
||||
<div class="layui-row layui-col-space12">
|
||||
<!-- 左侧主体内容 -->
|
||||
<div class="layui-col-md8 detail-main">
|
||||
<div class="detail-field-group">
|
||||
@@ -154,19 +153,19 @@
|
||||
<div class="detail-field-item">
|
||||
<div class="detail-field-label">秒杀状态</div>
|
||||
<div class="detail-field-value">
|
||||
{volist name="select_list_time_status" id="vo"}{eq name="vo.value" value="$row.time_status"}{$vo.label}{/eq}{/volist}
|
||||
{$select_list_time_status[$row.time_status]|default=''}
|
||||
</div>
|
||||
</div>
|
||||
<div class="detail-field-item">
|
||||
<div class="detail-field-label">是否推荐</div>
|
||||
<div class="detail-field-value">
|
||||
{volist name="select_list_is_recommend" id="vo"}{eq name="vo.value" value="$row.is_recommend"}<span class="layui-badge">{volist name="select_list_is_recommend" id="item"}{eq name="item.value" value="$row.is_recommend"}{$item.label}{/eq}{/volist}</span>{/eq}{/volist}
|
||||
<span class="layui-badge">{$select_list_is_recommend[$row.is_recommend]|default=''}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="detail-field-item">
|
||||
<div class="detail-field-label">商品类型</div>
|
||||
<div class="detail-field-value">
|
||||
{volist name="row.shop_type|explode=','" id="item"><span class="layui-badge layui-badge-rim" style="margin-right: 5px;">{volist name="select_list_shop_type" id="vo"}{eq name="vo.value" value="$item"}{$vo.label}{/eq}{/volist}</span>{/volist}
|
||||
{volist name="row.shop_type_list" id="item"}<span class="layui-badge layui-badge-rim" style="margin-right: 5px;">{$select_list_shop_type[$item]|default=''}</span>{/volist}
|
||||
</div>
|
||||
</div>
|
||||
<div class="detail-field-item">
|
||||
@@ -273,7 +272,7 @@
|
||||
<div class="detail-field-item">
|
||||
<div class="detail-field-label">状态</div>
|
||||
<div class="detail-field-value">
|
||||
{volist name="select_list_status" id="vo"}{eq name="vo.value" value="$row.status"}<span class="layui-badge">{volist name="select_list_status" id="item"}{eq name="item.value" value="$row.status"}{$item.label}{/eq}{/volist}</span>{/eq}{/volist}
|
||||
<span class="layui-badge">{$select_list_status[$row.status]|default=''}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="detail-field-item">
|
||||
|
||||
@@ -1213,8 +1213,16 @@ class BuildCurdServiceBase
|
||||
$selectList .= $this->buildSelectModel($field, $val['define']);
|
||||
}
|
||||
|
||||
// 为多图片和多文件字段生成获取器
|
||||
if (in_array($val['formType'], ['images', 'files'])) {
|
||||
// 为多图片、多文件、多选字段生成获取器
|
||||
if (in_array($val['formType'], ['images', 'files', 'checkbox'])) {
|
||||
// checkbox 使用逗号分隔,images/files 使用自定义分隔符
|
||||
if ($val['formType'] == 'checkbox') {
|
||||
$val['define'] = ','; // 多选框固定使用逗号分隔
|
||||
} elseif ($val['formType'] == 'images' || $val['formType'] == 'files') {
|
||||
if (!isset($val['define'])) {
|
||||
$val['define'] = '|'; // 默认分隔符
|
||||
}
|
||||
}
|
||||
$accessorList .= $this->buildAccessorModel($field, $val);
|
||||
}
|
||||
|
||||
@@ -1873,15 +1881,16 @@ class BuildCurdServiceBase
|
||||
} elseif ($val['formType'] == 'radio' || $val['formType'] == 'switch') {
|
||||
$templateFile = "view{$this->DS}module{$this->DS}readSwitch";
|
||||
if (isset($val['define']) && !empty($val['define'])) {
|
||||
// 构建下拉选择的显示值
|
||||
// 使用 kv 格式直接获取值
|
||||
$var_name = $this->getFieldVarName($field);
|
||||
$define = '{volist name="' . $var_name . '" id="vo"}{eq name="vo.value" value="$row.' . $field . '"}<span class="layui-badge">{volist name="' . $var_name . '" id="item"}{eq name="item.value" value="$row.' . $field . '"}{$item.label}{/eq}{/volist}</span>{/eq}{/volist}';
|
||||
$define = '<span class="layui-badge">{$' . $var_name . '[$row.' . $field . ']|default=\'\'}</span>';
|
||||
}
|
||||
} elseif ($val['formType'] == 'checkbox') {
|
||||
$templateFile = "view{$this->DS}module{$this->DS}readSelect";
|
||||
if (isset($val['define']) && !empty($val['define'])) {
|
||||
$var_name = $this->getFieldVarName($field);
|
||||
$define = '{volist name="row.' . $field . '|explode=\',\'" id="item"><span class="layui-badge layui-badge-rim" style="margin-right: 5px;">{volist name="' . $var_name . '" id="vo"}{eq name="vo.value" value="$item"}{$vo.label}{/eq}{/volist}</span>{/volist}';
|
||||
// 使用获取器列表,如 shop_type_list
|
||||
$define = '{volist name="row.' . $field . '_list" id="item"}<span class="layui-badge layui-badge-rim" style="margin-right: 5px;">{$' . $var_name . '[$item]|default=\'\'}</span>{/volist}';
|
||||
}
|
||||
} elseif ($val['formType'] == 'select') {
|
||||
$templateFile = "view{$this->DS}module{$this->DS}readSelect";
|
||||
@@ -1889,7 +1898,7 @@ class BuildCurdServiceBase
|
||||
$define = '{$row.' . $field . '}';
|
||||
} elseif (isset($val['define']) && !empty($val['define'])) {
|
||||
$var_name = $this->getFieldVarName($field);
|
||||
$define = '{volist name="' . $var_name . '" id="vo"}{eq name="vo.value" value="$row.' . $field . '"}{$vo.label}{/eq}{/volist}';
|
||||
$define = '{$' . $var_name . '[$row.' . $field . ']|default=\'\'}';
|
||||
}
|
||||
} elseif ($val['formType'] == 'relation') {
|
||||
// 关联表字段暂时使用文本显示
|
||||
|
||||
@@ -1,6 +1,2 @@
|
||||
|
||||
${{var_name}}_list = [];
|
||||
foreach ($this->model::{{name}} as $key => $value) {
|
||||
${{var_name}}_list[] = ['value' => $key, 'label' => $value];
|
||||
}
|
||||
$this->assign('{{var_name}}', ${{var_name}}_list, true);
|
||||
$this->assign('{{var_name}}', $this->model::{{name}}, true);
|
||||
|
||||
@@ -8,14 +8,13 @@
|
||||
<div class="detail-id">ID: {$row.id}</div>
|
||||
</div>
|
||||
<div class="layui-col-md3 text-right detail-actions">
|
||||
<button class="layui-btn layui-btn-primary" onclick="window.history.back()">返回</button>
|
||||
<button class="layui-btn" onclick="location.href='{{:url("edit", ["id" => $row.id])}}'">编辑</button>
|
||||
<button class="layui-btn layui-btn-danger" onclick="deleteData({{$row.id}})">删除</button>
|
||||
<button class="layui-btn layui-btn-primary" layuimini-content-href="{$Request.param.backTagId}" data-back="1">返回</button>
|
||||
<button class="layui-btn" onclick="location.href='{:url("edit", ["id" => $row.id])}'">编辑</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-card-body detail-content">
|
||||
<div class="layui-row">
|
||||
<div class="layui-row layui-col-space12">
|
||||
<!-- 左侧主体内容 -->
|
||||
<div class="layui-col-md8 detail-main">
|
||||
<div class="detail-field-group">
|
||||
|
||||
@@ -587,8 +587,7 @@ table样式
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
margin-bottom: 15px;
|
||||
padding-bottom: 10px;
|
||||
padding: 5px;
|
||||
border-bottom: 1px solid #e8e8e8;
|
||||
}
|
||||
|
||||
@@ -599,8 +598,7 @@ table样式
|
||||
|
||||
/* 字段项样式 */
|
||||
.detail-field-item {
|
||||
margin-bottom: 15px;
|
||||
padding-bottom: 15px;
|
||||
padding: 5px;
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
@@ -593,8 +593,7 @@ table样式
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
margin-bottom: 15px;
|
||||
padding-bottom: 10px;
|
||||
padding: 5px;
|
||||
border-bottom: 1px solid #e8e8e8;
|
||||
}
|
||||
|
||||
@@ -605,8 +604,7 @@ table样式
|
||||
|
||||
/* 字段项样式 */
|
||||
.detail-field-item {
|
||||
margin-bottom: 15px;
|
||||
padding-bottom: 15px;
|
||||
padding: 5px;
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user