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.
DS7/DSWeb/Areas/RptMng/Viewsjs/DemoIndex.js

297 lines
9.5 KiB
JavaScript

3 years ago
Ext.namespace('DsTruckRpt');
DsTruckRpt.DemoIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.DsTruckRpt.DemoIndex.superclass.constructor.call(this);
};
Ext.extend(DsTruckRpt.DemoIndex, Ext.Panel, {
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
initUIComponents: function () {
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
fields: [
{ name: 'GID', type: 'string' },
{ name: 'BSNO', type: 'string' },
{ name: 'FEESTATUS', type: 'number' },
{ name: 'FEETYPE', type: 'number' },
{ name: 'FEENAME', type: 'string' },
{ name: 'FEEDESCRIPTION', type: 'string' },
{ name: 'CUSTOMERTYPE', type: 'string' },
{ name: 'CUSTOMERNAME', type: 'string' },
{ name: 'UNIT', type: 'string' },
{ name: 'UNITPRICE', type: 'number' },
{ name: 'QUANTITY', type: 'number' },
{ name: 'AMOUNT', type: 'number' },
{ name: 'CURRENCY', type: 'string' },
{ name: 'EXCHANGERATE', type: 'number' },
{ name: 'REASON', type: 'string' },
{ name: 'REMARK', type: 'string' },
{ name: 'COMMISSIONRAGE', type: 'number' },
{ name: 'SETTLEMENT', type: 'number' },
{ name: 'INVOICE', type: 'number' },
{ name: 'ORDERAMOUNT', type: 'number' },
{ name: 'ORDERINVOICE', type: 'number' },
{ name: 'SUBMITDATE', type: 'date' },
{ name: 'AUDITOPERATOR', type: 'string' },
{ name: 'AUDITDATE', type: 'date' },
{ name: 'ENTEROPERATOR', type: 'string' },
{ name: 'ENTERDATE', type: 'date' },
{ name: 'DEBITNO', type: 'string' },
{ name: 'ISDEBIT', type: 'string' },
{ name: 'ISOPEN', type: 'string' },
{ name: 'ISADVANCEDPAY', type: 'string' },
{ name: 'SORT', type: 'string' },
{ name: 'ISINVOICE', type: 'string' },
{ name: 'FEEFRT', type: 'string' },
{ name: 'ISCRMORDERFEE', type: 'string' },
{ name: 'AUDITSTATUS', type: 'number' },
{ name: 'INVOICENUM', type: 'string' },
{ name: 'CHEQUENUM', type: 'string' },
{ name: 'WMSOUTBSNO', type: 'string' }
],
remoteSort: true,
proxy: {
type: 'ajax',
url: '/RptMng/Demo/QryData',
reader: {
id: '',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//定义Grid
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
columns: [{
sortable: true,
dataIndex: 'GID',
header: '惟一编号',
width: 160
}, {
sortable: true,
dataIndex: 'FEESTATUS',
header: '费用状态',
width: 100
}, {
sortable: true,
dataIndex: 'FEETYPE',
header: '费用收、付方式',
width: 100
}, {
sortable: true,
dataIndex: 'FEENAME',
header: '费用中文名称',
width: 200
}, {
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '客户名称',
width: 200
}, {
sortable: true,
dataIndex: 'UNIT',
header: '单位标准',
width: 200
}, {
sortable: true,
dataIndex: 'UNITPRICE',
header: '单价',
width: 160,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
sortable: true,
dataIndex: 'QUANTITY',
header: '数量',
width: 160
}, {
sortable: true,
dataIndex: 'AMOUNT',
header: '金额',
width: 160,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
sortable: true,
dataIndex: 'REMARK',
header: '备注',
width: 200
}
],
bbar: new Ext.PagingToolbar({
pageSize: 200,
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
//#region formSearch
//#region formSearch枚举参照相关
//#endregion
this.formSearch = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '组织',
name: 'PS_ORGCODE'
}
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
//#endregion formSearch
//查询工具条
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
}
]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 80,
items: [this.formSearch, this.panelBtn]
});
Ext.apply(this, {
items: [this.panelTop, this.gridList]
});
this.storeList.on('beforeload', function (store) {
if (!this.checkSearchCondition())
return;
var sql = this.getCondition();
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
}, //end initUIComponents
onRefreshClick: function (button, event) {
if (!this.checkSearchCondition())
return;
var sql = this.getCondition();
this.storeList.load({
params: { start: 0, limit: 5000, condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
getCondition: function () {
var form = this.formSearch.getForm();
var sql = '';
var sqldata = form.getValues();
sql = Ext.JSON.encode(sqldata);
return sql;
},
checkSearchCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return false;
}
return true;
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
return ret;
}
});