From 89b79aac3fea51b53673f74422d5987b6424c3e7 Mon Sep 17 00:00:00 2001
From: cwchen <1048842385@qq.com>
Date: Thu, 14 Nov 2024 10:13:12 +0800
Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E7=A8=8B=E7=BB=9F=E8=AE=A1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
api/init.json | 6 +
js/accessory/child/pro_count_detail.js | 309 +++++++++++++++++++++
js/accessory/pro_count_list.js | 205 ++++++++++++++
page/accessory/child/pro_count_detail.html | 148 ++++++++++
page/accessory/pro_count_list.html | 59 ++++
5 files changed, 727 insertions(+)
create mode 100644 js/accessory/child/pro_count_detail.js
create mode 100644 js/accessory/pro_count_list.js
create mode 100644 page/accessory/child/pro_count_detail.html
create mode 100644 page/accessory/pro_count_list.html
diff --git a/api/init.json b/api/init.json
index 5240e6a..a836e86 100644
--- a/api/init.json
+++ b/api/init.json
@@ -75,6 +75,12 @@
"icon": "fa fa-home",
"target": "_self",
"child": [
+ {
+ "title": "工程统计",
+ "href": "page/accessory/pro_count_list.html",
+ "icon": "fa fa-tachometer",
+ "target": "_self"
+ },
{
"title": "配件入库",
"href": "page/accessory/accessory_store_list.html",
diff --git a/js/accessory/child/pro_count_detail.js b/js/accessory/child/pro_count_detail.js
new file mode 100644
index 0000000..10678a9
--- /dev/null
+++ b/js/accessory/child/pro_count_detail.js
@@ -0,0 +1,309 @@
+let objParam;
+let form, table, upload, tableIns, layer;
+let pageNum = 1;
+
+function setParams(params) {
+ objParam = JSON.parse(params);
+ $('#proStatus').html(setProStatus('1'));
+ $('#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: '12%',
+ title: "配件类型",
+ unresize: true,
+ align: "center",
+ },
+ {
+ field: "partName",
+ width: '12%',
+ title: "配件名称",
+ unresize: true,
+ align: "center",
+ },
+ {
+ field: "partModel",
+ title: "规格型号",
+ width: '12%',
+ unresize: true,
+ align: "center",
+ },
+ {
+ field: "partUnit",
+ title: "单位",
+ width: '8%',
+ unresize: true,
+ align: "center",
+ },
+ {
+ field: "inputNum",
+ title: "使用量",
+ width: '8%',
+ unresize: true,
+ align: "center",
+ },
+ {
+ field: "partPrice",
+ width: '8%',
+ title: "金额(元)",
+ unresize: true,
+ align: "center",
+ },
+ {
+ field: "vendName",
+ width: '8%',
+ title: "领用量",
+ unresize: true,
+ align: "center",
+ },
+ {
+ field: "vendName",
+ width: '8%',
+ title: "金额(元)",
+ unresize: true,
+ align: "center",
+ },
+ {
+ field: "remark",
+ title: "退回量",
+ width: '8%',
+ align: "center",
+ unresize: true,
+ },
+ {
+ field: "remark",
+ title: "金额(元)",
+ width: '8%',
+ 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 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 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())
+ }
+ })
+}
+
+// 工程状态
+function setProStatus(status) {
+ if (status === '1') {
+ return "●在建";
+ } else if (status === '2') {
+ return "●完工";
+ }
+}
\ No newline at end of file
diff --git a/js/accessory/pro_count_list.js b/js/accessory/pro_count_list.js
new file mode 100644
index 0000000..8cc0154
--- /dev/null
+++ b/js/accessory/pro_count_list.js
@@ -0,0 +1,205 @@
+let form, table, laydate;
+let tableIns;
+let pageNum = 1; // 定义分页
+layui.use(["form", "table", 'laydate'], function () {
+ form = layui.form;
+ table = layui.table;
+ laydate = layui.laydate;
+ laydate.render({
+ elem: '#ID-laydate-rangeLinked',
+ range: ['#startDay', '#endDay'],
+ rangeLinked: true
+ });
+ initTable();
+});
+
+// 查询/重置
+function queryTable(type) {
+ if (type === 1) {
+ reloadTable(1);
+ } else if (type === 2) {
+ $('#keyWord').val('');
+ $('#startDate').val('');
+ $('#endDate').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({
+ 'keyWord': $('#keyWord').val(),
+ 'startDate': $('#startDate').val(),
+ 'endDate': $('#endDate').val()
+ }),
+ },
+ },
+ );
+}
+
+// 初始化表格
+function initTable() {
+ tableIns = table.render({
+ elem: "#currentTableId",
+ id: 'currentTableId',
+ headers: {
+ authorization: sessionStorage.getItem("gz-token"),
+ },
+ height: "full-170",
+ url: dataUrl + "backstage/partInput/findByPage",
+ where: {
+ encryptedData: JSON.stringify({
+ 'keyWord': $('#keyWord').val(),
+ 'startDate': $('#startDate').val(),
+ 'endDate': $('#endDate').val()
+ }),
+ },
+ request: {
+ pageName: 'pageNum',
+ limitName: 'pageSize'
+ },
+ parseData: function (res) { // res 即为原始返回的数据
+ return {
+ "code": 0, // 解析接口状态
+ "msg": '获取成功', // 解析提示文本
+ "count": res.total, // 解析数据长度
+ "data": res.list // 解析数据列表
+ };
+ },
+ cols: [
+ [
+ {
+ width: '6.9%',
+ title: "序号",
+ align: "center",
+ templet: function (d) {
+ return d.LAY_NUM;
+ },
+ },
+ {
+ field: "code",
+ width: '15%',
+ title: "工程名称",
+ unresize: true,
+ align: "center",
+ },
+ {
+ field: "inputUser",
+ width: '8%',
+ title: "工程状态",
+ unresize: true,
+ align: "center",
+ templet: function (d) {
+ return setProStatus('1');
+ },
+ },
+ {
+ field: "inputNum",
+ width: '10%',
+ title: "维修单数量",
+ unresize: true,
+ align: "center",
+ templet: function (d) {
+ return '1';
+ },
+ },
+ {
+ field: "allPrice",
+ width: '10%',
+ title: "配件领料单数量",
+ unresize: true,
+ align: "center",
+ templet: function (d) {
+ return '1';
+ },
+ },
+ {
+ field: "allPrice",
+ width: '10%',
+ title: "配件退回单数量",
+ unresize: true,
+ align: "center",
+ templet: function (d) {
+ return '1';
+ },
+ },
+ {
+ field: "remark",
+ width: '15%',
+ title: "领用/使用/退回配件数量",
+ unresize: true,
+ align: "center",
+ templet: function (d) {
+ return '领:2,563
';
+ // return '领:2,563
用:2,000
退:563
';
+ },
+
+ },
+ {
+ field: "remark",
+ width: '15%',
+ title: "领用/使用/退回配件金额",
+ unresize: true,
+ align: "center",
+ templet: function (d) {
+ return '领:2,563
';
+ // return '领:2,563
用:2,000
退:563
';
+ },
+ },
+ {
+ title: "操作",
+ width: '10%',
+ align: "center",
+ unresize: true,
+ templet: function (d) {
+ let 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 exportExcel() {
+ let params = {
+ 'proName': $('#proName').val(),
+ 'status': $('#status').val()
+ }
+ let url = dataUrl + "backstage/export/exportFhList";
+ exportExcelUtil(url, '配件入库数据', JSON.stringify(params));
+}
+
+// 配件退料详情
+function proCountDetail(obj) {
+ openIframeByParamObj("pro_count_detail", "详情", "./child/pro_count_detail.html", "92%", "95%", obj);
+}
+
+// 工程状态
+function setProStatus(status) {
+ if (status === '1') {
+ return "●在建";
+ } else if (status === '2') {
+ 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
new file mode 100644
index 0000000..b0467da
--- /dev/null
+++ b/page/accessory/child/pro_count_detail.html
@@ -0,0 +1,148 @@
+
+
+
+
+
+
+ 配件入库记录
+
+
+
+
+
+
+
+
+
+
+
+

+
+
+
+
+
+
+
+
+
+
+
+ | 领用数量 |
+ 领用成本价格(元) |
+ 退回数量 |
+ 退回成本价格(元) |
+ 使用数量 |
+ 使用成本价格(元) |
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+
+
+
+
+
+ | 文件名 |
+ 文件类型 |
+ 上传人员 |
+ 上传时间 |
+ 操作 |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/page/accessory/pro_count_list.html b/page/accessory/pro_count_list.html
new file mode 100644
index 0000000..926a48a
--- /dev/null
+++ b/page/accessory/pro_count_list.html
@@ -0,0 +1,59 @@
+
+
+
+
+
+ 工程统计
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file