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.

1031 lines
37 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.MsCrmQuotationIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsCrmQuotationIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsCrmQuotationIndex, Ext.Panel, {
PageSize: 30,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
sqlcontext: '',
sortfield: '',
sortdire: '',
initUIComponents: function () {
this.formname = "formMsCrmQuotationIndex"; //页面名称
//#region 定义数据集
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsCrmQuotationEntity',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsCrmQuotation/GetDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#endregion
//#region 列定义
this.initgirdcolums = [{
sortable: false,
dataIndex: 'GID',
header: '惟一值',
align: 'center',
hidden: true,
width: 0
},
{
sortable: false,
dataIndex: 'QUOTATIONCODE',
header: '报价编号',
align: 'center',
width: 100
},
{
sortable: false,
dataIndex: 'SHORTNAME',
header: '客户名称',
align: 'center',
width: 100
},
{
sortable: false,
dataIndex: 'TEL',
header: '联系方式',
align: 'center',
width: 100
},
{
sortable: false,
dataIndex: 'EMAIL',
header: '邮箱',
align: 'center',
width: 100
},
{
sortable: false,
dataIndex: 'SALE',
header: '报价人',
align: 'center',
width: 80
},
{
sortable: false,
dataIndex: 'CREATEUSER',
header: '录入人',
align: 'center',
width: 80
},
{
sortable: false,
dataIndex: 'CREATETIME',
header: '录入时间',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
align: 'center',
width: 80
},
{
sortable: false,
dataIndex: 'PORTLOAD',
header: '起运港',
align: 'center',
width: 100
},
{
sortable: false,
dataIndex: 'PORTDISCHARGE',
header: '目的港',
align: 'center',
width: 150
},
{
sortable: false,
dataIndex: 'CARRIER',
header: '船公司',
align: 'center',
width: 100
},
{
sortable: false,
dataIndex: 'CTNCODE',
header: '箱型',
align: 'center',
width: 80
},
{
sortable: false,
dataIndex: 'CTNNUM',
header: '箱量',
align: 'center',
width: 80
},
{
sortable: false,
dataIndex: 'GOODSTYPE',
header: '产品类别',
align: 'center',
width: 100
},
{
sortable: false,
dataIndex: 'GOODSNAME',
header: '品名',
align: 'center',
width: 100
},
{
sortable: false,
dataIndex: 'UNNO',
header: 'UN', //需求编号SR2017080400003
align: 'center',
width: 80
},
{
sortable: false,
dataIndex: 'DCLASS',
header: '危险品等级', //需求编号SR2017080400003
align: 'center',
width: 80
},
{
sortable: false,
dataIndex: 'QUOTATIONDATE',
header: '报价时间',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
align: 'center',
width: 80
},
{
sortable: false,
dataIndex: 'VALIDDATE',
header: '有效期',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
align: 'center',
width: 80
},
{
sortable: false,
dataIndex: 'SERVICE',
header: '运输条款',
align: 'center',
width: 80
},
{
sortable: false,
dataIndex: 'CTNSTATUS',
header: '箱状态',
align: 'center',
width: 80
},
{
sortable: false,
dataIndex: 'FORWARDER',
header: '使用代理',
align: 'center',
width: 100
},
{
sortable: false,
dataIndex: 'COMMISSIONRATE',
header: '佣金比率',
align: 'center',
width: 80
},
{
sortable: false,
dataIndex: 'FBPPORTLOAD',
header: '起运港免箱天数',
align: 'center',
width: 100
},
{
sortable: false,
dataIndex: 'CQPORTLOAD',
header: '起运港超期标准',
align: 'center',
width: 100
},
{
sortable: false,
dataIndex: 'FBPPORTDISCHARGE',
header: '目的港免箱天数',
align: 'center',
width: 100
},
{
sortable: false,
dataIndex: 'CQPORTDISCHARGE',
header: '目的港超期标准',
align: 'center',
width: 100
},
{
sortable: false,
dataIndex: 'RMBHJ',
header: 'RMB合计', //需求编号SR2017071700006-2、3、4
align: 'right',
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00'),
width: 80
},
{
sortable: false,
dataIndex: 'USDHJ',
header: 'USD合计', //需求编号SR2017071700006-2、3、4
align: 'right',
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00'),
width: 80
},
{
sortable: false,
dataIndex: 'REMARK',
header: '备注',
align: 'center',
width: 200
}];
this.girdcolums = this.initgirdcolums;
//#endregion
//#region gridList列表显示信息
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 30
});
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
_this = this;
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.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.GridCheckBoxModel,
columns: this.girdcolums,
viewConfig: {
enableTextSelection: true, //允许复制数据
autoFill: true
},
features: [{
ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性
}],
// paging bar on the bottom
bbar: [Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
}), this.Pagenum]
});
/////////////以下部分为获取存储的gridpanel显示样式
this.girdcolums = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums, 2); //使用者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/MsCrmQuotation/Edit');
}, this);
this.gridList.addListener('sortchange', function (ct, column, direction, eOpts) {
this.sortfield = column.dataIndex;
this.sortdire = direction;
}, this);
//#endregion
//#region formSearch 下拉框信息加载
//权限范围
this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsOP',
proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang' }
});
this.StoreOpRange.load({ params: { optype: "MsCrmQuotation"} });
//人员信息加载
this.storeOpCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storeOpCode.load();
//报价人
this.comboxSALE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '报价人',
store: this.storeOpCode,
forceSelection: true,
name: 'SALE',
valueField: 'UserName',
displayField: 'CodeAndName',
value: SHOWNAME,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//录入人
this.comboxCREATEUSER = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '录入人',
store: this.storeOpCode,
forceSelection: true,
name: 'CREATEUSER',
valueField: 'UserName',
displayField: 'CodeAndName',
value: SHOWNAME,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//品名code_msds//需求编号SR2017072600008-1
this.storeCodeGoodsList = Ext.create('DsExt.ux.RefTableStore', {
model: 'CodeMsdsModel',
proxy: { url: '/MvcShipping/MsCrmQuotation/GetCodeMsdsList' }
});
this.storeCodeGoodsList.load();
this.comboxGOODSNAME = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '品名',
store: this.storeCodeGoodsList,
matchFieldWidth: false, //下拉款自适应宽度
name: 'GOODSNAME',
valueField: 'CHEMICALCGOODSNAME', //GOODNAME
displayField: 'CodeAndName',
listeners: {
'render': function (_field, eOpts) {//自定义函数,定义双击事件
_field.getEl().on('dblclick', function (e, t, eOpts) {
var sValue = t.value.toString();
var sLen = sValue.indexOf("|");
if (sLen > -1) {
sValue = sValue.substring(0, (sLen - 1));
}
else {
sValue = "";
}
//
var openSet = "height=700, width=1224, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 750) / 2 + ",Left= " + (screen.width - 1100) / 2
var openType = "_blank";
var openUrl = "";
openUrl = "../../MvcContainer/MsCodeMSDS/MsdsView?handle=check&goodsname=" + sValue;
window.open(openUrl, openType, openSet);
});
}
}
});
//客户名称
this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeCustCode.load({ params: { condition: "ISCONTROLLER='1'"} });
this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '客户名称',
store: this.storeCustCode,
matchFieldWidth: false, //下拉款自适应宽度
forceSelection: true,
name: 'SHORTNAME',
valueField: 'CustName',
displayField: 'CodeAndName',
listeners: {
scope: this,
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//船公司
this.storeCARRIER = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeCARRIER.load({ params: { condition: "ISCARRIER='1'"} });
this.comboxCARRIER = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '船公司',
store: this.storeCARRIER,
matchFieldWidth: false, //下拉款自适应宽度
forceSelection: true,
name: 'CARRIER',
valueField: 'CustName',
displayField: 'CodeAndName',
listeners: {
scope: this,
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//订舱代理
this.storeFORWARDER = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeFORWARDER.load({ params: { condition: "ISAGENT='1'"} });
this.comboxFORWARDER = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '使用代理',
store: this.storeFORWARDER,
matchFieldWidth: false, //下拉款自适应宽度
forceSelection: true,
name: 'FORWARDER',
valueField: 'CustName',
displayField: 'CodeAndName',
listeners: {
scope: this,
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//枚举维护表tSysEnumValue_货物类别97028//需求编号SR2017072600008-3
this.storeTSysEnumValueCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.TSysEnumValueDataModel',
proxy: { url: '/CommMng/BasicDataRef/GetTSysEnumValueList' }
});
this.storeTSysEnumValueCode.load({ params: { condition: " and EnumTypeID=97028"} }); //货物类别
this.comboxGOODSTYPE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '产品类别',
store: this.storeTSysEnumValueCode,
forceSelection: true,
name: 'GOODSTYPE',
valueField: 'EnumValueName',
displayField: 'EnumValueName',
listeners: {
scope: this,
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//国内港口(起运港)//需求编号SR2017072600008-4
this.storeCodeLoadport = Ext.create('DsExt.ux.RefTableStore', {
//model: 'DsShipping.ux.CodeLoadportModel',
//proxy: { url: '/CommMng/BasicDataRef/GetCodeLoadportList' }
//需求编号SR2017071700006-5
model: 'DsShipping.ux.CodeDisportModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportList' }
});
this.storeCodeLoadport.load();
this.comboxPORTLOAD = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '起运港',
store: this.storeCodeLoadport,
matchFieldWidth: false, //下拉款自适应宽度
name: 'PORTLOAD',
valueField: 'PORT',
displayField: 'PORT', //'CodeAndName',
forceSelection: true,
listeners: {
scope: this,
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//国际港口(目的港)
this.storeCodeDisport = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeDisportModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportList' }
});
this.storeCodeDisport.load();
this.comboxPORTDISCHARGE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '目的港',
store: this.storeCodeDisport,
name: 'PORTDISCHARGE',
matchFieldWidth: false, //下拉款自适应宽度
valueField: 'PORT',
displayField: 'PORT', //'CodeAndName',
forceSelection: true,
listeners: {
scope: this,
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//集装箱
this.storeCodeCtn = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeCtnModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeCtnList' }
});
this.storeCodeCtn.load();
this.comboxCTNALL = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '箱型',
store: this.storeCodeCtn,
name: 'CTNCODE',
valueField: 'CTN',
displayField: 'CTN',
listeners: {
scope: this,
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//箱状态(同代理报价中的箱状态)
this.StoreCTNSTATUS = Ext.create('DsExt.ux.RefEnumStore', {});
this.StoreCTNSTATUS.load({ params: { enumTypeId: 97029} });
this.comboxCTNSTATUS = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreCTNSTATUS,
fieldLabel: '箱状态',
forceSelection: true,
name: 'CTNSTATUS',
valueField: 'EnumValueName',
displayField: 'EnumValueName',
listeners: {
scope: this,
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//运输条款
this.storeSERVICE = Ext.create('DsExt.ux.RefTableStore', {
model: 'CODE_SERVICE',
proxy: { url: '/CommMng/BasicDataRef/GetCodeServiceList' }
});
this.storeSERVICE.load({ params: { condition: ""} });
this.comboxSERVICE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '运输条款',
store: this.storeSERVICE,
forceSelection: true,
name: 'SERVICE',
valueField: 'SERVICE',
displayField: 'SERVICE'
});
//#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: 90,
msgTarget: 'qtip'
},
items: [{
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '报价编号',
name: 'QUOTATIONCODE',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, this.comboxCustCode, this.comboxSALE, this.comboxCARRIER, this.comboxCTNALL]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxPORTLOAD, this.comboxPORTDISCHARGE, this.comboxGOODSNAME, this.comboxGOODSTYPE, this.comboxCTNSTATUS]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxFORWARDER, this.comboxSERVICE, {
fieldLabel: '从有效期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'VALIDDATEBgn',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到',
format: 'Y-m-d',
xtype: 'datefield',
name: 'VALIDDATEEnd',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
xtype: 'container',
layout: 'hbox',
flex: 1,
defaultType: 'textfield',
items: [{
text: "重置",
flex: 1, xtype: 'button',
iconCls: "btnreset",
handler: function (button, event) {
this.onClearSql(button, event);
},
scope: this
}, {
xtype: 'button',
flex: 1,
text: "查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
}, {
xtype: 'button',
flex: 1,
text: "更多",
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
}//, { xtype: 'hiddenfield' }
]
}]
}]
}]
});
//#endregion formSearch
_this = this;
//#region 按钮工具条/页面布局
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [{
text: "新建",
iconCls: "btnadd",
handler: function (button, event) {
_this.OprationStatus = 'add';
DsOpenEditWin('/MvcShipping/MsCrmQuotation/Edit');
},
scope: this
}, {
text: "删除",
iconCls: "btndelete",
handler: function (button, event) {
_this.onDeleteClick(button, event);
},
scope: this
}, '-', {
text: "保存列表样式",
id: "btntest",
menu: [{ text: "保存",
handler: function (button, event) {
_this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridList.columns, _this.girdcolums, 2, true);
}
}, { text: "初始化",
handler: function (menu, event) {
_this.gridList.reconfigure(_this.storeList, _this.initgirdcolums);
_this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridList.columns, _this.initgirdcolums, 2, true);
}
}],
scope: this
}, '-', {
text: "打印",
iconCls: "btnprint",
handler: function (button, event) {
_this.Print(button, event);
},
scope: this
}, '-', {
text: "导出EXCEL",
handler: function (button, event) {
GridExportExcelPage(this.gridList);
},
scope: this
}]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 126,
items: [this.formSearch, this.panelBtn]
});
Ext.apply(this, {
items: [this.panelTop, this.gridList]
});
//#endregion
//#region 页面加载
this.onRefreshClick();
_this = this;
this.storeList.on('beforeload', function (store) {
//var sql = this.getCondition();
Ext.apply(store.proxy.extraParams, { condition: _this.sqlcontext });
}, this);
//#endregion
},
//#region 查询
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: "正在查询数据...", scope: this });
},
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = '';
//报价编号
var QUOTATIONCODE = form.findField('QUOTATIONCODE').getValue();
sql = sql + getAndConSql(sql, QUOTATIONCODE, "QUOTATIONCODE like '%" + QUOTATIONCODE + "%'");
//客户名称
var SHORTNAME = form.findField('SHORTNAME').getValue();
sql = sql + getAndConSql(sql, SHORTNAME, "SHORTNAME='" + SHORTNAME + "'");
//报价人
var SALE = form.findField('SALE').getValue();
sql = sql + getAndConSql(sql, SALE, "SALE='" + SALE + "'");
//船公司
var CARRIER = form.findField('CARRIER').getValue();
sql = sql + getAndConSql(sql, CARRIER, "CARRIER='" + CARRIER + "'");
//国内港口(起运港)//需求编号SR2017072600008-4
var PORTLOAD = form.findField('PORTLOAD').getValue();
sql = sql + getAndConSql(sql, PORTLOAD, "PORTLOAD='" + PORTLOAD + "'");
//国际港口(目的港)
var PORTDISCHARGE = form.findField('PORTDISCHARGE').getValue();
sql = sql + getAndConSql(sql, PORTDISCHARGE, "PORTDISCHARGE='" + PORTDISCHARGE + "'");
//集装箱
var CTNCODE = form.findField('CTNCODE').getValue();
sql = sql + getAndConSql(sql, CTNCODE, "CTNCODE='" + CTNCODE + "'");
//品名
var GOODSNAME = form.findField('GOODSNAME').getValue();
sql = sql + getAndConSql(sql, GOODSNAME, "GOODSNAME='" + GOODSNAME + "'");
//产品类别
var GOODSTYPE = form.findField('GOODSTYPE').getValue();
sql = sql + getAndConSql(sql, GOODSTYPE, "GOODSTYPE='" + GOODSTYPE + "'");
//箱状态
var CTNSTATUS = form.findField('CTNSTATUS').getValue();
sql = sql + getAndConSql(sql, CTNSTATUS, "CTNSTATUS='" + CTNSTATUS + "'");
//使用代理
var FORWARDER = form.findField('FORWARDER').getValue();
sql = sql + getAndConSql(sql, FORWARDER, "FORWARDER='" + FORWARDER + "'");
//运输条款
var SERVICE = form.findField('SERVICE').getValue();
sql = sql + getAndConSql(sql, SERVICE, "SERVICE='" + SERVICE + "'");
//有效期
var VALIDDATEBgn = form.findField('VALIDDATEBgn').getRawValue();
sql = sql + getAndConSql(sql, VALIDDATEBgn, "CONVERT(char(10), VALIDDATE, 20) >='" + VALIDDATEBgn + "'");
var VALIDDATEEnd = form.findField('VALIDDATEEnd').getRawValue();
sql = sql + getAndConSql(sql, VALIDDATEEnd, "CONVERT(char(10), VALIDDATE, 20) <='" + VALIDDATEEnd + "'");
return sql;
},
onClearSql: function () {
var form = this.formSearch.getForm();
form.reset();
},
onDsQuery: function () {
//var girdcolums = this.gridList.getColumnMode();
var sql = this.sqlcontext;
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据,请稍等...",
scope: this
});
},
//#endregion
//#region 删除
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 gids = "";
var sError = "";
for (var i = 0; i < selections.length; i++) {
var record = selections[i];
if (this.StoreOpRange.getCount() == 0) {
//Ext.Msg.show({ title: Zi.LAN.JingGao, msg: "权限不足,不允许操作!", icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
//return;
continue;
} else {
//var op = record.data.SALE; //报价人
var inputby = record.data.CREATEUSER; //录入人
var recordins = DsStoreQueryBy(this.StoreOpRange, 'OPID', inputby);
if (recordins.getCount() > 0) {
gids += "," + record.get('GID');
} else {
//Ext.Msg.show({ title: Zi.LAN.JingGao, msg: "权限不足,不允许操作!", icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
//return;
continue;
}
}
}
//
if (gids.trim() == "") {
Ext.Msg.show({ title: '提示', msg: '请选择符合权限的未审核业务!' + sError, icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
else {
gids = gids.substring(1);
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcShipping/MsCrmQuotation/Delete',
params: {
gids: gids
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
for (var i = 0; i < selections.length; i++) {
this.storeList.remove(selections[i]);
}
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 });
},
scope: this
}); //end Ext.Ajax.request
}
}, this);
}
},
//#endregion
//#region 打印
Print: function () {
_this = this;
if (this.storeList.getCount() == 0) {
return;
}
//
var gids = "";
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length != 0) {
for (var i = 0; i < selections.length; i++) {
var record = selections[i];
if (i == 0) {
gids = record.get('GID');
}
else {
gids += "," + record.get('GID');
}
}
}
//
Ext.Msg.wait('正在组织数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在组织数据...',
url: '/MvcShipping/MsCrmQuotation/GetDataListStr',
scope: this,
params: {
condition: _this.sqlcontext,
gids: gids,
printstr: 'true'
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnstr = jsonresult.data;
var printType = 'MsCrmQuotationLIST';
var sql1 = returnstr;
var sql2 = "";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
} else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
Ext.Msg.show({ title: '请重试', msg: '服务器响应出错', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
});
},
//#endregion
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
return ret;
}
});