仓库初始化
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
|
||||
public function {%methodName%}($value, $data)
|
||||
{
|
||||
$value = $value ?: ($data['{%field%}'] ?? '');
|
||||
$valueArr = explode(',', $value);
|
||||
$list = $this->{%listMethodName%}();
|
||||
return implode(',', array_intersect_key($list, array_flip($valueArr)));
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
|
||||
public function {%methodName%}($value, $data)
|
||||
{
|
||||
$value = $value ?: ($data['{%field%}'] ?? '');
|
||||
return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
|
||||
}
|
||||
1
application/admin/command/Crud/stubs/mixins/enum.stub
Normal file
1
application/admin/command/Crud/stubs/mixins/enum.stub
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
4
application/admin/command/Crud/stubs/mixins/import.stub
Normal file
4
application/admin/command/Crud/stubs/mixins/import.stub
Normal file
@@ -0,0 +1,4 @@
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
10
application/admin/command/Crud/stubs/mixins/modelinit.stub
Normal file
10
application/admin/command/Crud/stubs/mixins/modelinit.stub
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
protected static function init()
|
||||
{
|
||||
self::afterInsert(function ($row) {
|
||||
if (!$row['{%order%}']) {
|
||||
$pk = $row->getPk();
|
||||
$row->getQuery()->where($pk, $row[$pk])->update(['{%order%}' => $row[$pk]]);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
|
||||
public function {%relationMethod%}s()
|
||||
{
|
||||
return $this->{%relationMode%}('{%relationClassName%}', '{%relationForeignKey%}', '{%relationPrimaryKey%}');
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
|
||||
public function {%relationMethod%}()
|
||||
{
|
||||
return $this->{%relationMode%}('{%relationClassName%}', '{%relationForeignKey%}', '{%relationPrimaryKey%}', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
public function {%methodName%}($value, $data)
|
||||
{
|
||||
$value = $value ?: ($data['{%field%}'] ?? '');
|
||||
$valueArr = explode(',', $value);
|
||||
$list = $this->{%listMethodName%}();
|
||||
return implode(',', array_intersect_key($list, array_flip($valueArr)));
|
||||
}
|
||||
7
application/admin/command/Crud/stubs/mixins/radio.stub
Normal file
7
application/admin/command/Crud/stubs/mixins/radio.stub
Normal file
@@ -0,0 +1,7 @@
|
||||
|
||||
public function {%methodName%}($value, $data)
|
||||
{
|
||||
$value = $value ?: ($data['{%field%}'] ?? '');
|
||||
$list = $this->{%listMethodName%}();
|
||||
return $list[$value] ?? '';
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
|
||||
recyclebin: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
'dragsort_url': ''
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: '{%controllerUrl%}/recyclebin' + location.search,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},{%recyclebinTitleJs%}
|
||||
{
|
||||
field: '{%deleteTimeField%}',
|
||||
title: __('Deletetime'),
|
||||
operate: 'RANGE',
|
||||
addclass: 'datetimerange',
|
||||
formatter: Table.api.formatter.datetime
|
||||
},
|
||||
{
|
||||
field: 'operate',
|
||||
width: '140px',
|
||||
title: __('Operate'),
|
||||
table: table,
|
||||
events: Table.api.events.operate,
|
||||
buttons: [
|
||||
{
|
||||
name: 'Restore',
|
||||
text: __('Restore'),
|
||||
classname: 'btn btn-xs btn-info btn-ajax btn-restoreit',
|
||||
icon: 'fa fa-rotate-left',
|
||||
url: '{%controllerUrl%}/restore',
|
||||
refresh: true
|
||||
},
|
||||
{
|
||||
name: 'Destroy',
|
||||
text: __('Destroy'),
|
||||
classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit',
|
||||
icon: 'fa fa-times',
|
||||
url: '{%controllerUrl%}/destroy',
|
||||
refresh: true
|
||||
}
|
||||
],
|
||||
formatter: Table.api.formatter.operate
|
||||
}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
7
application/admin/command/Crud/stubs/mixins/select.stub
Normal file
7
application/admin/command/Crud/stubs/mixins/select.stub
Normal file
@@ -0,0 +1,7 @@
|
||||
|
||||
public function {%methodName%}($value, $data)
|
||||
{
|
||||
$value = $value ?: ($data['{%field%}'] ?? '');
|
||||
$list = $this->{%listMethodName%}();
|
||||
return $list[$value] ?? '';
|
||||
}
|
||||
Reference in New Issue
Block a user