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.
858 lines
34 KiB
858 lines
34 KiB
@{
|
|
ViewBag.Title = "Index";
|
|
Layout = "~/Views/Shared/_Index.cshtml";
|
|
}
|
|
<style>
|
|
.btn-primary {
|
|
margin-right: 2px;
|
|
}
|
|
|
|
.topPanel .toolbar {
|
|
float: left;
|
|
}
|
|
/*.ui-jqgrid tr.jqgrow td {
|
|
white-space: normal !important;
|
|
height: auto;
|
|
}*/
|
|
</style>
|
|
<script src="~/Content/js/CommonReport/CommonReport.js"></script>
|
|
<script>
|
|
//var _MenuCaption = "";
|
|
var _MenuTag = "";
|
|
|
|
var _MenuID = "";//菜单ID
|
|
var _SourceID = "";//数据源ID
|
|
var _sqlTxt = "";//加上参数的sql
|
|
var _sqlTxt_Condition = new Array();//加上过滤条件的sql
|
|
var _sqlTxt_AddCondition = "";//加上过滤条件的sql
|
|
var _IsExistsDataSource = "";
|
|
var _DBName = "";//s数据库
|
|
var _Cols = new Array();//列
|
|
var _ReportName = "";
|
|
var _Filter = "";
|
|
var _TempName = "";
|
|
var _footerrow = false;//是否有合计项
|
|
var _footercols = new Array();//合计项
|
|
var _formatcols = new Array();//个性化项
|
|
var _formatcols_Row = new Array();//个性化项的行
|
|
var _Mergercols = new Array();//合并项
|
|
var _XCol = "";
|
|
var dataRR = "";
|
|
var _HiddenCols = new Array();
|
|
$(function () {
|
|
debugger;
|
|
//1、获取当前页菜单名
|
|
GetMenuID();
|
|
//2、获取菜单设置
|
|
GetMenu();
|
|
//gridList();
|
|
$(window).resize(function () {
|
|
|
|
$("#gridList").setGridWidth($(window).width() * 0.99);
|
|
$("#gridList").setGridWidth(document.body.clientWidth * 0.99);
|
|
$("#gridList").setGridHeight($(window).height() - 132);
|
|
$("#gridList").setGridHeight(document.body.clientHeight - 132);
|
|
});
|
|
|
|
});
|
|
|
|
//1、获取当前页菜单名
|
|
function GetMenuID() {
|
|
debugger;
|
|
var cc = self.frameElement.getAttribute('id');
|
|
_MenuID = cc.replace("iframe", "");
|
|
//_MenuTag = $.request("MenuTag");
|
|
//$.ajax({
|
|
// url: "/SystemManage/CommonReport/GetMenuID?MenuTag=" + _MenuTag + "&" + Math.random(),
|
|
// dataType: "json",
|
|
// async: false,
|
|
// success: function (data) {
|
|
// if (data != false && data != null && data.length > 0) {
|
|
// _MenuID = data[0].MenuID;
|
|
// }
|
|
// else {
|
|
// alert("获取菜单ID异常,请查看菜单配置并刷新:" + data);
|
|
// }
|
|
// },
|
|
// error: function (aa) {
|
|
// alert("异常:" + aa.responseText);
|
|
|
|
// }
|
|
//});
|
|
}
|
|
|
|
//2、获取菜单设置 URL 列 等
|
|
function GetMenu() {
|
|
debugger;
|
|
$.ajax({
|
|
url: "/SystemManage/CommonReport/GetMenu?MenuID=" + _MenuID + "&" + Math.random(),
|
|
dataType: "json",
|
|
async: false,
|
|
success: function (data) {
|
|
if (data != false && data != null) {
|
|
_sqlTxt = data.sqlTxt;
|
|
_sqlTxt_AddCondition = data.sqlTxt;
|
|
_DBName = data.DBName;
|
|
_SourceID = data.SourceID;
|
|
_IsExistsDataSource = data.IsExistsDataSource;
|
|
_ReportName = data.ReportName;
|
|
_XCol = data.XCol;
|
|
_Mergercols = eval(data.Mergercols);
|
|
_formatcols = data.formatcols;
|
|
_TempName = data.TempName;
|
|
_footerrow = data.footerrow;
|
|
_footercols = eval(data.footercols);
|
|
_Cols = SetCols(eval(data.Cols));
|
|
_HiddenCols = eval(data.HiddenCols);
|
|
btn_Filter();
|
|
|
|
}
|
|
else {
|
|
alert("获取菜单栏位等信息异常。" + data);
|
|
}
|
|
},
|
|
error: function (aa) {
|
|
alert("异常:" + aa.responseText);
|
|
|
|
}
|
|
});
|
|
}
|
|
//个性化栏位背景色
|
|
function addCellAttr(rowId, val, rawObject, cm, rdata) {
|
|
var rr = ' id=\'' + cm.name + '' + rowId + "\' ";
|
|
var formatList = Getformatcol(_formatcols, cm.name);//获取format所有条件
|
|
if (formatList != null && formatList.length > 0) {
|
|
for (var i = 0; i < formatList.length; i++) {
|
|
var formatcol = formatList[i];//条件
|
|
var IsRow = false;
|
|
if (formatcol.AllRowFlag) {
|
|
IsRow = true;
|
|
var rr = {
|
|
rowid: rowId - 1,
|
|
backgroundcolor: formatcol.Color,
|
|
}
|
|
}
|
|
var FormatDataType = formatcol.DataType;
|
|
var LogStr = GetLogStringByNum(parseInt(formatcol.LogStr));
|
|
|
|
if (FormatDataType != "日期型") {
|
|
switch (LogStr) {
|
|
case "等于": if (val == formatcol.SValue) {
|
|
if (IsRow) { _formatcols_Row.push(rr); }
|
|
else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
|
|
}
|
|
break;
|
|
case "不等于": if (val != formatcol.SValue) {
|
|
if (IsRow) { _formatcols_Row.push(rr); }
|
|
else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
|
|
}
|
|
break;
|
|
case "小于": if (val < formatcol.SValue) {
|
|
if (IsRow) { _formatcols_Row.push(rr); }
|
|
else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
|
|
}
|
|
break;
|
|
case "大于": if (val > formatcol.SValue) {
|
|
if (IsRow) { _formatcols_Row.push(rr); }
|
|
else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
|
|
}
|
|
break;
|
|
case "小于等于": if (val <= formatcol.SValue) {
|
|
if (IsRow) { _formatcols_Row.push(rr); }
|
|
else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
|
|
}
|
|
break;
|
|
case "大于等于": if (val >= formatcol.SValue) {
|
|
if (IsRow) { _formatcols_Row.push(rr); }
|
|
else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
|
|
}
|
|
break;
|
|
case "范围内": if (val >= formatcol.SValue && val <= formatcol.DValue) {
|
|
if (IsRow) { _formatcols_Row.push(rr); }
|
|
else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
|
|
}
|
|
break;
|
|
case "范围外": if (val < formatcol.SValue || val > formatcol.DValue) {
|
|
if (IsRow) { _formatcols_Row.push(rr); }
|
|
else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
|
|
}
|
|
break;
|
|
case "包含": if (val.indexOf(formatcol.SValue) != -1) {
|
|
if (IsRow) { _formatcols_Row.push(rr); }
|
|
else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
|
|
}
|
|
break;
|
|
case "头部包含": if (val.indexOf(formatcol.SValue) == 0) {
|
|
if (IsRow) { _formatcols_Row.push(rr); }
|
|
else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
|
|
}
|
|
break;
|
|
case "尾部包含": if (val.indexOf(formatcol.SValue) == formatcol.length - val.length) {
|
|
if (IsRow) { _formatcols_Row.push(rr); }
|
|
else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
|
|
}
|
|
break;
|
|
case "不包含": if (val.indexOf(formatcol.SValue) == -1) {
|
|
if (IsRow) { _formatcols_Row.push(rr); }
|
|
else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
|
|
}
|
|
break;
|
|
|
|
|
|
}
|
|
}
|
|
else {
|
|
//日期型
|
|
if (val.length >= 10) {
|
|
var VV = val.substring(0, 10);
|
|
switch (LogStr) {
|
|
|
|
|
|
case "等于":
|
|
if (VV == formatcol.SValue) {
|
|
if (IsRow) { _formatcols_Row.push(rr); }
|
|
else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
|
|
}
|
|
break;
|
|
case "不等于": if (VV != formatcol.SValue) {
|
|
if (IsRow) { _formatcols_Row.push(rr); }
|
|
else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
|
|
}
|
|
break;
|
|
case "小于":
|
|
if (VV < formatcol.SValue) {
|
|
if (IsRow) { _formatcols_Row.push(rr); }
|
|
else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
|
|
}
|
|
break;
|
|
case "大于": if (VV > formatcol.SValue) {
|
|
if (IsRow) { _formatcols_Row.push(rr); }
|
|
else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
|
|
}
|
|
break;
|
|
case "小于等于": if (VV <= formatcol.SValue) {
|
|
if (IsRow) { _formatcols_Row.push(rr); }
|
|
else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
|
|
}
|
|
break;
|
|
case "大于等于": if (VV >= formatcol.SValue) {
|
|
if (IsRow) { _formatcols_Row.push(rr); }
|
|
else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
|
|
}
|
|
break;
|
|
case "范围内": if (VV >= formatcol.SValue && VV <= formatcol.DValue) {
|
|
if (IsRow) { _formatcols_Row.push(rr); }
|
|
else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
|
|
}
|
|
break;
|
|
case "范围外": if (VV < formatcol.SValue || VV > formatcol.DValue) {
|
|
if (IsRow) { _formatcols_Row.push(rr); }
|
|
else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
|
|
}
|
|
break;
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
return rr;
|
|
}
|
|
|
|
//个性化栏位背景色
|
|
function addCellAttr_ID(rowId, val, rawObject, cm, rdata) {
|
|
var rr = ' id=\'' + cm.name + '' + rowId + "\' ";
|
|
|
|
return rr;
|
|
}
|
|
|
|
|
|
function Getformatcol(formatcols, colname) {
|
|
var formatList = new Array();
|
|
if (formatcols != null && formatcols.length > 0) {
|
|
for (var i = 0; i < formatcols.length; i++) {
|
|
if (formatcols[i].ColFiledName == colname) {
|
|
formatList.push(formatcols[i]);
|
|
}
|
|
}
|
|
}
|
|
|
|
return formatList;
|
|
}
|
|
|
|
//生成colModel
|
|
function SetCols(datacols) {
|
|
var cols = new Array();
|
|
if (datacols != null && datacols.length > 0) {
|
|
for (var i = 0; i < datacols.length; i++) {
|
|
var ColCaption = datacols[i].ColCaption;
|
|
var ColFiledName = datacols[i].ColFiledName;
|
|
var DataType = datacols[i].DataType;
|
|
var DataTypeStr = GetDataTypeByNum(DataType);
|
|
var ColWidth = datacols[i].ColWidth;
|
|
var DeciamlNum = datacols[i].DeciamlNum;
|
|
var sortable = datacols[i].sortable;
|
|
var ColMerFlag = datacols[i].ColMerFlag;
|
|
var IsFormat = datacols[i].IsFormat;
|
|
var obj = new Array();
|
|
if (IsFormat == "1") {
|
|
obj = {
|
|
label: ColCaption,
|
|
name: ColFiledName,
|
|
width: ColWidth,
|
|
align: "left",
|
|
sortable: sortable,
|
|
cellattr: addCellAttr,
|
|
}
|
|
}
|
|
else {
|
|
obj = {
|
|
label: ColCaption,
|
|
name: ColFiledName,
|
|
width: ColWidth,
|
|
align: "left",
|
|
sortable: sortable,
|
|
cellattr: addCellAttr_ID,
|
|
}
|
|
}
|
|
|
|
switch (DataTypeStr) {
|
|
|
|
case "数值型":
|
|
var Formatoptions = new { decimalPlaces: DeciamlNum };
|
|
obj.push({ formatter: "number" });
|
|
obj.push({ formatoptions: Formatoptions });
|
|
|
|
break;
|
|
case "字符型":
|
|
case "日期型":
|
|
case "布尔值":
|
|
|
|
break;
|
|
|
|
}
|
|
//if (IsFormat) {
|
|
|
|
// obj.push({ cellattr: addCellAttr });
|
|
//}
|
|
|
|
|
|
|
|
cols.push(obj);
|
|
}
|
|
|
|
var collast = { label: "", name: "", width: "20", align: "left", sortable: false };
|
|
cols.push(collast);
|
|
}
|
|
return cols;
|
|
}
|
|
|
|
function gridList() {
|
|
document.getElementById("gridPanel").innerHTML = ' <table id="gridList"></table> <div id="gridPager"></div>';//重置grid
|
|
_formatcols_Row = new Array();
|
|
var $gridList = $("#gridList");
|
|
var condion = new Array();
|
|
if (_sqlTxt_Condition != undefined && _sqlTxt_Condition.length > 0) {
|
|
condion = _sqlTxt_Condition;
|
|
}
|
|
$gridList.dataGrid({
|
|
//url: "/SystemManage/CommonReport/GetGridJson",
|
|
url: "/SystemManage/CommonReport/GetGridJsonNew",
|
|
height: $(window).height() - 132,
|
|
// postData: { sqlTxt: _sqlTxt_AddCondition, DBName: _DBName, TempName: _TempName },
|
|
postData: { MenuID: _MenuID, sqlTxt_Condition: JSON.stringify(condion), DBName: _DBName, TempName: _TempName },
|
|
colModel: _Cols,
|
|
pager: "#gridPager",
|
|
//sortname: ' ',
|
|
//sortorder: ' ',
|
|
sortname: _XCol,
|
|
sortorder: ' ',
|
|
viewrecords: true,
|
|
multiselect: true,//开启选中行
|
|
footerrow: _footerrow,
|
|
gridComplete: function () {
|
|
var strIds = $("#gridList").jqGrid("getDataIDs");
|
|
|
|
|
|
if (_formatcols_Row.length > 0) {
|
|
for (var i = 0; i < _formatcols_Row.length; i++) {
|
|
$("#" + strIds[_formatcols_Row[i].rowid] + " td").css("background-color", _formatcols_Row[i].backgroundcolor);
|
|
}
|
|
}
|
|
//$("#"+ids[ii]+ " td").css("background-color","red");
|
|
|
|
//合并行
|
|
if (_Mergercols != undefined && _Mergercols.length > 0) {
|
|
for (var i = 0; i < _Mergercols.length; i++) {
|
|
Merger("gridList", _Mergercols[i]);
|
|
}
|
|
}
|
|
|
|
|
|
//合计
|
|
if (_footerrow == true) {
|
|
var footerData = {};
|
|
for (var i = 0; i < _footercols.length; i++) {
|
|
var total = 0;
|
|
|
|
for (var j = 0; j < strIds.length; j++) {
|
|
var qty = $("#gridList").jqGrid("getCell", strIds[j], _footercols[i]);
|
|
if (qty != "") {
|
|
total += parseInt(qty);
|
|
}
|
|
}
|
|
|
|
footerData[_footercols[i]] = total;
|
|
|
|
}
|
|
$("#gridList").footerData('set', footerData);
|
|
$("#gridList").footerData('set', { "rn": "合计" });
|
|
}
|
|
|
|
//隐藏列(不可见/无权限)
|
|
if (_HiddenCols != null && _HiddenCols.length > 0) {
|
|
for (var j = 0; j < _HiddenCols.length; j++) {
|
|
$("#gridList").setGridParam().hideCol(_HiddenCols[j].ColFiledName);
|
|
}
|
|
}
|
|
|
|
},
|
|
loadError: function (data) {
|
|
alert("异常:");
|
|
}
|
|
|
|
});
|
|
$("#btn_search").click(function () {
|
|
$gridList.jqGrid('setGridParam', {
|
|
//sqlTxt: _sqlTxt_AddCondition, DBName: _DBName, TempName: _TempName
|
|
MenuID: _MenuID, sqlTxt_Condition: JSON.stringify(condion), DBName: _DBName, TempName: _TempName
|
|
}).trigger('reloadGrid');
|
|
});
|
|
}
|
|
|
|
//过滤
|
|
function btn_Filter() {
|
|
$.modalOpen({
|
|
id: "Filer",
|
|
title: "过滤条件",
|
|
url: "/SystemManage/CommonReport/Filter?MenuID=" + _MenuID + "&SourceID=" + _SourceID + "&" + Math.random(),
|
|
width: "800px",
|
|
height: "570px",
|
|
btn: ['确认', '关闭'],
|
|
callBack: function (iframeId) {
|
|
_sqlTxt_Condition = eval(top.frames[iframeId].submitForm());
|
|
//_sqlTxt_AddCondition = _sqlTxt;
|
|
if (_sqlTxt_Condition != undefined) {
|
|
// if (_sqlTxt_Condition.length > 0) {
|
|
|
|
// for (var i = 0; i < _sqlTxt_Condition.length; i++) {
|
|
// _sqlTxt_AddCondition = ReplaceALL(_sqlTxt_AddCondition, _sqlTxt_Condition[i].CIndex, _sqlTxt_Condition[i].Content);
|
|
// }
|
|
|
|
// }
|
|
top.frames[iframeId].Close();
|
|
gridList();
|
|
}
|
|
}
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
//数据源
|
|
function btn_DataSource() {
|
|
$.modalOpen({
|
|
id: "DataSource",
|
|
title: "数据源",
|
|
url: "/SystemManage/CommonReport/DataSource?MenuID=" + _MenuID,//+ "&" + Math.random(),
|
|
width: "1300px",
|
|
height: "570px",
|
|
btn: ['确认', '关闭'],
|
|
callBack: function (iframeId) {
|
|
dataRR = top.frames[iframeId].submitForm();
|
|
if (dataRR == "Error")
|
|
{ }
|
|
else {
|
|
GetMenu();
|
|
}
|
|
}
|
|
});
|
|
|
|
|
|
}
|
|
|
|
//列设置
|
|
function btn_Cols() {
|
|
if (_IsExistsDataSource != "1") {
|
|
alert("请先设置数据源");
|
|
}
|
|
else {
|
|
$.modalOpen({
|
|
id: "Cols",
|
|
title: "列设置",
|
|
url: "/SystemManage/CommonReport/Cols?SourceID=" + _SourceID + "&MenuID=" + _MenuID + "&" + Math.random(),
|
|
width: "1300px",
|
|
height: "570px",
|
|
btn: ['确认', '关闭'],
|
|
callBack: function (iframeId) {
|
|
top.frames[iframeId].submitForm();
|
|
GetMenu();
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
//个性化设置
|
|
function btn_GridFormat() {
|
|
if (_IsExistsDataSource != "1") {
|
|
alert("请先设置数据源");
|
|
}
|
|
else {
|
|
$.modalOpen({
|
|
id: "GridFormat",
|
|
title: "个性化设置",
|
|
url: "/SystemManage/CommonReport/GridFormat?SourceID=" + _SourceID + "&" + Math.random(),
|
|
width: "800px",
|
|
height: "570px",
|
|
btn: null,
|
|
callBack: function (iframeId) {
|
|
|
|
GetMenu();
|
|
}
|
|
|
|
});
|
|
}
|
|
}
|
|
|
|
//多表头设置
|
|
function btn_GridHeader() {
|
|
if (_IsExistsDataSource != "1") {
|
|
alert("请先设置数据源");
|
|
}
|
|
else {
|
|
$.modalOpen({
|
|
id: "GridHeader",
|
|
title: "多表头设置",
|
|
url: "/SystemManage/CommonReport/GridHeader?SourceID=" + _SourceID + "&" + Math.random(),
|
|
width: "1300px",
|
|
height: "570px",
|
|
btn: ['确认', '关闭'],
|
|
callBack: function (iframeId) {
|
|
top.frames[iframeId].submitForm();
|
|
GetMenu();
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
//清空本菜单所有数据源相关设置
|
|
function btn_Clear() {
|
|
|
|
$.deleteForm({
|
|
url: "/SystemManage/CommonReport/ClearAll?" + Math.random(),
|
|
param: { MenuID: _MenuID },
|
|
success: function () {
|
|
_SourceID = "";//数据源ID
|
|
_sqlTxt = "";//加上参数的sql
|
|
_sqlTxt_AddCondition = "";//加上过滤条件的sql
|
|
_TempName = "";
|
|
_IsExistsDataSource = "";
|
|
_DBName = "";//s数据库
|
|
_Cols = new Array();//列
|
|
_Filter = "";
|
|
_footerrow = false;//是否有合计项
|
|
_footercols = new Array();//合计项
|
|
_formatcols = new Array();//个性化项
|
|
_formatcols_Row = new Array();//个性化项的行
|
|
_Mergercols = new Array();//合并项
|
|
document.getElementById("gridPanel").innerHTML = ' <table id="gridList"></table> <div id="gridPager"></div>';
|
|
},
|
|
error: function (aa) {
|
|
alert("异常", aa.responseText);
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
|
|
function btn_ExportAll() {
|
|
var condion = new Array();
|
|
if (_sqlTxt_Condition != undefined && _sqlTxt_Condition.length > 0) {
|
|
condion = _sqlTxt_Condition;
|
|
}
|
|
//var data = "&sqlTxt=" + encodeURIComponent(_sqlTxt_AddCondition) + "&DBName=" + _DBName + "&TempName=" + _TempName + "&MenuID=" + _MenuID;
|
|
var data = "&sqlTxt=" + encodeURIComponent(JSON.stringify(condion)) + "&DBName=" + _DBName + "&TempName=" + _TempName + "&MenuID=" + _MenuID;
|
|
$.download("/SystemManage/CommonReport/ExportAllNew?" + Math.random(), data, 'post');
|
|
}
|
|
|
|
|
|
function btn_WatchPanel() {
|
|
var condion = new Array();
|
|
if (_sqlTxt_Condition != undefined && _sqlTxt_Condition.length > 0) {
|
|
condion = _sqlTxt_Condition;
|
|
}
|
|
$.modalOpen({
|
|
id: "WatchPanel",
|
|
title: _ReportName + "看板显示",
|
|
url: "/SystemManage/CommonReport/WatchPanel?_MenuID=" + _MenuID + "&_sqlTxt_Condition=" + escape(JSON.stringify(condion)) + "&TempName=" + escape(_TempName) + "&" + Math.random(),
|
|
width: "1300px",
|
|
height: "570px",
|
|
btn: null,
|
|
callBack: function (iframeId) {
|
|
top.frames[iframeId].submitForm();
|
|
GetMenu();
|
|
}
|
|
});
|
|
}
|
|
|
|
//角色显示栏位
|
|
function btn_ColsVisible() {
|
|
$.modalOpen({
|
|
id: "ColsVisible",
|
|
title: _ReportName + " 角色显示栏位",
|
|
url: "/SystemManage/CommonReport/ColsVisible?MenuID=" + _MenuID + "&IsCommon=Y&Cols=&" + Math.random(),
|
|
width: "1000px",
|
|
height: "570px",
|
|
btn: null,
|
|
callBack: function (iframeId) {
|
|
alert("111");
|
|
GetMenu();
|
|
}
|
|
});
|
|
}
|
|
//新增类型
|
|
function btn_Create() {
|
|
debugger;
|
|
$.modalOpen({
|
|
id: "ICSConfigurationAdd",
|
|
title: "新增容器",
|
|
url: "/WMS/BasicSettings/ICSContainerAdd" + "?" + Math.random(),
|
|
width: "500px",
|
|
height: "400px",
|
|
callBack: function (iframeId) {
|
|
top.frames[iframeId].submitForm();
|
|
}
|
|
});
|
|
|
|
}
|
|
//删除库位
|
|
function btn_Delete() {
|
|
debugger;
|
|
var objArr = '';
|
|
var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
|
|
for (var i = 0; i < objList.length; i++) {
|
|
var rowId = objList[i];
|
|
var rowData = $("#gridList").jqGrid('getRowData', rowId);
|
|
objArr += "'" + rowData.ID + "',";
|
|
}
|
|
if (objArr == '') {
|
|
$.modalAlert("请选择需要删除的包装!");
|
|
return;
|
|
}
|
|
debugger;
|
|
$.deleteForm({
|
|
url: "/WMS/BasicSettings/DeleteICSContainer" + "?" + Math.random(),
|
|
param: { keyValue: JSON.stringify(objArr) },
|
|
success: function () {
|
|
$.currentWindow().$("#gridList").trigger("reloadGrid");
|
|
}
|
|
})
|
|
}
|
|
//修改类型
|
|
function btn_Update() {
|
|
debugger;
|
|
var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
|
|
if (ids.length != 1) {
|
|
$.modalAlert("请选择一行数据进行修改!");
|
|
return;
|
|
}
|
|
for (var i in ids) {
|
|
var rowData = jQuery("#gridList").jqGrid("getRowData", ids[i]);
|
|
//ID
|
|
var ID = rowData.ID;
|
|
var ContainerID = rowData.ContainerID;
|
|
var ContainerCODE = rowData.ContainerCODE;
|
|
var ContainerName = rowData.ContainerName;
|
|
var Memo = rowData.Memo;
|
|
$.modalOpen({
|
|
id: "Details",
|
|
title: "修改",
|
|
url: "/WMS/BasicSettings/ICSContainerAdd?ID=" + ID + "&ContainerID=" + ContainerID + "&ContainerCODE=" + ContainerCODE + "&ContainerName=" + ContainerName + "&Memo=" + Memo + "&" + Math.random(),
|
|
width: "500px",
|
|
height: "400px",
|
|
callBack: function (iframeId) {
|
|
top.frames[iframeId].submitForm();
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
//打印库位
|
|
function btn_Print() {
|
|
debugger;
|
|
var objArr = '';
|
|
var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
|
|
//if (objList.length != 1) {
|
|
// $.modalAlert("一次只能打印一个送货单!");
|
|
// return;
|
|
//}
|
|
for (var i = 0; i < objList.length; i++) {
|
|
var rowId = objList[i];
|
|
var rowData = $("#gridList").jqGrid('getRowData', rowId);
|
|
objArr += "'" + rowData.ID + "',";
|
|
}
|
|
var strPrintData;
|
|
var bIsInstallPrintControl;
|
|
var strPrintControlCookie;
|
|
$.ajax({
|
|
url: "/WMS/BasicSettings/PrintStack",
|
|
type: "post",
|
|
data: { keyValue: JSON.stringify(objArr) },
|
|
dataType: "json",
|
|
async: false,
|
|
success: function (data) {
|
|
strPrintData = data.strPrintData_1;
|
|
bIsInstallPrintControl = data.bIsInstallPrintControl_1;
|
|
strPrintControlCookie = data.strPrintControlCookie_1;
|
|
}
|
|
});
|
|
if (strPrintData != '') {
|
|
var test = "ChuLinPrint:" + strPrintData;
|
|
$("#ifrm")[0].src = "ChuLinPrint:" + strPrintData;
|
|
}
|
|
if (bIsInstallPrintControl == 'False') {
|
|
if (confirm("检测到打印控件未安装,您是否下载安装?")) {
|
|
$("#downPrintControl").click();
|
|
}
|
|
}
|
|
if (bIsInstallPrintControl == 'True') {
|
|
var strPrintControlCookie = strPrintControlCookie;
|
|
if (strPrintControlCookie != '') { //延时3秒后再次检测打印控件是否安装
|
|
setTimeout("checkPrintControlInstall()", 8000);
|
|
function checkPrintControlInstall() {
|
|
$.ajax({
|
|
url: "/SRM/ASNManage/IsCheckInstall?checkInstall=" + strPrintControlCookie,
|
|
dataType: "json",
|
|
async: false,
|
|
success: function (strResult) {
|
|
if (strResult.indexOf("PrintControlInstall") == -1) {
|
|
if (confirm("检测到打印控件未安装,您是否下载安装?")) {
|
|
$("#downPrintControl").click();
|
|
}
|
|
}
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}
|
|
$("#btn_search").click();
|
|
}
|
|
//导入
|
|
function btn_Introduction() {
|
|
debugger;
|
|
$("#FileUp").click();
|
|
}
|
|
function btn_Clike() {
|
|
$.ClickOperate();
|
|
}
|
|
function UpLoadFile(fileinfo) { //点击确定按钮的时候
|
|
debugger;
|
|
var files = fileinfo.files;
|
|
var fileURL = fileinfo.value;
|
|
var fileName = files[0].name;
|
|
if (fileName != null && fileName != "") {
|
|
var data = new FormData();
|
|
jQuery.each(jQuery('#FileUp')[0].files, function (i, file) {
|
|
data.append('file-' + i, file);
|
|
});
|
|
//var info = document.getElementById("form1");
|
|
//var formData = new FormData(info);
|
|
$.modalConfirm("确定上传文件吗?", function (r) {
|
|
if (r) {
|
|
$.ajax({
|
|
url: "/WMS/BasicSettings/Import" + "?" + Math.random() + "&fileURL=" + fileURL + "",
|
|
type: "post",
|
|
data: "",
|
|
contentType: false,
|
|
processData: false,
|
|
success: function (data) {
|
|
if (data != "" && data != "获取文件失败" && data != "上传文件失败") {
|
|
$.modalAlert("上传成功");
|
|
$.currentWindow().$("#gridList").trigger("reloadGrid");
|
|
}
|
|
else {
|
|
$.modalAlert("异常:" + data);
|
|
}
|
|
},
|
|
error: function (aa) {
|
|
$.modalAlert("上传失败:" + aa);
|
|
}
|
|
});
|
|
}
|
|
});
|
|
|
|
}
|
|
}
|
|
|
|
function btn_Tolead() {
|
|
$.modalOpen({
|
|
id: "Upload",
|
|
title: "期初导入",
|
|
url: "/WMS/HomeWork/InitialImportUpLoad?" + Math.random(),
|
|
width: "400px",
|
|
height: "225px",
|
|
btn: null,
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
</script>
|
|
<iframe id="ifrm" src="" width="0" height="0"></iframe>
|
|
<div class="topPanel">
|
|
<div class="toolbar">
|
|
<div class="btn-group">
|
|
<a class="btn btn-primary" style="margin-left:3px;" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
|
|
<a id="NF-Tolead" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_Tolead()"><i class="fa fa-pencil-square-o"></i>导入</a>
|
|
<a id="NF-Create" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_Create()"><i class="fa fa-pencil-square-o"></i>新增</a>
|
|
<a id="NF-Delete" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_Delete()"><i class="fa fa-pencil-square-o"></i>删除</a>
|
|
<a id="NF-Update" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_Update()"><i class="fa fa-pencil-square-o"></i>修改</a>
|
|
<a id="NF-ExportAll" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_ExportAll()"><i class="fa fa-download"></i>全部导出</a>
|
|
<a id="NF-Print" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_Print()"><i class="fa fa-print"></i>打印</a>
|
|
<a href="~/File/Stack/库位资料导入模板.xlsx" id="NF-IntroductionMould" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_IntroductionMould()"><i class="fa fa-file-excel-o"></i>导入模板下载</a>
|
|
<a id="NF-Introduction" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_Introduction()">导入</a>
|
|
<a id="NF-Clike" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_Clike()"><i class="fa fa-eject"></i>...</a>
|
|
|
|
</div>
|
|
<div class="operates">
|
|
<ul class="nav nav-pills">
|
|
|
|
<li><a class="btn btn-primary dropdown-text" onclick="btn_Filter()"><i class="fa fa-filter"></i>过滤</a></li>
|
|
<li><a id="NF-DataSource" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_DataSource()"><i class="fa fa-database"></i>设置数据源</a></li>
|
|
<li><a id="NF-Cols" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_Cols()"><i class="fa fa-text-width"></i>列设置</a></li>
|
|
<li class="split"></li>
|
|
<li><a id="NF-GridFormat" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_GridFormat()"><i class="fa fa-bars"></i>个性化设置</a></li>
|
|
<li class="split"></li>
|
|
<li><a id="NF-Clear" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_Clear()"><i class="fa fa-times"></i>清空本菜单所有设置</a></li>
|
|
<li><a id="NF-WatchPanel" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_WatchPanel()"><i class="fa fa-download"></i>看板显示</a></li>
|
|
<li><a id="NF-ColsVisible" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_ColsVisible()"><i class="fa fa-user"></i>角色显示栏位</a></li>
|
|
</ul>
|
|
<a href="javascript:;" class="close"></a>
|
|
</div>
|
|
<script>$('.toolbar').authorizeButton()</script>
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
<div class="gridPanel" id="gridPanel">
|
|
<table id="gridList"></table>
|
|
<div id="gridPager"></div>
|
|
</div>
|
|
|