|
@@ -13,50 +13,28 @@ let projectGljObject = {
|
|
|
projectGljSheet: null,
|
|
|
materialTreeSheet: null,
|
|
|
projectGljSheetData: [],
|
|
|
+ infoPriceData:[],
|
|
|
+ infoClassData:[],
|
|
|
mixRatioSetting: {},
|
|
|
infoPriceSetting: {
|
|
|
- header: [{
|
|
|
- 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: 100,
|
|
|
- dataCode: "taxPrice",
|
|
|
- hAlign: "right",
|
|
|
- dataType: "Number",
|
|
|
- validator: "number"
|
|
|
- },
|
|
|
- {
|
|
|
- headerName: "不含税市场价",
|
|
|
- headerWidth: 100,
|
|
|
- dataCode: "noTaxPrice",
|
|
|
- hAlign: "right",
|
|
|
- dataType: "Number",
|
|
|
- validator: "number"
|
|
|
- } //,decimalField:"glj.unitPrice"
|
|
|
+ header: [
|
|
|
+ { 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: 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] //,
|
|
|
//colHeaderHeight:30
|
|
|
}
|
|
|
},
|
|
|
+ infoClassSetting:{
|
|
|
+ header: [{ headerName: "分类", headerWidth: 420, dataCode: "name", dataType: "String"}],
|
|
|
+ view: {
|
|
|
+ lockColumns: [0]
|
|
|
+ }
|
|
|
+ },
|
|
|
relatedRationSetting: {
|
|
|
header: [{
|
|
|
headerName: "编码",
|
|
@@ -224,6 +202,7 @@ let projectGljObject = {
|
|
|
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.bind(GC.Spread.Sheets.Events.SelectionChanged, this.infoPriceSelectionChange);
|
|
|
this.infoPriceSheet.name('infoPriceSheet');
|
|
|
this.infoPriceSheet.setRowCount(0);
|
|
|
this.getInfoPriceOptions();
|
|
@@ -234,6 +213,19 @@ let projectGljObject = {
|
|
|
this.initInfoPriceRightClick();
|
|
|
}
|
|
|
},
|
|
|
+ initInfoClassSpread: function () {
|
|
|
+ if (this.infoClassSpread) return this.infoClassSpread.refresh();
|
|
|
+ this.infoClassSpread = SheetDataHelper.createNewSpread($("#info_class_sheet")[0]);
|
|
|
+ sheetCommonObj.spreadDefaultStyle(this.infoPriceSpread);
|
|
|
+ this.infoClassSheet = this.infoClassSpread.getSheet(0);
|
|
|
+ this.initSheet(this.infoClassSheet, this.infoClassSetting);
|
|
|
+ this.infoClassSheet.name('infoClassSheet');
|
|
|
+ this.infoClassSheet.setRowCount(0);
|
|
|
+ this.infoClassSheet.bind(GC.Spread.Sheets.Events.SelectionChanged, this.infoClassSelectionChange);
|
|
|
+ if (projectReadOnly) {
|
|
|
+ disableSpread(this.infoClassSpread);
|
|
|
+ }
|
|
|
+ },
|
|
|
initSpreads: function () {
|
|
|
if (this.projectGljSpread == null) this.initProjectGljSpread();
|
|
|
//if(materialAdjustObj.spread == null) materialAdjustObj.initSpread();
|
|
@@ -529,20 +521,44 @@ let projectGljObject = {
|
|
|
sheetCommonObj.showData(me.relatedRationSheet, me.relatedRationSetting, rations);
|
|
|
me.relatedRationSheet.setRowCount(rations.length);
|
|
|
},
|
|
|
+ setInfoClassSelection:function(){
|
|
|
+ let me = this;
|
|
|
+ let priceRow = me.infoPriceSheet.getSelections()[0].row;
|
|
|
+ let infoPrice = me.infoPriceData[priceRow];
|
|
|
+ if(infoPrice && me.infoClassData.length > 0){
|
|
|
+ const index = _.findIndex(me.infoClassData,{'ID':infoPrice.classID});
|
|
|
+ me.infoClassSheet.setSelection(index,0,1,1);
|
|
|
+ //me.infoClassSheet.clearSelection(); 清除焦点行
|
|
|
+ me.infoClassSheet.showRow(index, GC.Spread.Sheets.VerticalPosition.center);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ },
|
|
|
showInforPriceData: function (datas) {
|
|
|
let me = this;
|
|
|
me.infoPriceData = datas;
|
|
|
sheetCommonObj.showData(me.infoPriceSheet, me.infoPriceSetting, datas);
|
|
|
me.infoPriceSheet.setRowCount(datas.length);
|
|
|
+ if(datas.length > 0) me.setInfoClassSelection();
|
|
|
+ },
|
|
|
+ showInforClassData: function (datas) {
|
|
|
+ let me = this;
|
|
|
+ me.infoClassData = datas;
|
|
|
+ for(let d of datas){
|
|
|
+ d.collapsed = false;
|
|
|
+ }
|
|
|
+ sheetCommonObj.showTreeData(me.infoClassSheet, me.infoClassSetting, datas);
|
|
|
},
|
|
|
autoShowInfoPriceData: function () {
|
|
|
if (!$('#info-nav').hasClass('active')) return;
|
|
|
let projectGLJData = this.getProjectGLJSelected();
|
|
|
- $('#info_search_name').val(projectGLJData.name);
|
|
|
- let code = projectGLJData.code.substr(0, 4);
|
|
|
- $('#info_glj_name').val(projectGLJData.name);
|
|
|
- $('#info_glj_code').val(code);
|
|
|
- this.searchInfoPrice(null);
|
|
|
+ if(projectGLJData){
|
|
|
+ $('#info_search_name').val(projectGLJData.name);
|
|
|
+ let code = projectGLJData.code.substr(0, 4);
|
|
|
+ $('#info_glj_name').val(projectGLJData.name);
|
|
|
+ $('#info_glj_code').val(code);
|
|
|
+ this.searchInfoPrice(null);
|
|
|
+ }
|
|
|
},
|
|
|
getMixRatioSheetData: function (glj) {
|
|
|
let data = {
|
|
@@ -622,9 +638,23 @@ let projectGljObject = {
|
|
|
$("#tab_zaojiashu").click();
|
|
|
locateObject.locateNode(record.ID);
|
|
|
},
|
|
|
- onInfoPriceDoubleClick: function name(sender, args) {
|
|
|
+ onInfoPriceDoubleClick: function(sender, args) {
|
|
|
projectGljObject.preApplyInfoPrice(args.row);
|
|
|
},
|
|
|
+ infoPriceSelectionChange:function(sender, args){
|
|
|
+ projectGljObject.setInfoClassSelection();
|
|
|
+ },
|
|
|
+ infoClassSelectionChange:function(sender, args){
|
|
|
+ let me = projectGljObject;
|
|
|
+ let row = args.newSelections[0].row;
|
|
|
+ let infoClass = me.infoClassData[row];
|
|
|
+ if(infoClass){
|
|
|
+ $("#info_class").val(infoClass.ID);
|
|
|
+ $("#info_glj_name").val("")//清除工料机名字搜索项
|
|
|
+ me.searchInfoPrice();
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
onProjectGljSelectionChange: function (sender, args) {
|
|
|
let me = projectGljObject;
|
|
|
let newSel = args.newSelections[0];
|
|
@@ -657,6 +687,7 @@ let projectGljObject = {
|
|
|
sel.colCount = 1;
|
|
|
me.showMixRatioData();
|
|
|
me.showRelatedRationDatas();
|
|
|
+ $("#info_class").val("");
|
|
|
me.autoShowInfoPriceData();
|
|
|
},
|
|
|
rightClickCallback: function (row) {
|
|
@@ -1653,12 +1684,28 @@ let projectGljObject = {
|
|
|
if (projectGljObject.infoPriceLastLoadingRow == me.infoPriceData.length) { //如果最后一行已经加载过了,就不用再加载了,不然会重复加载
|
|
|
return;
|
|
|
}
|
|
|
- console.log(bottomRow);
|
|
|
me.infoPriceLastLoadingRow = me.infoPriceData.length;
|
|
|
//只有在空的搜索条件下才执行分页查询,其它情况无法分页
|
|
|
if ($('#info_search_name').val() == "") me.searchInfoPrice(me.infoPriceData[me.infoPriceData.length - 1]._id)
|
|
|
}
|
|
|
},
|
|
|
+ searchInfoClass:async function(){
|
|
|
+ let me = projectGljObject;
|
|
|
+ let areaID = $('#info_area').val();
|
|
|
+ let year = $('#info_year').val();
|
|
|
+ let month = $('#info_month').val();
|
|
|
+ let datas = [];
|
|
|
+ $('#info_class').val("");
|
|
|
+ try {
|
|
|
+ if (year != "" && month != "" && areaID != ""){
|
|
|
+ let period = year + "-" + month;
|
|
|
+ datas = await ajaxPost("/infoPrice/getClassByAreaID", {areaID:areaID,period:period});
|
|
|
+ }
|
|
|
+ me.showInforClassData(datas);
|
|
|
+ } catch (error) {
|
|
|
+ console.log(error)
|
|
|
+ }
|
|
|
+ },
|
|
|
searchInfoPrice: async function (objectID) {
|
|
|
let year = $('#info_year').val();
|
|
|
let month = $('#info_month').val();
|
|
@@ -1666,6 +1713,7 @@ let projectGljObject = {
|
|
|
let keyWord = $('#info_search_name').val();
|
|
|
let name = $('#info_glj_name').val();
|
|
|
let code = $('#info_glj_code').val();
|
|
|
+ let classID = $("#info_class").val();
|
|
|
let me = projectGljObject;
|
|
|
try {
|
|
|
if (year != "" && month != "" && areaID != "") {
|
|
@@ -1673,10 +1721,16 @@ let projectGljObject = {
|
|
|
period: year + "-" + month,
|
|
|
areaID: areaID
|
|
|
}
|
|
|
+ if(classID!=""){
|
|
|
+ keyWord = "";
|
|
|
+ condition.classID = classID;
|
|
|
+ }
|
|
|
+
|
|
|
if (projectGljObject.addCommonInfoPriceID) projectGljObject.addCommonInfoPriceID(condition);
|
|
|
let data = {
|
|
|
condition: condition
|
|
|
};
|
|
|
+
|
|
|
if (keyWord != "") data.keyWord = keyWord;
|
|
|
if (name !="") data.keyWord = name;
|
|
|
if (objectID) data.lastID = objectID;
|
|
@@ -1688,6 +1742,7 @@ let projectGljObject = {
|
|
|
} else {
|
|
|
me.infoPriceTotalSize = result.totalSize;
|
|
|
me.infoPriceLastLoadingRow = 0;
|
|
|
+
|
|
|
me.showInforPriceData(result.items);
|
|
|
if (result.totalSize == 0) {
|
|
|
$("#info-warning").text("当前材料没有信息价! ");
|
|
@@ -1707,6 +1762,7 @@ let projectGljObject = {
|
|
|
preApplyInfoPrice: function (row) {
|
|
|
let info = this.infoPriceData[row];
|
|
|
let projectGLJData = this.getProjectGLJSelected();
|
|
|
+ if(!projectGLJData) return;
|
|
|
if (projectGLJData.ratio_data && projectGLJData.ratio_data.length > 0) return;
|
|
|
let marketPrice = this.getInfoMarketPrice(info);
|
|
|
if (projectGLJData.unit == info.unit) {
|
|
@@ -1751,8 +1807,17 @@ let projectGljObject = {
|
|
|
return gljUtil.getInfoMarketPrice(info, taxType);
|
|
|
},
|
|
|
refreshInfoPrice: function () {
|
|
|
- $('#info_price_sheet').height($("#mix_ratio_sheet").height() - $("#infoToolDiv").height()-10);
|
|
|
- projectGljObject.initInfoPriceSpread();
|
|
|
+ this.setInfoDivHeight();
|
|
|
+ if ($('#info_price_sheet').is(':visible')){
|
|
|
+ this.initInfoPriceSpread();
|
|
|
+ this.initInfoClassSpread();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ setInfoDivHeight:function(){
|
|
|
+ let info_height = $("#mix_ratio_sheet").height() - $("#infoToolDiv").height()-10;
|
|
|
+ $('#info_price_main').height(info_height);
|
|
|
+ $('#info_class_sheet').height(info_height);
|
|
|
+ $('#info_price_sheet').height(info_height);
|
|
|
}
|
|
|
};
|
|
|
|
|
@@ -1811,8 +1876,7 @@ function loadProjectGljSize() {
|
|
|
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();
|
|
|
+ me.refreshInfoPrice();
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -2137,7 +2201,7 @@ $(function () {
|
|
|
projectGljObject.refreshInfoPrice();
|
|
|
projectGljObject.autoShowInfoPriceData();
|
|
|
});
|
|
|
- $('#info_year').change(function () {
|
|
|
+ $('#info_year').change(async function () {
|
|
|
let periodMap = projectGljObject.infoPriceOptions.periodMap;
|
|
|
let year = $(this).val();
|
|
|
let month = $("#info_month").val();
|
|
@@ -2147,21 +2211,25 @@ $(function () {
|
|
|
if (month != "") {
|
|
|
if (_.includes(options, month)) {
|
|
|
$("#info_month").val(month);
|
|
|
+ projectGljObject.searchInfoClass();
|
|
|
projectGljObject.searchInfoPrice();
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
- $('#info_month').change(function () {
|
|
|
- projectGljObject.searchInfoPrice();
|
|
|
+ $('#info_month').change(async function () {
|
|
|
+ await projectGljObject.searchInfoClass();
|
|
|
+ await projectGljObject.searchInfoPrice();
|
|
|
});
|
|
|
- $('#info_area').change(function () {
|
|
|
- projectGljObject.searchInfoPrice();
|
|
|
+ $('#info_area').change(async function () {
|
|
|
+ await projectGljObject.searchInfoClass()
|
|
|
+ await projectGljObject.searchInfoPrice();
|
|
|
});
|
|
|
$('#info_search_name').on('keypress', function (e) {
|
|
|
$("#info-warning").text("");
|
|
|
if (e.keyCode === 13) {
|
|
|
$('#info_glj_name').val("");
|
|
|
$('#info_glj_code').val("");
|
|
|
+ $('#info_class').val("");
|
|
|
projectGljObject.searchInfoPrice();
|
|
|
}
|
|
|
});
|
|
@@ -2169,6 +2237,7 @@ $(function () {
|
|
|
$('#info_search_btn').on('click', function (e) {
|
|
|
$('#info_glj_name').val("");
|
|
|
$('#info_glj_code').val("");
|
|
|
+ $('#info_class').val("");
|
|
|
projectGljObject.searchInfoPrice();
|
|
|
});
|
|
|
|