|
@@ -9,6 +9,7 @@ let Tree = null;
|
|
|
let movetoZTree = null;
|
|
|
let copytoZTree = null;
|
|
|
let engineering = [];
|
|
|
+let feeRateData = [];
|
|
|
let projectType = {
|
|
|
folder: 'Folder',
|
|
|
tender: 'Tender',
|
|
@@ -165,13 +166,14 @@ $(document).ready(function() {
|
|
|
$("input[name='valuation_type']").click(function() {
|
|
|
let type = $(this).val();
|
|
|
let targetData = type === 'bill' ? JSON.parse(billValuation) : JSON.parse(rationValuation);
|
|
|
+
|
|
|
let html = '<option value="">请选择计划规则</option>';
|
|
|
|
|
|
for(let valuation of targetData) {
|
|
|
if (valuation === null) {
|
|
|
continue;
|
|
|
}
|
|
|
- html += '<option value="'+ valuation._id +'" data-engineering="'+ valuation.engineering +'">'+ valuation.name +'</option>';
|
|
|
+ html += '<option value="'+ valuation._id +'">'+ valuation.name +'</option>';
|
|
|
}
|
|
|
$("#valuation").html(html);
|
|
|
});
|
|
@@ -228,20 +230,26 @@ $(document).ready(function() {
|
|
|
}
|
|
|
if (projectInfo !== null) {
|
|
|
let savedProjectData = localStorage.getItem(projectInfo.data.name);
|
|
|
+ console.log(savedProjectData);
|
|
|
savedProjectData = JSON.parse(savedProjectData);
|
|
|
// 填入计价规则
|
|
|
let valuationHtml = '<option value="'+ savedProjectData.valuation +'">'+ savedProjectData.valuationName +'</option>';
|
|
|
$("#tender-valuation").html(valuationHtml);
|
|
|
|
|
|
// 填入工程专业
|
|
|
- let engineeringString = getEngineeringName(savedProjectData.engineering);
|
|
|
- let engineeringHtml = '<option value="'+ savedProjectData.engineering +'">'+ engineeringString +'</option>';
|
|
|
+ let engineeringHtml = getEngineeringHtml(savedProjectData.engineeringList);
|
|
|
$("#tender-engineering").html(engineeringHtml);
|
|
|
|
|
|
$("input[name='tender_valuation_type']").attr('disabled', 'disabled').removeAttr('checked', 'checked');
|
|
|
$("input[name='tender_valuation_type'][value='"+ savedProjectData.valuationType +"']")
|
|
|
.attr("checked", "checked").removeAttr('disabled', 'disabled');
|
|
|
|
|
|
+ // 填入费率文件
|
|
|
+ let feeHtml = '<option>请选择费率文件</option>';
|
|
|
+ // for (let fee of savedProjectData.feeLib) {
|
|
|
+ // feeHtml += '<option value="'+ fee.id +'">'+ fee.name +'</option>';
|
|
|
+ // }
|
|
|
+ $("#tender-fee-rate").html(feeHtml);
|
|
|
}
|
|
|
|
|
|
});
|
|
@@ -523,7 +531,16 @@ function AddProject() {
|
|
|
}
|
|
|
let valuationName = $("#valuation").children("option:selected").text();
|
|
|
let valuationType = $("input[name='valuation_type']:checked").val();
|
|
|
- let engineering = $("#valuation").children("option:selected").data("engineering");
|
|
|
+ let engineeringList = [];
|
|
|
+
|
|
|
+ let valuationData = valuationType === 'bill' ? JSON.parse(billValuation) : JSON.parse(rationValuation);
|
|
|
+ for(let tmp of valuationData) {
|
|
|
+ if (tmp._id === valuation) {
|
|
|
+ engineeringList = tmp.engineering_list;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
let callback = function() {
|
|
|
$("#add-project-dialog").modal("hide");
|
|
|
// 记录选择后的信息
|
|
@@ -531,7 +548,7 @@ function AddProject() {
|
|
|
valuation: valuation,
|
|
|
valuationType: valuationType,
|
|
|
valuationName: valuationName,
|
|
|
- engineering: engineering
|
|
|
+ engineeringList: engineeringList,
|
|
|
};
|
|
|
localStorage.setItem(name, JSON.stringify(projectInfo));
|
|
|
};
|
|
@@ -875,19 +892,22 @@ function GetTargetTreeNode(zTreeObj) {
|
|
|
/**
|
|
|
* 根据指定id获取对应的工程专业
|
|
|
*
|
|
|
- * @param {Number} id
|
|
|
+ * @param {Array} engineeringList
|
|
|
* @return {String}
|
|
|
*/
|
|
|
-function getEngineeringName(id) {
|
|
|
- let result = '';
|
|
|
- if (engineering.length <= 0) {
|
|
|
+function getEngineeringHtml(engineeringList) {
|
|
|
+ let result = '<option>请选择对应的工程专业</option>';
|
|
|
+ if (engineeringList.length <= 0) {
|
|
|
return result;
|
|
|
}
|
|
|
-
|
|
|
+ let engineeringObject = {};
|
|
|
for(let tmp of engineering) {
|
|
|
- if (tmp.value === id) {
|
|
|
- result = tmp.name;
|
|
|
- break;
|
|
|
+ engineeringObject[tmp.value] = tmp.name;
|
|
|
+ }
|
|
|
+
|
|
|
+ for(let tmp of engineeringList) {
|
|
|
+ if (engineeringObject[tmp.engineering] !== undefined) {
|
|
|
+ result += '<option value="'+ tmp.engineering_id +'">'+ engineeringObject[tmp.engineering] +'</option>';
|
|
|
}
|
|
|
}
|
|
|
|