|
10 | 10 | use Illuminate\Http\Request;
|
11 | 11 |
|
12 | 12 | /**
|
13 |
| - * 面 |
14 |
| - * Class Plane |
| 13 | + * Class DLPViewer |
15 | 14 | * @package DLP
|
16 | 15 | */
|
17 |
| -class Plane |
| 16 | +class DLPViewer |
18 | 17 | {
|
19 | 18 | /**
|
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 | + * 头部-多操作添加 |
21 | 69 | * @param Grid $grid
|
22 | 70 | * @param array $settings [setting,...]
|
23 | 71 | * setting.document_id 自定义节点ID
|
@@ -64,7 +112,7 @@ public function render()
|
64 | 112 | }
|
65 | 113 |
|
66 | 114 | /**
|
67 |
| - * 列表页 列-多操作添加 |
| 115 | + * 列-多操作添加 |
68 | 116 | * @param Grid $grid
|
69 | 117 | * @param array $settings [setting,...]
|
70 | 118 | * setting.document_class 自定义类名
|
@@ -119,7 +167,7 @@ public function render()
|
119 | 167 | }
|
120 | 168 |
|
121 | 169 | /**
|
122 |
| - * 列表页 列-多操作添加 (旧版图标按钮模式) |
| 170 | + * 列-多操作添加 (旧版图标按钮模式) |
123 | 171 | * @param Grid $grid
|
124 | 172 | * @param array $settings [setting,...]
|
125 | 173 | * setting.document_class 自定义类名
|
|
0 commit comments