From e26da776f1a05debc211f2cbd445d5d983770ef7 Mon Sep 17 00:00:00 2001 From: cwchen <1048842385@qq.com> Date: Wed, 13 Nov 2024 13:36:20 +0800 Subject: [PATCH] =?UTF-8?q?=E9=85=8D=E4=BB=B6=E5=87=BA=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/accessory/accessory_out_bound_list.js | 22 +- .../child/accessory_out_bound_detail.js | 336 ++++++++++++++++++ .../child/accessory_out_bound_detail.html | 152 ++++++++ 3 files changed, 494 insertions(+), 16 deletions(-) create mode 100644 js/accessory/child/accessory_out_bound_detail.js diff --git a/js/accessory/accessory_out_bound_list.js b/js/accessory/accessory_out_bound_list.js index 0dd1b36..e8fca83 100644 --- a/js/accessory/accessory_out_bound_list.js +++ b/js/accessory/accessory_out_bound_list.js @@ -146,9 +146,9 @@ function initTable() { unresize: true, templet: function (d) { let html = ""; - html += "详情"; - html += "
|
审核"; - html += "
|
出库"; + html += "详情"; + html += "
|
审核"; + html += "
|
出库"; return html; }, }, @@ -186,18 +186,8 @@ function exportExcel() { exportExcelUtil(url, '配件入库数据', JSON.stringify(params)); } -// 配件入库 -function accessoryStore(type, obj) { +// 详情 审核 出库确认 +function accessoryOutBoundDetail(obj, type) { obj.type = type; - openIframeByParamObj("accessory_store", "配件到货入库", "../accessory/child/accessory_store_form.html", "92%", "95%", obj); -} - -// 配件入库详情 -function accessoryStoreDetail(obj) { - openIframeByParamObj("accessory_store_detail", "配件到货入库", "../accessory/child/accessory_store_detail.html", "92%", "95%", obj); -} - -// 配件入库编辑 -function accessoryStoreEdit(obj) { - openIframeByParamObj("accessory_store_edit", "配件到货入库编辑", "../accessory/child/accessory_store_edit_form.html", "92%", "95%", obj); + openIframeByParamObj("accessory_out_bound_detail", "配件出库记录", "../accessory/child/accessory_out_bound_detail.html", "92%", "95%", obj); } \ No newline at end of file diff --git a/js/accessory/child/accessory_out_bound_detail.js b/js/accessory/child/accessory_out_bound_detail.js new file mode 100644 index 0000000..d7c4818 --- /dev/null +++ b/js/accessory/child/accessory_out_bound_detail.js @@ -0,0 +1,336 @@ +let objParam; +let form, table, element, tableIns, layer; +let pageNum = 1; + +function setParams(params) { + objParam = JSON.parse(params); + console.error(objParam); + $('#code').html(objParam.code); + $('#titleName').html(objParam.inputDay + '配件入库记录'); + layui.use(["form", "table", 'element', 'layer'], function () { + form = layui.form; + table = layui.table; + element = layui.element; + layer = layui.layer; + getInputDetails(); + initTable(); + }); +} + +// 获取配件到货入库详情 +function getInputDetails() { + let params = { + encryptedData: JSON.stringify({ + 'id': objParam.id + }) + }; + let url = dataUrl + 'backstage/partInput/getInputDetails'; + ajaxRequest(url, "POST", params, true, function () { + }, function (result) { + console.error(result); + if (result.code === 200) { + setTableData(result.data); + } else { + } + }, function (xhr, status, error) { + errorFn(xhr, status, error) + }, 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); + } +} + +// 附件文档赋值 +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(); + let src = ''; + if (value.indexOf('docx') > -1 || value.indexOf('doc') > -1) { + src = '../../../images/docx.png' + } else if (value.indexOf('xls') > -1 || value.indexOf('xlsx') > -1) { + src = '../../../images/xlsx.png' + } else if (value.indexOf('pdf') > -1) { + src = '../../../images/pdf.png' + } else if (value.indexOf('png') > -1 || value.indexOf('jpg') > -1 || value.indexOf('jpeg') > -1) { + src = '../../../images/img_icon.png' + } + return '' +} + +// 查询/重置 +function queryTable(type) { + if (type === 1) { + reloadTable(1); + } else if (type === 2) { + $('#type').val(''); + $('#name').val(''); + $('#model').val(''); + layui.form.render(); + reloadTable(1); + } +} + +// 刷新页面数据 +function reloadData() { + reloadData(pageNum); +} + +// 重载表格 +function reloadTable(pageNum) { + table.reload("currentTableId", { + page: { + curr: pageNum ? pageNum : 1, + }, + where: { + encryptedData: JSON.stringify({ + 'type': $('#type').val(), + 'name': $('#name').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/partInput/getInputDetailListByPage", + where: { + encryptedData: JSON.stringify({ + 'type': $('#type').val(), + 'name': $('#name').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: '8%', + title: "序号", + align: "center", + templet: function (d) { + return d.LAY_NUM; + }, + }, + { + field: "partType", + width: '10%', + title: "配件类型", + unresize: true, + align: "center", + }, + { + field: "partName", + width: '10%', + title: "配件名称", + unresize: true, + align: "center", + }, + { + field: "partModel", + title: "规格型号", + width: '10%', + unresize: true, + align: "center", + }, + { + field: "partUnit", + title: "单位", + width: '10%', + unresize: true, + align: "center", + }, + { + field: "inputNum", + title: "入库量", + width: '10%', + unresize: true, + align: "center", + }, + { + field: "partPrice", + width: '10%', + title: "单价(元)", + unresize: true, + align: "center", + }, + { + field: "vendName", + width: '15%', + title: "配件厂家", + unresize: true, + align: "center", + }, + { + field: "remark", + title: "备注", + width: '17%', + align: "center", + unresize: true, + }, + ], + ], + limits: [10, 15, 20, 25, 50, 100], + limit: 10, + page: true, + done: function (res, curr, count) { + pageNum = tableIns.config.page.curr; + element.render(); + table.resize("currentTableId"); + }, + }); +} + + +// 导出 +function exportExcel() { + let params = { + '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)); +} + +// 打印 +function print() { + Print('#table-box', { + onStart: function () { + console.log('onStart', new Date()) + }, + onEnd: function () { + console.log('onEnd', new Date()) + } + }) +} + +// 查看概述 +function viewGs(obj) { + layer.open({ + type: 1, + shade: false, // 不显示遮罩 + content: '
' + obj.info + '
', + title: '

' + obj.inputDay + '入库概述:

', + btn: ['复制文字', '关闭'], + area: ['60%', '50%'], + move: false, + btnAlign: 'c', // 按钮居中显示 + btn1: function () { + exeCommandCopyText(obj.gs); + }, + btn2: function () { + layer.close(); + }, + }); +} + +// 复制文字 +function exeCommandCopyText(text) { + try { + const t = document.createElement('textarea') + t.nodeValue = text + t.value = text + document.body.appendChild(t) + t.select() + document.execCommand('copy'); + document.body.removeChild(t) + layer.msg('复制成功', { icon: 1 }); + } catch (e) { + console.log(e) + layer.msg('复制失败', { icon: 2 }); + } +} + +// 预览文件 +function viewFile(obj) { + let fileName = obj.fileName.toLowerCase(); + if (fileName.indexOf('png') || fileName.indexOf('jpg') || fileName.indexOf('jpeg')) { + layer.photos({ + shade: 0.5, + photos: { + "title": "图片预览", + "start": 0, + "data": [ + { + "alt": "layer", + "pid": 1, + "src": fileUrl + obj.fileUrl + '?token=' + sessionStorage.getItem("gz-token"), + } + ] + } + }); + } else { + // 调用公司的预览文件的服务 + } +} + +// 下载文件 +function downLoadFile(obj) { + console.log(obj); + let url = dataUrl + "backstage/export/download?fileId=" + obj.id; + downLoadFileUtil(url, obj.fileName, null); +} + +// 打印 +function print() { + Print('#body', { + onStart: function () { + console.log('onStart', new Date()) + }, + onEnd: function () { + console.log('onEnd', new Date()) + } + }) +} \ No newline at end of file diff --git a/page/accessory/child/accessory_out_bound_detail.html b/page/accessory/child/accessory_out_bound_detail.html index e69de29..7df1a09 100644 --- a/page/accessory/child/accessory_out_bound_detail.html +++ b/page/accessory/child/accessory_out_bound_detail.html @@ -0,0 +1,152 @@ + + + + + + + 配件入库记录 + + + + + + + + +
+
+
+ +
+

2024-05-05配件入库记录

+

+
+
+
+ +
+
+
+
+ +

基本信息

+
+
+ + + + + + + + + + + + + + + + + + + + + +
入库编号(系统自动生成)入库数量成本价格(元)入库人入库日期
备注
+
+
+
+
+ +

附件文档

+
+
+ + + + + + + + +
文件名文件类型上传人员上传时间操作
+
+
+
+
+ +

入库明细

+
+
+
+
+ 搜索信息 +
+
+
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+ + + +
+
+
+
+
+
+
+
+
+
+
+
+ + + + + + + + \ No newline at end of file