文档
测试

获取设备列表

POST
/device/getAll.action

接口描述

ajax的方式调用后端设备信息

请求头

参数名
类型
描述
必填
contentType: "application/json; charset=utf-8",
文本
必填
device.device_no
文本
设备编号
必填
device.facno
数字
工厂分号
必填

说明 / 示例

$.ajax({ type: "POST", url: url, async:false, cache: false, dataType: "json",//预期服务器返回的数据类型 //contentType: "application/json; charset=utf-8", data : param, success: function (data) { //alert(JSON.stringify(data)); //console.info(data); // if (data.rows.length > 0) { layui.use('table', function () { var table = layui.table; var form = layui.form; var createTable = function () { table.init('demo', tableOptions); }; // console.info(data.rows); //展示已知数据 table.render({ elem: '#demo' , cols: [[ //标题栏 { field: 'id', title: 'ID', width: 60, sort: true } , { field: 'device_no', title: '设备编号', width: 100, sort: true } , { field: 'device_name', title: '设备型号', width: 150, sort: true } , { field: 'device_type_id', title: '设备类型', width: 150, sort: true } , { field: 'kongzh_lx', title: '控制系统类型', width: 140, sort: true } , { field: 'status', title: '设备状态', width: 100, toolbar: '#statebar' } , { field: 'device_manufacture_date1', title: '出厂时间', width: 180, sort: true } , { field: 'device_purchase_date', title: '是否在保修期内', width: 100, toolbar: '#statusbar' } , { field: '', title: '操作', width: 220, toolbar: '#barDemo' } ]] , data: data.rows , even: true , page: true //是否显示分页 //,limits: [5, 7, 10] , limit: 15 //每页默认显示的数量 }); table.on('tool(demo)', function(obj){ var data = obj.data; console.log(data); if(obj.event === 'del'){ layer.confirm('真的要删除吗?', function(index) { isdelect(data.id); }); } else if(obj.event === 'edit'){ wgid = data.id; document.getElementById("ff").reset(); $("#id").attr("value",data.id); $("#customer").attr("value",data.facno); $('#device_name').val(data.device_name); $('#device_no').val(data.device_no); $('#device_home').val(data.device_home); $('#kongzh_lx').val(data.kongzh_lx); $('#device_manufacture_date1').val(data.device_manufacture_date1); $('#uuid').val(data.uuid); $('#uuidx').val(data.uuid); $('#device_keeper_id').val(data.device_keeper_id); $('#device_type_id').val(data.device_type_id); $('#note').val(data.note); $('#workcenter_no').val(data.workcenter_no); $("#ed_id").val('100'); var inputs = document.getElementsByName('device.status'); inputs[0].checked=false; inputs[1].checked=false; if(data.status=='0'){ inputs[0].checked=true; }else{ inputs[1].checked=true; } //$('#device_status').val(result.info.device_status); $('#facno').val(data.facno); $('#prono').val(data.prono); $('#title_bz').html('编辑设备'); $(".tip").fadeIn(100); $(".mengban").fadeIn(100); }else if(obj.event === 'exeprint'){ wgid = data.id; }else if(obj.event === 'caiji'){ layer.confirm('你是否真的要启用该功能?若要启用,原先的该设备的数据将丢失!!', function(index) { $('#uuidx').val(data.uuid); $('#equipcode').val(data.device_no); $('#ip').val(data.device_IP); send_uuid(data.uuid); }); } }); }); // } } });