273 lines
8.5 KiB
JavaScript
273 lines
8.5 KiB
JavaScript
|
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);
|
|||
|
}
|
|||
|
}
|
|||
|
|