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.
419 lines
15 KiB
JavaScript
419 lines
15 KiB
JavaScript
Ext.namespace('Shipping');
|
|
|
|
Shipping.MsExchangesUnitIndex = function (config) {
|
|
Ext.applyIf(this, config);
|
|
this.initUIComponents();
|
|
window.Shipping.MsExchangesUnitIndex.superclass.constructor.call(this);
|
|
};
|
|
|
|
Ext.extend(Shipping.MsExchangesUnitIndex, Ext.Panel, {
|
|
PageSize: 100,
|
|
OprationStatus: null, //仅当弹出界面时使用
|
|
SelectedRecord: null,
|
|
|
|
initUIComponents: function () {
|
|
this.formname = "formMsExchangesUnitIndex"; //页面名称
|
|
|
|
//#region 定义数据集
|
|
this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', {
|
|
model: 'MsOP',
|
|
proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang' }
|
|
});
|
|
this.StoreOpRange.load({ params: { optype: "modExchangesUnit"} });
|
|
//
|
|
this.storeList = Ext.create('Ext.data.Store', {
|
|
pageSize: this.PageSize,
|
|
model: 'MsExchangesUnitEntity',
|
|
remoteSort: true,
|
|
proxy: {
|
|
type: 'ajax',
|
|
url: '/MvcShipping/MsExchangesUnit/GetDataList',
|
|
reader: {
|
|
id: 'GID',
|
|
root: 'data',
|
|
totalProperty: 'totalCount'
|
|
}
|
|
}
|
|
});
|
|
//#endregion
|
|
|
|
//#region 定义Grid
|
|
this.girdcolums = [{
|
|
sortable: true,
|
|
dataIndex: 'GID',
|
|
header: '业务编号',
|
|
hidden: true
|
|
},
|
|
{
|
|
sortable: true,
|
|
dataIndex: 'TAXNO',
|
|
header: '序号',
|
|
width: 50
|
|
},
|
|
{
|
|
sortable: true,
|
|
dataIndex: 'CODENAME',
|
|
header: '客户代码',
|
|
width: 100
|
|
},
|
|
{
|
|
sortable: true,
|
|
dataIndex: 'SHORTNAME',
|
|
header: '客户简称',
|
|
width: 100
|
|
},
|
|
{
|
|
sortable: true,
|
|
dataIndex: 'DESCRIPTION',
|
|
header: '客户全称',
|
|
width: 200
|
|
},
|
|
{
|
|
sortable: true,
|
|
dataIndex: 'TEL',
|
|
header: '电话',
|
|
width: 80
|
|
},
|
|
{
|
|
sortable: true,
|
|
dataIndex: 'FAX',
|
|
header: '传真',
|
|
width: 80
|
|
},
|
|
{
|
|
sortable: true,
|
|
dataIndex: 'SALE',
|
|
header: '揽货人',
|
|
width: 80
|
|
},
|
|
{
|
|
sortable: true,
|
|
dataIndex: 'OPNAME',
|
|
header: '录入人',
|
|
width: 80
|
|
},
|
|
{
|
|
sortable: true,
|
|
dataIndex: 'OPTIME',
|
|
header: '录入时间',
|
|
width: 130
|
|
}];
|
|
|
|
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
|
|
|
|
this.gridList = new Ext.grid.GridPanel({
|
|
store: this.storeList,
|
|
enableHdMenu: false,
|
|
region: 'center',
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
trackMouseOver: true,
|
|
disableSelection: false,
|
|
columns: this.girdcolums,
|
|
viewConfig: {
|
|
enableTextSelection: true, //允许复制数据
|
|
autoFill: true
|
|
},
|
|
// 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';
|
|
DsOpenEditWin('/MvcShipping/MsExchangesUnit/Edit', "往来单位信息", "600", "1000", 200, 200);
|
|
}, this);
|
|
//#endregion
|
|
|
|
//#region formSearch 下拉框信息加载
|
|
Ext.define('IsAttributeModel', { extend: 'Ext.data.Model', fields: [{ name: 'id', type: 'string', name: 'Name', type: 'string'}] });
|
|
var dataIsAttribute = [
|
|
{ "id": "ISCONTROLLER", "Name": "委托单位" },
|
|
{ "id": "ISCARRIER", "Name": "船公司" },
|
|
{ "id": "ISBOOKING", "Name": "订舱公司" },
|
|
{ "id": "ISYARD", "Name": "场站" },
|
|
{ "id": "ISTRUCK", "Name": "车队" },
|
|
{ "id": "ISCUSTOM", "Name": "报关行" },
|
|
{ "id": "ISAGENT", "Name": "国外代理" },
|
|
{ "id": "ISAGENTCN", "Name": "国内代理" },
|
|
{ "id": "ISEXPRESS", "Name": "快递公司" },
|
|
{ "id": "ISAIRLINES", "Name": "航空公司" },
|
|
{ "id": "ISSHIPPER", "Name": "发货人" },
|
|
{ "id": "ISCONSIGNEE", "Name": "收货人" },
|
|
{ "id": "ISNOTIFYPARTY", "Name": "通知人" },
|
|
{ "id": "ISWAREHOUSE", "Name": "仓库" },
|
|
{ "id": "ISINSURE", "Name": "保险公司" },
|
|
{ "id": "ISLEASING", "Name": "租箱公司" },
|
|
{ "id": "ISTRADINGAGENCY", "Name": "贸易代理" },
|
|
{ "id": "ISWHARF", "Name": "码头" },
|
|
{ "id": "ISSHIPPINGAGENT", "Name": "船代" },
|
|
{ "id": "ISENTERP", "Name": "经营单位" },
|
|
{ "id": "ISOTHER", "Name": "其他" },
|
|
{ "id": "", "Name": "" }
|
|
];
|
|
var storeIsAttribute = Ext.create('Ext.data.Store', { model: 'IsAttributeModel', data: dataIsAttribute });
|
|
this.comboxIsAttribute = Ext.create('DsExt.ux.RefTableCombox', {
|
|
fieldLabel: '客户属性',
|
|
forceSelection: true,
|
|
store: storeIsAttribute,
|
|
hiddenName: 'combo',
|
|
name: 'IsAttribute',
|
|
valueField: 'id',
|
|
displayField: 'Name'
|
|
});
|
|
//#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: [{
|
|
xtype: 'container',
|
|
layout: 'hbox',
|
|
defaultType: 'textfield',
|
|
items: [{
|
|
fieldLabel: '客户代码',
|
|
name: 'sCODENAME'
|
|
}, {
|
|
fieldLabel: '客户名称',
|
|
name: 'sSHORTNAME'
|
|
}, this.comboxIsAttribute]
|
|
}]
|
|
});
|
|
//#endregion formSearch
|
|
|
|
//#region 页面布局
|
|
this.panelBtn = new Ext.Panel({
|
|
region: "north",
|
|
tbar: [{
|
|
text: "新建",
|
|
iconCls: "btnadd",
|
|
handler: function (button, event) {
|
|
this.OprationStatus = 'add';
|
|
DsOpenEditWin('/MvcShipping/MsExchangesUnit/Edit', "企业信息", "600", "900", 200, 200);
|
|
},
|
|
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: "打印",
|
|
iconCls: 'btnprint',
|
|
handler: function (button, event) {
|
|
this.Print();
|
|
},
|
|
scope: this
|
|
}, '-',
|
|
{
|
|
text: "客户名称更改",
|
|
handler: function (button, event) {
|
|
//this.Print();
|
|
},
|
|
scope: this
|
|
}, '-',
|
|
{
|
|
text: "重复客户合并",
|
|
handler: function (button, event) {
|
|
//this.Print();
|
|
},
|
|
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) { Ext.apply(store.proxy.extraParams, { condition: "" }); }, this);
|
|
|
|
this.onRefreshClick();
|
|
//#endregion
|
|
}, //end initUIComponents
|
|
|
|
onRefreshClick: function (button, event) {
|
|
var sql = this.getCondition();
|
|
this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql }, waitMsg: "正在查询数据...", scope: this });
|
|
},
|
|
|
|
getCondition: function () {
|
|
var sql = '';
|
|
//
|
|
var strCODENAME = this.formSearch.getForm().findField('sCODENAME').getValue();
|
|
if (strCODENAME != null) {
|
|
if (strCODENAME != "") {
|
|
sql = sql + getAndConSql(sql, strCODENAME, "CODENAME like '%" + strCODENAME.toString().trim() + "%'");
|
|
}
|
|
}
|
|
//
|
|
var strSHORTNAME = this.formSearch.getForm().findField('sSHORTNAME').getValue();
|
|
if (strSHORTNAME != null) {
|
|
if (strSHORTNAME != "") {
|
|
sql = sql + getAndConSql(sql, strSHORTNAME, "SHORTNAME like '%" + strSHORTNAME.toString().trim() + "%'");
|
|
}
|
|
}
|
|
//
|
|
var blIsAttribute = this.formSearch.getForm().findField('IsAttribute').getValue();
|
|
if (blIsAttribute != null) {
|
|
if (blIsAttribute != "") {
|
|
sql = sql + getAndConSql(sql, blIsAttribute, (blIsAttribute + "=1"));
|
|
}
|
|
}
|
|
return sql;
|
|
},
|
|
|
|
//#region 重置条件
|
|
onClearSql: function () {
|
|
var form = this.formSearch.getForm();
|
|
form.reset();
|
|
},
|
|
//#endregion
|
|
|
|
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;
|
|
}
|
|
//
|
|
if (this.StoreOpRange.getCount() == 0) {
|
|
Ext.Msg.show({ title: '警告', msg: '权限不足,不允许删除!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
|
|
return;
|
|
} else {
|
|
var MODIFIEDUSERNAME = selections[0].data.MODIFIEDUSERNAME;
|
|
var records = DsStoreQueryBy(this.StoreOpRange, 'OPID', MODIFIEDUSERNAME);
|
|
if (records.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/MsExchangesUnit/Delete',
|
|
params: {
|
|
GID: selections[0].data.GID.toString(),
|
|
SHORTNAME: selections[0].data.SHORTNAME.toString()
|
|
},
|
|
callback: function (options, success, response) {
|
|
if (success) {
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
if (jsonresult.Success) {
|
|
//this.storeList.remove(selections[0]);
|
|
this.onRefreshClick();
|
|
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);
|
|
},
|
|
|
|
OprationSwap: function () {
|
|
var ret = new Array();
|
|
ret[0] = this.OprationStatus;
|
|
ret[1] = this.storeList;
|
|
ret[2] = this.SelectedRecord;
|
|
return ret;
|
|
},
|
|
|
|
Print: function () {
|
|
if (this.storeList.getCount() == 0) {
|
|
return;
|
|
}
|
|
|
|
Ext.Msg.wait('正在组织数据, 请稍侯..');
|
|
Ext.Ajax.request({
|
|
waitMsg: '正在组织数据...',
|
|
url: '/MvcShipping/MsExchangesUnit/GetDataListStr',
|
|
scope: this,
|
|
params: {
|
|
condition: "",
|
|
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 = 'MsExchangesUnitList';
|
|
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
|
|
});
|
|
}
|
|
}
|
|
});
|
|
}
|
|
});
|
|
|
|
|