You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

234 lines
8.4 KiB
JavaScript

Ext.namespace('DsTruck');
DsTruck.FileImport = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
DsTruck.FileImport.superclass.constructor.call(this);
};
Ext.extend(DsTruck.FileImport, Ext.Window, {
StoreList: null,
BSNO: "",
priceAdd: "",
priceCut: "",
priceMul: "",
_20GPMul: "",
_40GPMul: "",
initUIComponents: function () {
// BEGIN OF CODE GENERATION PARTS, DON'T DELETE CODE BELOW
Ext.apply(this, {
height: 170,
width: 200,
closable: true,
draggable: true,
defaultButton: 'btnImport',
resizable: false,
items: [{
region: "center",
frame: "true",
items: [{
xtype: 'filefield',
name: 'file',
fieldLabel: 'Excel文件',
labelWidth: 80,
anchor: '100%',
buttonText: '选择文件...'
}/*, {
xtype: 'monthfield',
name: 'ACCDATE',
fieldLabel: '月份',
labelWidth: 80,
anchor: '100%'
}, {
xtype: 'label',
//name: 'label1',
text: '依照月份与车号导入。月份与车号相同的会覆盖而非增加。'
//labelWidth: 80,
//anchor: '100%'
}*/],
xtype: "form",
layout: "form",
id: 'importForm',
buttons: [{
text: "导入",
id: 'btnImport',
handler: function (button, event) {
var form = Ext.getCmp("importForm").getForm();
var storeList = this.StoreList;
//var form = this.up("form").getForm();
if (form.isValid()) {
form.submit({
url: '/TruckMng/MsWl_Port/File', waitMsg: '正在导入文件...',
params: {
BSNO: panelEdit.BSNO,
priceAdd: this.priceAdd,
priceCut: this.priceCut,
priceMul: this.priceMul,
_20GPMul: this._20GPMul,
_40GPMul: this._40GPMul
},
success: function (f, a) {
var result = a.result,
dataList = result.data;
for (var i = 0; i < dataList.length; i++) {
var record = dataList[i];
storeList.add(record);
}
var win = Ext.getCmp("importWin");
win.close();
panelEdit.ReflashEdt(panelEdit.BSNO);
Ext.Msg.alert('Success', result.Message);
},
failure: function (f, a) { Ext.Msg.alert('Failure', a.result.Message); }
});
}
//this.onImportClick(button, event);
},
scope: this
}, {
text: "关闭",
handler: function (button, event) {
var win = this.up("window"); // Ext.getCmp("importWin");
win.close();
}
}]
}],
layout: "border",
width: 300,
xtype: "window",
id: "importWin"/*,
closeAction: "close"*/
});
// END OF CODE GENERATION PARTS, DON'T DELETE CODE ABOVE
}
});
DsTruck.FileImport_ADL = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
DsTruck.FileImport_ADL.superclass.constructor.call(this);
};
Ext.extend(DsTruck.FileImport_ADL, Ext.Window, {
initUIComponents: function () {
// BEGIN OF CODE GENERATION PARTS, DON'T DELETE CODE BELOW
var _this = this.parent;
Ext.apply(this, {
height: 170,
width: 200,
closable: true,
draggable: true,
defaultButton: 'btnImport',
resizable: false,
items: [{
region: "center",
frame: "true",
items: [{
xtype: 'filefield',
name: 'file',
fieldLabel: 'Excel文件',
labelWidth: 80,
anchor: '100%',
buttonText: '选择文件...'
}/*, {
xtype: 'monthfield',
name: 'ACCDATE',
fieldLabel: '月份',
labelWidth: 80,
anchor: '100%'
}, {
xtype: 'label',
//name: 'label1',
text: '依照月份与车号导入。月份与车号相同的会覆盖而非增加。'
//labelWidth: 80,
//anchor: '100%'
}*/],
xtype: "form",
layout: "form",
id: 'importForm',
buttons: [{
text: "导入",
id: 'btnImport',
handler: function (button, event) {
var form = Ext.getCmp("importForm").getForm();
var storeList = this.StoreList;
//var form = this.up("form").getForm();
if (form.isValid()) {
form.submit({
url: '/TruckMng/MsWl_ADL_FuelTruckList/File', waitMsg: '正在导入文件...',
params: {
},
success: function (f, a) {
var result = a.result;
dataList = result.data;
pnl.storeList_ADL.removeAll();
pnl.storeList_ADL.add(dataList);
/*
for (var i = 0; i < dataList.length; i++) {
var record = dataList[i];
_this.storeList_ADL.add(record);
}*/
var win = Ext.getCmp("importWin_ADL");
win.close();
//panelEdit.ReflashEdt(panelEdit.BSNO);
Ext.Msg.alert('Success', result.Message);
},
failure: function (f, a) { Ext.Msg.alert('Failure', a.result.Message); }
});
}
//this.onImportClick(button, event);
},
scope: this
}, {
text: "关闭",
handler: function (button, event) {
var win = this.up("window"); // Ext.getCmp("importWin");
win.close();
}
}]
}],
layout: "border",
width: 300,
xtype: "window",
id: "importWin_ADL"/*,
closeAction: "close"*/
});
// END OF CODE GENERATION PARTS, DON'T DELETE CODE ABOVE
}
});
DsTruck.MsChFeeGetRowClass = function (feeStatus) {
if (feeStatus == 2) {
return 'feestatus_refer';
} else if (feeStatus == 0) {
return 'feestatus_pass';
} else if (feeStatus == 6) {
return 'feestatus_nopass';
} else if (feeStatus == 8 || feeStatus == 9) {
return 'feestatus_settle';
}
return '';
}
DsTruck.inserted = function (feeStatus) {
if (feeStatus == 1) {
return 'feestatus_settle';
} else if (feeStatus == 0) {
return '';
}
return '';
}