@@ -21,7 +21,7 @@ class DLPViewer
21
21
* @param string $column 数据字段名
22
22
* @param string $title 名称
23
23
* @param array $selected 已选择选项 [value1,value2,...]
24
- * @param array $select 全部选项 [[value=>text ],[value=>text ]...]
24
+ * @param array $select 全部选项 [[value1=>text1 ],[value2=>text2 ]...]
25
25
* @param array $settings 配置项[setting,...]
26
26
* settings.strict boolean json严格模式消除json敏感字符问题
27
27
* settings.width string 容器宽度设置
@@ -46,6 +46,40 @@ public static function makeComponentDot(Form $form, string $column, string $titl
46
46
$ form ->html ("<div id=' {$ column }' style='width: {$ width };height: {$ height };'></div> " , $ title );
47
47
}
48
48
49
+ /**
50
+ * 维度.点
51
+ * @param Form $form
52
+ * @param string $column 数据字段名
53
+ * @param string $title 名称
54
+ * @param array $selected 已选择选项 [value1,value2,...]
55
+ * @param array $select 全部选项 [[key=>key1,val=>value1,nodes=>[...]],...]
56
+ * select.node.key integer 键
57
+ * select.node.val string 值
58
+ * select.node.nodes array 子节点[node,node,...]
59
+ * @param array $settings 配置项[setting,...]
60
+ * settings.strict boolean json严格模式消除json敏感字符问题
61
+ * settings.width string 容器宽度设置
62
+ * settings.height string 容器高度设置
63
+ */
64
+ public static function makeComponentCascadeDot (Form $ form , string $ column , string $ title , array $ selected = [], array $ select = [], array $ settings = [])
65
+ {
66
+ $ strict = isset ($ settings ['strict ' ]) && $ settings ['strict ' ] ? true : false ;
67
+ $ width = isset ($ settings ['width ' ]) ? $ settings ['width ' ] : '100% ' ;
68
+ $ height = isset ($ settings ['height ' ]) ? $ settings ['height ' ] : '200px ' ;
69
+ if ($ strict ) {
70
+ $ selected = DLPHelper::safeJson ($ selected );
71
+ $ select = DLPHelper::safeJson ($ select );
72
+ } else {
73
+ $ selected = json_encode ($ selected , JSON_UNESCAPED_UNICODE | JSON_HEX_QUOT | JSON_HEX_APOS );
74
+ $ select = json_encode ($ select , JSON_UNESCAPED_UNICODE | JSON_HEX_QUOT | JSON_HEX_APOS );
75
+ }
76
+ Admin::script (<<<EOF
77
+ new ComponentCascadeDot(" {$ column }",JSON.parse(' {$ selected }'),JSON.parse(' {$ select }'));
78
+ EOF
79
+ );
80
+ $ form ->html ("<div id=' {$ column }' style='width: {$ width };height: {$ height };'></div> " , $ title );
81
+ }
82
+
49
83
/**
50
84
* 线
51
85
* @param Form $form
0 commit comments