浏览代码

yun spreadjs key

zhangweicheng 7 年之前
父节点
当前提交
274e9c400b

文件差异内容过多而无法显示
+ 1 - 1
config/config.js


+ 39 - 2
modules/main/facade/ration_facade.js

@@ -133,8 +133,11 @@ async function replaceRations(userID,data) {
 }
 
 async function replaceRation(nodeInfo,stdRation,firstLibID,projectID,calQuantity) {
-    if(stdRation){
-        await deleRationSubRecode(projectID,nodeInfo.ID);
+    if(nodeInfo.newCode == null||nodeInfo.newCode ==""){//说明是删除编号,则要变成一条空定额
+        await deleRationSubRecode(projectID,nodeInfo.ID);//删除定额下挂的各种数据,如定额工料机等
+        return await setEmptyRation(projectID,nodeInfo.ID);
+    }else if(stdRation){
+        await deleRationSubRecode(projectID,nodeInfo.ID);//删除定额下挂的各种数据,如定额工料机等
         let newRation = await updateRation(stdRation,firstLibID,nodeInfo.ID,nodeInfo.billsItemID,projectID,calQuantity);//生成并插入新的定额
         return await addRationSubList(stdRation,newRation,nodeInfo.needInstall);
     }else {
@@ -375,6 +378,40 @@ async function  updateRation(std,firstLibID,rationID,billsItemID,projectID,calQu
     return newRation;
 }
 
+async function setEmptyRation(projectID,rationID){
+    let ration ={};
+    ration.code = "";
+    ration.name = "";
+    ration.caption = "";
+    ration.unit = "";
+    ration.libID = null;
+    ration.content = "";
+    ration.adjustState = '';
+    ration.isFromDetail=0;
+    ration.isSubcontract=false;
+    ration.fees=[];
+    ration.comments = "";
+    ration.ruleText = "";
+    ration.quantity="";
+    ration.contain="";
+    ration.quantityEXP="";
+    ration.from = 'std';
+    //定额前缀 none:0, complementary:1, borrow: 2
+    ration.prefix = '';
+    ration.rationAssList = [];
+    ration.marketUnitFee ="";
+    ration.marketTotalFee ="";
+    ration.maskName = "";
+    ration.targetTotalFee ='';
+    ration.targetUnitFee = "";
+    ration.deleteInfo = null;
+    ration.quantityCoe = {};
+    ration.rationQuantityCoe="";
+    ration.tenderQuantity = "";
+    let newRation = await ration_model.model.findOneAndUpdate({ID:rationID,projectID:projectID},{"$set":ration},{new: true});//;
+    return {ration:newRation,ration_gljs:[],ration_coes:[],ration_installs:[]};
+}
+
 function createRationAss(std) {
     let  rationAssList = [];//生成辅助定额
     if(std.hasOwnProperty('rationAssList')&&std.rationAssList.length>0){

+ 4 - 2
web/building_saas/main/js/models/ration.js

@@ -399,8 +399,10 @@ var Ration = {
                     needInstall = project.Bills.isFBFX(r.node);
                 }
                 r.value===null||r.value===undefined?"":r.value = r.value.replace(/[\s\r\n]/g, "");//去掉空格回车换行等字符
-                nodeInfo.push({ID:r.node.data.ID,billsItemID:r.node.data.billsItemID,newCode:r.value,needInstall:needInstall});
-                refershNodes.push(r.node);
+                if(r.value != r.node.data.code){
+                    nodeInfo.push({ID:r.node.data.ID,billsItemID:r.node.data.billsItemID,newCode:r.value,needInstall:needInstall});
+                    refershNodes.push(r.node);
+                }
             }
             let calQuantity = optionsOprObj.getOption(optionsOprObj.optionsTypes.GENERALOPTS, 'rationQuanACToBillsQuan');
             $.bootstrapLoading.start();

+ 17 - 6
web/building_saas/main/js/views/project_view.js

@@ -524,9 +524,9 @@ var projectObj = {
         let node = project.mainTree.items[info.row];
         let fieldName = projectObj.mainController.setting.cols[info.col].data.field;
         let value = info.sheet.getValue(info.row, info.col);
-        if(fieldName === 'code' && node && calcTools.isRationItem(node) && isDef(node.data.code)){
+        if(fieldName === 'code' && node && calcTools.isRationItem(node) && isDef(node.data.code)&&isDef(value)){
             if (isDef(node.data.prefix) && node.data.prefix !== rationPrefix.none){
-                value = value.replace(new RegExp(node.data.prefix), '');
+                 value = value.replace(new RegExp(node.data.prefix), '');
             };
             value = value.replace(new RegExp(rationPrefix.replace), '');
             info.sheet.setValue(info.row, info.col, value);
@@ -545,11 +545,22 @@ var projectObj = {
                 return;
             }
         }
-    /*    if(node){
-            if(!$("#qd").is(":visible"))  $('#stdBillsTab').click();
-        }*/
+        if(fieldName == 'code' && node){
+            projectObj.showBillOrRationLib(node)
+        }
+
+    },
+    showBillOrRationLib(node){
+        if(node.sourceType == ModuleNames.bills){//
+
+        }
+
 
 
+/*
+        if(node){
+            if(!$("#qd").is(":visible"))  $('#stdBillsTab').click();
+        }*/
     },
     onColumnWidthChanged: function (sender, info) {         // CSL,2018.07.25
         if (info.colList.includes(4) || info.colList.includes(5)){
@@ -605,7 +616,7 @@ var projectObj = {
                 let node = project.mainTree.items[changedCell.row];
                 let colSetting = setting.cols[changedCell.col];
                 let value = projectObj.checkSpreadEditingText(changedCell.text, colSetting)
-                if(colSetting.data.field=='code' && value != '' && node.sourceType == project.Ration.getSourceType()&&node.data.type==rationType.ration){//如果是更新定额的编码
+                if(colSetting.data.field=='code' && node.sourceType == project.Ration.getSourceType()&&node.data.type==rationType.ration){//如果是更新定额的编码
                     updateRationCodes.push({'node':node,value:value});
                 }else {
                     projectObj.updateCellValue(node, value, colSetting,changedCell.text);