Compare commits
2 Commits
6c08c4fd1b
...
78ec2cbe85
| Author | SHA1 | Date | |
|---|---|---|---|
| 78ec2cbe85 | |||
| 3c9ba8a7f5 |
@ -647,7 +647,7 @@
|
|||||||
rows: 1000,
|
rows: 1000,
|
||||||
sort: "displacement",
|
sort: "displacement",
|
||||||
order: "asc",
|
order: "asc",
|
||||||
unitId: '0533JS',
|
unitId: defaultUnitId,
|
||||||
},
|
},
|
||||||
// async: true,
|
// async: true,
|
||||||
// dataType: 'json',
|
// dataType: 'json',
|
||||||
@ -746,7 +746,7 @@
|
|||||||
type: 'GET',
|
type: 'GET',
|
||||||
url: ext.contextPath + '/base/mainConfig/getJson.do',
|
url: ext.contextPath + '/base/mainConfig/getJson.do',
|
||||||
async: true,
|
async: true,
|
||||||
data: {unitId: unitId},
|
data: {unitId: defaultUnitId},
|
||||||
globle: false,
|
globle: false,
|
||||||
error: function () {
|
error: function () {
|
||||||
console.error('获取主配置数据失败');
|
console.error('获取主配置数据失败');
|
||||||
@ -849,12 +849,13 @@
|
|||||||
if (!hasPumpConfig) {
|
if (!hasPumpConfig) {
|
||||||
initPumpStations();
|
initPumpStations();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果没有工艺配置,使用默认数据
|
// // 如果没有工艺配置,使用默认数据
|
||||||
var hasProcessConfig = mpcode.some(function(item) { return item.type === 'process'; });
|
// var hasProcessConfig = mpcode.some(function(item) { return item.type === 'process'; });
|
||||||
if (!hasProcessConfig) {
|
// if (!hasProcessConfig) {
|
||||||
initProcessList();
|
// initProcessList();
|
||||||
}
|
// }
|
||||||
|
initProcessListByConfig(code, divid);
|
||||||
|
|
||||||
// 如果没有告警配置,使用默认数据
|
// 如果没有告警配置,使用默认数据
|
||||||
var hasAlarmConfig = mpcode.some(function(item) { return item.type === 'alarm'; });
|
var hasAlarmConfig = mpcode.some(function(item) { return item.type === 'alarm'; });
|
||||||
@ -900,7 +901,7 @@
|
|||||||
page: page,
|
page: page,
|
||||||
sort: 'equipmentcardid',
|
sort: 'equipmentcardid',
|
||||||
order: 'asc',
|
order: 'asc',
|
||||||
unitId: unitId,
|
unitId: defaultUnitId,
|
||||||
},
|
},
|
||||||
async: true,
|
async: true,
|
||||||
globle: false,
|
globle: false,
|
||||||
@ -1109,41 +1110,98 @@
|
|||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 根据配置初始化工艺列表
|
// 根据配置初始化工艺列表 - 调用工艺段接口
|
||||||
|
// /TGLW/user/processSection/getlist.do?rows=50&page=1&order=asc&search_code=0533JS&unitId=0533JS&search_name=&_=1775558221772
|
||||||
function initProcessListByConfig(mpointCode, containerId) {
|
function initProcessListByConfig(mpointCode, containerId) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
url: ext.contextPath + '/work/mpoint/getProcessList.do?unitId=' + unitId + '&mpointCode=' + mpointCode,
|
url: ext.contextPath + '/user/processSection/getlist.do',
|
||||||
|
data: {
|
||||||
|
unitId: defaultUnitId,
|
||||||
|
rows: 50,
|
||||||
|
page: 1,
|
||||||
|
},
|
||||||
async: true,
|
async: true,
|
||||||
|
dataType: 'json',
|
||||||
globle: false,
|
globle: false,
|
||||||
error: function () {
|
error: function () {
|
||||||
processData = generateProcessData();
|
// processData = generateProcessData();
|
||||||
renderProcessTable();
|
// renderProcessTable();
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
if (data != null && data !== '') {
|
if (data && data.rows) {
|
||||||
try {
|
// 将接口返回的工艺段数据转换为表格格式
|
||||||
var result = eval('(' + data + ')');
|
processData = [];
|
||||||
if (result.status === 'pass' && result.processList) {
|
var rows = data.rows || [];
|
||||||
processData = result.processList;
|
|
||||||
renderProcessTable();
|
// 为每个工艺段获取测点值
|
||||||
} else {
|
var promises = [];
|
||||||
processData = generateProcessData();
|
rows.forEach(function(item, index) {
|
||||||
renderProcessTable();
|
var processItem = {
|
||||||
}
|
...item,
|
||||||
} catch (e) {
|
processName: item.text || item.name || '--',
|
||||||
processData = generateProcessData();
|
param1: '--',
|
||||||
|
param2: '--',
|
||||||
|
param3: '--',
|
||||||
|
deviceId: item.id || ''
|
||||||
|
};
|
||||||
|
processData.push(processItem);
|
||||||
|
|
||||||
|
// 为param1, param2, param3创建获取值的Promise
|
||||||
|
['1', '2', '3'].forEach(function(suffix) {
|
||||||
|
var mpointCodeParam = item.id + '_' + suffix;
|
||||||
|
promises.push(
|
||||||
|
getMpointValueAsync(mpointCodeParam).then(function(value) {
|
||||||
|
if (suffix === '1') processItem.param1 = value;
|
||||||
|
else if (suffix === '2') processItem.param2 = value;
|
||||||
|
else if (suffix === '3') processItem.param3 = value;
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// 等待所有测点值获取完成后渲染表格
|
||||||
|
Promise.all(promises).then(function() {
|
||||||
renderProcessTable();
|
renderProcessTable();
|
||||||
}
|
}).catch(function() {
|
||||||
|
renderProcessTable();
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
processData = generateProcessData();
|
// processData = generateProcessData();
|
||||||
renderProcessTable();
|
// renderProcessTable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 异步获取测点值
|
||||||
|
function getMpointValueAsync(mpointCode) {
|
||||||
|
return new Promise(function(resolve) {
|
||||||
|
$.ajax({
|
||||||
|
type: 'GET',
|
||||||
|
url: ext.contextPath + '/work/mpoint/getValue.do',
|
||||||
|
data: {
|
||||||
|
unitId: defaultUnitId,
|
||||||
|
mpointCode: mpointCode
|
||||||
|
},
|
||||||
|
async: true,
|
||||||
|
dataType: 'json',
|
||||||
|
globle: false,
|
||||||
|
success: function(data) {
|
||||||
|
if (data && data.parmvalue !== undefined && data.parmvalue !== null) {
|
||||||
|
resolve(data.parmname + ':' + data.parmvalue + data.unit);
|
||||||
|
} else {
|
||||||
|
resolve('--');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function() {
|
||||||
|
resolve('--');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// 生成告警列表mock数据
|
// 生成告警列表mock数据
|
||||||
function generateAlarmData() {
|
function generateAlarmData() {
|
||||||
var processNames = ['粗格栅间', '细格栅间', '曝气沉砂池', '厌氧池', '缺氧池', '好氧池', '二沉池', '消毒池', '污泥浓缩池', '污泥脱水间'];
|
var processNames = ['粗格栅间', '细格栅间', '曝气沉砂池', '厌氧池', '缺氧池', '好氧池', '二沉池', '消毒池', '污泥浓缩池', '污泥脱水间'];
|
||||||
|
|||||||
Reference in New Issue
Block a user