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.

1146 lines
40 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.MsCwVouchersGlIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsCwVouchersGlIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsCwVouchersGlIndex, Ext.Panel, {
PageSize: 20,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
sqlcontext: '',
initUIComponents: function () {
this.formname = "formMsCwVouchersGlIndex"; //页面名称
//#region 定义数据集
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsCwVouchersGlModel',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsCwVouchersGl/GetDataList',
reader: {
id: 'ORDNO',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#endregion
//#region 列定义
//Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, { width: 30 });
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.girdcolums = [{
sortable: true,
dataIndex: 'ORDNO',
header: '', //唯一编码
hidden: true,
width: 0
},
{
sortable: true,
dataIndex: 'VOUDATE',
header: '凭证日期',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
align: 'center',
width: 100
},
{
sortable: true,
dataIndex: 'VKNO',
header: '凭证字',
align: 'center',
width: 50
},
{
sortable: true,
dataIndex: 'VOUNO',
header: '凭证号',
align: 'center',
width: 50
},
{
sortable: true,
dataIndex: 'AMTDR',
header: '本位币借方',
align: 'right',
width: 120
},
{
sortable: true,
dataIndex: 'AMTCR',
header: '本位币贷方',
align: 'right',
width: 120
},
{
sortable: true,
dataIndex: 'PREPARED',
header: '制单人',
align: 'center',
width: 80
},
{
sortable: true,
dataIndex: '',
header: '',
width: 500
},
{
sortable: true,
dataIndex: 'VOUALLNO',
header: '', //凭证号
hidden: true,
width: 0
},
{
sortable: true,
dataIndex: 'ISEXPORT',
header: '', //是否导出凭证
hidden: true,
width: 0
}];
//#endregion
//#region 加载主数据
function displayInnerGrid(renderId) {
//#region 定义数据集
this.storeDetailList = Ext.create('Ext.data.Store', {
model: 'MsCwVouitemsGlModel',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsCwVouchersGl/GetDetailList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#endregion
//#region 列定义
this.girdcolumsDetail = [{
sortable: true,
dataIndex: 'GID',
header: '', //唯一编码
hidden: true,
width: 0
},
{
sortable: false,
dataIndex: 'ORDNO',
header: '', //关联cw_vouchers_gl
hidden: true,
width: 0
},
{
sortable: false,
dataIndex: 'ITEMNO',
header: '行号',
align: 'center',
//style: "color: 'red'", //black
//color: "red",
width: 35
},
{
sortable: false,
dataIndex: 'EXPLAN',
header: '摘要',
align: 'center',
width: 170
},
{
sortable: false,
dataIndex: 'ACCID',
header: '科目代码',
align: 'center',
width: 80
},
{
sortable: false,
dataIndex: 'ACCNAME',
header: '科目名称',
align: 'center',
width: 80
},
{
sortable: false,
dataIndex: 'AMTDR',
header: '本位币借方',
align: 'right',
width: 80
},
{
sortable: false,
dataIndex: 'AMTCR',
header: '本位币贷方',
align: 'right',
width: 80
},
{
sortable: false,
dataIndex: 'FCYDR',
header: '外币借方',
align: 'right',
width: 80
},
{
sortable: false,
dataIndex: 'FCYCR',
header: '外币贷方',
align: 'right',
width: 80
},
{
sortable: false,
dataIndex: 'FCYEXRATE',
header: '汇率',
align: 'right',
width: 40
},
{
sortable: false,
dataIndex: 'CUSTOMERNAME',
header: '客户',
align: 'center',
width: 80
},
{
sortable: false,
dataIndex: 'SALE',
header: '人员',
align: 'center',
width: 60
},
{
sortable: false,
dataIndex: 'BLNO',
header: '提单号',
align: 'center',
width: 80
},
{
sortable: false,
dataIndex: 'ITEMNAME',
header: '项目名称',
align: 'center',
width: 80
},
{
sortable: false,
dataIndex: 'FSETTLCODE',
header: '结算方式',
align: 'center',
width: 60
},
{
sortable: false,
dataIndex: 'ISSYS',
header: '手动录入',
//xtype: 'checkcolumn',
xtype: "booleancolumn",
trueText: "是",
falseText: " ",
align: 'center',
width: 60
}];
//#endregion
//#region 加载明细数据
innerGrid = Ext.create('Ext.grid.Panel', {
store: storeDetailList,
selModel: {
selType: 'cellmodel'
},
columns: this.girdcolumsDetail,
columnLines: true,
enableHdMenu: false, //是否显示表头的上下文菜单,默认为true
enableColumnHide: false, //是否允许通过标题中的上下文菜单
trackMouseOver: true, //是否高亮显示鼠标所在的行,默认为true
disableSelection: true, //值为TRUE,表示禁止选择行
autoWidth: true,
autoHeight: true,
frame: false,
renderTo: renderId
});
this.storeDetailList.load({ params: { condition: "ORDNO='" + renderId + "'" }, waitMsg: "正在刷新数据...", scope: this });
//#endregion
}
function destroyInnerGrid(record) {
var parent = document.getElementById(record.get('ORDNO'));
var child = parent.firstChild;
while (child) {
child.parentNode.removeChild(child);
child = child.nextSibling;
}
}
Ext.define('MainGrid', {
extend: 'Ext.grid.Panel',
alias: 'widget.MainGrid',
region: 'center',
store: this.storeList,
columns: this.girdcolums,
loadMask: { msg: "数据加载中,请稍等..." },
enableColumnHide: false, //是否允许通过标题中的上下文菜单
enableHdMenu: false, //是否显示表头的上下文菜单,默认为true
trackMouseOver: true, //是否高亮显示鼠标所在的行,默认为true
disableSelection: false, //值为TRUE,表示禁止选择行
stripeRows: false, //斑马线效果
selModel: this.GridCheckBoxModel,
//selModel: {
// selType: 'cellmodel'
//},
plugins: [{
ptype: 'rowexpander',
rowBodyTpl: [
'<div id="{ORDNO}">',
'</div>'
]
}],
collapsible: true, //允许展开和收缩
animCollapse: false, //动画折叠,默认为false
bodyStyle: "background:'';",
//iconCls: 'icon-grid',
//render: Ext.getBody(),
//renderTo: Ext.getBody(),
tbar: [{
text: "新建",
iconCls: "btnadd",
handler: function (button, event) {
this.OprationStatus = 'add';
DsOpenEditWin('/MvcShipping/MsCwVouchersGl/Edit');
},
scope: this
}, {
text: "删除",
iconCls: "btndelete",
handler: function (button, event) {
this.onDeleteClick(button, event);
},
scope: this
}, {
text: "导出",
id: "btnExportExcel",
iconCls: 'btnexportexcel',
handler: function (button, event) {
this.onExportClick(button, event);
},
scope: this
}, '-', {
text: "重置条件",
iconCls: "btnreset",
handler: function (button, event) {
this.onClearSql(button, event);
},
scope: this
}, {
text: "查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
}, '-', {
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
id: 'VOUALL_NO',
fieldLabel: '凭证号',
labelAlign: 'right',
labelWidth: 40,
scope: this
}, {
id: 'VOUDATEbgn',
fieldLabel: '凭证日期',
format: 'Y-m-d',
xtype: 'datefield',
labelAlign: 'right',
labelWidth: 60,
scope: this
}, {
id: 'VOUDATEend',
fieldLabel: '到',
format: 'Y-m-d',
xtype: 'datefield',
labelAlign: 'right',
labelWidth: 20,
scope: this
}]
}]
}],
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
}),
initComponent: function () {
var me = this;
this.callParent(arguments);
}
});
//#endregion
//#region onReady
var _this = this;
Ext.onReady(function () {
Ext.QuickTips.init();
//Ext.BLANK_IMAGE_URL = '/images/s.gif';
var mainGrid = new Ext.create('MainGrid');
mainGrid.view.on('expandBody', function (rowNode, record, expandRow, eOpts) {
rowNode.style.backgroundColor = "#99CCFF"; //选中行背景色
//rowNode.style.color = "blue"; //选中行背景色
displayInnerGrid(record.get('ORDNO'));
});
mainGrid.view.on('collapsebody', function (rowNode, record, expandRow, eOpts) {
rowNode.style.backgroundColor = ""; //选中行背景色
//rowNode.style.color = ""; //选中行背景色
destroyInnerGrid(record);
});
mainGrid.render(Ext.getBody());
mainGrid.setHeight(window.innerHeight);
mainGrid.setWidth(window.innerWidth);
Ext.EventManager.onWindowResize(function () {
mainGrid.setHeight(window.innerHeight);
mainGrid.setWidth(window.innerWidth);
});
/////////////以下部分为获取存储的gridpanel显示样式
this.column = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums, 1); //使用者id表名中间column数组跳过一开始的几列
mainGrid.reconfigure(this.storeList, this.girdcolums);
mainGrid.columns[2] = new Ext.grid.RowNumberer();
var _this2 = _this;
mainGrid.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
_this2.OprationStatus = 'edit';
_this2.SelectedRecord = record;
DsOpenEditWin('/MvcShipping/MsCwVouchersGl/Edit', "凭证录入", "500", "900", "10", "10");
}, this);
//#region 页面加载
////////////////////////////////////////////////
mainGrid.addListener('beforeload', function (store) {
var sql = this.getCondition();
this.sqlcontext = sql;
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
// this.storeList.on('beforeload', function (store) {
// var sql = this.getCondition();
// this.sqlcontext = sql;
// Ext.apply(store.proxy.extraParams, { condition: sql });
// }, this);
//#endregion
});
//#endregion
}, //end initUIComponents
//#region 按钮函数
onRefreshClick: function (button, event) {
var sql = this.getCondition();
this.sqlcontext = sql;
this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql }, waitMsg: "正在刷新数据...", scope: this });
},
getCondition: function () {
var sql = '';
//凭证号
var VOUALLNO = Ext.getCmp("VOUALL_NO").value;
if (VOUALLNO != null) {
if (VOUALLNO != "") {
sql = sql + getAndConSql(sql, VOUALLNO, "VOUALLNO like '%" + VOUALLNO.toString().trim() + "%'");
}
}
//凭证日期
//var VOUDATEbgn = form.findField('VOUDATEbgn').getRawValue();
var VOUDATEbgn = Ext.getCmp("VOUDATEbgn").value;
if (VOUDATEbgn != null) {
if (VOUDATEbgn != "") {
VOUDATEbgn = this.GetDateStr(VOUDATEbgn, 1);
sql = sql + getAndConSql(sql, VOUDATEbgn, "convert(char(10),VOUDATE,120) >='" + VOUDATEbgn.toString().trim() + "'");
}
}
var VOUDATEend = Ext.getCmp("VOUDATEend").value;
if (VOUDATEend != null) {
if (VOUDATEend != "") {
VOUDATEend = this.GetDateStr(VOUDATEend, 1);
sql = sql + getAndConSql(sql, VOUDATEend, "convert(char(10),VOUDATE,120) <='" + VOUDATEend.toString().trim() + "'");
}
}
return sql;
},
onClearSql: function () {
Ext.getCmp("VOUALL_NO").setValue("");
Ext.getCmp("VOUDATEbgn").setValue("");
Ext.getCmp("VOUDATEend").setValue("");
}, //onDeleteClick
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 record = selections[0];
if (record.data.BSSTATUS == 'true') {
Ext.Msg.show({ title: '警告', msg: '业务已锁定,不允许删除!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
if (record.data.FEESTATUS == 'true') {
Ext.Msg.show({ title: '警告', msg: '费用已锁定,不允许删除!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
if (this.StoreOpRange.getCount() == 0) {
Ext.Msg.show({ title: '警告', msg: '权限不足,不允许删除!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
} else {
var op = record.data.OP;
var inputby = record.data.INPUTBY;
var records = DsStoreQueryBy(this.StoreOpRange, 'OPID', op);
if (records.getCount() > 0) {
} else {
var recordins = DsStoreQueryBy(this.StoreOpRange, 'OPID', inputby);
if (recordins.getCount() > 0) {
} else {
canedit = false;
Ext.Msg.show({ title: '警告', msg: '权限不足,不允许删除!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
}
}
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcShipping/MsOpSeai/Delete',
params: {
data: Ext.JSON.encode(record.data)
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeList.remove(record);
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
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);
},
//#region 导出Excel
onExportClick: function (button, event) {
var strGIDs = "";
// var SelectedRecords = this.gridList.selModel.getSelection();
// for (var i = 0; i < SelectedRecords.length; i++) {
// var rec = SelectedRecords[i];
// if (strGIDs == "") {
// strGIDs = rec.get('GID');
// }
// else {
// strGIDs = strGIDs + "," + rec.get('GID');
// }
// }
//
var sql = escape(this.getCondition());
var openSet = "height=1, width=400, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top=" + (screen.height - 200) / 2 + ",Left=" + (screen.width - 400) / 2;
var openType = "_blank";
var openUrl = "../../Reports/RptExport.aspx?handle=MsOpSeaiIndex&formname=" + this.formname + "&condition1=" + sql + "&gids=" + strGIDs;
window.open(openUrl, openType, openSet);
},
//#endregion
//#region 获取 YYYY-mm-dd 格式的日期
GetDateStr: function (sdate, AddDayCount) {
var dd = new Date(sdate); //获取选择的时期对象
dd.setDate(dd.getDate() + AddDayCount); //获取AddDayCount天后的日期
var sdate = dd.toISOString();
sdate = sdate.toString().substr(0, 10)
// var y = dd.getFullYear();
// var m = dd.getMonth()+1;//获取当前月份的日期
// var d = dd.getDate();
return sdate;
},
//#endregion
//#endregion
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
return ret;
}
});
/*
Ext.extend(Shipping.MsCwVouchersGlIndex, Ext.Panel, {
PageSize: 20,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
sqlcontext: '',
initUIComponents: function () {
this.formname = "formMsCwVouchersGlIndex"; //页面名称
//#region 定义数据集
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsCwVouchersGlModel',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsCwVouchersGl/GetDataList',
reader: {
id: 'ORDNO',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeDetailList = Ext.create('Ext.data.Store', {
model: 'MsCwVouitemsGlModel',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsCwVouchersGl/GetDetailList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#endregion
//#region 列定义
//Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, { width: 30 });
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.girdcolums = [{
sortable: true,
dataIndex: 'ORDNO',
header: '',//唯一编码
hidden: true,
width: 0
},
{
sortable: true,
dataIndex: 'VOUDATE',
header: '凭证日期',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
align: 'center',
width: 100
},
{
sortable: true,
dataIndex: 'VKNO',
header: '凭证字',
align: 'center',
width: 50
},
{
sortable: true,
dataIndex: 'VOUNO',
header: '凭证号',
align: 'center',
width: 50
},
{
sortable: true,
dataIndex: 'AMTDR',
header: '本位币借方',
align: 'right',
width: 120
},
{
sortable: true,
dataIndex: 'AMTCR',
header: '本位币贷方',
align: 'right',
width: 120
},
{
sortable: true,
dataIndex: 'PREPARED',
header: '制单人',
align: 'center',
width: 80
},
{
sortable: true,
dataIndex: 'VOUALLNO',
header: '',//凭证号
hidden: true,
width: 0
},
{
sortable: true,
dataIndex: 'ISEXPORT',
header: '',//是否导出凭证
hidden: true,
width: 0
}];
this.girdcolumsDetail = [{
sortable: true,
dataIndex: 'GID',
header: '',//唯一编码
hidden: true,
width: 0
},
{
sortable: true,
dataIndex: 'ORDNO',
header: '',//关联cw_vouchers_gl
hidden: true,
width: 0
},
{
sortable: true,
dataIndex: 'ITEMNO',
header: '行号',
align: 'center',
width: 80
},
{
sortable: true,
dataIndex: 'EXPLAN',
header: '摘要',
align: 'center',
width: 80
},
{
sortable: true,
dataIndex: 'ACCID',
header: '科目代码',
align: 'center',
width: 80
},
{
sortable: true,
dataIndex: 'ACCNAME',
header: '科目名称',
align: 'center',
width: 80
},
{
sortable: true,
dataIndex: 'AMTDR',
header: '本位币借方',
align: 'right',
width: 80
},
{
sortable: true,
dataIndex: 'AMTCR',
header: '本位币贷方',
align: 'right',
width: 80
},
{
sortable: true,
dataIndex: 'FCYDR',
header: '外币借方',
align: 'right',
width: 80
},
{
sortable: true,
dataIndex: 'FCYCR',
header: '外币贷方',
align: 'right',
width: 80
},
{
sortable: true,
dataIndex: 'FCYEXRATE',
header: '汇率',
align: 'right',
width: 30
},
{
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '客户',
align: 'center',
width: 80
},
{
sortable: true,
dataIndex: 'SALE',
header: '人员',
align: 'center',
width: 60
},
{
sortable: true,
dataIndex: 'BLNO',
header: '提单号',
align: 'center',
width: 80
},
{
sortable: true,
dataIndex: 'FSETTLCODE',
header: '结算方式',
align: 'center',
width: 60
},
{
sortable: true,
dataIndex: 'ISSYS',
header: '手动录入',
//xtype: 'checkcolumn',
xtype: "booleancolumn",
trueText: "是",
falseText: " ",
align: 'center',
width: 60
}];
//#endregion
//#region gridList列表显示信息
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
columns: this.girdcolums,
//selModel: this.GridCheckBoxModel,
selModel: {
selType: 'cellmodel'
},
plugins: [{
ptype: 'rowexpander',
rowBodyTpl: [
'<div id="{ORDNO}">',
'</div>'
]
}],
collapsible: true,
animCollapse: false,
iconCls: 'icon-grid',
renderTo: Ext.getBody(),
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
}),
listeners: {
scope: this,
'expandBody': function (rowNode, record, expandRow, eOpts) {
//this.storeDetailList.load({ params: { condition: record.get('ORDNO') }, waitMsg: "正在刷新数据...", scope: this });
displayInnerGrid(record.get('id'));
},
'collapsebody': function (rowNode, record, expandRow, eOpts) {
var parent = document.getElementById(record.get('ORDNO'));
var child = parent.firstChild;
while (child) {
child.parentNode.removeChild(child);
child = child.nextSibling;
}
}
}
});
/////////////以下部分为获取存储的gridpanel显示样式
this.column = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums, 1); //使用者id表名中间column数组跳过一开始的几列
this.gridList.reconfigure(this.storeList, this.girdcolums);
//this.gridList.columns[0] = new Ext.grid.RowNumberer();
this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
this.SelectedRecord = record;
this.OprationStatus = 'edit';
DsOpenEditWin('/MvcShipping/MsOpSeai/Edit', "科目信息录入", "", "800", "", "50");
}, this);
////////////////////////////////////////////////
this.gridDetailList = new Ext.grid.GridPanel({
store: this.storeDetailList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
columns: this.girdcolumsDetail,
selModel: this.GridCheckBoxModel
//,renderTo: 'ORDNO'
});
//swallowEvent( String eventName, [Boolean preventDefault] ) : Ext.Element//阻止eventName事件冒泡并视preventDefault阻断默认行为
//this.gridDetailList.getEl().swallowEvent(['mousedown', 'mouseup', 'click', 'contextmenu', 'mouseover', 'mouseout', 'dblclick', 'mousemove']);
//#endregion
//#region formSearch 查询面板
this.formSearch = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 60,
msgTarget: 'qtip'
},
items: [{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '凭证号',
name: 'VOUALLNO'
}, {
fieldLabel: '凭证日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'VOUDATEbgn'
}, {
fieldLabel: '到',
format: 'Y-m-d',
xtype: 'datefield',
name: 'VOUDATEend'
}]
}]//end items(fieldset 1)
}]//end root items
});
//#endregion formSearch
//#region 按钮工具条/页面布局
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [{
text: "新建",
iconCls: "btnadd",
handler: function (button, event) {
this.OprationStatus = 'add';
DsOpenEditWin('/MvcShipping/MsOpSeai/Edit');
},
scope: this
}, {
text: "删除",
iconCls: "btndelete",
handler: function (button, event) {
this.onDeleteClick(button, event);
},
scope: this
}, '-', {
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
}, {
text: "重置条件",
iconCls: "btnreset",
handler: function (button, event) {
this.onClearSql(button, event);
},
scope: this
}, '-', {
text: "导出Excel",
id: "btnExportExcel",
iconCls: 'btnexportexcel',
handler: function (button, event) {
this.onExportClick(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]
});
//#endregion
//#region 页面加载
this.storeList.on('beforeload', function (store) {
var sql = this.getCondition();
this.sqlcontext = sql;
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
//#endregion
}, //end initUIComponents
//#region 按钮函数
onRefreshClick: function (button, event) {
var sql = this.getCondition();
this.sqlcontext = sql;
this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql }, waitMsg: "正在刷新数据...", scope: this });
},
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = '';
//凭证号
var VOUALLNO = form.findField('VOUALLNO').getValue();
sql = sql + getAndConSql(sql, VOUALLNO, "VOUALLNO like '%" + VOUALLNO + "%'");
//凭证日期
var VOUDATEbgn = form.findField('VOUDATEbgn').getRawValue();
sql = sql + getAndConSql(sql, VOUDATEbgn, "VOUDATE >='" + VOUDATEbgn + "'");
var VOUDATEend = form.findField('VOUDATEend').getRawValue();
sql = sql + getAndConSql(sql, VOUDATEend, "VOUDATE <='" + VOUDATEend + "'");
return sql;
},
onClearSql: function () {
var form = this.formSearch.getForm();
form.reset();
}, //onDeleteClick
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 record = selections[0];
if (record.data.BSSTATUS == 'true') {
Ext.Msg.show({ title: '警告', msg: '业务已锁定,不允许删除!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
if (record.data.FEESTATUS == 'true') {
Ext.Msg.show({ title: '警告', msg: '费用已锁定,不允许删除!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
if (this.StoreOpRange.getCount() == 0) {
Ext.Msg.show({ title: '警告', msg: '权限不足,不允许删除!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
} else {
var op = record.data.OP;
var inputby = record.data.INPUTBY;
var records = DsStoreQueryBy(this.StoreOpRange, 'OPID', op);
if (records.getCount() > 0) {
} else {
var recordins = DsStoreQueryBy(this.StoreOpRange, 'OPID', inputby);
if (recordins.getCount() > 0) {
} else {
canedit = false;
Ext.Msg.show({ title: '警告', msg: '权限不足,不允许删除!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
}
}
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcShipping/MsOpSeai/Delete',
params: {
data: Ext.JSON.encode(record.data)
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeList.remove(record);
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
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);
},
//#region 导出Excel
onExportClick: function (button, event) {
var strGIDs = "";
// var SelectedRecords = this.gridList.selModel.getSelection();
// for (var i = 0; i < SelectedRecords.length; i++) {
// var rec = SelectedRecords[i];
// if (strGIDs == "") {
// strGIDs = rec.get('GID');
// }
// else {
// strGIDs = strGIDs + "," + rec.get('GID');
// }
// }
//
var sql = escape(this.getCondition());
var openSet = "height=1, width=400, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top=" + (screen.height - 200) / 2 + ",Left=" + (screen.width - 400) / 2;
var openType = "_blank";
var openUrl = "../../Reports/RptExport.aspx?handle=MsOpSeaiIndex&formname=" + this.formname + "&condition1=" + sql + "&gids=" + strGIDs;
window.open(openUrl, openType, openSet);
},
//#endregion
//#endregion
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeTreeList;
ret[2] = this.SelectedRecord;
return ret;
}
});
*/