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.

443 lines
14 KiB
JavaScript

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

Ext.namespace('Shipping');
Shipping.MsInfoClientHangXinCustIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsInfoClientHangXinCustIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsInfoClientHangXinCustIndex, Ext.Panel, {
PageSize:40,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
EditRecord: null,
GID: '',
//需求编号SR2017061200005-1
initUIComponents: function () {
this.sqlcontext = '';
this.formname = "MsInfoClientHangXinCustIndex"; //页面名称
//定义数据集
Ext.define('HangXinCust', {
extend: 'Ext.data.Model',
idProperty: 'GID',
fields: [
{ name: 'GID', type: 'string' },
{ name: 'CUSTGID', type: 'string' },
{ name: 'SHORTNAME', type: 'string' },
{ name: 'NO', type: 'string' },
{ name: 'CUSTNAME', type: 'string' },
{ name: 'TAXNO', type: 'string' },
{ name: 'ADDRTEL', type: 'string' },
{ name: 'BANK', type: 'string' }
]
});
_this = this;
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'HangXinCust',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsInfoClient/GetHangXinCust',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#region List列表显示信息
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 30
});
this.storeCustomerNameRef = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListRm' }
});
this.comboxCustomerNameRef = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeCustomerNameRef,
forceSelection: true,
queryMode: 'remote',
minChars: 1,
queryParam: 'CODENAME',
lazyRender: false,
name: 'CustomerName',
valueField: 'CustName',
displayField: 'CodeAndName'
});
this.girdcolums = [{
sortable: true,
dataIndex: 'GID',
header: Zi.LAN.GID, //'GID',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'CUSTGID',
header: Zi.LAN.GID, //'GID',
hidden: true,
width: 0
},
{
sortable: true,
dataIndex: 'NO',
header:'序号', //'合同号',
width: 90
},
{
sortable: true,
dataIndex: 'SHORTNAME',
header: '系统客户', //'签订日期',
editor: this.comboxCustomerNameRef,
width: 140
}, {
sortable: true,
dataIndex: 'CUSTNAME',
header:'客户名称', //'合同生效日期',
width: 250
},
{
sortable: true,
dataIndex: 'TAXNO',
header: '税号', //'合同结束日期',
width: 150
},
{
sortable: true,
dataIndex: 'ADDRTEL',
header:'地址电话', //'签订人',
width: 350
},
{
sortable: true,
dataIndex: 'BANK',
header:'银行账号', //'录入人',
width: 350
}];
this.Pagenum = Ext.create('Ext.form.field.Number', {
name: 'bottles',
fieldLabel: '每页记录数',
labelAlign: 'right',
value: this.PageSize,
maxValue: 100000,
width: 180,
minValue: 0,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.cellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
//定义Grid
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: Zi.LAN.ShuJuJiaZaiZhong }, //"数据加载中,请稍等..."
trackMouseOver: true,
disableSelection: false,
columns: this.girdcolums,
selModel: this.GridCheckBoxModel,
plugins: [this.cellEditing],
bbar:[ Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayMsg: Zi.LAN.displayMsg, //'当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: Zi.LAN.emptyMsg, //"没有数据"
displayInfo: true
}), this.Pagenum]
});
this.gridList.reconfigure(this.storeList, this.girdcolums);
this.gridList.columns[0] = new Ext.grid.RowNumberer();
////////////////////////////////////////////////
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: 'CUSTNAME',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, { xtype: 'hiddenfield' }, { xtype: 'hiddenfield' }, { xtype: 'hiddenfield' }
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
//#endregion formSearch
//按钮工具条
me = this;
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [ {
text: '暂存开票资料',
tooltip: '暂存开票资料',
iconCls: "btnsave",
handler: function (button, event) {
this.onSaveHangXinClick();
},
scope: this
}, '-', {
text: '更新发票信息',
tooltip: '更新发票信息',
id: 'btnSubmitAudit',
handler: function (button, event) {
this.onUpdateCustInvClick();
},
scope: this
}, '-',{
xtype: 'button',
// width: 90,
text: "执行查询", //"执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
}]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 75,
items: [this.panelBtn, this.formSearch]
});
Ext.apply(this, {
items: [this.panelTop, this.gridList]
});
this.onRefreshClick();
this.storeList.on('beforeload', function (store) {
var sql = this.sqlcontext;
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
}, //end initUIComponents
onRefreshClick: function (button, event) {
//var girdcolums = this.gridList.getColumnMode();
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.ZhengZaiChaXunShuJu,
scope: this
});
},
onSaveHangXinClick: function (button, event) {
var GidStr = '';
//var records = this.GridCheckBoxModel.selected.items;
//if (records.length == 0) {
// Ext.Msg.show({ title: '提示', msg: '请先选择要发放的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
// return;
//}
var bodyAddDatas = [];
for (var i = 0; i < this.storeList.getCount(); i++) {
var rec = this.storeList.getAt(i);
//if (rec.data.ISSALEFEE != '已发放') {
bodyAddDatas.push(rec);
//}
}
_this = this;
if (bodyAddDatas.length == 0) {
Ext.Msg.show({ title: '提示', msg: '没有要保存的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
} else {
Ext.Msg.wait('正在提取数据...');
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
Ext.Ajax.request({
waitMsg: '正在锁定...',
url: '/MvcShipping/MsInfoClient/SaveHangXinCust',
params: {
data: jsonbodyAddDatas
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
_this.onRefreshClick();
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
},
onUpdateCustInvClick: function (button, event) {
var GidStr = '';
//var records = this.GridCheckBoxModel.selected.items;
//if (records.length == 0) {
// Ext.Msg.show({ title: '提示', msg: '请先选择要发放的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
// return;
//}
var bodyAddDatas = [];
for (var i = 0; i < this.storeList.getCount(); i++) {
var rec = this.storeList.getAt(i);
if (rec.data.SHORTNAME!='')
bodyAddDatas.push(rec);
}
_this = this;
if (bodyAddDatas.length == 0) {
Ext.Msg.show({ title: '提示', msg: '没有要保存的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
} else {
Ext.Msg.wait('正在提取数据...');
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
Ext.Ajax.request({
waitMsg: '正在锁定...',
url: '/MvcShipping/MsInfoClient/UpdateHangXinCust',
params: {
data: jsonbodyAddDatas
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
_this.onRefreshClick();
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
},
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert(Zi.LAN.TiShi, Zi.LAN.ChaXunTiaoJianFuZhiCuoWu);
return '';
}
var sql = '';
var CUSTNAME = form.findField('CUSTNAME').getValue();
sql = sql + getAndConSql(sql, CUSTNAME, "CUSTNAME like '%" + CUSTNAME + "%'");
return sql;
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
ret[3] = this.EditRecord;
return ret;
}
});