|
@@ -47,10 +47,10 @@ ProjectGLJSpread.prototype.init = function () {
|
|
|
{name: '类型', field: 'unit_price.short_name', visible: true,width:45},
|
|
|
{name: 'ID', field: 'id', visible: false},
|
|
|
{name: '类型', field: 'unit_price.type', visible: false},
|
|
|
- {name: '总消耗量', field: 'quantity', visible: true,width:100},
|
|
|
- {name: '定额价', field: "unit_price.base_price", visible: true,width:70},
|
|
|
- {name: '调整价', field: 'adjust_price', visible: true,width:70},
|
|
|
- {name: '市场价', field: "unit_price.market_price", visible: true, validator: 'number',width:70},
|
|
|
+ {name: '总消耗量', field: 'quantity', visible: true,width:100,decimalField:'glj.quantity'},
|
|
|
+ {name: '定额价', field: "unit_price.base_price", visible: true,width:70,decimalField:"glj.unitPrice"},
|
|
|
+ {name: '调整价', field: 'adjust_price', visible: true,width:70,decimalField:"glj.unitPrice"},
|
|
|
+ {name: '市场价', field: "unit_price.market_price", visible: true, validator: 'number',width:70,decimalField:"glj.unitPrice"},
|
|
|
{
|
|
|
name: '是否暂估',
|
|
|
field: 'is_evaluate',
|
|
@@ -75,7 +75,7 @@ ProjectGLJSpread.prototype.init = function () {
|
|
|
{name: '工料机ID', field: 'glj_id', visible: false},
|
|
|
{name: '组成物消耗量', field: 'consumption', visible: false},
|
|
|
{name: '父级关联编码', field: 'connect_code', visible: false},
|
|
|
- {name: '消耗量', field: 'ratio_data', visible: false},
|
|
|
+ {name: '组成物信息', field: 'ratio_data', visible: false},
|
|
|
];
|
|
|
let sourceData = jsonData;
|
|
|
|
|
@@ -92,6 +92,8 @@ ProjectGLJSpread.prototype.init = function () {
|
|
|
let marketPriceColumn = this.sheetObj.getFieldColumn('unit_price.market_price');
|
|
|
let supplyColumn = this.sheetObj.getFieldColumn('supply');
|
|
|
let shortNameColumn = this.sheetObj.getFieldColumn('unit_price.short_name');
|
|
|
+ let supplyQuantity = this.sheetObj.getFieldColumn('supply_quantity');
|
|
|
+
|
|
|
|
|
|
// 居中样式
|
|
|
let centerStyleSetting = {hAlign: 1};
|
|
@@ -107,6 +109,7 @@ ProjectGLJSpread.prototype.init = function () {
|
|
|
this.sheetObj.setStyle(-1, adjustPriceColumn, rightStyleSetting);
|
|
|
this.sheetObj.setStyle(-1, marketPriceColumn, rightStyleSetting);
|
|
|
this.sheetObj.setStyle(-1, supplyColumn, rightStyleSetting);
|
|
|
+ this.sheetObj.setStyle(-1, supplyQuantity, rightStyleSetting);
|
|
|
|
|
|
// 设置可编辑列
|
|
|
this.sheetObj.setColumnEditable(marketPriceColumn);
|
|
@@ -135,9 +138,14 @@ ProjectGLJSpread.prototype.init = function () {
|
|
|
let typeColumn = self.sheetObj.getFieldColumn('unit_price.type');
|
|
|
let type = activeSheet.getValue(row, typeColumn);
|
|
|
|
|
|
+ let ratioColumn = self.sheetObj.getFieldColumn('ratio_data');
|
|
|
+ let ratioData = activeSheet.getValue(row, ratioColumn);
|
|
|
+
|
|
|
// 如果类型为混凝土、砂浆、配合比、机械,则提示
|
|
|
if (field === 'unit_price.market_price' && canNotChangeTypeId.indexOf(type) >= 0) {
|
|
|
- alert('当前工料机的市场单价由组成物计算得出,不可直接修改');
|
|
|
+ if(ratioData&&ratioData.length>0){
|
|
|
+ alert('当前工料机的市场单价由组成物计算得出,不可直接修改');
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
|
|
@@ -208,7 +216,9 @@ ProjectGLJSpread.prototype.updateProjectGLJField = function(info, callback) {
|
|
|
if(field === 'supply_quantity'){//修改数量需做4舍5入
|
|
|
value= value.toDecimal(getDecimal('glj.quantity'));
|
|
|
}
|
|
|
-
|
|
|
+ if(field === 'unit_price.market_price'){
|
|
|
+ value= value.toDecimal(getDecimal('glj.unitPrice'));
|
|
|
+ }
|
|
|
extend = Object.keys(extend).length > 0 ? JSON.stringify(extend) : '';
|
|
|
$.ajax({
|
|
|
url: '/glj/update',
|
|
@@ -280,10 +290,14 @@ ProjectGLJSpread.prototype.specialColumn = function (sourceData) {
|
|
|
// 锁定该单元格
|
|
|
activeSheet.getCell(rowCounter, supplyColumn, GC.Spread.Sheets.SheetArea.viewport).locked(true);
|
|
|
}
|
|
|
- // 如果为部分甲供或者为全部甲供则甲供数量需要可编辑
|
|
|
- if (data.supply === 1 || data.supply === 2) {
|
|
|
+ // 如果为部分甲供则甲供数量需要可编辑
|
|
|
+ if (data.supply === 1) {
|
|
|
activeSheet.getCell(rowCounter, supplyQuantity, GC.Spread.Sheets.SheetArea.viewport).locked(false);
|
|
|
}
|
|
|
+ //供货方式为完全甲供时设置甲供数量为总消耗量
|
|
|
+ if (data.supply === 2) {
|
|
|
+ activeSheet.setValue(rowCounter, supplyQuantity, data.quantity);
|
|
|
+ }
|
|
|
// 供货方式数据
|
|
|
let supplyIndex = parseInt(data.supply);
|
|
|
supplyIndex = isNaN(supplyIndex) ? 0 : supplyIndex;
|
|
@@ -297,7 +311,9 @@ ProjectGLJSpread.prototype.specialColumn = function (sourceData) {
|
|
|
this.firstMachineRow = this.firstMachineRow === -1 && data.unit_price.type === GLJTypeConst.GENERAL_MACHINE ?
|
|
|
rowCounter : this.firstMachineRow;
|
|
|
// 锁定该单元格
|
|
|
- activeSheet.getCell(rowCounter, marketPriceColumn, GC.Spread.Sheets.SheetArea.viewport).locked(true);
|
|
|
+ if (data.ratio_data && data.ratio_data.length > 0){//有组成物时,市场单价不可修改
|
|
|
+ activeSheet.getCell(rowCounter, marketPriceColumn, GC.Spread.Sheets.SheetArea.viewport).locked(true);
|
|
|
+ }
|
|
|
activeSheet.getCell(rowCounter, supplyColumn, GC.Spread.Sheets.SheetArea.viewport).locked(true);
|
|
|
}
|
|
|
|