Skip to content

Commit f12c928

Browse files
author
hikki
committed
1.2
1 parent 0cb1ef7 commit f12c928

File tree

3 files changed

+54
-81
lines changed

3 files changed

+54
-81
lines changed

src/Plane.php renamed to src/DLPViewer.php

Lines changed: 54 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,62 @@
1010
use Illuminate\Http\Request;
1111

1212
/**
13-
* 面
14-
* Class Plane
13+
* Class DLPViewer
1514
* @package DLP
1615
*/
17-
class Plane
16+
class DLPViewer
1817
{
1918
/**
20-
* 列表页 头部-多操作添加
19+
* 点
20+
* @param Form $form
21+
* @param string $column 字段名
22+
* @param string $title 名称
23+
* @param array $select 全部选项
24+
* @param array $selected 已选择选项
25+
* @param bool $strict json严格模式 消除json敏感字符问题
26+
*/
27+
public static function makeComponentDot(Form $form, string $column, string $title, array $select = [], array $selected = [],bool $strict = false)
28+
{
29+
if ($strict) {
30+
$select = DLPHelper::safeJson($select);
31+
$selected = DLPHelper::safeJson($selected);
32+
} else {
33+
$select = json_encode($select, JSON_UNESCAPED_UNICODE | JSON_HEX_QUOT | JSON_HEX_APOS);
34+
$selected = json_encode($selected, JSON_UNESCAPED_UNICODE | JSON_HEX_QUOT | JSON_HEX_APOS);
35+
}
36+
Admin::script(<<<EOF
37+
componentDot("{$column}",JSON.parse('{$selected}'),JSON.parse('{$select}'));
38+
EOF
39+
);
40+
$form->html("<div id='{$column}'></div>", $title);
41+
}
42+
43+
/**
44+
* 线
45+
* @param Form $form
46+
* @param string $column 字段名
47+
* @param string $title 名称
48+
* @param array $settings 设置项
49+
* @param array $data 数据
50+
* @param bool $strict json严格模式 消除json敏感字符问题
51+
*/
52+
public static function makeComponentLine(Form $form, string $column, string $title, array $settings = [], array $data = [], bool $strict = false)
53+
{
54+
if($strict) {
55+
$data = DLPHelper::safeJson($data);
56+
}else{
57+
$data = json_encode($data, JSON_UNESCAPED_UNICODE | JSON_HEX_QUOT | JSON_HEX_APOS);
58+
}
59+
$settings = json_encode($settings, JSON_UNESCAPED_UNICODE | JSON_HEX_QUOT | JSON_HEX_APOS);
60+
Admin::script(<<<EOF
61+
componentLine("{$column}",JSON.parse('{$settings}'),JSON.parse('{$data}'));
62+
EOF
63+
);
64+
$form->html("<div id='{$column}'></div>", $title);
65+
}
66+
67+
/**
68+
* 头部-多操作添加
2169
* @param Grid $grid
2270
* @param array $settings [setting,...]
2371
* setting.document_id 自定义节点ID
@@ -64,7 +112,7 @@ public function render()
64112
}
65113

66114
/**
67-
* 列表页 列-多操作添加
115+
* 列-多操作添加
68116
* @param Grid $grid
69117
* @param array $settings [setting,...]
70118
* setting.document_class 自定义类名
@@ -119,7 +167,7 @@ public function render()
119167
}
120168

121169
/**
122-
* 列表页 列-多操作添加 (旧版图标按钮模式)
170+
* 列-多操作添加 (旧版图标按钮模式)
123171
* @param Grid $grid
124172
* @param array $settings [setting,...]
125173
* setting.document_class 自定义类名

src/Dot.php

Lines changed: 0 additions & 38 deletions
This file was deleted.

src/Line.php

Lines changed: 0 additions & 37 deletions
This file was deleted.

0 commit comments

Comments
 (0)