update
This commit is contained in:
parent
626bccab78
commit
d591d82d0c
|
@ -11,16 +11,21 @@
|
|||
});
|
||||
var val = values.join(',');
|
||||
name = name.split('-')[0];
|
||||
var dataid = $(this).parents('tr.table-row-id').data('id');
|
||||
tpextbuilder.autoSendData({
|
||||
id: dataid,
|
||||
name: name,
|
||||
value: val
|
||||
}, url, 0);
|
||||
});
|
||||
|
||||
$('body').on('change', 'td.' + classname + ' :radio', function () {
|
||||
var name = $(this).attr('name');
|
||||
var val = $('td.' + classname + " input[name='" + name + "']:checked").val();
|
||||
name = name.split('-')[0];
|
||||
var dataid = $(this).parents('tr.table-row-id').data('id');
|
||||
tpextbuilder.autoSendData({
|
||||
id: dataid,
|
||||
name: name,
|
||||
value: val
|
||||
}, url, 0);
|
||||
|
@ -30,7 +35,9 @@
|
|||
var name = $(this).attr('name');
|
||||
var val = $(this).val();
|
||||
name = name.split('-')[0];
|
||||
var dataid = $(this).parents('tr.table-row-id').data('id');
|
||||
tpextbuilder.autoSendData({
|
||||
id: dataid,
|
||||
name: name,
|
||||
value: val
|
||||
}, url, 0);
|
||||
|
@ -40,7 +47,9 @@
|
|||
var name = $(this).attr('name');
|
||||
var val = $(this).val();
|
||||
name = name.split('-')[0];
|
||||
var dataid = $(this).parents('tr.table-row-id').data('id');
|
||||
tpextbuilder.autoSendData({
|
||||
id: dataid,
|
||||
name: name,
|
||||
value: val
|
||||
}, url, 0);
|
||||
|
@ -50,7 +59,9 @@
|
|||
var name = $(this).attr('name');
|
||||
var val = $(this).val();
|
||||
name = name.split('-')[0];
|
||||
var dataid = $(this).parents('tr.table-row-id').data('id');
|
||||
tpextbuilder.autoSendData({
|
||||
id: dataid,
|
||||
name: name,
|
||||
value: val
|
||||
}, url, 0);
|
||||
|
|
|
@ -52,7 +52,7 @@ class Table extends Wapper implements Renderable
|
|||
|
||||
protected $rowCheckbox = true;
|
||||
|
||||
protected $emptyText = "暂未数据~";
|
||||
protected $emptyText = "<p class='text-center'><span>暂无数据~</span></p>";
|
||||
|
||||
protected $toolbar = null;
|
||||
|
||||
|
@ -489,6 +489,10 @@ class Table extends Wapper implements Renderable
|
|||
|
||||
$this->ids[$key] = $data[$pk];
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->ids[$key] = $key;
|
||||
}
|
||||
|
||||
foreach ($cols as $col) {
|
||||
|
||||
|
@ -552,7 +556,7 @@ class Table extends Wapper implements Renderable
|
|||
'emptyText' => $this->emptyText,
|
||||
'headTextAlign' => $this->headTextAlign,
|
||||
'ids' => $this->ids,
|
||||
'rowCheckbox' => $this->rowCheckbox && !empty($this->ids),
|
||||
'rowCheckbox' => $this->rowCheckbox && $this->useToolbar,
|
||||
'name' => time() . mt_rand(1000, 9999),
|
||||
'verticalAlign' => $this->verticalAlign,
|
||||
'textAlign' => $this->textAlign,
|
||||
|
|
|
@ -68,6 +68,8 @@ class Field implements Renderable
|
|||
|
||||
protected static $labeltempl;
|
||||
|
||||
protected $mapClassWhen = [];
|
||||
|
||||
public function __construct($name, $label = '')
|
||||
{
|
||||
if (empty($label)) {
|
||||
|
@ -533,6 +535,22 @@ class Field implements Renderable
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @param array|string $value acses
|
||||
* @param string $class
|
||||
* @return $this
|
||||
*/
|
||||
public function mapClassWhen($values, $class)
|
||||
{
|
||||
if (!is_array($values)) {
|
||||
$values = [$values];
|
||||
}
|
||||
$this->mapClassWhen = [$values, $class];
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
|
@ -610,13 +628,23 @@ EOT;
|
|||
$this->default = implode(',', $this->default);
|
||||
}
|
||||
|
||||
$value = !($this->value === '' || $this->value === null) ? $this->value : $this->default;
|
||||
|
||||
$mapClass = '';
|
||||
|
||||
if (!empty($this->mapClassWhen)) {
|
||||
if (in_array($value, $this->mapClassWhen[0])) {
|
||||
$mapClass = ' ' . $this->mapClassWhen[1];
|
||||
}
|
||||
}
|
||||
|
||||
$vars = [
|
||||
'id' => $this->getId(),
|
||||
'label' => $this->label,
|
||||
'name' => $this->getName(),
|
||||
'tableRowKey' => $this->tableRowKey,
|
||||
'value' => !($this->value === '' || $this->value === null) ? $this->value : $this->default,
|
||||
'class' => ' ' . $this->class,
|
||||
'value' => $value,
|
||||
'class' => ' ' . $this->class . $mapClass,
|
||||
'attr' => $this->attr . ($this->disabled ? ' disabled' : '') . ($this->readonly ? ' readonly onclick="return false;"' : '') . (empty($this->style) ? '' : ' style="' . $this->style . '"'),
|
||||
'error' => $this->error,
|
||||
'size' => $this->size,
|
||||
|
|
|
@ -30,8 +30,6 @@ class Match extends Raw
|
|||
$this->value = $vars['value'] = $this->options[$vars['value']];
|
||||
} else if (isset($this->options['__default__'])) {
|
||||
$this->value = $vars['value'] = $this->options['__default__'];
|
||||
} else {
|
||||
echo $this->name, ':', $this->value, '|', $vars['value'], '<br>';
|
||||
}
|
||||
|
||||
$viewshow = $this->getViewInstance();
|
||||
|
|
|
@ -266,11 +266,12 @@ class Actionbar extends Toolbar
|
|||
* @param string $label
|
||||
* @param string $class
|
||||
* @param string $icon
|
||||
* @param boolean $confirm
|
||||
* @param string $attr
|
||||
* @param boolean $confirm
|
||||
* @return $this
|
||||
*
|
||||
*/
|
||||
public function btnPostRowid($name = '', $postUrl, $label = '', $class = 'btn-secondary', $icon = 'mdi-checkbox-marked-outline', $confirm = true, $attr = '')
|
||||
public function btnPostRowid($name = '', $postUrl, $label = '', $class = 'btn-secondary', $icon = 'mdi-checkbox-marked-outline', $attr = '', $confirm = true)
|
||||
{
|
||||
if (!$name) {
|
||||
$name = preg_replace('/.+?\/(\w+)\.?\w+$/', '$1', $postUrl, -1, $count);
|
||||
|
|
|
@ -196,11 +196,12 @@ class MultipleToolbar extends Toolbar
|
|||
* @param string $label
|
||||
* @param string $class
|
||||
* @param string $icon
|
||||
* @param boolean $confirm
|
||||
* @param string $attr
|
||||
* @param boolean $confirm
|
||||
* @return $this
|
||||
*
|
||||
*/
|
||||
public function btnPostChecked($url, $label = '', $class = 'btn-secondary', $icon = 'mdi-checkbox-marked-outline', $confirm = true, $attr = '')
|
||||
public function btnPostChecked($url, $label = '', $class = 'btn-secondary', $icon = 'mdi-checkbox-marked-outline', $attr = '', $confirm = true)
|
||||
{
|
||||
$action = preg_replace('/.+?\/(\w+)\.?\w+$/', '$1', $url, -1, $count);
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
{/notempty}
|
||||
<tbody>
|
||||
{volist name="list" id="row"}
|
||||
<tr>
|
||||
<tr class="table-row-id" data-id="{$ids[$key]}">
|
||||
{if condition="$rowCheckbox"}
|
||||
<td class="{$verticalAlign} {$textAlign}">
|
||||
<label class="lyear-checkbox checkbox-primary">
|
||||
|
@ -54,7 +54,7 @@
|
|||
{/volist}
|
||||
{empty name="$data"}
|
||||
<tr>
|
||||
<td>{$emptyText}</td>
|
||||
<td colspan="{$cols|count}">{$emptyText|raw}</td>
|
||||
</tr>
|
||||
{/empty}
|
||||
</tbody>
|
||||
|
|
Loading…
Reference in New Issue