天津投入产出系统后端
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.
 
 
 
 
 
 

337 lines
12 KiB

<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/AppMaster.Master"
Inherits="System.Web.Mvc.ViewPage<QMAPP.MESReport.Web.Models.LineQTY.LineQtyConditionModel>" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
班次对比分析
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<%=Html.QPSeach(80,true) %>
<table id="condiTable">
<tr>
<th align="right">
<%=Html.QV(p => p.WORKCENTER_CODE)%>
</th>
<td>
<%=Html.QC(p => p.WORKCENTER_CODE)%>
<script type="text/javascript" language="javascript">
$(function () {
$("#WORKCENTER_CODE").combobox({ onSelect: function (rec) {
var url = '/Dict/GetMachine?workcenter=' + rec.id;
$('#EQUIPMENT_CODE').combobox('reload', url);
}
});
});
$(function () {
$('#EQUIPMENT_CODE').combobox({
panelWidth: '200'
});
});
</script>
</td>
<th align="right">
<%=Html.QV(p => p.EQUIPMENT_CODE)%>
</th>
<td>
<%=Html.QC(p => p.EQUIPMENT_CODE)%>
</td>
<th align="right">
<%=Html.QV(p => p.SHIFT_CODE)%>
</th>
<td>
<%=Html.QC(p => p.SHIFT_CODE)%>
</td>
<th align="right">
日期
</th>
<td>
<%=Html.QC(p => p.START_DATE)%>
</td>
<th align="right">
</th>
<td>
<%=Html.QC(p => p.END_DATE)%>
</td>
</tr>
</table>
<%=Html.QPEnd()%>
<%=Html.QPList() %>
<%--<%=Html.QDateGrid<QMAPP.MESReport.Web.Models.LineQTY.LineDWQTYModel>(Model)%>--%>
<!--图表配置-->
<%=QMAPP.Common.Web.AppConfig.QMEChartPageConfig()%>
<div style="overflow: auto; height: 99%;">
<div style="width: 100%; text-align: center;">
<%--异步获取数据生成图表--%>
<%=QMFrameWork.WebUI.QMEChart.QMEChartHelper.CreateEchart("echartID", "/LineShiftQTYCount/GetEchartDataLine1", new string[] { "line", "bar" }
, "myEChart")%>
<table id="maintb" class="mtbtt" style="width:90%; margin:0px auto;">
</table>
</div>
</div>
<%--皮肤切换下拉列表--%>
<%--<%=QMFrameWork.WebUI.QMEChart.QMEChartHelper.CreateStyleSelector("themeselectline1", "myEChart")%>--%>
<%--刷新按钮--%>
<%--<%=QMFrameWork.WebUI.QMEChart.QMEChartHelper.CreateRefresh("refreshEChartline1", "myEChart")%>--%>
<%-- 自定义刷新方法 --%>
<script type="text/javascript">
function GetTable() {
$.ajax({
type: "POST",
url: "/LineShiftQTYCount/GetTableTrend?WORKCENTER_CODE=" + $("input[name='WORKCENTER_CODE']").val() + "&EQUIPMENT_CODE=" + $("input[name='EQUIPMENT_CODE']").val() + "&SHIFT_CODE=" + $("input[name='SHIFT_CODE']").val() + "&START_DATE=" + $("input[name='START_DATE']").val() + "&END_DATE=" + $("input[name='END_DATE']").val(),
dataType: "json",
data: {},
success: function (data) {
$("#maintb").html(data);
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
//alert(errorThrown);
}
});
}
$(function () { refreshEChartline1(); });
function refreshEChartline1() {
//alert(END_DATE.value);
//debugger;
if ($("#START_DATE").val() == "" || $("#END_DATE").val() == "") {
alert("请选择时间范围!");
return;
}
var endtime = document.getElementById("END_DATE").value;
if (parseDate($("#START_DATE").val()) > parseDate($("#END_DATE").val()) && endtime != "") {
alert("开始时间不能大于结束时间!");
return;
}
var ps = [];
var WORKCENTER_CODE = {};
WORKCENTER_CODE.key = "WORKCENTER_CODE";
WORKCENTER_CODE.value = $("input[name='WORKCENTER_CODE']").val();
ps.push(WORKCENTER_CODE);
var EQUIPMENT_CODE = {};
EQUIPMENT_CODE.key = "EQUIPMENT_CODE";
EQUIPMENT_CODE.value = $("input[name='EQUIPMENT_CODE']").val();
ps.push(EQUIPMENT_CODE);
var SHIFT_CODE = {};
SHIFT_CODE.key = "SHIFT_CODE";
SHIFT_CODE.value = $("input[name='SHIFT_CODE']").val();
ps.push(SHIFT_CODE);
var START_DATE = {};
START_DATE.key = "START_DATE";
START_DATE.value = $("input[name='START_DATE']").val();
ps.push(START_DATE);
var END_DATE = {};
END_DATE.key = "END_DATE";
END_DATE.value = $("input[name='END_DATE']").val();
ps.push(END_DATE);
//先隐藏然后延迟处理
document.getElementById("echartID").style.display = 'none';
GetEchartData("/LineShiftQTYCount/GetEchartDataLine1", myEChart, ps);
GetTable();
setTimeout("ConfigxAxisLable(myEChart)", 500);
}
//点击事件
function clickLine1Function(clickData) {
alert("点击的数据序列化后字符串:" + JSON.stringify(clickData));
}
//导出
// function Export() {
// var img = myEChart.getDataURL("png");
// $("#hiChartImg").val(img);
// submitByButton("ExportBanCi");
// }
//导出Excel
function Export() {
var ids = document.getElementById("selectKey").value;
$.get("/LineShiftQTYCount/ExportExcel?Trend=0", $("form").serializeArray(), function (data) {
submitByButton("/LineShiftQTYCount/ExportFile?Trend=0&FileName=" + data);
});
}
</script>
<input id="Button1" type="button" style=" display:none" onclick="Export();" value="导出" />
<input id="hiChartImg" name="hiChartImg" type="hidden" />
<script type="text/javascript" language="javascript">
//长文本配置
var longtextoption = {
grid: {
y2: 80
},
xAxis: [{
type: 'category',
axisLabel: {
interval: 0,
rotate: 30,
textStyle: {
fontSize: 14
}
}
}]
};
//竖文本配置
var vtextoption = {
grid: {
y2: 80
},
xAxis: [{
type: 'category',
axisLabel: {
formatter: function (value) { return value.split("").join("\n") },
interval: 0,
rotate: 0,
textStyle: {
fontSize: 12
}
}
}]
};
var normaltextoption = {
grid: {
y2: 80
},
xAxis: [{
type: 'category',
axisLabel: {
interval: 0,
rotate: 0
}
}]
};
//加载图表数据
function LoadChartData(chartObj, url) {
//debugger;
$.ajax({
type: 'POST',
url: url,
dataType: 'html',
success: function (data) {
eval("var dataStr=" + data + ";");
chartObj.hideLoading();
chartObj.clear();
chartObj.setOption(dataStr);
},
error: function (err) {
_closeProgress();
}
});
}
//设置X轴标签
function ConfigxAxisLable(chartObj) {
//x轴标签高度的系数
var lengthHight = 12;
var option = chartObj.getOption();
var cwidth = $(chartObj.getDom()).width();
//预防data为空,预先赋值。
var oxdLength = 12;
if (option.xAxis[0].data != undefined) {
oxdLength = option.xAxis[0].data.length;
}
var citemwidth = cwidth / oxdLength;
var maxlabelwidth = 0;
for (var i = 0; i < oxdLength; i++) {
//debugger;
if (option.xAxis[0].data !== undefined) {
if (option.xAxis[0].data[i].length * lengthHight > maxlabelwidth) {
maxlabelwidth = option.xAxis[0].data[i].length * lengthHight;
}
}
}
if (citemwidth <= 35) {
vtextoption.grid.y2 = maxlabelwidth + 10;
chartObj.setOption(vtextoption);
}
else if (maxlabelwidth > citemwidth) {
longtextoption.grid.y2 = maxlabelwidth / 2 + 25;
chartObj.setOption(longtextoption);
}
document.getElementById("echartID").style.display = 'block';
}
// $(function () {
// LoadChartData(myEChart, "/LineShiftQTYCount/GetEchartDataLine1");
// });
var labelformatter = function (value) {
//debugger
var ret = ""; //拼接加\n返回的类目项
var maxLength = 1; //每项显示文字个数
var valLength = value.length; //X轴类目项的文字个数
var rowN = Math.ceil(valLength / maxLength); //类目项需要换行的行数
if (rowN > 1)//如果类目项的文字大于3,
{
for (var i = 0; i < rowN; i++) {
var temp = ""; //每次截取的字符串
var start = i * maxLength; //开始截取的位置
var end = start + maxLength; //结束截取的位置
//这里也可以加一个是否是最后一行的判断,但是不加也没有影响,那就不加吧
temp = value.substring(start, end) + "\n";
ret += temp; //凭借最终的字符串
}
return ret;
}
else {
return value;
}
}
</script>
<%=Html.QPEnd() %>
<%=Html.Hidden("selectKey")%>
<%=Html.Hidden("PID")%>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ToolContent" runat="server">
<style type="text/css">
.mtbtt
{
border-collapse:collapse;
}
.mtbtt tr td
{
border: 1px solid grey;
}
.L1cos
{
width:160px;
}
</style>
<table cellpadding="0" cellspacing="0">
<tr>
<td align="center">
<%=Html.QTButtonSearch("LineShiftQTYCount", "GetTrendData", "refreshEChartline1()", QMAPP.Common.Web.SystemLimit.isLimt)%>
<%=Html.QTButton("export", "ExportExcel", QMFrameWork.WebUI.IconCls.redo, "Export()", QMAPP.Common.Web.SystemLimit.isLimt)%>
</td>
</tr>
</table>
</asp:Content>