From c5973f18744b1f9dc384eb4d7bef8dcd9ef352fa Mon Sep 17 00:00:00 2001 From: cwchen <1048842385@qq.com> Date: Wed, 13 Nov 2024 18:42:18 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9B=98=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/accessory/child/accessory_return_detail.js | 2 +- js/accessory/child/accessory_store_detail.js | 2 +- js/accessory/child/inventory_count_detail.js | 395 ++++++++++++++++++ js/basic/child/fit_type_form.js | 8 + js/demandPlan/child/delivery_batch_list.js | 2 +- .../child/inventory_count_detail.html | 154 +++++++ page/basic/child/fit_type_form.html | 4 +- 7 files changed, 562 insertions(+), 5 deletions(-) create mode 100644 js/accessory/child/inventory_count_detail.js create mode 100644 page/accessory/child/inventory_count_detail.html diff --git a/js/accessory/child/accessory_return_detail.js b/js/accessory/child/accessory_return_detail.js index c784ed6..d2ddad0 100644 --- a/js/accessory/child/accessory_return_detail.js +++ b/js/accessory/child/accessory_return_detail.js @@ -253,7 +253,7 @@ function viewGs(obj) { move: false, btnAlign: 'c', // 按钮居中显示 btn1: function () { - exeCommandCopyText(obj.gs); + exeCommandCopyText(obj.info); }, btn2: function () { layer.close(); diff --git a/js/accessory/child/accessory_store_detail.js b/js/accessory/child/accessory_store_detail.js index 7d97f9a..6e0a22c 100644 --- a/js/accessory/child/accessory_store_detail.js +++ b/js/accessory/child/accessory_store_detail.js @@ -267,7 +267,7 @@ function viewGs(obj) { move: false, btnAlign: 'c', // 按钮居中显示 btn1: function () { - exeCommandCopyText(obj.gs); + exeCommandCopyText(obj.info); }, btn2: function () { layer.close(); diff --git a/js/accessory/child/inventory_count_detail.js b/js/accessory/child/inventory_count_detail.js new file mode 100644 index 0000000..6cc1ecf --- /dev/null +++ b/js/accessory/child/inventory_count_detail.js @@ -0,0 +1,395 @@ +let objParam; +let form, table, upload, tableIns, layer; +let pageNum = 1; + +function setParams(params) { + objParam = JSON.parse(params); + $('#code').html(objParam.code); + $('#titleName').html(objParam.inputDay + '配件盘点记录'); + layui.use(["form", "table", 'upload', 'layer'], function () { + form = layui.form; + table = layui.table; + upload = layui.upload; + 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: '7.9%', + title: "序号", + align: "center", + templet: function (d) { + return d.LAY_NUM; + }, + }, + { + field: "partType", + width: '8%', + title: "配件类型", + unresize: true, + align: "center", + }, + { + field: "partName", + width: '8%', + title: "配件名称", + unresize: true, + align: "center", + }, + { + field: "partModel", + title: "规格型号", + width: '8%', + unresize: true, + align: "center", + }, + { + field: "partUnit", + title: "平均单价(元)", + width: '10%', + unresize: true, + align: "center", + }, + { + field: "partUnit", + title: "单位", + width: '8%', + unresize: true, + align: "center", + }, + { + field: "vendName", + width: '10%', + title: "库存量", + unresize: true, + align: "center", + templet: function (d) { + return setNumColor(1,1); + }, + }, + { + field: "vendName", + width: '10%', + title: "本次盘点量", + unresize: true, + align: "center", + templet: function (d) { + return setNumColor(2,2); + }, + }, + { + field: "vendName", + width: '10%', + title: "盘盈量", + unresize: true, + align: "center", + templet: function (d) { + return setNumColor(3,3); + }, + }, + { + field: "vendName", + width: '10%', + title: "盘亏量", + unresize: true, + align: "center", + templet: function (d) { + return setNumColor(4,4); + }, + }, + { + field: "remark", + title: "备注", + width: '10%', + 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; + table.resize("currentTableId"); + }, + }); +} +// 发货状态颜色 +function setNumColor(value, type) { + value = value ? parseInt(value) : 0; + let color = "#19be6b"; + let name = '' + if (type === 1) { + color = "#19be6b"; + } else if (type === 2) { + color = "#409eff"; + } else if (type === 3) { + color = "#19be6b"; + } else if (type === 4) { + color = "#f56c6c"; + } + return '' + value + ""; +} + + +// 导出 +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.info); + }, + btn2: function () { + layer.close(); + }, + }); +} + +function viewGs2(obj) { + layer.open({ + type: 1, + shade: false, // 不显示遮罩 + content: '
盘盈:喷漆:165=>180, 防撞条:210=>280, 晾衣杆:12=>18, 挡水胶:7=>80,洗菜盆:2=>10, 主控楼隔板:10=>18, 不锈钢踢脚板:3=>18,喷漆:165=>180, 喷漆:165=>180, 防撞条:210=>280, 晾衣杆:12=>18, 挡水胶:7=>80,洗菜盆:2=>10, 主控楼隔板:10=>18, 不锈钢踢脚板:3=>18 。
盘亏:喷漆:165=>100, 防撞条:210=>200, 晾衣杆:12=>10, 挡水胶:7=>1,洗菜盆:2=>0, 主控楼隔板:10=>8, 不锈钢踢脚板:3=>1,喷漆:165=>120, 喷漆:165=>110, 防撞条:210=>180, 晾衣杆:12=>11, 挡水胶:7=>2,洗菜盆:2=>1, 主控楼隔板:10=>3, 不锈钢踢脚板:3=>1 。
', + title: '

' + obj.inputDay + '盘点概述:

', + btn: ['复制文字', '关闭'], + area: ['60%', '50%'], + move: false, + btnAlign: 'c', // 按钮居中显示 + btn1: function () { + exeCommandCopyText(obj.info); + }, + 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/js/basic/child/fit_type_form.js b/js/basic/child/fit_type_form.js index f0a11d1..9a679b1 100644 --- a/js/basic/child/fit_type_form.js +++ b/js/basic/child/fit_type_form.js @@ -4,10 +4,18 @@ function setParams(obj) { objParam = JSON.parse(obj); console.log(objParam); if (objParam.type === 2) { // 修改 + if (objParam.level === '4') { + $('#unit').attr('lay-verify', 'required'); + $('#unitLabel').addClass('required'); + } $('#id').val(objParam.nodeId); $('#parentId').val(objParam.parentId); getDetailById(); } else if (objParam.type === 1) { // 新增 + if (objParam.level === '3') { + $('#unit').attr('lay-verify', 'required'); + $('#unitLabel').addClass('required'); + } $('#parentName').val(objParam.context); $('#parentId').val(objParam.nodeId); } diff --git a/js/demandPlan/child/delivery_batch_list.js b/js/demandPlan/child/delivery_batch_list.js index 449cff6..54b56ff 100644 --- a/js/demandPlan/child/delivery_batch_list.js +++ b/js/demandPlan/child/delivery_batch_list.js @@ -309,7 +309,7 @@ function viewGs(obj) { move: false, btnAlign: 'c', // 按钮居中显示 btn1: function () { - exeCommandCopyText(obj.gs); + exeCommandCopyText(obj.details); }, btn2: function () { layer.close(); diff --git a/page/accessory/child/inventory_count_detail.html b/page/accessory/child/inventory_count_detail.html new file mode 100644 index 0000000..3f6a0d7 --- /dev/null +++ b/page/accessory/child/inventory_count_detail.html @@ -0,0 +1,154 @@ + + + + + + + 库存盘点详情 + + + + + + + + +
+
+
+ +
+

+

+
+
+
+ +
+
+
+
+ +

基本信息

+
+
+ + + + + + + + + + + + + + + + + + + + + +
盘点编号(系统自动生成)盘点变化量盘点人盘点开始日期盘点结束日期
备注
+
+
+
+
+ +

附件文档

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

盘点明细

+
+
+
+
+ 搜索信息 +
+
+
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+ + + +
+
+
+
+
+
+
+
+
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/page/basic/child/fit_type_form.html b/page/basic/child/fit_type_form.html index 6183278..a1f14d3 100644 --- a/page/basic/child/fit_type_form.html +++ b/page/basic/child/fit_type_form.html @@ -42,10 +42,10 @@
- +
+ maxlength="30" lay-affix="clear">