181 lines
6.8 KiB
JavaScript
181 lines
6.8 KiB
JavaScript
|
|
/**
|
|||
|
|
* 加载绩效附表
|
|||
|
|
*/
|
|||
|
|
function getCamera4EquipmentCard(equipmentId, viewType) {
|
|||
|
|
$("#cameratable").bootstrapTable({ // 对应table标签的id
|
|||
|
|
url: ext.contextPath + '/equipment/equipmentCardCamera/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,
|
|||
|
|
eqid: equipmentId
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
onClickRow: function (row) {//单击行事件,执行查看功能
|
|||
|
|
// viewMaintainFun(row.id);
|
|||
|
|
},
|
|||
|
|
sortName: 'id', // 要排序的字段
|
|||
|
|
sortOrder: 'desc', // 排序规则
|
|||
|
|
columns: [
|
|||
|
|
{
|
|||
|
|
field: 'id_c',
|
|||
|
|
checkbox: true, // 显示一个勾选框
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
field: 'camera.name', // 返回json数据中的name
|
|||
|
|
title: '名称', // 表格表头显示文字
|
|||
|
|
align: 'center', // 左右居中
|
|||
|
|
valign: 'middle',
|
|||
|
|
width: '25%'
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
field: 'camera.url', // 返回json数据中的name
|
|||
|
|
title: '地址', // 表格表头显示文字
|
|||
|
|
align: 'center', // 左右居中
|
|||
|
|
valign: 'middle',
|
|||
|
|
width: '25%',
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
field: 'camera.channel', // 返回json数据中的name
|
|||
|
|
title: '通道号', // 表格表头显示文字
|
|||
|
|
align: 'center', // 左右居中
|
|||
|
|
valign: 'middle',
|
|||
|
|
width: '25%',
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
field: 'camera.type', // 返回json数据中的name
|
|||
|
|
title: '摄像机类形', // 表格表头显示文字
|
|||
|
|
align: 'center', // 左右居中
|
|||
|
|
valign: 'middle',
|
|||
|
|
width: '25%',
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
field: 'camera.style', // 返回json数据中的name
|
|||
|
|
title: '摄像机外形', // 表格表头显示文字
|
|||
|
|
align: 'center', // 左右居中
|
|||
|
|
valign: 'middle',
|
|||
|
|
width: '25%',
|
|||
|
|
formatter: function (value, row, index) {
|
|||
|
|
switch (value) {
|
|||
|
|
case '1':
|
|||
|
|
return '球机';
|
|||
|
|
case '0':
|
|||
|
|
return '枪机';
|
|||
|
|
default:
|
|||
|
|
return '';
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
title: "操作",
|
|||
|
|
align: 'center',
|
|||
|
|
valign: 'middle',
|
|||
|
|
width: 80, // 定义列的宽度,单位为像素px
|
|||
|
|
formatter: function (value, row, index) {
|
|||
|
|
var buts = '';
|
|||
|
|
buts += '<button type="button" class="btn btn-default btn-sm" title="浏览" onclick="viewFun_Camera(\'' + row.cameraid + '\')"><i class="fa fa-eye"></i><span class="hidden-md hidden-lg"> 浏览</span></button>';
|
|||
|
|
buts = '<div class="btn-group" >' + buts + '</div>';
|
|||
|
|
return buts;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
],
|
|||
|
|
onLoadSuccess: function () { //加载成功时执行
|
|||
|
|
|
|||
|
|
if (viewType == 'view') {
|
|||
|
|
$("#cameratable").bootstrapTable('hideColumn', 'id_c');//隐藏上述variablevalue列
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
adjustBootstrapTableView("cameratable");
|
|||
|
|
console.info("加载数据成功_摄像头");
|
|||
|
|
},
|
|||
|
|
onLoadError: function () { //加载失败时执行
|
|||
|
|
console.info("加载数据失败_摄像头");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 摄像头预览页面
|
|||
|
|
* @param id
|
|||
|
|
*/
|
|||
|
|
var viewCameraWindow = null;
|
|||
|
|
var viewFun_Camera = function (id) {
|
|||
|
|
// $.post(ext.contextPath + '/work/camera/cameraIdsShowList.do', {cameraIds: id}, function (data) {
|
|||
|
|
// $("#subCameraAddDiv").html(data);
|
|||
|
|
// openModal('cameraSubModal');
|
|||
|
|
// });
|
|||
|
|
var features = "height=800, width=1200, top=100, left=100, toolbar=no, menubar=no,scrollbars=no,resizable=no, location=no, status=no";
|
|||
|
|
// window.open(ext.contextPath + '/work/camera/cameraIdsShowList.do?cameraIds=' + id, "newW", features);
|
|||
|
|
viewCameraWindow = window.open(ext.contextPath + "/work/camera/getCameraJsp.do?id=" + id, "newW", features);
|
|||
|
|
viewCameraWindow.focus();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 弹窗摄像头选择页面
|
|||
|
|
* @param equipmentId
|
|||
|
|
*/
|
|||
|
|
var doAdd_camera = function (equipmentId) {
|
|||
|
|
$.post(ext.contextPath + '/equipment/equipmentCardCamera/selectListForCamera.do', {eqid: equipmentId}, function (data) {
|
|||
|
|
$("#subCameraAddDiv").html(data);
|
|||
|
|
openModal('cameraSubModal');
|
|||
|
|
});
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 删除关联的摄像头
|
|||
|
|
*/
|
|||
|
|
var doDelete_camera = function () {
|
|||
|
|
var checkedItems_camera = $("#cameratable").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/equipmentCardCamera/dodeletes.do', {ids: datas}, function (data) {
|
|||
|
|
if (data > 0) {
|
|||
|
|
$("#cameratable").bootstrapTable('refresh');
|
|||
|
|
} else {
|
|||
|
|
showAlert('d', '删除失败', 'mainAlertdiv');
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
|