let idParam, objParam; let details; let form, layer, table; function setParams(obj) { objParam = JSON.parse(obj); if (objParam.checkType === 2) { $('#print').before(''); } idParam = objParam.id; layui.use(['form', 'layer', 'table'], function () { form = layui.form; layer = layui.layer; table = layui.table; setCheckStatus(); getDetailById(); initTable(); }); } // 基本信息 function setPlanBasicTableInfo(obj) { $('#proName').html(obj.proName); $('#projectPart').html(obj.projectPart); $('#projectContent').html(obj.projectContent); $('#needTime').html(obj.needTime); $('#remark').html(obj.remark); } // 查询/重置 function queryTable(type) { if (type === 1) { reloadTable(1); } else if (type === 2) { $('#type').val(''); $('#model').val(''); layui.form.render(); reloadTable(1); } } // 刷新页面数据 function reloadData() { reloadTable(1); } // 重载表格 function reloadTable(pageNum) { table.reload("currentTableId", { page: { curr: pageNum ? pageNum : 1, }, where: { encryptedData: JSON.stringify({ 'type': $('#type').val(), 'model': $('#model').val(), 'id': objParam.id }), }, }, ); } // 初始化表格 function initTable() { tableIns = table.render({ elem: "#currentTableId", id: 'currentTableId', headers: { authorization: sessionStorage.getItem("gz-token"), }, height: "full", url: dataUrl + "backstage/planApplication/getPlanDetailsList", where: { encryptedData: JSON.stringify({ 'type': $('#type').val(), 'model': $('#model').val(), 'id': objParam.id }), }, request: { pageName: 'pageNum', limitName: 'pageSize' }, parseData: function (res) { // res 即为原始返回的数据 return { "code": 0, // 解析接口状态 "msg": '获取成功', // 解析提示文本 "count": res.total, // 解析数据长度 "data": res.list // 解析数据列表 }; }, cols: [ [ { width: '9.8%', title: "序号", align: "center", templet: function (d) { return d.LAY_NUM; }, }, { field: "typeName", width: '15%', title: "物机类型", unresize: true, align: "center", }, { field: "type", width: '15%', title: "物机名称", unresize: true, align: "center", }, { field: "module", width: '15%', title: "规格", unresize: true, align: "center", }, { field: "unit", width: '10%', title: "单位", unresize: true, align: "center", templet: function (d) { return setNullValue(d.unit); }, }, { field: "needNum", width: '10%', title: "需用量", unresize: true, align: "center", }, { field: "times", width: '10%', title: "需用天数", unresize: true, align: "center", }, { field: "remarks", width: '15%', title: "备注", unresize: true, align: "center", }, ], ], limits: [10, 15, 20, 25, 50, 100], limit: 10, page: true, done: function (res, curr, count) { pageNum = tableIns.config.page.curr; table.resize("currentTableId"); }, }); } // 导出 function exportData() { let params = { "id": objParam.id, 'type': $('#type').val(), 'model': $('#model').val(), } let url = dataUrl + "backstage/export/exportDetail"; exportExcelUtil(url, '机具明细', JSON.stringify(params)); } // 操作记录 function setOperRecordInfo(list, obj) { let creator = obj.creator; // 发起人 let html = ''; if (list && list.length > 0) { let imgUrl = '../../../images/user_head_icon.png'; let imgUrl2 = '../../../images/time_icon.png'; $.each(list, function (index, item) { let operData = ""; let dept = ''; let minutes = item.minutes; if (item.hours === 0 && item.minutes === 0) { minutes = 1; } if (item.auditType === '0' || item.auditType === '1') { dept = '项目部'; } else if (item.auditType === '2') { dept = '分公司'; } else if (item.auditType === '3') { dept = '项管中心'; } else if (item.auditType === '4') { dept = '机具公司'; } // 操作流程 if (item.auditType === '0') { operData = '发起申请'; } else if (item.auditType === '1') { operData = '重新提交申请'; } else if (item.auditType === '2' && item.auditStatus === '2') { operData = '审核确认通过,共耗时:' + item.hours + '小时' + minutes + '分钟 原因备注:' + item.auditRemarks + ''; } else if (item.auditType === '2' && item.auditStatus === '3') { operData = '驳回-给发起人' + creator + ',共耗时:' + item.hours + '小时' + minutes + '分钟 原因备注:' + item.auditRemarks + ''; } else if (item.auditType === '3' && item.auditStatus === '2') { operData = '审核确认通过,共耗时:' + item.hours + '小时' + minutes + '分钟 原因备注:' + item.auditRemarks + ''; } else if (item.auditType === '3' && item.auditStatus === '3') { operData = '驳回-给发起人' + creator + ',共耗时:' + item.hours + '小时' + minutes + '分钟 原因备注:' + item.auditRemarks + ''; } else if (item.auditType === '4' && item.auditStatus === '2') { operData = '完结-审核确认通过,共耗时:' + item.hours + '小时' + minutes + '分钟 原因备注:' + item.auditRemarks + ''; } else if (item.auditType === '4' && item.auditStatus === '3') { operData = '驳回-给发起人' + creator + ',共耗时:' + item.hours + '小时' + minutes + '分钟 原因备注:' + item.auditRemarks + ''; } html += '