|
@@ -1,12 +1,17 @@
|
|
|
|
|
|
+let unitOptions = ['m', 'm2', 'm3', 'km', 't', 'kg', '台班', '工日', '昼夜', '元', '项', '处', '个', '件',
|
|
|
+'根', '组', '系统', '台', '套', '株', '丛', '缸', '支', '只', '块', '座', '对', '份', '樘', '攒', '榀']
|
|
|
let equipmentPurchaseObj = {
|
|
|
setting:{
|
|
|
header: [
|
|
|
{headerName: "编号", headerWidth: 160, dataCode: "code", dataType: "String",formatter: "@"},
|
|
|
- {headerName: "名称", headerWidth: 200, dataCode: "name", dataType: "String"},
|
|
|
- {headerName: "单位", headerWidth: 100, dataCode: "unit", dataType: "String"},
|
|
|
- {headerName: "数量", headerWidth: 160, dataCode: "quantity", hAlign: "right", dataType: "Number",validator:'number'},
|
|
|
+ {headerName: "设备名称", headerWidth: 200, dataCode: "name", dataType: "String"},
|
|
|
+ {headerName: "设备价格-设备原价", headerWidth: 160, dataCode: "originalPrice", hAlign: "right", dataType: "Number",validator:'number'},
|
|
|
+ {headerName: "设备运杂费", headerWidth: 160, dataCode: "freight", hAlign: "right", dataType: "Number",validator:'number'},
|
|
|
+ {headerName: "备品备件费", headerWidth: 160, dataCode: "sparePartCost", hAlign: "right", dataType: "Number",validator:'number'},
|
|
|
{headerName: "单价", headerWidth: 160, dataCode: "unitPrice", hAlign: "right", dataType: "Number",validator:'number'},
|
|
|
+ {headerName: "单位", headerWidth: 60, dataCode: "unit", dataType: "String",hAlign: "center",cellType:'comboBox',editable:true,options:unitOptions},
|
|
|
+ {headerName: "数量", headerWidth: 160, dataCode: "quantity", hAlign: "right", dataType: "Number",validator:'number'},
|
|
|
{headerName: "金额", headerWidth: 160, dataCode: "totalPrice", hAlign: "right", dataType: "Number"},
|
|
|
],
|
|
|
view: {
|
|
@@ -25,6 +30,9 @@ let equipmentPurchaseObj = {
|
|
|
sheetCommonObj.initSheet(this.sheet, this.setting, 0);
|
|
|
this.sheet.bind(GC.Spread.Sheets.Events.ValueChanged,this.onValueChange);
|
|
|
this.sheet.bind(GC.Spread.Sheets.Events.RangeChanged, this.onSheetRangeChange);
|
|
|
+ this.sheet.bind(GC.Spread.Sheets.Events.SelectionChanged, function (e,args) {
|
|
|
+ args.sheet.repaint();
|
|
|
+ });
|
|
|
if (projectReadOnly) {
|
|
|
sheetCommonObj.disableSpread(this.spread);
|
|
|
} else {
|
|
@@ -61,16 +69,18 @@ let equipmentPurchaseObj = {
|
|
|
calcTotalPrice:function(newValue,dataCode,doc,equipment){
|
|
|
let unitPrice = equipment.unitPrice?scMathUtil.roundForObj(equipment.unitPrice,getDecimal('glj.unitPrice')):0;
|
|
|
let quantity = equipment.quantity?scMathUtil.roundForObj(equipment.quantity,getDecimal('glj.quantity')):0;
|
|
|
+ let quantity = equipment.quantity?scMathUtil.roundForObj(equipment.quantity,getDecimal('glj.quantity')):0;
|
|
|
+ let quantity = equipment.quantity?scMathUtil.roundForObj(equipment.quantity,getDecimal('glj.quantity')):0;
|
|
|
if(newValue){
|
|
|
+ if(gljUtil.isDef(doc.unitPrice)) unitPrice = doc.unitPrice;
|
|
|
+ if(gljUtil.isDef(doc.quantity)) quantity = doc.quantity;
|
|
|
if(dataCode === 'quantity') {
|
|
|
newValue = scMathUtil.roundForObj(newValue,getDecimal('glj.quantity'));
|
|
|
quantity = newValue;
|
|
|
- if(gljUtil.isDef(doc.unitPrice)) unitPrice = doc.unitPrice;
|
|
|
}
|
|
|
if(dataCode === 'unitPrice') {
|
|
|
newValue = scMathUtil.roundForObj(newValue,getDecimal('glj.unitPrice'));
|
|
|
unitPrice = newValue;
|
|
|
- if(gljUtil.isDef(doc.quantity)) quantity = doc.quantity;
|
|
|
}
|
|
|
doc.totalPrice = scMathUtil.roundForObj(quantity * unitPrice,getDecimal('glj.unitPrice'));
|
|
|
}
|