|
|
Ext.namespace('DsTruck');
|
|
|
|
|
|
DsTruck.CargoNameIndex = function (config) {
|
|
|
Ext.applyIf(this, config);
|
|
|
this.initUIComponents();
|
|
|
window.DsTruck.CargoNameIndex.superclass.constructor.call(this);
|
|
|
};
|
|
|
|
|
|
Ext.extend(DsTruck.CargoNameIndex, Ext.Panel, {
|
|
|
PageSize: 500,
|
|
|
OprationStatus: null, //仅当弹出界面时使用
|
|
|
SelectedRecord: null,
|
|
|
VISIBLERANGE: 0,
|
|
|
OPERATERANGE: 0,
|
|
|
_GID: 0,
|
|
|
_SHORTNAME: 0,
|
|
|
initUIComponents: function () {
|
|
|
//定义数据集
|
|
|
this.storeList = Ext.create('Ext.data.Store', {
|
|
|
model: 'Tradermb',
|
|
|
remoteSort: false,
|
|
|
pageSize: this.PageSize,
|
|
|
proxy: {
|
|
|
type: 'ajax',
|
|
|
url: '/CommMng/BasicDataRef/GetTrader',
|
|
|
reader: {
|
|
|
idProperty: 'gid',
|
|
|
root: 'data',
|
|
|
totalProperty: 'totalCount'
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
this.formname = "CargoName";
|
|
|
|
|
|
//this.InWorkFlow=false;
|
|
|
|
|
|
//#region 枚举参照
|
|
|
this.storeTrader = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'Tradermb',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetTrader' }
|
|
|
});
|
|
|
this.storeTrader.load({ params: { condition: ""} });
|
|
|
this.comboxTrader = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '往来单位',
|
|
|
store: this.storeTrader,
|
|
|
name: 'CustName', id: "CustName",
|
|
|
valueField: 'name',
|
|
|
displayField: 'codename'
|
|
|
});
|
|
|
|
|
|
Ext.define('ClintTypemb', {
|
|
|
extend: 'Ext.data.Model',
|
|
|
fields: [
|
|
|
{ name: 'ClintType', type: 'string' }
|
|
|
, { name: 'NAME', type: 'string' }
|
|
|
]
|
|
|
});
|
|
|
/*
|
|
|
ISCARRIER
|
|
|
ISBOOKING
|
|
|
ISYARD
|
|
|
ISTRUCK
|
|
|
ISCONTROLLER
|
|
|
ISCUSTOM
|
|
|
ISAGENT
|
|
|
ISAIRLINES
|
|
|
ISSHIPPER
|
|
|
ISCONSIGNEE
|
|
|
ISNOTIFYPARTY
|
|
|
ISCUSTOM
|
|
|
ISWAREHOUSE
|
|
|
ISAIRLINES*/
|
|
|
|
|
|
var ClintTypeData = [{ "ClintType": "ISSHIPPER", "NAME": "发货人" },
|
|
|
{ "ClintType": "ISAIRLINES", "NAME": "航空公司"}];
|
|
|
this.storeClintType = Ext.create('Ext.data.Store', {
|
|
|
model: 'ClintTypemb',
|
|
|
data: ClintTypeData
|
|
|
});
|
|
|
this.comboxClintType = Ext.create('DsExt.ux.RefEnumCombox', {
|
|
|
fieldLabel: '往来单位类型',
|
|
|
forceSelection: true,
|
|
|
store: this.storeClintType,
|
|
|
name: 'ClintType', id: "ClintType",
|
|
|
valueField: 'ClintType',
|
|
|
displayField: 'NAME'
|
|
|
});
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
this.column = [{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'gid',
|
|
|
header: 'gid',
|
|
|
width: 100
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'codename',
|
|
|
header: '代码/名称',
|
|
|
width: 200
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'name', hidden: true,
|
|
|
header: '名称',
|
|
|
width: 120
|
|
|
}];
|
|
|
|
|
|
//定义Grid
|
|
|
this.ClientCB = Ext.create('Ext.selection.CheckboxModel', { checkOnly: true });
|
|
|
|
|
|
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
|
|
|
width: 45
|
|
|
});
|
|
|
|
|
|
this.gridList = new Ext.grid.GridPanel({
|
|
|
store: this.storeList,
|
|
|
enableHdMenu: false,
|
|
|
//layout: "border",
|
|
|
region: 'center',
|
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
|
trackMouseOver: true,
|
|
|
disableSelection: false,
|
|
|
stripeRows: true,
|
|
|
viewConfig: {
|
|
|
enableTextSelection: true
|
|
|
},
|
|
|
stateful: true,
|
|
|
selModel: this.ClientCB,
|
|
|
|
|
|
columns: [new Ext.grid.RowNumberer()],
|
|
|
bbar: Ext.create('Ext.PagingToolbar', {
|
|
|
store: this.storeList,
|
|
|
displayInfo: true,
|
|
|
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
|
|
|
emptyMsg: "没有数据"
|
|
|
})
|
|
|
});
|
|
|
|
|
|
/////////////以下部分为获取存储的gridpanel显示样式
|
|
|
//this.column = DsTruck.GetGridPanel(USERID, this.formname, this.column);
|
|
|
//使用者id,表名 ,中间column数组,跳过一开始的几列
|
|
|
|
|
|
this.column.unshift(new Ext.grid.RowNumberer());
|
|
|
this.gridList.reconfigure(this.storeList, this.column);
|
|
|
////////////////////////////
|
|
|
|
|
|
/*
|
|
|
this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
|
|
|
this.SelectedRecord = record;
|
|
|
this.OprationStatus = 'edit';
|
|
|
DsOpenEditWin("/Import/CargoName/Edit", "", "620", "1000","200","400");
|
|
|
}, this);*/
|
|
|
|
|
|
|
|
|
this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
|
|
|
this.SelectedRecord = record;
|
|
|
this.OprationStatus = 'edit';
|
|
|
DsOpenEditWin("/Import/CargoName/Edit","商品信息:"+record.get('name'), "620", "1000", "200", "400");
|
|
|
|
|
|
//this._GID = record.data.gid;
|
|
|
//this._SHORTNAME = record.data.gid;
|
|
|
|
|
|
}, this);
|
|
|
|
|
|
//#region formSearch
|
|
|
|
|
|
|
|
|
this.formSearch = Ext.widget('form', {
|
|
|
frame: true,
|
|
|
region: 'center',
|
|
|
bodyPadding: 5,
|
|
|
fieldDefaults: {
|
|
|
margins: '2 2 2 2',
|
|
|
labelAlign: 'right',
|
|
|
flex: 1,
|
|
|
labelWidth: 120,
|
|
|
msgTarget: 'qtip'
|
|
|
},
|
|
|
|
|
|
items: [
|
|
|
{//fieldset 1
|
|
|
xtype: 'container',
|
|
|
defaultType: 'textfield',
|
|
|
layout: 'anchor',
|
|
|
defaults: {
|
|
|
anchor: '100%'
|
|
|
},
|
|
|
items: [{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [
|
|
|
this.comboxClintType,
|
|
|
this.comboxTrader,
|
|
|
{
|
|
|
fieldLabel: '名称或代码中包含',
|
|
|
name: 'CustCode',
|
|
|
id: "CustCode"
|
|
|
}, {
|
|
|
xtype: 'hiddenfield', flex: 1
|
|
|
}
|
|
|
]
|
|
|
}]
|
|
|
}, //end items(fieldset 1)
|
|
|
{//fieldset 2
|
|
|
xtype: 'container',
|
|
|
defaultType: 'textfield',
|
|
|
layout: 'anchor',
|
|
|
defaults: {
|
|
|
anchor: '100%'
|
|
|
},
|
|
|
items: [{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: []
|
|
|
}]
|
|
|
}, //end fieldset 2
|
|
|
{//fieldset 3
|
|
|
xtype: 'container',
|
|
|
defaultType: 'textfield',
|
|
|
layout: 'anchor',
|
|
|
defaults: {
|
|
|
anchor: '100%'
|
|
|
},
|
|
|
items: [{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [
|
|
|
]
|
|
|
}]
|
|
|
}, //end items(fieldset 3)
|
|
|
{//fieldset 5
|
|
|
xtype: 'container',
|
|
|
defaultType: 'textfield',
|
|
|
layout: 'anchor',
|
|
|
defaults: {
|
|
|
anchor: '100%'
|
|
|
},
|
|
|
items: []
|
|
|
} //end items(fieldset 5)
|
|
|
|
|
|
]//end root items
|
|
|
|
|
|
});
|
|
|
|
|
|
//#endregion formSearch
|
|
|
|
|
|
//_this = this;
|
|
|
this.CBMWorkFlow = new Ext.form.Checkbox({
|
|
|
fieldLabel: '只显示待处理业务',
|
|
|
labelwidth: 200
|
|
|
});
|
|
|
//查询工具条
|
|
|
this.panelBtn = new Ext.Panel({
|
|
|
region: "north",
|
|
|
tbar: [
|
|
|
{
|
|
|
text: "执行查询",
|
|
|
iconCls: "btnrefresh",
|
|
|
handler: function (button, event) {
|
|
|
this.onRefreshClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
},
|
|
|
{
|
|
|
text: "重置条件",
|
|
|
iconCls: "btnreset",
|
|
|
handler: function (button, event) {
|
|
|
//this.onResetClick(button, event);
|
|
|
//alert(this.getCondition);
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-',
|
|
|
{
|
|
|
text: "打开",
|
|
|
iconCls: "btnright", id: "OPEN",
|
|
|
handler: function (button, event) {
|
|
|
this.onOpenClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-'
|
|
|
]
|
|
|
});
|
|
|
|
|
|
//#region 商品名称
|
|
|
|
|
|
this.storeCargoinfo = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'CargoRef',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCargoRefList' }
|
|
|
});
|
|
|
this.storeCargoinfo.load({ params: { condition: ""} });
|
|
|
this.comboxCargoinfo = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
store: this.storeCargoinfo,
|
|
|
forceSelection: true,
|
|
|
name: 'HS_ID',
|
|
|
valueField: 'id',
|
|
|
displayField: 'codeandname'
|
|
|
//HS代码
|
|
|
});
|
|
|
|
|
|
this.storeCargociq = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'CargociqRef',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCargociqRefList' }
|
|
|
});
|
|
|
this.storeCargociq.load({ params: { condition: ""} });
|
|
|
this.comboxCargociq = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
store: this.storeCargociq,
|
|
|
forceSelection: true,
|
|
|
name: 'CIQ_ID',
|
|
|
valueField: 'id',
|
|
|
displayField: 'codeandname',
|
|
|
async: false
|
|
|
//ciq代码
|
|
|
});
|
|
|
|
|
|
this.storeCARGOTYPE = Ext.create('DsExt.ux.RefEnumStore', {});
|
|
|
this.storeCARGOTYPE.load({ params: { enumTypeId: 30} });
|
|
|
this.comboxCARGOTYPE = Ext.create('DsExt.ux.RefEnumCombox', {
|
|
|
//fieldLabel: '商品类型',
|
|
|
forceSelection: true,
|
|
|
store: this.storeCARGOTYPE,
|
|
|
name: 'CARGOTYPE',
|
|
|
valueField: 'EnumValueName',
|
|
|
displayField: 'EnumValueName'
|
|
|
});
|
|
|
|
|
|
//数据集
|
|
|
this.storeCargoName = Ext.create('Ext.data.Store', {
|
|
|
model: 'CargoNamemb',
|
|
|
remoteSort: false,
|
|
|
pruneModifiedRecords: true,
|
|
|
proxy: {
|
|
|
type: 'ajax',
|
|
|
url: '/Import/CargoName/GetCargoNameList',
|
|
|
reader: {
|
|
|
id: 'GID',
|
|
|
root: 'data',
|
|
|
totalProperty: 'totalCount'
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
//表格
|
|
|
this.cellEditing_S = Ext.create('Ext.grid.plugin.CellEditing', {
|
|
|
clicksToEdit: 1
|
|
|
});
|
|
|
this.CheckBoxModel_S = Ext.create('Ext.selection.CheckboxModel');
|
|
|
|
|
|
this.formCargoName = new Ext.grid.GridPanel({
|
|
|
layout: 'border',
|
|
|
store: this.storeCargoName,
|
|
|
enableHdMenu: false,
|
|
|
region: 'center', //bodyStyle: 'background:#FFF',
|
|
|
trackResetOnLoad: true,
|
|
|
//split:true,
|
|
|
//height: 160,
|
|
|
title: '商品名称',
|
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
|
trackMouseOver: true,
|
|
|
disableSelection: false,
|
|
|
plugins: [this.cellEditing_S],
|
|
|
selModel: this.CheckBoxModel_S,
|
|
|
selType: 'cellmodel',
|
|
|
tbar: [{
|
|
|
text: '增加明细',
|
|
|
tooltip: '增加明细', id: "add2",
|
|
|
iconCls: "btnadddetail",
|
|
|
handler: function (button, event) {
|
|
|
this.onAddCargoNameClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-', {
|
|
|
text: '删除明细',
|
|
|
tooltip: '删除明细', id: "del2",
|
|
|
iconCls: "btndeletedetail",
|
|
|
handler: function (button, event) {
|
|
|
this.onDelCargoNameClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}],
|
|
|
columns: [
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'GID',
|
|
|
header: 'GID',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'CLIENTGID',
|
|
|
header: 'CLIENTGID',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'CODENAME',
|
|
|
header: '代码',
|
|
|
editor: {
|
|
|
xtype: 'textfield'
|
|
|
},
|
|
|
width: 50
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'ENNAME',
|
|
|
header: '英文名称',
|
|
|
editor: {
|
|
|
xtype: 'textfield'
|
|
|
},
|
|
|
width: 110
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'CNNAME',
|
|
|
header: '中文名称',
|
|
|
editor: {
|
|
|
xtype: 'textfield'
|
|
|
},
|
|
|
width: 110
|
|
|
},
|
|
|
{
|
|
|
dataIndex: 'HS_ID',
|
|
|
header: 'HS代码',
|
|
|
renderer: function (value, p, record) {
|
|
|
if (value == null || value == '') return '';
|
|
|
else return record.data.HSREF;
|
|
|
},
|
|
|
editor: this.comboxCargoinfo,
|
|
|
width: 140
|
|
|
},
|
|
|
{
|
|
|
dataIndex: 'CIQ_ID',
|
|
|
header: 'CIQ代码',
|
|
|
renderer: function (value, p, record) {
|
|
|
if (value == null || value == '') return '';
|
|
|
else return record.data.CIQREF;
|
|
|
},
|
|
|
editor: this.comboxCargociq,
|
|
|
width: 140
|
|
|
},
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'MODIFIEDUSER',
|
|
|
header: 'MODIFIEDUSER',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'MODIFIEDTIME',
|
|
|
header: 'MODIFIEDTIME',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'AREA',
|
|
|
header: '区域',
|
|
|
editor: {
|
|
|
xtype: 'textfield'
|
|
|
},
|
|
|
width: 60
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'SBYS',
|
|
|
header: '申报要素',
|
|
|
editor: {
|
|
|
xtype: 'textfield'
|
|
|
},
|
|
|
width: 160
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'CARGOTYPE',
|
|
|
header: '商品类型',
|
|
|
editor: this.comboxCARGOTYPE,
|
|
|
width: 80
|
|
|
}]
|
|
|
});
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
//#region 布局
|
|
|
|
|
|
this.panelTop = new Ext.Panel({
|
|
|
layout: "border",
|
|
|
region: "north",
|
|
|
height: 85,
|
|
|
items: [this.formSearch, this.panelBtn]
|
|
|
});
|
|
|
/*
|
|
|
this.page_1 = new Ext.Panel({
|
|
|
id: "page_1",
|
|
|
layout: "border",
|
|
|
region: "center",
|
|
|
title: "选择往来单位",
|
|
|
//autoScroll: true,
|
|
|
items: [this.gridList]
|
|
|
});
|
|
|
|
|
|
this.page_2 = new Ext.Panel({
|
|
|
id: "page_2",
|
|
|
layout: "border",
|
|
|
region: "center",
|
|
|
title: "商品信息",
|
|
|
//autoScroll: true,
|
|
|
items: [this.formCargoName]
|
|
|
});
|
|
|
|
|
|
|
|
|
this.MainTab = new Ext.tab.Panel({
|
|
|
layout: "border",
|
|
|
region: "center", split: true,
|
|
|
items: [this.page_1
|
|
|
, this.page_2//, this.page_3, this.page_4//,this.page_5
|
|
|
]
|
|
|
});
|
|
|
*/
|
|
|
Ext.apply(this, {
|
|
|
items: [this.panelTop, this.gridList]
|
|
|
});
|
|
|
//#endregion
|
|
|
|
|
|
this.InitData();
|
|
|
|
|
|
//集中绑定事件
|
|
|
this.storeList.on('beforeload', function (store) {
|
|
|
var sql = this.getCondition();
|
|
|
Ext.apply(store.proxy.extraParams, { condition: sql });
|
|
|
}, this);
|
|
|
|
|
|
}, //end initUIComponents
|
|
|
|
|
|
checkHandler: function () {
|
|
|
alert('Checked a menu item');
|
|
|
},
|
|
|
onRefreshClick: function (button, event) {
|
|
|
var sql = this.getCondition();
|
|
|
this.storeList.load({
|
|
|
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
|
|
|
waitMsg: "正在查询数据...",
|
|
|
scope: this
|
|
|
});
|
|
|
//alert(this.storeList.getCount());
|
|
|
},
|
|
|
InitData: function () {
|
|
|
|
|
|
//var STEPNO=this.storeWorkFlowStep.getAt(index).get("STEPNO");
|
|
|
|
|
|
}, //end InitData
|
|
|
|
|
|
onOpenClick: 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;
|
|
|
}
|
|
|
if (selections.length > 1) {
|
|
|
Ext.Msg.show({ title: '提示', msg: '请注意,将打开所选内容的第一条!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
}
|
|
|
|
|
|
var selectedRecords = [];
|
|
|
|
|
|
selectedRecords = this.gridList.selModel.getSelection();
|
|
|
|
|
|
this.SelectedRecord = selectedRecords[0];
|
|
|
this.OprationStatus = 'edit';
|
|
|
DsOpenEditWin("/Import/CargoName/Edit", "", "620", "1000");
|
|
|
}, //onDeleteClick
|
|
|
|
|
|
getToday: function () {
|
|
|
var now = new Date();
|
|
|
|
|
|
var year = now.getFullYear(); //年
|
|
|
var month = now.getMonth() + 1; //月
|
|
|
var day = now.getDate(); //日
|
|
|
|
|
|
var clock = year + "-";
|
|
|
|
|
|
if (month < 10)
|
|
|
clock += "0";
|
|
|
|
|
|
clock += month + "-";
|
|
|
|
|
|
if (day < 10)
|
|
|
clock += "0";
|
|
|
|
|
|
clock += day + " ";
|
|
|
|
|
|
return (clock);
|
|
|
},
|
|
|
|
|
|
onResetClick: function (button, event) {
|
|
|
this.formSearch.getForm().reset();
|
|
|
},
|
|
|
getCondition: function () {
|
|
|
var form = this.formSearch.getForm();
|
|
|
if (!form.isValid()) {
|
|
|
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
|
|
|
return '';
|
|
|
}
|
|
|
|
|
|
var sql = "";
|
|
|
|
|
|
var CustName = Ext.getCmp("CustName").getValue();
|
|
|
sql = sql + getAndConSql(sql, CustName, "shortname like '%" + CustName + "%'");
|
|
|
|
|
|
var CustCode = Ext.getCmp("CustCode").getValue();
|
|
|
sql = sql + getAndConSql(sql, CustCode, "codename like '%" + CustCode + "%' shortname like '%" + CustCode + "%'");
|
|
|
|
|
|
var ClintType = Ext.getCmp("ClintType").getValue();
|
|
|
sql = sql + getAndConSql(sql, ClintType, " " + ClintType + "=1 ");
|
|
|
|
|
|
|
|
|
return sql;
|
|
|
},
|
|
|
onGetremind: function (field, newValue, oldValue) {
|
|
|
if (newValue != null) {
|
|
|
this.storeList.load({
|
|
|
params: { start: 0, limit: this.PageSize, sort: '', condition: newValue },
|
|
|
waitMsg: "正在查询数据...",
|
|
|
scope: this
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
OprationSwap: function () {
|
|
|
var ret = new Array();
|
|
|
ret[0] = this.OprationStatus;
|
|
|
ret[1] = this.storeList;
|
|
|
ret[2] = this.SelectedRecord;
|
|
|
ret[3] = Ext.getCmp("ClintType").getValue();
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
});
|