apiready = function() { var ctrl = { logId: null, init: {}, //初始化 bind: {}, //事件绑定 toast: {}, //弹出提示框 getInspectLogDetail: {}, //获取巡检日志详情 renderInspectLogDetail: {}, //渲染巡检日志详情 type: { common: 1, // 一般 recheck: 3, // 复检 burst: 2 // 突发 } } ctrl.init = function() { // 适配安卓状态栏 CommonModel.fitInStatusBar(); this.logId = api.pageParam.id; this.prName = api.pageParam.prname || ''; // 此配电室名是从“巡检安排”“已完成”查看详情跳转时传递的参数 ctrl.bind(); ctrl.getInspectLogDetail(); var pr = $api.getStorage('powerRoom'); $("#pr-name").text(this.prName || pr.prName); $("#power-name").text(this.prName || pr.prName); ctrl.initGuideTab(); } ctrl.bind = function() { //点击返回按钮 $api.addEvt($api.dom("#back"), "touchend", function() { api.closeWin(); }) // 跳转到工单详情 $("#problem-list").on("touchend", ".detail-btn", function () { var id = $(this).data('id'); api.openWin({ 'name': 'systemOrderDetail', 'url': 'widget://html/feature/logQuery/inspectBug.html', 'pageParam': { id: id } }) }) // 点击设备分类,自动折叠当前分类的巡检项 $(".container").on("touchend", ".category-name", function () { // 隐藏 当前分类的巡检项 $api.toggleCls($(this).next()[0], 'hide'); // 分类名前的箭头旋转90度 $api.toggleCls($api.dom(this, 'img'), 'transform'); }); } /** * 弹出提示框 */ ctrl.toast = function(msg) { api.toast({ msg: msg, duration: 3000, locaiton: 'top' }); } // 获取日志详情 ctrl.getInspectLogDetail = function() { var url = '/test/xun-jian-pr/queryById/' + this.logId; $api.get(url, function(res, err) { if (err) { ctrl.toast("网络请求失败"); } else { if (res.code == 200 && res.data) { ctrl.renderDetail(res.data); } else { ctrl.toast("服务器响应错误" + (res.code ? (",错误码:" + res.code) : "")); } } }); } // 渲染日志详情 ctrl.renderDetail = function (data) { $('#complete-time').text(data.wanChengShiJian); $('#weather').text(data.tianQi); $('#person').text(data.xunJianRen); $('#remark').text(data.beiZhu); // 渲染设备缺陷列表 ctrl.renderProblemList(data.xjProblems); } // 渲染问题列表 ctrl.renderProblemList = function (list) { var length = list.length; var listContenDom = $('#problem-list'); listContenDom.empty(); if (length) { var dom = ctrl.creatProblemListDom(list); listContenDom.html(dom); } else { listContenDom.html('