|
|
|
|
Ext.namespace('Shipping');
|
|
|
|
|
|
|
|
|
|
Shipping.MsCrmClientVisitIndex = function (config) {
|
|
|
|
|
Ext.applyIf(this, config);
|
|
|
|
|
this.initUIComponents();
|
|
|
|
|
window.Shipping.MsCrmClientVisitIndex.superclass.constructor.call(this);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Ext.extend(Shipping.MsCrmClientVisitIndex, Ext.Panel, {
|
|
|
|
|
|
|
|
|
|
OprationStatus: null, //仅当弹出界面时使用
|
|
|
|
|
SelectedRecord: null,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
initUIComponents: function () {
|
|
|
|
|
|
|
|
|
|
this.customernameid = '';
|
|
|
|
|
//定义数据集
|
|
|
|
|
this.storeList = Ext.create('Ext.data.Store', {
|
|
|
|
|
model: 'MsCrmClientVisit',
|
|
|
|
|
remoteSort: true,
|
|
|
|
|
proxy: {
|
|
|
|
|
type: 'ajax',
|
|
|
|
|
url: '/MvcShipping/MsCrmClient/GetVisitDataList',
|
|
|
|
|
reader: {
|
|
|
|
|
id: 'GID',
|
|
|
|
|
root: 'data',
|
|
|
|
|
totalProperty: 'totalCount'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.initgirdcolums = [{
|
|
|
|
|
sortable: true,
|
|
|
|
|
dataIndex: 'GID',
|
|
|
|
|
header: 'GID',
|
|
|
|
|
hidden: true,
|
|
|
|
|
width: 120
|
|
|
|
|
}, {
|
|
|
|
|
sortable: true,
|
|
|
|
|
dataIndex: 'VISITTITLE',
|
|
|
|
|
header: '主题',
|
|
|
|
|
width: 220
|
|
|
|
|
}, {
|
|
|
|
|
sortable: true,
|
|
|
|
|
dataIndex: 'VISITDATE',
|
|
|
|
|
header: '时间',
|
|
|
|
|
width: 120
|
|
|
|
|
}, {
|
|
|
|
|
sortable: true,
|
|
|
|
|
dataIndex: 'SHORTNAME',
|
|
|
|
|
header: '客户名称',
|
|
|
|
|
width: 160
|
|
|
|
|
}, {
|
|
|
|
|
sortable: true,
|
|
|
|
|
dataIndex: 'SALE',
|
|
|
|
|
header: '销售人员',
|
|
|
|
|
width: 80
|
|
|
|
|
}, {
|
|
|
|
|
sortable: true,
|
|
|
|
|
dataIndex: 'CONTACTNAME',
|
|
|
|
|
header: '联系人',
|
|
|
|
|
width: 100
|
|
|
|
|
}, {
|
|
|
|
|
sortable: true,
|
|
|
|
|
dataIndex: 'VISITCONTENT',
|
|
|
|
|
header: '拜访内容',
|
|
|
|
|
width: 260
|
|
|
|
|
}, {
|
|
|
|
|
sortable: true,
|
|
|
|
|
dataIndex: 'VISITWAY',
|
|
|
|
|
header: '拜访方式',
|
|
|
|
|
width: 80
|
|
|
|
|
}, {
|
|
|
|
|
sortable: true,
|
|
|
|
|
dataIndex: 'NEXTDATE',
|
|
|
|
|
header: '下次拜访日期',
|
|
|
|
|
width: 120
|
|
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
this.girdcolums = this.initgirdcolums;
|
|
|
|
|
|
|
|
|
|
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
|
|
|
|
|
|
|
|
|
|
//定义Grid
|
|
|
|
|
this.gridList = new Ext.grid.GridPanel({
|
|
|
|
|
store: this.storeList,
|
|
|
|
|
enableHdMenu: false,
|
|
|
|
|
region: 'center',
|
|
|
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
|
|
|
trackMouseOver: true,
|
|
|
|
|
disableSelection: false,
|
|
|
|
|
selModel: this.GridCheckBoxModel,
|
|
|
|
|
viewConfig: {
|
|
|
|
|
enableTextSelection: true, //允许复制数据
|
|
|
|
|
autoFill: true
|
|
|
|
|
},
|
|
|
|
|
columns: this.girdcolums,
|
|
|
|
|
// paging bar on the bottom
|
|
|
|
|
bbar: Ext.create('Ext.PagingToolbar', {
|
|
|
|
|
store: this.storeList,
|
|
|
|
|
displayInfo: true,
|
|
|
|
|
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
|
|
|
|
|
emptyMsg: "没有数据"
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
|
|
|
|
|
this.SelectedRecord = record;
|
|
|
|
|
this.OprationStatus = 'edit';
|
|
|
|
|
var openSet = "height=400, width=850, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 450) / 2 + ",Left= " + (screen.width - 850) / 2
|
|
|
|
|
var openType = "_blank";
|
|
|
|
|
var openUrl = "/MvcShipping/MsCrmClient/VisitEdit";
|
|
|
|
|
window.open(openUrl, openType, openSet);
|
|
|
|
|
}, this);
|
|
|
|
|
|
|
|
|
|
//#region formSearch
|
|
|
|
|
|
|
|
|
|
//#region formSearch枚举参照相关
|
|
|
|
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
|
//客户加载_委托单位
|
|
|
|
|
this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
|
|
model: 'DsShipping.ux.CustomRefModel',
|
|
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListRm' }
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.storeCustCode.load({ params: { CODENAME: "", isall: "1" } });
|
|
|
|
|
//委托单位
|
|
|
|
|
_this = this;
|
|
|
|
|
this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
|
|
fieldLabel: '客户名称', //'委托单位',
|
|
|
|
|
store: this.storeCustCode,
|
|
|
|
|
queryMode: 'remote',
|
|
|
|
|
matchFieldWidth: false,
|
|
|
|
|
minChars: 1,
|
|
|
|
|
queryParam: 'CODENAME',
|
|
|
|
|
name: 'CLIENTGID',
|
|
|
|
|
valueField: 'GId',
|
|
|
|
|
displayField: 'CodeAndName',
|
|
|
|
|
enableKeyEvents: true,
|
|
|
|
|
listeners: {
|
|
|
|
|
specialkey: function (field, e) {
|
|
|
|
|
if (e.getKey() == e.ENTER) {
|
|
|
|
|
_this.onRefreshClick();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.StoreQueryCompare = Ext.create('Ext.data.Store', {
|
|
|
|
|
fields: ['BL']
|
|
|
|
|
});
|
|
|
|
|
this.StoreQueryCompare.add({ "BL": "全部" });
|
|
|
|
|
this.StoreQueryCompare.add({ "BL": "本日" });
|
|
|
|
|
this.StoreQueryCompare.add({ "BL": "明日" });
|
|
|
|
|
this.StoreQueryCompare.add({ "BL": "昨日" });
|
|
|
|
|
this.StoreQueryCompare.add({ "BL": "本周" });
|
|
|
|
|
this.StoreQueryCompare.add({ "BL": "上周" });
|
|
|
|
|
this.StoreQueryCompare.add({ "BL": "下周" });
|
|
|
|
|
this.StoreQueryCompare.add({ "BL": "本月" });
|
|
|
|
|
this.StoreQueryCompare.add({ "BL": "上月" });
|
|
|
|
|
this.StoreQueryCompare.add({ "BL": "下月" });
|
|
|
|
|
|
|
|
|
|
_this = this;
|
|
|
|
|
this.comboxCOMPARE = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
|
|
store: this.StoreQueryCompare,
|
|
|
|
|
fieldLabel: '拜访日期', //'揽货人',
|
|
|
|
|
forceSelection: true,
|
|
|
|
|
valueField: 'BL',
|
|
|
|
|
displayField: 'BL',
|
|
|
|
|
value:'本周',
|
|
|
|
|
name: 'COMPARE',
|
|
|
|
|
listeners: {
|
|
|
|
|
scope: this,
|
|
|
|
|
'select': function (combo, records, eOpts) {
|
|
|
|
|
if (records.length > 0) {
|
|
|
|
|
if (records[0].data.BL == '全部') {
|
|
|
|
|
this.formSearch.getForm().findField('ETDbgn').setValue('');
|
|
|
|
|
this.formSearch.getForm().findField('ETDend').setValue('');
|
|
|
|
|
} else if (records[0].data.BL == '本日') {
|
|
|
|
|
var myDate = new Date();
|
|
|
|
|
var mydatestr = Ext.util.Format.date(myDate, 'Y-m-d');
|
|
|
|
|
this.formSearch.getForm().findField('ETDbgn').setValue(mydatestr);
|
|
|
|
|
this.formSearch.getForm().findField('ETDend').setValue(mydatestr);
|
|
|
|
|
} else if (records[0].data.BL == '明日') {
|
|
|
|
|
var myDate = new Date();
|
|
|
|
|
myDate.setTime(myDate.getTime() + 24 * 60 * 60 * 1000);
|
|
|
|
|
var mydatestr = myDate.getFullYear() + "-" + (myDate.getMonth() + 1) + "-" + myDate.getDate();
|
|
|
|
|
this.formSearch.getForm().findField('ETDbgn').setValue(mydatestr);
|
|
|
|
|
this.formSearch.getForm().findField('ETDend').setValue(mydatestr);
|
|
|
|
|
} else if (records[0].data.BL == '昨日') {
|
|
|
|
|
var myDate = new Date();
|
|
|
|
|
myDate.setTime(myDate.getTime() -24 * 60 * 60 * 1000);
|
|
|
|
|
var mydatestr = myDate.getFullYear() + "-" + (myDate.getMonth() + 1) + "-" + myDate.getDate();
|
|
|
|
|
this.formSearch.getForm().findField('ETDbgn').setValue(mydatestr);
|
|
|
|
|
this.formSearch.getForm().findField('ETDend').setValue(mydatestr);
|
|
|
|
|
} else if (records[0].data.BL == '本周') {
|
|
|
|
|
var now = new Date(); //当前日期
|
|
|
|
|
var nowDayOfWeek = now.getDay(); //今天本周的第几天
|
|
|
|
|
var nowDay = now.getDate(); //当前日
|
|
|
|
|
var nowMonth = now.getMonth(); //当前月
|
|
|
|
|
var nowYear = now.getFullYear(); //当前年
|
|
|
|
|
var mydatestr = new Date(nowYear, nowMonth, nowDay - nowDayOfWeek + 1);
|
|
|
|
|
var mydateendstr = new Date(nowYear, nowMonth, nowDay - nowDayOfWeek + 7);
|
|
|
|
|
this.formSearch.getForm().findField('ETDbgn').setValue(mydatestr);
|
|
|
|
|
this.formSearch.getForm().findField('ETDend').setValue(mydateendstr);
|
|
|
|
|
} else if (records[0].data.BL == '下周') {
|
|
|
|
|
var now = new Date(); //当前日期
|
|
|
|
|
now.setTime(now.getTime() +7*24 * 60 * 60 * 1000);
|
|
|
|
|
var nowDayOfWeek = now.getDay(); //今天本周的第几天
|
|
|
|
|
var nowDay = now.getDate(); //当前日
|
|
|
|
|
var nowMonth = now.getMonth(); //当前月
|
|
|
|
|
var nowYear = now.getFullYear(); //当前年
|
|
|
|
|
var mydatestr = new Date(nowYear, nowMonth, nowDay - nowDayOfWeek + 1);
|
|
|
|
|
var mydateendstr = new Date(nowYear, nowMonth, nowDay - nowDayOfWeek + 7);
|
|
|
|
|
this.formSearch.getForm().findField('ETDbgn').setValue(mydatestr);
|
|
|
|
|
this.formSearch.getForm().findField('ETDend').setValue(mydateendstr);
|
|
|
|
|
} else if (records[0].data.BL == '上周') {
|
|
|
|
|
var now = new Date(); //当前日期
|
|
|
|
|
now.setTime(now.getTime() - 7 * 24 * 60 * 60 * 1000);
|
|
|
|
|
var nowDayOfWeek = now.getDay(); //今天本周的第几天
|
|
|
|
|
var nowDay = now.getDate(); //当前日
|
|
|
|
|
var nowMonth = now.getMonth(); //当前月
|
|
|
|
|
var nowYear = now.getFullYear(); //当前年
|
|
|
|
|
var mydatestr = new Date(nowYear, nowMonth, nowDay - nowDayOfWeek + 1);
|
|
|
|
|
var mydateendstr = new Date(nowYear, nowMonth, nowDay - nowDayOfWeek + 7);
|
|
|
|
|
this.formSearch.getForm().findField('ETDbgn').setValue(mydatestr);
|
|
|
|
|
this.formSearch.getForm().findField('ETDend').setValue(mydateendstr);
|
|
|
|
|
} else if (records[0].data.BL == '本月') {
|
|
|
|
|
var now = new Date(); //当前日期
|
|
|
|
|
var nowMonth = now.getMonth(); //当前月
|
|
|
|
|
var nowYear = now.getFullYear(); //当前年
|
|
|
|
|
var mydatestr = new Date(nowYear, nowMonth,1);
|
|
|
|
|
var mydateendstr = new Date(nowYear, nowMonth, getMonthDays(nowMonth));
|
|
|
|
|
this.formSearch.getForm().findField('ETDbgn').setValue(mydatestr);
|
|
|
|
|
this.formSearch.getForm().findField('ETDend').setValue(mydateendstr);
|
|
|
|
|
} else if (records[0].data.BL == '下月') {
|
|
|
|
|
var lastMonthDate = new Date(); //上月日期
|
|
|
|
|
lastMonthDate.setDate(1);
|
|
|
|
|
lastMonthDate.setMonth(lastMonthDate.getMonth() +1);
|
|
|
|
|
var lastYear = lastMonthDate.getFullYear();
|
|
|
|
|
var lastMonth = lastMonthDate.getMonth();
|
|
|
|
|
var mydatestr = new Date(lastYear, lastMonth, 1);
|
|
|
|
|
var mydateendstr = new Date(lastYear, lastMonth, getMonthDays(lastMonth));
|
|
|
|
|
this.formSearch.getForm().findField('ETDbgn').setValue(mydatestr);
|
|
|
|
|
this.formSearch.getForm().findField('ETDend').setValue(mydateendstr);
|
|
|
|
|
} else if (records[0].data.BL == '上月') {
|
|
|
|
|
var lastMonthDate = new Date(); //上月日期
|
|
|
|
|
lastMonthDate.setDate(1);
|
|
|
|
|
lastMonthDate.setMonth(lastMonthDate.getMonth() - 1);
|
|
|
|
|
var lastYear = lastMonthDate.getFullYear();
|
|
|
|
|
var lastMonth = lastMonthDate.getMonth();
|
|
|
|
|
var mydatestr = new Date(lastYear, lastMonth, 1);
|
|
|
|
|
var mydateendstr = new Date(lastYear, lastMonth, getMonthDays(lastMonth));
|
|
|
|
|
this.formSearch.getForm().findField('ETDbgn').setValue(mydatestr);
|
|
|
|
|
this.formSearch.getForm().findField('ETDend').setValue(mydateendstr);
|
|
|
|
|
}
|
|
|
|
|
_this.onRefreshClick();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.storeSaleCode = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
|
|
model: 'DsShipping.ux.UserRefModel',
|
|
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefListRm' }
|
|
|
|
|
});
|
|
|
|
|
this.storeSaleCode.load();
|
|
|
|
|
this.comboxSALE = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
|
|
fieldLabel: '销售', //'揽货人',
|
|
|
|
|
store: this.storeSaleCode,
|
|
|
|
|
forceSelection: true,
|
|
|
|
|
queryMode: 'remote',
|
|
|
|
|
minChars: 0,
|
|
|
|
|
queryParam: 'CODENAME',
|
|
|
|
|
name: 'SALE',
|
|
|
|
|
valueField: 'UserName',
|
|
|
|
|
displayField: 'CodeAndName',
|
|
|
|
|
enableKeyEvents: true,
|
|
|
|
|
listeners: {
|
|
|
|
|
specialkey: 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: 70,
|
|
|
|
|
msgTarget: 'qtip'
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
items: [
|
|
|
|
|
{//fieldset 1
|
|
|
|
|
xtype: 'container',
|
|
|
|
|
defaultType: 'textfield',
|
|
|
|
|
layout: 'anchor',
|
|
|
|
|
defaults: {
|
|
|
|
|
anchor: '100%'
|
|
|
|
|
},
|
|
|
|
|
items: [{
|
|
|
|
|
xtype: 'container',
|
|
|
|
|
layout: 'hbox',
|
|
|
|
|
defaultType: 'textfield',
|
|
|
|
|
items: [{
|
|
|
|
|
fieldLabel: '模糊查询',
|
|
|
|
|
labelWidth: 60,
|
|
|
|
|
name: 'NAME',
|
|
|
|
|
listeners: {
|
|
|
|
|
specialkey: function (field, e) {
|
|
|
|
|
if (e.getKey() == e.ENTER) {
|
|
|
|
|
_this.onRefreshClick();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}, this.comboxCustCode, this.comboxSALE,this.comboxCOMPARE, {
|
|
|
|
|
flex: 0.8,
|
|
|
|
|
format: 'Y-m-d',
|
|
|
|
|
xtype: 'datefield',
|
|
|
|
|
name: 'ETDbgn',
|
|
|
|
|
enableKeyEvents: true,
|
|
|
|
|
listeners: {
|
|
|
|
|
specialkey: function (field, e) {
|
|
|
|
|
if (e.getKey() == e.ENTER) {
|
|
|
|
|
_this.onRefreshClick();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}, {
|
|
|
|
|
fieldLabel: '至', //'到',
|
|
|
|
|
labelWidth: 20,
|
|
|
|
|
flex: 0.7,
|
|
|
|
|
format: 'Y-m-d',
|
|
|
|
|
xtype: 'datefield',
|
|
|
|
|
name: 'ETDend',
|
|
|
|
|
enableKeyEvents: true,
|
|
|
|
|
listeners: {
|
|
|
|
|
specialkey: function (field, e) {
|
|
|
|
|
if (e.getKey() == e.ENTER) {
|
|
|
|
|
_this.onRefreshClick();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
]//end items(fieldset 1)
|
|
|
|
|
}//end fieldset 1
|
|
|
|
|
]//end root items
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//#endregion formSearch
|
|
|
|
|
|
|
|
|
|
//查询工具条
|
|
|
|
|
this.panelBtn = new Ext.Panel({
|
|
|
|
|
region: "north",
|
|
|
|
|
tbar: [
|
|
|
|
|
{
|
|
|
|
|
text: "新建",
|
|
|
|
|
iconCls: "btnadd",
|
|
|
|
|
handler: function (button, event) {
|
|
|
|
|
this.OprationStatus = 'add';
|
|
|
|
|
var openSet = "height=400, width=850, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 450) / 2 + ",Left= " + (screen.width - 850) / 2
|
|
|
|
|
var openType = "_blank";
|
|
|
|
|
var openUrl = "/MvcShipping/MsCrmClient/VisitEdit";
|
|
|
|
|
window.open(openUrl, openType, openSet);
|
|
|
|
|
},
|
|
|
|
|
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) {
|
|
|
|
|
var form = this.formSearch.getForm();
|
|
|
|
|
form.reset();
|
|
|
|
|
},
|
|
|
|
|
scope: this
|
|
|
|
|
}, '-', {
|
|
|
|
|
text: "保存列表样式",
|
|
|
|
|
menu: [
|
|
|
|
|
{
|
|
|
|
|
text: "保存",
|
|
|
|
|
handler: function (button, event) {
|
|
|
|
|
this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridList.columns, _this.girdcolums, 1, true);
|
|
|
|
|
}
|
|
|
|
|
}, {
|
|
|
|
|
text: "初始化",
|
|
|
|
|
handler: function (menu, event) {
|
|
|
|
|
_this.InitGrid(_this.initgirdcolums);
|
|
|
|
|
_this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridList.columns, _this.initgirdcolums, 1, true);
|
|
|
|
|
}
|
|
|
|
|
}],
|
|
|
|
|
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.getCondition();
|
|
|
|
|
Ext.apply(store.proxy.extraParams, { condition: sql });
|
|
|
|
|
}, this);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var now = new Date(); //当前日期
|
|
|
|
|
var nowDayOfWeek = now.getDay(); //今天本周的第几天
|
|
|
|
|
var nowDay = now.getDate(); //当前日
|
|
|
|
|
var nowMonth = now.getMonth(); //当前月
|
|
|
|
|
var nowYear = now.getFullYear(); //当前年
|
|
|
|
|
var mydatestr = new Date(nowYear, nowMonth, nowDay - nowDayOfWeek + 1);
|
|
|
|
|
var mydateendstr = new Date(nowYear, nowMonth, nowDay - nowDayOfWeek + 7);
|
|
|
|
|
this.formSearch.getForm().findField('ETDbgn').setValue(mydatestr);
|
|
|
|
|
this.formSearch.getForm().findField('ETDend').setValue(mydateendstr);
|
|
|
|
|
|
|
|
|
|
this.onRefreshClick();
|
|
|
|
|
|
|
|
|
|
}, //end initUIComponents
|
|
|
|
|
|
|
|
|
|
LoadData: function (cust) {
|
|
|
|
|
this.customernameid = cust;
|
|
|
|
|
this.onRefreshClick();
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onRefreshClick: function (button, event) {
|
|
|
|
|
var sql = this.getCondition();
|
|
|
|
|
this.storeList.load({
|
|
|
|
|
params: { start: 0, limit: 500, sort: '', condition: sql },
|
|
|
|
|
waitMsg: "正在查询数据...",
|
|
|
|
|
scope: this
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
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];
|
|
|
|
|
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
|
|
|
|
|
if (btn == 'yes') {
|
|
|
|
|
Ext.Msg.wait('正在删除数据...');
|
|
|
|
|
Ext.Ajax.request({
|
|
|
|
|
waitMsg: '正在删除数据...',
|
|
|
|
|
url: '/MvcShipping/MsCrmClient/DeleteVisit',
|
|
|
|
|
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);
|
|
|
|
|
}, //onDeleteClick
|
|
|
|
|
getCondition: function () {
|
|
|
|
|
var form = this.formSearch.getForm();
|
|
|
|
|
if (!form.isValid()) {
|
|
|
|
|
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
|
|
|
|
|
return '';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var sql = " ISNULL(VISITTITLE,'')<>'' ";
|
|
|
|
|
|
|
|
|
|
sql = sql + getAndConSql(sql, this.customernameid, " CLIENTGID='" + this.customernameid + "' ");
|
|
|
|
|
|
|
|
|
|
var SERVICENAME = form.findField('NAME').getValue();
|
|
|
|
|
sql = sql + getAndConSql(sql, SERVICENAME, " (SHORTNAME like '%" + SERVICENAME + "%' OR SALE='" + SERVICENAME + "' OR VISITTITLE like '%" + SERVICENAME + "%' OR VISITCONTENT like '%" + SERVICENAME + "%' ) ");
|
|
|
|
|
|
|
|
|
|
var CLIENTGID = form.findField('CLIENTGID').getValue();
|
|
|
|
|
sql = sql + getAndConSql(sql, CLIENTGID, " CLIENTGID='" + CLIENTGID + "' ");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var SALE = form.findField('SALE').getValue();
|
|
|
|
|
sql = sql + getAndConSql(sql, SALE, " SALE='" + SALE + "' ");
|
|
|
|
|
|
|
|
|
|
var ETDbgn = form.findField('ETDbgn').getRawValue();
|
|
|
|
|
sql = sql + getAndConSql(sql, ETDbgn, "VISITDATE >='" + ETDbgn + "'");
|
|
|
|
|
var ETDend = form.findField('ETDend').getRawValue();
|
|
|
|
|
sql = sql + getAndConSql(sql, ETDend, "VISITDATE <='" + ETDend + "'");
|
|
|
|
|
|
|
|
|
|
return sql;
|
|
|
|
|
},
|
|
|
|
|
OprationSwap: function () {
|
|
|
|
|
var ret = new Array();
|
|
|
|
|
ret[0] = this.OprationStatus;
|
|
|
|
|
ret[1] = this.storeList;
|
|
|
|
|
ret[2] = this.SelectedRecord;
|
|
|
|
|
ret[3] = this.customernameid;
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|