274 lines
11 KiB
JavaScript
274 lines
11 KiB
JavaScript
/* * 版 本 PIT-ADMS V7.0.3 敏捷开发框架
|
||
* Copyright (c) 2013-2018 Hexagon PPM
|
||
* 创建人:超级管理员
|
||
* 日 期:2022-03-07 13:44
|
||
* 描 述:工程数据表
|
||
*/
|
||
var refreshGirdData;
|
||
var ProjectId = parent.request('ProjectId');
|
||
var bootstrap = function ($, learun) {
|
||
"use strict";
|
||
var page = {
|
||
init: function () {
|
||
page.initGird();
|
||
page.bind();
|
||
},
|
||
bind: function () {
|
||
$('#UpObjectTypeID').lrselect({
|
||
url: top.$.rootUrl + '/ZZDT_EC/ec_objecttype/GetTreeData',
|
||
param: { ProjectId: ProjectId, isShowCheck: false },
|
||
type: 'tree',
|
||
allowSearch: true,
|
||
maxHeight: 225
|
||
});
|
||
$('#DataStatus').lrDataItemSelect({ code: 'Be_DataStatus' });
|
||
//查询
|
||
$('#btn_Search').on('click', function () {
|
||
page.search($('.lr-layout-tool-left').lrGetFormData());
|
||
});
|
||
// 刷新
|
||
$('#lr_refresh').on('click', function () {
|
||
location.reload();
|
||
});
|
||
// 新增
|
||
$('#lr_add').on('click', function () {
|
||
learun.layerForm({
|
||
id: 'form',
|
||
title: '新增',
|
||
url: top.$.rootUrl + '/ZZDT_EC/ec_enginedata/Form?ProjectId=' + ProjectId,
|
||
width: 600,
|
||
height: 400,
|
||
callBack: function (id) {
|
||
return top[id].acceptClick(refreshGirdData);
|
||
}
|
||
});
|
||
});
|
||
// 编辑
|
||
$('#lr_edit').on('click', function () {
|
||
var rowdata = $('#gridtable').jfGridGet('rowdata');
|
||
if (rowdata.length != 1) {
|
||
learun.alert.warning('请勾选一条数据项再操作!');
|
||
return false;
|
||
}
|
||
learun.layerForm({
|
||
id: 'form',
|
||
title: '编辑',
|
||
url: top.$.rootUrl + '/ZZDT_EC/ec_enginedata/Form?keyValue=' + rowdata[0].EngineDataID + "&ProjectId=" + ProjectId,
|
||
width: 600,
|
||
height: 400,
|
||
callBack: function (id) {
|
||
return top[id].acceptClick(refreshGirdData);
|
||
}
|
||
});
|
||
});
|
||
// 删除
|
||
$('#lr_delete').on('click', function () {
|
||
var rowdata = $('#gridtable').jfGridGet('rowdata');
|
||
if (rowdata.length == 0) {
|
||
learun.alert.warning('请勾选一条数据项再操作!');
|
||
return false;
|
||
}
|
||
var postData = {
|
||
strEntity: JSON.stringify(rowdata),
|
||
ProjectId: ProjectId
|
||
}
|
||
learun.layerConfirm('是否确认删除选中的项!', function (res) {
|
||
if (res) {
|
||
learun.deleteForm(top.$.rootUrl + '/ZZDT_EC/ec_enginedata/DeleteForm', postData, function () {
|
||
refreshGirdData();
|
||
});
|
||
}
|
||
});
|
||
});
|
||
// 图元
|
||
$('#lr_pixel').on('click', function () {
|
||
var rowdata = $('#gridtable').jfGridGet('rowdata');
|
||
if (rowdata.length != 1) {
|
||
learun.alert.warning('请勾选一条数据项再操作!');
|
||
return false;
|
||
}
|
||
learun.layerForm({
|
||
id: 'form',
|
||
title: '图元',
|
||
url: top.$.rootUrl + '/ZZDT_EC/ec_enginedata_pixel/Index?ProjectId=' + ProjectId + "&EngineDataID=" + rowdata[0].EngineDataID,
|
||
width: 1000,
|
||
height: 600,
|
||
btn: null
|
||
});
|
||
});
|
||
// 属性
|
||
$('#lr_property').on('click', function () {
|
||
var rowdata = $('#gridtable').jfGridGet('rowdata');
|
||
if (rowdata.length != 1) {
|
||
learun.alert.warning('请勾选一条数据项再操作!');
|
||
return false;
|
||
}
|
||
learun.layerForm({
|
||
id: 'form',
|
||
title: '属性',
|
||
url: top.$.rootUrl + '/ZZDT_EC/ec_enginedata_property/Index?ObjectTypeID=' + rowdata[0].ObjectTypeID + "&ProjectId=" + ProjectId + "&EngineDataID=" + rowdata[0].EngineDataID + "&CaseID=" + rowdata[0].CaseID,
|
||
width: 1200,
|
||
height: 700,
|
||
btn: null
|
||
});
|
||
});
|
||
//模板导出
|
||
$('#lr_export').on('click', function () {
|
||
learun.layerForm({
|
||
id: 'export',
|
||
title: '模板或数据导出',
|
||
url: top.$.rootUrl + '/ZZDT_EC/ec_objecttype/BatchSelctIndex?ProjectId=' + ProjectId,
|
||
width: 800,
|
||
height: 600,
|
||
btn: null
|
||
});
|
||
});
|
||
//
|
||
//CheckIsRequiredPropsByDrawing接口得到的结果,进行反向导入
|
||
$('#lr_importPropertyCheck').on('click', function () {
|
||
var format = 'xlsx,xls';
|
||
var uploadKeyValue = Guid.NewGuid().toString();
|
||
learun.layerForm({
|
||
id: 'import',
|
||
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');
|
||
MuliteImport(uploadKeyValue,2);
|
||
}
|
||
});
|
||
});
|
||
//数据导入
|
||
$('#lr_import').on('click', function () {
|
||
var format = 'xlsx,xls';
|
||
var uploadKeyValue = Guid.NewGuid().toString();
|
||
learun.layerForm({
|
||
id: 'import',
|
||
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');
|
||
MuliteImport(uploadKeyValue,1);
|
||
}
|
||
});
|
||
});
|
||
//数据审批
|
||
$('#lr_approval').on('click', function () {
|
||
var rowdata = $('#gridtable').jfGridGet('rowdata');
|
||
if (rowdata.length <= 0) {
|
||
learun.alert.warning('请至少勾选一条数据项再操作!');
|
||
return false;
|
||
}
|
||
var bResult = true;
|
||
$.each(rowdata, function (_index, _item) {
|
||
if (_item.DataStatus != "00002") {
|
||
bResult = false;
|
||
return false;
|
||
}
|
||
});
|
||
if (bResult) {
|
||
learun.layerConfirm('是否确认批量审核勾选数据!', function (res) {
|
||
if (res) {
|
||
var postData = {
|
||
strEntity: JSON.stringify(rowdata),
|
||
ProjectId: ProjectId
|
||
}
|
||
$.lrSaveForm(top.$.rootUrl + '/ZZDT_EC/ec_enginedata/UpdateDataStatus', postData, function (res) {
|
||
// 保存成功后才回调
|
||
refreshGirdData();
|
||
});
|
||
}
|
||
});
|
||
} else {
|
||
learun.alert.warning('只能审批待验证区的数据!');
|
||
return false;
|
||
}
|
||
});
|
||
//数据关联
|
||
$('#lr_related').on('click', function () {
|
||
var rowdata = $('#gridtable').jfGridGet('rowdata');
|
||
if (rowdata.length != 1) {
|
||
learun.alert.warning('请勾选一条数据项再操作!');
|
||
return false;
|
||
}
|
||
learun.layerForm({
|
||
id: 'enginedatarel',
|
||
title: '数据关联',
|
||
url: top.$.rootUrl + '/ZZDT_EC/ec_enginedata_rel/Index?ProjectId=' + ProjectId + "&EngineDataID=" + rowdata[0].EngineDataID,
|
||
width: 900,
|
||
height: 650,
|
||
btn: null
|
||
});
|
||
});
|
||
},
|
||
// 初始化列表
|
||
initGird: function () {
|
||
$('#gridtable').jfGrid({
|
||
url: top.$.rootUrl + '/ZZDT_EC/ec_enginedata/GetPageList',
|
||
headData: [
|
||
{ label: "位号", name: "TagNumber", width: 300, align: "center", sort: false },
|
||
{ label: "对象类型", name: "FullPathCN", width: 300, align: "center", sort: false },
|
||
{ label: "数据状态", name: "DataStatusName", width: 150, align: "center", sort: false },
|
||
{ name: "", width: 1, sort: false }
|
||
],
|
||
mainId: 'EngineDataID',
|
||
isPage: true,
|
||
isMultiselect: true,
|
||
});
|
||
page.search();
|
||
},
|
||
search: function (param) {
|
||
param = param || {};
|
||
if (param.UpObjectTypeID == "-1") {
|
||
param.UpObjectTypeID = "";
|
||
}
|
||
param.ProjectId = ProjectId;
|
||
$('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
|
||
}
|
||
};
|
||
refreshGirdData = function () {
|
||
$('#gridtable').jfGridSet('reload');
|
||
};
|
||
page.init();
|
||
}
|
||
function MuliteImport(fileId,MODE) {
|
||
var learun = top.learun;
|
||
learun.loading(true, "数据导入中...");
|
||
var ServerApi = "";
|
||
|
||
if (MODE == 1) {
|
||
ServerApi = "/ZZDT_EC/ec_objecttype/MuliteImport?rdo=" + Math.random();
|
||
}
|
||
else if (MODE == 2) {
|
||
ServerApi = "/ZZDT_EC/ec_objecttype/PropertyCheckResImport";
|
||
}
|
||
$.ajax({
|
||
type: 'POST',
|
||
url: top.$.rootUrl + ServerApi,
|
||
data: { fileId: fileId, ProjectId: ProjectId },
|
||
traditional: true,
|
||
success: function (data) {
|
||
var data = JSON.parse(data);
|
||
if (data.code == '200') {
|
||
learun.alert.success(data.info);
|
||
refreshGirdData();
|
||
} else {
|
||
learun.alert.error(data.info);
|
||
}
|
||
|
||
},
|
||
error: function (msg) {
|
||
learun.alert.error(msg);
|
||
}, complete: function (data) {
|
||
learun.loading(false);
|
||
}
|
||
});
|
||
} |