diff --git a/app/admin/controller/Common.php b/app/admin/controller/Common.php
index eaf8e59225c966138189a966acfbbe3840642ac1..a04691588ba8d5d7c67752f8443a7dca008eb565 100755
--- a/app/admin/controller/Common.php
+++ b/app/admin/controller/Common.php
@@ -394,6 +394,8 @@ class Common extends BaseController
}
}
+ // 表格列表公共标识
+ MyViewAssign('hook_name_form_list', $current.'_list');
// 内容外部顶部
MyViewAssign('hook_name_content_top', $current.'_content_top');
// 内容外部底部
diff --git a/app/admin/view/default/public/module/form_table.html b/app/admin/view/default/public/module/form_table.html
index b6ffedfd42c8c415b9880108068f10f7ec379126..180be5eeee13c28abc7fa8ac8aba3bdc52b4dafc 100644
--- a/app/admin/view/default/public/module/form_table.html
+++ b/app/admin/view/default/public/module/form_table.html
@@ -298,6 +298,33 @@
{{/if}}
{{/case}}
{{/switch}}
+
+
+ {{if !empty($t['unique_key']) and $t['view_type'] neq 'operate'}}
+ {{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}}
+
+ {{$hook_name_form_list}}_grid_{{$t.unique_key}}
+
+ {{/if}}
+ {{php}}
+ $hook_data = MyEventTrigger($hook_name_form_list.'_grid_'.$t['unique_key'], [
+ 'hook_name' => $hook_name_form_list.'_grid_'.$t['unique_key'],
+ 'is_backend' => true,
+ 'id' => isset($data_list[$i][$form_table['base']['key_field']]) ? $data_list[$i][$form_table['base']['key_field']] : 0,
+ 'data' => $data_list[$i],
+ ]);
+ if(!empty($hook_data) && is_array($hook_data))
+ {
+ foreach($hook_data as $hook)
+ {
+ if(is_string($hook) || is_int($hook))
+ {
+ echo htmlspecialchars_decode($hook);
+ }
+ }
+ }
+ {{/php}}
+ {{/if}}
{{/if}}
{{/if}}
diff --git a/app/index/controller/Common.php b/app/index/controller/Common.php
index 54d1bf7c6f5f7def49d5b985318b661e4b3d51c0..21344f1f9efc90bb8d80b61f5f6f4d073fcdaebc 100755
--- a/app/index/controller/Common.php
+++ b/app/index/controller/Common.php
@@ -554,6 +554,8 @@ class Common extends BaseController
}
}
+ // 表格列表公共标识
+ MyViewAssign('hook_name_form_list', $current.'_list');
// 内容外部顶部
MyViewAssign('hook_name_content_top', $current.'_content_top');
// 内容外部底部
diff --git a/app/index/view/default/public/module/form_table.html b/app/index/view/default/public/module/form_table.html
index b6ffedfd42c8c415b9880108068f10f7ec379126..180be5eeee13c28abc7fa8ac8aba3bdc52b4dafc 100644
--- a/app/index/view/default/public/module/form_table.html
+++ b/app/index/view/default/public/module/form_table.html
@@ -298,6 +298,33 @@
{{/if}}
{{/case}}
{{/switch}}
+
+
+ {{if !empty($t['unique_key']) and $t['view_type'] neq 'operate'}}
+ {{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}}
+
+ {{$hook_name_form_list}}_grid_{{$t.unique_key}}
+
+ {{/if}}
+ {{php}}
+ $hook_data = MyEventTrigger($hook_name_form_list.'_grid_'.$t['unique_key'], [
+ 'hook_name' => $hook_name_form_list.'_grid_'.$t['unique_key'],
+ 'is_backend' => true,
+ 'id' => isset($data_list[$i][$form_table['base']['key_field']]) ? $data_list[$i][$form_table['base']['key_field']] : 0,
+ 'data' => $data_list[$i],
+ ]);
+ if(!empty($hook_data) && is_array($hook_data))
+ {
+ foreach($hook_data as $hook)
+ {
+ if(is_string($hook) || is_int($hook))
+ {
+ echo htmlspecialchars_decode($hook);
+ }
+ }
+ }
+ {{/php}}
+ {{/if}}
{{/if}}
{{/if}}
diff --git a/app/module/FormHandleModule.php b/app/module/FormHandleModule.php
index 04d0c18125859173c55d5ac33ea3be0dd9a88519..63e555f0bf4451526f57f6d2cc79c30565511cd8 100644
--- a/app/module/FormHandleModule.php
+++ b/app/module/FormHandleModule.php
@@ -620,6 +620,22 @@ class FormHandleModule
{
$this->order_by['field'] = empty($v['sort_field']) ? $form_name : $v['sort_field'];
}
+
+ // 唯一key,避免是模块路径、直接取最后一段
+ $unique_key = '';
+ if(!empty($v['view_key']))
+ {
+ // 多字段情况下
+ if(is_array($v['view_key']))
+ {
+ $unique_key = isset($v['view_key'][0]) ? $v['view_key'][0] : '';
+ } else {
+ // 字段名称、模块路径
+ $temp = explode('/', $v['view_key']);
+ $unique_key = empty($temp) ? '' : end($temp);
+ }
+ }
+ $v['unique_key'] = $unique_key;
}
}