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/MvcShipping/Viewsjs/MsChFeeYsAutoDui/MsChFeeYsAutoDuiMainIndex.js

390 lines
13 KiB
JavaScript

3 years ago
Ext.namespace('Shipping');
Shipping.MsChFeeYsAutoDuiIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsChFeeYsAutoDuiIndex.superclass.constructor.call(this);
};
var sqlParms = '';
var selCustName = '';
Ext.extend(Shipping.MsChFeeYsAutoDuiIndex, Ext.Panel, {
PageSize: 200,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
selectbsnostr: '',
selectfeestr: '',
sqlcontext: '',
initUIComponents: function () {
this.formname = 'MsChFeeYsDuiMainIndex';
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
model: 'MsChFeeYsAutoDuiMain',
pageSize: this.PageSize,
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsChFeeYsAutoDui/GetMainDataList',
reader: {
id: 'DUINO',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.initgirdcolums = [{
dataIndex: 'dMainId',
header: '主键',
width: 120,
hidden: true
},
{
sortable: true,
dataIndex: 'mainDuiNo',
header: '对账记录号',
width: 120
},
{
sortable: true,
dataIndex: 'mainDuiName',
header: '对账名称',
width: 160
},
{
sortable: true,
dataIndex: 'DuiZhangKeHu',
header: '对账客户',
width: 160
}, {
sortable: true,
dataIndex: 'duiOp',
header: '对账人',
width: 60
}, {
sortable: true,
dataIndex: 'description',
header: '对账备注',
width: 120
}, {
sortable: true,
dataIndex: 'duiDate',
header: '对账日期',
width: 120
}
];
this.girdcolums = this.initgirdcolums;
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
//定义Grid
this.Pagenum = Ext.create('Ext.form.field.Number', {
name: 'bottles',
fieldLabel: Zi.LAN.NumberOfpage, //每页记录数
labelAlign: 'right',
value: this.PageSize,
maxValue: 100000,
width: 180,
minValue: 0,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: Zi.LAN.LoadData }, //数据加载中,请稍等...
trackMouseOver: true,
disableSelection: false,
columns: this.girdcolums,
selModel: this.GridCheckBoxModel,
viewConfig: {
autoFill: true,
enableTextSelection: true, //允许复制数据
getRowClass: function (record, rowIndex, rowParams, store) {
var BILLSTATUSREF = record.get('BILLSTATUSREF');
if (BILLSTATUSREF == "锁定")
return 'feestatus_refer';
}
},
// paging bar on the bottom
bbar: [Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: Zi.LAN.FenYe, //当前显示 {0} - {1}条记录 /共 {2}条记录
emptyMsg: Zi.LAN.Nodata//没有数据
}), this.Pagenum]
});
this.girdcolums = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums, 1); //使用者id表名中间column数组跳过一开始的几列
this.gridList.reconfigure(this.storeList, this.girdcolums);
this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
this.SelectedRecord = record;
this.OprationStatus = 'edit';
sqlParms = this.getCondition('1');
selCustName = record.data.KeHuJianCheng;
DsOpenEditWin('/MvcShipping/MsChFeeYsAutoDui/Edit', "自动对账明细");
}, this);
//#region formSearch
_this = this;
this.storeCustCodefee = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListRm' }
});
this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel:'对账客户',
store: this.storeCustCodefee,
queryMode: 'remote',
minChars: 1,
forceSelection: true,
queryParam: 'CODENAME',
name: 'CUSTNAME',
valueField: 'CustName',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
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: '对账日期从', //到对账日期
format: 'Y-m-d',
xtype: 'datefield',
name: 'duiDateFrom'
}, {
fieldLabel: '对账日期从', //到对账日期
format: 'Y-m-d',
xtype: 'datefield',
name: 'duiDateTo'
}, this.comboxCustCode, { xtype: 'hidden' }, { xtype: 'hidden' }
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
//#endregion formSearch
//查询工具条
_this = this;
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
text: Zi.LAN.ExecuteQuery, //执行查询
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
},
{
text: Zi.LAN.ResetCondition, //重置条件
iconCls: "btnreset",
handler: function (button, event) {
this.onClearSql(button, event);
},
scope: this
},
{
text: '新建',
iconCls: "btnadd",
handler: function (menu, event) {
_this.OprationStatus = 'add';
DsOpenEditWin('/MvcShipping/MsChFeeYsAutoDui/Edit', "添加自动对账");
},
scope: this
}, '-', {
text: Zi.LAN.Saveliststyle, //保存列表样式
id: "btntest",
menu: [
{ text: Zi.LAN.Save, //保存
handler: function (button, event) {
this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridList.columns, _this.girdcolums, 1, true);
}
}, { text: Zi.LAN.Initialization,
handler: function (menu, event) {
_this.InitGrid(_this.initgirdcolums);
_this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridList.columns, _this.initgirdcolums, 1, true);
}
}],
scope: this
}, '-', {
text: "删除",
iconCls: "btndelete",
handler: function (button, event) {
this.onDeleteClick(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) {
var sql = this.sqlcontext;
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
}, //end initUIComponents
InitGrid: function (grid) {
var agirdcolums = grid;
this.gridList.reconfigure(this.storeList, agirdcolums);
},
onClearSql: function () {
var form = this.formSearch.getForm();
form.reset();
}, //onDeleteClick
onRefreshClick: function (button, event) {
var sql = this.getCondition();
this.sqlcontext = sql;
this.PageSize = this.Pagenum.getValue();
this.storeList.pageSize = this.PageSize;
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: Zi.LAN.NowSelect, //正在查询数据...
scope: this
});
},
getCondition: function (type) {
var form = this.formSearch.getForm();
var sql = '';
var duiDateFrom = form.findField('duiDateFrom').getRawValue();
if (duiDateFrom != "" && duiDateFrom != null) {
sql = sql + getAndConSql(sql, duiDateFrom, "duiDate >='" + duiDateFrom + "'");
}
var duiDateTo = form.findField('duiDateTo').getRawValue();
if (duiDateTo != "" && duiDateTo != null) {
sql = sql + getAndConSql(sql, duiDateTo, "duiDate <='" + duiDateTo + "'");
}
var CUSTNAME = form.findField('CUSTNAME').getValue();
sql = sql + getAndConSql(sql, CUSTNAME, " DuiZhangKeHu='" + CUSTNAME + "'");
return sql;
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.SelectedRecord;
return ret;
},
onDeleteClick: function (button, event) {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择对账据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var selectStores = [];
for (var i = 0; i < selections.length; i++) {
selectStores.push(selections[i].data);
}
var _this = this;
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcShipping/MsChFeeYsAutoDui/DeleteMain',
params: {
data: Ext.JSON.encode(selectStores)
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
_this.onRefreshClick(button,event);
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) {
},
scope: this
}); //end Ext.Ajax.request
}
}, this);
}
});