表单,diy细节优化

feat/task1-c-wallet
gongfuxiang 2025-11-11 09:34:19 +08:00
parent 64fc96d2df
commit 09d32ef13f
12 changed files with 86 additions and 18 deletions

View File

@ -583,7 +583,7 @@ class FormTableHandleModule
// 附件字段
$is_handle_annex_field = isset($form_data['is_handle_annex_field']) && $form_data['is_handle_annex_field'] == 1;
$handle_annex_fields = empty($form_data['handle_annex_fields']) ? ['cover', 'logo', 'icon', 'images', 'images_url', 'video', 'video_url'] : (is_array($form_data['handle_annex_fields']) ? $form_data['handle_annex_fields'] : explode(',', $form_data['handle_annex_fields']));
$handle_annex_fields = empty($form_data['handle_annex_fields']) ? ['avatar', 'cover', 'logo', 'icon', 'images', 'images_url', 'video', 'video_url'] : (is_array($form_data['handle_annex_fields']) ? $form_data['handle_annex_fields'] : explode(',', $form_data['handle_annex_fields']));
// 附件字节转单位
$is_handle_annex_size_unit = isset($form_data['is_handle_annex_size_unit']) && $form_data['is_handle_annex_size_unit'] == 1;
@ -1144,25 +1144,48 @@ class FormTableHandleModule
* @param [string] $field [字段]
*/
public function ServiceActionModule($data, $field)
{
return (!empty($data) && !empty($data[$field])) ? $this->ServiceActionModuleHandle($data[$field]) : [];
}
/**
* 服务层方法模块处理
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2022-08-02
* @desc description
* @param [string] $value [字符数据]
*/
public function ServiceActionModuleHandle($value)
{
$result = [];
if(!empty($data) && !empty($data[$field]) && stripos($data[$field], '::') !== false)
if(!empty($value) && stripos($value, '::') !== false)
{
$arr = explode('::', $data[$field]);
$arr = explode('::', $value);
$action = $arr[1];
// 是否存在命名空间反斜杠
if(stripos($arr[0], '\\') === false)
{
if(empty($this->plugins_module_name))
// 是插件则优先走插件的服务层处理
$module = '';
if(!empty($this->plugins_module_name))
{
$module = 'app\plugins\\'.$this->plugins_module_name.'\service\\'.$arr[0];
if(!class_exists($module) || !method_exists($module, $action))
{
$module = '';
}
}
// 再走系统服务层处理
if(empty($module))
{
$module = 'app\service\\'.$arr[0];
} else {
$module = 'app\plugins\\'.$this->plugins_module_name.'\service\\'.$arr[0];
}
} else {
$module = $arr[0];
}
$action = $arr[1];
if(class_exists($module));
if(class_exists($module))
{
if(method_exists($module, $action))
{
@ -1909,6 +1932,15 @@ class FormTableHandleModule
// 默认走自定义模块处理
default :
// 是否自定义类方法处理
$m = $this->ServiceActionModuleHandle($action_custom);
if(!empty($m))
{
$module = $m['module'];
$action = $m['action'];
return $module::$action($value, $params);
}
// 模块是否自定义条件值方法处理条件
$obj = is_object($object_custom) ? $object_custom : $this->module_obj;
if(!empty($action_custom) && method_exists($obj, $action_custom))

View File

@ -5,7 +5,7 @@
<link rel="shortcut icon" type="image/x-icon" href="{{$public_host}}favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{:MyLang('common_service.diy.base_nav_title')}}</title>
<script type="module" crossorigin src="{{$public_host}}static/diy/js/entry/index-2a2c400d.js"></script>
<script type="module" crossorigin src="{{$public_host}}static/diy/js/entry/index-f54f35e2.js"></script>
<link rel="stylesheet" href="{{$public_host}}static/diy/css/index-2f85a04b.css">
</head>
<body>

View File

@ -5,7 +5,7 @@
<link rel="shortcut icon" type="image/x-icon" href="{{$public_host}}favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{:MyLang('common_service.forminput.base_nav_title')}}</title>
<script type="module" crossorigin src="{{$public_host}}static/form_input/js/entry/index-73cff735.js"></script>
<script type="module" crossorigin src="{{$public_host}}static/form_input/js/entry/index-760f2a3e.js"></script>
<link rel="stylesheet" href="{{$public_host}}static/form_input/css/index-8d3e644f.css">
</head>
<body>

View File

@ -216,9 +216,8 @@
{{/if}}
{{/if}}
{{/if}}
<!-- 直接展示数据 -->
{{else /}}
<!-- 直接展示数据 -->
<span>{{$form_table_data_detail[$t['view_key']]|raw}}</span>
{{if isset($t['is_copy']) and $t['is_copy'] eq 1 and !empty($form_table_data_detail[$t['view_key']])}}
<i class="iconfont icon-copy am-margin-left-xs am-color-grey text-copy-submit" data-value="{{$form_table_data_detail[$t['view_key']]|raw}}"></i>
@ -256,6 +255,25 @@
{{/case}}
{{/switch}}
<!-- 底部提示文字 -->
{{if isset($t['is_bottom_text_tips']) and $t['is_bottom_text_tips'] eq 1 and (
(!empty($t['bottom_text_tips_key']) and !empty($form_table_data_detail[$t['bottom_text_tips_key']])) or
!empty($t['bottom_text_tips_data'])
) and (
(empty($t['bottom_text_tips_where_key']) or empty($t['bottom_text_tips_where_type']) or !isset($t['bottom_text_tips_where_value'])) or
(
($t['bottom_text_tips_where_type'] eq 'eq' and $form_table_data_detail[$t['bottom_text_tips_where_key']] eq $t['bottom_text_tips_where_value']) or
($t['bottom_text_tips_where_type'] eq 'gt' and $form_table_data_detail[$t['bottom_text_tips_where_key']] gt $t['bottom_text_tips_where_value']) or
($t['bottom_text_tips_where_type'] eq 'neq' and $form_table_data_detail[$t['bottom_text_tips_where_key']] neq $t['bottom_text_tips_where_value']) or
($t['bottom_text_tips_where_type'] eq 'lt' and $form_table_data_detail[$t['bottom_text_tips_where_key']] lt $t['bottom_text_tips_where_value']) or
($t['bottom_text_tips_where_type'] eq 'in' and is_array($t['bottom_text_tips_where_value']) and in_array($form_table_data_detail[$t['bottom_text_tips_where_key']], $t['bottom_text_tips_where_value'])) or
($t['bottom_text_tips_where_type'] eq 'notin' and is_array($t['bottom_text_tips_where_value']) and !in_array($form_table_data_detail[$t['bottom_text_tips_where_key']], $t['bottom_text_tips_where_value']))
)
)
}}
<p class="am-margin-top-xs {{if !empty($t['bottom_text_tips_style'])}}am-text-{{$t.bottom_text_tips_style}}{{/if}} {{if !empty($t['bottom_text_tips_icon'])}}am-icon-{{$t.bottom_text_tips_icon}}{{/if}}">{{if !empty($t['bottom_text_tips_key']) and !empty($form_table_data_detail[$t['bottom_text_tips_key']])}}{{$form_table_data_detail[$t['bottom_text_tips_key']]}}{{else /}}{{$t.bottom_text_tips_data}}{{/if}}</p>
{{/if}}
<!-- 列表格子钩子 -->
{{if !empty($t['unique_key']) and $t['view_type'] neq 'operate'}}
{{if isset($shopxo_is_develop) and $shopxo_is_develop eq true}}

View File

@ -256,9 +256,8 @@
{{/if}}
{{/if}}
{{/if}}
<!-- 直接展示数据 -->
{{else /}}
<!-- 直接展示数据 -->
<span>{{$form_table_data_list[$i][$t['view_key']]|raw}}</span>
{{if isset($t['is_copy']) and $t['is_copy'] eq 1 and !empty($form_table_data_list[$i][$t['view_key']])}}
<i class="iconfont icon-copy am-margin-left-xs am-color-grey text-copy-submit" data-value="{{$form_table_data_list[$i][$t['view_key']]|raw}}"></i>
@ -375,6 +374,25 @@
{{/case}}
{{/switch}}
<!-- 底部提示文字 -->
{{if isset($t['is_bottom_text_tips']) and $t['is_bottom_text_tips'] eq 1 and (
(!empty($t['bottom_text_tips_key']) and !empty($form_table_data_list[$i][$t['bottom_text_tips_key']])) or
!empty($t['bottom_text_tips_data'])
) and (
(empty($t['bottom_text_tips_where_key']) or empty($t['bottom_text_tips_where_type']) or !isset($t['bottom_text_tips_where_value'])) or
(
($t['bottom_text_tips_where_type'] eq 'eq' and $form_table_data_list[$i][$t['bottom_text_tips_where_key']] eq $t['bottom_text_tips_where_value']) or
($t['bottom_text_tips_where_type'] eq 'gt' and $form_table_data_list[$i][$t['bottom_text_tips_where_key']] gt $t['bottom_text_tips_where_value']) or
($t['bottom_text_tips_where_type'] eq 'neq' and $form_table_data_list[$i][$t['bottom_text_tips_where_key']] neq $t['bottom_text_tips_where_value']) or
($t['bottom_text_tips_where_type'] eq 'lt' and $form_table_data_list[$i][$t['bottom_text_tips_where_key']] lt $t['bottom_text_tips_where_value']) or
($t['bottom_text_tips_where_type'] eq 'in' and is_array($t['bottom_text_tips_where_value']) and in_array($form_table_data_list[$i][$t['bottom_text_tips_where_key']], $t['bottom_text_tips_where_value'])) or
($t['bottom_text_tips_where_type'] eq 'notin' and is_array($t['bottom_text_tips_where_value']) and !in_array($form_table_data_list[$i][$t['bottom_text_tips_where_key']], $t['bottom_text_tips_where_value']))
)
)
}}
<p class="am-margin-top-xs {{if !empty($t['bottom_text_tips_style'])}}am-text-{{$t.bottom_text_tips_style}}{{/if}} {{if !empty($t['bottom_text_tips_icon'])}}am-icon-{{$t.bottom_text_tips_icon}}{{/if}}">{{if !empty($t['bottom_text_tips_key']) and !empty($form_table_data_list[$i][$t['bottom_text_tips_key']])}}{{$form_table_data_list[$i][$t['bottom_text_tips_key']]}}{{else /}}{{$t.bottom_text_tips_data}}{{/if}}</p>
{{/if}}
<!-- 列表格子钩子 -->
{{if !empty($t['unique_key']) and $t['view_type'] neq 'operate'}}
{{if isset($shopxo_is_develop) and $shopxo_is_develop eq true}}

View File

@ -0,0 +1 @@
import{d as a,c as e,u as s,a as r,o as t}from"../entry/index-f54f35e2.js";const n=a({__name:"index",setup(a){const n=s(),p=r(),{params:o,query:u}=n,{path:d}=o;return p.replace({path:"/"+d,query:u}),(a,s)=>(t(),e("div"))}});export{n as default};

View File

@ -1 +0,0 @@
import{d as a,c as e,u as s,a as r,o as t}from"../entry/index-2a2c400d.js";const n=a({__name:"index",setup(a){const n=s(),p=r(),{params:o,query:u}=n,{path:d}=o;return p.replace({path:"/"+d,query:u}),(a,s)=>(t(),e("div"))}});export{n as default};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
import{d as a,c as e,u as s,a as r,o as t}from"../entry/index-760f2a3e.js";const n=a({__name:"index",setup(a){const n=s(),p=r(),{params:o,query:u}=n,{path:d}=o;return p.replace({path:"/"+d,query:u}),(a,s)=>(t(),e("div"))}});export{n as default};

View File

@ -1 +0,0 @@
import{d as a,c as e,u as s,a as r,o as t}from"../entry/index-73cff735.js";const n=a({__name:"index",setup(a){const n=s(),p=r(),{params:o,query:u}=n,{path:d}=o;return p.replace({path:"/"+d,query:u}),(a,s)=>(t(),e("div"))}});export{n as default};