|
|
@@ -74,7 +74,7 @@ $(document).ready(function () {
|
|
|
model +
|
|
|
"_lib'][data-id='" +
|
|
|
addLib.id +
|
|
|
- "']"
|
|
|
+ "']",
|
|
|
).length > 0
|
|
|
) {
|
|
|
alert("重复添加数据!");
|
|
|
@@ -166,7 +166,7 @@ $(document).ready(function () {
|
|
|
} else if (actionType == "modify") {
|
|
|
let oldIndex = $("#groupIndex").val();
|
|
|
let parentTr = $("input[data-id = " + oldIndex + "]").parents(
|
|
|
- ".taxGroup_tr"
|
|
|
+ ".taxGroup_tr",
|
|
|
);
|
|
|
parentTr.after(htmlString);
|
|
|
parentTr.remove();
|
|
|
@@ -449,7 +449,7 @@ $(document).ready(function () {
|
|
|
})">
|
|
|
<span class="glyphicon glyphicon-arrow-up"></span>
|
|
|
<input type="hidden" class="sort_temp_value" value='${JSON.stringify(
|
|
|
- { id: lib.id, name: lib.name }
|
|
|
+ { id: lib.id, name: lib.name },
|
|
|
)}'>
|
|
|
</a>
|
|
|
<a class="pull-right stdBillUp" title="下移" onclick="libDown(${
|
|
|
@@ -478,8 +478,8 @@ $(document).ready(function () {
|
|
|
lib.id
|
|
|
}" value='${JSON.stringify({ id: lib.id, name: lib.name })}'>
|
|
|
${index === 0 ? '<i class="glyphicon glyphicon-flag"></i> ' : ""}${
|
|
|
- lib.name
|
|
|
- }
|
|
|
+ lib.name
|
|
|
+ }
|
|
|
</p>`;
|
|
|
});
|
|
|
$(".bill-list").html(html);
|
|
|
@@ -583,7 +583,7 @@ $(document).ready(function () {
|
|
|
$(this).parent().remove();
|
|
|
})*/
|
|
|
$(
|
|
|
- ".bill-list, .ration-list, .glj-list, .fee-list, .artificial-list, .program-list, .billsGuidance-list,.feature-list,.info-list,.progressive-list,.engineer_info-list,.engineer_feature-list,.material-list,.main_quantity-list,.economic-list,.over_height-list,.item_increase-list"
|
|
|
+ ".bill-list, .ration-list, .glj-list, .fee-list, .artificial-list, .program-list, .billsGuidance-list,.feature-list,.info-list,.progressive-list,.engineer_info-list,.engineer_feature-list,.material-list,.main_quantity-list,.economic-list,.over_height-list,.item_increase-list",
|
|
|
).on("click", ".remove-lib", function () {
|
|
|
$(this).parent().remove();
|
|
|
});
|
|
|
@@ -827,20 +827,115 @@ $(document).ready(function () {
|
|
|
});
|
|
|
//
|
|
|
|
|
|
- // CLD 办事处选择
|
|
|
- $("#category-select").change(function () {
|
|
|
- $.ajax({
|
|
|
- url: "/compilation/changeCategory",
|
|
|
- type: "post",
|
|
|
- data: { id: id, category: $(this).val() },
|
|
|
- dataType: "json",
|
|
|
- success: function (response) {
|
|
|
- if (response.error !== 0) {
|
|
|
- alert("更改失败");
|
|
|
+ // CLD 办事处选择 - 多级子菜单
|
|
|
+ (function () {
|
|
|
+ function buildTree(list) {
|
|
|
+ var map = {};
|
|
|
+ var roots = [];
|
|
|
+ list.forEach(function (item) {
|
|
|
+ map[item.id] = { data: item, children: [] };
|
|
|
+ });
|
|
|
+ list.forEach(function (item) {
|
|
|
+ if (item.parentId && item.parentId !== "0" && map[item.parentId]) {
|
|
|
+ map[item.parentId].children.push(map[item.id]);
|
|
|
+ } else {
|
|
|
+ roots.push(map[item.id]);
|
|
|
}
|
|
|
- },
|
|
|
+ });
|
|
|
+ return roots;
|
|
|
+ }
|
|
|
+
|
|
|
+ function renderTree(nodes, depth) {
|
|
|
+ depth = depth || 0;
|
|
|
+ var html = "";
|
|
|
+ nodes.forEach(function (node) {
|
|
|
+ var hasChildren = node.children.length > 0;
|
|
|
+ var paddingLeft = depth * 16 + 10 + "px";
|
|
|
+ html += '<li style="padding:0;">';
|
|
|
+ html +=
|
|
|
+ '<div class="category-node" data-id="' +
|
|
|
+ node.data.id +
|
|
|
+ '" data-name="' +
|
|
|
+ node.data.name +
|
|
|
+ '" style="padding:5px 10px 5px ' +
|
|
|
+ paddingLeft +
|
|
|
+ '; cursor:pointer; white-space:nowrap; display:flex; align-items:center; justify-content:space-between; user-select:none;">';
|
|
|
+ html += "<span>" + node.data.name + "</span>";
|
|
|
+ if (hasChildren) {
|
|
|
+ html +=
|
|
|
+ '<span class="category-toggle" style="margin-left:8px; font-size:12px; color:#555; cursor:pointer;">' +
|
|
|
+ (depth === 0 ? "▼" : "▶") +
|
|
|
+ "</span>";
|
|
|
+ }
|
|
|
+ html += "</div>";
|
|
|
+ if (hasChildren) {
|
|
|
+ html +=
|
|
|
+ '<ul style="list-style:none; padding:0; margin:0; display:' +
|
|
|
+ (depth === 0 ? "block" : "none") +
|
|
|
+ ';">';
|
|
|
+ html += renderTree(node.children, depth + 1);
|
|
|
+ html += "</ul>";
|
|
|
+ }
|
|
|
+ html += "</li>";
|
|
|
+ });
|
|
|
+ return html;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (typeof categoryListData === "undefined") {
|
|
|
+ categoryListData = JSON.parse(
|
|
|
+ document.getElementById("category-list-json").value || "[]",
|
|
|
+ );
|
|
|
+ currentCategoryID =
|
|
|
+ document.getElementById("category-current-id").value || "";
|
|
|
+ }
|
|
|
+ if (categoryListData.length) {
|
|
|
+ var tree = buildTree(categoryListData);
|
|
|
+ $("#category-tree").html(renderTree(tree));
|
|
|
+ if (currentCategoryID) {
|
|
|
+ var found = categoryListData.find(function (item) {
|
|
|
+ return item.id == currentCategoryID;
|
|
|
+ });
|
|
|
+ if (found) $("#category-label").text(found.name);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $(document).on("click", "#category-tree .category-toggle", function (e) {
|
|
|
+ var $children = $(this).closest("li").children("ul");
|
|
|
+ $children.toggle();
|
|
|
+ $(this).html($children.is(":visible") ? "▼" : "▶");
|
|
|
});
|
|
|
- });
|
|
|
+
|
|
|
+ $(document).on("click", "#category-tree .category-node", function (e) {
|
|
|
+ if ($(e.target).hasClass("category-toggle")) return;
|
|
|
+ var categoryId = $(this).data("id");
|
|
|
+ var categoryName = $(this).data("name");
|
|
|
+ $("#category-label").text(categoryName);
|
|
|
+ $("#category-select").val(categoryId);
|
|
|
+ $("#category-panel").hide();
|
|
|
+ $.ajax({
|
|
|
+ url: "/compilation/changeCategory",
|
|
|
+ type: "post",
|
|
|
+ data: { id: id, category: categoryId },
|
|
|
+ dataType: "json",
|
|
|
+ success: function (response) {
|
|
|
+ if (response.error !== 0) {
|
|
|
+ alert("更改失败");
|
|
|
+ }
|
|
|
+ },
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ $("#category-dropdown-btn").on("click", function (e) {
|
|
|
+ e.stopPropagation();
|
|
|
+ $("#category-panel").toggle();
|
|
|
+ });
|
|
|
+
|
|
|
+ $(document).on("click", function (e) {
|
|
|
+ if (!$(e.target).closest("#category-dropdown-wrap").length) {
|
|
|
+ $("#category-panel").hide();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ })();
|
|
|
|
|
|
// 选择默认所在地
|
|
|
$("#location-select").change(function () {
|
|
|
@@ -1490,7 +1585,7 @@ function deleteEngineerClick(engineerID, element) {
|
|
|
},
|
|
|
null,
|
|
|
["确定", "取消"],
|
|
|
- false
|
|
|
+ false,
|
|
|
);
|
|
|
}
|
|
|
|
|
|
@@ -1509,7 +1604,7 @@ function copyEngineerClick(engineerID) {
|
|
|
},
|
|
|
null,
|
|
|
["确定", "取消"],
|
|
|
- false
|
|
|
+ false,
|
|
|
);
|
|
|
}
|
|
|
|
|
|
@@ -1533,7 +1628,7 @@ function updateEngineer(engineerID, data, callback) {
|
|
|
if (callback) {
|
|
|
callback();
|
|
|
}
|
|
|
- }
|
|
|
+ },
|
|
|
);
|
|
|
}
|
|
|
|
|
|
@@ -1546,11 +1641,11 @@ function editTaxGroup(ele) {
|
|
|
if (!_.isEmpty(groupData)) {
|
|
|
$("#taxType").val(groupData.taxType ? groupData.taxType : "");
|
|
|
$("#program_lib").val(
|
|
|
- groupData.program_lib ? groupData.program_lib.id : ""
|
|
|
+ groupData.program_lib ? groupData.program_lib.id : "",
|
|
|
);
|
|
|
$("#norm_lib").val(groupData.norm_lib ? groupData.norm_lib : "");
|
|
|
$("#template_lib").val(
|
|
|
- groupData.template_lib ? groupData.template_lib.id : ""
|
|
|
+ groupData.template_lib ? groupData.template_lib.id : "",
|
|
|
);
|
|
|
$("#col_lib").val(groupData.col_lib ? groupData.col_lib.id : "");
|
|
|
$("#fee_lib").val(groupData.fee_lib ? groupData.fee_lib.id : "");
|