You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

203 lines
6.5 KiB

3 years ago
@{
ViewData["Title"] = "运输配置管理";
Layout = "~/Views/Shared/_Index.cshtml";
}
<div class="lr-layout">
<div class="lr-layout-center">
<div class="lr-layout-wrap lr-layout-wrap-notitle">
<div class="lr-layout-tool">
<div class="lr-layout-tool-left">
<div class="lr-layout-tool-item">
<div id="datesearch" class="datetime"></div>
</div>
<div class="lr-layout-tool-item">
<input id="txt_Keyword" type="text" class="form-control" placeholder="请输入要查询关键字" />
</div>
<div class="lr-layout-tool-item">
<a id="btn_hint" class="fa fa-question-circle" style="font-size: 18px; color: orange;"></a>
<a id="btn_Search" class="btn btn-primary btn-sm"><i class="fa fa-search"></i>&nbsp;<span class="lrlg">查询</span></a>
<a id="btn_Reset" class="btn btn-default btn-sm"><i class="fa fa-refresh"></i>&nbsp;<span class="lrlg">重置</span></a>
</div>
</div>
<div class="lr-layout-tool-right">
<div class="btn-group btn-group-sm">
<a id="btn_refresh" class="btn btn-default"><i class="fa fa-refresh"></i></a>
</div>
<div class="btn-group btn-group-sm" learun-authorize="yes">
<a id="btn_add" class="btn btn-default"><i class="fa fa-plus"></i>&nbsp;<span class="lrlg">新增</span></a>
<a id="btn_edit" class="btn btn-default"><i class="fa fa-pencil-square-o"></i>&nbsp;<span class="lrlg">编辑</span></a>
<a id="btn_delete" class="btn btn-default"><i class="fa fa-trash-o"></i>&nbsp;<span class="lrlg">删除</span></a>
</div>
</div>
</div>
<div class="lr-layout-body" id="gridtable"></div>
</div>
</div>
</div>
<script>
var selectedRow;
var curParam = {
StartTime: '',
EndTime: '',
Keyword: ''
};
var checkJustReturn = false;
var bootstrap = function ($, learun) {
"use strict";
var page = {
init: function () {
page.bind();
page.initGrid();
},
bind: function () {
//日期查询
$('.datetime').each(function () {
$(this).lrdate({
//初始值
dfdata: [
{ name: '今天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00') }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
{ name: '近7天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'd', -6) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
{ name: '近1月', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'm', -1) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
{ name: '近3月', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'm', -3) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
],
// 初始索引值
dfvalue: '-1',
selectfn: function (begin, end) {
curParam.StartTime = begin;
curParam.EndTime = end;
page.search();
}
});
});
$('#btn_hint').popover({
trigger: 'hover',//触发方式
placement: 'right',//弹出框位置
html: true,//添加data-html="true"之后,data-content里面就可以添加HTML代码
//title: 'title',
content: "&emsp;查询时间:<br>创建时间<br>" +
"&emsp;查询关键字:<br>序号",
container: 'body'
});
// 查询
$('#btn_Search').on('click', function () {
curParam.Keyword = $('#txt_Keyword').val();
page.search();
});
// 重置
$('#btn_Reset').on('click', function () {
curParam = {};
checkJustReturn = true;
$('#datesearch').find('.lr-search-date-btn-block:last').find('a').click();
$('#txt_Keyword').val('');
checkJustReturn = false;
page.search();
});
// 刷新
$('#btn_refresh').on('click', function () {
location.reload();
});
//新增
$('#btn_add').on('click', function () {
selectedRow = null;
learun.layerForm({
id: 'form',
title: '新增',
url: top.$.rootUrl + '/AutoWeight/Ini/Form',
height: 500,
width: 600,
callBack: function (id) {
return top[id].acceptClick(page.refreshData);
}
});
});
//编辑
$('#btn_edit').on('click', function () {
selectedRow = $('#gridtable').jfGridGet('rowdata');
var keyValue = $('#gridtable').jfGridValue('Id');
if (learun.checkrow(keyValue)) {
learun.layerForm({
id: 'form',
title: '编辑',
url: top.$.rootUrl + '/AutoWeight/Ini/Form',
height: 500,
width: 600,
callBack: function (id) {
return top[id].acceptClick(page.refreshData);
}
});
}
});
//删除
$('#btn_delete').on('click', function () {
var keyValue = $('#gridtable').jfGridValue('Id');
if (learun.checkrow(keyValue)) {
learun.layerConfirm('是否确认删除该项!', function (res) {
if (res) {
learun.deleteForm(top.$.rootUrl + '/AutoWeight/Ini/DeleteForm', { keyValue: keyValue }, function () {
page.refreshData();
});
}
});
}
});
},
initGrid: function () {
$('#gridtable').lrAuthorizeJfGrid({
url: top.$.rootUrl + '/AutoWeight/Ini/GetPageList',
isPage: true,
mainId: 'Id',
rows: 30,
sidx: '',//排序字段只有在分页的情况下支持,多个字段用,隔开
headData: [
{
label: "Id", name: "Id", ishide: true
},
{
label: "序号", name: "SerialNumber", width: 100, align: "center", frozen: true
},
{
label: "月计划数量", name: "PlanNumber", width: 100, align: "center"
},
{
label: "运单数量", name: "BillNumber", width: 100, align: "center"
},
{
label: "创建时间", name: "CreateTime", width: 150, align: "center",
formatter: function (value, row, op, $cell) {
return learun.formatDate(value, 'yyyy-MM-dd hh:mm:ss');
}
},
{
label: "更新时间", name: "UpdateTime", width: 150, align: "center",
formatter: function (value, row, op, $cell) {
return learun.formatDate(value, 'yyyy-MM-dd hh:mm:ss');
}
},
{
label: "备注", name: "Remark", width: 400, align: "left"
}
]
});
page.search();
},
beforeSearch: function () {
if (checkJustReturn) {
return false;
}
return true;
},
search: function (param) {
if (page.beforeSearch()) {
$('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(curParam) });
}
},
refreshData: function () {
page.search();
}
};
page.init();
}
</script>