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.
252 lines
7.7 KiB
252 lines
7.7 KiB
3 years ago
|
@{
|
||
|
ViewData["Title"] = "站点管理";
|
||
|
Layout = "~/Views/Shared/_Index.cshtml";
|
||
|
}
|
||
|
|
||
|
<div id="lr_layout" class="lr-layout lr-layout-left-center">
|
||
|
|
||
|
<div class="lr-layout-left">
|
||
|
<div class="lr-layout-wrap">
|
||
|
<div class="lr-layout-title lrlg ">公司信息</div>
|
||
|
<div id="companyTree" class="lr-layout-body"></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div class="lr-layout-center">
|
||
|
<div class="lr-layout-wrap">
|
||
|
|
||
|
<div class="lr-layout-title">
|
||
|
<span id="titleinfo" class="lrlg">未选择公司</span> - <span class="lrlg">站点信息</span>
|
||
|
</div>
|
||
|
|
||
|
<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> <span class="lrlg">查询</span></a>
|
||
|
<a id="btn_Reset" class="btn btn-default btn-sm"><i class="fa fa-refresh"></i> <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> <span class="lrlg">新增</span></a>
|
||
|
<a id="btn_edit" class="btn btn-default"><i class="fa fa-pencil-square-o"></i> <span class="lrlg">编辑</span></a>
|
||
|
<a id="btn_delete" class="btn btn-default"><i class="fa fa-trash-o"></i> <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: '',
|
||
|
CompanyId: '',
|
||
|
Keyword: ''
|
||
|
};
|
||
|
var checkJustReturn = false;
|
||
|
var bootstrap = function ($, learun) {
|
||
|
"use strict";
|
||
|
|
||
|
var page = {
|
||
|
init: function () {
|
||
|
page.bind();
|
||
|
page.initTree();
|
||
|
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:
|
||
|
" 查询时间:<br>创建时间<br>" +
|
||
|
" 查询关键字:<br>站点名",
|
||
|
container: 'body'
|
||
|
});
|
||
|
// 查询
|
||
|
$('#btn_Search').on('click', function () {
|
||
|
curParam.Keyword = $('#txt_Keyword').val();
|
||
|
page.search();
|
||
|
});
|
||
|
// 重置
|
||
|
$('#btn_Reset').on('click', function () {
|
||
|
var tempId = curParam.CompanyId;
|
||
|
curParam = {};
|
||
|
curParam.CompanyId = tempId;
|
||
|
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 () {
|
||
|
if (!curParam.CompanyId) {
|
||
|
learun.alert.warning('请选择公司!');
|
||
|
return false;
|
||
|
}
|
||
|
selectedRow = null;
|
||
|
learun.layerForm({
|
||
|
id: 'form',
|
||
|
title: '新增',
|
||
|
url: top.$.rootUrl + '/AutoWeight/Site/Form?companyId=' + curParam.CompanyId,
|
||
|
width: 750,
|
||
|
height: 450,
|
||
|
callBack: function (id) {
|
||
|
return top[id].acceptClick(page.refreshData);
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
//编辑
|
||
|
$('#btn_edit').on('click', function () {
|
||
|
if (!curParam.CompanyId) {
|
||
|
learun.alert.warning('请选择公司!');
|
||
|
return false;
|
||
|
}
|
||
|
selectedRow = $('#gridtable').jfGridGet('rowdata');
|
||
|
var keyValue = $('#gridtable').jfGridValue('Id');
|
||
|
if (learun.checkrow(keyValue)) {
|
||
|
learun.layerForm({
|
||
|
id: 'form',
|
||
|
title: '编辑',
|
||
|
url: top.$.rootUrl + '/AutoWeight/Site/Form?companyId=' + curParam.CompanyId,
|
||
|
width: 750,
|
||
|
height: 450,
|
||
|
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/Site/DeleteForm', { keyValue: keyValue }, function () {
|
||
|
page.refreshData();
|
||
|
});
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
});
|
||
|
},
|
||
|
initTree: function () {
|
||
|
$('#companyTree').lrtree({
|
||
|
url: top.$.rootUrl + '/LR_OrganizationModule/Company/GetTree2',
|
||
|
nodeClick: page.treeNodeClick,
|
||
|
callback: function () {
|
||
|
$('#companyTree').lrtreeSet("clickFirst");
|
||
|
}
|
||
|
});
|
||
|
},
|
||
|
treeNodeClick: function (item) {
|
||
|
$('#titleinfo').text(item.text);
|
||
|
curParam.CompanyId = item.id;
|
||
|
page.search();
|
||
|
},
|
||
|
initGrid: function () {
|
||
|
$('#gridtable').lrAuthorizeJfGrid({
|
||
|
url: top.$.rootUrl + '/AutoWeight/Site/GetPageList',
|
||
|
isPage: true,
|
||
|
mainId: 'Id',
|
||
|
rows: 30,
|
||
|
sidx: '',//排序字段只有在分页的情况下支持,多个字段用,隔开
|
||
|
headData: [
|
||
|
{
|
||
|
label: "Id", name: "Id", ishide: true
|
||
|
},
|
||
|
{
|
||
|
label: "名称", name: "Name", width: 100, align: "center", frozen: true
|
||
|
},
|
||
|
{
|
||
|
label: "创建者", name: "CreateMan", 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: "UpdateMan", width: 100, align: "center"
|
||
|
},
|
||
|
{
|
||
|
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", align: "left"
|
||
|
}
|
||
|
]
|
||
|
});
|
||
|
},
|
||
|
beforeSearch: function () {
|
||
|
if (checkJustReturn) {
|
||
|
return false;
|
||
|
}
|
||
|
if (!curParam.CompanyId) {
|
||
|
learun.alert.warning('请选择公司!');
|
||
|
return false;
|
||
|
}
|
||
|
return true;
|
||
|
},
|
||
|
search: function (param) {
|
||
|
if (page.beforeSearch()) {
|
||
|
$('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(curParam) });
|
||
|
}
|
||
|
},
|
||
|
refreshData: function () {
|
||
|
page.search();
|
||
|
}
|
||
|
};
|
||
|
|
||
|
page.init();
|
||
|
}
|
||
|
</script>
|