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/SysMng/ViewJs/SysRoleTaskQuery/SysRoleTaskQueryIndex.js

732 lines
25 KiB
JavaScript

Ext.namespace('Shipping');
Shipping.SysRoleTaskQueryIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.SysRoleTaskQueryIndex.superclass.constructor.call(this);
var GID = getQueryString("GID");
//var p_hblno = getQueryString("p_hblno");
if (GID != null) {
this.formSearch.getForm().findField('GID').setValue(GID);
}
this.onRefreshClick();
};
var allowSend = 1;
Ext.extend(Shipping.SysRoleTaskQueryIndex, Ext.Panel, {
PageSize: 50,
SelectedRecord: null,
initUIComponents: function () {
this.formname = "formSysRoleTaskQueryIndex"; //页面名称
var me = this;
//定义数据集
// this.storeOPSeaeClientModel = Ext.create('DsExt.ux.RefTableStore', {
// model: 'DsShipping.ux.OPSeaeClient',
// proxy: { url: '/CommMng/BasicDataRef/GetCtnDisp' }
// });
this.storeList = Ext.create('Ext.data.Store', {
model: 'SysRoleTaskQueryModel',
remoteSort: false,
proxy: {
type: 'ajax',
url: '/SysMng/SysRoleTaskQuery/GetDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#region List列表显示信息
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 30
});
this.Pagenum = Ext.create('Ext.form.field.Number', {
name: 'bottles',
fieldLabel: '每页记录数',
labelAlign: 'right',
value: this.PageSize,
maxValue: 2000,
width: 180,
minValue: 0,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.initgirdcolums = [
{
sortable: true,
dataIndex: 'GID',
text: 'GID',
width: 100,hidden:true
}, {
sortable: true,
dataIndex: 'RoleId',
text: 'RoleId',
width: 100, hidden: true
},
{
sortable: true,
dataIndex: 'RoleName',
text: '角色名称',
width: 100
},
{
sortable: true,
dataIndex: 'FormName',
text: 'JS_FormName',
width: 100
},
{
sortable: true,
dataIndex: 'MODNAME',
text: '模块名称(sysmodel)',
width: 100
},
{
sortable: true,
dataIndex: 'BSTYPE',
text: '工作台项目名称',
width: 100
},
{
sortable: true,
2 years ago
dataIndex: 'SQLSTR',
text: '登陆者过滤',
width: 100
},
{
sortable: true,
dataIndex: 'URL',
text: 'URL',
width: 100
},
{
sortable: true,
dataIndex: 'FIELDVALUES',
text: 'FIELDVALUES',
width: 100,hidden:true
},
{
sortable: true,
dataIndex: 'SQLCONTEXT',
2 years ago
text: '查询子句',
width: 200
}, {
sortable: true,
id: '',
dataIndex: 'COMPANYID',
header: '分公司', //'整票状态',
width: 120,
renderer: function (value, cellmeta, record, rowIndex) {
if (value) {
var companyname = _this.GetCompanyInfo( value);
if (companyname )
//cellmeta.style = "background-color:" + statusrecord.COLOR;
return companyname;
}
}
}
];
this.girdcolums = this.initgirdcolums;
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
//定义Grid
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.GridCheckBoxModel,
viewConfig: {
enableTextSelection: 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,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
}), this.Pagenum]
});
/////////////以下部分为获取存储的gridpanel显示样式
this.girdcolums = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums, 0); //使用者id表名中间column数组跳过一开始的几列
this.girdcolums.unshift(new Ext.grid.RowNumberer());
this.gridList.reconfigure(this.storeList, this.girdcolums);
////////////////////////////////////////////////
this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
this.SelectedRecord = record;
this.OprationStatus = 'edit';
var GID = record.get('GID');
2 years ago
var SHORTNAME = record.get('BSTYPE');
var queryString = "?GID=" + GID + "&opstatus=edit";
var exTabArr = this.mainTab.items.items;
for (var i = 0; i < exTabArr.length; i++) {
if (exTabArr[i].id == GID) {
this.mainTab.setActiveTab(GID);
return;
}
}
this.mainTab.insert(this.mainTab.items.length, {
title: SHORTNAME,
id: GID,
html: '<iframe scrolling="auto" frameborder="0" width="100%" height="100%" src="/SysMng/SysRoleTaskQuery/Edit' + queryString + '"></iframe>',
closable: true
});
this.mainTab.setActiveTab(GID);
}, this);
//#endregion
//录入人
//this.comboxINPUTBY = Ext.create('DsExt.ux.RefTableCombox', {
// fieldLabel: '录入人',
// store: this.storeOpCode,
// forceSelection: true,
// name: 'INPUTBY',
// valueField: 'UserName',
// displayField: 'CodeAndName',
// listeners: {
// specialkey: function (field, e) {
// if (e.getKey() == e.ENTER) {
// _this.onRefreshClick();
// }
// }
// }
//});
this.storeCompany = Ext.create('DsExt.ux.RefTableStore', {
model: 'companymb', proxy: { url: '/CommMng/BasicDataRef/GetcompanyList' }
});
this.storeCompany.load({
params: { condition: "" },
//callback: function (options, success, response) {
// if (success) {
// this.storeCompany({});
// }
//}
});
this.comboxCompany = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '分公司',
//allowBlank: false,
forceSelection: true,
store: this.storeCompany,
name: 'COMPANYID',
valueField: 'gid',
displayField: 'name',
listeners: {
scope: this,
//blur: function (field, The, eOpts) {
// //field.setRawValue(field.value);
//}
//,
//beforequery: function (e) {
// //return FilterCombox(e, 2);//在beforequery使用此方法
//},
specialkey: function (field, e) {
//if (e.getKey() == e.ENTER) {
// e.keyCode = 9;
//}
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeRole = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.GeneralValue',
proxy: { url: '/CommMng/BasicDataRef/GetRoleList' }
});
this.storeRole.load({ params: { condition: "" } });
this.comboxRole = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: "角色", //'卸货港',
store: this.storeRole,
name: 'RoleId',
matchFieldWidth: false,
// forceSelection: true,
valueField: 'GID',
queryMode: 'local',
//queryMode: 'remote',
//minChars: 2,
//queryParam: 'RoleName',
displayField: 'GVALUE',
listeners: {
scope: this,
//blur: function (field, The, eOpts) {
// //field.setRawValue(field.value);
//}
//,
//beforequery: function (e) {
// //return FilterCombox(e, 2);//在beforequery使用此方法
//},
specialkey: function (field, e) {
//if (e.getKey() == e.ENTER) {
// e.keyCode = 9;
//}
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//#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: 80,
msgTarget: 'qtip'
},
items: [{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
_this.comboxCompany,
_this.comboxRole,
{
fieldLabel: 'Js_FormName',
name: 'FormName',
listeners: {
change: function (field, newValue, oldValue) {
//var str = newValue.replace(/(^\s*)|(\s*$)/g, "");
//_this.formSearch.getForm().findField('CODENAME').setValue(str);
},
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
},
{
fieldLabel: '工作台项目名称',
name: 'BSTYPE',
listeners: {
change: function (field, newValue, oldValue) {
//var str = newValue.replace(/(^\s*)|(\s*$)/g, "");
//_this.formSearch.getForm().findField('SHORTNAME').setValue(str);
},
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: []
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: []
}]//end items(fieldset 1)
}]//end root items
});
//#endregion formSearch
_this = this;
//按钮工具条
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [{
text: "新增",
iconCls: "btnadd",
handler: function (button, event) {
this.SelectedRecord = '';
this.OprationStatus = 'add';
let newgid='*'
var queryString = "?GID="+newgid+"&opstatus=add";
this.mainTab.insert(1, {
//title: '新Tab ' + (++index),
title: '新建工作台待办事项',
id: newgid,
html: ' <iframe scrolling="auto" frameborder="0" width="100%" height="100%" src="/SysMng/SysRoleTaskQuery/Edit' + queryString + '"></iframe>',
// loader: { url:'/MvcShipping/MsOpSeaeEdi/CustomEdit', loadMask: 'loading...', autoLoad: true, scripts: true },
closable: true
});
this.mainTab.setActiveTab(newgid);
//DsOpenEditWin('/MvcShipping/MsOpSeaeEdi/CustomEdit');
},
scope: this
}, {
text: "删除",
iconCls: "btndelete",
handler: function (button, event) {
this.onDeleteClick(button, event);
},
scope: this
}, '-', {
text: "重置条件",
iconCls: "btnreset",
handler: function (button, event) {
this.onClearSql(button, event);
},
scope: this
}, '-', {
text: "保存列表样式",
id: "btntest",
menu: [
{
text: "保存",
handler: function (button, event) {
_this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridList.columns, _this.initgirdcolums, 0, 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, 0, true);
}
}],
scope: this
}, '-', {
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
}, '-'
]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
bodyStyle: 'border-width:0 0 0 0;',
height: 70,
items: [this.panelBtn, this.formSearch]
});
this.panelMainList = new Ext.Panel({
layout: "border",
region: "north",
bodyStyle: 'border-width:0 0 0 0;',
title: "工作台待办事项",
items: [this.panelTop, this.gridList],
listeners: {
'show': function (t, eOpts) {
me.onRefreshClick(null, null);
}
}
});
this.mainTab = new Ext.TabPanel({
id: 'mainTabPanel',
bodyStyle: 'border-width:0 0 0 0;',
enableTabScroll: true,
closeAll: true,
activeTab: 0,
region: 'center',
resizeTabs: true,
items: [this.panelMainList]
});
Ext.apply(this, {
items: [this.mainTab]
});
this.storeList.on('beforeload', function (store) {
var sql = this.getCondition();
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
this.formDownloadShow = 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',
id: 'downloadfile',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'label',
html: '',
width: 120,
text: ''
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
}, //end initUIComponents
onRefreshClick: function (button, event) {
//let newrecord = { GID: "1", CODENAME: "codename" };
//this.storeList.add(newrecord);
var sql = this.getCondition();
this.PageSize = this.Pagenum.getValue();
this.storeList.pageSize = this.PageSize;
this.storeList.currentPage = 1;
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
//权限
},
onDeleteClick: function (button, event) {
var selectedRecords = this.gridList.getSelectionModel().getSelection();
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var GID = selectedRecords[0].data.GID;
Ext.MessageBox.confirm('提示', '确定删除选中记录吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/SysMng/SysRoleTaskQuery/DelHead',
params: {
GID: GID
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
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);
},
onOpenClick: function (button, event) {
var selectedRecords = this.gridList.getSelectionModel().getSelection();
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var bsnos = '';
this.SelectedRecord = selectedRecords[0];
this.OprationStatus = 'edit';
var mfno = this.SelectedRecord.get('MFNO');
var hblno = this.SelectedRecord.get('HBLNO');
var mblno = this.SelectedRecord.get('MBLNO');
var lno = '';
if (hblno != '') {
lno = hblno;
} else {
lno = mblno;
}
var queryString = "?mfno=" + mfno + "&opstatus=edit";
var exTabArr = this.mainTab.items.items;
for (var i = 0; i < exTabArr.length; i++) {
if (exTabArr[i].id == mfno) {
this.mainTab.setActiveTab(mfno);
return;
}
}
this.mainTab.insert(this.mainTab.items.length, {
//title: '新Tab ' + (++index),
title: lno,
id: mfno,
html: '<iframe scrolling="auto" frameborder="0" width="100%" height="100%" src="/MvcShipping/OPSeaeClient/Edit' + queryString + '"></iframe>',
// loader: { url:'/MvcShipping/OPSeaeClient/CustomEdit', loadMask: 'loading...', autoLoad: true, scripts: true },
closable: true
});
this.mainTab.setActiveTab(mfno);
},
onClearSql: function () {
var form = this.formSearch.getForm();
form.reset();
}, //onDeleteClick
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = { COMPANYID: "", RoleId: "", BSTYPE: "" };
//#region formSearch 查询面板
//编号包括(主提单号)
var COMPANYID = form.findField('COMPANYID').getValue();
sql.CODENAME = COMPANYID;
sql.RoleId = form.findField('RoleId').getValue();
//sql.MODCNNAME = form.findField('MODCNNAME').getValue();
sql.BSTYPE = form.findField('BSTYPE').getValue();
return Ext.JSON.encode(sql);
},
setIsShowAdvancedQuery: function () {
if (this.isShowAdvancedQuery == 0) {
this.panelSearch.show();
this.isShowAdvancedQuery = 1;
} else {
this.panelSearch.hide();
this.isShowAdvancedQuery = 0;
}
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
//ret[3] = this.IsAudit;
//ret[4] = this.BillType;
//ret[5] = this.OrType;
return ret;
}
//#endregion
,GetCompanyInfo: function (CORPID) {
var company = getStoreRecordsByFieldValue(this.storeCompany, "GID", CORPID)
if (company.length > 0) {
return company[0].get("NAME");
} else {
return "";
}
}
});
function getQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]); return null;
}
function openMap(url, mblno) {
var myPanel = new Ext.Panel({
layout: 'fit',
bodyStyle: 'background:#ffffff;',
html: "<iframe src='" + url + "' width=\"100%\" height=\"100%\"></iframe>",
frame: true
});
var win = new Ext.Window({
title: mblno,
width: 710,
height: 400,
resizable: false,
closable: true,
draggable: true,
resizable: false,
layout: 'fit',
modal: false,
plain: false, // 表示为渲染window body的背景为透明的背景
bodyStyle: 'padding:5px;',
items: [myPanel],
buttonAlign: 'center',
buttons: [{
text: '关闭',
type: 'button',
handler: function () {
win.close();
}
}]
});
win.show();
}