Kaynağa Gözat

项目管理新建项目报错问题

zhangweicheng 7 yıl önce
ebeveyn
işleme
aef7c10e0e

+ 2 - 1
modules/all_models/compilation.js

@@ -20,6 +20,7 @@ let engineeringListSchema = new Schema({
     }
 }, {_id: false});
 let childrenSchema = new Schema({
+    id:String,
     // 计价名称
     name: String,
     // 工程专业列表
@@ -47,7 +48,7 @@ let childrenSchema = new Schema({
             "cols":[]
         }
     }
-});
+},{_id: false});
 let modelSchema = {
     // 是否发布
     is_release: {

+ 5 - 5
modules/users/models/engineering_lib_model.js

@@ -39,10 +39,10 @@ class EngineeringLibModel extends BaseModel {
                 continue;
             }
             for(let engineering of valuation.engineering_list) {
-                if (engineeringTemp[valuation._id] === undefined) {
-                    engineeringTemp[valuation._id] = [engineering.engineering_id];
+                if (engineeringTemp[valuation.id] === undefined) {
+                    engineeringTemp[valuation.id] = [engineering.engineering_id];
                 }else {
-                    engineeringTemp[valuation._id].push(engineering.engineering_id);
+                    engineeringTemp[valuation.id].push(engineering.engineering_id);
                 }
                 engineeringLibIdList.push(engineering.engineering_id);
             }
@@ -79,10 +79,10 @@ class EngineeringLibModel extends BaseModel {
                 continue;
             }
             for(let engineering of valuation.engineering_list) {
-                if (engineering === null || engineeringLib[valuation._id] === undefined) {
+                if (engineering === null || engineeringLib[valuation.id] === undefined) {
                     continue;
                 }
-                for (let tmp of engineeringLib[valuation._id]) {
+                for (let tmp of engineeringLib[valuation.id]) {
                     if (tmp._id.toString() === engineering.engineering_id.toString()) {
                         engineering.lib = tmp;
                     }

+ 2 - 1
web/building_saas/pm/html/project-management.html

@@ -546,6 +546,7 @@
     let billValuation = '<%- billValuation %>';
     let rationValuation = '<%- rationValuation %>';
     let engineeringList = '<%- engineeringList %>';
-    let compilationData = JSON.parse('<%- compilationData %>');
+    let compilationData = '<%- compilationData %>';
+    compilationData = JSON.parse(compilationData.replace(/[\s\r\n]/g, ""));//去掉空格字符
 </script>
 </html>

+ 4 - 3
web/building_saas/pm/js/pm_newMain.js

@@ -24,6 +24,7 @@ let fileType = {
     feeRateFile: 'FeeRateFile'
 };
 
+
 const projTreeObj = {
     tree: null,
     workBook: null,
@@ -1064,7 +1065,7 @@ $(document).ready(function() {
             if (valuation === null) {
                 continue;
             }
-            html += `<option ${i === targetData.length -1 ? 'selected' : ''} value="${valuation._id}">${valuation.name}</option>`;
+            html += `<option ${i === targetData.length -1 ? 'selected' : ''} value="${valuation.id}">${valuation.name}</option>`;
         }
         $("#valuation").html(html);
         //$("#tender-engineering").html('<option value="">请选择对应的工程专业</option>');
@@ -1778,7 +1779,7 @@ function getEngineeringList(){
     let valuationData = valuationType === 'bill' ? JSON.parse(billValuation) : JSON.parse(rationValuation);
     let engineeringList = [];
     for(let tmp of valuationData) {
-        if (tmp._id === valuation) {
+        if (tmp.id === valuation) {
             engineeringList = tmp.engineering_list;
             break;
         }
@@ -2076,7 +2077,7 @@ function AddTender() {
         let valuationData = valuationType === 'bill' ? JSON.parse(billValuation) : JSON.parse(rationValuation);
         let engineeringList = [];
         for(let tmp of valuationData) {
-            if (tmp._id === valuation) {
+            if (tmp.id === valuation) {
                 engineeringList = tmp.engineering_list;
                 break;
             }