Accept Merge Request #102: (feature/zy -> develop)
Merge Request: feature: salary menu Created By: @zhuyu Accepted By: @zhuyu URL: https://g-bcrc3009.coding.net/p/allocatr/d/allocatr/git/merge/102
This commit is contained in:
commit
663c4317ef
347
application/admin/controller/salary/CustomDetail.php
Normal file
347
application/admin/controller/salary/CustomDetail.php
Normal file
|
|
@ -0,0 +1,347 @@
|
|||
<?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 CustomDetail 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 index()
|
||||
{
|
||||
//当前是否为关联查询
|
||||
$this->relationSearch = true;
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags', 'trim']);
|
||||
|
||||
$items = Db::name('salary_item')->field('id,attr,type,name')->select();
|
||||
|
||||
$salaryItem = [];
|
||||
foreach ($items as $item) {
|
||||
$idAttr[$item['id']] = $item['attr'];
|
||||
if ($item['attr'] == 'JXKHJL') {
|
||||
$salaryItem[] = [
|
||||
'id' => 'jx_total',
|
||||
'name' => '绩效提成',
|
||||
];
|
||||
}
|
||||
$salaryItem[] = [
|
||||
'id' => 'item_' . $item['id'],
|
||||
'name' => $item['name'],
|
||||
];
|
||||
}
|
||||
$salaryItem[] = [
|
||||
'id' => 'total',
|
||||
'name' => '总计',
|
||||
];
|
||||
|
||||
$month = date('Y-m-01');
|
||||
|
||||
if ($this->request->isAjax()) {
|
||||
|
||||
|
||||
$filter = $this->request->param('filter');
|
||||
$filter = json_decode($filter, true);
|
||||
|
||||
if (!empty($filter['month'])) {
|
||||
$month = $filter['month'] . '-01';
|
||||
}
|
||||
|
||||
$res = [];
|
||||
|
||||
if (!$this->auth->isSuperAdmin()) {
|
||||
$admins = Db::name('admin')->where('id', $this->auth->id)->field('id,nickname')->select();
|
||||
} else{
|
||||
$admins = Db::name('admin')->field('id,nickname')->select();
|
||||
}
|
||||
|
||||
$admins = array_column($admins, NULL, 'id');
|
||||
$adminIds = array_keys($admins);
|
||||
|
||||
$adminNames = array_column($admins, 'nickname', 'id');
|
||||
|
||||
$builder = $this->model
|
||||
->where('salary_month', '=', $month);
|
||||
if (!$this->auth->isSuperAdmin()) {
|
||||
$builder = $builder->where('target_admin_id', $this->auth->id);
|
||||
}
|
||||
|
||||
$queryData = $builder->select();
|
||||
$queryRes = [];
|
||||
foreach ($queryData as $queryDatum) {
|
||||
$targetAdminId = $queryDatum['target_admin_id'];
|
||||
$itemId = $queryDatum['item_id'];
|
||||
$queryRes[$targetAdminId][$itemId] = $queryDatum['item_value'];
|
||||
}
|
||||
|
||||
$querySettleData = Db::name('salary_settle')
|
||||
->whereIn('target_admin_id', $adminIds)
|
||||
->where('salary_month', '=', $month)
|
||||
->field('id,target_admin_id,settle_status')
|
||||
->select();
|
||||
$querySettleRes = [];
|
||||
foreach ($querySettleData as $querySettleDatum) {
|
||||
$targetAdminId = $querySettleDatum['target_admin_id'];
|
||||
$querySettleRes[$targetAdminId] = $querySettleDatum['settle_status'];
|
||||
}
|
||||
|
||||
|
||||
foreach ($adminIds as $adminId) {
|
||||
$attrValue = [];
|
||||
$total = 0;
|
||||
foreach ($items as $item) {
|
||||
|
||||
$res[$adminId]['target_admin_id'] = $adminId;
|
||||
$res[$adminId]['name'] = $adminNames[$adminId];
|
||||
$res[$adminId]['month'] = $month;
|
||||
|
||||
$itemKey = 'item_' . $item['id'];
|
||||
|
||||
$value = 0;
|
||||
|
||||
if (!empty($queryRes[$adminId][$item['id']])) {
|
||||
$value = $this->clean_number($queryRes[$adminId][$item['id']]);
|
||||
$total = $this->calc_total($total, $item['type'], $queryRes[$adminId][$item['id']]);
|
||||
}
|
||||
|
||||
$attrValue[$item['attr']] = $value;
|
||||
if ($item['attr'] == 'TD') {
|
||||
$value = $value . '%';
|
||||
}
|
||||
$res[$adminId][$itemKey] = $value;
|
||||
}
|
||||
|
||||
$jxTotal = ($attrValue['ZWJX'] - $attrValue['YYCB']) * $attrValue['TD'] / 100;
|
||||
$res[$adminId]['jx_total'] = $this->clean_number($jxTotal);
|
||||
$res[$adminId]['total'] = $this->clean_number($total + $jxTotal);
|
||||
$res[$adminId]['settle_status'] = $querySettleRes[$adminId] ?? 0;
|
||||
}
|
||||
|
||||
$res = array_values($res);
|
||||
|
||||
$result = array("total" => count($res), "rows" => $res);
|
||||
|
||||
|
||||
return json($result);
|
||||
}
|
||||
|
||||
$this->assignconfig("manage", $this->auth->check('salary/custom_detail/edit'));
|
||||
$this->view->assign("month", $month);
|
||||
$this->view->assign("salaryitem", json_encode($salaryItem));
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
public function calc_total($total, $type, $value){
|
||||
if ($type == 1) {
|
||||
return $total + $value;
|
||||
}
|
||||
if ($type == 2) {
|
||||
return $total - $value;
|
||||
}
|
||||
|
||||
return $total;
|
||||
}
|
||||
|
||||
public function clean_number($num): string {
|
||||
return rtrim(rtrim(number_format($num, 10, '.', ''), '0'), '.');
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
|
||||
if (false === $this->request->isPost()) {
|
||||
|
||||
$items = Db::name('salary_item')->field('id,type,name')->select();
|
||||
|
||||
$typeMap = [
|
||||
1 => '应发工资',
|
||||
2 => '应扣款项',
|
||||
3 => '其他'
|
||||
];
|
||||
$groupedItems = [];
|
||||
foreach ($items as $item) {
|
||||
$type = $item['type'];
|
||||
$label = $typeMap[$type];
|
||||
$groupedItems[$label][] = $item;
|
||||
}
|
||||
|
||||
$this->view->assign('groupedItems', $groupedItems);
|
||||
$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();
|
||||
}
|
||||
|
||||
|
||||
public function edit()
|
||||
{
|
||||
|
||||
if (false === $this->request->isPost()) {
|
||||
|
||||
|
||||
$targetAdminId = $this->request->get('target_admin_id');
|
||||
$month = $this->request->get('month');
|
||||
|
||||
$row['salary_month'] = $month;
|
||||
$row['target_admin_id'] = $targetAdminId;
|
||||
|
||||
|
||||
$queryData = $this->model
|
||||
->where('salary_month', '=', $month)
|
||||
->where('target_admin_id', $targetAdminId)
|
||||
->select();
|
||||
$items = Db::name('salary_item')->field('id,name,type')->select();
|
||||
$queryData = array_column($queryData, NULL, 'item_id');
|
||||
|
||||
foreach ($items as $item) {
|
||||
$itemKey = 'item_' . $item['id'];
|
||||
$row[$itemKey] = !empty($queryData[$item['id']]) ? $queryData[$item['id']]['item_value'] : 0;
|
||||
}
|
||||
|
||||
$typeMap = [
|
||||
1 => '应发工资',
|
||||
2 => '应扣款项',
|
||||
3 => '其他'
|
||||
];
|
||||
$groupedItems = [];
|
||||
foreach ($items as $item) {
|
||||
$type = $item['type'];
|
||||
$label = $typeMap[$type];
|
||||
$groupedItems[$label][] = $item;
|
||||
}
|
||||
|
||||
$this->view->assign('groupedItems', $groupedItems);
|
||||
$this->view->assign('items', $items);
|
||||
$this->view->assign('row', $row);
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
public function settle()
|
||||
{
|
||||
if (false === $this->request->isPost()) {
|
||||
$this->error(__("Invalid parameters"));
|
||||
}
|
||||
|
||||
$targetAdminId = $this->request->get('target_admin_id');
|
||||
$month = $this->request->get('month');
|
||||
|
||||
|
||||
$settle = Db::name('salary_settle')
|
||||
->where('salary_month', $month)
|
||||
->where('target_admin_id', $targetAdminId)
|
||||
->field('target_admin_id,salary_month')->find();
|
||||
if (!empty($settle)) {
|
||||
Db::name('salary_settle')
|
||||
->where('salary_month', $month)
|
||||
->where('target_admin_id', $targetAdminId)
|
||||
->save([
|
||||
'settle_status' => 1,
|
||||
]);
|
||||
$this->success();
|
||||
}
|
||||
|
||||
Db::name('salary_settle')->insert([
|
||||
'target_admin_id' => $targetAdminId,
|
||||
'salary_month' => $month,
|
||||
'settle_status' => 1,
|
||||
]);
|
||||
|
||||
$this->success();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
36
application/admin/view/salary/custom_detail/add.html
Normal file
36
application/admin/view/salary/custom_detail/add.html
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
<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 $groupedItems as $groupName => $group}
|
||||
<div class="form-group" style="border-top: 1px solid #ddd; padding-top: 10px; margin-top: 20px;">
|
||||
<label class="control-label col-xs-12 col-sm-2 text-left" style="font-weight: bold;">{$groupName}</label>
|
||||
</div>
|
||||
|
||||
{foreach $group as $index => $item}
|
||||
{if $index % 2 == 0}<div class="form-group">{/if}
|
||||
<label class="control-label col-xs-12 col-sm-1">{$item.name}:</label>
|
||||
<div class="col-xs-12 col-sm-4">
|
||||
<input class="form-control" step="0.01" name="row[item_{$item.id}]" type="number" value="">
|
||||
</div>
|
||||
{if $index % 2 == 1 || $index == count($group) - 1}</div>{/if}
|
||||
{/foreach}
|
||||
{/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>
|
||||
38
application/admin/view/salary/custom_detail/edit.html
Normal file
38
application/admin/view/salary/custom_detail/edit.html
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
<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" readonly="readonly" data-rule="required" data-source="auth/admin/selectpage" data-field="nickname" 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">{:__('Salary_month')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-salary_month" readonly="readonly" class="form-control datetimepicker" data-date-format="YYYY-MM" data-use-current="true" name="row[salary_month]" type="text" value="{$row.salary_month|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
{foreach $groupedItems as $groupName => $group}
|
||||
<div class="form-group" style="border-top: 1px solid #ddd; padding-top: 10px; margin-top: 20px;">
|
||||
<label class="control-label col-xs-12 col-sm-2 text-left" style="font-weight: bold;">{$groupName}</label>
|
||||
</div>
|
||||
|
||||
{foreach $group as $index => $item}
|
||||
{if $index % 2 == 0}<div class="form-group">{/if}
|
||||
<label class="control-label col-xs-12 col-sm-1">{$item.name}:</label>
|
||||
<div class="col-xs-12 col-sm-4">
|
||||
<input class="form-control" step="0.01" name="row[item_{$item.id}]" type="number" value="{$row['item_' . $item.id]|htmlentities}">
|
||||
</div>
|
||||
{if $index % 2 == 1 || $index == count($group) - 1}</div>{/if}
|
||||
{/foreach}
|
||||
{/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>
|
||||
66
application/admin/view/salary/custom_detail/index.html
Normal file
66
application/admin/view/salary/custom_detail/index.html
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
<div class="panel panel-default panel-intro">
|
||||
{:build_heading()}
|
||||
|
||||
|
||||
<textarea id="salaryitem" name="salaryitem" class="form-control" cols="30" rows="5" style="display:none;">{$salaryitem}</textarea>
|
||||
|
||||
|
||||
<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/custom_detail/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
|
||||
width="100%">
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script id="customformtpl" type="text/html">
|
||||
<!--form表单必须添加form-commsearch这个类-->
|
||||
<form action="" class="form-commonsearch">
|
||||
<div style="border-radius:2px;margin-bottom:10px;background:#f5f5f5;padding:15px 20px;">
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-sm-6 col-md-3" style="min-height:68px;">
|
||||
<!--这里添加68px是为了避免刷新时出现元素错位闪屏-->
|
||||
<div class="form-group">
|
||||
<label class="control-label">时间范围</label>
|
||||
<!-- 指定这个字段是 month,操作符为 = -->
|
||||
<input type="hidden" class="operate" data-name="month" value="="/>
|
||||
<div>
|
||||
<input id="c-month"
|
||||
class="form-control datetimepicker"
|
||||
data-date-format="YYYY-MM"
|
||||
data-use-current="true"
|
||||
name="month"
|
||||
type="text"
|
||||
value="{:date('Y-m')}" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-6 col-md-3">
|
||||
<div class="form-group">
|
||||
<label class="control-label"></label>
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
<input type="submit" class="btn btn-success btn-block" value="查询"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</script>
|
||||
|
||||
127
public/assets/js/backend/salary/custom_detail.js
Normal file
127
public/assets/js/backend/salary/custom_detail.js
Normal file
|
|
@ -0,0 +1,127 @@
|
|||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'salary/custom_detail/index' + location.search,
|
||||
add_url: 'salary/custom_detail/add',
|
||||
// del_url: 'oa/schedule/del',
|
||||
// multi_url: 'oa/schedule/multi',
|
||||
// import_url: 'oa/schedule/import',
|
||||
table: 'salary',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
var defaultColumnArr = [];
|
||||
defaultColumnArr.push({
|
||||
"title":"用户名",
|
||||
"field":"name",
|
||||
},{
|
||||
"title":"用户id",
|
||||
"field":"target_admin_id",
|
||||
"visible":false
|
||||
});
|
||||
|
||||
|
||||
// 获取后端传入的字段定义(JSON 字符串)
|
||||
|
||||
var columnJson = $('#salaryitem').val();
|
||||
var rawColumns = JSON.parse(columnJson);
|
||||
rawColumns.forEach(function (item) {
|
||||
// 可以加入格式化、样式控制等逻辑
|
||||
defaultColumnArr.push({
|
||||
field: item.id,
|
||||
title: item.name,
|
||||
});
|
||||
});
|
||||
|
||||
defaultColumnArr.push({
|
||||
field: 'operate',
|
||||
title: __('Operate'),
|
||||
table: table,
|
||||
buttons: [
|
||||
{
|
||||
name: 'edit',
|
||||
text: '编辑',
|
||||
title: '编辑',
|
||||
classname: 'btn btn-xs btn-success btn-dialog',
|
||||
icon: 'fa fa-edit',
|
||||
url: function (row) {
|
||||
// 注意这里拼接 admin_id 和 month
|
||||
return 'salary/custom_detail/edit?target_admin_id=' + row.target_admin_id + '&month=' + row.month;
|
||||
},
|
||||
extend: 'data-area=\'["800px", "600px"]\'',
|
||||
visible:function(row){
|
||||
if (!Config.manage) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'complete',
|
||||
text:"结算",
|
||||
title:"结算",
|
||||
extend: 'data-toggle="tooltip" data-container="body"',
|
||||
classname: 'btn btn-xs btn-success btn-magic btn-ajax',
|
||||
icon: 'fa fa-cny',
|
||||
url: function (row) {
|
||||
// 注意这里拼接 admin_id 和 month
|
||||
return 'salary/detail/settle?target_admin_id=' + row.target_admin_id + '&month=' + row.month;
|
||||
},
|
||||
confirm: '确认结算?',
|
||||
refresh: true,
|
||||
success: function (data, ret) {
|
||||
$("#table").bootstrapTable('refresh');
|
||||
return false;
|
||||
},
|
||||
error: function (data, ret) {
|
||||
Layer.alert(ret.msg);
|
||||
return false;
|
||||
},
|
||||
visible: function (row) {
|
||||
if (!Config.manage) {
|
||||
return false;
|
||||
}
|
||||
//返回true时按钮显示,返回false隐藏
|
||||
if (row.settle_status != 1) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
},
|
||||
],
|
||||
events: Table.api.events.operate,
|
||||
formatter: Table.api.formatter.operate
|
||||
});
|
||||
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
columns: defaultColumnArr,
|
||||
searchFormVisible: true,
|
||||
searchFormTemplate: 'customformtpl',
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
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