ETX常用操作例子

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<%
String path = request.getContextPath();
response.setHeader("P3P", "CP=CAO PSA OUR");
%>
<head>
<title>权限管理页面</title>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css"
href="<%=path%>/ext/resources/css/ext-all.css" />
<link rel="stylesheet" type="text/css"
href="<%=path%>/controlpanel/css/desktop.css" />
<!-- GC -->
<!-- LIBS -->
<script type="text/javascript"
src="<%=path%>/ext/adapter/ext/ext-base.js"></script>
<!-- ENDLIBS -->
<script type="text/javascript" src="<%=path%>/ext/ext-all.js"></script>
<script type="text/javascript">

Ext.onReady(function() {

Ext.QuickTips.init();

var customservice_rn = null;//行序列
var customservice_sm = null;//复选框
var customservice_cm = null;//用户信息表格列模型
var customservice_bbar = null;//用户信息分页条
var customservice_ds = null;//用户信息数据源
var customservice_grid = null;//用户信息Grid对象

var customservice_query_form = null;//搜索Form对象
//窗口对象
var roleuserinfo_add_form = null;//管理用户权限表单
var roleuserinfo_add_window = null;//管理用户角色详情窗口
var roleuserinfo_window = null;

var crm_roleuserinfo_detail_form = null;//CRM权限列表表单
var crm_roleuserinfo_detail_window = null;//CRM权限列表表单

var roleinfo_cmb = null;//角色下拉框
var roleinfo_ds = null;//角色数据源

var dictionary_cmb = null;//营业部下拉框
var dictionary_ds = null;//营业部数据源


var roleuserinfo_loadmask = new Ext.LoadMask(Ext.getBody(), {
msg : "正在处理,请稍候..."
});

//设置用户信息行序列
customservice_rn = new Ext.grid.RowNumberer();

//设置复选框
customservice_sm = new Ext.grid.CheckboxSelectionModel({
singleSelect:false //设置复选
});

//初始化列标题
customservice_cm = new Ext.grid.ColumnModel([
customservice_rn,
//customservice_sm,
{
header: "用户名",
width: 100,
sortable: false,
dataIndex: 'name',
menuDisabled : true
},
{
header: "真实姓名",
width: 100,
sortable: false,
dataIndex: 'realName',
menuDisabled : true
},
{
header: "营部门名称",
width: 100,
sortable: false,
dataIndex: 'branchName',
menuDisabled : true
},
{
header: "电子邮件",
width: 100,
sortable: false,
dataIndex: 'email',
menuDisabled : true
},
{
header: "手机号码",
width: 100,
sortable: false,
dataIndex: 'mobile',
menuDisabled : true
},
{
header: "操作",
width: 100,
align: 'center',
dataIndex: 'id',
renderer:function(value, cellmeta, record, rowIndex, columnIndex, store){
return "<a href='#' title='管理权限' onclick='roleuserinfo_add_function(\"" + record.data['id'] + "\")'><img src='<%=path%>/shared/icons/fam/plugin.gif'></a>";
},
menuDisabled : true
}
]);

//数据源绑定
customservice_ds = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({url:"<%=path%>/customServiceAction.do?method=getAllCustomService"}),
reader: new Ext.data.JsonReader({
root:'customServiceList',
totalProperty : 'customServiceTotal'
},
[
{name: 'id',mapping: 'id',type: 'int'},
{name: 'name',mapping: 'name',type: 'string'},
{name: 'realName',mapping: 'realName',type: 'string'},
{name: 'employeeId',mapping: 'employeeId',type: 'string'},
{name: 'provinceId',mapping: 'provinceId',type: 'string'},
{name: 'refId',mapping: 'refId',type: 'string'},
{name: 'email',mapping: 'email',type: 'string'},
{name: 'mobile',mapping: 'mobile',type: 'string'},
{name: 'branchName',mapping: 'branchName',type: 'string'}
])
});

//分页导航
customservice_bbar = new Ext.PagingToolbar({
pageSize: 15,
store: customservice_ds,
displayInfo: true,
displayMsg: '显示第 {0} 条到 {1} 条记录,一共 {2} 条',
emptyMsg: "没有记录",
afterPageText: '/ {0}',
beforePageText: '页',
firstText: '首页',
prevText: '上一页',
nextText: '下一页',
lastText: '尾页',
refreshText: '刷新'
});

//数据表格对象
customservice_grid = new Ext.grid.GridPanel({
renderTo:'authority_grid_context',
border:false,
ds: customservice_ds,
cm: customservice_cm,
//width:730,
//height:440,
width:Ext.getBody().getWidth(),
height:Ext.getBody().getHeight()-45,
region:'center',
frame:false,
resizable:false,
collapsible: false,
viewConfig: {
forceFit:true
},
bbar: customservice_bbar
});

roleinfo_ds = new Ext.data.Store({
//autoLoad : true,
//baseParams : {
// start:0,
// limit:1000
//},
proxy: new Ext.data.HttpProxy({url:"<%=path%>/roleInfoAction.do?method=getAllRoleInfo"}),
reader: new Ext.data.JsonReader({
root:'roleInfoList',
totalProperty : 'roleInfoTotal'
},
[
{name: 'id',mapping: 'id',type: 'int'},
{name: 'roleCode',mapping: 'roleCode',type: 'string'},
{name: 'name',mapping: 'name',type: 'string'}
])
});

roleinfo_ds.load({params:{start:0, limit:1000}});

dictionary_ds = new Ext.data.Store({
//autoLoad : true,
//baseParams : {
// start:0,
// limit:1000
//},
proxy: new Ext.data.HttpProxy({url:"<%=path%>/dictionaryAction.do?method=getAllDictionary"}),
reader: new Ext.data.JsonReader({
root:'dictionaryList'
},
[
{name: 'id',mapping: 'id',type: 'int'},
{name: 'keyCode',mapping: 'keyCode',type: 'string'},
{name: 'keyName',mapping: 'keyName',type: 'string'}
])
});

dictionary_ds.load();

roleinfo_cmb = new Ext.form.ComboBox({
id:'customservice_query_roleCode',
name:'customservice_query_roleCode',
fieldLabel: '角色名称',
width:80,
xtype:'combo',
typeAhead: true,
//readOnly:true,
store:roleinfo_ds,
loadingText: '',
valueField: 'id',
displayField:'name',
mode: 'remote',
triggerAction: 'all',
editable:false,
emptyText: '所有',
selectOnFocus:true,
forceSelection: true,
value: '',
resizable:true
});

dictionary_cmb = new Ext.form.ComboBox({
id:'customservice_query_branchId',
name:'customservice_query_branchId',
fieldLabel: '营业部',
width:80,
xtype:'combo',
typeAhead: true,
//readOnly:true,
store:dictionary_ds,
loadingText: '',
valueField: 'keyCode',
displayField:'keyName',
mode: 'remote',
triggerAction: 'all',
editable:false,
emptyText: '所有',
selectOnFocus:true,
forceSelection: true,
value: '',
resizable:true
});


customservice_query_form = new Ext.FormPanel({
renderTo:'authority_query_context',
//width: 730,
width:Ext.getBody().getWidth(),
height:45,
border:false,
//bodyStyle:'padding:8px 8px;',
frame:true,
region:'north',
layout:'column',
items:[{
layout:'form',
border:false,
width:150,
labelWidth:50,
items:[{
xtype:'textfield',
id: 'customservice_query_name',
name: 'customservice_query_name',
fieldLabel: '用户名',
width:80
}]
},{
layout:'form',
border:false,
width:160,
labelWidth:60,
items:[{
xtype:'textfield',
id: 'customservice_query_realName',
name: 'customservice_query_realName',
fieldLabel: '真实姓名',
width:80
}]
},{
layout:'form',
border:false,
width:150,
labelWidth:50,
items:dictionary_cmb
},{
layout:'form',
border:false,
width:160,
labelWidth:60,
items:roleinfo_cmb
},{
layout:'form',
border:false,
labelWidth:10,
width:40,
items:[{
xtype:'button',
text:'查询',
labelWidth:10,
handler:function(){
var _customservice_query_name = Ext.get('customservice_query_name').getValue();
var _customservice_query_realName = Ext.get('customservice_query_realName').getValue();
var _customservice_query_branchId = Ext.getCmp('customservice_query_branchId').getValue();
var _customservice_query_roleCode = Ext.getCmp('customservice_query_roleCode').getValue();
customservice_ds.baseParams["query_name"] = _customservice_query_name;
customservice_ds.baseParams["query_realName"] = _customservice_query_realName;
customservice_ds.baseParams["query_branchId"] = _customservice_query_branchId;
customservice_ds.baseParams["query_roleCode"] = _customservice_query_roleCode;
customservice_ds.load({params:{start:0, limit:15}});
}
}]
},{
layout:'form',
border:false,
labelWidth:10,
width:40,
items:[{
xtype:'button',
text:'清空',
labelWidth:10,
handler:function(){
//customservice_query_form.getForm().reset();
Ext.getCmp('customservice_query_name').setValue(null);
Ext.getCmp('customservice_query_realName').setValue(null);
Ext.getCmp('customservice_query_branchId').setValue(null);
Ext.getCmp('customservice_query_roleCode').setValue(null);
customservice_ds.baseParams["query_name"] = "";
customservice_ds.baseParams["query_realName"] = "";
customservice_ds.baseParams["query_branchId"] = "";
customservice_ds.baseParams["query_roleCode"] = "";
customservice_ds.load({params:{start:0, limit:15}});
}
}]
}]
});

//创建管理用户权限表单
roleuserinfo_add_form = new Ext.FormPanel({
labelWidth: 200,
frame:true,
bodyStyle:'padding:5px 5px 0',
width: 600,
height:400,
autoScroll:true,
defaults: {width: 200},
defaultType: 'textfield',
modal:true,
layout: 'column'
});

//设置查看用户权限详情窗口
roleuserinfo_add_window = new Ext.Window({
id: 'roleuserinfo_add_window_id',
title: '权限列表',
width: 650,
height:300,
minWidth: 450,
minHeight: 300,
layout: 'fit',
plain:true,
bodyStyle:'padding:0px',
buttonAlign:'center',
closeAction: 'hide',
items: roleuserinfo_add_form,
buttons: [{
id:'roleuserinfo_add_form_btn_modify',
text: '修改',
handler: function(){
roleuserinfo_loadmask.show();
roleuserinfo_modify_function(roleuserinfo_add_form.id);
Ext.getCmp('roleuserinfo_add_form_btn_modify').disable();
}
},{
text: '取消',
handler:function(){
roleuserinfo_add_window.hide();
}
}]
});

//创建管理用户权限表单
crm_roleuserinfo_detail_form = new Ext.FormPanel({
labelWidth: 200,
frame:true,
bodyStyle:'padding:5px 5px 0',
width: 600,
height:400,
autoScroll:true,
defaults: {width: 200},
defaultType: 'textfield',
modal:true,
layout: 'column'
});

//设置查看用户CRM权限详情窗口
crm_roleuserinfo_detail_window = new Ext.Window({
id: 'crm_roleuserinfo_detail_window_id',
title: 'CRM权限列表',
width: 450,
height:300,
minWidth: 450,
minHeight: 300,
layout: 'fit',
plain:true,
bodyStyle:'padding:0px',
buttonAlign:'center',
closeAction: 'hide',
items: crm_roleuserinfo_detail_form,
buttons: [{
text: '关闭',
handler:function(){
crm_roleuserinfo_detail_window.hide();
}
}]
});


crm_roleuserinfo_detail_function = function(refId){

// 先删除原来的,防止重复
for(var i= crm_roleuserinfo_detail_form.items.length-1;i>=0; i--){
crm_roleuserinfo_detail_form.remove(crm_roleuserinfo_detail_form.items.get(i));
}

Ext.Ajax.request({
url:'<%=path%>/crmRoleUserInfoAction.do?method=displayCRMRoleUserInfo',
method:'post',
params:{userId: refId},
success:function(form,action){
var obj = Ext.util.JSON.decode(form.responseText);
var jsonObj = obj.crmRoleUserInfoList;
for(var i= 0; i< jsonObj.length; i++){
var stritem = new Ext.form.Label({'text':jsonObj[i].roleName});
crm_roleuserinfo_detail_form.add(stritem).show();
}
crm_roleuserinfo_detail_form.doLayout();
crm_roleuserinfo_detail_form.id = refId;
crm_roleuserinfo_detail_window.show();
},
failure:function(form,action){
crm_roleuserinfo_detail_window.close();
Ext.MessageBox.show({
title: '警告',
msg: '获取CRM权限列表出现异常,未能完成,请重试!',
buttons:{"ok":"确定"},
icon: Ext.MessageBox.ERROR
});
}
});
}

//点击查看用户权限管理按钮事件
roleuserinfo_add_function = function(refId){
// 先删除原来的,防止重复
for(var i= roleuserinfo_add_form.items.length-1;i>=0; i--){
roleuserinfo_add_form.remove(roleuserinfo_add_form.items.get(i));
}

Ext.Ajax.request({
url:'<%=path%>/roleUserInfoAction.do?method=displayRoleUserInfo',
method:'post',
params:{userId: refId},
success:function(form,action){
var obj = Ext.util.JSON.decode(form.responseText);
var jsonObj = obj.roleInfoList;
for(var i= 0; i< jsonObj.length; i++){
var stritem = new Ext.form.Checkbox({'name':'roleIdArray','boxLabel':jsonObj[i].name,'inputValue':jsonObj[i].id, 'checked':jsonObj[i].flag});
roleuserinfo_add_form.add(stritem).show();
}
roleuserinfo_add_form.doLayout();
roleuserinfo_add_form.id = refId;
roleuserinfo_add_window.show();
Ext.getCmp('roleuserinfo_add_form_btn_modify').enable();
},
failure:function(form,action){
roleuserinfo_add_window.close();
Ext.MessageBox.show({
title: '警告',
msg: '获取权限列表出现异常,未能完成,请重试!',
buttons:{"ok":"确定"},
icon: Ext.MessageBox.ERROR
});
}
});
}

//点击查看用户角色详情按钮事件
roleuserinfo_modify_function = function(refId){
var roleIds = '';

for(var i= 0;i< roleuserinfo_add_form.items.length;i++){
var rs = roleuserinfo_add_form.items.get(i);
if(rs.checked == true){
roleIds = roleIds + "," + rs.inputValue;
}
}

Ext.Ajax.request({
url:'<%=path%>/roleUserInfoAction.do?method=modifyRoleUserInfo',
method:'post',
params:{
userId: refId,
roleIds:roleIds
},
success:function(form,action){
var obj = Ext.util.JSON.decode(form.responseText);
if(obj.result==true){
roleuserinfo_loadmask.hide();
roleuserinfo_add_window.hide();
Ext.MessageBox.show({
title: '成功',
msg:'修改权限成功!',
buttons:{"ok":"确定"},
width:250,
icon: Ext.MessageBox.INFO
});
//customservice_ds.reload({params:{start:0, limit:15}});
}else
{
roleuserinfo_loadmask.hide();
roleuserinfo_add_window.hide();
Ext.MessageBox.show({
title: '失败',
msg: '修改权限失败!',
buttons:{"ok":"确定"},
width:250,
icon: Ext.MessageBox.INFO
});
}
},
failure:function(form,action){
roleuserinfo_loadmask.hide();
roleuserinfo_add_window.hide();
Ext.MessageBox.show({
title: '警告',
msg: '修改权限出现异常,未能完成,请重试!',
buttons:{"ok":"确定"},
icon: Ext.MessageBox.ERROR
});
}
});
}

window.onresize = function() {
customservice_query_form.setHeight(45);
customservice_query_form.setWidth(Ext.getBody().getWidth());
customservice_grid.setHeight(Ext.getBody().getHeight()-45);
customservice_grid.setWidth(Ext.getBody().getWidth());
};

//渲染数据表格对象
customservice_grid.render();
//加载数据源对象,传递分页参数
//var _customservice_query_realName = Ext.get('customservice_query_realName').getValue();
//customservice_ds.baseParams["query_realName"] = _customservice_query_realName;
customservice_ds.load({params:{start:0, limit:15}});

});
</script>
</head>
<body>
<div id="authority_grid_context" style="width:100%;" />
<div id="authority_query_context" style="width:100%;" />
</body>
</html>
什么是ASCII码?ASCII码是美国信息交换标准代码的缩写,最初由美国国家标准学会(ANSI)在1960年代提出,旨在为计算机、通信设备之间的数据交换提供统一的字符编码标准。ASCII码使用7位二进制数来表示128个字符,覆盖了包括控制字符、标点符号、数字、字母和一些特殊符号。ASCII码的特点标准化:ASCII为数字、字母和特殊符号提供了统一的编码方案,方便不同系统之间的数据交换。简洁性:采用7位编码,共支持128个字符。扩展性:后续扩展了8位ASCII码(Extended ASCII),支持256个字符,以应对更多语言和符号需求。ASCII码的发展历史1. 早期的字符编码在ASCII码出现之前,不同的计算机厂商和电信系统使用各自的编码方案,如IBM的EBCDIC(扩展二进制编码十进制交换码)。这些编码方案往往只能在特定设备上使用,缺乏互通性,导致设备之间的数据交换困难。2. ASCII的诞生随着计算机和通信行业的迅速发展,亟需一个统一的字符编码标准来实现不同设备之间的数据交换。1963年,美国国家标准学会(ANSI)发布了ASCII码的早期版本,定义了包括26个英文字母(大小写)、10个数字、标点符号和一些控制字符的编码。3. ASCII码的推广与扩展随着时间的推移,ASCII码成为美国及国际上的广泛采用标准。到了1980年代,随着个人电脑的普及和多语言需求的增加,ASCII码扩展为8位(即Extended ASCII),支持256个字符,以便涵盖更多的符号和国际语言字符。4. 现代字符编码标准的发展虽然ASCII码至今仍然在许多场景下被使用,但随着全球化的发展和多语言支持需求的增加,Unicode等更为通用的编码标准得到了广泛应用。然而,ASCII码作为字符编码的基础,依然是其他编码标准的重要组成部分。ASCII码的基本结构ASCII码由7位二进制数表示,每个字符的二进制值可以从0到127。其结构大致分为以下几类:控制字符(0–31和127):控制字符用于管理数据流,例如回车(Carriage Return, CR)、换行(Line Feed, LF)等。可打印字符(32–126):这些字符包括空格、标点符号、数字、字母等,主要用于文本文字的表示。扩展字符(128–255, Extended ASCII):这部分字符在标准ASCII中并不存在,但在扩展ASCII中被定义,用于支持国际化字符集、图形符号等。控制字符示例0 (NUL):空字符,通常用于字符串的终止。9 (TAB):水平制表符,用于对齐文本。13 (CR):回车符,通常用于光标回到行首。可打印字符示例32:空格字符。65 (A):大写字母A。97 (a):小写字母a。48 (0):数字0。全量ASCII码表解析下面列出ASCII码表中每个字符的对应值及其二进制表示。十进制 二进制 字符 描述0 0000000 NUL 空字符1 0000001 SOH 标题开始2 0000010 STX 正文开始3 0000011 ETX 正文结束… … … …65 1000001 A 大写字母A66 1000010 B 大写字母B67 1000011 C 大写字母C… … … …97 1100001 a 小写字母a98 1100010 b 小写字母b99 1100011 c 小写字母c完整ASCII码表可以帮助我们快速查找特定字符的编码值,或者通过编码值反推出具体的字符。ASCII码的应用场景1. 文本文件的存储在文本文件中,每个字符都对应一个ASCII码。例如,文本文件中存储的字符串"Hello",实际上在底层被编码为72 101 108 108 111。2. 网络通信ASCII码广泛用于网络协议中的数据传输。例如,HTTP协议中的请求和响应头信息都采用ASCII编码。3. 编程语言的字符串处理在编程语言中,字符串的底层通常使用ASCII编码。例如,在C语言中,字符串实际上是一个以NUL字符结束的ASCII字符数组。4. 控制字符在终端和打印机中的应用ASCII码中的控制字符广泛应用于早期的终端和打印机控制,例如换行符(LF)和回车符(CR)用来控制输出的格式。ASCII码与其他编码标准的关系1. 与Unicode的关系Unicode是现代字符编码的主流标准,支持几乎所有语言的字符。ASCII码作为其子集,Unicode中前128个字符与ASCII码保持完全一致。也就是说,在支持Unicode的系统中,ASCII字符可以直接兼容使用。2. 与扩展ASCII的关系扩展ASCII(Extended ASCII)通过使用8位编码扩展了原有的ASCII码,新增了128个字符,用于表示更多的符号和国际化字符。然而,扩展ASCII并没有得到统一的标准,具体字符集可能因地区或操作系统而异。3. 与EBCDIC的区别EBCDIC(扩展二进制编码十进制交换码)是IBM在早期大型机系统中使用的一种编码方式,与ASCII完全不同。EBCDIC的字符顺序与ASCII不兼容,虽然它也使用7位或8位编码,但字符的排列和用途完全不同。结语ASCII码作为字符编码的基础标准,尽管在全球化和多语言支持的背景下逐渐被Unicode等更为广泛的编码标准取代,但它仍然在许多计算机系统中扮演着重要的角色。掌握ASCII码表及其应用,可以帮助开发者更好地理解计算机系统中的字符处理机制,提高编程效率。在现代计算机中,了解ASCII不仅是基础知识,还能帮助我们更好地理解其他复杂的字符编码标准,为更高效的系统设计和编码实践打下坚实的基础。希望通过这篇文章,大家能对ASCII码有更深入的认识,并能在实际开发中应用这些知识。
最新发布
04-08
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值