|
@@ -15,10 +15,11 @@ let projectGljObject={
|
|
|
mixRatioSetting:{},
|
|
|
infoPriceSetting:{
|
|
|
header:[
|
|
|
- {headerName: "材料名称", headerWidth: 360, dataCode: "name", dataType: "String"},
|
|
|
- {headerName: "规格型号", headerWidth: 240, dataCode: "specs", hAlign: "left", dataType: "String"},
|
|
|
+ {headerName: "材料名称", headerWidth: 320, dataCode: "name", dataType: "String"},
|
|
|
+ {headerName: "规格型号", headerWidth: 200, dataCode: "specs", hAlign: "left", dataType: "String"},
|
|
|
{headerName: "单位", headerWidth: 50, dataCode: "unit", dataType: "String",hAlign: "center"},
|
|
|
- {headerName: "含税市场价", headerWidth: 160, dataCode: "taxPrice", hAlign: "right", dataType: "Number",validator:"number"}//,decimalField:"glj.unitPrice"
|
|
|
+ {headerName: "含税市场价", headerWidth: 100, dataCode: "taxPrice", hAlign: "right", dataType: "Number",validator:"number"},
|
|
|
+ {headerName: "不含税市场价", headerWidth: 100, dataCode: "noTaxPrice", hAlign: "right", dataType: "Number",validator:"number"}//,decimalField:"glj.unitPrice"
|
|
|
],
|
|
|
view: {
|
|
|
lockColumns: [0,1,2,3,4]//,
|
|
@@ -83,10 +84,16 @@ let projectGljObject={
|
|
|
this.infoPriceSheet = this.infoPriceSpread .getSheet(0);
|
|
|
this.initSheet(this.infoPriceSheet,this.infoPriceSetting);
|
|
|
this.infoPriceSheet.bind(GC.Spread.Sheets.Events.TopRowChanged, _.debounce(this.onInfoTopRowChanged, 100));
|
|
|
+ this.infoPriceSheet.bind(GC.Spread.Sheets.Events.CellDoubleClick, this.onInfoPriceDoubleClick);
|
|
|
this.infoPriceSheet.name('infoPriceSheet');
|
|
|
this.infoPriceSheet.setRowCount(0);
|
|
|
-
|
|
|
this.getInfoPriceOptions();
|
|
|
+
|
|
|
+ if(projectReadOnly){
|
|
|
+ disableSpread(this.infoPriceSpread);
|
|
|
+ }else{
|
|
|
+ this.initInfoPriceRightClick();
|
|
|
+ }
|
|
|
},
|
|
|
initSpreads:function(){
|
|
|
if(this.projectGljSpread==null) this.initProjectGljSpread();
|
|
@@ -455,6 +462,9 @@ let projectGljObject={
|
|
|
$("#tab_zaojiashu").click();
|
|
|
locateObject.locateNode(record.ID);
|
|
|
},
|
|
|
+ onInfoPriceDoubleClick:function name(sender,args) {
|
|
|
+ projectGljObject.preApplyInfoPrice(args.row);
|
|
|
+ },
|
|
|
onProjectGljSelectionChange:function (sender, args) {
|
|
|
let me = projectGljObject;
|
|
|
let newSel = args.newSelections[0];
|
|
@@ -568,10 +578,9 @@ let projectGljObject={
|
|
|
}
|
|
|
me.batchUpdateGLJProperty(propertyCells,sheetName,function () {
|
|
|
//价格属于单价文件表,如果与项目工料机的其它属性一起的话计算起来会比较复杂,同时出现价格与其它属性一起更新的情况也会比较少;
|
|
|
- projectGLJ.batchUpdatePrice(priceCells,sheetName,function (impactList) {
|
|
|
- me.refreshBySheetName(sheetName);
|
|
|
- gljOprObj.refreshView();
|
|
|
- });
|
|
|
+ projectGLJ.batchUpdatePrice(priceCells,sheetName);
|
|
|
+ //me.refreshBySheetName(sheetName); 2020-07-27 改在projectGLJ里统一刷新了
|
|
|
+ //gljOprObj.refreshView();
|
|
|
});
|
|
|
},
|
|
|
refreshBySheetName:function (sheetName) {
|
|
@@ -669,6 +678,7 @@ let projectGljObject={
|
|
|
},
|
|
|
showProjectGljData:function () {
|
|
|
if(!this.projectGljSpread) return;
|
|
|
+ let me = this;
|
|
|
this.projectGljSpread.setActiveSheetIndex(0);
|
|
|
let sel = this.projectGljSheet.getSelections()[0];
|
|
|
let oldData = sel.row<this.projectGljSheetData.length?this.projectGljSheetData[sel.row]:"";
|
|
@@ -680,10 +690,12 @@ let projectGljObject={
|
|
|
projectGljSheetData.push(this.getSheetDataByGLJ(glj));
|
|
|
}
|
|
|
this.projectGljSheetData = projectGljSheetData;
|
|
|
- sheetCommonObj.showData(this.projectGljSheet, this.projectGljSetting,this.projectGljSheetData);
|
|
|
- this.projectGljSheet.setRowCount(this.projectGljSheetData.length);
|
|
|
- sel.row = oldData?_.findIndex(this.projectGljSheetData,{'id':oldData.id}):'';
|
|
|
- this.projectGljSheet.setSelection(sel.row==-1?0:sel.row,sel.col,sel.rowCount,sel.colCount);
|
|
|
+ sheetCommonObj.showData(this.projectGljSheet, this.projectGljSetting,this.projectGljSheetData,null,function(){
|
|
|
+ me.projectGljSheet.setRowCount(me.projectGljSheetData.length);
|
|
|
+ sel.row = oldData?_.findIndex(me.projectGljSheetData,{'id':oldData.id}):-1;
|
|
|
+ me.projectGljSheet.setSelection(sel.row==-1?0:sel.row,sel.col,sel.rowCount,sel.colCount);
|
|
|
+ });
|
|
|
+
|
|
|
},
|
|
|
showMaterialTreeData:function () {
|
|
|
this.projectGljSpread.setActiveSheetIndex(1);
|
|
@@ -740,20 +752,22 @@ let projectGljObject={
|
|
|
if(me.displayType == filterType.ZGCL || me.displayType == filterType.PBCL) return configMaterialObj.refreshSheetDatas();
|
|
|
me.refreshDataSheet();
|
|
|
},
|
|
|
- refreshDataSheet:function () {
|
|
|
+ refreshDataSheet:function (refresh) {//refresh = true 的时候不用更新表头信息
|
|
|
let me = projectGljObject;
|
|
|
- let quantityCol = _.findIndex(me.projectGljSetting.header,function (header) {
|
|
|
+ if(!refresh){
|
|
|
+ let quantityCol = _.findIndex(me.projectGljSetting.header,function (header) {
|
|
|
return header.dataCode == 'quantity'|| header.dataCode == 'techQuantity' || header.dataCode =='subdivisionQuantity';
|
|
|
- });
|
|
|
- if(me.displayType == filterType.FBFX){//分部分项人材机,将“总消耗量”替换显示为“分部分项总消耗量”。
|
|
|
- me.projectGljSetting.header[quantityCol].dataCode = 'subdivisionQuantity';
|
|
|
- me.projectGljSheet.setValue(0, quantityCol, "分部分项总消耗量", GC.Spread.Sheets.SheetArea.colHeader);
|
|
|
- }else if(me.displayType == filterType.TECH) {//措施项目人材机,将“总消耗量”替换显示为“措施项目总消耗量”。
|
|
|
- me.projectGljSetting.header[quantityCol].dataCode = 'techQuantity';
|
|
|
- me.projectGljSheet.setValue(0, quantityCol, "措施项目总消耗量", GC.Spread.Sheets.SheetArea.colHeader);
|
|
|
- }else {
|
|
|
- me.projectGljSetting.header[quantityCol].dataCode = 'quantity';
|
|
|
- me.projectGljSheet.setValue(0, quantityCol, "总消耗量", GC.Spread.Sheets.SheetArea.colHeader);
|
|
|
+ });
|
|
|
+ if(me.displayType == filterType.FBFX){//分部分项人材机,将“总消耗量”替换显示为“分部分项总消耗量”。
|
|
|
+ me.projectGljSetting.header[quantityCol].dataCode = 'subdivisionQuantity';
|
|
|
+ me.projectGljSheet.setValue(0, quantityCol, "分部分项总消耗量", GC.Spread.Sheets.SheetArea.colHeader);
|
|
|
+ }else if(me.displayType == filterType.TECH) {//措施项目人材机,将“总消耗量”替换显示为“措施项目总消耗量”。
|
|
|
+ me.projectGljSetting.header[quantityCol].dataCode = 'techQuantity';
|
|
|
+ me.projectGljSheet.setValue(0, quantityCol, "措施项目总消耗量", GC.Spread.Sheets.SheetArea.colHeader);
|
|
|
+ }else {
|
|
|
+ me.projectGljSetting.header[quantityCol].dataCode = 'quantity';
|
|
|
+ me.projectGljSheet.setValue(0, quantityCol, "总消耗量", GC.Spread.Sheets.SheetArea.colHeader);
|
|
|
+ }
|
|
|
}
|
|
|
if(me.displayType == filterType.SCHZ){//三材汇总树节点
|
|
|
me.showMaterialTreeData();
|
|
@@ -909,6 +923,7 @@ let projectGljObject={
|
|
|
qualityGrace:glj.qualityGrace,
|
|
|
brand:glj.brand,
|
|
|
unitPriceID:glj.unit_price.id,
|
|
|
+ priceFrom:glj.unit_price.priceFrom,
|
|
|
remark:glj.remark
|
|
|
};
|
|
|
gljOprObj.setGLJPrice(data,glj);
|
|
@@ -1116,11 +1131,10 @@ let projectGljObject={
|
|
|
projectObj.mainController.refreshTreeNode(projectObj.project.mainTree.roots);
|
|
|
});
|
|
|
}
|
|
|
- gljOprObj.refreshView();
|
|
|
};
|
|
|
if(dataCode=='basePrice'||dataCode=='marketPrice'){//修改市场价和修改定额价时需要重新记算很多受影响的树节点,现在改成与定字额工料机那里调相同的方法。
|
|
|
let editField = dataCode === 'basePrice'?"base_price":"market_price";
|
|
|
- projectObj.project.projectGLJ.updatePrice(recode,editField,value,'pg',callback);
|
|
|
+ projectObj.project.projectGLJ.updatePrice(recode,editField,value,'pg',null,callback);
|
|
|
}else {
|
|
|
let extend = {};
|
|
|
// 如果是供货方式则需要处理数据
|
|
@@ -1204,6 +1218,30 @@ let projectGljObject={
|
|
|
}
|
|
|
return data;
|
|
|
},
|
|
|
+ initInfoPriceRightClick:function(){
|
|
|
+ let me = this;
|
|
|
+ $.contextMenu({
|
|
|
+ selector: '#info_price_sheet',
|
|
|
+ build: function ($trigger, e) {
|
|
|
+ me.rightClickTarget = SheetDataHelper.safeRightClickSelection($trigger, e, me.infoPriceSpread);
|
|
|
+ return me.rightClickTarget.hitTestType === GC.Spread.Sheets.SheetArea.viewport ||
|
|
|
+ me.rightClickTarget.hitTestType === GC.Spread.Sheets.SheetArea.rowHeader;
|
|
|
+ },
|
|
|
+ items: {
|
|
|
+ "apply": {
|
|
|
+ name: "确认套用(或双快速套用)",
|
|
|
+ icon: 'fa-sign-in',
|
|
|
+ disabled: function () {
|
|
|
+ return me.rightClickTarget.row === undefined;
|
|
|
+ },
|
|
|
+ callback: function (key, opt) {
|
|
|
+ let row = me.rightClickTarget.row;
|
|
|
+ me.preApplyInfoPrice(row);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
initRightClick : function() {
|
|
|
let activeSheet = this.mixRatioSheet;
|
|
|
let me = this;
|
|
@@ -1302,15 +1340,20 @@ let projectGljObject={
|
|
|
getInfoPriceOptions:async function(){
|
|
|
let options =await ajaxPost("/infoPrice/getOptions",{});
|
|
|
this.infoPriceOptions=options;
|
|
|
- this.createSelectOptions($("#info_area"),options.areas);
|
|
|
+ this.createSelectOptions($("#info_area"),options.areas,true);
|
|
|
let years = _.keysIn(options.periodMap);
|
|
|
this.createSelectOptions($("#info_year"),_.sortBy(years));
|
|
|
},
|
|
|
- createSelectOptions:function(ele,opts){
|
|
|
+ createSelectOptions:function(ele,opts,isArea){
|
|
|
ele.empty();
|
|
|
let str = `<option value=""></option>`;
|
|
|
for(let o of opts){
|
|
|
- str +=`<option value="${o}">${o}</option>`
|
|
|
+ if(isArea == true){
|
|
|
+ str +=`<option value="${o.ID}">${o.name}</option>`
|
|
|
+ }else{
|
|
|
+ str +=`<option value="${o}">${o}</option>`
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
ele.html(str);
|
|
|
},
|
|
@@ -1332,14 +1375,14 @@ let projectGljObject={
|
|
|
searchInfoPrice:async function(objectID){
|
|
|
let year = $('#info_year').val();
|
|
|
let month = $('#info_month').val();
|
|
|
- let area = $('#info_area').val();
|
|
|
+ let areaID = $('#info_area').val();
|
|
|
let keyWord = $('#info_search_name').val();
|
|
|
let me = projectGljObject;
|
|
|
try {
|
|
|
- if(year !="" && month!="" && area!="") {
|
|
|
+ if(year !="" && month!="" && areaID!="") {
|
|
|
let condition = {
|
|
|
period:year+"-"+month,
|
|
|
- area:area
|
|
|
+ areaID:areaID
|
|
|
}
|
|
|
let data ={condition:condition};
|
|
|
if(keyWord !="") data.keyWord = keyWord;
|
|
@@ -1356,8 +1399,48 @@ let projectGljObject={
|
|
|
}
|
|
|
} catch (error) {
|
|
|
console.log(error)
|
|
|
- }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ preApplyInfoPrice:function (row) {
|
|
|
+ let info = this.infoPriceData[row];
|
|
|
+ let projectGLJData = this.getProjectGLJSelected();
|
|
|
+ if (projectGLJData.ratio_data && projectGLJData.ratio_data.length > 0) return ;
|
|
|
+ let marketPrice = this.getInfoMarketPrice(info);
|
|
|
+ if(projectGLJData.unit == info.unit){
|
|
|
+ this.applyInfoPrice(projectGLJData,marketPrice,1);
|
|
|
+ }else if(_.includes(["t","kg"],projectGLJData.unit)&&_.includes(["t","kg"],info.unit)){
|
|
|
+ //遇到t和kg之间的转换,默认处理:1t=1000kg,不弹换算窗口
|
|
|
+ let coeMap={"t":1,"kg":1000};
|
|
|
+ let coe = coeMap[info.unit]/coeMap[projectGLJData.unit];
|
|
|
+ this.applyInfoPrice(projectGLJData,marketPrice,coe);
|
|
|
+ }else{//弹出单位转换窗口
|
|
|
+ $("#infoRow").val(row);
|
|
|
+ $("#applyGLJName").text(projectGLJData.name);
|
|
|
+ $("#applyGLJUnit").text(projectGLJData.unit);
|
|
|
+ $("#infoPriceCoe").val("");
|
|
|
+ $("#applyInfoUnit").text(info.unit);
|
|
|
+ $("#infoPriceCoeDiv").modal('show')
|
|
|
+ }
|
|
|
+ },
|
|
|
+ applyInfoPrice:function (projectGLJData,price,coe) {
|
|
|
+ let priceFrom= me.getPriceFrom();
|
|
|
+ projectObj.project.projectGLJ.updatePrice(projectGLJData,"market_price",price*coe,'pg',{"priceFrom":priceFrom});
|
|
|
|
|
|
+ },
|
|
|
+ getPriceFrom:function(){
|
|
|
+ let area = "";
|
|
|
+ for(let o of this.infoPriceOptions.areas){
|
|
|
+ if(o.ID == $("#info_area").val()){
|
|
|
+ area = o.name;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return `${area}信息价(${$("#info_year").val()}${$("#info_month").val()})`;
|
|
|
+ },
|
|
|
+
|
|
|
+ getInfoMarketPrice:function (info) {
|
|
|
+ let taxType = projectObj.project.property.taxType;//1: 一般计税 2: 简易计税
|
|
|
+ return gljUtil.getInfoMarketPrice(info,taxType);
|
|
|
}
|
|
|
};
|
|
|
|
|
@@ -1741,8 +1824,58 @@ $(function () {
|
|
|
projectGljObject.searchInfoPrice();
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
$('#info_search_btn').on('click', function (e) {
|
|
|
projectGljObject.searchInfoPrice();
|
|
|
});
|
|
|
|
|
|
+ $('#infoPriceCoeConfirm').on('click', function (e) {
|
|
|
+ let me = projectGljObject;
|
|
|
+ let infoPriceCoe = $("#infoPriceCoe").val();
|
|
|
+ if(infoPriceCoe==="") return alert("请输入单位转换值!");
|
|
|
+ if(!(/^\d+(\.\d+)?$/.test(infoPriceCoe))) return alert("请输入数字!");
|
|
|
+ $("#infoPriceCoeDiv").modal('hide');
|
|
|
+ let pojectGLJData = me.getProjectGLJSelected();
|
|
|
+ let info=me.infoPriceData[parseInt($("#infoRow").val())];
|
|
|
+ let marketPrice = me.getInfoMarketPrice(info);
|
|
|
+ me.applyInfoPrice(pojectGLJData,marketPrice,parseFloat(infoPriceCoe));
|
|
|
+ });
|
|
|
+
|
|
|
+ $('#muti_apply_info').on('click', function (e) {
|
|
|
+ let year = $('#info_year').val();
|
|
|
+ let month = $('#info_month').val();
|
|
|
+ let areaID = $('#info_area').val();
|
|
|
+ if(year !="" && month!="" && areaID!=""){
|
|
|
+ $("#mutiApplyInfoPriceDiv").modal("show");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ $('#mutiApplyinfoPriceConfirm').on('click', function (e) {
|
|
|
+ let typeMap= {};
|
|
|
+ let pgljMap = {};
|
|
|
+ let year = $('#info_year').val();
|
|
|
+ let month = $('#info_month').val();
|
|
|
+ let areaID = $('#info_area').val();
|
|
|
+ for(let e of $(".info_apply_type")){
|
|
|
+ if($(e).prop('checked') == true){
|
|
|
+ typeMap[$(e).val()] = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for(let pglj of projectGljObject.projectGljSheetData){
|
|
|
+ if(pglj.ratio_data && pglj.ratio_data.length > 0) continue; //有组成物时跳过
|
|
|
+ let typeString = pglj.type +"";
|
|
|
+ if(typeMap[typeString.charAt(0)]){
|
|
|
+ let index = gljUtil.getIndex(pglj,["name","specs","unit"]);
|
|
|
+ let obj = {pgljID:pglj.id,unitPriceID:pglj.unitPriceID,fullIndex:gljUtil.getIndex(pglj)};
|
|
|
+ pgljMap[index]?pgljMap[index].push(obj):pgljMap[index]=[obj];//考虑到只用三个去匹配会有重复的工料机,所以这里用数组
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(_.isEmpty(pgljMap)) return;
|
|
|
+ let condition = {
|
|
|
+ period:year+"-"+month,
|
|
|
+ areaID:areaID
|
|
|
+ }
|
|
|
+ let priceFrom = projectGljObject.getPriceFrom();
|
|
|
+ projectObj.project.projectGLJ.mutiApplyInfoPrice(pgljMap,condition,priceFrom);
|
|
|
+
|
|
|
+ });
|
|
|
});
|