feature: 面板
This commit is contained in:
parent
831a47b19b
commit
10fcccf53a
84
application/admin/controller/salary/Detail.php
Normal file
84
application/admin/controller/salary/Detail.php
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
<?php
|
||||
|
||||
namespace app\admin\controller\salary;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use think\Db;
|
||||
use think\exception\PDOException;
|
||||
use think\exception\ValidateException;
|
||||
|
||||
/**
|
||||
* 工资详情
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class Detail extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* Detail模型对象
|
||||
* @var \app\admin\model\salary\Detail
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\salary\Detail;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
public function custom_add()
|
||||
{
|
||||
|
||||
if (false === $this->request->isPost()) {
|
||||
|
||||
$items = Db::name('salary_item')->field('id,name')->select();
|
||||
|
||||
$this->view->assign('items', $items);
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
$params = $this->request->post('row/a');
|
||||
if (empty($params)) {
|
||||
$this->error(__('Parameter %s can not be empty', ''));
|
||||
}
|
||||
|
||||
|
||||
$month = $params['salary_month'] . '-01';
|
||||
$targetAdminId = $params['target_admin_id'];
|
||||
$salaryDetails = [];
|
||||
|
||||
foreach ($params as $k => $v) {
|
||||
if (!str_contains($k, 'item')) {
|
||||
continue;
|
||||
}
|
||||
$salaryDetails[] = [
|
||||
'target_admin_id' => $targetAdminId,
|
||||
'salary_month' => $month,
|
||||
'item_id' => explode('_', $k)[1],
|
||||
'item_value' => $v,
|
||||
];
|
||||
}
|
||||
|
||||
Db::name('salary_detail')
|
||||
->where('salary_month', $month)
|
||||
->where('target_admin_id', $targetAdminId)
|
||||
->delete();
|
||||
|
||||
Db::name('salary_detail')
|
||||
->insertAll($salaryDetails);
|
||||
|
||||
$this->success();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
37
application/admin/controller/salary/Item.php
Normal file
37
application/admin/controller/salary/Item.php
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
namespace app\admin\controller\salary;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* 工资项目
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class Item extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* Item模型对象
|
||||
* @var \app\admin\model\salary\Item
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\salary\Item;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
12
application/admin/lang/zh-cn/salary/detail.php
Normal file
12
application/admin/lang/zh-cn/salary/detail.php
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'Id' => 'ID',
|
||||
'Admin_id' => '创建人id',
|
||||
'Target_admin_id' => '工资归属人id',
|
||||
'Item_id' => '指标id',
|
||||
'Item_value' => '值',
|
||||
'Salary_month' => '工资月份',
|
||||
'Create_time' => '创建时间',
|
||||
'Update_time' => '编辑时间'
|
||||
];
|
||||
10
application/admin/lang/zh-cn/salary/item.php
Normal file
10
application/admin/lang/zh-cn/salary/item.php
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'Id' => 'ID',
|
||||
'Admin_id' => '创建人id',
|
||||
'Name' => '名称',
|
||||
'Desc' => '描述',
|
||||
'Create_time' => '创建时间',
|
||||
'Update_time' => '编辑时间'
|
||||
];
|
||||
40
application/admin/model/salary/Detail.php
Normal file
40
application/admin/model/salary/Detail.php
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
namespace app\admin\model\salary;
|
||||
|
||||
use think\Model;
|
||||
|
||||
|
||||
class Detail extends Model
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $name = 'salary_detail';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = false;
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = false;
|
||||
protected $updateTime = false;
|
||||
protected $deleteTime = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
40
application/admin/model/salary/Item.php
Normal file
40
application/admin/model/salary/Item.php
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
namespace app\admin\model\salary;
|
||||
|
||||
use think\Model;
|
||||
|
||||
|
||||
class Item extends Model
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $name = 'salary_item';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = false;
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = false;
|
||||
protected $updateTime = false;
|
||||
protected $deleteTime = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
27
application/admin/validate/salary/Detail.php
Normal file
27
application/admin/validate/salary/Detail.php
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
namespace app\admin\validate\salary;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class Detail extends Validate
|
||||
{
|
||||
/**
|
||||
* 验证规则
|
||||
*/
|
||||
protected $rule = [
|
||||
];
|
||||
/**
|
||||
* 提示消息
|
||||
*/
|
||||
protected $message = [
|
||||
];
|
||||
/**
|
||||
* 验证场景
|
||||
*/
|
||||
protected $scene = [
|
||||
'add' => [],
|
||||
'edit' => [],
|
||||
];
|
||||
|
||||
}
|
||||
27
application/admin/validate/salary/Item.php
Normal file
27
application/admin/validate/salary/Item.php
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
namespace app\admin\validate\salary;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class Item extends Validate
|
||||
{
|
||||
/**
|
||||
* 验证规则
|
||||
*/
|
||||
protected $rule = [
|
||||
];
|
||||
/**
|
||||
* 提示消息
|
||||
*/
|
||||
protected $message = [
|
||||
];
|
||||
/**
|
||||
* 验证场景
|
||||
*/
|
||||
protected $scene = [
|
||||
'add' => [],
|
||||
'edit' => [],
|
||||
];
|
||||
|
||||
}
|
||||
45
application/admin/view/salary/detail/add.html
Normal file
45
application/admin/view/salary/detail/add.html
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Target_admin_id')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-target_admin_id" data-rule="required" data-source="target/admin/index" class="form-control selectpage" name="row[target_admin_id]" type="text" value="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Item_id')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-item_id" data-rule="required" data-source="item/index" class="form-control selectpage" name="row[item_id]" type="text" value="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Item_value')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-item_value" data-rule="required" class="form-control" step="0.01" name="row[item_value]" type="number" value="0.00">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Salary_month')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-salary_month" class="form-control datetimepicker" data-date-format="YYYY-MM-DD" data-use-current="true" name="row[salary_month]" type="text" value="{:date('Y-m-d')}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Create_time')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-create_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[create_time]" type="text" value="{:date('Y-m-d H:i:s')}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Update_time')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-update_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[update_time]" type="text" value="{:date('Y-m-d H:i:s')}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group layer-footer">
|
||||
<label class="control-label col-xs-12 col-sm-2"></label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
30
application/admin/view/salary/detail/custom_add.html
Normal file
30
application/admin/view/salary/detail/custom_add.html
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Target_admin_id')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-target_admin_id" data-rule="required" data-source="auth/admin/selectpage" data-field="nickname" class="form-control selectpage" name="row[target_admin_id]" type="text" value="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Salary_month')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-salary_month" class="form-control datetimepicker" data-date-format="YYYY-MM" data-use-current="true" name="row[salary_month]" type="text" value="{:date('Y-m-d')}">
|
||||
</div>
|
||||
</div>
|
||||
{foreach $items as $item}
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{$item['name']}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-item_value" class="form-control" step="0.01" name="row[item_{$item['id']}]" type="number" value="10">
|
||||
</div>
|
||||
</div>
|
||||
{/foreach}
|
||||
|
||||
<div class="form-group layer-footer">
|
||||
<label class="control-label col-xs-12 col-sm-2"></label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
45
application/admin/view/salary/detail/edit.html
Normal file
45
application/admin/view/salary/detail/edit.html
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Target_admin_id')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-target_admin_id" data-rule="required" data-source="target/admin/index" class="form-control selectpage" name="row[target_admin_id]" type="text" value="{$row.target_admin_id|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Item_id')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-item_id" data-rule="required" data-source="item/index" class="form-control selectpage" name="row[item_id]" type="text" value="{$row.item_id|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Item_value')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-item_value" data-rule="required" class="form-control" step="0.01" name="row[item_value]" type="number" value="{$row.item_value|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Salary_month')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-salary_month" class="form-control datetimepicker" data-date-format="YYYY-MM-DD" data-use-current="true" name="row[salary_month]" type="text" value="{$row.salary_month}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Create_time')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-create_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[create_time]" type="text" value="{$row.create_time}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Update_time')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-update_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[update_time]" type="text" value="{$row.update_time}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group layer-footer">
|
||||
<label class="control-label col-xs-12 col-sm-2"></label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
29
application/admin/view/salary/detail/index.html
Normal file
29
application/admin/view/salary/detail/index.html
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<div class="panel panel-default panel-intro">
|
||||
{:build_heading()}
|
||||
|
||||
<div class="panel-body">
|
||||
<div id="myTabContent" class="tab-content">
|
||||
<div class="tab-pane fade active in" id="one">
|
||||
<div class="widget-body no-padding">
|
||||
<div id="toolbar" class="toolbar">
|
||||
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
|
||||
<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('salary/detail/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
|
||||
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('salary/detail/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
|
||||
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('salary/detail/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
|
||||
data-operate-edit="{:$auth->check('salary/detail/edit')}"
|
||||
data-operate-del="{:$auth->check('salary/detail/del')}"
|
||||
width="100%">
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
33
application/admin/view/salary/item/add.html
Normal file
33
application/admin/view/salary/item/add.html
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text" value="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Desc')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-desc" data-rule="required" class="form-control" name="row[desc]" type="text" value="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Create_time')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-create_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[create_time]" type="text" value="{:date('Y-m-d H:i:s')}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Update_time')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-update_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[update_time]" type="text" value="{:date('Y-m-d H:i:s')}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group layer-footer">
|
||||
<label class="control-label col-xs-12 col-sm-2"></label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
33
application/admin/view/salary/item/edit.html
Normal file
33
application/admin/view/salary/item/edit.html
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text" value="{$row.name|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Desc')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-desc" data-rule="required" class="form-control" name="row[desc]" type="text" value="{$row.desc|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Create_time')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-create_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[create_time]" type="text" value="{$row.create_time}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Update_time')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-update_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[update_time]" type="text" value="{$row.update_time}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group layer-footer">
|
||||
<label class="control-label col-xs-12 col-sm-2"></label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
29
application/admin/view/salary/item/index.html
Normal file
29
application/admin/view/salary/item/index.html
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<div class="panel panel-default panel-intro">
|
||||
{:build_heading()}
|
||||
|
||||
<div class="panel-body">
|
||||
<div id="myTabContent" class="tab-content">
|
||||
<div class="tab-pane fade active in" id="one">
|
||||
<div class="widget-body no-padding">
|
||||
<div id="toolbar" class="toolbar">
|
||||
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
|
||||
<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('salary/item/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
|
||||
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('salary/item/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
|
||||
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('salary/item/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
|
||||
data-operate-edit="{:$auth->check('salary/item/edit')}"
|
||||
data-operate-del="{:$auth->check('salary/item/del')}"
|
||||
width="100%">
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
60
public/assets/js/backend/salary/detail.js
Normal file
60
public/assets/js/backend/salary/detail.js
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'salary/detail/index' + location.search,
|
||||
add_url: 'salary/detail/add',
|
||||
edit_url: 'salary/detail/edit',
|
||||
del_url: 'salary/detail/del',
|
||||
multi_url: 'salary/detail/multi',
|
||||
import_url: 'salary/detail/import',
|
||||
table: 'salary_detail',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'admin_id', title: __('Admin_id')},
|
||||
{field: 'target_admin_id', title: __('Target_admin_id')},
|
||||
{field: 'item_id', title: __('Item_id')},
|
||||
{field: 'item_value', title: __('Item_value'), operate:'BETWEEN'},
|
||||
{field: 'salary_month', title: __('Salary_month'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
|
||||
{field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
|
||||
{field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
custom_add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
55
public/assets/js/backend/salary/item.js
Normal file
55
public/assets/js/backend/salary/item.js
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'salary/item/index' + location.search,
|
||||
add_url: 'salary/item/add',
|
||||
edit_url: 'salary/item/edit',
|
||||
del_url: 'salary/item/del',
|
||||
multi_url: 'salary/item/multi',
|
||||
import_url: 'salary/item/import',
|
||||
table: 'salary_item',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'admin_id', title: __('Admin_id')},
|
||||
{field: 'name', title: __('Name'), operate: 'LIKE'},
|
||||
{field: 'desc', title: __('Desc'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
||||
{field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
|
||||
{field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
Loading…
Reference in New Issue
Block a user