diff --git a/WebContent/WEB-INF/views/ma/machineTypeformNew.jsp b/WebContent/WEB-INF/views/ma/machineTypeformNew.jsp new file mode 100644 index 0000000..804bf06 --- /dev/null +++ b/WebContent/WEB-INF/views/ma/machineTypeformNew.jsp @@ -0,0 +1,392 @@ +<%@ page contentType="text/html;charset=UTF-8" %> + + + +
+
+ + + + + + + + + + + + + + +
+ +
+ * 设备类型: + + +
设备标签: + + +
+
+
+ + +
+
+ + + + + + + + + + + + + + + + + + +
+ +
+ * 设备类型: + + +
+ * 库存预警值: + + + + 💡 当库存低于此值时将触发预警提示 + +
设备标签: + + +
+
+
+ + +
+
+ + + + + + + + + + +
+ +
+ * 库存预警值: + + + + 💡 此设置将应用于所有机具类型的库存预警 + +
+
+
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ * 机具类型: + + +
+ * 规格型号: + + +
+ * 数量: + + +
计量单位: + +
+ * 租赁价格(元): + + +
+ * 丢失赔偿价格(元): + + +
+ * 购置价格(元): + + +
是否只计数: + + +
+
+
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ 机具类型: + + +
+ * 规格型号: + + +
+ * 数量: + + +
计量单位: + +
+ * 租赁价格(元): + + +
+ * 丢失赔偿价格(元): + + +
+ * 购置价格(元): + + +
是否只计数: + + +
+
+
+ diff --git a/WebContent/WEB-INF/views/ma/machineTypelistNew.jsp b/WebContent/WEB-INF/views/ma/machineTypelistNew.jsp new file mode 100644 index 0000000..09e14db --- /dev/null +++ b/WebContent/WEB-INF/views/ma/machineTypelistNew.jsp @@ -0,0 +1,573 @@ +<%@ page contentType="text/html;charset=UTF-8" %> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> + + + +<%@include file="../baseset.jsp" %> +<%@include file="../systemset.jsp" %> + + + + + + + + +
+ + + + +
+ +
+
+
+

机具类型结构

+
+ + +
+
+ + +
+
+ + + +
+
+ +
    +
    +
    + + +
    +
    +
    +
    + + 规格型号列表 + 请选择机具类型 +
    +
    + +
    +
    + + +
    + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + +
    序号物资类型物资名称规格型号数量单位租赁价格(元)丢失赔偿价购置价(元)操作
    + + +
    +
    +
    +
      +
      +
      +
      +
      +
      +
      + + + <%@include file="./machineTypeformNew.jsp" %> + <%@include file="../dialog.jsp" %> +
      + + + + + diff --git a/WebContent/WEB-INF/views/ma/machinelist.jsp b/WebContent/WEB-INF/views/ma/machinelist.jsp index 56bba3b..906e4aa 100644 --- a/WebContent/WEB-INF/views/ma/machinelist.jsp +++ b/WebContent/WEB-INF/views/ma/machinelist.jsp @@ -54,9 +54,7 @@ 购置价格 固定资产 固定编号 - 原编号 设备编码 - 资产属性 出厂日期 合格证 技术材料 diff --git a/WebContent/WEB-INF/views/ma/machinelistEdit.jsp b/WebContent/WEB-INF/views/ma/machinelistEdit.jsp index 3631852..52899c2 100644 --- a/WebContent/WEB-INF/views/ma/machinelistEdit.jsp +++ b/WebContent/WEB-INF/views/ma/machinelistEdit.jsp @@ -57,9 +57,8 @@ 购置价格 固定资产 固定编号 - 原编号 设备编码 - 资产属性 + 出厂日期 合格证 技术材料 改造手续 @@ -67,7 +66,7 @@ 二维码 机具状态 备注 - 操作 + 操作 diff --git a/WebContent/WEB-INF/views/ma/typeDetailslist.jsp b/WebContent/WEB-INF/views/ma/typeDetailslist.jsp index d015ee5..525e71a 100644 --- a/WebContent/WEB-INF/views/ma/typeDetailslist.jsp +++ b/WebContent/WEB-INF/views/ma/typeDetailslist.jsp @@ -38,7 +38,7 @@ 单位 租赁价格(元) 丢失赔偿价格(元) - 原值(元) + 购置价(元) 操作人 文件是否上传 备注 diff --git a/WebContent/WEB-INF/views/rm/unFinishWorkList.jsp b/WebContent/WEB-INF/views/rm/unFinishWorkList.jsp index 6b28e46..8cdcce7 100644 --- a/WebContent/WEB-INF/views/rm/unFinishWorkList.jsp +++ b/WebContent/WEB-INF/views/rm/unFinishWorkList.jsp @@ -24,14 +24,17 @@
      -   任务状态: - - - +    + + +
      @@ -138,6 +141,16 @@ getbaseList(1); } + function viewFlowChart() { + layer.open({ + type: 1, + title: false, + area: ['647px', '510px'], + shadeClose: true, + content: '流程图' + }); + } + $(function() { // 页面加载完成后立即获取待办列表 getbaseList(1); diff --git a/WebContent/static/css/sys/basic.css b/WebContent/static/css/sys/basic.css index c53df59..b1d25b6 100644 --- a/WebContent/static/css/sys/basic.css +++ b/WebContent/static/css/sys/basic.css @@ -1,5 +1,10 @@ @CHARSET "UTF-8"; body{background-color:#FFFFFF} +/* 去掉表格斑马线效果 */ +.table-striped>tbody>tr:nth-child(odd)>td, +.table-striped>tbody>tr:nth-child(odd)>th { + background-color: #fff !important; +} .row .form-inline select{font-weight: bold;color: #707070;} .form-inline label{font-weight: bold;color: #707070;} .font-bold{font-weight: bold;} @@ -9,7 +14,176 @@ form .isSelect135{width:135px;}form .isSelect125{width:125px;}form .isSelect115{ form .isSelect105{width:105px;}form .isSelect95{width:95px;}form .isSelect85{width:85px;} form .isSelect75{width:75px;}form .isSelect65{width:65px;}form .isSelect55{width:55px;} button, input, select, textarea {margin: 1px;} -.dataTables_paginate .pagination .choseJPage{height:30px;width:55px;text-align:center;float:left;} + +/* ========== 现代化分页组件设计 ========== */ +.dataTables_paginate { + padding: 15px 0; + text-align: right; +} + +.dataTables_paginate .pagination { + display: inline-flex; + align-items: center; + gap: 8px; + padding: 0; + margin: 0; + list-style: none; + flex-wrap: wrap; + justify-content: center; +} + +.dataTables_paginate .pagination > li { + display: inline-block; + margin: 0; +} + +/* 页码链接和文本样式 */ +.dataTables_paginate .pagination > li > a, +.dataTables_paginate .pagination > li > span { + display: inline-flex; + align-items: center; + justify-content: center; + min-width: 36px; + height: 36px; + padding: 0 8px; + font-size: 14px; + font-weight: 500; + color: #333; + background-color: #f5f5f5; + border: 1px solid #e0e0e0; + border-radius: 4px; + cursor: pointer; + transition: all 0.3s ease; + text-decoration: none; + line-height: 1; +} + +.dataTables_paginate .pagination > li > a:hover { + background-color: #e8e8e8; + border-color: #d0d0d0; + color: #000; +} + +.dataTables_paginate .pagination > li > a:active { + background-color: #ddd; +} + +/* 当前页码样式 */ +.dataTables_paginate .pagination > li.active > a, +.dataTables_paginate .pagination > li.active > span { + background-color: #428bca; + border-color: #428bca; + color: #fff; + font-weight: 600; +} + +.dataTables_paginate .pagination > li.active > a:hover { + background-color: #3276b1; + border-color: #3276b1; +} + +/* 禁用状态 */ +.dataTables_paginate .pagination > li.disabled > a, +.dataTables_paginate .pagination > li.disabled > span { + color: #999; + background-color: #f9f9f9; + border-color: #e0e0e0; + cursor: not-allowed; + opacity: 0.6; +} + +.dataTables_paginate .pagination > li.disabled > a:hover { + background-color: #f9f9f9; + border-color: #e0e0e0; + color: #999; +} + +/* 页码输入框 */ +.dataTables_paginate .pagination .choseJPage { + height: 36px; + width: 60px; + padding: 6px 8px; + font-size: 14px; + text-align: center; + border: 1px solid #e0e0e0; + border-radius: 4px; + background-color: #fff; + color: #333; + transition: all 0.3s ease; +} + +.dataTables_paginate .pagination .choseJPage:focus { + outline: none; + border-color: #428bca; + box-shadow: 0 0 0 3px rgba(66, 139, 202, 0.1); +} + +/* 跳转按钮 */ +.dataTables_paginate .pagination .btn { + height: 36px; + padding: 0 16px; + font-size: 14px; + font-weight: 500; + border-radius: 4px; + border: none; + cursor: pointer; + transition: all 0.3s ease; + margin: 0; +} + +.dataTables_paginate .pagination .btn-success { + background-color: #5cb85c; + color: #fff; +} + +.dataTables_paginate .pagination .btn-success:hover { + background-color: #4cae4c; +} + +.dataTables_paginate .pagination .btn-success:active { + background-color: #449d44; +} + +/* 条数下拉框 */ +.dataTables_paginate .pagination select { + height: 36px; + padding: 6px 8px; + font-size: 14px; + border: 1px solid #e0e0e0; + border-radius: 4px; + background-color: #fff; + color: #333; + cursor: pointer; + transition: all 0.3s ease; + appearance: none; + background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e"); + background-repeat: no-repeat; + background-position: right 8px center; + background-size: 16px; + padding-right: 28px; +} + +.dataTables_paginate .pagination select:focus { + outline: none; + border-color: #428bca; + box-shadow: 0 0 0 3px rgba(66, 139, 202, 0.1); +} + +/* 分页信息文本 */ +.dataTables_paginate .pagination > li > span { + background-color: transparent; + border: none; + color: #666; + font-weight: normal; + cursor: default; + padding: 0 4px; +} + +.dataTables_paginate .pagination > li > span:hover { + background-color: transparent; + border: none; + color: #666; +} .aBtnNoTD{cursor:pointer;text-decoration:none;} .aBtnNoTD:hover{cursor: pointer;text-decoration:none;} .aBtnNoTD:focus{cursor: pointer;text-decoration:none;} diff --git a/WebContent/static/img/flowchart.png b/WebContent/static/img/flowchart.png new file mode 100644 index 0000000..761c6ef Binary files /dev/null and b/WebContent/static/img/flowchart.png differ diff --git a/WebContent/static/js/ma/machine.js b/WebContent/static/js/ma/machine.js index 22c36b1..0a25e20 100644 --- a/WebContent/static/js/ma/machine.js +++ b/WebContent/static/js/ma/machine.js @@ -196,9 +196,7 @@ function getbaseList(index) { html += "是"; } html += ""+ JY.Object.notEmpty(l.assetNum) + ""; - html += ""+ JY.Object.notEmpty(l.originNum) + ""; html += ""+ JY.Object.notEmpty(l.deviceCode) + ""; - html += ""+ JY.Object.notEmpty(l.companyName) + ""; html += ""+ JY.Object.notEmpty(l.outFactortTime) + ""; if(l.fileName == null || l.fileName == 'null' || l.fileName == ''){ html += "上传"; diff --git a/WebContent/static/js/ma/machineEdit.js b/WebContent/static/js/ma/machineEdit.js index b265d9b..7df7afb 100644 --- a/WebContent/static/js/ma/machineEdit.js +++ b/WebContent/static/js/ma/machineEdit.js @@ -197,9 +197,8 @@ function getbaseList(index) { html += "是"; } html += ""+ JY.Object.notEmpty(l.assetNum) + ""; - html += ""+ JY.Object.notEmpty(l.originNum) + ""; html += ""+ JY.Object.notEmpty(l.deviceCode) + ""; - html += ""+ JY.Object.notEmpty(l.companyName) + ""; + html += ""+ JY.Object.notEmpty(l.outFactortTime) + ""; if(l.fileName == null || l.fileName == 'null' || l.fileName == ''){ html += "上传"; html += "上传"; diff --git a/WebContent/static/js/ma/machineTypeNew.js b/WebContent/static/js/ma/machineTypeNew.js new file mode 100644 index 0000000..302f905 --- /dev/null +++ b/WebContent/static/js/ma/machineTypeNew.js @@ -0,0 +1,1089 @@ +/** + * 机具类型管理 - 重构版 + * 功能:双向查询、树节点定位、全局搜索、面包屑导航 + */ + +// 全局变量 +var levels = ""; +var parentIds = ""; +var currentTreeNode = null; // 当前选中的树节点 +var zTreeObj = null; // zTree对象 + +$(function() { + // 初始化 + initPage(); + + // 绑定事件 + bindEvents(); +}); + +/** + * 页面初始化 + */ +function initPage() { + // 初始化树 + getOrgTreeData("", "", ""); + + // 初始化列表(第一页) + getbaseList(1); +} + +/** + * 绑定事件 + */ +function bindEvents() { + // 新增按钮 + $('#addBtn').on('click', function(e) { + e.preventDefault(); + cleanForm(); + $("#namesType").val(""); + JY.Model.edit("add", "新增机具类型", function() { + if (JY.Validate.form("addform")) { + var that = $(this); + var parentId = $("#parentIds").val(); + var name = $("#namesType").val(); + var label = $("input[name='label']:checked").val(); + + JY.Ajax.doRequest(null, bonuspath + '/backstage/machineType/insert', + {parentId: parentId, name: name, level: 3, label: label}, + function(data) { + that.dialog("close"); + JY.Model.info(data.resMsg, function() { + search(); + refreshTree(); + }); + } + ); + } + }); + }); + + // 库存预警值设置按钮 + $('#upWarnValue').on('click', function(e) { + e.preventDefault(); + $("#warnValueUpdate").val(""); + JY.Model.edit("update", "库存预警值设置", function() { + if (JY.Validate.form("updateform")) { + var that = $(this); + var warnValue = $("#warnValueUpdate").val(); + + JY.Ajax.doRequest(null, bonuspath + '/backstage/machineType/updateWarnValue', + {warnValue: warnValue}, + function(data) { + that.dialog("close"); + JY.Model.info(data.resMsg, function() { + search(); + refreshTree(); + }); + } + ); + } + }); + }); +} + +/** + * 更新面包屑导航 + */ +function updateBreadcrumb(treeNode) { + if (!treeNode) { + resetBreadcrumb(); + return; + } + + var breadcrumbHtml = '
    • 首页
    • '; + + // 获取节点路径 + var path = getNodePath(treeNode); + + for (var i = 0; i < path.length; i++) { + var node = path[i]; + if (i === path.length - 1) { + // 最后一个节点(当前节点) + breadcrumbHtml += '
    • ' + node.name + '
    • '; + } else { + // 中间节点(可点击) + breadcrumbHtml += '
    • ' + node.name + '
    • '; + } + } + + $("#breadcrumbNav").html(breadcrumbHtml); +} + +/** + * 重置面包屑 + */ +function resetBreadcrumb() { + var breadcrumbHtml = '
    • 首页
    • '; + breadcrumbHtml += '
    • 机具类型管理
    • '; + $("#breadcrumbNav").html(breadcrumbHtml); +} + +/** + * 获取节点路径(从根到当前节点) + */ +function getNodePath(node) { + var path = []; + var currentNode = node; + + while (currentNode) { + if (currentNode.id !== 0) { // 排除根节点 + path.unshift(currentNode); + } + currentNode = currentNode.getParentNode(); + } + + return path; +} + +/** + * 跳转到首页 + */ +function goToHome() { + // 重置树搜索 + resetTreeSearch(); + + // 重置右侧表格搜索 + $("#keyWord").val(""); + + // 显示所有规格型号 + showAllSpecifications(); + + // 重置面包屑 + resetBreadcrumb(); +} + +/** + * 跳转到指定节点 + */ +function goToNode(nodeId) { + if (!zTreeObj) return; + + var node = zTreeObj.getNodeByParam("id", nodeId, null); + if (node) { + zTreeObj.selectNode(node); + zTreeObj.expandNode(node, true, true, true); + onTreeClick(null, null, node, 1); + updateBreadcrumb(node); + } +} + + + +/** + * 定位到树节点(从表格操作) + * @param {string} id - 规格型号ID(第4层) + * @param {string} name - 规格型号名称 + * @param {string} parentId - 父节点ID(第3层物资型号) + */ +function locateToTree(id, name, parentId) { + if (!zTreeObj) { + JY.Model.info("树结构未加载完成!"); + return; + } + + // 第4层规格型号在树中不存在,需要定位到其父节点(第3层物资型号) + var targetId = parentId || id; + + // 在树中查找节点 + var node = zTreeObj.getNodeByParam("id", targetId, null); + + if (node) { + // 展开并选中节点 + zTreeObj.selectNode(node); + zTreeObj.expandNode(node, true, true, true); + + // 展开父节点 + var parentNode = node.getParentNode(); + if (parentNode) { + zTreeObj.expandNode(parentNode, true, true, true); + } + + // 滚动到可视区域 + var nodeDOM = $("#" + node.tId); + if (nodeDOM.length > 0) { + $(".orgTree").animate({ + scrollTop: nodeDOM.offset().top - $(".orgTree").offset().top + $(".orgTree").scrollTop() - 100 + }, 500); + } + + // 更新面包屑 + updateBreadcrumb(node); + + // 高亮效果 + $("#" + node.tId + "_a").addClass("curSelectedNode"); + setTimeout(function() { + $("#" + node.tId + "_a").removeClass("curSelectedNode"); + }, 2000); + + // 刷新右侧表格,显示该节点下的规格型号 + onTreeClick(null, null, node, 1); + + JY.Model.info("已定位到:" + node.name + " > " + name); + } else { + JY.Model.info("未找到对应的树节点!"); + } +} + +/** + * 导出数据 + */ +function exportData() { + var params = { + keyWord: $("#keyWord").val(), + level: $("#level").val(), + parentId: $("#pId").val() + }; + var url = bonuspath + '/backstage/machineType/expExcel'; + exportCommon(url, 'POST', params, '机具类型详情表'); +} + +// ==================== zTree 配置 ==================== + +/** + * zTree 设置 + */ +var setting1 = { + view: { + addHoverDom: addHoverDom, + removeHoverDom: removeHoverDom, + selectedMulti: false + }, + data: { + simpleData: { + enable: true + } + }, + edit: { + enable: true, + renameTitle: "修改", + removeTitle: "删除", + showRemoveBtn: showRenameBtn, + showRenameBtn: showRenameBtn + }, + callback: { + onClick: onTreeClick, + beforeClick: beforeClick, + beforeDrag: beforeDrag, + beforeEditName: beforeEditName, + beforeRename: beforeRename, + onRename: onRename, + beforeRemove: beforeRemove + } +}; + +/** + * 树节点点击前 + */ +function beforeClick(treeId, treeNode) { + if (treeNode.id == 0) { + return false; + } + return true; +} + +/** + * 显示重命名/删除按钮 + */ +function showRenameBtn(treeId, treeNode) { + if (treeNode.id == 0) { + return false; + } + return true; +} + +/** + * 移除悬停按钮 + */ +function removeHoverDom(treeId, treeNode) { + $("#addBtn_" + treeNode.id).unbind().remove(); +} + +/** + * 修改完时处理 + */ +function beforeRename(treeId, treeNode, newName) { + if (newName.length == 0) { + JY.Model.info("类型名称不能为空!"); + var zTree = getTree(); + setTimeout(function() { + zTree.editName(treeNode); + }, 10); + return false; + } + return true; +} + +/** + * 修改成功后处理 + */ +function onRename(event, treeId, treeNode) { + if (treeNode.existed) { + updateNode(treeNode); + } else { + addNode(treeNode); + } +} + +/** + * 添加节点 + */ +function addNode(treeNode) { + $.post(bonuspath + '/backstage/machineType/treeInsert', + {"name": treeNode.name, "parentId": treeNode.parentId, "level": treeNode.level}, + function(data) { + JY.Model.info(data.resMsg, function() { + refreshTree(); + }); + }, "json"); +} + +/** + * 修改节点名称 + */ +function updateNode(treeNode) { + $.post(bonuspath + '/backstage/machineType/treeUpdate', + {"id": treeNode.id, "name": treeNode.name}, + function(data) { + JY.Model.info(data.resMsg, function() { + refreshTree(); + }); + }, "json"); +} + +/** + * 不允许拖拽 + */ +function beforeDrag(treeId, treeNodes) { + return false; +} + +/** + * 确认是否进入编辑状态 + */ +function beforeEditName(treeId, treeNode) { + if (treeNode.id == 0) { + JY.Model.info("根节点不能修改!"); + return false; + } + return true; +} + +/** + * 添加新增按钮 + */ +function addHoverDom(treeId, treeNode) { + if (treeNode.editNameFlag || $("#addBtn_" + treeNode.id).length > 0 || + (treeNode.pId != 0 && treeNode.pId != null && treeNode.pId != "null")) { + return; + } + + var sObj = $("#" + treeNode.tId + "_span"); + var addStr = ""; + sObj.append(addStr); + + var btn = $("#addBtn_" + treeNode.id); + if (btn) { + btn.bind("click", function() { + var zTree = getTree(); + var newNode = zTree.addNodes(treeNode, { + parentId: treeNode.id, + name: "新增", + icon: bonuspath + "/static/css/sys/images/user_group.gif" + }); + if (newNode) { + zTree.editName(newNode[0]); + } + return false; + }); + } +} + +/** + * 确认是否删除 + */ +function beforeRemove(treeId, treeNode) { + if (treeNode.id == 0) { + JY.Model.info("根节点不能删除!"); + return false; + } + + var zTree = getTree(); + zTree.selectNode(treeNode); + + if (treeNode.id) { + JY.Model.confirm("请联系相关人员", function() { + JY.Model.confirm("确认删除节点 -- " + treeNode.name + " 吗?", function() { + $.post(bonuspath + '/backstage/machineType/del', + {"id": treeNode.id}, + function(data) { + JY.Model.info(data.resMsg, function() { + refreshTree(); + }); + }, "json"); + }); + }); + } else { + zTree.removeNode(treeNode); + } + return false; +} + +/** + * 定义树节点初始数据 + */ +var zNodes1 = [{ + id: 0, + pId: -1, + open: true, + name: "机具类型列表", + icon: bonuspath + "/static/css/sys/images/home.gif" +}]; + +/** + * 获取数据初始化树 + */ +function getOrgTreeData(typeName, name, model) { + $.ajax({ + type: 'POST', + url: bonuspath + '/backstage/machineType/maTypeTree', + data: { + typeName: typeName, + name: name, + model: model + }, + success: function(result) { + var nodes = zNodes1.concat(result.obj.list); + zTreeObj = $.fn.zTree.init($("#orgTree"), setting1, nodes); + + // 默认展开第一层 + var rootNode = zTreeObj.getNodeByParam("id", 0, null); + if (rootNode) { + zTreeObj.expandNode(rootNode, true, false, false); + } + + // 如果是搜索模式(有 model 参数),自动展开所有节点并高亮匹配的节点 + if (model && model.trim() !== "") { + expandAllNodes(); + highlightSearchResults(model); + JY.Model.loadingClose(); + } + }, + error: function(e) { + JY.Model.info("加载树结构失败!"); + JY.Model.loadingClose(); + }, + dataType: 'json' + }); +} + +/** + * 展开所有树节点 + */ +function expandAllNodes() { + if (!zTreeObj) return; + var nodes = zTreeObj.getNodes(); + for (var i = 0; i < nodes.length; i++) { + zTreeObj.expandNode(nodes[i], true, true, true); + } +} + +/** + * 高亮搜索结果 + */ +function highlightSearchResults(keyword) { + if (!zTreeObj) return; + + var nodes = zTreeObj.getNodes(); + var foundCount = 0; + + // 遍历所有节点,高亮匹配的节点 + var highlightNode = function(node) { + if (node.name && node.name.indexOf(keyword) !== -1) { + // 添加高亮样式 + var nodeElement = $("#" + node.tId + "_a"); + if (nodeElement.length > 0) { + nodeElement.css({ + "background-color": "#fff3cd", + "color": "#856404", + "font-weight": "bold", + "border-radius": "4px", + "padding": "2px 6px" + }); + foundCount++; + } + } + + // 递归处理子节点 + if (node.children && node.children.length > 0) { + for (var i = 0; i < node.children.length; i++) { + highlightNode(node.children[i]); + } + } + }; + + // 从根节点开始遍历 + for (var i = 0; i < nodes.length; i++) { + highlightNode(nodes[i]); + } + + // 显示搜索结果提示 + if (foundCount > 0) { + JY.Model.info("找到 " + foundCount + " 个匹配的规格型号"); + } else { + JY.Model.info("未找到匹配的规格型号"); + } +} + +/** + * 刷新树 + */ +function refreshTree() { + getOrgTreeData("", "", ""); +} + +/** + * 筛选树(精确搜索) + */ +function searchType() { + var model = $("#model").val(); + if (!model || model.trim() === "") { + JY.Model.info("请输入物资型号!"); + return; + } + + JY.Model.loading(); + getOrgTreeData("", "", model); +} + +/** + * 重置树搜索 + */ +function resetTreeSearch() { + $("#model").val(""); + refreshTree(); +} + +/** + * 获取树对象 + */ +function getTree() { + return $.fn.zTree.getZTreeObj("orgTree"); +} + +/** + * 树节点点击事件 + * 点击树节点后,右侧表格只显示该节点下的第4层规格型号 + */ +function onTreeClick(event, treeId, treeNode, clickFlag) { + currentTreeNode = treeNode; + + $("#roleVisName").html(treeNode.name); + $("#pId").val(treeNode.id); + $("#parentIds").val(treeNode.id); + $("#level").val(treeNode.level); + + levels = treeNode.level; + parentIds = treeNode.id; + + localStorage.setItem("levels", levels); + + // 更新面包屑 + updateBreadcrumb(treeNode); + + // 更新标题 + $("#currentViewTitle").html(treeNode.name); + + // 刷新列表,显示该节点下的第4层规格型号(第一页,根据树节点过滤) + getbaseList(1, 1); +} + +// ==================== 列表操作 ==================== + +/** + * 搜索 + */ +function search() { + getbaseList(1); +} + +/** + * 显示所有规格型号(重置过滤) + */ +function showAllSpecifications() { + // 清空搜索关键词 + $("#keyWord").val(""); + + // 清空树节点选择 + $("#pId").val(0); + $("#parentIds").val(0); + $("#level").val(0); + + // 更新标题 + $("#roleVisName").html("所有规格型号"); + + // 加载所有数据(第一页,显示所有) + getbaseList(1, 2); +} + +/** + * 获取列表数据 + * @param {number} pageNum - 页码,可选。如果不提供,则从表单中读取 + * @param {number} type - 1: 根据树节点过滤, 2: 显示所有数据 + */ +function getbaseList(pageNum, type) { + // 如果没有提供 pageNum,则从表单中读取(用于分页导航点击) + if (!pageNum) { + pageNum = $("#baseForm .pageNum").val(); + if (!pageNum) pageNum = 1; + } else { + // 如果提供了 pageNum,则更新表单中的值 + $("#baseForm .pageNum").val(pageNum); + } + + if (type == 2) { + $("#roleVisName").html("所有规格型号"); + // 清空树节点选择 + $("#pId").val(0); + $("#parentIds").val(0); + $("#level").val(0); + } + + JY.Model.loading(); + + // 获取搜索关键词 + var keyword = $("#keyWord").val() || ""; + + // 获取当前选中的树节点信息 + var parentId = $("#parentIds").val(); + var level = $("#level").val(); + + // 分页参数 + var pageSize = 10; + + $.ajax({ + url: bonuspath + '/backstage/machineType/searchSpecifications', + type: 'POST', + dataType: 'json', + data: { + keyWord: keyword, + parentId: parentId, // 传递父节点ID + level: level, // 传递层级 + pageNum: pageNum, + pageSize: pageSize + }, + success: function(data) { + $("#baseTable tbody").empty(); + + if (data && data.res == 1 && data.obj) { + var results = data.obj.list || []; + var totalRecord = data.obj.totalRecord || 0; + + // 树节点过滤已在后端处理,无需前端再次过滤 + + var html = ""; + var startIndex = (pageNum - 1) * pageSize; + + if (results && results.length > 0) { + for (var i = 0; i < results.length; i++) { + var l = results[i]; + html += ""; + html += "" + (startIndex + i + 1) + ""; + + html += "" + (JY.Object.notEmpty(l.firstName) || "-") + ""; + + html += "" + (JY.Object.notEmpty(l.secondName) || "-") + ""; + + // 显示规格型号名称,鼠标悬停显示完整路径 + var fullPath = l.firstName + " > " + l.secondName + " > " + l.parentName + " > " + l.name; + html += "" + JY.Object.notEmpty(l.name) + ""; + + // 数量 + html += "" + (JY.Object.notEmpty(l.nums) || "-") + ""; + + // 单位 + html += "" + (JY.Object.notEmpty(l.unit) || "-") + ""; + + // 租赁价格 + html += "" + (JY.Object.notEmpty(l.leasePrice) || "-") + ""; + + // 赔偿价格 + html += "" + (JY.Object.notEmpty(l.payPrice) || "-") + ""; + + // 原值 + html += "" + (JY.Object.notEmpty(l.buyPrice) || "-") + ""; + + // 操作按钮(传递parentId用于定位到树) + html += rowFunction(l.id, l.name, l.parentId); + html += ""; + } + + $("#baseTable tbody").append(html); + // 设置分页 + JY.Page.setPage("baseForm", "pageing", pageSize, pageNum, totalRecord, "getbaseList"); + } else { + html = ""; + html += ""; + html += "暂无数据"; + $("#baseTable tbody").append(html); + $("#pageing ul").empty(); + } + } else { + var html = ""; + html += ""; + html += "暂无数据"; + $("#baseTable tbody").append(html); + $("#pageing ul").empty(); + } + + JY.Model.loadingClose(); + }, + error: function() { + JY.Model.loadingClose(); + JY.Model.info("加载数据失败!"); + } + }); +} + +/** + * 根据树节点过滤规格型号 + * @param {Array} results - 所有规格型号数据 + * @param {string} parentId - 父节点ID + * @param {string} level - 节点层级 + * @returns {Array} 过滤后的数据 + */ +function filterByTreeNode(results, parentId, level) { + if (!results || results.length == 0) { + return []; + } + + // level = 1: 第1层(物资类型),需要匹配 firstName + // level = 2: 第2层(物资名称),需要匹配 secondId + // level = 3: 第3层(物资型号),需要匹配 parentId + + return results.filter(function(item) { + if (level == 3 || level == '3') { + // 第3层:直接匹配parentId + return item.parentId == parentId; + } else if (level == 2 || level == '2') { + // 第2层:匹配secondId(需要后端返回) + return item.secondId == parentId; + } else if (level == 1 || level == '1') { + // 第1层:匹配firstId(需要后端返回) + return item.firstId == parentId; + } + return true; + }); +} + +/** + * 生成操作按钮 + * @param {string} id - 规格型号ID + * @param {string} name - 规格型号名称 + * @param {string} parentId - 父节点ID(第3层物资型号) + */ +function rowFunction(id, name, parentId) { + var h = ""; + h += ""; + h += ""; + h += ""; + return h; +} + +/** + * 清空表单 + */ +function cleanForm() { + JY.Tags.cleanForm("auForm"); + $("#auForm input[name$='name']").val(JY.Object.notEmpty('')); + $("#auForm input[name='label']").prop('checked', false); + $("#auForm input[name$='warnValue']").val(JY.Object.notEmpty('')); +} + +/** + * 设置表单数据 + */ +function setForm(data) { + var l = data.obj; + $("#auForm input[name$='name']").val(JY.Object.notEmpty(l.name)); + $("#auForm input[name$='warnValue']").val(JY.Object.notEmpty(l.warnValue)); + + if (l.label == "1") { + $('#label11').prop('checked', true); + } + if (l.label == "2") { + $('#label21').prop('checked', true); + } +} + +/** + * 修改 + */ +function edit(id) { + cleanForm(); + JY.Ajax.doRequest(null, bonuspath + '/backstage/machineType/find', {id: id}, function(data) { + setForm(data); + JY.Model.edit("auDiv", "修改机具类型", function() { + if (JY.Validate.form("auForm")) { + var that = $(this); + JY.Ajax.doRequest("auForm", bonuspath + '/backstage/machineType/update', {id: id}, function(data) { + that.dialog("close"); + JY.Model.info(data.resMsg, function() { + search(); + refreshTree(); + }); + }); + } + }); + }); +} + +/** + * 删除 + */ +function del(id) { + JY.Ajax.doRequest(null, bonuspath + '/backstage/role/findUserRole', {}, function(data) { + var res = data.obj; + if (res != 2) { + JY.Model.confirm("权限不够,无法删除!"); + } else { + JY.Model.confirm("请联系相关人员", function() { + JY.Model.confirm("确认删除吗?", function() { + JY.Ajax.doRequest(null, bonuspath + '/backstage/machineType/delete', { + id: id, + level: 4 + }, function(data) { + JY.Model.info(data.resMsg, function() { + getbaseList(1); + refreshTree(); + }); + }); + }); + }); + } + }); +} + +/** + * 查看规格型号详情(旧版,打开新页面) + */ +function check(id, name) { + localStorage.setItem("parentId", id); + localStorage.setItem("parentName", name); + layer.open({ + type: 2, + title: ['规格型号', 'background-color: #667eea;color:#fff'], + shadeClose: true, + shade: false, + maxmin: true, + area: ['900px', '530px'], + content: bonuspath + '/backstage/machineType/details' + }); +} + +/** + * 查看规格型号详情(新版,弹窗显示) + */ +function viewSpecification(id) { + JY.Ajax.doRequest(null, bonuspath + '/backstage/machineType/findModel', {id: id}, function(data) { + if (data && data.obj) { + var spec = data.obj; + var html = ''; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + html += '
      规格型号:' + JY.Object.notEmpty(spec.name) + '机具类型:' + JY.Object.notEmpty(spec.parentName) + '
      数量:' + (JY.Object.notEmpty(spec.nums) || '-') + '单位:' + (JY.Object.notEmpty(spec.unit) || '-') + '
      租赁价格:' + (JY.Object.notEmpty(spec.leasePrice) || '-') + ' 元赔偿价格:' + (JY.Object.notEmpty(spec.payPrice) || '-') + ' 元
      原值:' + (JY.Object.notEmpty(spec.buyPrice) || '-') + ' 元是否只计数:' + (spec.isCount == '1' ? '是' : '否') + '
      '; + + layer.open({ + type: 1, + title: ['规格型号详情', 'background-color: #667eea;color:#fff'], + area: ['700px', 'auto'], + content: html + }); + } + }); +} + +/** + * 新增规格型号 + */ +function addSpecification() { + // 检查是否选择了机具类型 + var parentId = $("#parentIds").val(); + if (!parentId || parentId == 0) { + JY.Model.info("请先在左侧树中选择一个机具类型!"); + return; + } + + // 清空表单 + $("#addSpecForm")[0].reset(); + $("#specParentId").val(parentId); + + // 获取选中的树节点信息 + var node = zTreeObj.getNodeByParam("id", parentId, null); + if (node) { + $("#specParentName").val(node.name); + } + + JY.Model.edit("addSpecDiv", "新增规格型号", function() { + if (JY.Validate.form("addSpecForm")) { + var that = $(this); + var formData = { + parentId: $("#specParentId").val(), + name: $("#specName").val(), + nums: $("#specNums").val(), + unit: $("#specUnit").val(), + leasePrice: $("#specLeasePrice").val(), + payPrice: $("#specPayPrice").val(), + buyPrice: $("#specBuyPrice").val(), + isCount: $("input[name='isCount']:checked").val(), + level: 4 + }; + + JY.Ajax.doRequest(null, bonuspath + '/backstage/machineType/insert', formData, function(data) { + that.dialog("close"); + JY.Model.info(data.resMsg, function() { + getbaseList(1); + refreshTree(); + }); + }); + } + }); +} + +/** + * 编辑规格型号 + */ +function editSpecification(id) { + JY.Ajax.doRequest(null, bonuspath + '/backstage/machineType/findModel', {id: id}, function(data) { + if (data && data.obj) { + var spec = data.obj; + + // 填充表单数据 + $("#editSpecId").val(spec.id); + $("#editSpecParentId").val(spec.parentId); + $("#editSpecParentName").val(spec.parentName); + $("#editSpecName").val(spec.name); + $("#editSpecNums").val(spec.nums); + $("#editSpecUnit").val(spec.unit); + $("#editSpecLeasePrice").val(spec.leasePrice); + $("#editSpecPayPrice").val(spec.payPrice); + $("#editSpecBuyPrice").val(spec.buyPrice); + + // 设置单选框 + if (spec.isCount == '1') { + $("#editSpecIsCount1").prop("checked", true); + } else { + $("#editSpecIsCount0").prop("checked", true); + } + + JY.Model.edit("editSpecDiv", "编辑规格型号", function() { + if (JY.Validate.form("editSpecForm")) { + var that = $(this); + var formData = { + id: $("#editSpecId").val(), + parentId: $("#editSpecParentId").val(), + name: $("#editSpecName").val(), + nums: $("#editSpecNums").val(), + unit: $("#editSpecUnit").val(), + leasePrice: $("#editSpecLeasePrice").val(), + payPrice: $("#editSpecPayPrice").val(), + buyPrice: $("#editSpecBuyPrice").val(), + isCount: $("input[name='isCount']:checked").val(), + level: 4 + }; + + JY.Ajax.doRequest(null, bonuspath + '/backstage/machineType/update', formData, function(data) { + that.dialog("close"); + JY.Model.info(data.resMsg, function() { + getbaseList(1); + refreshTree(); + }); + }); + } + }); + } + }); +} + +/** + * 删除规格型号 + */ +function deleteSpecification(id) { + JY.Model.confirm("确认删除该规格型号吗?", function() { + JY.Ajax.doRequest(null, bonuspath + '/backstage/machineType/del', { + id: id, + level: 4 + }, function(data) { + JY.Model.info(data.resMsg, function() { + getbaseList(1); + refreshTree(); + }); + }); + }); +} + +// ==================== 下拉框数据 ==================== + +/** + * 获取物资类型列表 + */ +function getTypeName() { + $("#typeNameId").html(""); + JY.Ajax.doRequest(null, bonuspath + '/backstage/machineType/getTypeNameList', null, function(data) { + var l = data.obj.list; + var str = ''; + for (var i = 0; i < l.length; i++) { + str += ''; + } + $("#typeNameId").append(str); + }); +} + +/** + * 获取物资名称列表 + */ +function getName() { + $("#nameId").html(""); + var typeName = $("#typeNameId").val(); + + JY.Ajax.doRequest(null, bonuspath + '/backstage/machineType/getNameList', {typeName: typeName}, function(data) { + var l = data.obj.list; + var str = ''; + for (var i = 0; i < l.length; i++) { + str += ''; + } + $("#nameId").append(str); + }); +} diff --git a/resources/mybatis/ma/MachineTypeMapper.xml b/resources/mybatis/ma/MachineTypeMapper.xml index 8b2c0d9..7af2e92 100644 --- a/resources/mybatis/ma/MachineTypeMapper.xml +++ b/resources/mybatis/ma/MachineTypeMapper.xml @@ -43,97 +43,171 @@ --> - + SELECT DISTINCT + mat.ID AS id, + mr.ORG_ID AS companyId, + po.`NAME` AS companyName, + mat.`NAME`, + mat2.`NAME` AS parentName, + mat2.ID AS parentId, + mat.UNIT AS unit, + mat.WEIGHT AS weight, + mat.RATED_LOAD AS ratedLoad, + mat.TEST_LOAD AS testLoad, + mat.HOLDING_TIME AS holdingTime, + mat.LEASE_PRICE AS leasePrice, + ROUND(CONVERT ( ( mat.PAY_PRICE ), DECIMAL ( 10, 2 ) )) AS payPrice, + ROUND(mat.BUY_PRICE) AS buyPrice, + mat.IS_COUNT AS isCount, + mat.FILE_URL AS fileUrl, + ROUND(mat.NUM) AS nums, + mat.SAMPING_RATIO AS sampingRatio, + mat.WARN_NUM AS warnNum, + mat.LEVEL AS level FROM - mm_type mat - LEFT JOIN - ma_org_relation mr ON mat.ID = mr.TYPE_ID - LEFT JOIN pm_organization po - ON mr.ORG_ID = po.ID - LEFT JOIN mm_type mat2 ON mat2.ID = mat.PARENT_ID - LEFT JOIN mm_type mat3 ON mat3.ID = mat2.PARENT_ID - LEFT JOIN mm_type - mat4 ON mat4.ID = mat3.PARENT_ID + mm_type mat + LEFT JOIN ma_org_relation mr ON mat.ID = mr.TYPE_ID + LEFT JOIN pm_organization po ON mr.ORG_ID = po.ID + LEFT JOIN mm_type mat2 ON mat2.ID = mat.PARENT_ID + LEFT JOIN mm_type mat3 ON mat3.ID = mat2.PARENT_ID + LEFT JOIN mm_type mat4 ON mat4.ID = mat3.PARENT_ID WHERE - mat4.PARENT_ID = 0 - AND - mat.IS_ACTIVE = '1' - AND mat2.IS_ACTIVE = '1' - AND mat3.IS_ACTIVE = '1' - AND mat4.IS_ACTIVE = '1' - and mat.PARENT_ID = #{param.parentId} - + mat4.PARENT_ID = 0 + AND mat.IS_ACTIVE = '1' + AND mat2.IS_ACTIVE = '1' + AND mat3.IS_ACTIVE = '1' + AND mat4.IS_ACTIVE = '1' + + and mat.PARENT_ID = #{param.parentId} + and ( mat.`NAME` like CONCAT('%',#{param.keyWord},'%') or + mat4.`NAME` like CONCAT('%',#{param.keyWord},'%') or mat.WEIGHT like CONCAT('%',#{param.keyWord},'%') or - mat.LEASE_PRICE - like CONCAT('%',#{param.keyWord},'%') or - mat.PAY_PRICE like - CONCAT('%',#{param.keyWord},'%') or - mat.BUY_PRICE like - CONCAT('%',#{param.keyWord},'%') + mat.LEASE_PRICE like CONCAT('%',#{param.keyWord},'%') or + mat.PAY_PRICE like CONCAT('%',#{param.keyWord},'%') or + mat.BUY_PRICE like CONCAT('%',#{param.keyWord},'%') ) GROUP BY mat.ID,mr.ORG_ID + + +