Commit c55430f9 by 宋祥

1.物料清单页面优化

parent 3be9c7c8
......@@ -658,32 +658,28 @@ public class ServiceHPSC002 extends ServiceBase {
inInfo.set("root",root);
return inInfo;
}
@OperationLogAnnotation(operModul = "物料清单",operType = "查询",operDesc = "树查询服务")
//树查询服务
/**
* 查询树
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "物料清单", operType = "查询", operDesc = "树查询服务")
public EiInfo queryTreeNode(EiInfo inInfo) {
//1 获取参数
String pEname = inInfo.getCellStr(EiConstant.queryBlock, 0, "node");
if(StringUtils.equals("$",pEname)){
pEname = "root";
}
String proj = inInfo.get(CommonConstant.Field.PROJ_ID).toString();
Long projId = NumberUtils.toLong(proj.split("&")[0]);
Map queryMap = new HashMap();
queryMap.put("pEname", pEname);
if (projId != null) {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
String node = MapUtils.getString(queryRow, "node");
Map map = new HashMap();
map.put("id", projId);
List list = dao.query("HPSC001.queryDomainById", map);
if (list.size() > 0) {
String projCode = ((HPSC001)list.get(0)).getProjCode();
queryMap.put("projCode", projCode);
}
}
//2 查询节点
map.put("id", queryRow.get(CommonConstant.Field.PROJ_ID));
List<HPSC001> dbSc001s = dao.query("HPSC001.queryDomainById", map);
// 查询节点
Map queryMap = new HashMap();
queryMap.put("projCode", CollectionUtils.isEmpty(dbSc001s) ? "null" : dbSc001s.get(0).getProjCode());
queryMap.put("pEname", "$".equals(node) ? "root" : node);
List rows = dao.query("HPSC002.queryTree", queryMap);
//3 增加节点block块
// 增加节点block块
EiInfo outInfo = new EiInfo();
EiBlock outBlock = outInfo.addBlock(BeanUtil.isEmpty(pEname) ? "" : pEname);
EiBlock outBlock = outInfo.addBlock(node);
outBlock.addRows(rows);
return outInfo;
}
......
......@@ -185,7 +185,7 @@
$order$
</isNotEmpty>
<isEmpty property="order">
A.ID DESC
A.ID ASC
</isEmpty>
</dynamic>
</sql>
......@@ -335,7 +335,7 @@
<isNotEmpty prepend=" AND " property="projCode">
PROJ_CODE = #projCode#
</isNotEmpty>
ORDER BY CREATED_TIME DESC
ORDER BY ID ASC
</select>
......
var inventNameGlobalData = [];
var prdtNameGlobalData = [];
// 传递参数 将附件ID与当前记录ID进行绑定
// let rowId = '';
let parentId = '';
let projCode = '';
var strs;
var url = location.search; //获取url中"?"符后的字串
if (url.indexOf("?") != -1) { //判断是否有参数
var str = url.substr(1); //从第一个字符开始 因为第0个是?号 获取所有除问号的所有符串
strs = str.split("="); //用等号进行分隔 (因为知道只有一个参数 所以直接用等号进分隔 如果有多个参数 要用&号分隔 再用等号进行分隔)
// console.log('strs=' + strs) //直接弹出第一个参数 (如果有多个参数 还要进行循环的)
}
let inventNameGlobalData = [];
let prdtNameGlobalData = [];
$(function () {
IPLATUI.EFTree = {
"materialTree": {
ROOT: "root:项目列表",
// ROOT: "root:项目列表",
/**
* 树加载完成后的回调函数
* @param options: 树的配置项
*/
query: function (postEiInfo, model) {
postEiInfo.set("projId",strs?strs[1] : null);
postEiInfo.set("inqu_status-0-projId", $("#inqu_status-0-projId").val());
return postEiInfo;
},
loadComplete: function (options) {
......@@ -41,10 +32,16 @@ $(function () {
*/
select: function (e) {
var nodeData = this.dataItem(e.node);
// 选择最后一级时,自动点击上一级
if (nodeData.lv == 3) {
IPLATUI.EFTree.materialTree.selectTreeNode.nodeId = nodeData.pId;
// 刷新树
refreshTree();
} else {
let eiInfo = new EiInfo();
if (nodeData.lv == 1){
if (nodeData.lv == 1) {
eiInfo.set("inqu_status-0-inventTypes", [4]);
}else if (nodeData.lv == 2){
} else if (nodeData.lv == 2) {
eiInfo.set("inqu_status-0-inventTypes", [3]);
}
var dataSource;
......@@ -56,26 +53,18 @@ $(function () {
onFail: function (ei) {
}
}, {async: false});
IPLATUI.EFTree.materialTree.selectTreeNode.nodeId = nodeData.nodeId;
IPLATUI.EFTree.materialTree.selectTreeNode.prdtCode = nodeData.prdtCode;
IPLATUI.EFTree.materialTree.selectTreeNode.projCode = nodeData.projCode;
IPLATUI.EFTree.materialTree.selectTreeNode.prdtName = nodeData.prdtName;
IPLATUI.EFTree.materialTree.selectTreeNode.projName = nodeData.projName;
IPLATUI.EFTree.materialTree.selectTreeNode.deliveryDate = nodeData.deliveryDate;
IPLATUI.EFTree.materialTree.selectTreeNode.lv = nodeData.lv;
// 重新查询EFGrid
parentId = nodeData.nodeId;
// 设置树节点的值
setTreeNodeValue(nodeData);
}
// 刷新列表数据
query();
// 动态显示列名
dynamicColumnName();
},
selectTreeNode: {}
}
};
$("#QUERY").on("click", function () {
query();
});
IPLATUI.EFGrid = {
result: {
pageable: {
......@@ -98,20 +87,18 @@ $(function () {
});
},
onSuccess: function (e) {
if(e.eiInfo.extAttr.methodName == 'save'
||e.eiInfo.extAttr.methodName == 'delete'){
if (e.eiInfo.extAttr.methodName == 'save'
|| e.eiInfo.extAttr.methodName == 'delete') {
query();
refreshTree();
}
},
query: function () {
var ei = new EiInfo();
ei.set("inqu_status-0-prdtType",$("#inqu_status-0-prdtType").val());
ei.set("inqu_status-0-prdtCode",$("#inqu_status-0-prdtCode").val());
ei.set("inqu_status-0-status",$("#inqu_status-0-status").val());
ei.set("inqu_status-0-parentId",parentId? parentId : strs[1]);
// ei.set("inqu_status-0-parentId",-1);
ei.set("inqu_status-0-prdtType", $("#inqu_status-0-prdtType").val());
ei.set("inqu_status-0-prdtCode", $("#inqu_status-0-prdtCode").val());
ei.set("inqu_status-0-status", $("#inqu_status-0-status").val());
let nodeId = IPLATUI.EFTree.materialTree.selectTreeNode.nodeId;
ei.set("inqu_status-0-parentId", isBlank(nodeId) ? $("#inqu_status-0-projId").val() : nodeId);
return ei;
},
/**
......@@ -213,8 +200,7 @@ $(function () {
// save: false, // 不显示保存按钮
delete: true, // 显示删除按钮
},
columns: [
{
columns: [{
field: "operator",
title: "操作",
template: function (item) {
......@@ -223,13 +209,14 @@ $(function () {
let template = '';
// template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
// + 'onclick="openUploadFile(' + item.id + ',1)" >附件上传</a>';
if (item.id){
if (item.id) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showUploadFile(' + item.id + ')" >附件清单</a>';
}
if (lv === '3') {
if (auditStatus == 0) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' +
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+
'onclick="check(' + item.id + ',1)" >提交</a>';
} /*else {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' +
......@@ -243,21 +230,21 @@ $(function () {
title: "部件类型",
filter: function (options) {
let selectTreeNode = IPLATUI.EFTree.materialTree.selectTreeNode;
if(selectTreeNode.lv == 1) {
if (selectTreeNode.lv == 1) {
// 返回我们过滤后的数据集
/*return options.values[0][province];*/
return _.filter(options.values, function (item) {
return item["valueField"]==4;
return item["valueField"] == 4;
})
} else {
return _.filter(options.values, function (item) {
return item["valueField"]==2 || item["valueField"]==3;
return item["valueField"] == 2 || item["valueField"] == 3;
})
}
}
},{
}, {
field: "prdtName",
title: "部件名称",
// title: "部件名称",
/*query: function (container, options) {
let eiInfo = new EiInfo();
eiInfo.set("inqu_status-0-inventTypes", [3, 4]);
......@@ -283,14 +270,14 @@ $(function () {
input.appendTo(container);
let eiInfo = new EiInfo();
let selectTreeNode = IPLATUI.EFTree.materialTree.selectTreeNode;
if (selectTreeNode.lv == 1){
if (selectTreeNode.lv == 1) {
eiInfo.set("inventType", 4);
}else if (selectTreeNode.lv == 2){
eiInfo.set("inventTypes", [2,3]);
}else {
eiInfo.set("inventTypes", [3,4]);
} else if (selectTreeNode.lv == 2) {
eiInfo.set("inventTypes", [2, 3]);
} else {
eiInfo.set("inventTypes", [3, 4]);
}
eiInfo.set("isSplicingSymbol",false);
eiInfo.set("isSplicingSymbol", false);
var dataSource;
EiCommunicator.send("HPPZ004", "queryComboBox", eiInfo, {
onSuccess: function (ei) {
......@@ -315,7 +302,7 @@ $(function () {
}, {
field: "parentPrdtName",
template: function (dataItem) {
if(dataItem.lv > 2){
if (dataItem.lv > 2) {
return dataItem['parentPrdtName'];
}
return "";
......@@ -363,6 +350,10 @@ $(function () {
]
},
};
// 查询
$("#QUERY").on("click", query);
/**
* 导入
*/
......@@ -387,16 +378,17 @@ $(function () {
});
e.preventDefault();
} else {
//uploadFileWindow.open();
var parentId = IPLATUI.EFTree.materialTree.selectTreeNode.nodeId;
var nodeId = IPLATUI.EFTree.materialTree.selectTreeNode.nodeId;
var parentPrdtName = IPLATUI.EFTree.materialTree.selectTreeNode.prdtName;
var projCode = IPLATUI.EFTree.materialTree.selectTreeNode.projCode;
var projName = IPLATUI.EFTree.materialTree.selectTreeNode.projName;
var deliveryDate = IPLATUI.EFTree.materialTree.selectTreeNode.deliveryDate;
var lv = IPLATUI.EFTree.materialTree.selectTreeNode.lv;
JSColorbox.open({
href: "HPSC097?methodName=initLoad&inqu_status-0-id=route_001&inqu_status-0-parentId=" + parentId+"&inqu_status-0-projCode="+projCode+"&inqu_status-0-projName="+projName+"&inqu_status-0-parentPrdtName="+parentPrdtName+"&inqu_status-0-deliveryDate="+deliveryDate,
href: "HPSC097?methodName=initLoad&inqu_status-0-id=route_001&inqu_status-0-parentId="
+ nodeId + "&inqu_status-0-projCode=" + projCode + "&inqu_status-0-projName="
+ projName + "&inqu_status-0-parentPrdtName=" + parentPrdtName
+ "&inqu_status-0-deliveryDate=" + deliveryDate,
title: "<div style='text-align: center;'>导入</div>",
width: "60%",
height: "50%",
......@@ -412,79 +404,19 @@ $(function () {
}
}
});
/* IPLATUI.EFUpload = {
fileUpload: {
showFileList: false,
upload: function (e) {
openFileWindow.close();
IPLAT.progress($("body"), true);
},
success: function (e) {
debugger;
var src;
var className;
if ("run" == projectEnv) {
//src = e.response.docUrl + e.response.docType
src = downloadHref(e.response.docId) + e.response.docType
className = e.response.groupId;
} else {
src = e.response.docUrl
//src = downloadHref(e.response.docId) + '.' + e.response.docUrl.split(".")[1];
className = e.response.docTag;
}
var parentId = IPLATUI.EFTree.materialTree.selectTreeNode.nodeId;
var parentPrdtName = IPLATUI.EFTree.materialTree.selectTreeNode.prdtName;
var projCode = IPLATUI.EFTree.materialTree.selectTreeNode.projCode;
var projName = IPLATUI.EFTree.materialTree.selectTreeNode.projName;
var lv = IPLATUI.EFTree.materialTree.selectTreeNode.lv;
var eiInfo = new EiInfo();
eiInfo.set("fileName", src);
eiInfo.set("className", className);
eiInfo.set("parentId", parentId);
eiInfo.set("parentPrdtName", parentPrdtName);
eiInfo.set("projCode", projCode);
eiInfo.set("projName", projName);
eiInfo.set("lv", lv);
EiCommunicator.send("HPFF001", "importDate", eiInfo, {
onSuccess: function (ei) {
if (ei.status == "-1") {
NotificationUtil({msg: ei.msg, detailMsg: ei.detailMsg}, "error");
} else {
NotificationUtil(ei.msg);
refreshTree();
query();
}
},
onFail: function (ei) {
NotificationUtil("调用失败,原因[" + ei + "]", "error");
}
}, {
async: false
});
IPLAT.progress($("body"), false);
},
fail: function (e) {
IPLAT.NotificationUtil('导入失败!', "error");// 失败提示信息
}
}
}*/
$("#DOWNLOAD").on("click", function (e) {
var href = ctx + "\\HP\\template\\SC\\HPSC002_物料清单.xls";
window.location.href = href;
});
/**
* 生成模板
*/
$("#GENERATE").on("click", function () {
var projCode=strs[1];
var projCode = $("#inqu_status-0-projId").val();
var info = new EiInfo()
info.set("id", projCode);
info.set("id", $("#inqu_status-0-projId").val());
EiCommunicator.send("HPPZ015", "count", info, {
onSuccess: function (ei) {
if (ei["status"] == 1) {
......@@ -541,7 +473,7 @@ $(function () {
* 物料生成
*/
function assign() {
var projCode=strs[1];
var projCode = $("#inqu_status-0-projId").val();
var info = new EiInfo()
info.set("id", projCode);
EiCommunicator.send("HPSC002", "count", info, {
......@@ -616,7 +548,7 @@ $(function () {
}
// 关闭事件
// 关闭事件
IPLATUI.EFWindow = {
"uploadFile": {
close: function (e) {
......@@ -668,6 +600,7 @@ $(function () {
}, {async: false});
});
});
$(window).load(function () {
// 存货名称
let inInfo = new EiInfo();
......@@ -690,21 +623,6 @@ let query = function () {
resultGrid.dataSource.page(1);
}
let refreshTree = function () {
//更新树
var tree = $("#materialTree").data("kendoTreeView");
var inInfo = new EiInfo();
EiCommunicator.send("HPSC002", "queryTreeNode", inInfo, {//传入参数
onSuccess: function (inInfo) {
tree.reload("root");//更新树
}
});
}
function openUploadFile(id) {
uploadFileWindow.open().center();
// rowId = id;
}
/**
* 显示附件清单
*
......@@ -731,14 +649,12 @@ function check(id, auditStatus) {
onFail(errorMessage, status, e) {
NotificationUtil("执行失败!", "error");
}
},
{
}, {
async: false
}
);
}
/**
* 删除
*/
......@@ -760,8 +676,13 @@ function deleteFunc() {
if(flag){
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"删除\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPSC002", "delete", true);
updateTree();
JSUtils.submitGridsData("result", "HPSC002", "delete",
true, function (res) {
if (res.status > -1) {
refreshTree();
}
}
);
}
});
}
......@@ -809,24 +730,108 @@ function saveFunc() {
if(flag){
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPSC002", "save", true);
updateTree();
JSUtils.submitGridsData("result", "HPSC002", "save",
true, function (res) {
if (res.status > -1) {
refreshTree();
}
}
);
}
});
}
}
//更新树
function updateTree() {
var tree = $("#materialTree").data("kendoTreeView");
var inInfo = new EiInfo();
EiCommunicator.send("HPSC002", "queryTreeNode", inInfo, {//传入参数
onSuccess: function (inInfo) {
tree.reload("root");//更新树
/**
* 刷新树
*/
let refreshTree = function () {
setTimeout(() => {
// 刷新树节点
const tree = $("#materialTree").data("kendoTreeView");
// 选中的节点
const treeId = IPLATUI.EFTree.materialTree.selectTreeNode.nodeId;
tree.reload(treeId)
// 展开成功后选中对应的树节点
expandTreeNode(tree, treeId);
// 展开成功后选中对应的树节点
selectTreeNode(tree, treeId);
}, 500);
}
/**
* 展开对应的树节点
*
* @param tree
* @param treeId
*/
let expandTreeNode = function (tree, treeId) {
if (!tree || treeId == null) {
return
}
setTimeout(() => {
let barDataItem = tree.dataSource.get(treeId);
if (barDataItem) {
tree.expandPath([treeId])
} else {
expandTreeNode(tree, treeId)
}
});
}, 300);
}
/**
* 选中树节点
*
* @param tree
* @param treeId
*/
let selectTreeNode = (tree, treeId) => {
if (!tree || treeId == null) {
return
}
setTimeout(() => {
let barDataItem = tree.dataSource.get(treeId);
if (barDataItem) {
let barElement = tree.findByUid(barDataItem.uid);
// 刷新完成后选中对应的树节点
tree.select(barElement);
// 赋值
setTreeNodeValue(barDataItem);
} else {
selectTreeNode(tree, treeId)
}
}, 300)
}
/**
* 设置树节点的值
*
* @param nodeData
*/
let setTreeNodeValue = function (nodeData) {
IPLATUI.EFTree.materialTree.selectTreeNode.nodeId = nodeData.nodeId;
IPLATUI.EFTree.materialTree.selectTreeNode.pId = nodeData.pId;
IPLATUI.EFTree.materialTree.selectTreeNode.prdtCode = nodeData.prdtCode;
IPLATUI.EFTree.materialTree.selectTreeNode.projCode = nodeData.projCode;
IPLATUI.EFTree.materialTree.selectTreeNode.prdtName = nodeData.prdtName;
IPLATUI.EFTree.materialTree.selectTreeNode.projName = nodeData.projName;
IPLATUI.EFTree.materialTree.selectTreeNode.deliveryDate = nodeData.deliveryDate;
IPLATUI.EFTree.materialTree.selectTreeNode.lv = nodeData.lv;
}
/**
* 动态显示列名
*/
let dynamicColumnName = function () {
// 根据叶子节点动态设置列名
let lv = IPLATUI.EFTree.materialTree.selectTreeNode.lv;
let th = $("th[data-field='prdtName']");
if (lv == 2) {
th.html("<span class=\"i-input-required\">*</span>零件名称");
} else {
th.html("<span class=\"i-input-required\">*</span>部件名称");
}
}
......@@ -4,11 +4,10 @@
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<head>
<%-- <link rel="stylesheet" href="${ctx}/css/simulatedOperation.css"/>--%>
</head>
<EF:EFPage title="物料清单">
<EF:EFRegion id="inqu" title="查询条件">
<EF:EFInput ename="inqu_status-0-projId" type="hidden"/>
<div class="row">
<%--<EF:EFSelect ename="inqu_status-0-prdtType" cname="部件类型" colWidth="3" filter="contains"
template="#=textField#" valueTemplate="#=textField#">
......@@ -23,10 +22,9 @@
<EF:EFOption label="未提交" value="0"/>
<EF:EFOption label="已提交" value="1"/>
</EF:EFSelect>
<EF:EFInput ename="inqu_status-0-projId" hidden="true"/>
</div>
<%-- <EF:EFButton ename="QUERY" cname="查询" row="1" class="btn-align-right"></EF:EFButton>--%>
</EF:EFRegion>
<div id="splitter" class="i-fit-height" style="display: inline">
<div id="left-pane" class="i-fit-height" style="width: 20%;float:left;">
<EF:EFRegion id="projTree" title="BOM结构图" fitHeight="true">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment