Forráskód Böngészése

机械组成物可添加组成物

zhongzewei 6 éve
szülő
commit
c8ed7c7fe9

+ 2 - 2
public/web/tools_const.js

@@ -10,8 +10,8 @@
 //允许使用的工料机类型:人工、普通材料、混凝土、砂浆、配合比、商品混凝土、商品砂浆、机械台班、机械组成物、机上人工、设备
 let allowGljType = [1, 201, 202, 203, 204, 205, 206, 301, 302, 303,5];
 
-//允许含有组成物的工料机类型:混凝土、砂浆、配合比、机械台班
-let allowComponent = [202, 203, 204, 301];
+//允许含有组成物的工料机类型:混凝土、砂浆、配合比、机械台班、机械组成物(普通材料)
+let allowComponent = [202, 203, 204, 301, 302];
 //可以作为组成物的工料机类型:普通材料、机械组成物、机上人工
 let componentType = [201, 302, 303];
 //允许含有组成物的机械工料机类型:机械台班

+ 1 - 1
web/maintain/std_glj_lib/js/components.js

@@ -117,7 +117,7 @@ let componentOprObj = {
         for(let i = 0; i < gljList.length; i++){
             if(machineAllowComponent.includes(that.currentGlj.gljType) && machineComponent.includes(gljList[i].gljType) ||
                 materialAllowComponent.includes(that.currentGlj.gljType) && gljList[i].gljType === 201||
-                that.currentGlj.gljType === 4 && gljList[i].gljType === 4 && (!gljList[i].component || gljList[i].component.length === 0) && gljList[i].ID !== that.currentGlj.ID){
+                that.currentGlj.gljType === 302 && gljList[i].gljType === 201){//机械组成物,应可选择无组成物的普通材料
                 let isExist = false;
                 for(let j = 0; j < that.currentComponent.length; j++){
                     if(that.currentComponent[j].ID === gljList[i].ID){

+ 4 - 2
web/maintain/std_glj_lib/js/glj.js

@@ -466,11 +466,13 @@ let repositoryGljObj = {
         return v !== undefined && v !== null;
     },
 
-    //成为了组成物,暂时只需要判断主材的
+    //成为了组成物
     isComponent: function (gljId, gljList) {
+        //暂时只需要判断主材(可成为主材的组成物)、机械组成物(可成为机械台班的组成物,但是机械组成物可能引用了普通材料)
+        let gljTypes = [302, 4];
         for(let i = 0, len = gljList.length; i < len; i++){
             let gljComponent = gljList[i].component;
-            if(gljList[i].gljType === 4 && this.isDef(gljComponent) && gljComponent.length > 0){
+            if(gljTypes.includes(gljList[i].gljType) && this.isDef(gljComponent) && gljComponent.length > 0){
                 for(let j = 0, jLen = gljComponent.length; j < jLen; j++){
                     if(gljComponent[j].ID === gljId){
                         return true;

+ 6 - 4
web/maintain/std_glj_lib/js/gljComponent.js

@@ -277,10 +277,12 @@ let gljComponentOprObj = {
                     //控制按钮是否可用
                     let insertDis = false,
                         delDis = false;
-                    if(!(that.currentGlj && allowComponent.includes(that.currentGlj.gljType)) || (that.currentGlj.gljType === 4 && that.isComponent(that.currentGlj.ID, that.gljList))){
+                    if(!(that.currentGlj && allowComponent.includes(that.currentGlj.gljType)) || //机械组成物,应可选择无组成物的普通材料
+                        ([4].includes(that.currentGlj.gljType) && that.isComponent(that.currentGlj.ID, that.gljList))){
                         insertDis = true;
                     }
-                    if(!that.currentGlj || typeof that.currentComponent === 'undefined' || (typeof that.currentComponent !== 'undefined' && target.row >= that.currentComponent.length)){//右键定位在有组成物的行,删除键才显示可用
+                    if(!that.currentGlj || typeof that.currentComponent === 'undefined' ||
+                        (typeof that.currentComponent !== 'undefined' && target.row >= that.currentComponent.length)){//右键定位在有组成物的行,删除键才显示可用
                         delDis = true;
                     }
                     return {
@@ -372,7 +374,7 @@ let gljComponentOprObj = {
                     hasCode = true;
                     if((materialAllowComponent.includes(that.currentGlj.gljType) && gljList[i].gljType === 201)
                         || (machineAllowComponent.includes(that.currentGlj.gljType) && machineComponent.includes(gljList[i].gljType))
-                        || (that.currentGlj.gljType === 4 && gljList[i].gljType === 4 && that.currentGlj.ID !== gljList[i].ID)){//普通材料
+                        || (that.currentGlj.gljType === 302 && gljList[i].gljType === 201)){
                         //是否与原有组成物不同
                         let isExist = false;
                         for(let j = 0; j < component.length; j++){
@@ -515,7 +517,7 @@ let gljComponentOprObj = {
                         existCode = true;
                         if((materialAllowComponent.includes(that.currentGlj.gljType) && gljCache[j].gljType === 201)
                             || (machineAllowComponent.includes(that.currentGlj.gljType) && machineComponent.includes(gljCache[j].gljType))
-                            || (that.currentGlj.gljType === 4 && gljCache[j].gljType === 4 && that.currentGlj.ID !== gljCache[i].ID)){
+                            || (that.currentGlj.gljType === 302 && gljCache[j].gljType === 201)){
                             //是否与原有组成物不同
                             let isExist = false;
                             for(let k = 0; k < component.length; k++){