diff --git a/js/accessory/child/pro_count_detail.js b/js/accessory/child/pro_count_detail.js index 10678a9..58e19f7 100644 --- a/js/accessory/child/pro_count_detail.js +++ b/js/accessory/child/pro_count_detail.js @@ -4,8 +4,8 @@ let pageNum = 1; function setParams(params) { objParam = JSON.parse(params); - $('#proStatus').html(setProStatus('1')); - $('#titleName').html(objParam.inputDay + '配件记录'); + $('#proStatus').html(setProStatus(objParam.proStatus)); + $('#titleName').html(objParam.proName + '配件记录'); layui.use(["form", "table", 'upload', 'layer'], function () { form = layui.form; table = layui.table; @@ -13,6 +13,7 @@ function setParams(params) { layer = layui.layer; getInputDetails(); initTable(); + initFileTable(); }); } @@ -20,10 +21,10 @@ function setParams(params) { function getInputDetails() { let params = { encryptedData: JSON.stringify({ - 'id': objParam.id + 'proId': objParam.proId }) }; - let url = dataUrl + 'backstage/partInput/getInputDetails'; + let url = dataUrl + 'backstage/statistic/getProDetails'; ajaxRequest(url, "POST", params, true, function () { }, function (result) { console.error(result); @@ -36,38 +37,11 @@ function getInputDetails() { }, null); // 基本数据表格赋值 function setTableData(obj) { - $('#codeValue').html(obj.code); - $('#inputNum').html(obj.inputNum); - $('#allPrice').html(obj.allPrice); - $('#inputUser').html(obj.inputUser); - $('#inputDay').html(obj.inputDay); - $('#remark').html(obj.remark); - setFileTable(obj.fileList); + $('#lyNum').html(obj.lyNum); + $('#lyMoney').html(obj.lyMoney); } } -// 附件文档赋值 -function setFileTable(fileList) { - $('#file-table tbody tr:not(:first)').remove(); - let html = ''; - if (fileList && fileList.length > 0) { - $.each(fileList, function (index, item) { - html += '' + - '' + handleFileType(item.fileName) + item.fileName + '' + - '' + (item.suffix.replace('.', '')) + '' + - '' + item.createName + '' + - '' + item.createTime + '' + - '预览' + - '下载' + - '' + - ''; - }) - } else { - html = '暂无数据'; - } - $('#file-table tbody').after(html); -} - // 处理文件类型 function handleFileType(value) { value = value.toLowerCase(); @@ -84,6 +58,103 @@ function handleFileType(value) { return '' } + +function initFileTable() { + tableIns = table.render({ + elem: "#currentTableIdByFile", + id: 'currentTableIdByFile', + headers: { + authorization: sessionStorage.getItem("gz-token"), + }, + height: "full", + url: dataUrl + "backstage/statistic/getProDetailsFilePage", + where: { + encryptedData: JSON.stringify({ + 'proId': objParam.proId + }), + }, + request: { + pageName: 'pageNum', + limitName: 'pageSize' + }, + parseData: function (res) { // res 即为原始返回的数据 + return { + "code": 0, // 解析接口状态 + "msg": '获取成功', // 解析提示文本 + "count": res.total, // 解析数据长度 + "data": res.list // 解析数据列表 + }; + }, + cols: [ + [ + { + width: '10%', + title: "序号", + align: "center", + templet: function (d) { + return d.LAY_NUM; + }, + }, + { + field: "fileName", + width: '20%', + title: "文件名", + unresize: true, + align: "center", + templet: function (d) { + return handleFileType(d.fileName) + d.fileName; + }, + }, + { + field: "type", + width: '10%', + title: "文件类型", + unresize: true, + align: "center", + }, + { + field: "createName", + title: "上传人员", + width: '20%', + unresize: true, + align: "center", + templet: function (d) { + return '' + d.createName; + }, + }, + { + field: "createTime", + title: "上传时间", + width: '20%', + unresize: true, + align: "center", + }, + { + field: "inputNum", + title: "操作", + width: '20%', + unresize: true, + align: "center", + templet: function (d) { + let html = ""; + html += "预览"; + html += "下载"; + return html; + }, + }, + ], + ], + 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 queryTable(type) { if (type === 1) { @@ -113,7 +184,7 @@ function reloadTable(pageNum) { 'type': $('#type').val(), 'name': $('#name').val(), 'model': $('#model').val(), - 'id': objParam.id + 'proId': objParam.proId }), }, }, @@ -129,13 +200,13 @@ function initTable() { authorization: sessionStorage.getItem("gz-token"), }, height: "full", - url: dataUrl + "backstage/partInput/getInputDetailListByPage", + url: dataUrl + "backstage/statistic/getProDetailsPage", where: { encryptedData: JSON.stringify({ 'type': $('#type').val(), 'name': $('#name').val(), 'model': $('#model').val(), - 'id': objParam.id + 'proId': objParam.proId }), }, request: { @@ -246,14 +317,13 @@ function initTable() { // 导出 function exportExcel() { let params = { + 'type': $('#type').val(), 'name': $('#name').val(), 'module': $('#module').val(), 'proId': objParam.proId, - 'id': id, - 'curryDay': time } - let url = dataUrl + "backstage/export/exportPcList"; - exportExcelUtil(url, '发货详情-批次-' + time, JSON.stringify(params)); + let url = dataUrl + "backstage/statistic/exportProDetailsPage"; + exportExcelUtil(url, '配件明细', JSON.stringify(params)); } @@ -305,5 +375,7 @@ function setProStatus(status) { return "在建"; } else if (status === '2') { return "完工"; + } else { + return ''; } } \ No newline at end of file diff --git a/page/accessory/child/pro_count_detail.html b/page/accessory/child/pro_count_detail.html index a3dcac4..d34c0c7 100644 --- a/page/accessory/child/pro_count_detail.html +++ b/page/accessory/child/pro_count_detail.html @@ -4,7 +4,7 @@ - 库存盘点记录 + 工程配件记录 @@ -61,8 +61,8 @@ 使用成本价格(元) - - + + @@ -77,7 +77,10 @@

附件文档

- +
+
+
+