Files
SIPAIIS_WMS_JSSW/WebRoot/JS/equipment/equipmentMeasurePoint.js
2026-01-16 14:13:44 +08:00

199 lines
6.9 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* 加载绩效附表
*/
function getMpoint4EquipmentCard(equipmentId, equipmentcardId, bizid, viewType) {
$("#table_mpoint2").bootstrapTable({ // 对应table标签的id
// url: ext.contextPath + '/work/mpoint/getlistES.do', // 获取表格数据的url
url: ext.contextPath + '/work/mpoint/getlist.do', // 获取表格数据的url
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
striped: true, //表格显示条纹默认为false
pagination: true, // 在表格底部显示分页组件默认false
pageList: [10, 20, 50], // 设置页面可以显示的数据条数
pageSize: 10, // 页面数据条数
pageNumber: 1, // 首页页码
sidePagination: 'server', // 设置为服务器端分页
queryParams: function (params) { // 请求服务器数据时发送的参数可以在这里添加额外的查询参数返回false则终止请求
return {
rows: params.limit, // 每页要显示的数据条数
page: params.offset / params.limit + 1, // 每页显示数据的开始页码
sort: params.sort, // 要排序的字段
order: params.order,
equipmentId: equipmentId,
equipmentcardId: equipmentcardId,
companyId: bizid
}
},
onClickRow: function (row) {//单击行事件,执行查看功能
// viewMaintainFun(row.id);
},
sortName: 'id', // 要排序的字段
sortOrder: 'desc', // 排序规则
columns: [
{
field: 'id_c',
checkbox: true, // 显示一个勾选框
},
{
field: 'parmname', // 返回json数据中的name
title: '点位名称', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
formatter: function (value, row, index) {
return value;
}
}
,
{
field: 'mpointcode', // 返回json数据中的name
title: '点位编号', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
formatter: function (value, row, index) {
return value;
}
}
,
{
field: 'parmvalue', // 返回json数据中的name
title: '最新值', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
formatter: function (value, row, index) {
return '<span onclick="showHis(\'' + row.mpointcode + '\',\'' + row.bizid + '\');" style="color:#004B97;cursor:pointer;">' + row.parmvalue + '</span>' + ' ' + row.unit;
}
}
,
{
field: 'measuredt', // 返回json数据中的name
title: '时间', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
formatter: function (value, row, index) {
value = value.replace(RegExp("T", "g"), " ");
value = value.replace(RegExp("Z", "g"), " ");
value = value.substring(0, 19);
return value;
}
}
],
onLoadSuccess: function () { //加载成功时执行
if (viewType == 'view') {
$("#table_mpoint2").bootstrapTable('hideColumn', 'id_c');//隐藏上述variablevalue列
}
adjustBootstrapTableView("table_mpoint2");
console.info("加载数据成功");
},
onLoadError: function () { //加载失败时执行
console.info("加载数据失败");
}
})
}
//曲线
function showHis(mpcode, bizid) {
$.post(ext.contextPath + '/data/showOnlyLine.do', {mpcode: mpcode, unitId: bizid}, function (data) {
$("#subDivHis").html(data);
openModal('curveModal');
});
}
/**
* 弹窗摄像头选择页面
* @param equipmentId
*/
var doAdd_mpoint = function () {
$.post(ext.contextPath + '/work/mpoint/mpointList4Layer.do', {
mpids: '',
fucname: 'dosave_mpoint',
existenceIds: getIdsMPoint()
}, function (data) {
$("#subDiv_PatroPoint").html(data);
openModal('subModalMpoint');
});
};
//获取关联的ids测量点
function getIdsMPoint() {
var allTableData = $("#table_mpoint2").bootstrapTable('getData');
var mPointIds = "";
$.each(allTableData, function (index, item) {
if (mPointIds != "") {
mPointIds += ",";
}
if (item.mPoint != null && item.mPoint != '') {//避免因测量点删除 无法加载
mPointIds += "'" + item.mPoint.mpointid + "'";
}
})
return mPointIds;
}
//保存(测量点)
function dosave_mpoint(data) {
$.post(ext.contextPath + '/equipment/updateMPoints.do', {
mPointIds: data,
equipmentId: equipmentId,
bizId: bizId
}, function (data) {
if (data.res > 0) {
$("#table_mpoint2").bootstrapTable('refresh');
} else {
showAlert('d', '导入失败', 'mainAlertdiv');
}
}, 'json');
}
/**
* 删除关联的摄像头
*/
var doDelete_mpoint = function () {
var checkedItems_camera = $("#table_mpoint2").bootstrapTable('getSelections');
var datas = "";
$.each(checkedItems_camera, function (index, item) {
datas += item.id + ",";
});
if (datas == "") {
showAlert('d', '请先选择记录', 'cameraAlertdiv');
} else {
swal({
text: "您确定要删除选中记录?",
dangerMode: true,
buttons: {
cancel: {
text: "取消",
value: null,
visible: true,
className: "btn btn-default btn-sm",
closeModal: true,
},
confirm: {
text: "确定",
value: true,
visible: true,
className: "btn btn-danger btn-sm",
closeModal: true
}
}
})
.then(function (willDelete) {
if (willDelete) {
$.post(ext.contextPath + '/equipment/deleteMPoints.do', {
ids: datas,
bizId: bizId
}, function (data) {
if (data > 0) {
$("#table_mpoint2").bootstrapTable('refresh');
} else {
showAlert('d', '删除失败', 'mainAlertdiv');
}
});
}
});
}
};