| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615 | 
							- /**
 
-  * Created by zhang on 2018/3/13.
 
-  */
 
- projectGljObject={
 
-     showTag:'ration',//mixRatio/machine
 
-     mixRatioType: [gljType.CONCRETE, gljType.MORTAR, gljType.MIX_RATIO,gljType.MAIN_MATERIAL],
 
-     machineType: [gljType.GENERAL_MACHINE],
 
-     projectGljSetting:{
 
-         header: [
 
-             {headerName: "编码", headerWidth: 80, dataCode: "code", dataType: "String"},
 
-             {headerName: "名称", headerWidth: 160, dataCode: "name", dataType: "String"},
 
-             {headerName: "规格型号", headerWidth: 120, dataCode: "specs", hAlign: "left", dataType: "String"},
 
-             {headerName: "单位", headerWidth: 45, dataCode: "unit", hAlign: "center", dataType: "String"},
 
-             {headerName: "类型", headerWidth: 45, dataCode: "short_name", hAlign: "center", dataType: "String"},
 
-             {headerName: "总消耗量", headerWidth: 100, dataCode: "quantity", hAlign: "right", dataType: "Number",decimalField:'glj.quantity'},
 
-             {headerName: "定额价", headerWidth: 70, dataCode: "basePrice", hAlign: "right", dataType: "Number",decimalField:'glj.unitPrice',validator:"number"},
 
-             {headerName: "调整价", headerWidth: 70, dataCode: "adjustPrice", hAlign: "right", dataType: "Number",decimalField:"glj.unitPrice"},
 
-             {headerName: "市场价", headerWidth: 70, dataCode: "marketPrice", hAlign: "right", dataType: "Number",decimalField:"glj.unitPrice",validator:"number"},
 
-             {headerName: "是否暂估", headerWidth: 60, dataCode: "is_evaluate", hAlign: "center", dataType: "String",cellType:'checkBox'},
 
-             {headerName: "供货方式", headerWidth: 80, dataCode: "supply", hAlign: "center", dataType: "String",cellType:'comboBox',editorValueType:true,options:supplyComboMap},
 
-             {headerName: "甲供数量", headerWidth: 100, dataCode: "supply_quantity", hAlign: "right", dataType: "String",validator:"number"},
 
-             {headerName: "交货方式", headerWidth: 90, dataCode: "delivery", hAlign: "left", dataType: "String"},
 
-             {headerName: "送达地点", headerWidth: 100, dataCode: "delivery_address", hAlign: "left", dataType: "String"},
 
-             {headerName: "不调价", headerWidth: 55, dataCode: "is_adjust_price", dataType: "String",cellType: "checkBox"}
 
-         ],
 
-         view: {
 
-             lockColumns: [0,1,2,3,4,5,7,12,13]
 
-         }
 
-     },
 
-     projectGljSpread:null,
 
-     projectGljSheet:null,
 
-     projectGljSheetData:[],
 
-     mixRatioSetting:{
 
-         header:[
 
-             {headerName: "编码", headerWidth: 120, dataCode: "code", dataType: "String"},
 
-             {headerName: "名称", headerWidth: 120, dataCode: "name", dataType: "String"},
 
-             {headerName: "单位", headerWidth: 120, dataCode: "unit", hAlign: "center", dataType: "String"},
 
-             {headerName: "类型", headerWidth: 120, dataCode: "short_name", hAlign: "center", dataType: "String"},
 
-             {headerName: "定额价", headerWidth: 120, dataCode: "basePrice", hAlign: "right", dataType: "Number",decimalField:'glj.unitPrice',validator:"number"},
 
-             {headerName: "调整价", headerWidth: 120, dataCode: "adjustPrice", hAlign: "right", dataType: "Number",decimalField:"glj.unitPrice"},
 
-             {headerName: "市场价", headerWidth: 120, dataCode: "marketPrice", hAlign: "right", dataType: "Number",decimalField:"glj.unitPrice",validator:"number"},
 
-             {headerName: "用量", headerWidth: 120, dataCode: "consumption", hAlign: "right", dataType: "Number",decimalField:"glj.quantity",validator:"number"}
 
-         ],
 
-         view: {
 
-             lockColumns: [0,1,2,3,4,5,6]
 
-         }
 
-     },
 
-     mixRatioSpread:null,
 
-     mixRatioSheet:null,
 
-     mixRatioData:[],
 
-     usedTenderList:[],
 
-     usedUnitPriceInfo:null,
 
-     initProjectGljSpread:function () {
 
-         this.projectGljSpread = SheetDataHelper.createNewSpread($("#project_glj_sheet")[0]);
 
-         this.projectGljSheet = this.projectGljSpread .getSheet(0);
 
-         this.initSheet(this.projectGljSheet,this.projectGljSetting);
 
-         this.projectGljSheet.bind(GC.Spread.Sheets.Events.SelectionChanged,this.onProjectGljSelectionChange);
 
-         this.projectGljSheet.bind(GC.Spread.Sheets.Events.EditStarting,this.onProjectGljEditStarting);
 
-         this.projectGljSheet.name('projectGljSheet');
 
-     },
 
-     initMixRatio:function () {
 
-         let me = projectGljObject;
 
-         if(me.mixRatioSpread==null){
 
-             me.initMixRatioSpread();
 
-             me.initRightClick();
 
-         }
 
-         me.showMixRatioData();
 
-     },
 
-     initMixRatioSpread:function () {
 
-         this.mixRatioSpread = SheetDataHelper.createNewSpread($("#mix_ratio_sheet")[0]);
 
-         this.mixRatioSheet = this.mixRatioSpread .getSheet(0);
 
-         this.initSheet(this.mixRatioSheet,this.mixRatioSetting);
 
-         this.mixRatioSheet.name('mixRatioSheet');
 
-     },
 
-     unitPriceFileInit:function() {
 
-         let me = this;
 
-         let projectGLJ = projectObj.project.projectGLJ;
 
-         let data = projectGLJ.datas;
 
-         me.usedTenderList = data.usedTenderList !== undefined ? data.usedTenderList : [];
 
-         me.usedUnitPriceInfo = data.constData.usedUnitPriceInfo !== undefined ?
 
-             data.constData.usedUnitPriceInfo : {};
 
-         $("#current-name").text(me.usedUnitPriceInfo.name);
 
-         let usedCount = me.usedTenderList.length <= 0 ? 1 : me.usedTenderList.length;
 
-         $("#used-project-count").text(usedCount);
 
-     },
 
-     getUsedTenderInfo:function() {
 
-         return projectGljObject.usedTenderList.join("<br>");
 
-     },
 
-     showMixRatioData:function () {
 
-         let me = this,gljId = null;
 
-         let consumptionCol =  _.findIndex(me.mixRatioSetting.header, { 'dataCode': 'consumption'});
 
-         if(me.showTag == 'ration'){
 
-             return;
 
-         }else if(me.showTag == 'mixRatio'){
 
-             me.mixRatioSheet.setValue(0, consumptionCol, '用量', GC.Spread.Sheets.SheetArea.colHeader);
 
-         }else if(me.showTag == 'machine'){
 
-             me.mixRatioSheet.setValue(0, consumptionCol, '消耗量', GC.Spread.Sheets.SheetArea.colHeader);
 
-         }
 
-         let sel = me.projectGljSheet.getSelections()[0];
 
-         if(me.projectGljSheetData.length>sel.row){
 
-             gljId = me.projectGljSheetData[sel.row].id;
 
-         }
 
-         projectObj.project.projectGLJ.getRatioData(gljId,function (data) {
 
-             let rationList =[];
 
-             console.log(data);
 
-             for(let glj of data){
 
-                 rationList.push(me.getMixRatioSheetData(glj)) ;
 
-             }
 
-             me.mixRatioData = rationList;
 
-             me.mixRatioSheet.setRowCount(0);
 
-             sheetCommonObj.showData(me.mixRatioSheet, me.mixRatioSetting,me.mixRatioData);
 
-             me.mixRatioSheet.setRowCount(me.mixRatioData.length);
 
-         })
 
-     },
 
-     getMixRatioSheetData:function (glj) {
 
-         let data ={
 
-             id:glj.id,
 
-             mix_ratio_id:glj.ratio_data.id,
 
-             code:glj.code,
 
-             name:glj.name,
 
-             specs:glj.specs,
 
-             unit:glj.unit,
 
-             type:glj.type,
 
-             short_name:projectObj.project.projectGLJ.getShortNameByID(glj.type),
 
-             consumption:glj.ratio_data.consumption,
 
-             unit_price:glj.unit_price
 
-         };
 
-         gljOprObj.setGLJPrice(data,glj);
 
-         return data;
 
-     },
 
-     onProjectGljEditStarting:function (sender, args) {
 
-         let me = projectGljObject;
 
-         let row = args.row;
 
-         let col = args.col;
 
-         let dataCode = me.projectGljSetting.header[col].dataCode;
 
-         if(dataCode=='is_adjust_price'||dataCode=='is_evaluate'){
 
-             args.cancel = true;
 
-         }
 
-     },
 
-     onProjectGljSelectionChange:function (sender, args) {
 
-         let me = projectGljObject;
 
-         let row = args.newSelections[0].row;
 
-         let col = args.newSelections[0].col;
 
-         let data = me.projectGljSheetData[row];
 
-         let dataCode = me.projectGljSetting.header[col].dataCode;
 
-         if(dataCode=='basePrice'||dataCode=='marketPrice'||dataCode=='supply'){//有组成物时,市场单价、定额价、供货方式不能修改
 
-             let priceCell = false;
 
-             if (data.ratio_data  && data.ratio_data.length > 0){
 
-                 priceCell = true;
 
-             }
 
-             if(priceCell==false&&dataCode=='basePrice'&&data.is_add!=1){//如果不是新增,定额价不可修改。
 
-                 priceCell = true;
 
-             }
 
-             me.projectGljSheet.getCell(row, col,  GC.Spread.Sheets.SheetArea.viewport).locked(priceCell);
 
-         }
 
-         if(dataCode == 'supply_quantity'){
 
-             if (data.supply == 1) {// 如果为部分甲供则甲供数量需要可编辑
 
-                 me.projectGljSheet.getCell(row, col,  GC.Spread.Sheets.SheetArea.viewport).locked(false);
 
-             }else {
 
-                 me.projectGljSheet.getCell(row, col,  GC.Spread.Sheets.SheetArea.viewport).locked(true);
 
-             }
 
-         }
 
-         me.showMixRatioData();
 
-         me.projectGljSheet.repaint();
 
-     },
 
-     showProjectGljData:function () {
 
-         let projectGljSheetData = [];
 
-         let gljList = projectObj.project.projectGLJ.datas.gljList;
 
-         gljList = this.filterProjectGLJ(gljList);
 
-         gljList = sortProjectGLJ(gljList);
 
-         for(let glj of gljList){
 
-             projectGljSheetData.push(this.getSheetDataByGLJ(glj));
 
-         }
 
-         this.projectGljSheetData = projectGljSheetData;
 
-         this.projectGljSheet.setRowCount(0);
 
-         sheetCommonObj.showData(this.projectGljSheet, this.projectGljSetting,this.projectGljSheetData);
 
-         this.projectGljSheet.setRowCount(this.projectGljSheetData.length);
 
-     },
 
-     filterProjectGLJ:function (gljList) {
 
-         let me = projectGljObject;
 
-         if(gljList.length>0){
 
-             gljList = _.filter(gljList,function (item) {
 
-                 if(item.quantity !== 0 && item.quantity !== '0'){//过滤掉消耗量为0的工料机
 
-                     //showTag:'ration',//mixRatio/machine
 
-                     if(me.showTag == 'ration'){
 
-                         return true;
 
-                     }else if(me.showTag == 'mixRatio'){
 
-                         return _.includes(me.mixRatioType,item.type)
 
-                     }else if(me.showTag == 'machine'){
 
-                         return _.includes(me.machineType,item.type)
 
-                     }
 
-                 }
 
-                 return false;
 
-             });
 
-         }
 
-         return gljList;
 
-     },
 
-     getSheetDataByGLJ:function (glj) {
 
-         let projectGLJ = projectObj.project.projectGLJ;
 
-         let materialIdList = projectGLJ.datas.constData.materialIdList;
 
-         let data ={
 
-             id:glj.id,
 
-             code:glj.code,
 
-             name:glj.name,
 
-             specs:glj.specs,
 
-             unit:glj.unit,
 
-             type:glj.type,
 
-             short_name:projectGLJ.getShortNameByID(glj.type),
 
-             quantity:glj.quantity,
 
-             supply:glj.supply,
 
-             supply_quantity:glj.supply_quantity,
 
-             delivery:glj.delivery,
 
-             delivery_address:glj.delivery_address,
 
-             is_adjust_price:glj.is_adjust_price,
 
-             ratio_data:glj.ratio_data,
 
-             is_add:glj.unit_price.is_add,
 
-             bgColour:'white'
 
-         };
 
-         gljOprObj.setGLJPrice(data,glj);
 
-         //供货方式为完全甲供时设置甲供数量为总消耗量
 
-         if (data.supply == 2) {
 
-             data.supply_quantity = glj.quantity;
 
-         }
 
-         // 只有材料才显示是否暂估
 
-         if (materialIdList.indexOf(glj.type) >= 0) {
 
-             data.is_evaluate = glj.is_evaluate;
 
-         }
 
-         //bgColour
 
-         if(data.basePrice == data.marketPrice){//如果定额价等于市场价时,改底色。 优先度低于有组成物时的底色
 
-             data.bgColour = "#C4CAFB";
 
-         }
 
-         if (notEditType.indexOf(glj.type) >= 0) {
 
-             if (data.ratio_data  && data.ratio_data.length > 0){//有组成物时
 
-                 //设置底色
 
-                 data.bgColour = "#E0E0E0";
 
-             }
 
-         }
 
-         return data;
 
-     },
 
-     refreshProjectGljRow:function (row) {
 
-         let me = projectGljObject;
 
-         let rowData = me.projectGljSheetData[row];
 
-         let glj = projectObj.project.projectGLJ.getByID(rowData.id);
 
-         if(glj){
 
-             me.projectGljSheetData[row] = me.getSheetDataByGLJ(glj);
 
-         }
 
-         sheetCommonObj.showRowData(this.projectGljSheet, this.projectGljSetting,row,this.projectGljSheetData);
 
-     },
 
-     initSheet: function (sheet,setting) {
 
-         var me = this;
 
-         sheetCommonObj.initSheet(sheet, setting, 30);
 
-         sheet.bind(GC.Spread.Sheets.Events.ValueChanged, me.onSheetValueChange);
 
-     },
 
-     onSheetValueChange:function (e,info) {
 
-         let me = projectGljObject;
 
-         if(info.sheetName=='projectGljSheet'){
 
-             me.onProjectGLJValueChange(e,info);
 
-         }if(info.sheetName == 'mixRatioSheet'){
 
-             me.onMixRatioValueChange(e,info);
 
-         }
 
-     },
 
-     onMixRatioValueChange:function (e,info){
 
-         let composition = projectObj.project.composition;
 
-         let me = projectGljObject,row = info.row, col = info.col;
 
-         let dataCode = me.mixRatioSetting.header[col].dataCode;
 
-         let recode = me.mixRatioData[row];
 
-         let value = info.newValue;
 
-         if (!me.checkData(col,me.mixRatioSetting,value)) {
 
-             alert('输入的数据类型不对,请重新输入!');
 
-             me.mixRatioSheet.setValue(row, col, info.oldValue);
 
-             return false;
 
-         }
 
-         value = scMathUtil.roundToString(value,getDecimal("glj.quantity"));
 
-         let [parentMarketPrice, parentBasePrice] = me.getCompositionSumPrice('modify', row, value);
 
-         let updateData ={id: recode.mix_ratio_id, field: 'mix_ratio.' + dataCode, value: value, market_price: parentMarketPrice, base_price: parentBasePrice};
 
-         let prow= projectGljObject.projectGljSheet.getActiveRowIndex();//取父机械或组成物的下标
 
-         let prowData = projectGljObject.projectGljSheetData[prow];
 
-         composition.updateConsumption(updateData,recode,prowData.id,function () {
 
-            me.refreshParentData(prow,prowData.id);
 
-         });
 
-     },
 
-     refreshParentData:function (row,pid) {
 
-         let me = this;
 
-         me.refreshProjectGljRow(row);
 
-         // 更新组成物缓存
 
-         projectObj.project.composition.loadData();
 
-         //选查找使用了父项目工料机的定额工料机
 
-         let updateNodes=[];
 
-         let ration_gljs = _.filter(projectObj.project.ration_glj.datas,{'projectGLJID':pid});
 
-         for(let rg of ration_gljs){
 
-             let node = projectObj.project.mainTree.getNodeByID(rg.rationID);
 
-             if(node){
 
-                 updateNodes.push(node);
 
-             }
 
-         }
 
-         //或者是使用了父项目工料机的工料机类型的定额
 
-         let rations = _.filter(projectObj.project.Ration.datas,{'type':3,'projectGLJID':pid});
 
-         for(let r of rations){
 
-             let r_node = projectObj.project.mainTree.getNodeByID(r.ID);
 
-             if(r_node){
 
-                 r_node.data.marketUnitFee =  projectGljObject.projectGljSheetData[row].marketPrice;//parentMarketPrice;//这里用显示的价格
 
-                 updateNodes.push(r_node);
 
-             }
 
-         }
 
-         if(updateNodes.length>0){
 
-             projectObj.project.calcProgram.calcRationsAndSave(updateNodes);
 
-         }
 
-         gljOprObj.refreshView();
 
-     },
 
-     deleteMixRatio:function (row) {
 
-         let me = this, deleteRecode = me.mixRatioData[row];
 
-         let consumption = deleteRecode.consumption;
 
-         let [parentMarketPrice, parentBasePrice] = me.getCompositionSumPrice('delete', row);
 
-         let prow= projectGljObject.projectGljSheet.getActiveRowIndex();//取父机械或组成物的下标
 
-         let prowData = projectGljObject.projectGljSheetData[prow];
 
-         let updateData = {id: deleteRecode.mix_ratio_id, field: 'mix_ratio.consumption' , value: 0, market_price: parentMarketPrice, base_price: parentBasePrice};
 
-         projectObj.project.composition.deleteComposition(updateData,deleteRecode,prowData.id,function () {
 
-             me.refreshParentData(prow,prowData.id);
 
-             me.mixRatioSheet.deleteRows(row,1);
 
-         });
 
-     },
 
-     getCompositionSumPrice : function(scene, affectRow, newValue = 0) {
 
-         let me = this;
 
-         let parentMarketPrice = 0;
 
-         let parentBasePrice = 0;
 
-         for(let i = 0;i < me.mixRatioData.length;i++){
 
-             let ratio = me.mixRatioData[i];
 
-             let marketPrice = ratio.unit_price.marketPrice;
 
-             let basePrice = ratio.unit_price.base_price;
 
-             // 如果是删除则忽略即将被删除的行数据
 
-             if (scene === 'delete' && affectRow === i) {
 
-                 continue;
 
-             }
 
-             let consumption = i === affectRow ? newValue : ratio.consumption;
 
-             parentMarketPrice += operationWithRound(consumption,marketPrice,"glj.unitPrice","*");
 
-             parentBasePrice += operationWithRound(consumption,basePrice,"glj.unitPrice","*");
 
-         }
 
-         parentMarketPrice = parentMarketPrice.toDecimal(getDecimal("glj.unitPrice"));
 
-         parentBasePrice = parentBasePrice.toDecimal(getDecimal("glj.unitPrice"));
 
-         return [parentMarketPrice, parentBasePrice];
 
-     },
 
-     onProjectGLJValueChange:function (e,info) {
 
-         let projectGLJ = projectObj.project.projectGLJ;
 
-         let me = projectGljObject,row = info.row, col = info.col;
 
-         let dataCode = me.projectGljSetting.header[col].dataCode;
 
-         let recode = me.projectGljSheetData[row];
 
-         let value = info.newValue;
 
-         if (!me.checkData(col,me.projectGljSetting,value)) {
 
-             alert('输入的数据类型不对,请重新输入!');
 
-             return ;
 
-         }
 
-         let callback=function (impactList) {
 
-             info.sheet.suspendPaint();
 
-             info.sheet.suspendEvent();
 
-             me.refreshProjectGljRow(row);
 
-             for(let g of impactList){
 
-                 let index = _.findIndex(me.projectGljSheetData, { 'id': g.id });
 
-                 if(index>=0&&index != row){
 
-                     me.refreshProjectGljRow(index);
 
-                 }
 
-             }
 
-             info.sheet.resumeEvent();
 
-             info.sheet.resumePaint();
 
-         };
 
-         if(dataCode=='basePrice'||dataCode=='marketPrice'){
 
-             value= scMathUtil.roundForObj(value,getDecimal('glj.unitPrice'));//修改市场价和修改定额价时需要重新记算很多受影响的树节点,现在改成与定字额工料机那里调相同的方法。
 
-             let editField = dataCode === 'basePrice'?"base_price":"market_price";
 
-             projectObj.project.projectGLJ.updatePrice(recode,editField,value,'pg',callback);
 
-         }else {
 
-             let extend = {};
 
-             // 如果是供货方式则需要处理数据
 
-             if (dataCode === 'supply') {
 
-                 extend.supply_quantity = me.getSupplyQuantity(value, recode.quantity);
 
-             }
 
-             if(dataCode === 'supply_quantity'){//修改数量需做4舍5入
 
-                 value= value.toDecimal(getDecimal('glj.quantity'));
 
-             }
 
-             if(dataCode === 'is_evaluate'||dataCode === 'is_adjust_price'){
 
-                 if(value == true){
 
-                     value = 1;
 
-                 }else if(value == false){
 
-                     value = 0;
 
-                 }
 
-             }
 
-             extend = Object.keys(extend).length > 0 ?  JSON.stringify(extend) : '';
 
-             let updateData = {id: recode.id, field: dataCode, value: value, extend: extend};
 
-             projectGLJ.pGljUpdate(updateData,callback);
 
-         }
 
-     },
 
-     getSupplyQuantity : function(supplyType, quantity) {
 
-         // 自行采购和甲定乙供则把甲供数量设置为0,其余情况则设置为当前总消耗量
 
-         let supplyQuantity = supplyType == 0 || supplyType == 3 ? 0 : quantity;
 
-         supplyQuantity = parseFloat(supplyQuantity);
 
-         return supplyQuantity;
 
-     },
 
-     checkData : function(col,setting, value) {
 
-         let result = true;
 
-         let validator = setting.header[col].validator !== undefined ? setting.header[col].validator : null;
 
-         if (validator === null) {
 
-             return result;
 
-         }
 
-         switch (validator) {
 
-             case 'number':
 
-                 let regular = /^\d+(\.\d+)?$/;
 
-                 result = regular.test(value);
 
-                 break;
 
-             case 'boolean':
 
-                 let booleanValue = [true, false];
 
-                 result = booleanValue.indexOf(value) >= 0;
 
-                 break;
 
-         }
 
-         return result;
 
-     },
 
-     initRightClick : function() {
 
-         let activeSheet = this.mixRatioSheet;
 
-         let me = this;
 
-         $.contextMenu({
 
-             selector: '#mix_ratio_sheet',
 
-             build: function ($trigger, e) {
 
-                 me.rightClickTarget = SheetDataHelper.safeRightClickSelection($trigger, e, me.mixRatioSpread);
 
-                 return me.rightClickTarget.hitTestType === GC.Spread.Sheets.SheetArea.viewport ||
 
-                     me.rightClickTarget.hitTestType === GC.Spread.Sheets.SheetArea.rowHeader;
 
-             },
 
-             items: {
 
-                 "deleteMixRatio": {
 
-                     name: "删除",
 
-                     icon: 'fa-trash-o',
 
-                     disabled: function () {
 
-                         return me.rightClickTarget.row === undefined;
 
-                     },
 
-                     callback: function (key, opt) {
 
-                         let row = me.rightClickTarget.row;
 
-                         me.deleteMixRatio(row);
 
-                     }
 
-                 },
 
-             }
 
-         });
 
-     },
 
-     changeFileCallback:function(){
 
-         projectGljObject.unitPriceFileInit();
 
-         projectGljObject.showProjectGljData();
 
-         gljOprObj.refreshView();
 
-         projectObj.project.calcProgram.calcAllNodesAndSave();
 
-         if(socketObject.roomInfo){
 
-             let data ={
 
-                 projectID:projectObj.project.ID(),
 
-                 oldRoom:socketObject.roomInfo.unitFile,
 
-                 newRoom:socketObject.getUnitFileRoomID(),
 
-                 name:'unitFile'
 
-             };
 
-             socket.emit('changeNewRoom',data);
 
-             socketObject.roomInfo.unitFile = socketObject.getUnitFileRoomID();
 
-         }
 
-     }
 
- };
 
- $(function () {
 
-     $('#tab_project_glj').on('shown.bs.tab', function (e) {
 
-         let me = projectGljObject;
 
-         $(e.relatedTarget.hash).removeClass('active');
 
-         if(me.projectGljSpread==null){
 
-             me.initProjectGljSpread();
 
-         }
 
-         me.unitPriceFileInit();
 
-         me.showProjectGljData();
 
-         loadSize("project-glj-main", function () {
 
-             me.projectGljSpread.refresh();
 
-         });
 
-     });
 
-     $('#ration_link').on('shown.bs.tab', function (e) {
 
-         let me = projectGljObject;
 
-         me.showTag='ration';
 
-         me.showProjectGljData();
 
-     });
 
-     $('#mix_ratio_link').on('shown.bs.tab', function (e) {
 
-         let me = projectGljObject;
 
-         me.showTag='mixRatio';
 
-         me.showProjectGljData();
 
-         me.initMixRatio();
 
-     });
 
-     $('#machine_ratio_link').on('shown.bs.tab', function (e) {
 
-         let me = projectGljObject;
 
-         me.showTag='machine';
 
-         me.showProjectGljData();
 
-         me.initMixRatio();
 
-     });
 
-     slideResize($("#project-glj-main"), function () {
 
-         projectGljObject.projectGljSpread.refresh();
 
-     });
 
-     $('#pop-used-list').popover({
 
-             placement: "bottom",
 
-             html: true,
 
-             trigger: "hover | focus",
 
-             content: projectGljObject.getUsedTenderInfo
 
-         }
 
-     );
 
-     // 单价文件切换弹框
 
-     $('#change-unitFile').on('shown.bs.modal', function () {
 
-         // 获取当前建设项数据
 
-         let projectName = projectInfoObj.projectInfo.fullFolder !== undefined &&
 
-         projectInfoObj.projectInfo.fullFolder.length > 0 ? projectInfoObj.projectInfo.fullFolder[0] : '';
 
-         $("#current-project-name").text(projectName);
 
-         let rootProjectID = projectInfoObj.projectInfo.property.rootProjectID;
 
-         // 获取切换单价文件相关数据
 
-         $.ajax({
 
-             url: '/glj/get-project-info',
 
-             type: 'post',
 
-             data: {project_id: scUrlUtil.GetQueryString('project'),rootProjectID:rootProjectID},
 
-             dataType: 'json',
 
-             success: function (response) {
 
-                 if (response.err === 1) {
 
-                     alert('数据传输错误!');
 
-                     return false;
 
-                 }
 
-                 let data = response.data;
 
-                 // 本项目中的单价文件
 
-                 if (data.self.length > 0) {
 
-                     let selfFileHtml = '';
 
-                     for (let tmp of data.self) {
 
-                         let select = usedUnitPriceInfo === tmp.id ? ' selected="selected"' : '';
 
-                         selfFileHtml += '<option' + select + ' value="' + tmp.id + '">' + tmp.name + '</option>';
 
-                     }
 
-                     $("#self-file").html(selfFileHtml);
 
-                 }
 
-                 // 其他建设项目数据
 
-                 if (data.other.length > 0) {
 
-                     let otherProjectHtml = '';
 
-                     let otherFileHtml = '';
 
-                     for (let tmp of data.other) {
 
-                         otherProjectHtml += '<option value="' + tmp.ID + '">' + tmp.name + '</option>';
 
-                         otherFileData[tmp.ID] = tmp.unitPriceList;
 
-                         if (otherFileHtml !== '') {
 
-                             continue;
 
-                         }
 
-                         for (let unitPrice of tmp.unitPriceList) {
 
-                             otherFileHtml += '<option value="' + unitPrice.id + '">' + unitPrice.name + '</option>';
 
-                         }
 
-                     }
 
-                     $("#other-project").html(otherProjectHtml);
 
-                     $("#other-file").html(otherFileHtml);
 
-                 }
 
-             }
 
-         });
 
-     });
 
-     // 单价文件切换确认
 
-     $("#change-file-confirm").click(function () {
 
-         let type = $("input[name='change-type']:checked").val();
 
-         type = parseInt(type);
 
-         let changeUnitPriceId = 0;
 
-         if (type === 0) {
 
-             // 从本项目中选择
 
-             changeUnitPriceId = $("#self-file").val();
 
-         } else {
 
-             // 从其他项目中复制
 
-             changeUnitPriceId = $("#other-file").val();
 
-         }
 
-         $('#change-unitFile').modal("hide");
 
-         let data = {project_id: scUrlUtil.GetQueryString('project'), change_id: changeUnitPriceId, type: type};
 
-         projectObj.project.projectGLJ.changeFile(data,function () {
 
-             projectGljObject.changeFileCallback();
 
-         })
 
-     });
 
-     // 单价文件选项切换
 
-     $("input[name='change-type']").change(function () {
 
-         let type = $(this).val();
 
-         type = parseInt(type);
 
-         $("#change-unitFile .option").hide();
 
-         if (type === 0) {
 
-             $(".option.select").show();
 
-         } else {
 
-             $(".option.copy").show();
 
-         }
 
-     });
 
-     $("#unitFile-save-as").on('shown.bs.modal', function () {
 
-         // 获取当前建设项数据
 
-         $("#save-as-name").val(projectGljObject.usedUnitPriceInfo.name + '(复件)');
 
-     });
 
-     // 从其他建设项目中复制 选择建设项目
 
-     $("#other-project").change(function () {
 
-         let projectId = $(this).val();
 
-         if (otherFileData[projectId] === undefined) {
 
-             return false;
 
-         }
 
-         let otherFileHtml = '';
 
-         for (let unitPrice of otherFileData[projectId]) {
 
-             otherFileHtml += '<option value="' + unitPrice.id + '">' + unitPrice.name + '</option>';
 
-         }
 
-         $("#other-file").html(otherFileHtml);
 
-     });
 
-     // 单价文件另存为操作
 
-     $("#save-as-confirm").click(function () {
 
-         let name = $("#save-as-name").val();
 
-         if (name === '') {
 
-             $("#save-as-tips").text('请填写单价文件名称').show();
 
-             return false;
 
-         }
 
-         let saveData = {name: name, project_id: scUrlUtil.GetQueryString('project')};
 
-         projectObj.project.projectGLJ.saveAs(saveData,function () {
 
-              projectGljObject.changeFileCallback();
 
-             $("#unitFile-save-as").modal("hide");
 
-         });
 
-     });
 
- });
 
 
  |