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/MsInfoClient/MsInfoClientContractDsIndex.js

451 lines
16 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.MsInfoClientContractDsIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsInfoClientContractDsIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsInfoClientContractDsIndex, Ext.Panel, {
PageSize: 20,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
EditRecord: null,
GID: '',
//需求编号SR2017061200005-1
initUIComponents: function () {
this.formname = "formInfoClientContractDsIndex"; //页面名称
this.sqlcontext = '';
//定义数据集
this.storectndisp = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CtnDispModel',
proxy: { url: '/CommMng/BasicDataRef/GetCtnDisp' }
});
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsInfoClientContractModel',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsInfoClient/GetContractDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#region List列表显示信息
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 30
});
this.girdcolums = [{
sortable: true,
dataIndex: 'GID',
header: Zi.LAN.GID, //'GID',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'LINKID',
hidden: true,
header: Zi.LAN.LINKID, //'LINKID',
width: 0
},
{
sortable: true,
dataIndex: 'CUSTNAME',
header: '客户名称', //'合同号',
width: 140
},
{
sortable: true,
dataIndex: 'CONTRACTNO',
header: Zi.LAN.CONTRACTNO, //'合同号',
width: 140
},
{
sortable: true,
dataIndex: 'CONTRACTNAME',
header: Zi.LAN.CONTRACTNAME, //'合同号',
width: 140
},
{
sortable: true,
dataIndex: 'SIGNINGDATE',
header: Zi.LAN.SIGNINGDATE, //'签订日期',
width: 140
}, {
sortable: true,
dataIndex: 'STARTDATE',
header: Zi.LAN.STARTDATE, //'合同生效日期',
width: 120
},
{
sortable: true,
dataIndex: 'CANCELDATE',
header: Zi.LAN.CANCELDATE, //'合同结束日期',
width: 120
},
{
sortable: true,
dataIndex: 'CHIEF',
header: Zi.LAN.CHIEF2, //'签订人',
width: 120
},
{
sortable: true,
dataIndex: 'CREATEUSERREF',
header: Zi.LAN.CREATEUSERREF, //'录入人',
width: 120
},
{
sortable: true,
dataIndex: 'CREATETIME',
header: Zi.LAN.CREATETIME, //'录入日期',
width: 120
}];
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
//定义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,
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayMsg: Zi.LAN.displayMsg, //'当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: Zi.LAN.emptyMsg, //"没有数据"
displayInfo: true
})
});
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';
window.open('/MvcShipping/MsInfoClient/ContractDsEdit', Zi.LAN.ContactEdit, 'width=' + (window.screen.availWidth - 110) + ',height=' + (window.screen.availHeight - 55) + ',top=0,left=0,resizable=yes,status=yes,menubar=no,scrollbars=yes');
}, this);
//#region formSearch 查询面板
_this = this;
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: Zi.LAN.MblNo, //'代码或简称',
labelWidth: 80, name: 'MblNo',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel:'合同号', //'代码或简称',
labelWidth: 80, name: 'CONTRACTNO',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel:'签订日期', //'录入日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'CETDbgn',
flex: 0.9,
labelWidth: 70,
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel:'到', //'到',
format: 'Y-m-d',
xtype: 'datefield',
name: 'CETDend',
labelWidth: 20,
flex: 0.6,
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}
, {
fieldLabel: Zi.LAN.ETDbgn, //'录入日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ETDbgn',
flex: 0.9,
labelWidth: 70,
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: Zi.LAN.ETDend, //'到',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ETDend',
labelWidth: 20,
flex: 0.6,
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}
, {
xtype: 'button',
width: 90,
text: Zi.LAN.btnRefresh, //"执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
}, {
xtype: 'button',
width: 45,
// text: Zi.LAN.btnMore, //"高级查询",
iconCls: "btnmore",
handler: function (button, event) {
var sql = this.getCondition();
var winAccess = new Shipping.DsQuery({
});
winAccess.StoreList = this.storeList;
winAccess.formname = this.formname;
winAccess.condition = sql;
winAccess.show();
return;
},
scope: this
}]
}
]//end items(fieldset 1)
}]//end root items
});
//#endregion formSearch
//按钮工具条
me = this;
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [{
text: Zi.LAN.btnAdd, //"新建",
iconCls: "btnadd",
handler: function (button, event) {
this.OprationStatus = 'add';
window.open('/MvcShipping/MsInfoClient/ContractDsEdit', Zi.LAN.ContactEdit, 'width=' + (window.screen.availWidth - 110) + ',height=' + (window.screen.availHeight - 55) + ',top=0,left=0,resizable=yes,status=yes,menubar=no,scrollbars=yes');
},
scope: this
}, {
text: Zi.LAN.btnDelete, //"删除",
iconCls: "btndelete",
handler: function (button, event) {
this.onDeleteClick(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.getCondition();
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.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: Zi.LAN.ZhengZaiChaXunShuJu,
scope: this
});
},
onDsQuery: function (button, event) {
//var girdcolums = this.gridList.getColumnMode();
var sql = this.sqlcontext;
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: Zi.LAN.ZhengZaiChaXunShuJu,
scope: this
});
},
onDeleteClick: function (button, event) {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.QingXianXuanZeXinXi, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var record = selections[0];
Ext.MessageBox.confirm(Zi.LAN.TiShi, Zi.LAN.QueDingShanChuGaiJiLuMa, function (btn) {
if (btn == 'yes') {
Ext.Msg.wait(Zi.LAN.ZhengZaiCaoZuoShuJu);
Ext.Ajax.request({
waitMsg: Zi.LAN.ZhengZaiCaoZuoShuJu, //'正在删除数据...',
url: '/MvcShipping/MsInfoClient/DeleteContract',
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: Zi.LAN.TiShi, msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: Zi.LAN.CuoWu, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: Zi.LAN.JingGao, msg: Zi.LAN.FuWuQiXiangYingChuCuo, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) { },
scope: this
}); //end Ext.Ajax.request
}
}, this);
},
onClearSql: function () {
var form = this.formSearch.getForm();
form.reset();
}, //onDeleteClick
getCondition: function () {
var form = this.formSearch.getForm();
// var form2 = this.formSearch2.getForm();
if (!form.isValid()) {
Ext.Msg.alert(Zi.LAN.TiShi, Zi.LAN.ChaXunTiaoJianFuZhiCuoWu); //'查询条件赋值错误,请检查。'
return '';
}
//
var sql = '';
//#region formSearch 查询面板
var MblNo = form.findField('MblNo').getValue();
sql = sql + getAndConSql(sql, MblNo, " LINKID IN (SELECT GID FROM INFO_CLIENT WHERE (CODENAME like '%" + MblNo + "%' or SHORTNAME like '%" + MblNo + "%')) ");
var CONTRACTNO = form.findField('CONTRACTNO').getValue();
sql = sql + getAndConSql(sql, CONTRACTNO, " CONTRACTNO like '%" + CONTRACTNO + "%'");
var ETDbgn = form.findField('ETDbgn').getRawValue();
sql = sql + getAndConSql(sql, ETDbgn, "CREATETIME >='" + ETDbgn + "'");
var ETDend = form.findField('ETDend').getRawValue();
sql = sql + getAndConSql(sql, ETDend, "CREATETIME <='" + ETDend + " 23:59:59'");
var CETDbgn = form.findField('CETDbgn').getRawValue();
sql = sql + getAndConSql(sql, CETDbgn, "SIGNINGDATE >='" + CETDbgn + "'");
var CETDend = form.findField('CETDend').getRawValue();
sql = sql + getAndConSql(sql, CETDend, "SIGNINGDATE <='" + CETDend + "'");
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;
}
});