tmp
This commit is contained in:
313
ShowTrend_tmp3/ShowTrend3/wwwroot/js/AnalogChart.js
Normal file
313
ShowTrend_tmp3/ShowTrend3/wwwroot/js/AnalogChart.js
Normal file
@@ -0,0 +1,313 @@
|
||||
class AnalogChart {
|
||||
constructor(vdp, tstart, tend) {
|
||||
function ValueDateFormatter(e) {
|
||||
var hours = 1000 * 60 * 60;
|
||||
if (e.trigger === "reset") {
|
||||
e.chart.options.axisX.valueFormatString = "MM.DD HH";
|
||||
}
|
||||
else if (e.trigger === "zoom") {
|
||||
//Hour (Comparing Hours)
|
||||
if ((((e.axisX[0].viewportMaximum - e.axisX[0].viewportMinimum) / (hours)) < 24)) {
|
||||
e.chart.options.axisX.valueFormatString = "HH:mm:ss";
|
||||
}
|
||||
//Day (Comparing Days)
|
||||
else if (((e.axisX.viewportMaximum - e.axisX.viewportMinimum) / (hours)) < 48) {
|
||||
e.chart.options.axisX.valueFormatString = "HH:mm";
|
||||
}
|
||||
//Year (Comparing Years)
|
||||
else if (((e.axisX[0].viewportMaximum - e.axisX[0].viewportMinimum) / (hours * 24)) < 2) {
|
||||
e.chart.options.axisX.valueFormatString = "MM.DD HH";
|
||||
}
|
||||
else {
|
||||
e.chart.options.axisX.valueFormatString = "MM.DD";
|
||||
}
|
||||
}
|
||||
}
|
||||
this._vdp = vdp;
|
||||
this._tstart = tstart;
|
||||
this._tend = tend;
|
||||
this._chart_global = $("#AnalogChart_Global");
|
||||
this._chart_checkbox = $("#AnalogChart_Checkbox");
|
||||
this._chart_label = $("#AnalogChart_label");
|
||||
this._chart_buttonUpdate = $("#AnalogChart_Update");
|
||||
var self = this;
|
||||
this._chart_buttonUpdate.unbind("click");
|
||||
this._chart_buttonUpdate.click(function () {
|
||||
self.Update();
|
||||
});
|
||||
this._chart_conteiner = $("#AnalogChart");
|
||||
this._data = [];
|
||||
this._axisYList = [
|
||||
{
|
||||
labelFontSize: 12, labelAngle: -90,
|
||||
margin: 1, tickLength: 3, tickThickness: 1, lineThickness: 1, gridThickness: 0.1,
|
||||
suffix: "кА", logarithmic: false
|
||||
},
|
||||
{
|
||||
labelFontSize: 12, labelAngle: -90,
|
||||
margin: 1, tickLength: 3, tickThickness: 1, lineThickness: 1, gridThickness: 0.1,
|
||||
suffix: "кПа", logarithmic: false
|
||||
},
|
||||
{
|
||||
labelFontSize: 12, labelAngle: -90,
|
||||
margin: 1, tickLength: 3, tickThickness: 1, lineThickness: 1, gridThickness: 0.1,
|
||||
suffix: "А", logarithmic: false
|
||||
},
|
||||
{
|
||||
labelFontSize: 12, labelAngle: -90,
|
||||
margin: 1, tickLength: 3, tickThickness: 1, lineThickness: 1, gridThickness: 0.1,
|
||||
suffix: "В", logarithmic: false
|
||||
},
|
||||
{
|
||||
labelFontSize: 12, labelAngle: -90,
|
||||
margin: 1, tickLength: 3, tickThickness: 1, lineThickness: 1, gridThickness: 0.1,
|
||||
suffix: "гр.С", logarithmic: false
|
||||
},
|
||||
{
|
||||
labelFontSize: 12, labelAngle: -90,
|
||||
margin: 1, tickLength: 3, tickThickness: 1, lineThickness: 1, gridThickness: 0.1,
|
||||
suffix: "гр", logarithmic: false
|
||||
},
|
||||
{
|
||||
labelFontSize: 12, labelAngle: -90,
|
||||
margin: 1, tickLength: 3, tickThickness: 1, lineThickness: 1, gridThickness: 0.1,
|
||||
suffix: "мм", logarithmic: false
|
||||
},
|
||||
{
|
||||
labelFontSize: 12, labelAngle: -90,
|
||||
margin: 1, tickLength: 3, tickThickness: 1, lineThickness: 1, gridThickness: 0.1,
|
||||
suffix: "мкм.рт.с", logarithmic: true
|
||||
},
|
||||
{
|
||||
labelFontSize: 12, labelAngle: -90,
|
||||
margin: 1, tickLength: 3, tickThickness: 1, lineThickness: 1, gridThickness: 0.1,
|
||||
suffix: "м^3/ч", logarithmic: false
|
||||
},
|
||||
{
|
||||
labelFontSize: 12, labelAngle: -80,
|
||||
margin: 1, tickLength: 3, tickThickness: 1, lineThickness: 1, gridThickness: 0.1,
|
||||
suffix: "кгс/см^2", logarithmic: false
|
||||
}
|
||||
];
|
||||
|
||||
this._chart = new CanvasJS.Chart("AnalogChart", {
|
||||
toolTip: {
|
||||
fontSize: 12,
|
||||
shared: true,
|
||||
contentFormatter: function (e) {
|
||||
var str = "";
|
||||
if (e.entries.length < 1)
|
||||
return str;
|
||||
var lastdate = e.entries[0].dataPoint.x;
|
||||
var data = e.chart._dataInRenderedOrder;
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var y = null;
|
||||
|
||||
for (var j = 0; j < data[i].dataPoints.length; j++) {
|
||||
var t = data[i].dataPoints[j].x - lastdate;
|
||||
if (t <= 0)
|
||||
y = data[i].dataPoints[j].y;
|
||||
else
|
||||
break;
|
||||
t = data[i].dataPoints[(data[i].dataPoints.length - 1) - j].x - lastdate;
|
||||
if (t <= 0) {
|
||||
y = data[i].dataPoints[(data[i].dataPoints.length - 1) - j].y;
|
||||
break;
|
||||
}
|
||||
}
|
||||
var temp =
|
||||
data[i].name + ': <strong style="color:' +
|
||||
data[i].color + ';">' +
|
||||
y + ' </strong>' + data[i].axisY.suffix + "<br/>";
|
||||
str = str.concat(temp);
|
||||
}
|
||||
return (str);
|
||||
}
|
||||
},
|
||||
animationEnabled: true,
|
||||
animationDuration: 1000,
|
||||
exportFileName: "Analog Signals",
|
||||
exportEnabled: true,
|
||||
zoomEnabled: true,
|
||||
theme: "light1",
|
||||
backgroundColor: "#FFFFFF",
|
||||
colorSet: "colorSet1",
|
||||
culture: "ru",
|
||||
title: {},
|
||||
legend: {},
|
||||
|
||||
rangeChanging: ValueDateFormatter,
|
||||
axisX: {
|
||||
labelFontSize: 12,
|
||||
margin: 1,
|
||||
tickLength: 3,
|
||||
tickThickness: 1,
|
||||
lineThickness: 1,
|
||||
gridThickness: 0.3,
|
||||
valueFormatString: "MM.DD HH"
|
||||
},
|
||||
axisY: [
|
||||
{
|
||||
labelFontSize: 12, labelAngle: -90,
|
||||
margin: 1, tickLength: 3, tickThickness: 1, lineThickness: 1, gridThickness: 0.1,
|
||||
suffix: "", logarithmic: false
|
||||
}
|
||||
],
|
||||
data: []
|
||||
});
|
||||
var self = this;
|
||||
}
|
||||
|
||||
LoadData() {
|
||||
this.Clear();
|
||||
$("#AnalogChart_Load_Element").show();
|
||||
var self = this;
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: 'http://' + document.URL.split("/")[2] + '/api/listanalog',
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
data: JSON.stringify({
|
||||
"vdp": self._vdp
|
||||
}),
|
||||
success: function (date) {
|
||||
self.AddList(date);
|
||||
self.Update();
|
||||
self.Show();
|
||||
},
|
||||
complete: function () {
|
||||
$("#AnalogChart_Load_Element").hide();
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
AddList(d) {
|
||||
if (d == undefined || d.length <= 0)
|
||||
return;
|
||||
for (var i = 0; i < d.length; i++) {
|
||||
var data = {
|
||||
type: "line",
|
||||
markerType: "none",
|
||||
name: d[i].sn == undefined ? "" : d[i].sn,
|
||||
suffix: d[i].s,
|
||||
axisYIndex: 0,
|
||||
}
|
||||
this._data.push(data);
|
||||
|
||||
var vischk = d[i].v ? 'checked' : '';
|
||||
this._chart_checkbox.append('<label class="form-check-label">' +
|
||||
'<input type = "checkbox" class= "form-check-input"' + vischk + '>' +
|
||||
d[i].fn + '</label><br />');
|
||||
}
|
||||
}
|
||||
|
||||
Update() {
|
||||
this._chart_buttonUpdate.attr('disabled', true);
|
||||
while (this._chart.options.axisY.length > 1)
|
||||
this._chart.options.axisY.pop();
|
||||
while (this._chart.options.data.length > 0)
|
||||
this._chart.options.data.pop();
|
||||
var chkList = this._chart_checkbox.find('input');
|
||||
var sendmass = [];
|
||||
for (var i = 0; i < chkList.length; i++) {
|
||||
if (chkList[i].checked)
|
||||
sendmass.push(i);
|
||||
}
|
||||
var self = this;
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: 'http://' + document.URL.split("/")[2] + '/api/analog',
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
data: JSON.stringify({
|
||||
"vdp": self._vdp,
|
||||
"timeStart": self._tstart,
|
||||
"timeEnd": self._tend,
|
||||
"signals": sendmass
|
||||
}),
|
||||
success: function (date) {
|
||||
for (var i = 0; i < date.length; i++) {
|
||||
date[i] = self.Hunpack(date[i]);
|
||||
}
|
||||
var caret = 0;
|
||||
var chkList = self._chart_checkbox.find('input');
|
||||
for (var i = 0; i < chkList.length; i++) {
|
||||
if (!chkList[i].checked)
|
||||
continue;
|
||||
|
||||
var d = self._data[i];
|
||||
d.dataPoints = [];
|
||||
for (var j = 0; j < date[caret].length; j++)
|
||||
d.dataPoints.push({
|
||||
x: new Date(date[caret][j].x),
|
||||
y: date[caret][j].y
|
||||
});
|
||||
caret++;
|
||||
|
||||
var idx = -1;
|
||||
for (var j = 0; j < self._chart.options.axisY.length; j++)
|
||||
if (self._chart.options.axisY[j].suffix == d.suffix)
|
||||
idx = j;
|
||||
if (idx != -1) {
|
||||
d.axisYIndex = idx;
|
||||
self._chart.options.data.push(d);
|
||||
continue;
|
||||
}
|
||||
|
||||
for (var j = 0; j < self._axisYList.length; j++) {
|
||||
if (self._axisYList[j].suffix == d.suffix)
|
||||
idx = j;
|
||||
}
|
||||
if (idx != -1) {
|
||||
self._chart.options.axisY.push(self._axisYList[idx]);
|
||||
d.axisYIndex = self._chart.options.axisY.length - 1;
|
||||
self._chart.options.data.push(d);
|
||||
continue;
|
||||
}
|
||||
d.axisYIndex = 0;
|
||||
self._chart.options.data.push(d);
|
||||
}
|
||||
self._chart.render();
|
||||
},
|
||||
complete: function () {
|
||||
self._chart_buttonUpdate.removeAttr('disabled');
|
||||
//$("#AnalogChart_Load_Element").hide();
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Show() {
|
||||
//this.Update();
|
||||
this._chart_global.removeAttr('hidden');
|
||||
this._chart_label.removeAttr('hidden');
|
||||
this._chart.render();
|
||||
}
|
||||
|
||||
Clear() {
|
||||
this._data = [];
|
||||
this._chart_global.attr('hidden', true);
|
||||
this._chart_label.attr('hidden', true);
|
||||
this._chart_checkbox.empty();
|
||||
this._chart.options.data = [];
|
||||
}
|
||||
|
||||
Hunpack(hlist) {
|
||||
for (var
|
||||
length = hlist.length,
|
||||
klength = hlist[0],
|
||||
result = Array(((length - klength - 1) / klength) || 0),
|
||||
i = 1 + klength,
|
||||
j = 0,
|
||||
ki, o;
|
||||
i < length;
|
||||
) {
|
||||
for (
|
||||
result[j++] = (o = {}), ki = 0;
|
||||
ki < klength;
|
||||
o[hlist[++ki]] = hlist[i++]
|
||||
);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
272
ShowTrend_tmp3/ShowTrend3/wwwroot/js/Pasport.js
Normal file
272
ShowTrend_tmp3/ShowTrend3/wwwroot/js/Pasport.js
Normal file
@@ -0,0 +1,272 @@
|
||||
class Pasport {
|
||||
constructor() {
|
||||
//html Elements
|
||||
this._ajax;
|
||||
this._pasp_lable = $('#Pasport_Lable');
|
||||
this._pasp_date = $('#Pasport_Date');
|
||||
this._pasp_info = $('#Pasport_Info');
|
||||
this._pasp_button = $('#Pasport_button_LoadAll');
|
||||
|
||||
|
||||
//private Elements
|
||||
this._server_dir = "";
|
||||
|
||||
|
||||
//public Elements
|
||||
this.have_date = false;
|
||||
this.have_pasport = false;
|
||||
this.time_start = "";
|
||||
this.time_end = "";
|
||||
this.num_vdp = -1;
|
||||
this.num_plav = "";
|
||||
this.splav = "";
|
||||
this.is = "";
|
||||
this.pereplav = -1;
|
||||
this.naznachenie = "";
|
||||
this.kategory = "";
|
||||
this.zakaz = "";
|
||||
this.ves_slit = -1;
|
||||
this.kompl = -1;
|
||||
this.diam_krist = -1;
|
||||
this.diam_electr = -1;
|
||||
this.num_kontract = "";
|
||||
this.ukazanie = "";
|
||||
this.kod_npl = "";
|
||||
this.rm = "";
|
||||
this.notd = -1;
|
||||
this.tin = "";
|
||||
this.dzap = "";
|
||||
this.dlog = -1;
|
||||
this.last = -1;
|
||||
this.dlper = -1;
|
||||
this.izl = -1;
|
||||
this.robm = -1;
|
||||
this.rizol = 6;
|
||||
this.pos = -1;
|
||||
this.pril = 1;
|
||||
}
|
||||
|
||||
Download(dir) {
|
||||
if (dir == this._server_dir)
|
||||
return;
|
||||
var self = this;
|
||||
this._server_dir = dir;
|
||||
this.num_vdp = this._ParseDirToNumVDP(dir);
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: 'http://' + document.URL.split("/")[2] + '/api/pasport',
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
|
||||
data: JSON.stringify({ "pasport": this._server_dir }),
|
||||
|
||||
beforeSend: function (jqXHR, settings) {
|
||||
self._pasp_button.attr('hidden', true);
|
||||
},
|
||||
success: function (date) {
|
||||
self.have_date = date.have_date;
|
||||
self.have_pasport = date.have_pasport;
|
||||
self.time_start = date.time_start;
|
||||
self.time_end = date.time_end;
|
||||
if (!self.have_pasport)
|
||||
return;
|
||||
self.num_plav = date.num_plav;
|
||||
self.splav = date.splav;
|
||||
self.is = date.is;
|
||||
self.pereplav = date.pereplav;
|
||||
self.naznachenie = date.naznachenie;
|
||||
self.kategory = date.kategory;
|
||||
self.zakaz = date.zakaz;
|
||||
self.ves_slit = date.ves_slit;
|
||||
self.kompl = date.kompl;
|
||||
self.diam_krist = date.diam_krist;
|
||||
self.diam_electr = date.diam_electr;
|
||||
self.num_kontract = date.num_kontract;
|
||||
self.ukazanie = date.ukazanie;
|
||||
self.kod_npl = date.kod_npl;
|
||||
self.rm = date.rm;
|
||||
self.notd = date.notd;
|
||||
self.tin = date.tin;
|
||||
self.dzap = date.dzap;
|
||||
self.dlog = date.dlog;
|
||||
self.last = date.last;
|
||||
self.dlper = date.dlper;
|
||||
self.izl = date.izl;
|
||||
self.robm = date.robm;
|
||||
self.rizol = date.rizol;
|
||||
self.pos = date.pos;
|
||||
self.pril = date.pril;
|
||||
self.Show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
_ParseDirToNumVDP(dir) {
|
||||
var t = dir.split('.');
|
||||
if (t[t.length - 1] != "gz")
|
||||
return parseInt(t[t.length - 1]);
|
||||
t = t[0].split('-');
|
||||
if (t.length == 2)
|
||||
return parseInt(t[t.length - 1]);
|
||||
if (t.length == 4)
|
||||
return parseInt(t[2]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
Show() {
|
||||
this._pasp_lable.removeAttr('hidden');
|
||||
if (this.have_date == undefined || !this.have_date) {
|
||||
this._pasp_lable.find('h5').html('Ошибка получения паспорта');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (this.have_pasport == undefined || !this.have_pasport)
|
||||
this._pasp_lable.find('h5').html('Паспорта нет');
|
||||
else
|
||||
this._pasp_lable.find('h5').html('Плавка №' + this.num_plav);
|
||||
|
||||
this._pasp_date.removeAttr('hidden');
|
||||
this._pasp_date.find('span').eq(0).html(this.time_start);
|
||||
this._pasp_date.find('span').eq(1).html(this.time_end);
|
||||
|
||||
this._pasp_button.removeAttr('hidden');
|
||||
if (this.have_pasport == undefined || !this.have_pasport)
|
||||
return;
|
||||
|
||||
this._pasp_info.removeAttr('hidden');
|
||||
var temp = this._pasp_info.find('span');
|
||||
temp.empty();
|
||||
if (this.is != '-')
|
||||
temp.eq(0).html(this.splav + ' ' + this.is);
|
||||
else
|
||||
temp.eq(0).html(this.splav);
|
||||
temp.eq(1).html(this.pereplav);
|
||||
temp.eq(2).html(this.naznachenie);
|
||||
temp.eq(3).html(this.kategory);
|
||||
temp.eq(4).html(this.zakaz);
|
||||
temp.eq(5).html(this.ves_slit);
|
||||
temp.eq(6).html(this.kompl);
|
||||
temp.eq(7).html(this.diam_krist);
|
||||
temp.eq(8).html(this.diam_electr);
|
||||
temp.eq(9).html(this.num_kontract);
|
||||
temp.eq(10).html(this.ukazanie);
|
||||
}
|
||||
|
||||
Clear() {
|
||||
this._pasp_lable.find('h5').empty();
|
||||
this._pasp_lable.attr('hidden', true);
|
||||
|
||||
this._pasp_date.find('span').empty();
|
||||
this._pasp_date.attr('hidden', true);
|
||||
|
||||
this._pasp_info.find('span').empty();
|
||||
this._pasp_info.attr('hidden', true);
|
||||
|
||||
this._pasp_button.attr('hidden', true);
|
||||
}
|
||||
}
|
||||
|
||||
class TechCycle {
|
||||
constructor() {
|
||||
this._sort = false;
|
||||
this._modal_load = $('#Modal_load');
|
||||
this._tech_lable = $('#Tech_Cycle_Lable');
|
||||
this._tech_table = $('#Tech_Cycle_Table');
|
||||
this._tech_sort = $('#Tech_Cycle_Sort');
|
||||
this._info_arr = [];
|
||||
|
||||
var self = this;
|
||||
this._tech_sort.click(function () {
|
||||
if (self._sort == undefined)
|
||||
self._sort == true;
|
||||
self._sort = !self._sort;
|
||||
self._tech_table.find('tbody').empty();
|
||||
self.Show();
|
||||
});
|
||||
}
|
||||
Download(pasp) {
|
||||
var self = this;
|
||||
this._info_arr = [];
|
||||
this.Clear();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: 'http://' + document.URL.split("/")[2] + '/api/techcycle',
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
|
||||
data: JSON.stringify({
|
||||
"vdp": pasp.num_vdp,
|
||||
"timeStart": pasp.time_start,
|
||||
"timeEnd": pasp.time_end
|
||||
}),
|
||||
success: function (date) {
|
||||
if (date == undefined || date.length == 0)
|
||||
return;
|
||||
self._info_arr = date;
|
||||
self.Show();
|
||||
}
|
||||
//complete: function () { }
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
DownloadFormTime(vdp, tStart, tEnd) {
|
||||
var self = this;
|
||||
this._modal_load.modal('show');
|
||||
this._info_arr = [];
|
||||
this.Clear();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: 'http://' + document.URL.split("/")[2] + '/api/techcycle',
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
|
||||
data: JSON.stringify({
|
||||
"vdp": vdp,
|
||||
"timeStart": tStart,
|
||||
"timeEnd": tEnd
|
||||
}),
|
||||
success: function (date) {
|
||||
if (date == undefined || date.length == 0)
|
||||
return;
|
||||
self._info_arr = date;
|
||||
self.Show();
|
||||
}
|
||||
//complete: function () { }
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
Show() {
|
||||
if (this._info_arr == undefined || this._info_arr.length == 0)
|
||||
return;
|
||||
|
||||
this._tech_sort.removeClass('fa-sort-amount-down fa-sort-amount-up');
|
||||
this._tech_sort.addClass(this._sort ? 'fa-sort-amount-up' : 'fa-sort-amount-down');
|
||||
|
||||
for (var i = 0; i < this._info_arr.length; i++) {
|
||||
var j = this._sort ? this._info_arr.length - 1 - i : i;
|
||||
this._tech_table.find('tbody').append(
|
||||
'<tr style="background-color : rgba(' + this._info_arr[j].color + ', 0.15);">' +
|
||||
'<td>' + (j + 1) +
|
||||
'</td>' +
|
||||
'<td>' + this._info_arr[j].date +
|
||||
'</td>' +
|
||||
'<td>' + this._info_arr[j].value +
|
||||
'</td>' +
|
||||
'</tr>');
|
||||
}
|
||||
this._tech_table.find('td').addClass('p-1');
|
||||
this._tech_lable.removeAttr('hidden');
|
||||
this._tech_table.removeAttr('hidden');
|
||||
}
|
||||
Clear() {
|
||||
this._tech_lable.attr('hidden', true);
|
||||
|
||||
this._tech_table.find('tbody').empty();
|
||||
this._tech_table.attr('hidden', true);
|
||||
}
|
||||
}
|
||||
|
154
ShowTrend_tmp3/ShowTrend3/wwwroot/js/main.js
Normal file
154
ShowTrend_tmp3/ShowTrend3/wwwroot/js/main.js
Normal file
@@ -0,0 +1,154 @@
|
||||
var pasport_vdp = new Pasport();
|
||||
var tech_cycle = new TechCycle();
|
||||
|
||||
var search1_date = $('#Search1_date');
|
||||
var search1_list_pasport = $('#Search1_list_pasport');
|
||||
var search1_button = $('#Search1_button');
|
||||
var button_load_all = $('#Pasport_button_LoadAll');
|
||||
|
||||
var search2_select_vdp = $('#Search2_select_vdp');
|
||||
var search2_date_start = $('#Search2_date_start');
|
||||
var search2_date_end = $('#Search2_date_end');
|
||||
var search2_time_start = $('#Search2_time_start');
|
||||
var search2_time_end = $('#Search2_time_end');
|
||||
var search2_button_load = $('#Search2_button_load');
|
||||
|
||||
var analog_Chart = new AnalogChart();
|
||||
$(document).ready(function () {
|
||||
var d = new Date();
|
||||
var t = d.getFullYear() + "-" +
|
||||
("0" + (d.getMonth() + 1)).slice(-2) + "-" +
|
||||
("0" + d.getDate()).slice(-2);
|
||||
search1_date.val(t);
|
||||
search2_date_end.val(t);
|
||||
|
||||
t = ("0" + d.getHours()).slice(-2) + ":" +
|
||||
("0" + d.getMinutes()).slice(-2) + ":" +
|
||||
("0" + d.getSeconds()).slice(-2);
|
||||
search2_time_end.val(t);
|
||||
search2_time_start.val(t);
|
||||
|
||||
d.setDate(d.getDate() - 3);
|
||||
t = d.getFullYear() + "-" +
|
||||
("0" + (d.getMonth() + 1)).slice(-2) + "-" +
|
||||
("0" + d.getDate()).slice(-2);
|
||||
search2_date_start.val(t);
|
||||
|
||||
for (var i = 1; i < 51; i++)
|
||||
search2_select_vdp.append('<option>' + i + '</option>');
|
||||
for (var i = 91; i < 95; i++)
|
||||
search2_select_vdp.append('<option>' + i + '</option>');
|
||||
});
|
||||
|
||||
search1_date.change(function () {
|
||||
search1_list_pasport.empty();
|
||||
pasport_vdp.Clear();
|
||||
tech_cycle.Clear();
|
||||
analog_Chart.Clear();
|
||||
var value = search1_date.val();
|
||||
value = value.split('-');
|
||||
value = new Date(value[0], value[1] - 1, value[2]);
|
||||
if (value < new Date(2001, 01, 21))
|
||||
search1_date.val("2001-02-21");
|
||||
|
||||
if (value > new Date()) {
|
||||
var date = new Date();
|
||||
date =
|
||||
date.getFullYear() + "-" +
|
||||
("0" + (date.getMonth() + 1)).slice(-2) + "-" +
|
||||
("0" + date.getDate()).slice(-2);
|
||||
search1_date.val(date);
|
||||
}
|
||||
});
|
||||
|
||||
search1_button.click(function () {
|
||||
if (!search1_date.val())
|
||||
return;
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: 'http://' + document.URL.split("/")[2] + '/api/dirbrowse',
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
data: JSON.stringify({ "date": search1_date.val() }),
|
||||
failure: function (errMsg) {
|
||||
alert(errMsg);
|
||||
},
|
||||
beforeSend: function (jqXHR, settings) {
|
||||
pasport_vdp.Clear();
|
||||
search1_list_pasport.empty();
|
||||
},
|
||||
success: function (date) {
|
||||
if (date.length == 0)
|
||||
search1_list_pasport.append('<option>Плавок нет</option>');
|
||||
for (var i = 0; i < date.length; i++)
|
||||
search1_list_pasport.append('<option value="' + date[i].Dir + '">' + date[i].Name + '</option>');
|
||||
search1_list_pasport.change();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
search1_list_pasport.change(function () {
|
||||
var chk = search1_list_pasport.find(":selected").val();
|
||||
if (chk == undefined || chk == "" || chk == "Плавок нет")
|
||||
return;
|
||||
if (chk != pasport_vdp._server_dir) {
|
||||
pasport_vdp.Download(chk);
|
||||
}
|
||||
tech_cycle.Clear();
|
||||
analog_Chart.Clear();
|
||||
});
|
||||
|
||||
button_load_all.click(function () {
|
||||
tech_cycle.Download(pasport_vdp);
|
||||
analog_Chart = new AnalogChart(pasport_vdp.num_vdp, pasport_vdp.time_start, pasport_vdp.time_end);
|
||||
analog_Chart.LoadData();
|
||||
});
|
||||
|
||||
search2_button_load.click(function () {
|
||||
if (search2_date_start.val() == undefined ||
|
||||
search2_date_end.val() == undefined ||
|
||||
search2_time_start.val() == undefined ||
|
||||
search2_time_end.val() == undefined) {
|
||||
alert("Не верно указаны даты.");
|
||||
return;
|
||||
}
|
||||
pasport_vdp.Clear();
|
||||
tech_cycle.Clear();
|
||||
analog_Chart.Clear();
|
||||
var d = search2_date_start.val().split('-');
|
||||
var t = search2_time_start.val().split(':');
|
||||
var r_start = new Date(d[0], d[1], d[2], t[0], t[1], t[2]);
|
||||
|
||||
d = search2_date_end.val().split('-');
|
||||
t = search2_time_end.val().split(':');
|
||||
var r_end = new Date(d[0], d[1], d[2], t[0], t[1], t[2]);
|
||||
var delta = r_end - r_start;
|
||||
delta = Math.round(delta / 1000 / 60 / 60 / 24);
|
||||
if (delta < 0) {
|
||||
alert("Не верно указаны даты.");
|
||||
return;
|
||||
}
|
||||
if (delta > 3) {
|
||||
alert("Временной интервал больше 4 дней.");
|
||||
return;
|
||||
}
|
||||
var ds = search2_date_start.val().split('-');
|
||||
var ts = search2_time_start.val().split(':');
|
||||
var de = search2_date_end.val().split('-');
|
||||
var te = search2_time_end.val().split(':');
|
||||
tech_cycle.DownloadFormTime(
|
||||
search2_select_vdp.find(":selected").val(),
|
||||
ds[2] + '.' + ds[1] + '.' + ds[0] + ' ' + ts[0] + ':' + ts[1] + ':' + ts[2],
|
||||
de[2] + '.' + de[1] + '.' + de[0] + ' ' + te[0] + ':' + te[1] + ':' + te[2]);
|
||||
analog_Chart = new AnalogChart(search2_select_vdp.find(":selected").val(),
|
||||
ds[2] + '.' + ds[1] + '.' + ds[0] + ' ' + ts[0] + ':' + ts[1] + ':' + ts[2],
|
||||
de[2] + '.' + de[1] + '.' + de[0] + ' ' + te[0] + ':' + te[1] + ':' + te[2]);
|
||||
analog_Chart.LoadData();
|
||||
})
|
||||
|
||||
$("#test_button").click(function () {
|
||||
analog_Chart.LoadData();
|
||||
});
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user