Просмотр исходного кода

Merge branch '1.0.0_online' of http://192.168.1.41:3000/SmartCost/ConstructionCost into 1.0.0_online

zhongzewei 6 лет назад
Родитель
Сommit
86439a1c88

+ 21 - 1
modules/all_models/evaluate_list.js

@@ -26,4 +26,24 @@ let evaluateSchema = {
     originPlace:String,//产地
     vender:String //厂家
 };
-mongoose.model("evaluate_list", new Schema(evaluateSchema, {versionKey: false, collection: "evaluate_list"}));
+mongoose.model("evaluate_list", new Schema(evaluateSchema, {versionKey: false, collection: "evaluate_list"}));
+
+let bidEvaluationSchema = {
+    ID:{type:String,  index: true},
+    projectID: {type:Number,index: true},
+    is_related:{type: Number, default: 0},//关联,1关,0不关
+    projectGLJID:Number,//关联工料机ID
+    seq:String,//序号
+    code:String,
+    name:String,
+    specs:String,
+    unit:String,
+    type:Number,
+    market_price:String,
+    quantity:String,
+    remark:String,
+    originPlace:String,//产地
+    vender:String //厂家
+};
+
+mongoose.model("bid_evaluation_list", new Schema(bidEvaluationSchema, {versionKey: false, collection: "bid_evaluation_list"}));

+ 1 - 1
modules/all_models/stdRation_ration.js

@@ -40,7 +40,7 @@ const rationItemSchema = new Schema({
     labourPrice: Number,
     materialPrice: Number,
     machinePrice: Number,
-    sectionId: Number,
+    sectionId: {type: Number,index: true},
     rationRepId: Number,
     caption: String,
     feeType: Number,

+ 1 - 22
modules/complementary_ration_lib/models/compleRationModel.js

@@ -165,20 +165,10 @@ class CompleRatoinDao {
                 comGljs = await complementaryGljModel.find({userId: userId, ID: {$in: comGljIds}});
             }
             let gljDatas = gljUtil.sortRationGLJ(stdGljs.concat(comGljs),true);
-          /*  gljDatas.sort(function (a, b) {
-                let aV = a.gljType + a.code,
-                    bV = b.gljType + b.code;
-                if(aV > bV) {
-                    return 1;
-                } else if (aV < bV) {
-                    return -1;
-                }
-                return 0;
-            });*/
             if(ration.jobContent && ration.jobContent.toString().trim() !== ''){
                 hintsArr.push(`<label class="nomargin font_blue">工作内容:`);
                 hintsArr = hintsArr.concat(ration.jobContent.split('\n'));
-                hintsArr.push("</label>")
+                hintsArr.push("</label>");
                 hintsArr.push("");
             }
             for(let glj of gljDatas){
@@ -253,17 +243,6 @@ class CompleRatoinDao {
                 stdGljs = await stdGljModel.find({ID: {$in: stdGljIds}});
             }
             let gljDatas =  gljUtil.sortRationGLJ(stdGljs,true);
-        /*    gljDatas.sort(function (a, b) {
-                let aV = a.gljType + a.code,
-                    bV = b.gljType + b.code;
-                if(aV > bV) {
-                    return 1;
-                } else if (aV < bV) {
-                    return -1;
-                }
-                return 0;
-            });*/
-            gljDatas = gljUtil.sortRationGLJ(gljDatas,true);
             if(ration.jobContent && ration.jobContent.toString().trim() !== ''){
                 hintsArr.push(`<label class="nomargin font_blue">工作内容:`);
                 hintsArr = hintsArr.concat(ration.jobContent.split('\n'));

+ 7 - 7
modules/complementary_ration_lib/models/searchModel.js

@@ -15,13 +15,13 @@ const compleRationLib = 'compleRationLib';
 class SearchDao{
     async getRationItem(userId, compilationId, rationRepIds, code, ID, callback){
         let ration = null;
+        let otherLibs=[];
         try{
-            let firstLib = rationRepIds.shift();//优先取第一个
-            if(rationRepIds.includes(firstLib)) {//去掉重复的库ID
-                rationRepIds.splice(rationRepIds.indexOf(firstLib), 1);
-            }
-            if(rationRepIds.includes(compleRationLib)) {
-                rationRepIds.splice(rationRepIds.indexOf(compleRationLib), 1);
+            let firstLib = rationRepIds[0];//优先取第一个
+            for (let l of rationRepIds){
+                if(l != firstLib && l != compleRationLib){
+                    otherLibs.push(l);
+                }
             }
             if(firstLib == compleRationLib){//说明选中的是补充定额库
                 ration = await this.getCompleRation(userId,compilationId,code,ID);
@@ -34,7 +34,7 @@ class SearchDao{
                 ration = await this.getStdRation(firstQuery);
             }
             if(ration == null){//选中的定额库或者默认的定额库中没有找到定额,才走常规的流程查找其它定额库
-                let stdQuery = {rationRepId: {$in: rationRepIds}, code: code, $or: [{isDeleted: null}, {isDeleted: false}]};
+                let stdQuery = {rationRepId: {$in: otherLibs}, code: code, $or: [{isDeleted: null}, {isDeleted: false}]};
                 if(ID){
                     stdQuery = {ID: ID, $or: [{isDeleted: null}, {isDeleted: false}]};
                 }

+ 2 - 2
web/building_saas/glj/html/project_glj.html

@@ -49,9 +49,9 @@
                       <li class="nav-item">
                           <a class=" nav-link  active " data-toggle="tab" data-name="related_sheet" id="related_link" href="#related_div" role="tab">关联暂估材料</a>
                       </li>
-                     <li class="nav-item">
+                  <!--   <li class="nav-item">
                          <a class=" nav-link " data-toggle="tab" data-name="detail_sheet" id="detail_link" href="#related_div" role="tab">关联暂估材料明细</a>
-                     </li>
+                     </li>-->
                 </ul>
                 <!-- Tab panes -->
                 <div class="tab-content">

+ 6 - 2
web/building_saas/main/js/views/config_material_view.js

@@ -117,11 +117,11 @@ let configMaterialObj = {
         let materialIdList = projectGLJ.datas.constData.materialIdList;
         for(let d of projectGLJ.datas.gljList){
             if (materialIdList.indexOf(d.type) >= 0){//材料类型
+                if(d.is_evaluate == 1 && d.id != projectGLJID) continue;//排除其它已被关联的工料机
                 if(name != ''){//name为''时不做过滤
                     if(d.name.indexOf(name)==-1){
                         if(!(d.is_evaluate == 1 && d.id == projectGLJID)) continue;//虽然不匹配,但是是关联的暂估材料,这时应该显示
                     }
-                    if(d.is_evaluate == 1 && d.id != projectGLJID) continue;
                 }
                 let t = {
                     id:d.id,
@@ -371,9 +371,13 @@ let configMaterialObj = {
             let pdata = {id:relate.id,doc:{is_evaluate:value},action:'update',type:"glj_list"};
             task.push(pdata);
             let tdata = {type:'evaluate_list',doc:{},action:"update",ID:evaluate.ID};
-            if(value == 0){//如果是1的话
+            if(value == 0){//如果是0的话
                 tdata.doc = {is_related:0,quantity:'0'};
             }else {
+                if(relate.unit != evaluate.unit){//检查单位是否相同,如果不同不能关联
+                    alert("单位不一致,不允许关联!");
+                    return me.showEvaluateRelateDatas();
+                }
                 //如果已经关联了其它项目工料机,要把那个项目工料机的是否暂估标记为否
                 if(evaluate.is_related == 1)  task.push({id:evaluate.projectGLJID,doc:{is_evaluate:0},action:'update',type:"glj_list"});
                 //更新暂估材料的工料机ID,和关联标记