3
3
namespace App \Admin \Controllers ;
4
4
5
5
use DLP \Tool \Assistant ;
6
- use DLP \Tool \FormPanel ;
7
6
use DLP \Widget \Plane ;
8
7
use Encore \Admin \Admin ;
9
8
use Encore \Admin \Controllers \AdminController ;
@@ -46,7 +45,7 @@ protected function grid()
46
45
* url 弹窗页地址
47
46
* xhr_url 表单提交地址
48
47
* method 提交方式 POST PUT GET ...
49
- * callback ajax请求回调函数
48
+ * callback ajax请求回调js函数 (字符串方式书写)
50
49
* function(response){
51
50
* alert(response);
52
51
* }
@@ -59,7 +58,7 @@ protected function grid()
59
58
* url 弹窗页地址 {id}反向匹配当前行id
60
59
* xhr_url 表单提交地址 {id}反向匹配当前行id
61
60
* method 提交方式 POST PUT GET ...
62
- * callback ajax请求回调函数
61
+ * callback ajax请求回调js函数 (字符串方式书写)
63
62
* function(response){
64
63
* alert(response);
65
64
* }
@@ -128,9 +127,13 @@ protected function form($id)
128
127
129
128
/**
130
129
* 点组件
131
- * options 设置数据集 一维数组 格式 [value1=>text1,value2=>text2...]
132
- * checked 已选择 一维数组 值类型integer
130
+ * options 设置数据集 一维数组 格式 [value1=>text1,value2=>text2...]
131
+ * checked 已选择 一维数组 值类型integer
132
+ * attribute.width 设置宽度 默认100%
133
133
* attribute.height 设置高度 默认200px
134
+ * attribute.limit 选择限制数 默认0:无限
135
+ * attribute.mode 组件模式设置 false:默认模式 true:下拉列表模式
136
+ * attribute.placeholder 下拉列表模式 默认未选择占位
134
137
*/
135
138
$ form ->Dot ('dot ' ,'标签选择器 ' )
136
139
->options ([1 =>'松下紗栄子 ' ,2 =>'上原亜衣 ' ,3 =>'白石茉莉奈 ' ,4 =>'美谷朱里 ' ,5 =>'沖田杏梨 ' ,6 =>'由愛可奈 ' ,7 =>'七瀬あいり ' ,8 =>'五十嵐星蘭 ' ,9 =>'仲里紗羽 ' ,10 =>'波多野結衣 ' ])
@@ -141,93 +144,106 @@ protected function form($id)
141
144
* 级联点组件
142
145
* options 设置数据集 多维数组 格式[[key=>key1,val=>value1,nodes=>[...]],...]
143
146
* 链表结构数据辅助组装
144
- * 1.倒排父节点查询
145
- * $select = Model::orderBy('parent_id ','DESC')->select('id as key','name as val','parent_id as par')->get()->toArray();
147
+ * 1.倒排父节点查询 注:id name parent_id 必须命别名 key val par
148
+ * $select = Model::orderBy('par ','DESC')->select('id as key','name as val','parent_id as par')->get()->toArray();
146
149
* 2.辅助函数dimension 组装后的结构参考$this->cascadeData()的示例数据
147
150
* DLPHelper::dimension($select);
148
- * checked 已选择 一维数组 值类型integer
151
+ * checked 已选择 一维数组 值类型integer
152
+ * attribute.width 设置宽度 默认100%
149
153
* attribute.height 设置高度 默认200px
154
+ * attribute.limit 选择限制数 默认0:无限
150
155
*/
151
- $ form ->CascadeDot ('cascadeDot ' ,'级联标签选择器 ' )
152
- ->options ($ this ->cascadeData ())
156
+ $ form ->CascadeDot ('cascadeDot ' ,'级联选择器 ' )
157
+ ->options ($ this ->cascadeExampleData ())
153
158
->checked ([614 ,550 ,543 ])
154
159
->attribute (['height ' =>'200px ' ]);
155
160
156
161
/**
157
162
* 线组件
158
- * columns 设置列表head名称 row字段输出格式input,text,hidden
159
- * options 设置数据集 二维数组
160
- * attribute.height 设置高度 默认360px
161
- * attribute.options 设置操作列 默认开启['sortable'=>true,'delete'=>true]
163
+ * columns[column...] 列数据格式配置
164
+ * column.name 列表头名称
165
+ * column.type 列数据 输出格式input,text,hidden,datetime,date,select,image,file
166
+ * column.insert_type 增加列格式(不填时默认等同于type值) hidden表示置空
167
+ * column.options insert_type或type为select时 多选项
168
+ * column.options_limit insert_type或type为select时 多选项选择限制数 默认0:无限制
169
+ * column.style 自定义style格式
170
+ * list 设置数据集 二维数组列表格式
171
+ * attribute.width 设置宽度 默认100%
172
+ * attribute.height 设置高度 默认355px
173
+ * attribute.options 设置操作列 默认开启:可排序/可删除/可新增['sortable' => true, 'delete' => true, 'insert' => true]
162
174
*/
163
- $ form ->Linear ('flux_linkage ' , '磁力链接 ' )
175
+ $ form ->Linear ('line ' , '列表管理器 ' )
164
176
->columns ([
165
177
'name ' => ['name ' => '名称 ' , 'type ' => 'input ' ],
166
- 'meta ' => ['name ' => '信息 ' , 'type ' => 'input ' ],
167
- 'url ' => ['name ' => '链接 ' , 'type ' => 'input ' ],
168
- 'time ' => ['name ' => '更新时间 ' , 'type ' => 'text ' ],
169
- 'is-small ' => ['name ' => '高清[1是 2否] ' , 'type ' => 'input ' , 'style ' => 'width:60px ' ],
170
- 'is-warning ' => ['name ' => '含字幕[1是 2否] ' , 'type ' => 'input ' , 'style ' => 'width:60px ' ]
178
+ 'meta ' => ['name ' => '信息 ' , 'type ' => 'input ' ,'insert_type ' =>'hidden ' ],
179
+ 'url ' => ['name ' => '链接 ' , 'type ' => 'image ' ],
180
+ 'time ' => ['name ' => '更新时间 ' , 'type ' => 'text ' ,'insert_type ' =>'datetime ' ],
181
+ 'is-small ' => ['name ' => '高清 ' , 'type ' => 'select ' ,'options ' =>[1 =>'是 ' ,2 =>'否 ' ],'options_limit ' =>1 , 'style ' => 'width:60px ' ]
171
182
])
172
- ->options ([
173
- ['name ' =>'01 ' ,'meta ' =>'test info1 ' ,'url ' =>'1 ' ,'time ' =>'2021-05-15 00:00:00 ' ,'is-small ' =>1 ,'is-warning ' =>1 ],
174
- ['name ' =>'02 ' ,'meta ' =>'test info2 ' ,'url ' =>'2 ' ,'time ' =>'2021-05-15 00:00:00 ' ,'is-small ' =>1 ,'is-warning ' =>1 ],
175
- ['name ' =>'03 ' ,'meta ' =>'test info3 ' ,'url ' =>'3 ' ,'time ' =>'2021-05-15 00:00:00 ' ,'is-small ' =>1 ,'is-warning ' =>1 ]]);
183
+ ->list ([
184
+ ['name ' =>'01 ' ,'meta ' =>'test info1 ' ,'url ' =>'1 ' ,'time ' =>'2021-05-15 00:00:00 ' ,'is-small ' =>1 ],
185
+ ['name ' =>'02 ' ,'meta ' =>'test info2 ' ,'url ' =>'2 ' ,'time ' =>'2021-05-15 00:00:00 ' ,'is-small ' =>1 ],
186
+ ['name ' =>'03 ' ,'meta ' =>'test info3 ' ,'url ' =>'3 ' ,'time ' =>'2021-05-15 00:00:00 ' ,'is-small ' =>1 ]])
187
+ ->attribute (['height ' => '360px ' ,'options ' =>['sortable ' => true , 'delete ' => true , 'insert ' => true ]]);
176
188
177
189
/**
178
190
* 级联线组件
179
- * options 设置数据集 多维数组 格式[[key=>key1,val=>value1,nodes=>[...]],...]
191
+ * list 设置数据集 多维数组 格式[[key=>key1,val=>value1,nodes=>[...]],...]
180
192
* 链表结构数据辅助组装
181
- * 1.倒排父节点查询
193
+ * 1.倒排父节点查询 注:id name parent_id 必须命别名 key val par
182
194
* $select = Model::orderBy('parent_id','DESC')->select('id as key','name as val','parent_id as par')->get()->toArray();
183
195
* 2.辅助函数dimension 组装后的$select结构参考$this->cascadeExampleData()返回数据
184
196
* DLPHelper::dimension($select);
185
- * xhr 接口地址 编码参见:test\CascadeLineController
186
- * attribute.height 设置高度 默认200px
197
+ * xhr 接口地址 编码参见文件:test\CascadeLineController 路由配置$router->resource('xhr地址', 'CascadeLineController')
198
+ * attribute.width 设置宽度 默认100%
199
+ * attribute.height 设置高度 默认200px
200
+ * attribute.options 设置 可迁移(迁移该节点与其子集到其他节点下)/可交换(节点与其后代节点交换位置)/可新增/可修改/可删除
201
+ * ['movable' => true,'exchange' => true,'insert' => true,'update' => true,'delete' => true]
187
202
*/
188
- $ form ->CascadeLine ('cascadeLine ' ,'级联标签管理器 ' )
189
- ->options ($ this ->cascadeExampleData ())
190
- ->xhr ('route-to-CascadeLineController ' );
203
+ $ form ->CascadeLine ('cascadeLine ' ,'级联管理器 ' )
204
+ ->list ($ this ->cascadeExampleData ())
205
+ ->xhr ('.../xhr地址 ' )
206
+ ->attribute (['height ' => '200px ' ,'options ' =>['movable ' => true ,'exchange ' => true ,'insert ' => true ,'update ' => true ,'delete ' => true ]]);
191
207
return $ form ;
192
208
}
193
209
194
210
public function blank ()
195
- {
196
- $ title = '<h1>松下紗栄子</h1> ' ;
197
- /*弹窗模式 渲染自定义页模板 Plane::html*/
198
- $ panel = new FormPanel ();
199
- $ panel ->input ('id ' ,'序号 ' );
200
- $ panel ->textarea ('descript ' ,'描述 ' );
201
- $ panel ->select ('status ' ,'状态 ' ,[0 ],[0 =>'开启 ' ,1 =>'关闭 ' ,2 =>'删除 ' ],1 );
202
- $ panel ->datepicker ('time ' ,'时间 ' );
203
- $ panel ->html ('test ' ,'自定义 ' ,'<p>松下紗栄子</p> ' );
204
- /*多图/文件 上传样例 */
205
- $ settings = [
206
- 'uploadUrl ' => 'https://...upload.file.url... ' ,
207
- 'uploadExtraData ' => [
208
- '_token ' => csrf_token (),
209
- 'uploadAsync ' => true ,
210
- /*自定义加传参*/
211
- ],
212
- 'deleteUrl ' => 'https://...delete.file.url... ' ,
213
- 'deleteExtraData ' => [
214
- '_token ' => csrf_token (),
215
- 'uploadAsync ' => true ,
216
- /*自定义加传参*/
217
- ],
218
- 'maxFileCount ' => 10 ,
219
- 'maxFileSize ' => 800 //单图限制800kb
220
- ];
221
- $ images = ['/image1... ' ,'/image2... ' ,'/image3... ' ];
222
- $ panel ->fileInput ('photo ' ,'艳照 ' ,$ settings ,
223
- ['files ' => $ images , 'url ' => '/image.server... ' ],
224
- "accept='image/*' " );
225
-
226
- $ html = $ panel ->compile ();
227
- return Plane::html ($ title .$ html );
228
- }
211
+ {
212
+ $ title = '<h1>松下紗栄子</h1> ' ;
213
+ /*弹窗模式 渲染自定义页模板 Plane::html*/
214
+ $ panel = new FormPanel ();
215
+ $ panel ->input ('id ' ,'序号 ' );
216
+ $ panel ->textarea ('description ' ,'描述 ' );
217
+ $ panel ->select ('status ' ,'状态 ' ,[0 ],[0 =>'开启 ' ,1 =>'关闭 ' ,2 =>'删除 ' ],1 );
218
+ $ panel ->datepicker ('time ' ,'时间 ' );
219
+ $ panel ->html ('test ' ,'自定义html ' ,'<p>松下紗栄子</p> ' );
220
+ /*多图上传样例 */
221
+ $ settings = [
222
+ 'uploadUrl ' => 'https://...upload.file.url... ' ,
223
+ 'uploadExtraData ' => [
224
+ '_token ' => csrf_token (),
225
+ 'uploadAsync ' => true ,
226
+ /*自定义加传参*/
227
+ ],
228
+ 'deleteUrl ' => 'https://...delete.file.url... ' ,
229
+ 'deleteExtraData ' => [
230
+ '_token ' => csrf_token (),
231
+ 'uploadAsync ' => true ,
232
+ /*自定义加传参*/
233
+ ],
234
+ 'maxFileCount ' => 10 ,
235
+ 'maxFileSize ' => 800 //单图限制800kb
236
+ ];
237
+ $ images = ['/image1... ' ,'/image2... ' ,'/image3... ' ];
238
+ $ panel ->fileInput ('photo ' ,'艳照 ' ,$ settings ,
239
+ ['files ' => $ images , 'url ' => '/image.server... ' ],
240
+ "accept='image/*' " );
241
+
242
+ $ html = $ panel ->compile ();
243
+ return Plane::html ($ title .$ html );
244
+ }
229
245
230
- private function cascadeData ()
246
+ private function cascadeExampleData ()
231
247
{
232
248
return [
233
249
["key " => "3 " , "val " => "基本 " , "nodes " => [
0 commit comments