添加日志

This commit is contained in:
xman 2025-04-15 17:58:27 +08:00
parent 850c962340
commit dd67cb9d13
3 changed files with 122 additions and 73 deletions

View File

@ -1,29 +1,25 @@
<div class="panel panel-default panel-intro">
{:build_heading()}
<div class="panel-heading">
<!--<div class="panel-lead"><em>多表格Multitable</em>用于展示在一个页面展示多个表格数据,并且每次切换时刷新</div>-->
<ul class="nav nav-tabs">
<li class="active"><a href="#first" data-toggle="tab">任务变更日志</a></li>
<li><a href="#second" data-toggle="tab">跟进记录</a></li>
</ul>
</div>
<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('orders/dispatchlog/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('orders/dispatchlog/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('orders/dispatchlog/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('orders/dispatchlog/edit')}"
data-operate-del="{:$auth->check('orders/dispatchlog/del')}"
width="100%">
</table>
</div>
<div class="tab-pane fade active in" id="first">
<table id="table1" class="table table-striped table-bordered table-hover" width="100%">
</table>
</div>
<div class="tab-pane fade" id="second">
<table id="table2" class="table table-striped table-bordered table-hover" width="100%">
</table>
</div>
</div>
</div>
</div>

View File

@ -1,14 +1,9 @@
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action=""
xmlns="http://www.w3.org/1999/html">
{notempty name='records'}
<div class="col-xs-12 col-sm-6">
{/notempty}
<input type="hidden" name="row[dispatch_id]" value="{$dispatch.id|htmlentities}">
<input type="hidden" name="row[worker_id]" value="{$dispatch.worker_id|htmlentities}">
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Remark')}:</label>
<div class="col-xs-12 col-sm-8">
@ -34,37 +29,8 @@
<input id="c-notice_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[notice_time]" type="text" value="{:date('Y-m-d H:i:s')}">
</div>
</div>
{notempty name='records'}
</div>
{/notempty}
{notempty name='records'}
<div class="col-xs-12 col-sm-6">
<table class="table table-hover">
<thead>
<tr>
<th>ID</th>
<th>备忘内容</th>
<th>通知</th>
<th>状态</th>
<th>时间</th>
</tr>
</thead>
<tbody>
{volist name="records" id="item"}
<tr>
<td>{$item.id}</td>
<td>{$item.remark}</td>
<td>{$item.need_notice_text}</td>
<td>{$item.status_text}</td>
<td>{$item.create_time}</td>
</tr>
{/volist}
</tbody>
</table>
</div>
{/notempty}
<div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label>

View File

@ -1,24 +1,35 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'orders/dispatchlog/index' + location.search,
// add_url: 'orders/dispatchlog/add',
// edit_url: 'orders/dispatchlog/edit',
// del_url: 'orders/dispatchlog/del',
multi_url: 'orders/dispatchlog/multi',
import_url: 'orders/dispatchlog/import',
table: 'order_dispatch_log',
}
});
index: function () {
// 初始化表格参数配置
Table.api.init();
//绑定事件
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
var panel = $($(this).attr("href"));
if (panel.length > 0) {
Controller.table[panel.attr("id")].call(this);
$(this).on('click', function (e) {
$($(this).attr("href")).find(".btn-refresh").trigger("click");
});
}
//移除绑定的事件
$(this).unbind('shown.bs.tab');
});
//必须默认触发shown.bs.tab事件
$('ul.nav-tabs li.active a[data-toggle="tab"]').trigger("shown.bs.tab");
// var table = $("#table");
var table = $("#table");
// 初始化表格
table.bootstrapTable({
/*table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
@ -38,11 +49,87 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
// {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
});
});*/
// 为表格绑定事件
Table.api.bindevent(table);
//Table.api.bindevent(table);
},
table: {
first: function () {
// 表格1
var table1 = $("#table1");
table1.bootstrapTable({
url: 'orders/dispatchlog/index' + location.search,
toolbar: '#toolbar1',
sortName: 'id',
search: false,
commonSearch:false,
visible: false,
showToggle: false,
showColumns: false,
showExport: false,
columns: [
[
{field: 'id', title: __('Id')},
// {field: 'dispatch_id', title: __('Dispatch_id')},
//{field: 'order_id', title: __('Order_id')},
//{field: 'worker_id', title: __('Worker_id')},
// {field: 'status', title: __('Status')},
{field: 'status_text', title: __('Status_text'), operate: 'LIKE'},
{field: 'remark', title: __('Remark'), operate: 'LIKE', table: table1, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
// {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
});
// 为表格1绑定事件
Table.api.bindevent(table1);
},
second: function () {
// 表格2
var table2 = $("#table2");
table2.bootstrapTable({
url: 'orders/dispatchrecord/index' + location.search,
/* extend: {
index_url: '',
add_url: '',
edit_url: '',
del_url: '',
multi_url: '',
table: '',
},*/
toolbar: '#toolbar2',
sortName: 'id',
search: false,
commonSearch:false,
visible: false,
showToggle: false,
showColumns: false,
showExport: false,
columns: [
[
{field: 'id', title: __('Id')},
//{field: 'dispatch_id', title: __('Dispatch_id')},
//{field: 'worker_id', title: __('Worker_id')},
{field: 'remark', title: __('跟进内容'), operate: 'LIKE', table: table2, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'need_notice', title: __('需要提醒'), searchList: {"0":__('否'),"1":__('是')}, formatter: Table.api.formatter.normal},
{field: 'notice_time', title: __('提醒时间'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
{field: 'status', title: __('状态'), searchList: {"0":__('未完成'),"1":__('已结束')}, formatter: Table.api.formatter.status},
{field: 'create_time', title: __('创建时间'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
//{field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
]
]
});
// 为表格2绑定事件
Table.api.bindevent(table2);
}
},
add: function () {
Controller.api.bindevent();
},