|
@@ -13,6 +13,18 @@ let projectGljObject={
|
|
|
materialTreeSheet:null,
|
|
|
projectGljSheetData:[],
|
|
|
mixRatioSetting:{},
|
|
|
+ infoPriceSetting:{
|
|
|
+ header:[
|
|
|
+ {headerName: "材料名称", headerWidth: 360, dataCode: "name", dataType: "String"},
|
|
|
+ {headerName: "规格型号", headerWidth: 240, 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"
|
|
|
+ ],
|
|
|
+ view: {
|
|
|
+ lockColumns: [0,1,2,3,4]//,
|
|
|
+ //colHeaderHeight:30
|
|
|
+ }
|
|
|
+ },
|
|
|
relatedRationSetting:{
|
|
|
header:[
|
|
|
{headerName: "编码", headerWidth: 100, dataCode: "code", dataType: "String"},
|
|
@@ -64,6 +76,18 @@ let projectGljObject={
|
|
|
{ID:'MAIN_MATERIAL',text:'主材'},
|
|
|
{ID:'EQUIPMENT',text:'设备'}
|
|
|
],
|
|
|
+ initInfoPriceSpread:function(){
|
|
|
+ if(this.infoPriceSpread) return this.infoPriceSpread.refresh();
|
|
|
+ this.infoPriceSpread = SheetDataHelper.createNewSpread($("#info_price_sheet")[0]);
|
|
|
+ sheetCommonObj.spreadDefaultStyle(this.infoPriceSpread);
|
|
|
+ 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.name('infoPriceSheet');
|
|
|
+ this.infoPriceSheet.setRowCount(0);
|
|
|
+
|
|
|
+ this.getInfoPriceOptions();
|
|
|
+ },
|
|
|
initSpreads:function(){
|
|
|
if(this.projectGljSpread==null) this.initProjectGljSpread();
|
|
|
//if(materialAdjustObj.spread == null) materialAdjustObj.initSpread();
|
|
@@ -348,7 +372,12 @@ let projectGljObject={
|
|
|
sheetCommonObj.showData(me.relatedRationSheet, me.relatedRationSetting,rations);
|
|
|
me.relatedRationSheet.setRowCount(rations.length);
|
|
|
},
|
|
|
-
|
|
|
+ showInforPriceData:function(datas){
|
|
|
+ let me = this;
|
|
|
+ me.infoPriceData = datas;
|
|
|
+ sheetCommonObj.showData(me.infoPriceSheet, me.infoPriceSetting,datas);
|
|
|
+ me.infoPriceSheet.setRowCount(datas.length);
|
|
|
+ },
|
|
|
getMixRatioSheetData:function (glj) {
|
|
|
let data ={
|
|
|
id:glj.id,
|
|
@@ -1195,6 +1224,10 @@ let projectGljObject={
|
|
|
callback: function (key, opt) {
|
|
|
let row = me.rightClickTarget.row;
|
|
|
me.deleteMixRatio(row);
|
|
|
+ },
|
|
|
+ visible: function(key, opt){
|
|
|
+ if(!$('#mixRatio-nav').hasClass('active')) return false;
|
|
|
+ return true;
|
|
|
}
|
|
|
},
|
|
|
"addMixRatio":{
|
|
@@ -1207,6 +1240,10 @@ let projectGljObject={
|
|
|
callback: function (key, opt) {
|
|
|
me.selectedProjectGLJ = projectGljObject.getProjectGLJSelected();
|
|
|
getGLJData('addMix', null, true, null);
|
|
|
+ },
|
|
|
+ visible: function(key, opt){
|
|
|
+ if(!$('#mixRatio-nav').hasClass('active')) return false;
|
|
|
+ return true;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1261,6 +1298,66 @@ let projectGljObject={
|
|
|
}
|
|
|
htmlString += '</ul>';
|
|
|
$('#ALL').after(htmlString);
|
|
|
+ },
|
|
|
+ getInfoPriceOptions:async function(){
|
|
|
+ let options =await ajaxPost("/infoPrice/getOptions",{});
|
|
|
+ this.infoPriceOptions=options;
|
|
|
+ this.createSelectOptions($("#info_area"),options.areas);
|
|
|
+ let years = _.keysIn(options.periodMap);
|
|
|
+ this.createSelectOptions($("#info_year"),_.sortBy(years));
|
|
|
+ },
|
|
|
+ createSelectOptions:function(ele,opts){
|
|
|
+ ele.empty();
|
|
|
+ let str = `<option value=""></option>`;
|
|
|
+ for(let o of opts){
|
|
|
+ str +=`<option value="${o}">${o}</option>`
|
|
|
+ }
|
|
|
+ ele.html(str);
|
|
|
+ },
|
|
|
+ onInfoTopRowChanged:function(sender, args){
|
|
|
+ let me = projectGljObject;
|
|
|
+ const bottomRow = args.sheet.getViewportBottomRow(1);
|
|
|
+ if(me.infoPriceData >= me.infoPriceTotalSize) return;
|
|
|
+ if(me.infoPriceData.length - bottomRow < 20 ){
|
|
|
+ if(projectGljObject.infoPriceLastLoadingRow == me.infoPriceData.length){//如果最后一行已经加载过了,就不用再加载了,不然会重复加载
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ console.log(bottomRow);
|
|
|
+ me.infoPriceLastLoadingRow = me.infoPriceData.length;
|
|
|
+ me.searchInfoPrice(me.infoPriceData[me.infoPriceData.length - 1]._id)
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ },
|
|
|
+ searchInfoPrice:async function(objectID){
|
|
|
+ let year = $('#info_year').val();
|
|
|
+ let month = $('#info_month').val();
|
|
|
+ let area = $('#info_area').val();
|
|
|
+ let keyWord = $('#info_search_name').val();
|
|
|
+ let me = projectGljObject;
|
|
|
+ try {
|
|
|
+ if(year !="" && month!="" && area!="") {
|
|
|
+ let condition = {
|
|
|
+ period:year+"-"+month,
|
|
|
+ area:area
|
|
|
+ }
|
|
|
+ let data ={condition:condition};
|
|
|
+ if(keyWord !="") data.keyWord = keyWord;
|
|
|
+ if(objectID) data.lastID = objectID;
|
|
|
+ let result = await ajaxPost("/infoPrice/getDataByCondition",data);
|
|
|
+ if(objectID){//分页查询
|
|
|
+ sheetCommonObj.appendData(me.infoPriceSheet, me.infoPriceData.length, 0, me.infoPriceSetting, result.items);
|
|
|
+ me.infoPriceData.splice(me.infoPriceData.length, 0, ...result.items);
|
|
|
+ }else{
|
|
|
+ me.infoPriceTotalSize = result.totalSize;
|
|
|
+ me.infoPriceLastLoadingRow = 0;
|
|
|
+ me.showInforPriceData(result.items);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.log(error)
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
};
|
|
|
|
|
@@ -1317,6 +1414,11 @@ function loadProjectGljSize() {
|
|
|
SlideResize.loadVerticalHeight(pojGljResizeEles.eleObj.module, pojGljResizeEles.eleObj, pojGljResizeEles.limit, function () {
|
|
|
me.projectGljSpread?me.projectGljSpread.refresh():'';
|
|
|
me.mixRatioSpread?me.mixRatioSpread.refresh():'';
|
|
|
+ //信息价相关
|
|
|
+ $('#info_price_sheet').height($("#mix_ratio_sheet").height() - $("#infoToolDiv").height());
|
|
|
+ if($('#info_price_sheet').is(':visible')) me.initInfoPriceSpread();
|
|
|
+
|
|
|
+
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -1609,6 +1711,38 @@ $(function () {
|
|
|
projectGljObject.mixRatioSpread.refresh();
|
|
|
projectGljObject.showRelatedRationDatas();
|
|
|
});
|
|
|
-});
|
|
|
-
|
|
|
+ $("#info-nav").on('shown.bs.tab', function () {
|
|
|
+ $('#info_price_sheet').height($("#mix_ratio_sheet").height() - $("#infoToolDiv").height());
|
|
|
+ projectGljObject.initInfoPriceSpread();
|
|
|
+ /*
|
|
|
+ projectGljObject.showRelatedRationDatas(); */
|
|
|
+ });
|
|
|
+ $('#info_year').change(function () {
|
|
|
+ let periodMap = projectGljObject.infoPriceOptions.periodMap;
|
|
|
+ let year = $(this).val();
|
|
|
+ let month = $("#info_month").val();
|
|
|
+ let options = periodMap[year];
|
|
|
+ projectGljObject.createSelectOptions($("#info_month"),periodMap[year]);
|
|
|
+ if(month !=""){
|
|
|
+ if(_.includes(options,month)){
|
|
|
+ $("#info_month").val(month);
|
|
|
+ projectGljObject.searchInfoPrice();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ $('#info_month').change(function () {
|
|
|
+ projectGljObject.searchInfoPrice();
|
|
|
+ });
|
|
|
+ $('#info_area').change(function () {
|
|
|
+ projectGljObject.searchInfoPrice();
|
|
|
+ });
|
|
|
+ $('#info_search_name').on('keypress', function (e) {
|
|
|
+ if (e.keyCode === 13) {
|
|
|
+ projectGljObject.searchInfoPrice();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ $('#info_search_btn').on('click', function (e) {
|
|
|
+ projectGljObject.searchInfoPrice();
|
|
|
+ });
|
|
|
|
|
|
+});
|