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