Skip to content

Commit 983b2b8

Browse files
author
hikki
committed
1.5
1 parent bc5f340 commit 983b2b8

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

src/DLPViewer.php

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,13 @@ public static function makeComponentLine(Form $form, string $column, string $tit
9494
* 头部-多操作添加
9595
* @param Grid $grid
9696
* @param array $settings 配置项[setting,...]
97-
* setting.document_id dom节点id string(必须填)
98-
* setting.title 自定义按钮名 string(必须填)
99-
* setting.url 加载页地址:url/{id}参数匹配id string(必须填)
100-
* setting.xhr_url ajax提交地址rl/{id}参数匹配id string(选填)
101-
* setting.method ajax提交方法:POST PUT... string(选填)
102-
* setting.options 弹窗配置项 array(选填)
97+
* setting.document_id dom节点id string(必须填)
98+
* setting.title 自定义按钮名 string(必须填)
99+
* setting.url 加载页地址:url/{id}参数匹配id string(必须填)
100+
* setting.xhr_url ajax提交地址rl/{id}参数匹配id string(选填)
101+
* setting.method ajax提交方法:POST PUT... string(选填)
102+
* setting.callback ajax提交回调方法 string(选填)
103+
* setting.options 弹窗配置项 array(选填)
103104
* options = ['W'=>0.8,'H'=>0.8] W宽 H高
104105
*/
105106
public static function makeHeadPlaneAction(Grid $grid, array $settings = [])
@@ -108,10 +109,11 @@ public static function makeHeadPlaneAction(Grid $grid, array $settings = [])
108109
foreach ($settings as $setting) {
109110
$xhr_url = isset($setting['xhr_url']) ? $setting['xhr_url'] : $setting['url'];
110111
$method = isset($setting['method']) ? $setting['method'] : 'POST';
112+
$callback = isset($setting['callback']) ? $setting['callback'] : 'null';
111113
$options = isset($setting['options']) ? json_encode($setting['options']) : '[]';
112114
$script .= <<<EOF
113115
$('#{$setting['document_id']}').click(function(){
114-
new ComponentPlane('{$setting['url']}','{$xhr_url}','{$method}',null,JSON.parse('{$options}'));
116+
new ComponentPlane('{$setting['url']}','{$xhr_url}','{$method}',{$callback},JSON.parse('{$options}'));
115117
});
116118
EOF;
117119
Admin::script($script);
@@ -149,6 +151,7 @@ public function render()
149151
* setting.url 加载页地址:url/{id}参数匹配id string(必须填)
150152
* setting.xhr_url ajax提交地址:url/{id}加参数匹配id string(选填)
151153
* setting.method ajax提交方法:POST PUT... string(选填)
154+
* setting.callback ajax提交回调方法 string(选填)
152155
* setting.options 弹窗配置项 array(选填)
153156
* options = ['W'=>0.8,'H'=>0.8] W宽 H高
154157
* @param array $disable ['view','edit','delete'] 禁止操作按钮
@@ -158,14 +161,15 @@ public static function makeRowPlaneAction(Grid $grid, array $settings = [], arra
158161
$script = '';
159162
foreach ($settings as $setting) {
160163
$url = $setting['url'];
161-
$method = isset($setting['method']) ? $setting['method'] : 'POST';
162164
$xhr_url = isset($setting['xhr_url']) ? $setting['xhr_url'] : $url;
165+
$method = isset($setting['method']) ? $setting['method'] : 'POST';
166+
$callback = isset($setting['callback']) ? $setting['callback'] : 'null';
163167
$options = isset($setting['options']) ? json_encode($setting['options']) : '[]';
164168
$script .= <<<EOF
165169
$('.{$setting['document_class']}').click(function(){
166170
let url = '$url'.replace('{id}',$(this).attr('data-id'));
167171
let xhr_url = '$xhr_url'.replace('{id}',$(this).attr('data-id'));
168-
new ComponentPlane(url,xhr_url,'{$method}',null,JSON.parse('{$options}'));
172+
new ComponentPlane(url,xhr_url,'{$method}',{$callback},JSON.parse('{$options}'));
169173
});
170174
EOF;
171175
}
@@ -207,6 +211,7 @@ public function render()
207211
* setting.url 加载页地址:url/{id}参数匹配id string(必须填)
208212
* setting.xhr_url ajax提交地址:url/{id}加参数匹配id string(选填)
209213
* setting.method ajax提交方法:POST PUT... string(选填)
214+
* setting.callback ajax提交回调方法 string(选填)
210215
* setting.options 弹窗配置项 array(选填)
211216
* options = ['W'=>0.8,'H'=>0.8] W宽 H高
212217
* @param array $disable ['view','edit','delete'] 禁止操作按钮
@@ -216,14 +221,15 @@ public static function _makeRowPlaneAction(Grid $grid, array $settings = [], arr
216221
$script = '';
217222
foreach ($settings as $setting) {
218223
$url = $setting['url'];
219-
$method = isset($setting['method']) ? $setting['method'] : 'POST';
220224
$xhr_url = isset($setting['xhr_url']) ? $setting['xhr_url'] : $url;
225+
$method = isset($setting['method']) ? $setting['method'] : 'POST';
226+
$callback = isset($setting['callback']) ? $setting['callback'] : 'null';
221227
$options = isset($setting['options']) ? json_encode($setting['options']) : '[]';
222228
$script .= <<<EOF
223229
$('.{$setting['document_class']}').click(function(){
224230
let url = '$url'.replace('{id}',$(this).attr('data-id'));
225231
let xhr_url = '$xhr_url'.replace('{id}',$(this).attr('data-id'));
226-
new ComponentPlane(url,xhr_url,'{$method}',null,JSON.parse('{$options}'));
232+
new ComponentPlane(url,xhr_url,'{$method}',{$callback},JSON.parse('{$options}'));
227233
});
228234
EOF;
229235
}

0 commit comments

Comments
 (0)