Skip to content

Commit 4befbe8

Browse files
author
hikki
committed
v3.6
1 parent a01d5d2 commit 4befbe8

File tree

1 file changed

+50
-43
lines changed

1 file changed

+50
-43
lines changed

test/example.php

Lines changed: 50 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace App\Admin\Controllers;
44

55
use DLP\Tool\Assistant;
6+
use DLP\Tool\FormPanel;
67
use DLP\Widget\Plane;
78
use Encore\Admin\Admin;
89
use Encore\Admin\Controllers\AdminController;
@@ -45,7 +46,7 @@ protected function grid()
4546
* url 弹窗页地址
4647
* xhr_url 表单提交地址
4748
* method 提交方式 POST PUT GET ...
48-
* callback ajax请求回调js函数 (字符串方式书写)
49+
* callback ajax请求回调函数
4950
* function(response){
5051
* alert(response);
5152
* }
@@ -58,7 +59,7 @@ protected function grid()
5859
* url 弹窗页地址 {id}反向匹配当前行id
5960
* xhr_url 表单提交地址 {id}反向匹配当前行id
6061
* method 提交方式 POST PUT GET ...
61-
* callback ajax请求回调js函数 (字符串方式书写)
62+
* callback ajax请求回调函数
6263
* function(response){
6364
* alert(response);
6465
* }
@@ -127,13 +128,9 @@ protected function form($id)
127128

128129
/**
129130
* 点组件
130-
* options 设置数据集 一维数组 格式 [value1=>text1,value2=>text2...]
131-
* checked 已选择 一维数组 值类型integer
132-
* attribute.width 设置宽度 默认100%
131+
* options 设置数据集 一维数组 格式 [value1=>text1,value2=>text2...]
132+
* checked 已选择 一维数组 值类型integer
133133
* attribute.height 设置高度 默认200px
134-
* attribute.limit 选择限制数 默认0:无限
135-
* attribute.menu_mode 组件模式设置 false:默认模式 true:下拉列表模式
136-
* attribute.menu_placeholder 下拉列表模式 默认未选择占位
137134
*/
138135
$form->Dot('dot','标签选择器')
139136
->options([1=>'松下紗栄子',2=>'上原亜衣',3=>'白石茉莉奈',4=>'美谷朱里',5=>'沖田杏梨',6=>'由愛可奈',7=>'七瀬あいり',8=>'五十嵐星蘭',9=>'仲里紗羽',10=>'波多野結衣'])
@@ -144,83 +141,93 @@ protected function form($id)
144141
* 级联点组件
145142
* options 设置数据集 多维数组 格式[[key=>key1,val=>value1,nodes=>[...]],...]
146143
* 链表结构数据辅助组装
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();
149146
* 2.辅助函数dimension 组装后的结构参考$this->cascadeData()的示例数据
150147
* DLPHelper::dimension($select);
151-
* checked 已选择 一维数组 值类型integer
152-
* attribute.width 设置宽度 默认100%
148+
* checked 已选择 一维数组 值类型integer
153149
* attribute.height 设置高度 默认200px
154-
* attribute.limit 选择限制数 默认0:无限
155150
*/
156151
$form->CascadeDot('cascadeDot','级联标签选择器')
157-
->options($this->cascadeExampleData())
152+
->options($this->cascadeData())
158153
->checked([614,550,543])
159154
->attribute(['height'=>'200px']);
160155

161156
/**
162157
* 线组件
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
170159
* 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]
174162
*/
175163
$form->Linear('flux_linkage', '磁力链接')
176164
->columns([
177165
'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']
182171
])
183172
->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+
188177
/**
189178
* 级联线组件
190179
* options 设置数据集 多维数组 格式[[key=>key1,val=>value1,nodes=>[...]],...]
191180
* 链表结构数据辅助组装
192-
* 1.倒排父节点查询 注:id name parent_id 必须命别名 key val par
181+
* 1.倒排父节点查询
193182
* $select = Model::orderBy('parent_id','DESC')->select('id as key','name as val','parent_id as par')->get()->toArray();
194183
* 2.辅助函数dimension 组装后的$select结构参考$this->cascadeExampleData()返回数据
195184
* 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
201187
*/
202188
$form->CascadeLine('cascadeLine','级联标签管理器')
203189
->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');
206191
return $form;
207192
}
208193

209194
public function blank()
210195
{
211-
$html = '<h1>弹窗模式 自定页</h1>';
196+
$title = '<h1>松下紗栄子</h1>';
212197
/*弹窗模式 渲染自定义页模板 Plane::html*/
213198
$panel = new FormPanel();
214199
$panel->input('id','序号');
215-
$panel->textarea('description','描述');
200+
$panel->textarea('descript','描述');
216201
$panel->select('status','状态',[0],[0=>'开启',1=>'关闭',2=>'删除'],1);
217202
$panel->datepicker('time','时间');
218203
$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+
219226
$html = $panel->compile();
220227
return Plane::html($title.$html);
221228
}
222229

223-
private function cascadeExampleData()
230+
private function cascadeData()
224231
{
225232
return [
226233
["key" => "3", "val" => "基本", "nodes" => [

0 commit comments

Comments
 (0)