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/MsInfoClientWebUserIndex.js

719 lines
23 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.MsInfoClientWebUserIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsInfoClientWebUserIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsInfoClientWebUserIndex, Ext.Panel, {
PageSize: 100,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
isShowAdvancedQuery: 0, //是否显示高级查询面板
sqlcontext: '',
editype: '',
selectbsno: '',
sortfield: '',
sortdire: '',
//需求编号SR2017061200005-1
initUIComponents: function () {
this.formname = "MsInfoClientWebUserIndex"; //页面名称
this.selecttype = 3;
//定义数据集
this.storectndisp = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CtnDispModel',
proxy: { url: '/CommMng/BasicDataRef/GetCtnDisp' }
});
_this = this;
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsInfoClientShipperModel',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsInfoClient/GetShipperAllDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
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();
}
}
}
});
//#region List列表显示信息
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 30
});
_this = this;
this.initgirdcolums = [{
sortable: true,
dataIndex: 'CODENAME',
hidden: true,
header: Zi.LAN.CODENAME, //'CODENAME',
width: 0
},
{
sortable: true,
dataIndex: 'SHIPPERID',
header: Zi.LAN.SHIPPERID, //'代码',
width: 140
},
{
sortable: true,
dataIndex: 'SHORTNAME',
header: Zi.LAN.SHORTNAME, //'简称',
width: 140
}, {
sortable: true,
dataIndex: 'SERVICECONTRACTNO',
header: Zi.LAN.SERVICECONTRACTNO, //'内容',
width: 120
}, {
sortable: true,
dataIndex: 'SHIPPERDETAIL',
header: Zi.LAN.SHIPPERDETAIL, //'内容',
width: 220
},
{
sortable: true,
dataIndex: 'SHIPPERTYPE',
header: Zi.LAN.SHIPPERTYPE, //'类型',
width: 120,
renderer: function (value, cellmeta) {
if (value == 1) {
return "收货人";
} else if (value == 2) {
return "发货人";
} else if (value == 3) {
return "通知人";
} else if (value == 4) {
return "代理";
}
}
},
{
sortable: true,
dataIndex: 'ISPUBLIC',
header: Zi.LAN.ISPUBLIC, //'是否公共',
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: 'west',
width: 300,
loadMask: { msg: Zi.LAN.ShuJuJiaZaiZhong }, //"数据加载中,请稍等..."
trackMouseOver: true,
disableSelection: false,
selModel: this.GridCheckBoxModel,
viewConfig: {
enableTextSelection: true, //允许复制数据
autoFill: true
},
listeners: {
cellclick: function (thisTab, record, item, index, e, eOpts) {
if (index == 10) {//设置按钮列
// alert('用户编号=' + this.getStore().getAt(rowIndex).data.usercode);
}
}
},
columns: this.girdcolums,
// paging bar on the bottom
bbar: [Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayMsg: Zi.LAN.displayMsg, //'当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: Zi.LAN.emptyMsg, //"没有数据"
displayInfo: true
}), this.Pagenum]
});
/////////////以下部分为获取存储的gridpanel显示样式
this.girdcolums = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums, 1); //使用者id表名中间column数组跳过一开始的几列
this.gridList.columns[0] = new Ext.grid.RowNumberer();
this.gridList.reconfigure(this.storeList, this.girdcolums);
////////////////////////////////////////////////
this.gridList.addListener('itemclick', function (dataview, record, item, index, e, b) {
_this.editRecord = record;
_this.OpStatus = 'edit';
_this.LoadData("edit", "GID='" + record.data.GID + "'");
}, this);
this.gridList.addListener('sortchange', function (ct, column, direction, eOpts) {
this.sortfield = column.dataIndex;
this.sortdire = direction;
}, this);
//#region formSearch 下拉框信息加载
//权限范围
//#endregion
//#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: '代码或简称',
name: 'SHIPPERID'
}, this.comboxCustCode, { xtype: 'hiddenfield' }, { xtype: 'hiddenfield' }, { xtype: 'hiddenfield' }
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
//#endregion formSearch
_this = this;
//按钮工具条_
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [{
text: Zi.LAN.btnAdd, //"新建",
iconCls: "btnadd",
handler: function (button, event) {
this.LoadData('add', '');
},
scope: this
}, {
text: Zi.LAN.btnDelete, //"删除",
iconCls: "btndelete",
handler: function (button, event) {
this.onDeleteClick(button, event);
},
scope: this
}, {
id: 'btnESave',
text: Zi.LAN.btnESave, //"保存",
iconCls: "btnsave",
handler: function (button, event) {
this.Save('0');
},
scope: this
}, {
id: 'btnESaveAndNew',
text: Zi.LAN.btnESaveAndNew, //"保存并新建",
handler: function (button, event) {
this.Save('2');
},
scope: this
}, '-',
{
text: Zi.LAN.btnReset, //"重置条件",
iconCls: "btnreset",
handler: function (button, event) {
var form = this.formSearch.getForm();
form.reset();
},
scope: this
}, '-', {
text: Zi.LAN.Excel,
id: "btnExportExcel",
iconCls: 'btnexportexcel',
handler: function (button, event) {
this.onExportClick(button, event);
},
scope: this
}, '-', {
text: Zi.LAN.btnTest, //"保存列表样式",
id: "btntest",
menu: [
{ text: Zi.LAN.btnESave, //"保存",
handler: function (button, event) {
this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridList.columns, _this.girdcolums, 1, true);
}
}, { text: Zi.LAN.SaveGridPanel, //"初始化",
handler: function (menu, event) {
_this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridList.columns, _this.initgirdcolums, 1, true);
}
}],
scope: this
}, '-',
{
text: Zi.LAN.btnPrint, //"打印",
iconCls: 'btnprint',
menu: [
{ text: Zi.LAN.PrintAll, //"全部",
handler: function (menu, event) {
_this.Print();
}
}, { text: Zi.LAN.PrintSelect, //"选择打印",
handler: function (menu, event) {
_this.PrintSelect();
}
}],
scope: this
}
]
});
//#region 编辑formEdit 基本信息
this.storeBodyList = Ext.create('Ext.data.Store', {
model: 'MsInfoClientWebUser',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsInfoClient/GetWebUserDataList',
reader: {
root: 'data',
totalProperty: 'totalCount'
}
}
});
//明细表表格
this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.gridListBody = new Ext.grid.GridPanel({
store: this.storeBodyList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: Zi.LAN.ShuJuJiaZaiZhong },
trackMouseOver: true,
disableSelection: false,
plugins: [this.gridListCellEditing],
selType: 'cellmodel',
tbar: [{
text: '增加网上用户', //'增加费用明细',
tooltip:'增加网上用户' , //'增加费用明细',
iconCls: "btnadddetail",
handler: function (button, event) {
this.onAddDetailClick(button, event, 1);
},
scope: this
}, '-', {
text: '删除网上用户', //'删除费用明细',
tooltip: '删除网上用户', //'删除费用明细',
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDelDetailClick(button, event, 1);
},
scope: this
}],
columns: [{
sortable: true,
dataIndex: 'GID',
header: 'GID', //'GID',
hidden: true,
width: 100
}, {
sortable: true,
dataIndex: 'LOGINNAME',
header: '账号', //'备注',
editor: {
xtype: 'textfield',
selectOnFocus: true,
enableKeyEvents: true
},
width: 150
}, {
sortable: true,
dataIndex: 'LOGINPASSWORD',
header: '秘钥', //'备注',
editor: {
xtype: 'textfield',
selectOnFocus: true,
enableKeyEvents: true
},
width: 150
}, {
sortable: true,
dataIndex: 'REMARK',
header: '备注', //'备注',
editor: {
xtype: 'textfield',
selectOnFocus: true,
enableKeyEvents: true
},
width: 150
}, {
sortable: true,
dataIndex: 'CREATEUSERREF',
header: Zi.LAN.CREATEUSERREF, //'录入人',
width: 100
}, {
sortable: true,
dataIndex: 'CREATETIME',
header: Zi.LAN.CREATETIME, //'录入日期',
width: 100
}
]
});
this.panelService = new Ext.Panel({
title: Zi.LAN.FeeField, //'费用字段',
layout: "border",
region: 'center',
margin: '5 10',
items: [this.gridList]
});
this.panelpage = new Ext.Panel({
title: '账号明细', //'客户基本信息',
layout: "border",
region: 'center',
animate: true,
autoScroll: true,
// containerScroll: true,
frame: false,
items: [this.formEdit]
});
//#endregion
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.panelpage]
});
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: '', load: 'true' },
waitMsg: Zi.LAN.ZhengZaiChaXunShuJu,
scope: this
});
this.storeList.on('beforeload', function (store) {
// var sql = this.getCondition();
Ext.apply(store.proxy.extraParams, { condition: _this.sqlcontext });
}, this);
//定义Grid
}, //end initUIComponents
LoadData: function (opstatus, condition) {
this.serialNo = 0;
//this.bodyDel = [];
this.opStatus = opstatus;
Ext.Ajax.request({
waitMsg: Zi.LAN.ZhengZaiChaXunShuJu,
url: '/MvcShipping/MsInfoClient/GetData',
params: {
handle: opstatus,
condition: condition
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: Zi.LAN.TiShi, //Zi.LAN.TiShi,
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
}
data = result.data;
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(data);
this.formACC.getForm().reset();
this.formACC.getForm().setValues(data);
if (this.opStatus == 'add') {
// this.LoadDefValue();
}
this.Editdata = data;
if (this.opStatus == 'edit') {
this.storeBodyList.load({ params: { condition: "LINKID='" + data.GID + "'", isedit: "1" } });
this.storeBodyList_ACCDATE.load({ params: { condition: "LINKGID='" + data.GID + "'", isedit: "1" } });
this.storeListContact.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: "LINKID='" + data.GID + "'" },
waitMsg: Zi.LAN.ZhengZaiChaXunShuJu,
scope: this
});
}
this.GetEditStatus();
} else {
Ext.MessageBox.alert(Zi.LAN.FuWuQiXiangYingChuCuo, response.responseText);
}
},
scope: this
});
var billno = '*';
var gid = '*';
}, // end LoadDate
//#region 保存
onRefreshClick: function (button, event) {
//var girdcolums = this.gridList.getColumnMode();
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: Zi.LAN.ZhengZaiChaXunShuJu,
scope: this
});
},
onDsQuery: function () {
//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
});
},
//end initUIComponents
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 = '';
var SHIPPERID = form.findField('SHIPPERID').getValue();
sql = sql + getAndConSql(sql, SHIPPERID, " (SHIPPERID like '%" + SHIPPERID + "%' or SHORTNAME like '%" + SHIPPERID + "%')");
var CUSTOMERNAME = form.findField('CUSTOMERNAME').getValue();
sql = sql + getAndConSql(sql, CUSTOMERNAME, " CODENAME='" + CUSTOMERNAME + "'");
return sql;
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
ret[3] = this.selectbsno;
ret[4] = 'info_client';
return ret;
},
Print: function () {
_this = this;
if (this.storeList.getCount() == 0) {
return;
}
var bsno = '11111';
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length != 0) {
var record = selections[0];
bsno = record.data.CODENAME;
}
var sortstr = '[{\"property\":\"CODENAME\",\"direction\":\"ASC\"}]';
if (this.sortfield != '' && this.sortdire != '') {
sortstr = this.sortfield + ' ' + this.sortdire;
}
Ext.Msg.wait(Zi.LAN.ZhengZaiCaoZuoShuJu);
Ext.Ajax.request({
waitMsg: Zi.LAN.ZhengZaiCaoZuoShuJu,
url: '/MvcShipping/MsInfoClient/GetDataListStr',
scope: this,
params: {
condition: _this.sqlcontext,
printstr: 'true',
sort: sortstr
},
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 = 'MSINFOCLIENTLIST';
var sql1 = returnstr;
var sql2 = "select * from info_client where CODENAME='" + bsno + "'";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
} else {
Ext.Msg.show({ title: Zi.LAN.TiShi, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
Ext.Msg.show({ title: Zi.LAN.TiShi,
msg: Zi.LAN.FuWuQiXiangYingChuCuo, //'服务器响应出错,请重试...',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
},
PrintSelect: function () {
_this = this;
if (this.storeList.getCount() == 0) {
return;
}
var selectedRecords = [];
var storeadd = null;
selectedRecords = this.GridCheckBoxModel.selected.items;
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.QingXianXuanZeXinXi, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //'请先选择要打印的业务!'
return;
}
var sortstr = 'CODENAME';
if (this.sortfield != '' && this.sortdire != '') {
sortstr = this.sortfield + ' ' + this.sortdire;
}
var feeGidSql = '';
for (var i = 0; i < selectedRecords.length; i++) {
var record = selectedRecords[i];
var feeGId = "'" + record.get('GID') + "'";
if (feeGidSql == '') {
feeGidSql = feeGId;
} else {
feeGidSql = feeGidSql + "," + feeGId;
}
};
var bsno = '11111';
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length != 0) {
var record = selections[0];
bsno = record.data.GID;
}
var printType = 'MSOPCLIENTLISTSELECT';
var sql1 = "select * from info_client WHERE GID IN (" + feeGidSql + ") order by " + sortstr;
var sql2 = "select * from info_client where GID='" + bsno + "'";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
},
onExportClick: function (button, event) {
GridExportExcelPage(this.gridList);
}
});