var treeData = null; var treeSel = null; var tree = null; var importValueList = [{ "text": "中通快递标准模板", "value": "http://cloudprint.cainiao.com/template/standard/301/221" }, { "text": "中通快递标准三联模板", "value": "http://cloudprint.cainiao.com/template/standard/74805/47" }, { "text": "中通快递标准模板(蓝牙版)", "value": "http://cloudprint.cainiao.com/template/standard/285198/2" }, { "text": "中通便携式模板", "value": "http://cloudprint.cainiao.com/template/standard/278404/3" }, { "text": "中通便携式模板(高度200mm)", "value": "http://cloudprint.cainiao.com/template/standard/288345/4" }, { "text": "中通一联单", "value": "http://cloudprint.cainiao.com/template/standard/300336/38" }, { "text": "中通蓝牙一联单", "value": "http://cloudprint.cainiao.com/template/standard/308812/8" }]; $(document).ready(function () { if (treeData != null) { tree = mini.get("m_tree"); tree.loadList(treeData, "id", "pid"); if (treeSel != null) { $_selTreeNode(); } } }); function $_selTreeNode() { if (treeSel == null) true; tree.expandPath(treeSel); tree.expandNode(treeSel); tree.selectNode(treeSel); //alert(tree.scrollIntoView); tree.scrollIntoView(tree.getNode(treeSel)); } function getParentName(pId) { if (treeData != null && treeData.length > 0) { for (var i = 0; i < treeData.length; i++) { if (treeData[i].id == pId) return treeData[i].name; } } return ""; } function treeNodeSelFn(e, node) { var id = e.node.id; $("#hId").val(id); $("#hName").val(e.node.name); if (id == "0") { addFn(); $("#designTable").hide() } else { $("#designTable").show() getDesignInfo() getAjax("get_dic_item", "class=" + $("#hClass").val() + "&mId=" + id, function (dataList) { if (dataList.length > 0) { var data = dataList[0]; mini.get("btnAdd").setEnabled(true); mini.get("btnDel").setEnabled(true); $("#hParentId").val(data.ParentID); var pName = getParentName(data.ParentID); $("#txtParentName").val(pName); $("#txtName").val(data.Name); $("#txtCode").val(data.Code); if ($("#selShop").is(':visible')) { mini.get("selPemShop").setValue(data.pemShop); } $("#txtSort").val(data.Sort); $("#chkDel")[0].checked = (data.IsDel == "False" ? false : true); if ($("#OldOrder").is(':visible')) { $("#OldOrder")[0].checked = (data.OldOrder == "False" ? false : true); } $("#txtMemo").val(data.Memo); if (data.Url != undefined) $("#txtUrl").val(data.Url); if (data.Tag != undefined) $("#txtTag").val(data.Tag); if (data.Icon != undefined) $("#txtIcon").val(data.Icon); if (data.HostFieldName != undefined) $("#txtHostFieldName").val(data.HostFieldName); if (data.HostName != undefined) $("#txtHostName").val(data.HostName); if (data.MaxStock != undefined) $("#txtMaxStock").val(data.MaxStock); if (data.WarningStock != undefined) $("#txtWarningStock").val(data.WarningStock); if (data.isOperate != undefined) $("#chkOperate")[0].checked = (data.isOperate == "False" ? false : true); } }); } } function addFn() { var id = $("#hId").val(); $("#hParentId").val(id); var objs = $(".m_tb").find("input"); for (var i = 0; i < objs.length; i++) { if (objs[i].type == "text") { objs[i].value = ""; } else if (objs[i].type = "checkbox") { objs[i].checked = false; } } var pName = getParentName(id); $("#txtParentName").val(pName); $("#txtMemo").val(""); mini.get("btnAdd").setEnabled(false); mini.get("btnDel").setEnabled(false); if ($("#selShop").is(':visible')) { mini.get("selPemShop").setValue(""); } $("#hId").val(""); } function saveFn() { var id = $("#hId").val(); var pArr = new Array(); if (id == "" || id == "0") { pArr.push("id=0"); pArr.push("pid=" + $("#hParentId").val()); } else { if ($("#hParentId").val() == "") { alert("数据错误无法保存"); return; } pArr.push("id=" + $("#hId").val()); pArr.push("pid=" + $("#hParentId").val()); } pArr.push("class=" + $("#hClass").val()); pArr.push("name=" + encodeURIComponent($("#txtName").val())); pArr.push("code=" + $("#txtCode").val()); if ($("#selShop").is(':visible')) { pArr.push("selPemShop=" + mini.get("selPemShop").getValue()); } pArr.push("sort=" + $("#txtSort").val()); pArr.push("del=" + ($("#chkDel")[0].checked ? "1" : "0")); if ($("#OldOrder").is(':visible')) { pArr.push("oldOrder=" + ($("#OldOrder")[0].checked ? "1" : "0")); } pArr.push("memo=" + encodeURI($("#txtMemo").val())); if ($("#chkOperate").length > 0) pArr.push("operate=" + ($("#chkOperate")[0].checked ? "1" : "0")); if ($("#txtUrl").length > 0) pArr.push("url=" + $("#txtUrl").val()); if ($("#txtTag").length > 0) pArr.push("tag=" + $("#txtTag").val()); if ($("#txtIcon").length > 0) pArr.push("icon=" + $("#txtIcon").val()); if ($("#txtHostFieldName").length > 0) pArr.push("hostfield=" + encodeURIComponent($("#txtHostFieldName").val())); if ($("#txtHostName").length > 0) pArr.push("hostname=" + encodeURIComponent($("#txtHostName").val())); if ($("#txtMaxStock").length > 0) pArr.push("maxstock=" + $("#txtMaxStock").val()); if ($("#txtWarningStock").length > 0) pArr.push("warningstock=" + $("#txtWarningStock").val()); getAjax("save_dic_item", pArr.join("&"), async function (data) { if (data != "") { var sArr = data.split('|'); await saveShopDesign(); setTimeout(() => { window.location = "DicPage.aspx?t=" + $("#hClass").val() + "&mId=" + sArr[0]; }, 200); //resultShow(sArr[1], ""); } else { alert('保存失败!'); } }); } function delFn() { var id = $("#hId").val(); if (id == "") { alert("找不到要删除的项!"); return false; } getAjax("del_dic_item", "class=" + $("#hClass").val() + "&mId=" + id, function (data) { if (data != "") { var sArr = data.split('|'); resultShow(sArr[1], "window.location='DicPage.aspx?t=" + $("#hClass").val() + "&mId=" + sArr[0] + "';"); } else { alert('删除失败!'); } }); } function builderFn() { var id = $("#hId").val(); if (id == "") { alert("找不到要生成的项!"); return false; } getAjax("build_dic_item", "mId=" + id, function (data) { if (data != "") { var sArr = data.split('|'); window.location = "DicPage.aspx?t=" + $("#hClass").val() + "&mId=" + sArr[0]; //resultShow(sArr[1], ""); } else { alert('保存失败!'); } }); } function transferFn() { var id = $("#hId").val(); if (id == "") { alert("找不到要操作的项!"); return false; } var win = mini.get("transfer_win"); win.setTitle("节点转移"); win.show(); } function saveTransferFn() { var id = $("#hId").val(); var pId = $("#selTrans").val(); var sort = mini.get("txtTransSort").getValue(); if (sort == "") { alert("排序不允许为空!"); return; } getAjax("transfer_dic_item", "class=" + $("#hClass").val() + "&mId=" + id + "&pId=" + pId + "&sort=" + sort, function (data) { if (data != "") { var sArr = data.split('|'); window.location = "DicPage.aspx?t=" + $("#hClass").val() + "&mId=" + sArr[0]; //resultShow(sArr[1], ""); } else { alert('保存失败!'); } }); }