@@ -19,10 +19,7 @@ class FormPanel
19
19
public function input (string $ column , string $ label , string $ value = '' )
20
20
{
21
21
$ content = <<<EOF
22
- <div class="input-group">
23
- <span class="input-group-addon"><i class="fa fa-pencil fa-fw"></i></span>
24
- <input required="1" type="text" id=" {$ column }" name=" {$ column }" value=" {$ value }" class="form-control {$ column }" placeholder="输入 {$ label }" />
25
- </div>
22
+ <input required="1" type="text" id=" {$ column }" name=" {$ column }" value=" {$ value }" class="dlp-input {$ column }" placeholder="输入 {$ label }" />
26
23
EOF ;
27
24
$ this ->html .= $ this ->rowpanel ($ column , $ label , $ content );
28
25
}
@@ -46,19 +43,27 @@ public function hidden(string $column, string $value)
46
43
public function textarea (string $ column , string $ label , string $ value = '' )
47
44
{
48
45
$ content = <<<EOF
49
- <textarea name=" {$ column }" class="form-control {$ column }" rows="3" placeholder="输入 {$ label }"> {$ value }</textarea>
46
+ <textarea name=" {$ column }" class=" {$ column }" rows="3" placeholder="输入 {$ label }"> {$ value }</textarea>
50
47
EOF ;
51
48
$ this ->html .= $ this ->rowpanel ($ column , $ label , $ content );
52
49
}
53
50
54
- public function select (string $ column , array $ options , int $ selected )
51
+ public function select (string $ column , string $ label , array $ selected, array $ select , $ limit = 0 , array $ style =[] )
55
52
{
56
-
57
- }
58
-
59
- public function multiSelect (string $ column , array $ options , array $ selected )
60
- {
61
-
53
+ $ selected = json_encode ($ selected , JSON_UNESCAPED_UNICODE | JSON_HEX_QUOT | JSON_HEX_APOS );
54
+ $ select = json_encode ($ select , JSON_UNESCAPED_UNICODE | JSON_HEX_QUOT | JSON_HEX_APOS );
55
+ $ style = array_merge (['width ' =>'100% ' ,'height ' =>'62px ' ],$ style );
56
+ $ style_string = '' ;
57
+ foreach ($ style as $ k =>$ s ){
58
+ $ style_string .="$ k: $ s; " ;
59
+ }
60
+ $ content = <<<EOF
61
+ <div id=" {$ column }" style=" $ style_string"></div>
62
+ <script>
63
+ new ComponentDot(" {$ column }",JSON.parse(' {$ selected }'),JSON.parse(' {$ select }'), {$ limit });
64
+ </script>
65
+ EOF ;
66
+ $ this ->html .= $ this ->rowpanel ($ column , $ label , $ content );
62
67
}
63
68
64
69
/**
@@ -72,21 +77,17 @@ public function datepicker(string $column, string $label, string $value = '')
72
77
$ value = date ('Y-m-d H:i:s ' );
73
78
}
74
79
$ content = <<<EOF
75
- <div class="input-group">
76
- <span class="input-group-addon"><i class="fa fa-calendar fa-fw"></i></span>
77
- <input style="width: 160px" type="text" id=" {$ column }" name=" {$ column }" value=" {$ value }" class="form-control release_time" placeholder="输入 {$ label }" />
78
- </div>
79
- EOF ;
80
- Admin::script (<<<EOF
80
+ <input style="width: 160px" type="text" id=" {$ column }" name=" {$ column }" value=" {$ value }" class="dlp-input {$ column }" placeholder="输入 {$ label }" />
81
+ <script>
81
82
$('# {$ column }').datetimepicker({"format":"YYYY-MM-DD HH:mm:ss","locale":"zh-CN"});
82
83
$('# {$ column }').on(
83
84
'dp.show',
84
85
function(e) {
85
86
$(".bootstrap-datetimepicker-widget").css(
86
87
"background-color", "#3c3e43");
87
88
});
88
- EOF
89
- ) ;
89
+ </script>
90
+ EOF ;
90
91
$ this ->html .= $ this ->rowpanel ($ column , $ label , $ content );
91
92
}
92
93
@@ -103,20 +104,18 @@ public function html(string $column, string $label, string $content)
103
104
public function compile ()
104
105
{
105
106
return <<<EOF
106
- <form accept-charset="UTF-8" method="post">
107
- <div class="box-body" > {$ this ->html }</div>
107
+ <form class="dlp" accept-charset="UTF-8" method="post">
108
+ <div> {$ this ->html }</div>
108
109
</form>
109
110
EOF ;
110
111
}
111
112
112
113
private function rowpanel ($ column , $ label , $ content )
113
114
{
114
115
return <<<EOF
115
- <div class="form-group">
116
- <label for=" {$ column }" class="col-sm-2 control-label"> {$ label }</label>
117
- <div class="col-sm-8">
118
- {$ content }
119
- </div>
116
+ <div class="dlp-form-row">
117
+ <label class="dlp-text" for=" {$ column }"> {$ label }</label>
118
+ {$ content }
120
119
</div>
121
120
EOF ;
122
121
}
0 commit comments