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.
350 lines
11 KiB
350 lines
11 KiB
@{
|
|
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" style="width: 160px;">
|
|
<div id="supplier_select" style="border-radius: 4px;"></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>
|
|
<a id="btn_more" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
|
|
<i class="fa fa-reorder"></i> <span class="lrlg">更多</span><span class="caret"></span>
|
|
</a>
|
|
<ul class="dropdown-menu pull-right">
|
|
<li id="btn_reCount"><a><i></i> <span class="lrlg">重计实重</span></a></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="lr-layout-body" id="gridtable"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<style>
|
|
.jumpG {
|
|
color: #1abc9c;
|
|
text-decoration: underline;
|
|
}
|
|
|
|
.jumpG:hover {
|
|
color: #0b9277;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.jumpR {
|
|
color: #e74c3c;
|
|
text-decoration: underline;
|
|
}
|
|
|
|
.jumpR:hover {
|
|
color: #c0392b;
|
|
cursor: pointer;
|
|
}
|
|
</style>
|
|
|
|
<script>
|
|
var selectedRow;
|
|
var curParam = {
|
|
StartTime: '',
|
|
EndTime: '',
|
|
CompanyId: '',
|
|
SupplierId: '',
|
|
Keyword: ''
|
|
};
|
|
var checkJustReturn = false;
|
|
var bootstrap = function ($, learun) {
|
|
"use strict";
|
|
|
|
var page = {
|
|
init: function () {
|
|
page.bind();
|
|
page.initTree();
|
|
page.initGrid();
|
|
},
|
|
bind: function () {
|
|
// 供应商选择
|
|
$('#supplier_select').lrselect({
|
|
// 访问数据接口地址
|
|
url: top.$.rootUrl + '/AutoWeight/Supplier/GetTree',
|
|
type: 'tree',
|
|
placeholder: '请选择供应商',
|
|
// 是否允许搜索
|
|
allowSearch: true,
|
|
select: function (item) {
|
|
curParam.SupplierId = (!!item && item.id > 0) ? item.id : '';
|
|
page.search();
|
|
}
|
|
});
|
|
// 日期查询
|
|
$('.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/MonthPlan/Form?companyId=' + curParam.CompanyId,
|
|
height: 500,
|
|
width: 600,
|
|
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/MonthPlan/Form?companyId=' + curParam.CompanyId,
|
|
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/MonthPlan/DeleteForm', { keyValue: keyValue }, function () {
|
|
page.refreshData();
|
|
});
|
|
}
|
|
});
|
|
}
|
|
});
|
|
// 重计实重
|
|
$('#btn_reCount').on('click', function () {
|
|
var keyValue = $('#gridtable').jfGridValue('Id');
|
|
if (learun.checkrow(keyValue)) {
|
|
learun.layerConfirm('是否重计实到重量!', function (res) {
|
|
if (res) {
|
|
learun.deleteForm(top.$.rootUrl + '/AutoWeight/MonthPlan/ReCountWeight', { 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/MonthPlan/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: "SupplierName", width: 150, align: "center", frozen: true
|
|
},
|
|
{
|
|
label: "料号", name: "MaterialNo", width: 150, align: "center"
|
|
},
|
|
{
|
|
label: "计划重量", name: "PlanQty", width: 60, align: "center"
|
|
},
|
|
{
|
|
label: "实到重量", name: "ActQty", width: 60, align: "center",
|
|
formatter: function (value, row, op, $cell) {
|
|
var elm = document.createElement("p");
|
|
elm.innerHTML = row.ActQty;
|
|
elm.classList.add((row.PlanQty - row.ActQty) > 0 ? "jumpG" : "jumpR");
|
|
elm.dataset.SerialNumber = row.SerialNumber;
|
|
elm.addEventListener("click", function (e) {
|
|
page.getModuleByCode("TransportBillModule", function (module) {
|
|
parent.document.getElementById(module.F_ModuleId).click();
|
|
setTimeout(function () {
|
|
var curTab = learun.frameTab.currentIframe();
|
|
curTab.focusSearch(curParam.CompanyId, e.target.dataset.SerialNumber);
|
|
}, 500);
|
|
});
|
|
});
|
|
return elm;
|
|
}
|
|
},
|
|
{
|
|
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", width: 400, 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();
|
|
},
|
|
getModuleByCode: function (code, callback) {
|
|
if (!!window.NeedModule) {
|
|
callback(window.NeedModule);
|
|
} else {
|
|
learun.httpAsyncGet2(top.$.rootUrl + '/LR_SystemModule/Module/GetModuleByCode', { code: code }, function (res) {
|
|
if (!!res.data && !!callback) {
|
|
window.NeedModule = res.data;
|
|
callback(window.NeedModule);
|
|
} else {
|
|
setTimeout(page.getModuleByCode(code, callback), 300);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
};
|
|
|
|
page.init();
|
|
}
|
|
</script>
|