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

1316 lines
46 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.MsInfoClientRang = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsInfoClientRang.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsInfoClientRang, Ext.Panel, {
PageSize: 100,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
isShowAdvancedQuery: 0, //是否显示高级查询面板
sqlcontext: '',
sqlCustcontext: '',
editype: '',
selectbsno: '',
sortfield: '',
sortdire: '',
_SHORTNAME:'',
//需求编号SR2017061200005-1
initUIComponents: function () {
this.formname = "MsInfoClientRang"; //页面名称
//定义数据集
this.storectndisp = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CtnDispModel',
proxy: { url: '/CommMng/BasicDataRef/GetCtnDisp' }
});
this.sqlcontext = '';
this.sqlCustcontext = '';
this._SHORTNAME = getUrlParam('SHORTNAME');
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsInfoClientModel',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsInfoClient/GetDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#region List列表显示信息
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 30
});
_this = this;
this.initgirdcolums = [{
sortable: true,
id: '',
dataIndex: '',
header: '',
width: 0
}, {
sortable: true,
id: '',
dataIndex: 'GID',
header: Zi.LAN.GID, //'编号',
hidden: true,
width: 0
}, {
sortable: true,
id: '',
dataIndex: 'CODENAME',
header: Zi.LAN.CODENAME, //'客户代码',
width: 120
}, {
sortable: true,
id: '',
dataIndex: 'SHORTNAME',
header: Zi.LAN.SHORTNAME, //'客户简称',
width: 120
}, {
sortable: true,
id: '',
dataIndex: 'DESCRIPTION',
header: Zi.LAN.DESCRIPTION, //'客户全称',
width: 200
},
{
sortable: true,
id: '',
dataIndex: 'ENFULLNAME',
header: Zi.LAN.ENFULLNAME, //'英文全称',
width: 200
},
{
sortable: true,
id: '',
dataIndex: 'FARCODE',
header: Zi.LAN.FARCODE, //'应收代码',
width: 80
},
{
sortable: true,
id: '',
dataIndex: 'FAPCODE',
header: Zi.LAN.FAPCODE, //'应付代码',
width: 80
},
{
sortable: true,
id: '',
dataIndex: 'ORDERNO',
header: Zi.LAN.ORDERNO, //'财务序号',
width: 80
},
{
sortable: true,
id: '',
dataIndex: 'TEL',
header: Zi.LAN.TEL, //'电话',
width: 120
},
{
sortable: true,
id: '',
dataIndex: 'FAX',
header: Zi.LAN.FAX, //'传真',
width: 80
},
{
sortable: true,
id: '',
dataIndex: 'SALE',
header: Zi.LAN.SALE, //'揽货人',
width: 120
},
{
sortable: true,
id: '',
dataIndex: 'BSSOURCE',
header: Zi.LAN.BSSOURCE, //'业务来源',
width: 120
},
{
sortable: true,
id: '',
dataIndex: 'OPNAME',
header: Zi.LAN.OPNAME, //'录入人',
width: 80
},
{
sortable: true,
id: '',
dataIndex: 'OPTIME',
header: Zi.LAN.OPTIME, //'录入日期',
width: 80
},
{
sortable: true,
id: '',
dataIndex: 'BLSTATUSREF',
header: Zi.LAN.BLSTATUSREF, //'审核状态',
width: 80
},
{
sortable: true,
id: '',
dataIndex: 'ACCREMARK',
header: Zi.LAN.ACCREMARK, //'审核状态',
width: 80
},
{
sortable: true,
dataIndex: 'ACCTYPE',
header: "可结算方式",
width: 80
},
{
sortable: true,
dataIndex: 'ACCMONTH',
header: "间隔月份",
width: 80
},
{
sortable: true,
dataIndex: 'ACCDAYS',
header: "结算时间",
width: 80
}];
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:430,
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
})
});
/////////////以下部分为获取存储的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.ClientClick(dataview, record, item, index, e, b);
}, this);
this.gridList.addListener('sortchange', function (ct, column, direction, eOpts) {
this.sortfield = column.dataIndex;
this.sortdire = direction;
}, this);
Ext.define('ModuleModel', {
extend: 'Ext.data.Model',
fields: [
{ name: 'id', type: 'string' },
{ name: 'NAME', type: 'string' },
{ name: 'DESCRIPTION', type: 'string' },
{ name: 'MODULEURL', type: 'string' },
{ name: 'SORT', type: 'number' },
{ name: 'PARENTID', type: 'string' },
{ name: 'PARENTNAME', type: 'string' },
{ name: 'TYPE', type: 'string' },
{ name: 'leaf', type: 'bool' },
{ name: 'expanded', type: 'bool' },
{ name: 'checked', type: 'bool',value:true }
]
});
this.treestore = new Ext.data.TreeStore({
model: 'ModuleModel',
nodeParam: 'PARENTID',
proxy: {
type: 'ajax',
url: '/MvcShipping/MsUserAuthority/GetUserTreeExpRefList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
},
autoLoad: true,
root: {
name: '根节点',
expanded: true,
id: '0'
}
});
this.GridCheckBoxTreeModel = Ext.create('Ext.selection.CheckboxModel');
var travelParentChecked = function(node, checkStatus, opts){
//父节点
var upNode = node.parentNode;
if(upNode != null){
var opts = {};
opts["isPassive"] = true;
//父节点当前选中状态
var upChecked = upNode.data.checked;
//选中状态,遍历父节点,判断有父节点下的子节点是否都全选
if(checkStatus){
var allChecked = true;
//此时父节点不可能是选中状态
//如果有一个节点未选中,可以判断,当前父节点肯定是未选中状态,所以此时不必向上遍历
upNode.eachChild(function (child) {
if(!child.data.checked){
allChecked = false;
return false;
}
});
upNode.set('checked', allChecked);
if(allChecked){
travelParentChecked(upNode, allChecked, opts);
}else{//如果后台传递数据时,选择状态正确的话,此处不需要执行
//travelParentChecked(upNode, allChecked, opts);
}
}else{//未选中,让父节点全都 不选
if(upNode.data.checked){
upNode.set('checked', checkStatus);
travelParentChecked(upNode, checkStatus, opts);
}else{
//travelParentChecked(upNode, allChecked, opts);
}
}
}
}
/** 递归遍历子节点,复选框 **/
var travelChildrenChecked = function(node, checkStatus, eOpts){
var isLeaf = node.data.leaf;
if(!isLeaf){
node.expand(false, function(){
if(eOpts["isPassive"] == null){//主动点击
node.eachChild(function (child) {
child.set('checked', checkStatus);
travelChildrenChecked(child, checkStatus, eOpts);
//child.fireEvent('checkchange',child, checked);//不知什么原因,不起作用
});
}
});
}
node.set('checked', checkStatus);
}
this.tabtree = new Ext.tree.Panel({
region: 'center',
title: '人员信息', //'业务信息',
split: true,
// width: 320,
// collapsible: true,
margins: '0 0 0 0',
store: this.treestore,
useArrows: true,
singleExpand:true,
rootVisible: false,
hideHeaders: true,
// selModel: this.GridCheckBoxTreeModel,
animate: false,
// checked:true,
lines: false,
columns: [{
xtype: 'treecolumn',
text: '人员信息', //'模块名称',
width: 318,
dataIndex: 'DESCRIPTION'
}],
listeners: {
scope: this,
//'itemclick': function (_this, record, item, index, e, eOpts) {
// if (record.data.TYPE == '2') {
// var userid = record.data.id;
// this.panelcenter.setTitle(record.data.DESCRIPTION + '权限范围');
// _thisAuthority.storeList.load({
// params: { start: 0, limit: 500, sort: '', userid: userid },
// waitMsg: "正在查询数据...",
// scope: this
// });
// _thisAuthority.opid = userid;
// }
//},
"checkchange": function(node, checked, eOpts){
travelChildrenChecked(node, checked, eOpts);
travelParentChecked(node, checked, eOpts);
}
}
});
this.paneltree = new Ext.Panel({
layout: "border",
region: "west",
width: 320,
items: [this.tabtree]
});
this.treestoreCustRange = new Ext.data.TreeStore({
model: 'ModuleModel',
nodeParam: 'PARENTID',
proxy: {
type: 'ajax',
url: '/MvcShipping/MsUserAuthority/GetUserTreeExpRefList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
},
autoLoad: false,
root: {
name: '根节点',
expanded: true,
id: '0'
}
});
this.tabtreeCustRange = new Ext.tree.Panel({
region: 'center',
title: '已指定人员', //'业务信息',
split: true,
// width: 320,
// collapsible: true,
margins: '0 0 0 0',
store: this.treestoreCustRange,
useArrows: true,
// singleExpand: true,
rootVisible: false,
hideHeaders: true,
// selModel: this.GridCheckBoxTreeModel,
animate: false,
// checked: true,
lines: false,
columns: [{
xtype: 'treecolumn',
text: '已指定人员', //'模块名称',
width: 318,
dataIndex: 'DESCRIPTION'
}],
listeners: {
scope: this,
"checkchange": function(node, checked, eOpts) {
travelChildrenChecked(node, checked, eOpts);
travelParentChecked(node, checked, eOpts);
}
}
});
this.panelbtn = new Ext.Panel({
layout: "border",
region: "west",
width: 90,
items: [{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'button',
width: 90,
text: '>>', //"执行查询",
height: 35,
// iconCls: "btnrefresh",
handler: function (button, event) {
this.onInsertRangeClick(button, event);
},
scope: this
}, {
xtype: 'button',
width: 90,
height: 35,
text: '<<', //"执行查询",
// iconCls: "btnrefresh",
handler: function (button, event) {
this.onDeleteRangeClick(button, event);
},
scope: this
}]
}]
});
//#region formSearch 下拉框信息加载
//权限范围
this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsOP',
proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang' }
});
this.StoreOpRange.load({ params: { optype: "modExchangesUnit" } });
this.storeISADVANCEDPAY = Ext.create('Ext.data.Store', {
fields: ['FSTATUS', 'NAME']
});
this.storeISADVANCEDPAY.add({ "FSTATUS": "", "NAME": "全部" });
this.storeISADVANCEDPAY.add({ "FSTATUS": "0", "NAME": "否" });
this.storeISADVANCEDPAY.add({ "FSTATUS": "1", "NAME": "是" });
this.comboxISADVANCEDPAY = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '是否设置权限', //是否开垫付
store: this.storeISADVANCEDPAY,
valueField: 'FSTATUS',
displayField: 'NAME',
forceSelection: true,
name: 'ISADVANCEDPAY',
value: '',
// flex: 0.7,
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//#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: Zi.LAN.MblNo, //'代码或简称',
labelWidth: 80, name: 'MblNo',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: Zi.LAN.CODENO, //'财务代码/序号',
name: 'CODENO',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: Zi.LAN.QUANCHENG, //'联系人',
name: 'CUSTFULLNAME',
labelWidth: 50,
flex: 0.8,
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: Zi.LAN.ATTN, //'联系人',
name: 'ATTN',
labelWidth: 50,
flex: 0.8,
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: Zi.LAN.ETDbgn, //'录入日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ETDbgn',
flex: 0.9,
labelWidth: 70,
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: Zi.LAN.ETDend, //'到',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ETDend',
labelWidth: 20,
flex: 0.6,
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, this.comboxISADVANCEDPAY
, {
xtype: 'button',
width: 90,
text: Zi.LAN.btnRefresh, //"执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
}, {
xtype: 'button',
width: 45,
// text: Zi.LAN.btnMore, //"高级查询",
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
}]
}
]//end items(fieldset 1)
}]//end root items
});
//#endregion formSearch
_this = this;
//按钮工具条_
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height:50,
items: [this.formSearch]
});
this.panelcust = new Ext.Panel({
layout: "border",
region: "center",
items: [this.tabtreeCustRange]
});
this.panelcenter = new Ext.Panel({
layout: "border",
region: "center",
items: [this.gridList, this.paneltree,this.panelbtn,this.panelcust]
});
Ext.apply(this, {
items: [this.panelTop, this.panelcenter]
});
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);
this.treestoreCustRange.on('beforeload', function (store) {
var sql = _this.sqlCustcontext;
if (sql=='') sql=' 1=2 '
Ext.apply(store.proxy.extraParams, {
condition: sql
});
}, this);
if (this._SHORTNAME && this._SHORTNAME!='') {
this.OpenSearch();
}
}, //end initUIComponents
onRefreshClick: function (button, event) {
//var girdcolums = this.gridList.getColumnMode();
var sql = this.getCondition();
this.sqlcontext = sql;
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
});
},
onInsertRangeClick: function (button, event) {
//var girdcolums = this.gridList.getColumnMode();
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 bodyAddDatas = [];
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
bodyAddDatas.push(rec);
}
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
var feeGidSql = '';
var seletdata = this.tabtree.getChecked();
// var seletdata = selectops[0].store.data;
var _rec = selections[0];
_this = this;
var seltype = '';
if (seletdata.length> 0) {
for (var j = 0; j < seletdata.length ; j++) {
var member = seletdata[j];
seltype = member.data.TYPE;
if (seltype == '2') {
if (member.data.checked) {
var feeGId = "'" + member.data.id + "'";
if (feeGidSql == '') {
feeGidSql = feeGId;
} else {
feeGidSql = feeGidSql + "," + feeGId;
}
}
}
}
}
if (feeGidSql == '') {
Ext.Msg.show({ title:'提示', msg:'请选择人员!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
Ext.Msg.wait('正在操作数据...');
if (feeGidSql != '') {
Ext.Ajax.request({
waitMsg: '正在操作数据...', //'正在删除数据...',
url: '/MvcShipping/MsInfoClient/InCustRange',
params: {
cust: jsonbodyAddDatas,
op: feeGidSql,
seltype:2
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
//this.treestoreCustRange.reload();
_this.ClientClick('', _rec);
Ext.Msg.hide();
}
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
} else {
Ext.Msg.show({ title:'提示', msg: "删除成功!", icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
},
onDeleteRangeClick: function (button, event) {
//var girdcolums = this.gridList.getColumnMode();
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 bodyAddDatas = [];
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
bodyAddDatas.push(rec);
}
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
var feeGidSql = '';
var seletdata = this.tabtreeCustRange.getChecked();
// var seletdata = selectops[0].store.data;
var seltype = '';
if (seletdata.length > 0) {
for (var j = 0; j < seletdata.length ; j++) {
var member = seletdata[j];
seltype = member.data.TYPE;
if (seltype == '2') {
if (member.data.checked) {
var feeGId = "'" + member.data.id + "'";
if (feeGidSql == '') {
feeGidSql = feeGId;
} else {
feeGidSql = feeGidSql + "," + feeGId;
}
}
}
}
}
if (feeGidSql == '') {
Ext.Msg.show({ title: '提示', msg: '请选择要取消的人员!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
Ext.Msg.wait('正在操作数据...');
if (feeGidSql != '') {
Ext.Ajax.request({
waitMsg: '正在操作数据...', //'正在删除数据...',
url: '/MvcShipping/MsInfoClient/DelCustRange',
params: {
cust: jsonbodyAddDatas,
op: feeGidSql,
seltype: 2
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.treestoreCustRange.load({
params: {
PARENTID: '-1', condition: _this.sqlCustcontext
},
waitMsg: "正在查询数据...",
scope: this
});
Ext.Msg.hide();
}
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
} else {
Ext.Msg.show({ title: '提示', msg: "删除成功!", icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
},
//end initUIComponents
onClearSql: function () {
var form = this.formSearch.getForm();
form.reset();
}, //onDeleteClick
OpenSearch() {
this.onClearSql();
var form = this.formSearch.getForm();
form.findField('MblNo').setValue(this._SHORTNAME);
this.onRefreshClick();
},
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 '';
}
this.isShowAdvancedQuery = 0;
//
var sql = '';
//#region formSearch 查询面板
var MblNo = form.findField('MblNo').getValue();
sql = sql + getAndConSql(sql, MblNo, "(CODENAME like '%" + MblNo + "%' or SHORTNAME like '%" + MblNo + "%')");
var ATTN = form.findField('ATTN').getValue();
sql = sql + getAndConSql(sql, ATTN, "GID IN (SELECT LINKID FROM info_client_contact where SHOWNAME like '%" + ATTN + "%')");
var ETDbgn = form.findField('ETDbgn').getRawValue();
sql = sql + getAndConSql(sql, ETDbgn, "OPTIME >='" + ETDbgn + "'");
var ETDend = form.findField('ETDend').getRawValue();
sql = sql + getAndConSql(sql, ETDend, "OPTIME <='" + ETDend + "'");
var CODENO = form.findField('CODENO').getValue();
sql = sql + getAndConSql(sql, CODENO, "(FARCODE like '%" + CODENO + "%' or FAPCODE like '%" + CODENO + "%' or ORDERNO like '%" + CODENO + "%')");
var CUSTFULLNAME = form.findField('CUSTFULLNAME').getValue();
sql = sql + getAndConSql(sql, CUSTFULLNAME, "[DESCRIPTION] like '%" + CUSTFULLNAME + "%' ");
var ISADVANCEDPAY = form.findField('ISADVANCEDPAY').getValue();
if (ISADVANCEDPAY == '1') {
sql = sql + getAndConSql(sql, ISADVANCEDPAY, " SHORTNAME in (SELECT SHORTNAME from info_client_range )");
}
if (ISADVANCEDPAY == '0') {
sql = sql + getAndConSql(sql, ISADVANCEDPAY, " SHORTNAME not in (SELECT SHORTNAME from info_client_range )");
}
//var StrAudit = " EXISTS (select 1 from ch_fee left join workflow_using wu on wu.bsno=ch_fee.GID where v_op_bill.BSNO=ch_fee.BSNO and dbo.[GetUsingStep](wu.WORKFLOWID,wu.currentid,'" + userid + "',wu.stepno)>0) ";
//#endregion formSearch
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);
},
//客户名称更改
UpdateCustomersWith: function (button, event) {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.QingXianXuanZeXinXi, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //'请先选择要的客户!'
return;
}
//
if ((USERID == "1BEC90E1-9780-472F-90C2-0C6390C044A4") || (usercode == "ADMIN") || (SHOWNAME == "系统管理员") || (SHOWNAME == "Admin")) {
var record = selections[0];
var selectedId = record.data.GID;
var URLs = "../shipping/ExchangesUnitUpdate.aspx?id=" + selectedId;
ret = window.open(URLs, Zi.LAN.UpdateCustomersWith, "height=300, width=700, toolbar=no, menubar=no,scrollbars=no, resizable=0,location=no, status=no,Top= " + (screen.height - 300) / 2 + ",Left= " + (screen.width - 700) / 2);
}
else {
Ext.Msg.show({ title: Zi.LAN.JingGao, msg: Zi.LAN.QuanXianBuZuBuYunXuCaoZuo, icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); //'请联系系统管理员,其他人员无操作权限!'
return;
}
},
//重复客户合并
RepeatCustomersWith: function (button, event) {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.QingXianXuanZeXinXi, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //'请先选择要的客户!'
return;
}
//
if ((USERID == "1BEC90E1-9780-472F-90C2-0C6390C044A4") || (usercode == "ADMIN") || (SHOWNAME == "系统管理员") || (SHOWNAME == "Admin")) {
var record = selections[0];
var selectedId = record.data.GID;
var URLs = "../shipping/ExchangesUnitRepeat.aspx?id=" + selectedId;
ret = window.open(URLs, Zi.LAN.RepeatCustomersWith, "height=300, width=700, toolbar=no, menubar=no,scrollbars=no, resizable=0,location=no, status=no,Top= " + (screen.height - 300) / 2 + ",Left= " + (screen.width - 700) / 2);
}
else {
Ext.Msg.show({ title: Zi.LAN.JingGao, msg: Zi.LAN.QuanXianBuZuBuYunXuCaoZuo, icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); //'请联系系统管理员,其他人员无操作权限!'
return;
}
}
, onStartClick: function () {
//this.onSaveClick();
var selections = this.gridList.getSelectionModel().getSelection();
var bodyList = [];
for (i = 0; i < selections.length; i += 1) {
var member = selections[i];
if (member.data.BLSTATUSREF != "录入状态" && member.data.BLSTATUSREF != "驳回提交") {
alert(Zi.LAN.ZhiNengTiJiaoLuRuZhuangTaiHuoBoHuiTiJiaoDeWangLaiDanWei); //"只能提交 录入状态 或 驳回提交 的往来单位"
} else {
bodyList.push(member);
}
};
var jsonBody = ConvertRecordsToJsonAll(bodyList);
if (jsonBody == '') {
return;
}
Ext.Ajax.request({
waitMsg: Zi.LAN.ZhengZaiCaoZuoShuJu,
url: '/MvcShipping/MsInfoClient/IC_Start',
params: {
USERID: USERID,
data: jsonBody
},
callback: function (options, success, response) {
if (success) {
this.onRefreshClick();
}
},
failure: function (response, options) {
Ext.Msg.show({ title: Zi.LAN.JingGao, msg: Zi.LAN.FuWuQiXiangYingChuCuo, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) { },
scope: this
}); //end Ext.Ajax.request
}
, onBackClick: function (REASON) {
var selections = this.gridList.getSelectionModel().getSelection();
var bodyList = [];
for (i = 0; i < selections.length; i += 1) {
var member = selections[i];
if (member.data.BLSTATUSREF != "提交审核") {
alert(Zi.LAN.ZhiNengCheHuiTiJiaoShenHeDeWangLaiDanWei); //"只能撤回 提交审核 的往来单位"
} else {
bodyList.push(member);
}
};
var jsonBody = ConvertRecordsToJsonAll(bodyList);
if (jsonBody == '') {
return;
}
Ext.Ajax.request({
waitMsg: Zi.LAN.ZhengZaiCaoZuoShuJu,
url: '/MvcShipping/MsInfoClient/IC_Back',
params: {
USERID: USERID,
data: jsonBody,
REASON: REASON
},
callback: function (options, success, response) {
if (success) {
this.onRefreshClick();
}
},
failure: function (response, options) {
Ext.Msg.show({ title: Zi.LAN.JingGao, msg: Zi.LAN.FuWuQiXiangYingChuCuo, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) { },
scope: this
}); //end Ext.Ajax.request
}
, onAuditBackClick: function (REASON) {
//this.onSaveClick();
var selections = this.gridList.getSelectionModel().getSelection();
var bodyList = [];
for (i = 0; i < selections.length; i += 1) {
var member = selections[i];
if (member.data.BLSTATUSREF != "提交审核" && member.data.BLSTATUSREF != "审核通过") {
alert(Zi.LAN.ZhiNengBoHuiTiJiaoShenHeHuoShenHeTongGuoDeWangLaiDanWei); //"只能驳回 提交审核 或 审核通过 的往来单位"
} else {
bodyList.push(member);
}
};
var jsonBody = ConvertRecordsToJsonAll(bodyList);
if (jsonBody == '') {
return;
}
Ext.Ajax.request({
waitMsg: Zi.LAN.ZhengZaiCaoZuoShuJu,
url: '/MvcShipping/MsInfoClient/IC_AuditBack',
params: {
USERID: USERID,
data: jsonBody
},
callback: function (options, success, response) {
if (success) {
this.onRefreshClick();
}
},
failure: function (response, options) {
Ext.Msg.show({ title: Zi.LAN.JingGao, msg: Zi.LAN.FuWuQiXiangYingChuCuo, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) { },
scope: this
}); //end Ext.Ajax.request
}
, onAuditClick: function () {
//this.onSaveClick();
var selections = this.gridList.getSelectionModel().getSelection();
var bodyList = [];
for (i = 0; i < selections.length; i += 1) {
var member = selections[i];
if (member.data.BLSTATUSREF != "提交审核") {
alert(Zi.LAN.ZhiNengShenHeTiJiaoShenHeDeWangLaiDanWei); //"只能审核 提交审核 的往来单位"
} else {
bodyList.push(member);
}
};
var jsonBody = ConvertRecordsToJsonAll(bodyList);
if (jsonBody == '') {
return;
}
Ext.Ajax.request({
waitMsg: Zi.LAN.ZhengZaiCaoZuoShuJu,
url: '/MvcShipping/MsInfoClient/IC_Audit',
params: {
USERID: USERID,
data: jsonBody
},
callback: function (options, success, response) {
if (success) {
//this.winQCShow.close();
//Ext.getCmp("REASON").setValue("");
this.onRefreshClick();
}
},
failure: function (response, options) {
Ext.Msg.show({ title: Zi.LAN.JingGao, msg: Zi.LAN.FuWuQiXiangYingChuCuo, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) { },
scope: this
}); //end Ext.Ajax.request
}
, ClientClick(dataview, record, item, index, e, b) {
this.SelectedRecord = record;
this.OprationStatus = 'edit';
this.sqlCustcontext = " ((TYPE='2' AND GID IN (SELECT USERID FROM info_client_range WHERE SHORTNAME='" + record.data.SHORTNAME + "')) OR (TYPE='1' AND GID IN (SELECT deptgid FROM VW_user WHERE USERID IN (SELECT USERID FROM info_client_range WHERE SHORTNAME='" + record.data.SHORTNAME + "'))) "
+ " OR (TYPE='0' AND GID IN (SELECT COMPANYID FROM VW_user WHERE USERID IN (SELECT USERID FROM info_client_range WHERE SHORTNAME='" + record.data.SHORTNAME + "'))) )";
// this.treestoreCustRange.load
this.treestoreCustRange.load({
params: {
PARENTID: '-1', condition: _this.sqlCustcontext
},
waitMsg: "正在查询数据...",
scope: this
});
}
});