Skip to content

Commit 4fe5ddc

Browse files
committed
v3.4
1 parent fa96801 commit 4fe5ddc

File tree

4 files changed

+20
-16
lines changed

4 files changed

+20
-16
lines changed

src/Widget/CascadeDot.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,14 @@ public function render()
2929

3030
/**
3131
* 直接调用ComponentCascadeDot组件
32+
* @param string $name 名称
3233
* @param array $selected 已选择id组 [1,2,3...]
3334
* @param array $select 全部选项
3435
* @param int $limit 选择限制数 默认0:无限
3536
* @param array $style 组件样式设置 宽:width 高:height
3637
* @return string
3738
*/
38-
public static function panel(array $selected,array $select,int $limit=1,array $style=[])
39+
public static function panel($name,array $selected,array $select,int $limit=1,array $style=[])
3940
{
4041
$selected = json_encode($selected, JSON_UNESCAPED_UNICODE | JSON_HEX_QUOT | JSON_HEX_APOS);
4142
$select = json_encode($select, JSON_UNESCAPED_UNICODE | JSON_HEX_QUOT | JSON_HEX_APOS);
@@ -44,11 +45,11 @@ public static function panel(array $selected,array $select,int $limit=1,array $s
4445
foreach ($style as $k=>$s){
4546
$style_string.="$k:$s;";
4647
}
47-
$id = 'cascade_dot_'.mt_rand(0,100);
48+
4849
return <<<EOF
49-
<div id="{$id}" style="$style_string"></div>
50+
<div id="{$name}" style="$style_string"></div>
5051
<script>
51-
new ComponentCascadeDot("{$id}",JSON.parse('{$selected}'),JSON.parse('{$select}'),{$limit});
52+
new ComponentCascadeDot("{$name}",JSON.parse('{$selected}'),JSON.parse('{$select}'),{$limit});
5253
</script>
5354
EOF;
5455
}

src/Widget/CascadeLine.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public function render()
2929

3030
/**
3131
* 直接调用ComponentCascadeLine组件
32+
* @param string $name 名称
3233
* @param array $select 全部选项
3334
* @param string $xhr ajax接口地址
3435
* @param array $style 组件样式设置 宽:width 高:height
@@ -40,7 +41,7 @@ public function render()
4041
* options.delete bool 可删除
4142
* @return string
4243
*/
43-
public static function panel(array $select,string $xhr,array $style=[],array $options=[])
44+
public static function panel($name,array $select,string $xhr,array $style=[],array $options=[])
4445
{
4546
$select = json_encode($select, JSON_UNESCAPED_UNICODE | JSON_HEX_QUOT | JSON_HEX_APOS);
4647
$style = array_merge(['width'=>'100%','height'=>'230px'],$style);
@@ -54,11 +55,11 @@ public static function panel(array $select,string $xhr,array $style=[],array $op
5455
foreach ($style as $k=>$s){
5556
$style_string.="$k:$s;";
5657
}
57-
$id = 'cascade_line_'.mt_rand(0,100);
58+
5859
return <<<EOF
59-
<div id="{$id}" style="$style_string"></div>
60+
<div id="{$name}" style="$style_string"></div>
6061
<script>
61-
new ComponentCascadeLine("{$id}",JSON.parse('{$select}'),'{$xhr}',JSON.parse('{$options}'));
62+
new ComponentCascadeLine("{$name}",JSON.parse('{$select}'),'{$xhr}',JSON.parse('{$options}'));
6263
</script>
6364
EOF;
6465
}

src/Widget/Dot.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,14 @@ public function render()
2929

3030
/**
3131
* 直接调用ComponentDot组件
32+
* @param string $name 名称
3233
* @param array $selected 已选择id组 [1,2,3...]
3334
* @param array $select 全部选项
3435
* @param int $limit 选择限制数 默认0:无限
3536
* @param array $style 组件样式设置 宽:width 高:height
3637
* @return string
3738
*/
38-
public static function panel(array $selected,array $select,int $limit=1,array $style=[])
39+
public static function panel($name,array $selected,array $select,int $limit=1,array $style=[])
3940
{
4041
$selected = json_encode($selected, JSON_UNESCAPED_UNICODE | JSON_HEX_QUOT | JSON_HEX_APOS);
4142
$select = json_encode($select, JSON_FORCE_OBJECT | JSON_UNESCAPED_UNICODE | JSON_HEX_QUOT | JSON_HEX_APOS);
@@ -44,11 +45,11 @@ public static function panel(array $selected,array $select,int $limit=1,array $s
4445
foreach ($style as $k=>$s){
4546
$style_string.="$k:$s;";
4647
}
47-
$id = 'dot_'.mt_rand(0,100);
48+
4849
return <<<EOF
49-
<div id="{$id}" style="$style_string"></div>
50+
<div id="{$name}" style="$style_string"></div>
5051
<script>
51-
new ComponentDot("{$id}",JSON.parse('{$selected}'),JSON.parse('{$select}'),{$limit});
52+
new ComponentDot("{$name}",JSON.parse('{$selected}'),JSON.parse('{$select}'),{$limit});
5253
</script>
5354
EOF;
5455
}

src/Widget/Linear.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public function render()
4141

4242
/**
4343
* 直接调用Linear组件
44+
* @param string $name 名称
4445
* @param array $columns 头部字段样式定义
4546
* @param array $data 数据集
4647
* @param array $style 组件样式设置 宽:width 高:height
@@ -50,7 +51,7 @@ public function render()
5051
* options.insert bool 可新增
5152
* @return string
5253
*/
53-
public static function panel(array $columns, array $data, array $style = [], array $options = ['sortable' => true, 'delete' => true, 'insert' => true])
54+
public static function panel($name,array $columns, array $data, array $style = [], array $options = ['sortable' => true, 'delete' => true, 'insert' => true])
5455
{
5556
$columns = json_encode($columns, JSON_UNESCAPED_UNICODE | JSON_HEX_QUOT | JSON_HEX_APOS);
5657
$data = json_encode($data, JSON_UNESCAPED_UNICODE | JSON_HEX_QUOT | JSON_HEX_APOS);
@@ -60,11 +61,11 @@ public static function panel(array $columns, array $data, array $style = [], arr
6061
$style_string .= "$k:$s;";
6162
}
6263
$options = json_encode(array_merge(['sortable' => true, 'delete' => true, 'insert' => true], $options));
63-
$id = 'linear_' . mt_rand(0, 100);
64+
6465
return <<<EOF
65-
<div id="{$id}" style="$style_string"></div>
66+
<div id="{$name}" style="$style_string"></div>
6667
<script>
67-
new ComponentLine("{$id}",JSON.parse('{$columns}'),JSON.parse('{$data}'),JSON.parse('{$options}'));
68+
new ComponentLine("{$name}",JSON.parse('{$columns}'),JSON.parse('{$data}'),JSON.parse('{$options}'));
6869
</script>
6970
EOF;
7071
}

0 commit comments

Comments
 (0)