180 lines
6.8 KiB
JavaScript
180 lines
6.8 KiB
JavaScript
/* * 版 本 PIT-ADMS V7.0.3 敏捷开发框架
|
||
* Copyright (c) 2013-2018 Hexagon PPM
|
||
* 创建人:超级管理员
|
||
* 日 期:2022-02-28 14:47
|
||
* 描 述:端子排表
|
||
*/
|
||
var refreshGirdData;
|
||
var ProjectId = request('ProjectId');
|
||
|
||
var bootstrap = function ($, learun) {
|
||
"use strict";
|
||
var page = {
|
||
init: function () {
|
||
page.initGird();
|
||
page.bind();
|
||
},
|
||
bind: function () {
|
||
// 查询
|
||
$('#btn_Search').on('click', function () {
|
||
page.search();
|
||
});
|
||
// 刷新
|
||
$('#lr_refresh').on('click', function () {
|
||
location.reload();
|
||
});
|
||
// 新增
|
||
$('#lr_add').on('click', function () {
|
||
learun.layerForm({
|
||
id: 'form',
|
||
title: '新增',
|
||
url: top.$.rootUrl + '/ZZDT_EC/ec_PanelStrip/Form?ProjectId=' + ProjectId,
|
||
width: 650,
|
||
height: 380,
|
||
callBack: function (id) {
|
||
return top[id].acceptClick(refreshGirdData);
|
||
}
|
||
});
|
||
});
|
||
// 编辑
|
||
$('#lr_edit').on('click', function () {
|
||
var keyValue = $('#gridtable').jfGridValue('StripID');
|
||
if (learun.checkrow(keyValue)) {
|
||
learun.layerForm({
|
||
id: 'form',
|
||
title: '编辑',
|
||
url: top.$.rootUrl + '/ZZDT_EC/ec_PanelStrip/Form?keyValue=' + keyValue + "&ProjectId=" + ProjectId,
|
||
width: 650,
|
||
height: 380,
|
||
callBack: function (id) {
|
||
return top[id].acceptClick(refreshGirdData);
|
||
}
|
||
});
|
||
}
|
||
});
|
||
// 删除
|
||
$('#lr_delete').on('click', function () {
|
||
var keyValue = $('#gridtable').jfGridValue('StripID');
|
||
if (learun.checkrow(keyValue)) {
|
||
learun.layerConfirm('是否确认删除该项!', function (res) {
|
||
if (res) {
|
||
learun.deleteForm(top.$.rootUrl + '/ZZDT_EC/ec_PanelStrip/DeleteForm', { keyValue: keyValue, ProjectId: ProjectId }, function () {
|
||
refreshGirdData();
|
||
});
|
||
}
|
||
});
|
||
}
|
||
});
|
||
//通道
|
||
$('#lr_namingconv').on('click', function () {
|
||
var keyValue = $('#gridtable').jfGridValue('StripID');
|
||
if (learun.checkrow(keyValue)) {
|
||
learun.layerForm({
|
||
id: 'ChannelForm',//窗口id
|
||
title: '通道',//标题
|
||
url: top.$.rootUrl + '/ZZDT_EC/ec_PanelChannel/Index?StripID=' + keyValue + "&ProjectId=" + ProjectId,//窗体打开页面连接
|
||
width: 800,
|
||
height: 500,
|
||
maxmin: true,
|
||
btn: null//窗体底部显示按钮
|
||
});
|
||
}
|
||
});
|
||
|
||
|
||
//监测系统表导出 lr_export
|
||
$('#lr_export').on('click', function () {
|
||
|
||
learun.loading(true, "导出中...");
|
||
var iframeUrl = top.$.rootUrl + '/ZZDT_EC/ec_Wire_Group/IOModuleExportExcel?ProjId=' + ProjectId;
|
||
var body = document.getElementsByTagName("body")[0];
|
||
var downloadIframe = document.createElement("iframe");
|
||
downloadIframe.setAttribute("src", iframeUrl);
|
||
downloadIframe.setAttribute("style", "display:none;")
|
||
body.appendChild(downloadIframe);
|
||
learun.loading(false);
|
||
});
|
||
//监测数据表导入
|
||
$('#lr_import').on('click', function () {
|
||
var format = 'xlsx';
|
||
var uploadKeyValue = Guid.NewGuid().toString();
|
||
|
||
learun.layerForm({
|
||
id: 'import_IO',
|
||
title: '监测表数据导入',
|
||
url: top.$.rootUrl + '/LR_SystemModule/Annexes/UploadForm?keyVaule=' + uploadKeyValue + "&multiple=false" + "&format=" + format,
|
||
width: 600,
|
||
height: 400,
|
||
maxmin: true,
|
||
btn: ['确认'],
|
||
callBack: function (id) {
|
||
learun.layerClose('import_IO');
|
||
import_IO(uploadKeyValue);
|
||
}
|
||
});
|
||
});
|
||
},
|
||
initGird: function () {
|
||
$('#gridtable').jfGrid({
|
||
url: top.$.rootUrl + '/ZZDT_EC/ec_PanelStrip/GetPageList',
|
||
headData: [
|
||
{ label: '端子排名称', name: 'StripName', width: 150, align: "center", sort: false },
|
||
{ label: 'IO类型', name: 'IO_TYPE', width: 150, align: "center", sort: false },
|
||
{ label: '端子排顺序', name: 'Panel_Strip_Seq', width: 100, align: "center", sort: false },
|
||
//{ label: '位号', name: 'TagNumber', width: 150, align: "center", sort: false },
|
||
{ name: "", width: 1, sort: false }
|
||
],
|
||
mainId: 'StripID',
|
||
isPage: true
|
||
});
|
||
page.search();
|
||
},
|
||
search: function (param) {
|
||
param = param || {};
|
||
param.ProjectId = ProjectId;
|
||
param.StripName = $("#StripName").val();
|
||
$('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
|
||
}
|
||
};
|
||
refreshGirdData = function () {
|
||
$('#gridtable').jfGridSet('reload');
|
||
};
|
||
|
||
|
||
//监测数据表导入
|
||
function import_IO(fileId) {
|
||
var learun = top.learun;
|
||
learun.loading(true, "监测表数据导入中...");
|
||
$.ajax({
|
||
type: 'POST',
|
||
url: top.$.rootUrl + "/ZZDT_EC/ec_Wire_Group/IOModuleImportExcel?rdo=" + Math.random(),
|
||
data: {
|
||
fileId: fileId,
|
||
ProjId: ProjectId
|
||
},
|
||
traditional: true,
|
||
success: function (data) {
|
||
var data = JSON.parse(data);
|
||
if (data.code == '200') {
|
||
learun.alert.success(data.info);
|
||
} else {
|
||
learun.alert.error(data.info);
|
||
}
|
||
|
||
},
|
||
error: function (msg) {
|
||
learun.alert.error(msg);
|
||
},
|
||
complete: function (data) {
|
||
learun.loading(false);
|
||
if (!!thiscall) {
|
||
thiscall();
|
||
}
|
||
}
|
||
});
|
||
}
|
||
|
||
|
||
page.init();
|
||
}
|