code stringlengths 1 2.08M | language stringclasses 1 value |
|---|---|
/**
* 角色授权窗口
*
* @param {}
* roleId
*/
var RoleGrantRightView = function(roleId,roleName) {
var roleGrantView = new Ext.ux.tree.CheckTreePanel({
title : '为角色['+roleName+']授权',
id : 'roleGrantView',
autoScroll : true,
rootVisible : false,
loader : new Ext.app.MenuLoader({
dataUrl : __ctxPath + '/js/menu.xml'
}),
root : new Ext.tree.AsyncTreeNode({
expanded : true
}),
tools : [{
id : 'refresh',
qtip : '重新加载树',
handler : function() {
roleGrantView.getRootNode().reload();
}
}]
});
var granWin = new Ext.Window({
id : 'RoleGrantView',
title : '角色授权设置',
width : 600,
height : 450,
modal : true,
layout : 'fit',
plain : true,
bodyStyle : 'padding:5px;',
buttonAlign : 'center',
items : [roleGrantView],
buttons : [
{
text : '保存',
iconCls:'btn-save',
handler : function() {
//alert(roleGrantView.getValue().toString());
Ext.Ajax.request({
url : __ctxPath + '/system/grantAppRole.do',
method : 'POST',
params:{roleId:roleId,rights:roleGrantView.getValue().toString()},
success : function(response, options) {
Ext.Msg.alert('操作信息','授权成功!');
granWin.close();
},
failure : function(response, options) {
Ext.Msg.alert('操作信息','授权出错,请联系管理员!');
},
scope : this
});
}
},{
text : '取消',
iconCls:'btn-cancel',
handler:function(){
granWin.close();
}
}
]
});
granWin.show();
//load the has the value setttings.
Ext.Ajax.request({
url : __ctxPath + '/system/getAppRole.do',
method : 'POST',
params:{roleId:roleId},
success : function(response, options) {
var object=Ext.util.JSON.decode(response.responseText);
//alert(object.data.rights);
if(object.data.rights!=null){
roleGrantView.setValue(object.data.rights);
}
},
failure : function(response, options) {
Ext.Msg.alert('操作信息','加载权限出错!');
},
scope : this
});
} | JavaScript |
var AppUserForm = function(_title,_userId) {
return this.setup(_title,_userId);
};
AppUserForm.prototype.setup = function(_title,userId) {
var _url = __ctxPath + '/system/listDepartment.do';
var depSelector = new TreeSelector('depTreeSelector', _url, '所属部门',
'appUser.depId');
var footToolbar = this.initFooterToolbar(userId);
var userform = new Ext.form.FormPanel({
id : 'AppUserForm',
title : _title,
closable : true,
iconCls:'menu-customer',
border : false, // 不要边框
fileUpload : true, // 允许上传
autoScroll : true,
bodyStyle : "margin-top:5px;margin-left: 4%; background-color: transparent;",
labelAlign : "right",
layout : 'table',
autoScroll : true,
tbar : footToolbar,
defaultType : "textfield",
layoutConfig:{columns:3},
url : __ctxPath + '/system/saveAppUser.do',
reader : new Ext.data.JsonReader({
root : 'data'
}, [{
name : 'appUser.userId',
mapping : 'userId'
}, {
name : 'appUser.username',
mapping : 'username'
}, {
name : 'appUser.password',
mapping : 'password'
}, {
name : 'appUser.fullname',
mapping : 'fullname'
}, {
name : 'appUser.email',
mapping : 'email'
}, {
name : 'appUser.depName',
mapping : 'department.depName'
}, {
name : 'appUser.accessionTime',
mapping : 'accessionTime'
}, {
name : 'appUserStatus',
mapping : 'status'
},
{
name : 'appUserTitle',
mapping : 'title'
}, {
name : 'appUser.position',
mapping : 'position'
}, {
name : 'appUser.phone',
mapping : 'phone'
}, {
name : 'appUser.mobile',
mapping : 'mobile'
}, {
name : 'appUser.fax',
mapping : 'fax'
}, {
name : 'appUser.address',
mapping : 'address'
}, {
name : 'appUser.zip',
mapping : 'zip'
},
{
name : 'appUser.photo',
mapping : 'photo'
}]),
items : [{
id:'displayUserPhoto',
xtype : "panel",
width : 230,
rowspan:2,
height : 435,
title : "个人照片",
html : '<img src="' + __ctxPath + '/images/default_image_male.jpg"/>',
tbar : new Ext.Toolbar({
width : '100%',
height : 30,
items : [{
text : '上传',
iconCls : 'btn-upload',
handler : function() {
var photo = Ext.getCmp('appUser.photo');
var dialog = App.createUploadDialog({
file_cat : 'system/appUser',
callback : uploadUserPhoto,
permitted_extensions:['jpg']
});
if(photo.value != '' && photo.value !=null && photo.value !='undefined'){
var msg = '再次上传需要先删除原有图片,';
Ext.Msg.confirm('信息确认', msg+'是否删除?', function(btn) {
if (btn == 'yes') {
//删除图片
Ext.Ajax.request({
url:__ctxPath + '/system/deleteFileAttach.do',
method:'post',
params:{filePath:photo.value},
success:function(){
if(userId != '' && userId !=null && userId !='undefined'){
Ext.Ajax.request({
url:__ctxPath + '/system/photoAppUser.do',
method:'post',
params:{userId:userId},
success:function(){
photo.setValue('');
var appUserTitle = Ext.getCmp('appUserTitle');
var display = Ext.getCmp('displayUserPhoto');
if(appUserTitle.value ==1){
display.body.update('<img src="' + __ctxPath
+ '/images/default_image_male.jpg" />');
}else{
display.body.update('<img src="'+ __ctxPath
+ '/images/default_image_female.jpg" />');
}
dialog.show('queryBtn');
}
});
}else{
photo.setValue('');
var appUserTitle = Ext.getCmp('appUserTitle');
var display = Ext.getCmp('displayUserPhoto');
if(appUserTitle.value ==1){
display.body.update('<img src="' + __ctxPath
+ '/images/default_image_male.jpg" />');
}else{
display.body.update('<img src="'+ __ctxPath
+ '/images/default_image_female.jpg" />');
}
dialog.show('queryBtn');
}
}
});
}
})
}else{
dialog.show('queryBtn');
}
}
}, {
text : '删除',
iconCls : 'btn-delete',
handler : function() {
var photo = Ext.getCmp('appUser.photo');
if(photo.value != null && photo.value !='' && photo.value !='undefined'){
var msg = '照片一旦删除将不可恢复,';
Ext.Msg.confirm('确认信息',msg+'是否删除?',function(btn){
if(btn == 'yes'){
Ext.Ajax.request({
url:__ctxPath + '/system/deleteFileAttach.do',
method:'post',
params:{filePath:photo.value},
success:function(){
if(userId != '' && userId !=null && userId !='undefined'){
Ext.Ajax.request({
url:__ctxPath + '/system/photoAppUser.do',
method:'post',
params:{userId:userId},
success:function(){
photo.setValue('');
var appUserTitle = Ext.getCmp('appUserTitle');
var display = Ext.getCmp('displayUserPhoto');
if(appUserTitle.value ==1){
display.body.update('<img src="' + __ctxPath
+ '/images/default_image_male.jpg" />');
}else{
display.body.update('<img src="'+ __ctxPath
+ '/images/default_image_female.jpg" />');
}
}
});
}else{
photo.setValue('');
var appUserTitle = Ext.getCmp('appUserTitle');
var display = Ext.getCmp('displayUserPhoto');
if(appUserTitle.value ==1){
display.body.update('<img src="' + __ctxPath
+ '/images/default_image_male.jpg" />');
}else{
display.body.update('<img src="'+ __ctxPath
+ '/images/default_image_female.jpg" />');
}
}
}
});
}
});
}// end if
else{
Ext.Msg.alert('提示信息','您还未增加照片.');
}
}
}]
})
}, {
xtype : "panel",
id:'AppUserMustInfo',
width : 265,
height : 215,
title : "基本信息(必填)",
layout : 'form',
defaultType : "textfield",
defaults : {
width : 163
},
labelWidth : 55,
labelAlign : "right",
hideLabels : false,
items : [{
xtype : 'hidden',
fieldLabel : '员工ID',
name : 'appUser.userId',
id : 'appUser.userId'
}, {
fieldLabel : '登录账号',
allowBlank : false,
name : 'appUser.username',
id : 'appUser.username'
// minLength : 6,
// maxLength : 50
}, {
fieldLabel : '登录密码',
allowBlank : false,
name : 'appUser.password',
id : 'appUser.password'
// minLength : 6,
// maxLength : 50
}, {
fieldLabel : '员工姓名',
allowBlank : false,
name : 'appUser.fullname',
id : 'appUser.fullname'
}, {
fieldLabel : 'E-mail',
allowBlank : false,
name : 'appUser.email',
id : 'appUser.email',
vtype : 'email',
vtypeText : '邮箱格式不正确!'
},
depSelector,// 所属部门
{
fieldLabel : '入职时间',
xtype : 'datefield',
allowBlank : false,
readOnly : true,
format : 'Y-m-d',
name : 'appUser.accessionTime',
id : 'appUser.accessionTime',
length : 50
}, {
fieldLabel : '状态',
id : 'appUserStatus',
hiddenName : 'appUser.status',
xtype : 'combo',
mode : 'local',
allowBlank : false,
editable : false,
triggerAction : 'all',
store : [['1', '可用'], ['0', '禁用']],
value : 0
}, {
xtype : 'hidden',
allowBlank : false,
name : 'appUser.department.depId',
id : 'appUser.depId'
}]
}, {
xtype : "panel",
width : 265,
height : 215,
title : "扩展信息(选填)",
layout : 'form',
defaultType : 'textfield',
labelWidth : 55,
defaults : {
width : 163
},
hideLabel : false,
items : [{
fieldLabel : '性别',
xtype : 'combo',
hiddenName : 'appUser.title',
id : 'appUserTitle',
mode : 'local',
editable : false,
triggerAction : 'all',
store : [['1', '先生'], ['0','女士']],
value : '1',
listeners:{
select:function(combo, record,index){
var photo = Ext.getCmp('appUser.photo');
if(photo.value =='' || photo.value == 'undefined' || photo.value ==null){
var display = Ext.getCmp('displayUserPhoto');
if(combo.value == '0'){
display.body.update('<img src="' + __ctxPath
+ '/images/default_image_female.jpg" />');
}else{
display.body.update('<img src="' + __ctxPath
+ '/images/default_image_male.jpg" />');
}
}
}
}
}, {
fieldLabel : '职位',
name : 'appUser.position',
id : 'appUser.position'
}, {
fieldLabel : '家庭电话',
xtype : 'numberfield',
name : 'appUser.phone',
id : 'appUser.phone'
}, {
fieldLabel : '移动电话',
xtype : 'numberfield',
name : 'appUser.mobile',
id : 'appUser.mobile'
}, {
fieldLabel : '传真',
xtype : 'numberfield',
name : 'appUser.fax',
id : 'appUser.fax'
}, {
fieldLabel : '家庭住址',
name : 'appUser.address',
id : 'appUser.address'
}, {
fieldLabel : '邮编',
xtype : 'numberfield',
name : 'appUser.zip',
id : 'appUser.zip'
},{
filedLabel:'照片',
xtype:'hidden',
id:'appUser.photo',
name:'appUser.photo'
}]
}, {
xtype : 'panel',
title:'用户角色',
width : 530,
height : 220,
colspan : 2,
items : [{
xtype : 'itemselector',
id:'AppUserRoles',
name : 'AppUserRoles',
fromLegend : '',
imagePath : __ctxPath+'/ext3/ux/images/',
multiselects : [{
id:'chooseRoles',
title:'可选角色',
width : 247,
height : 190,
//SimpleStore 有可能 在Ext 3.0 以后的版本 换成 ArrayStore,更新版本时请注意
store : new Ext.data.SimpleStore({
autoLoad :true,
baseParams :{userId:userId},
url:__ctxPath+'/system/chooseRolesAppUser.do',
fields:['roleId','roleName']
}),
displayField : 'roleName',
valueField : 'roleId'
}, {
id:'selectedRoles',
name:'selectedRoles',
title:'已有角色',
width : 247,
height : 190,
store : new Ext.data.SimpleStore({
autoLoad :true,
baseParams :{userId:userId},
url:__ctxPath+'/system/selectedRolesAppUser.do',
fields:['roleId','roleName']
}),
tbar : [{
text : '清除所选',
handler : function() {
Ext.getCmp('AppUserForm').getForm().findField('AppUserRoles').reset();
}
}],
displayField : 'roleName',
valueField : 'roleId'
}]
}]
}]
});
return userform;
};
// 初始化操作菜单
AppUserForm.prototype.initFooterToolbar = function(userId) {
var toolbar = new Ext.Toolbar({
id:'AppUserFormToolbar',
width : '100%',
height : 30,
items : [{
text : '保存',
iconCls:'btn-save',
handler : function() {
var userform = Ext.getCmp('AppUserForm');
var depId=Ext.getCmp("appUser.depId");
if (userform.getForm().isValid()){
if(depId.getValue()==null||depId.getValue()==''){
Ext.Msg.alert('操作信息', '所属部门不能为空!');
return ;
}
userform.getForm().submit({
waitMsg : '正在提交用户信息',
success : function(userform, o) {
Ext.Msg.alert('操作信息', '保存成功!');
var userview = Ext.getCmp('AppUserGrid');
if (userview != null) {//假如员工列表不为空,则重载数据
userview.getStore().reload({
start : 0,
limit : 25
});
}
}
});
}
}
}, {
text : '取消',
iconCls:'reset',
handler : function() {
var tabs = Ext.getCmp('centerTabPanel');
tabs.remove('AppUserForm');
}
},{
text: '修改密码',
id:'resetPassword',
iconCls:'btn-password',
hidden:true,
handler : function(){
new resetPassword(userId);
}
}]
});
return toolbar;
};
/**
* 上传照片
* @param {} data
*/
function uploadUserPhoto(data){
var photo = Ext.getCmp('appUser.photo');
var display = Ext.getCmp('displayUserPhoto');
photo.setValue(data[0].filepath);
display.body.update('<img src="' + __ctxPath + '/attachFiles/'+data[0].filepath+'" width="100%" height="100%"/>');
};
/**
* 修改密码
*/
function resetPassword(userId){
var formPanel = new Ext.FormPanel({
url : __ctxPath+ '/system/resetPasswordAppUser.do',
layout : 'form',
id:'setPasswordForm',
frame : true,
defaults : {
widht : 400,
anchor : '100%,100%'
},
defaultType : 'textfield',
items : [{
name : 'appUserUserId',
id : 'appUserUserId',
xtype:'hidden',
value : userId
}, {
fieldLabel : '旧密码',
name : 'oldPassword',
id : 'oldPassword',
inputType : 'password'
}, {
fieldLabel : '新密码',
name : 'newPassword',
id : 'newPassword',
inputType : 'password'
}, {
fieldLabel : '再输入',
name : 'againPassword',
id : 'againPassword',
inputType : 'password'
}]
});
var setPassword = new Ext.Window({
title:'修改密码',
width : 300,
height : 175,
modal: true,
layout : 'anchor',
bodyStyle : 'padding:5px;',
buttonAlign : 'center',
items:[formPanel],
buttons : [{
text : '保存',
handler : function() {
var fp=Ext.getCmp('setPasswordForm');
if (fp.getForm().isValid()) {
fp.getForm().submit({
method: 'post',
waitMsg : '正在提交数据...',
success : function(fp,action) {
Ext.Msg.alert('操作信息', '密码修改成功!');
setPassword.close();
},
failure : function(fp,action) {
Ext.Msg.alert('错误提示',action.result.msg);
Ext.getCmp('setPasswordForm').getForm().reset();
}
});
}
}
}, {
text : '取消',
handler : function() {
setPassword.close();
}
}]
});
setPassword.show();
}
| JavaScript |
Ext.ns('ReportTemplateView');
/**
* 报表列表
*/
var ReportTemplateView = function() {
return new Ext.Panel({
id : 'ReportTemplateView',
title : '报表列表',
iconCls : 'menu-report',
autoScroll : true,
items : [new Ext.FormPanel({
height : 35,
frame : true,
id : 'ReportTemplateSearchForm',
layout : 'column',
defaults : {
xtype : 'label'
},
items : [{
text : '请输入查询条件:'
}, {
text : '标题'
}, {
xtype : 'textfield',
name : 'Q_title_S_LK'
}, {
text : '描述'
}, {
xtype : 'textfield',
name : 'Q_descp_S_LK'
}, {
text : '创建时间'
}, {
xtype : 'textfield',
name : 'Q_createtime_S_LK'
}, {
xtype : 'button',
text : '查询',
iconCls : 'search',
handler : function() {
var searchPanel = Ext
.getCmp('ReportTemplateSearchForm');
var grid = Ext.getCmp('ReportTemplateGrid');
if (searchPanel.getForm().isValid()) {
searchPanel.getForm().submit({
waitMsg : '正在提交查询',
url : __ctxPath
+ '/system/listReportTemplate.do',
success : function(formPanel, action) {
var result = Ext.util.JSON
.decode(action.response.responseText);
grid.getStore().loadData(result);
}
});
}
}
}]
}), this.setup()]
});
};
/**
* 建立视图
*/
ReportTemplateView.prototype.setup = function() {
return this.grid();
};
/**
* 建立DataGrid
*/
ReportTemplateView.prototype.grid = function() {
var sm = new Ext.grid.CheckboxSelectionModel();
var cm = new Ext.grid.ColumnModel({
columns : [sm, new Ext.grid.RowNumberer(), {
header : 'reportId',
dataIndex : 'reportId',
hidden : true
}, {
header : '标题',
dataIndex : 'title'
}, {
header : '描述',
dataIndex : 'descp'
}, {
header : '模版路径',
dataIndex : 'reportLocation'
}, {
header : '查询条件路径',
dataIndex : 'queryLocation'
}, {
header : '创建时间',
dataIndex : 'createtime'
}, {
header : '修改时间',
dataIndex : 'updatetime'
}, {
header : '管理',
dataIndex : 'reportId',
sortable : false,
width : 55,
renderer : function(value, metadata, record, rowIndex,
colIndex) {
var editId = record.data.reportId;
var str = '<button title="查看" value=" " class="btn-preview" onclick="ReportTemplateView.preview('
+ editId + ')"></button>';
str += '<button title="删除" value=" " class="btn-del" onclick="ReportTemplateView.remove('
+ editId + ')"></button>';
str += ' <button title="编辑" value=" " class="btn-edit" onclick="ReportTemplateView.edit('
+ editId + ')"></button>';
return str;
}
}],
defaults : {
sortable : true,
menuDisabled : false,
width : 100
}
});
var store = this.store();
store.load({
params : {
start : 0,
limit : 25
}
});
var grid = new Ext.grid.GridPanel({
id : 'ReportTemplateGrid',
tbar : this.topbar(),
store : store,
trackMouseOver : true,
disableSelection : false,
loadMask : true,
autoHeight : true,
cm : cm,
sm : sm,
viewConfig : {
forceFit : true,
enableRowBody : false,
showPreview : false
},
bbar : new Ext.PagingToolbar({
pageSize : 25,
store : store,
displayInfo : true,
displayMsg : '当前显示从{0}至{1}, 共{2}条记录',
emptyMsg : "当前没有记录"
})
});
grid.addListener('rowdblclick', function(grid, rowindex, e) {
grid.getSelectionModel().each(function(rec) {
ReportTemplateView.edit(rec.data.reportId);
});
});
return grid;
};
/**
* 初始化数据
*/
ReportTemplateView.prototype.store = function() {
var store = new Ext.data.Store({
proxy : new Ext.data.HttpProxy({
url : __ctxPath + '/system/listReportTemplate.do'
}),
reader : new Ext.data.JsonReader({
root : 'result',
totalProperty : 'totalCounts',
id : 'id',
fields : [{
name : 'reportId',
type : 'int'
}
, 'title', 'descp', 'reportLocation',
'queryLocation', 'createtime', 'updatetime']
}),
remoteSort : true
});
store.setDefaultSort('reportId', 'desc');
return store;
};
/**
* 建立操作的Toolbar
*/
ReportTemplateView.prototype.topbar = function() {
var toolbar = new Ext.Toolbar({
id : 'ReportTemplateFootBar',
height : 30,
bodyStyle : 'text-align:left',
items : [{
iconCls : 'btn-add',
text : '添加报表',
xtype : 'button',
handler : function() {
new ReportTemplateForm();
}
}, {
iconCls : 'btn-del',
text : '删除报表',
xtype : 'button',
handler : function() {
var grid = Ext.getCmp("ReportTemplateGrid");
var selectRecords = grid.getSelectionModel()
.getSelections();
if (selectRecords.length == 0) {
Ext.Msg.alert("信息", "请选择要删除的记录!");
return;
}
var ids = Array();
for (var i = 0; i < selectRecords.length; i++) {
ids.push(selectRecords[i].data.reportId);
}
ReportTemplateView.remove(ids);
}
}]
});
return toolbar;
};
/**
* 删除单个记录
*/
ReportTemplateView.remove = function(id) {
var grid = Ext.getCmp("ReportTemplateGrid");
Ext.Msg.confirm('信息确认', '您确认要删除该记录吗?', function(btn) {
if (btn == 'yes') {
Ext.Ajax.request({
url : __ctxPath
+ '/system/multiDelReportTemplate.do',
params : {
ids : id
},
method : 'post',
success : function() {
Ext.Msg.alert("信息提示", "成功删除所选记录!");
grid.getStore().reload({
params : {
start : 0,
limit : 25
}
});
}
});
}
});
};
/**
* 编辑报表
*/
ReportTemplateView.edit = function(id) {
new ReportTemplateForm(id);
}
/**
* 查看报表
*/
ReportTemplateView.preview = function(id) {
//只允许有一个编辑窗口
var tabs = Ext.getCmp('centerTabPanel');
var edit = Ext.getCmp('ReportPreview'+id);
if(edit==null){
edit = new ReportTemplatePreview(id);
tabs.add(edit);
}else{
tabs.remove('ReportTemplatePreview');
edit = new ReportTemplatePreview(id);
tabs.add(edit);
}
tabs.activate(edit);
}
var ReportTemplatePreview = function(reportId){
var panel = new Ext.Panel({
id : 'ReportPreview'+reportId,
title:'查看报表',
autoScroll:true,
collapsible:true,
tbar:[{xtype : 'label',text:'查询报表: '},
{xtype : 'label',text:"条件1"},
{xtype : 'textfield',id:'condition1'},
{xtype : 'label',text:"条件2"},
{xtype : 'textfield',id:'condition2'},
{
xtype : 'button',
text : '生成pdf报表',
iconCls : 'search',
handler : function(){
var condition1 = Ext.getCmp('condition1').getValue();
var condition2 = Ext.getCmp('condition2').getValue();
var reportType = 'pdf';
//要是查询条件里什么也没输入的话,则把参数值设为0,以免造成异常
if(condition1==''){
condition1='0';
}
if(condition2==''){
condition2='0';
}
document.location.href=__ctxPath+'/report/report.jsp?id='+reportId+'&condition1='+condition1+'&condition2='+condition2+'&reportType='+reportType;
}
},{
xtype : 'button',
text : '生成excel报表',
iconCls : 'search',
handler : function(){
var condition1 = Ext.getCmp('condition1').getValue();
var condition2 = Ext.getCmp('condition2').getValue();
var reportType = 'xls';
//要是查询条件里什么也没输入的话,则把参数值设为0,以免造成异常
if(condition1==''){
condition1='0';
}
if(condition2==''){
condition2='0';
}
document.location.href=__ctxPath+'/report/report.jsp?id='+reportId+'&condition1='+condition1+'&condition2='+condition2+'&reportType='+reportType;
}
},{
xtype : 'button',
text : '生成html报表',
iconCls : 'search',
handler : function(){
var condition1 = Ext.getCmp('condition1').getValue();
var condition2 = Ext.getCmp('condition2').getValue();
var reportType = 'html';
//要是查询条件里什么也没输入的话,则把参数值设为0,以免造成异常
if(condition1==''){
condition1='0';
}
if(condition2==''){
condition2='0';
}
document.location.href=__ctxPath+'/report/report.jsp?id='+reportId+'&condition1='+condition1+'&condition2='+condition2+'&reportType='+reportType;
}
}
]
,
items : [
{
xtype:'panel',
//根据页面传来reportId,动态加载报表模版路径,显示报表
html:'<iframe src="report/report.jsp?id='+reportId+'" width="100%" height="500" scrolling="auto"></iframe>'
}
]
}
);
return panel;
}
| JavaScript |
Ext.ns('AppUserView');
/**
* 员工列表
*
* @return {}
*/
var AppUserView = function() {
return this.getView();
};
/**
* AppUserView.getView()
*
* @return {}
*/
AppUserView.prototype.getView = function() {
return new Ext.Panel({
id : 'AppUserView',
// region:'center',
title : '员工信息',
iconCls:'menu-appuser',
autoScroll : true,
items : [new Ext.FormPanel({
height : 35,
frame : true,
id : 'AppUserSearchForm',
layout : 'column',
defaults : {
xtype : 'label'
},
items : [{
text : '查询条件:'
}, {
text : '用户账号'
}, {
width : 80,
xtype : 'textfield',
name : 'Q_username_S_LK'
}, {
text : '用户姓名'
}, {
width : 80,
xtype : 'textfield',
name : 'Q_fullname_S_LK'
},
// -----------------------------------------datefield 存在问题 start
{
text : '入职时间:'
}, {
width : 90,
xtype : 'datefield',
format: 'Y-m-d',
name : 'Q_accessionTime_D_GT'
}, {
text : '至'
},{
width : 90,
xtype : 'datefield',
format: 'Y-m-d',
name : 'Q_accessionTime_D_LT'
},
// -----------------------------------------datefield 存在问题 end
{
xtype : 'button',
text : '查询',
iconCls : 'search',
handler : function() {
var appUserSearchForm = Ext.getCmp('AppUserSearchForm');
var grid = Ext.getCmp('AppUserGrid');
if (appUserSearchForm.getForm().isValid()) {
appUserSearchForm.getForm().submit({
waitMsg : '正在提交查询',
url : __ctxPath
+ '/system/listAppUser.do',
success : function(formPanel, action) {
var result = Ext.util.JSON.decode(action.response.responseText);
grid.getStore().loadData(result);
}
});
}
}
}
// ,{
// xtype : 'button',
// text : '高级搜索',
// iconCls : '',
// handler : function(){
// Ext.Msg.alert('','待实现');
// }
// }
]
}), this.setup()]
});
return
};
/**
* 这个方法是AppUserGrid
*
* @return {}
*/
AppUserView.prototype.setup = function() {
var store = this.initData();
var toolbar = this.initToolbar();
// var topbar=this.initTopToolbar();
store.load({
params : {
start : 0,
limit : 25
}
});
var sm = new Ext.grid.CheckboxSelectionModel();
var cm = new Ext.grid.ColumnModel({
columns : [sm, new Ext.grid.RowNumberer(), {
header : "userId",
dataIndex : 'userId',
hidden : true
}, {
header : "账号",
dataIndex : 'username',
width : 60
}, {
header : "用户名",
dataIndex : 'fullname',
width : 60
}, {
header : "邮箱",
dataIndex : 'email',
width : 120
},
{// 先不显示
header: "所属部门",
dataIndex: 'department',
renderer:function(value){
return value.depName;
},
width: 60
},
{
header : "所在职位",
dataIndex : 'position',
width : 60
}, {
header : "入职时间",
dataIndex : 'accessionTime',
width : 100
}, {
header : "状态",
dataIndex : 'status',
width : 50,
renderer : function(value) {
return value == '0' ? "禁用" : "激活";
}
}, {
header : '管理',
dataIndex : 'userId',
sortable:false,
width : 100,
renderer : function(value, metadata, record, rowIndex,
colIndex) {
var editId = record.data.userId;
var editName = record.data.username;
/*
* var str = '<button title="删除" value=" "
* class="btn-del" onclick="AppUserView.remove(' +
* editId + ')"></button>';
*/
var str = ' <button title="编辑" value=" " class="btn-edit" onclick="AppUserView.edit('
+ editId + ',\'' + editName + '\')"></button>';
return str;
}
}],
defaults : {
sortable : true,
menuDisabled : true,
width : 100
},
listeners : {
hiddenchange : function(cm, colIndex, hidden) {
saveConfig(colIndex, hidden);
}
}
});
var grid = new Ext.grid.GridPanel({
id : 'AppUserGrid',
// title:'员工基本信息',
tbar : toolbar,
store : store,
autoHeight:true,
shim : true,
trackMouseOver : true,
disableSelection : false,
loadMask : true,
cm : cm,
sm : sm,
// customize view config
viewConfig : {
forceFit : true,
enableRowBody : false,
showPreview : false
},
// paging bar on the bottom
bbar : new Ext.PagingToolbar({
pageSize : 25,
store : store,
displayInfo : true,
displayMsg : '当前显示从{0}至{1}, 共{2}条记录',
emptyMsg : "当前没有记录"
})
});
// 为Grid增加双击事件,双击行可编辑
grid.addListener('rowdblclick', rowdblclickFn);
function rowdblclickFn(grid, rowindex, e) {
grid.getSelectionModel().each(function(rec) {
AppUserView.edit(rec.data.userId, rec.data.username);
});
}
return grid;
};
AppUserView.prototype.initData = function() {
var store = new Ext.data.Store({
proxy : new Ext.data.HttpProxy({
url : __ctxPath + '/system/listAppUser.do'
}),
// create reader that reads the Topic records
reader : new Ext.data.JsonReader({
root : 'result',
totalProperty : 'totalCounts',
id : 'id',
fields : [{
name : 'userId',
type : 'int'
}, 'username', 'password', 'fullname',
'email', 'department', 'title',// 性别
'position', {
name : 'accessionTime'
}, {
name : 'status',
type : 'int'
}]
}),
remoteSort : true
});
store.setDefaultSort('id', 'desc');
return store;
};
// 初始化操作菜单
AppUserView.prototype.initToolbar = function() {
var toolbar = new Ext.Toolbar({
width : '100%',
height : 30,
items : [{
text : '添加',
iconCls : 'add-user',
handler : function() {
var tabs = Ext.getCmp('centerTabPanel');
var addUser = Ext.getCmp('AppUserForm');
if (addUser == null) {
addUser = new AppUserForm('增加员工');
tabs.add(addUser);
} else {
tabs.remove(addUser)
// addUser.setTitle('增加员工');
// addUser.form.reset();
addUser = new AppUserForm('增加员工');
tabs.add(addUser);
}
tabs.activate(addUser);
}
}]
});
return toolbar;
};
/**
* 用户删除
*
* @param {}
* userId
*/
AppUserView.remove = function(userId) {
Ext.Msg.confirm('删除操作', '你确定要删除该用户吗?', function(btn) {
if (btn == 'yes') {
Ext.Ajax.request({
url : __ctxPath + '/system/multiDelAppUser.do',
method : 'post',
params : {
ids : userId
},
success : function() {
Ext.Msg.alert("操作信息", "用户删除成功"), AppUserView.grid
.getStore().reload();
},
failure : function() {
Ext.Msg.alert("操作信息", "用户删除失败");
AppUserView.grid.getStore().reload();
}
});
}
});
}
/**
* 用户编辑
*
* @param {}
* userId
*/
AppUserView.edit = function(userId, username) {
// 只允许有一个编辑窗口
var tabs = Ext.getCmp('centerTabPanel');
var edit = Ext.getCmp('AppUserForm');
if (edit == null) {
edit = new AppUserForm(username + '-详细信息', userId);
tabs.add(edit);
} else {
tabs.remove('AppUserForm');
edit = new AppUserForm(username + '-详细信息', userId);
tabs.add(edit);
}
tabs.activate(edit);
// 不可显示密码,不能修改账号
var appUserMustInfo = Ext.getCmp('AppUserMustInfo');
appUserMustInfo.remove('appUser.password');
Ext.getCmp('appUser.username').getEl().dom.readOnly = true;
appUserMustInfo.doLayout(true);
// 显示修改密码按钮
var appUserFormToolbar = Ext.getCmp('AppUserFormToolbar');
Ext.getCmp('resetPassword').show();
appUserFormToolbar.doLayout(true);
// 往编辑窗口中填充新闻数据
edit.form.load({
url : __ctxPath + '/system/getAppUser.do',
params : {
userId : userId
},
method : 'post',
waitMsg : '正在载入数据...',
success : function(edit, o) {
// 载入照片
var photo = Ext.getCmp('appUser.photo');
var display = Ext.getCmp('displayUserPhoto');
var appUserTitle = Ext.getCmp('appUserTitle');
if (photo.value != '' && photo.value !=null && photo.value !='undefined') {
display.body.update('<img src="' + __ctxPath
+ '/attachFiles/' + photo.value + '" width="100%" height="100%"/>');
}else if(appUserTitle.value == '0'){
display.body.update('<img src="' + __ctxPath
+ '/images/default_image_female.jpg" />');
}
var user = Ext.util.JSON.decode(o.response.responseText).data[0];
// 载入入职时间(DateUtil.js 已经换成 date.js 方法改为改下)
// var accessionTime = Date.parseString(user.accessionTime,
// 'yyyy-MM-dd HH:mm:ss');
var accessionTime = getDateFromFormat(user.accessionTime,
'yyyy-MM-dd HH:mm:ss');
Ext.getCmp('appUser.accessionTime').setValue(new Date(accessionTime));
// 载入部门信息
Ext.getCmp('appUser.depId').setValue(user.department.depId);
Ext.getCmp('depTreeSelector')
.setValue(user.department.depName);
},
failure : function() {
Ext.Msg.alert('编辑', '载入失败');
}
});
}
| JavaScript |
var ReportTemplateForm = function(reportId) {
this.reportId = reportId;
var fp = this.setup();
var window = new Ext.Window({
id : 'ReportTemplateFormWin',
title : '报表详细信息',
width : 600,
autoHeight : true,
modal : true,
layout : 'anchor',
plain : true,
bodyStyle : 'padding:5px;',
buttonAlign : 'center',
items : [this.setup()],
buttons : [{
text : '保存',
iconCls : 'btn-save',
handler : function() {
var fp = Ext.getCmp('ReportTemplateForm');
if (fp.getForm().isValid()) {
fp.getForm().submit({
method : 'post',
waitMsg : '正在提交数据...',
success : function(fp, action) {
Ext.Msg.alert('操作信息', '成功信息保存!');
Ext.getCmp('ReportTemplateGrid').getStore()
.reload();
window.close();
},
failure : function(fp, action) {
Ext.MessageBox.show({
title : '操作信息',
msg : '信息保存出错,请联系管理员!',
buttons : Ext.MessageBox.OK,
icon : 'ext-mb-error'
});
window.close();
}
});
}
}
}, {
text : '取消',
iconCls : 'btn-cancel',
handler : function() {
window.close();
}
}]
});
window.show();
};
ReportTemplateForm.prototype.setup = function() {
// 文件上传组件的回调函数
function fn(data) {
// 定义一个变量用来接收上传文件成功后返回的路径值
var path;
for (var i = 0; i < data.length; i++) {
path = data[i].filepath;
//alert("文件上传路径:" + path);
// 得到报表模块路径的字段,然后把上传成功后返回的路径值设到字段里面
Ext.getCmp('reportLocation').setValue(path);
}
}
var formPanel = new Ext.FormPanel({
url : __ctxPath + '/system/saveReportTemplate.do',
layout : 'form',
id : 'ReportTemplateForm',
frame : true,
defaults : {
widht : 400,
anchor : '100%,100%'
},
formId : 'ReportTemplateFormId',
defaultType : 'textfield',
items : [{
name : 'reportTemplate.reportId',
id : 'reportId',
xtype : 'hidden',
value : this.reportId == null ? '' : this.reportId
}, {
fieldLabel : '报表标题',
name : 'reportTemplate.title',
id : 'title',
allowBlank : false,
blankText : '报表标题不能为空'
}, {
fieldLabel : '报表描述',
name : 'reportTemplate.descp',
id : 'descp',
xtype : 'htmleditor',
height : 200,
allowBlank : false,
blankText : '报表描述不能为空'
}, {
xtype : 'container',
height : 26,
layout : 'column',
defaultType : 'textfield',
items : [{
xtype : 'label',
style : 'padding-left:0px;margin-left:0px;margin-bottom:2px;',
text : '报表模块路径',
width : 102
},
{
columnWidth:.8,
name : 'reportTemplate.reportLocation',
id : 'reportLocation',
allowBlank : false,
blankText : '报表模块jasper文件路径不能为空'
}, {
xtype : 'button',
text : '上传附件',
columnWidth:.2,
handler : function() {
// 点击上传附件按钮后,调用上传组件
var dialog = App
.createUploadDialog({
file_cat : 'system',
callback : fn
});
dialog.show('queryBtn');
}
}
]
}, {
fieldLabel : '报表查询条件路径',
name : 'reportTemplate.queryLocation',
id : 'queryLocation'
}
]
});
if (this.reportId != null && this.reportId != 'undefined') {
formPanel.getForm().load({
deferredRender : false,
url : __ctxPath + '/system/getReportTemplate.do?reportId='
+ this.reportId,
waitMsg : '正在载入数据...',
success : function(form, action) {
// Ext.Msg.alert('编辑', '载入成功!');
},
failure : function(form, action) {
// Ext.Msg.alert('编辑', '载入失败');
}
});
}
return formPanel;
};
| JavaScript |
var DepartmentForm=function(nodeId){
var formPanel=this.initUI(nodeId);
var window = new Ext.Window({
title: '部门信息',
width: 400,
height:250,
layout: 'fit',
plain:true,
bodyStyle:'padding:5px;',
buttonAlign:'center',
items: formPanel,
buttons: [{
text: '保存',
iconCls:'btn-save',
handler:function(){
var tree1 = Ext.getCmp('treePanel');
if(formPanel.getForm().isValid()){
formPanel.getForm().submit({
waitMsg:'正在提交部门信息',
success: function(formPanel, o){
Ext.Msg.alert('操作信息','添加部门成功!')
window.close();
tree1.root.reload();
}
});
}
}
},{
text: '取消',
handler:function(){
window.close();
}
}]
});
window.show();
};
DepartmentForm.prototype.initUI=function(nodeId){
var formPanel = new Ext.form.FormPanel({
id:'departmentForm',
baseCls: 'x-plain',
layout:'absolute',
defaultType: 'textfield',
url:__ctxPath+'/system/addDepartment.do',
defaultType: 'textfield',
reader: new Ext.data.JsonReader(
{
root:'data'
},
[
{name:'depId',mapping:'depId'}
,{name:'depName',mapping:'depName'}
,{name:'depDesc',mapping:'depDesc'}
,{name:'parentId',mapping:'parentId'}
]
),
defaults: {
anchor: '95%,95%',
allowBlank: false,
selectOnFocus: true,
msgTarget: 'side'
},
items:[{
xtype:'hidden'
,name:'department.depId'
,id:'depId'
},{
xtype:'hidden',
name:'department.parentId',
id:'parentId',
value:nodeId
},
{
xtype:'hidden',
name:'department.path',
id:'path'
},
{
x:0,
y:5,
xtype:'label',
text:'部门名'
},
{
x:0,
y:25,
name:'department.depName',
blankText: '部门名为必填!',
id:'depName'
}
,
{
x:0,
y:55,
allowBlank: true,
xtype:'label',
text:'部门描述'
},
{
x:0,
y:75,
xtype:'textarea',
name:'department.depDesc',
blankText: '部门描述为必填!',
id:'depDesc'
}
]
});
return formPanel;
};
| JavaScript |
Ext.ns('AppRoleView');
/**
* 用户角色列表
*/
var AppRoleView = function() {
return new Ext.Panel({
id:'AppRoleView',
title:'角色列表',
iconCls:'menu-role',
autoScroll:true,
items:[
new Ext.FormPanel({
height:35,
frame:true,
id:'AppRoleSearchForm',
layout:'column',
defaults:{xtype:'label'},
items:[
{
text : '角色名称'
}, {
xtype : 'textfield',
name : 'Q_roleName_S_LK'
}, {
text : '角色描述'
}, {
xtype : 'textfield',
name : 'Q_roleDesc_S_LK'
},{
xtype:'button',
text:'查询',
iconCls:'search',
handler:function(){
var searchPanel=Ext.getCmp('AppRoleSearchForm');
var grid=Ext.getCmp('AppRoleGrid');
if(searchPanel.getForm().isValid()){
searchPanel.getForm().submit({
waitMsg:'正在提交查询',
url:__ctxPath+'/system/listAppRole.do',
success:function(formPanel,action){
var result=Ext.util.JSON.decode(action.response.responseText);
grid.getStore().loadData(result);
}
});
}
}
}
]
}),
this.setup()
]
});
};
/**
* 建立视图
*/
AppRoleView.prototype.setup = function() {
return this.grid();
};
/**
* 建立DataGrid
*/
AppRoleView.prototype.grid = function() {
var sm = new Ext.grid.CheckboxSelectionModel();
var cm = new Ext.grid.ColumnModel({
columns : [sm, new Ext.grid.RowNumberer(), {
header : 'roleId',
dataIndex : 'roleId',
hidden : true
}, {
header : "角色名称",
dataIndex : 'roleName',
width : 60
}, {
header : "角色描述",
dataIndex : 'roleDesc',
width : 60
}, {
header : "状态",
dataIndex : 'status',
width : 60,
renderer : function(value) {
return value == '0' ? "禁用" : "激活";
}
}, {
header : '管理',
dataIndex : 'roleId',
width : 50,
renderer : function(value, metadata, record, rowIndex,colIndex) {
var editId = record.data.roleId;
var roleName=record.data.roleName;
var str = '<button title="删除" value=" " class="btn-del" onclick="AppRoleView.remove('+ editId + ')"></button>';
str += ' <button title="编辑" value=" " class="btn-edit" onclick="AppRoleView.edit('+ editId + ')"></button>';
str += ' <button title="授权" value=" " class="btn-grant" onclick="AppRoleView.grant('
+ editId + ',\'' + roleName + '\')"> </button>';
return str;
}
}],
defaults : {
sortable : true,
menuDisabled : false,
width : 100
}
});
var store = this.store();
store.load({
params : {
start : 0,
limit : 25
}
});
var grid = new Ext.grid.GridPanel({
id : 'AppRoleGrid',
tbar : this.topbar(),
store : store,
trackMouseOver : true,
disableSelection : false,
loadMask : true,
autoHeight:true,
//fbar : this.footbar(),
cm : cm,
sm : sm,
// customize view config
viewConfig : {
forceFit : true,
enableRowBody : false,
showPreview : false
},
// paging bar on the bottom
bbar : new Ext.PagingToolbar({
pageSize : 25,
store : store,
displayInfo : true,
displayMsg : '当前显示从{0}至{1}, 共{2}条记录',
emptyMsg : "当前没有记录"
})
});
grid.addListener('rowdblclick', function(grid, rowindex, e) {
grid.getSelectionModel().each(function(rec) {
AppRoleView.edit(rec.data.roleId);
});
});
return grid;
};
/**
* 初始化数据
*/
AppRoleView.prototype.store = function() {
var store = new Ext.data.Store({
proxy : new Ext.data.HttpProxy({
url : __ctxPath + '/system/listAppRole.do'
}),
reader : new Ext.data.JsonReader({
root : 'result',
totalProperty : 'totalCounts',
id : 'id',
fields : [{
name : 'roleId',
type : 'int'
}, 'roleName', 'roleDesc', {
name : 'status',
type : 'int'
}]
}),
remoteSort : true
});
store.setDefaultSort('roleId', 'desc');
return store;
};
/**
* 建立操作的Toolbar
*/
AppRoleView.prototype.topbar = function() {
var toolbar = new Ext.Toolbar({
id : 'AppRoleFootBar',
height : 30,
bodyStyle:'text-align:left',
items : [
{
iconCls : 'btn-add',
text : '添加角色',
xtype : 'button',
handler : function() {
new AppRoleForm();
}
}, {
iconCls : 'btn-del',
text : '删除角色',
xtype : 'button',
handler : function() {
var grid=Ext.getCmp("AppRoleGrid");
var selectRecords=grid.getSelectionModel().getSelections();
if(selectRecords.length==0){
Ext.Msg.alert("信息","请选择要删除的记录!");
return;
}
var ids=Array();
for(var i=0;i<selectRecords.length;i++){
ids.push(selectRecords[i].data.roleId);
}
AppRoleView.remove(ids);
}
}
]
});
return toolbar;
};
/**
* 删除单个记录
*/
AppRoleView.remove=function(id){
var grid=Ext.getCmp("AppRoleGrid");
Ext.Msg.confirm('信息确认','您确认要删除该记录吗?',function(btn){
if(btn=='yes'){
Ext.Ajax.request({
url:__ctxPath+'/system/multiDelAppRole.do',
params:{
ids:id
},
method:'post',
success:function(){
Ext.Msg.alert("信息","成功删除所选记录!");
grid.getStore().reload({params:{
start : 0,
limit : 25
}});
}
});
}
});
};
/**
*
*/
AppRoleView.edit=function(id){
new AppRoleForm(id);
};
AppRoleView.grant=function(id,roleName){
new RoleGrantRightView(id,roleName);
};
| JavaScript |
Ext.ns('FileAttachView');
/**
* ������列表
*/
var FileAttachView = function() {
return new Ext.Panel({
id : 'FileAttachView',
title : '附件列表',
iconCls:'menu-attachment',
autoScroll : true,
items : [new Ext.FormPanel({
height : 35,
frame : true,
id : 'FileAttachSearchForm',
layout : 'column',
defaults : {
xtype : 'label'
},
items : [{
text : '请输入查询条件:'
}, {
text : '文件名'
}, {
xtype : 'textfield',
width : 80,
name : 'Q_fileName_S_LK'
},{
text : '创建时间'
}, {
xtype : 'textfield',
width : 80,
name : 'Q_createtime_S_LK'
}, {
text : '扩展名'
}, {
xtype : 'textfield',
width : 60,
name : 'Q_ext_S_LK'
},{
text : '上传者'
}, {
xtype : 'textfield',
width : 80,
name : 'Q_creator_S_LK'
}, {
xtype : 'button',
text : '查询',
iconCls : 'search',
handler : function() {
var searchPanel = Ext
.getCmp('FileAttachSearchForm');
var grid = Ext.getCmp('FileAttachGrid');
if (searchPanel.getForm().isValid()) {
searchPanel.getForm().submit({
waitMsg : '正在提交查询',
url : __ctxPath
+ '/system/listFileAttach.do',
success : function(formPanel, action) {
var result = Ext.util.JSON
.decode(action.response.responseText);
grid.getStore().loadData(result);
}
});
}
}
}]
}), this.setup()]
});
};
/**
* 建立视图
*/
FileAttachView.prototype.setup = function() {
return this.grid();
};
/**
* 建立DataGrid
*/
FileAttachView.prototype.grid = function() {
var sm = new Ext.grid.CheckboxSelectionModel();
var cm = new Ext.grid.ColumnModel({
columns : [sm, new Ext.grid.RowNumberer(), {
header : 'fileId',
dataIndex : 'fileId',
hidden : true
}, {
header : '文件名',
dataIndex : 'fileName'
}, {
header : '文件路径',
dataIndex : 'filePath'
}, {
header : '创建时间',
dataIndex : 'createtime'
}, {
header : '扩展名',
dataIndex : 'ext'
}, {
header : '附件类型',
dataIndex : 'type'
}, {
header : '说明',
dataIndex : 'note'
}, {
header : '上传者',
dataIndex : 'creator'
}, {
header : '管理',
dataIndex : 'fileId',
width : 50,
renderer : function(value, metadata, record, rowIndex,
colIndex) {
var editId = record.data.fileId;
var str = '<button title="删除" value=" " class="btn-del" onclick="FileAttachView.remove('
+ editId + ')"></button>';
str += ' <button title="编辑" value=" " class="btn-edit" onclick="FileAttachView.edit('
+ editId + ')"></button>';
return str;
}
}],
defaults : {
sortable : true,
menuDisabled : false,
width : 100
}
});
var store = this.store();
store.load({
params : {
start : 0,
limit : 25
}
});
var grid = new Ext.grid.GridPanel({
id : 'FileAttachGrid',
tbar : this.topbar(),
store : store,
trackMouseOver : true,
disableSelection : false,
loadMask : true,
autoHeight : true,
cm : cm,
sm : sm,
viewConfig : {
forceFit : true,
enableRowBody : false,
showPreview : false
},
bbar : new Ext.PagingToolbar({
pageSize : 25,
store : store,
displayInfo : true,
displayMsg : '当前显示从{0}至{1}, 共{2}条记录',
emptyMsg : "当前没有记录"
})
});
grid.addListener('rowdblclick', function(grid, rowindex, e) {
grid.getSelectionModel().each(function(rec) {
FileAttachView.edit(rec.data.fileId);
});
});
return grid;
};
/**
* 初始化数据
*/
FileAttachView.prototype.store = function() {
var store = new Ext.data.Store({
proxy : new Ext.data.HttpProxy({
url : __ctxPath + '/system/listFileAttach.do'
}),
reader : new Ext.data.JsonReader({
root : 'result',
totalProperty : 'totalCounts',
id : 'id',
fields : [{
name : 'fileId',
type : 'int'
}
, 'fileName', 'filePath', 'createtime',
'ext', 'type', 'note', 'creator']
}),
remoteSort : true
});
store.setDefaultSort('fileId', 'desc');
return store;
};
/**
* 建立操作的Toolbar
*/
FileAttachView.prototype.topbar = function() {
var toolbar = new Ext.Toolbar({
id : 'FileAttachFootBar',
height : 30,
bodyStyle : 'text-align:left',
items : [{
iconCls : 'btn-add',
text : '添加附件',
xtype : 'button',
handler : function() {
new FileAttachForm();
}
}, {
iconCls : 'btn-del',
text : '删除附件',
xtype : 'button',
handler : function() {
var grid = Ext.getCmp("FileAttachGrid");
var selectRecords = grid.getSelectionModel()
.getSelections();
if (selectRecords.length == 0) {
Ext.Msg.alert("信息", "请选择要删除的记录!");
return;
}
var ids = Array();
for (var i = 0; i < selectRecords.length; i++) {
ids.push(selectRecords[i].data.fileId);
}
FileAttachView.remove(ids);
}
}]
});
return toolbar;
};
/**
* 删除单个记录
*/
FileAttachView.remove = function(id) {
var grid = Ext.getCmp("FileAttachGrid");
Ext.Msg.confirm('信息确认', '您确认要删除该记录吗?', function(btn) {
if (btn == 'yes') {
Ext.Ajax.request({
url : __ctxPath
+ '/system/multiDelFileAttach.do',
params : {
ids : id
},
method : 'post',
success : function() {
Ext.Msg.alert("信息提示", "成功删除所选记录!");
grid.getStore().reload({
params : {
start : 0,
limit : 25
}
});
}
});
}
});
};
/**
*
*/
FileAttachView.edit = function(id) {
new FileAttachForm(id);
}
| JavaScript |
Ext.ns('DepartmentView');
var DepartmentView=function(){
return this.setup();
};
DepartmentView.prototype.setup=function(){
var selected;
var store=this.initData();
var sm=new Ext.grid.CheckboxSelectionModel();
var cm = new Ext.grid.ColumnModel({
columns:[sm,new Ext.grid.RowNumberer(),{
header: "userId",
dataIndex: 'userId',
hidden: true
},{
header: "账号",
dataIndex: 'username',
width: 60
},
// {
// header: "密码",
// dataIndex: 'password',
// width: 60
// },
{
header: "用户名",
dataIndex:'fullname',
width:60
},{
header: "邮箱",
dataIndex: 'email',
width: 60
},
// {
// header: "所属部门",
// dataIndex: 'department.depName',
// width: 60
// },
{
header: "所在职位",
dataIndex: 'position',
width: 60
},{
header: "入职时间",
dataIndex: 'accessionTime',
width: 35
},{
header: "状态",
dataIndex: 'status',
width: 60,
renderer:function(value){
return value=='0'?"禁用":"激活";
}
},{
header:'管理',
dataIndex:'userId',
width:50,
renderer:function(value,metadata,record,rowIndex,colIndex){
var editId=record.data.userId;
var editName=record.data.username;
var str='<button title="删除" value=" " class="btn-del" onclick="AppUserView.remove('+editId+')"> </button>';
str+=' <button title="编辑" value=" " class="btn-edit" onclick="AppUserView.edit('+editId+',\''+editName+'\')"> </button>';
return str;
}
}
],
defaults: {
sortable: true,
menuDisabled: true,
width: 100
},
listeners: {
hiddenchange: function(cm, colIndex, hidden) {
saveConfig(colIndex, hidden);
}
}
});
var grid = new Ext.grid.GridPanel({
id:'UserView',
autoHeight:true,
title:'员工基本信息',
store: store,
shim: true,
trackMouseOver:true,
disableSelection:false,
loadMask: true,
cm:cm,
sm:sm,
viewConfig: {
forceFit:true,
enableRowBody:false,
showPreview:false
},
// paging bar on the bottom
bbar: new Ext.PagingToolbar({
pageSize: 25,
store: store,
displayInfo: true,
displayMsg: '当前显示从{0}至{1}, 共{2}条记录',
emptyMsg: "当前没有记录"
})
});
store.load({params:{start:0, limit:25}});
var treePanel=new Ext.tree.TreePanel({
region:'west',
id:'treePanel',
title:'部门信息显示',
collapsible : true,
split : true,
height:800,
width:200,
tbar:new Ext.Toolbar({items:[{
xtype:'button',
iconCls:'btn-refresh',
text:'刷新',
handler:function(){
treePanel.root.reload();
}
},
{
xtype:'button',
text:'展开',
iconCls:'btn-expand',
handler:function(){
treePanel.expandAll();
}
},
{
xtype:'button',
text:'收起',
iconCls:'btn-collapse',
handler:function(){
treePanel.collapseAll();
}
}
]}),
loader:new Ext.tree.TreeLoader({
url:__ctxPath+'/system/listDepartment.do'
}),
root:new Ext.tree.AsyncTreeNode({
expanded: true
}),
rootVisible: false,
listeners: {
'click': DepartmentView.clickNode
}
});
//树的右键菜单的
treePanel.on('contextmenu', contextmenu, treePanel);
// 创建右键菜单
var treeMenu = new Ext.menu.Menu( {
id : 'treeMenu',
items : [
{
text : '新建部门',
scope : this,
handler :createNode
},
{
text : '修改部门信息',
scope : this,
handler : editNode
},{
text : '删除部门',
scope : this,
handler : deteleNode
}
]
});
function contextmenu(node, e) {
selected = new Ext.tree.TreeNode({
id:node.id,
text:node.text
});
//if(selected.id>0){
treeMenu.showAt(e.getXY());
//}
}
/**
* 菜单事件
*/
function createNode(){
var nodeId = selected.id;
var departmentForm = Ext.getCmp('departmentForm');
if(departmentForm==null){
if(nodeId>0){
new DepartmentForm(nodeId);
}else{
new DepartmentForm(0);
}
}
}
function deteleNode(){
var depId = selected.id;
var type = Ext.getCmp('treePanel');
if(depId>0){
Ext.Msg.confirm('删除操作','你确定删除部门?',function(btn){
if(btn=='yes'){
Ext.Ajax.request({
url:__ctxPath+'/system/removeDepartment.do?depId='+depId,
success:function(){
Ext.Msg.alert('操作信息','删除成功!');
type.root.reload();
}
});
}
});
}else{
Ext.Msg.alert('警告',"总公司不能被删除");
}
}
function editNode(){
var depId = selected.id;
if(depId>0){
var departmentForm = Ext.getCmp('departmentForm');
if(departmentForm==null){
new DepartmentForm();
departmentForm = Ext.getCmp('departmentForm');
}
departmentForm.form.load({
url:__ctxPath+'/system/detailDepartment.do',
params:{depId:depId},
method:'post',
deferredRender :true,
layoutOnTabChange :true,
success : function() {
// Ext.Msg.alert('编辑', '载入成功!');
},
failure : function() {
// Ext.Msg.alert('编辑', '载入失败');
}
});
}else{
Ext.Msg.alert('警告',"总公司不能修改!");
}
}
var panel=new Ext.Panel({
id:'DepartmentView',
title:'部门信息',
closable:true,
iconCls:'menu-department',
layout : 'border',
height:800,
items:[treePanel,{region:'center',width:'100%',items:[grid]}]
});
return panel;
};
DepartmentView.prototype.initData=function(){
var store = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url: __ctxPath+'/system/selectAppUser.do'
}),
// create reader that reads the Topic records
reader: new Ext.data.JsonReader({
root: 'result',
totalProperty: 'totalCounts',
id: 'id',
fields: [
{name:'userId',type:'int'},
'username',
// 'password',
'fullname',
'email',
//'department.depName',
'title',//性别
'position',
{name:'accessionTime'},
{name:'status',type:'int'}
]
}),
remoteSort: true
});
store.setDefaultSort('id', 'desc');
return store;
};
/**
* 初始化
* @return {}
*/
/**
* 用户删除
* @param {} userId
*/
DepartmentView.remove=function(userId){
Ext.Msg.confirm('删除操作','你确定要删除该用户吗?',function(btn){
if(btn=='yes'){
Ext.Ajax.request({
url: __ctxPath+'/system/removeAppUser.do',
method:'post',
params:{userId:userId},
success:function(){
Ext.Msg.alert("信息","删除成功"),
UserView.grid.getStore().reload();
},
failure:function(){
Ext.Msg.alert("信息","删除失败");
UserView.grid.getStore().reload();
}
});
}
});
}
DepartmentView.clickNode=function(node){
if (node != null) {
var users = Ext.getCmp('UserView');
var store=users.getStore();
store.url=__ctxPath+'/system/selectAppUser.do';
store.baseParams={depId:node.id};
store.params={start:0,limit:25};
store.reload({params:{start:0,limit:25}});
}
};
| JavaScript |
var AppRoleForm = function(roleId) {
this.roleId = roleId;
var fp = this.setup();
var window = new Ext.Window({
id : 'AppRoleFormWin',
title : '角色详细信息',
width : 370,
height : 220,
modal: true,
minWidth : 300,
minHeight : 200,
layout : 'anchor',
plain : true,
bodyStyle : 'padding:5px;',
buttonAlign : 'center',
items : [fp],
buttons : [{
text : '保存',
iconCls:'btn-save',
handler : function() {
var fp=Ext.getCmp('AppRoleForm');
if (fp.getForm().isValid()) {
fp.getForm().submit({
method: 'post',
waitMsg : '正在提交数据...',
success : function(fp,action) {
Ext.Msg.alert('操作信息', '成功信息保存!');
Ext.getCmp('AppRoleGrid').getStore().reload();
window.close();
},
failure : function(fp,action) {
Ext.MessageBox.show({
title: '操作信息',
msg: '信息保存出错,请联系管理员!',
buttons: Ext.MessageBox.OK,
icon:'ext-mb-error'
});
window.close();
}
});
}
}
}, {
text : '取消',
iconCls:'btn-cancel',
handler : function() {
window.close();
}
}]
});
window.show();
};
AppRoleForm.prototype.setup = function() {
var formPanel = new Ext.FormPanel({
url : __ctxPath+ '/system/saveAppRole.do',
layout : 'form',
id:'AppRoleForm',
frame : true,
defaults : {
widht : 400,
anchor : '100%,100%'
},
formId:'AppRoleFormId',
defaultType : 'textfield',
items : [{
name : 'appRole.roleId',
id : 'roleId',
xtype:'hidden',
value : this.roleId == null ? '' : this.roleId
}, {
fieldLabel : '角色名称',
allowBlank : false,
name : 'appRole.roleName',
id : 'roleName'
}, {
fieldLabel : '角色描述',
xtype : 'textarea',
name : 'appRole.roleDesc',
id : 'roleDesc'
}, {
fieldLabel : '状态',
hiddenName : 'appRole.status',
id : 'status',
xtype : 'combo',
mode : 'local',
editable : true,
triggerAction : 'all',
store : [['0', '禁用'], ['1', '可用']],
value : 0
}]
});
if(this.roleId!=null&&this.roleId!='undefined'){
formPanel.getForm().load({
deferredRender :false,
url : __ctxPath + '/system/getAppRole.do?roleId=' + this.roleId,
waitMsg : '正在载入数据...',
success : function(form, action) {
},
failure : function(form, action) {
}
});
}
return formPanel;
};
| JavaScript |
/*
* 文件附件详细
*/
Ext.ns('FileAttachDetail');
FileAttachDetail.show=function(fileId){
var window = new Ext.Window({
title : '文档详细信息',
width : 480,
height : 280,
modal : true,
minWidth : 300,
minHeight : 200,
layout : 'anchor',
plain : true,
bodyStyle : 'padding:5px;',
scope:this,
buttonAlign : 'center',
autoLoad:{
url:__ctxPath+'/fileDetail.do?fileId='+fileId//url:__ctxPath+'/document/fileDetail.do?fileId='+fileId
},
buttons:[
{
xtype:'button',
text:'关闭',
handler:function(){
window.close();
}
}
]
});
window.show();
}; | JavaScript |
Ext.ns('CompanyView');
var CompanyView=function(){
return this.setup();
};
CompanyView.prototype.setup=function(){
var formPanel = new Ext.form.FormPanel({
id:'CompanyView',
labelAlign: 'top',
frame:true,
closable: true,//这个属性可以控制关闭form
url:__ctxPath+'/system/addCompany.do',
title: '公司信息',
iconCls:'menu-company',
bodyStyle:'padding:5px 5px 0',
width: 600,
reader: new Ext.data.JsonReader(
{
root:'result'
},
[
{name:'companyId',mapping:'companyId'},
{name:'companyNo',mapping:'companyNo'},
{name:'companyName',mapping:'companyName'},
{name:'companyDesc',mapping:'companyDesc'},
{name:'legalPerson',mapping:'legalPerson'},
{name:'setup',mapping:'setup'},
{name:'phone',mapping:'phone'},
{name:'fax',mapping:'fax'},
{name:'site',mapping:'site'},
{name:'logo',mapping:'logo'}
]
),
items: [{
layout:'column',
items:[{
columnWidth:.5,
layout: 'form',
items: [
{
xtype:'hidden',
fieldLabel: '公司ID',
name: 'company.companyId',
id: 'companyId',
anchor:'95%'
},
{
xtype:'textfield',
fieldLabel: '公司编号',
name: 'company.companyNo',
id: 'companyNo',
anchor:'95%'
},{
xtype:'textfield',
fieldLabel: '公司名称',
name: 'company.companyName',
id: 'companyName',
allowBlank:false,
anchor:'95%'
},{
xtype:'textfield',
fieldLabel: '法人',
name: 'company.legalPerson',
id: 'legalPerson',
anchor:'95%'
},{
xtype:'textfield',
fieldLabel: '电话',
name: 'company.phone',
id: 'phone',
anchor:'95%'
}]
},{
columnWidth:.5,
layout: 'form',
items: [ {
fieldLabel: '成立时间',
xtype:'datefield',
format:'Y-m-d',
name: 'company.setup' ,
id: 'setup'
},{
xtype:'textfield',
fieldLabel: '传真',
name: 'company.fax',
id: 'fax',
anchor:'95%'
},{
xtype:'textfield',
fieldLabel: 'Logo',
name: 'company.logo',
id: 'logo',
anchor:'95%'
}
, {
xtype:'textfield',
fieldLabel: '公司网址(必须为完整网址)',
name: 'company.site',
id: 'site',
anchor:'95%'
}
]
}]
},{
columnWidth:.1,
layout: 'form',
items: [ {
buttons: [{
text: '访问公司主页',
handler:function(){
var s = Ext.getCmp('site');
var site = s.getValue().trim();
window.open(site);
}
}]
}]},{
xtype:'htmleditor',
fieldLabel:'公司描述',
name:'company.companyDesc',
id:'companyDesc',
height:200,
anchor:'98%'
}],
buttons: [{
text: '保存',
handler:function(){
var formPanel = Ext.getCmp('CompanyView');
if(formPanel.getForm().isValid()){
formPanel.getForm().submit({
waitMsg:'正在修改公司信息',
success: function(formPanel, o){
Ext.Msg.alert('操作信息','公司信息保存成功!')
}
});
}
}
},{
text: '重置',
handler: function(){
var formPanel = Ext.getCmp('CompanyView');
formPanel.form.load({
url:__ctxPath+'/system/listCompany.do',
deferredRender :true,
layoutOnTabChange :true,
waitMsg : '正在加载公司信息...',
success: function(formPanel, o){
Ext.Msg.alert('操作信息','公司信息重置成功!');
}
});
}
}]
});
formPanel.form.load({
url:__ctxPath+'/system/listCompany.do',
deferredRender :true,
layoutOnTabChange :true,
waitMsg : '正在载入数据...'
});
return formPanel;
}
| JavaScript |
Ext.ns('App.login');
/**
* 系统登陆JS,包括登录,检查是否登录,登出
* @type
*/
App.login = {
//登录窗口
/*
createLoginWindow : function(){
var win=new Ext.Window({
title:'test',
height:200,
width:300
});
win.show();
}
*/
createLoginWindow : function() {
App.loginWindow = new LoginWindow({
url : __ctxPath + '/login.do',
callback : function(result) {
if (result.success) {
App.loginWindow.close();
window.location.href = __ctxPath + '/index.jsp'
}else{
Ext.Msg.alert('错误信息',result.msg)
}
}
});
App.loginWindow.show();
},
//登出
logout : function() {
Ext.Ajax.request({
url : __ctxPath + '/j_logout.do',
success : function() {
window.location.href = __ctxPath + '/login.jsp';
}
})
}
};
/**
* 登录窗口
* @class LoginWindow
* @extends Ext.Window
*/
var LoginWindow = Ext.extend(Ext.Window, {
title : '用户登录',
width : 350,
height : 220,
closable : false,
resizable:false,
iconCls:'login-icon',
buttonAlign : 'center',
createFormPanel : function() {
return new Ext.form.FormPanel({
bodyStyle : 'padding-top:6px',
defaultType : 'textfield',
labelAlign : 'right',
labelWidth : 55,
labelPad : 0,
layout:'form',
frame:true,
defaults : {
allowBlank : false,
anchor:'96%,96%',
selectOnFocus : true
},
items : [{
name : 'username',
fieldLabel : '账 号',
blankText : '账号不能为空'
}, {
name : 'password',
fieldLabel : '密 码',
blankText : '密码不能为空',
inputType : 'password'
}, {
name : 'checkCode',
fieldLabel : '验证码',
blankText : '验证码不能为空'
}, {
xtype:'container',
layout:'table',
defaultType:'textfield',
hideLabel:false,
layoutConfig: {
columns: 3
},
items:[
{
width:55,
xtype:'label',
text:' '//这里的排序以后再改
},{
width:150,
id:'loginCode',
xtype:'panel',
html:'<img border="0" height="30" width="150" src="'+__ctxPath + '/CaptchaImg"/>'
},{
width:55,
xtype:'panel',
bodyStyle:'font-size:12px;padding-left:12px',
html:'<a href="javascript:refeshCode()">看不清</a>'
}]
}, {
xtype : 'checkbox',
name : '_spring_security_remember_me',
boxLabel : '让系统记住我 '
}]
});
},
login : function() {
if (this.formPanel.form.isValid()) {
this.formPanel.form.submit({
waitTitle : "请稍候",
waitMsg : '正在登录......',
url : this.url,
success : function(form, action) {
this.hide();
if (this.callback) {
this.callback.call(this, action.result);
}
},
failure : function(form, action) {
if (this.callback) {
this.callback.call(this, action.result);
}
form.findField("password").setRawValue("");
form.findField("username").focus(true);
},
scope : this
});
}
},
initComponent : function() {
this.keys = {
key : Ext.EventObject.ENTER,
fn : this.login,
scope : this
};
LoginWindow.superclass.initComponent.call(this);
this.formPanel = this.createFormPanel();
this.add(this.formPanel);
this.addButton({text:'登录',iconCls:'btn-login'}, this.login, this);
this.addButton({text:'重填',iconCls:'btn-login-reset'}, function() {
this.formPanel.getForm().reset();
}, this);
}
});
/**
* 更新验证码
*/
function refeshCode(){
var loginCode = Ext.getCmp('loginCode');
loginCode.body.update('<img border="0" height="30" width="150" src="'+__ctxPath + '/CaptchaImg?rand='+Math.random()+'"/>');
}; | JavaScript |
/**
*新建流程
*/
var NewProcess = function(){
return this.getView();
};
NewProcess.prototype.getView=function(){
var selectedNode;
var proDefView=new ProDefinitionView(false);//不能进行数据的管理
var treePanel = new Ext.tree.TreePanel({
region : 'west',
title : '流程分类',
collapsible : true,
split : true,
width : 150,
height : 900,
tbar:new Ext.Toolbar({items:[{
xtype:'button',
iconCls:'btn-refresh',
text:'刷新',
handler:function(){
treePanel.root.reload();
}
}
]}),
loader : new Ext.tree.TreeLoader({
url : __ctxPath + '/flow/rootProType.do'
}),
root : new Ext.tree.AsyncTreeNode({
expanded : true
}),
rootVisible : false,
listeners : {
'click' : function(node){
proDefView.setTypeId(node.id);
//注意id区别于流程管理的Grid
var defGridView=Ext.getCmp('ProDefinitionGrid0');
defGridView.getStore().proxy.conn.url=__ctxPath + '/flow/listProDefinition.do?typeId='+node.id;
defGridView.getStore().load({
params : {
start : 0,
limit : 25
}
});
}
}
});
var panel = new Ext.Panel({
title : '新建流程',
layout : 'border',
id:'NewProcess',
height : 800,
items : [treePanel,proDefView.getView()]
});
return panel;
} | JavaScript |
var ChangeTaskView = function(c, b) {
var a = new Ext.FormPanel( {
layout : "form",
bodyStyle : "padding:4px 4px 4px 4px",
url : __ctxPath + "/flow/changeTask.do",
border : false,
items : [ {
xtype : "hidden",
name : "taskId",
value : c
}, {
xtype : "panel",
height : 32,
border : false,
layout : "column",
defaults : {
margins : "0 6 0 0"
},
items : [ {
xtype : "label",
text : "代办人",
width : 105
}, {
name : "fullname",
id : "fullname",
xtype : "textfield",
allowBlank : false,
width : 240
}, {
xtype : "hidden",
name : "userId",
id : "userId"
}, {
xtype : "button",
text : "选择",
iconCls : "btn-select",
width : 80,
handler : function() {
UserSelector.getView(function(g, h) {
var e = Ext.getCmp("fullname");
var f = Ext.getCmp("userId");
e.setValue(h);
f.setValue(g);
}, true).show();
}
} ]
}, {
xtype : "textarea",
name : "msg",
anchor : "98%,98%",
fieldLabel : "代办信息"
} ]
});
var d = new Ext.Window(
{
title : "任务代办--" + b,
height : 180,
iconCls : "btn-changeTask",
buttonAlign : "center",
width : 500,
modal : true,
layout : "fit",
items : [ a ],
buttons : [
{
text : "转交代办人",
iconCls : "btn-save",
handler : function() {
if (a.getForm().isValid()) {
a
.getForm()
.submit(
{
success : function(f, g) {
Ext.MessageBox.alert("操作信息提示","任务已经成功转交代办人来处理!");
var h = Ext.getCmp("MyTaskView");
var e = Ext.getCmp("TaskPanelView");
if (e != null) {
e.getUpdater().update(__ctxPath+ "/flow/displayTask.do");
}
if (h != null) {
h.getStore().reload();
}
d.close();
}
});
}
}
}, {
text : "关闭",
iconCls : "btn-close",
handler : function() {
d.close();
}
} ]
});
d.show();
}; | JavaScript |
Ext.ns('ProTypeView');
/**
* ������������列表
*/
var ProTypeView = function() {
return new Ext.Panel({
id : 'ProTypeView',
title : 'ProType列表',
autoScroll : true,
items : [new Ext.FormPanel({
height : 35,
frame : true,
id : 'ProTypeSearchForm',
layout : 'column',
defaults : {
xtype : 'label'
},
items : [{
text : '请输入查询条件:'
}, {
text : '分类名称'
}, {
xtype : 'textfield',
name : 'Q_typeName_S_LK'
}, {
xtype : 'button',
text : '查询',
iconCls : 'search',
handler : function() {
var searchPanel = Ext.getCmp('ProTypeSearchForm');
var grid = Ext.getCmp('ProTypeGrid');
if (searchPanel.getForm().isValid()) {
searchPanel.getForm().submit({
waitMsg : '正在提交查询',
url : __ctxPath + '/flow/listProType.do',
success : function(formPanel, action) {
var result = Ext.util.JSON
.decode(action.response.responseText);
grid.getStore().loadData(result);
}
});
}
}
}]
}), this.setup()]
});
};
/**
* 建立视图
*/
ProTypeView.prototype.setup = function() {
return this.grid();
};
/**
* 建立DataGrid
*/
ProTypeView.prototype.grid = function() {
var sm = new Ext.grid.CheckboxSelectionModel();
var cm = new Ext.grid.ColumnModel({
columns : [sm, new Ext.grid.RowNumberer(), {
header : 'typeId',
dataIndex : 'typeId',
hidden : true
}, {
header : '分类名称',
dataIndex : 'typeName'
}, {
header : '管理',
dataIndex : 'typeId',
width : 50,
renderer : function(value, metadata, record, rowIndex,
colIndex) {
var editId = record.data.typeId;
var str = '<input type="button" title="删除" value=" " class="btn-del" onclick="ProTypeView.remove('
+ editId + ')"/>';
str += ' <input type="button" title="编辑" value=" " class="btn-edit" onclick="ProTypeView.edit('
+ editId + ')"/>';
return str;
}
}],
defaults : {
sortable : true,
menuDisabled : false,
width : 100
}
});
var store = this.store();
store.load({
params : {
start : 0,
limit : 25
}
});
var grid = new Ext.grid.GridPanel({
id : 'ProTypeGrid',
tbar : this.topbar(),
store : store,
trackMouseOver : true,
disableSelection : false,
loadMask : true,
autoHeight : true,
cm : cm,
sm : sm,
viewConfig : {
forceFit : true,
enableRowBody : false,
showPreview : false
},
bbar : new Ext.PagingToolbar({
pageSize : 25,
store : store,
displayInfo : true,
displayMsg : '当前显示从{0}至{1}, 共{2}条记录',
emptyMsg : "当前没有记录"
})
});
grid.addListener('rowdblclick', function(grid, rowindex, e) {
grid.getSelectionModel().each(function(rec) {
ProTypeView.edit(rec.data.typeId);
});
});
return grid;
};
/**
* 初始化数据
*/
ProTypeView.prototype.store = function() {
var store = new Ext.data.Store({
proxy : new Ext.data.HttpProxy({
url : __ctxPath + '/flow/listProType.do'
}),
reader : new Ext.data.JsonReader({
root : 'result',
totalProperty : 'totalCounts',
id : 'id',
fields : [{
name : 'typeId',
type : 'int'
}
, 'typeName']
}),
remoteSort : true
});
store.setDefaultSort('typeId', 'desc');
return store;
};
/**
* 建立操作的Toolbar
*/
ProTypeView.prototype.topbar = function() {
var toolbar = new Ext.Toolbar({
id : 'ProTypeFootBar',
height : 30,
bodyStyle : 'text-align:left',
items : [{
iconCls : 'btn-add',
text : '添加ProType',
xtype : 'button',
handler : function() {
new ProTypeForm();
}
}, {
iconCls : 'btn-del',
text : '删除ProType',
xtype : 'button',
handler : function() {
var grid = Ext.getCmp("ProTypeGrid");
var selectRecords = grid.getSelectionModel()
.getSelections();
if (selectRecords.length == 0) {
Ext.Msg.alert("信息", "请选择要删除的记录!");
return;
}
var ids = Array();
for (var i = 0; i < selectRecords.length; i++) {
ids.push(selectRecords[i].data.typeId);
}
ProTypeView.remove(ids);
}
}]
});
return toolbar;
};
/**
* 删除单个记录
*/
ProTypeView.remove = function(id) {
var grid = Ext.getCmp("ProTypeGrid");
Ext.Msg.confirm('信息确认', '您确认要删除该记录吗?', function(btn) {
if (btn == 'yes') {
Ext.Ajax.request({
url : __ctxPath + '/flow/multiDelProType.do',
params : {
ids : id
},
method : 'post',
success : function() {
Ext.Msg.alert("信息提示", "成功删除所选记录!");
grid.getStore().reload({
params : {
start : 0,
limit : 25
}
});
}
});
}
});
};
/**
*
*/
ProTypeView.edit = function(id) {
new ProTypeForm(id);
}
| JavaScript |
Ext.ns("ProDefinitionSetting");
/**
* 流程定义人员设置
*/
var ProDefinitionSetting=function(defId,name){
this.defId=defId;
this.name=name;
var leftPanel=new Ext.Panel({
title:'流程示意图',
width:500,
height:800,
split:true,
region:'west',
margin:'5 5 5 5',
html:'<img src="'+__ctxPath+ '/jbpmImage?defId='+this.defId+ '"/>'
});
var rightPanel=this.getRightPanel(defId);
var topPanel=new Ext.Panel({
id:'ProDefinitionSetting'+this.defId,
title:'流程参与人员设置-'+this.name,
layout:'border',
items:[
leftPanel,rightPanel
]
});
return topPanel;
};
ProDefinitionSetting.prototype.getRightPanel=function(defId){
var toolbar = new Ext.Toolbar({
width : '100%',
items : [{
text : '保存',
iconCls : 'btn-save',
handler : function() {
var params = [];
for (i = 0, cnt = store.getCount(); i < cnt; i += 1) {
var record = store.getAt(i);
if(record.data.assignId=='' || record.data.assignId==null){//设置未保存的assignId标记,方便服务端进行gson转化
record.set('assignId',-1);
}
if (record.dirty) // 得到所有修改过的数据
params.push(record.data);
}
if (params.length == 0) {
Ext.Msg.alert('信息', '没有对数据进行任何更改');
return;
}
Ext.Ajax.request({
method : 'post',
url : __ctxPath
+ '/flow/saveProUserAssign.do',
success : function(request) {
Ext.Msg.alert('操作信息', '成功设置流程表单');
store.reload();
grid.getView().refresh();
},
failure : function(request) {
Ext.MessageBox.show({
title : '操作信息',
msg : '信息保存出错,请联系管理员!',
buttons : Ext.MessageBox.OK,
icon : 'ext-mb-error'
});
},
params : {
data : Ext.encode(params)
}
});
}
}]
});
var store = new Ext.data.Store({
proxy : new Ext.data.HttpProxy({
url : __ctxPath + '/flow/listProUserAssign.do?defId='+this.defId
}),
reader : new Ext.data.JsonReader({
root : 'result',
id : 'id',
fields : ['assignId', 'deployId', 'activityName',
'userId','username', 'roleId','roleName']
})
});
store.load();
var row = 0;
var col = 0;
//用户的行选择器
var userEditor = new Ext.form.TriggerField({
triggerClass : 'x-form-browse-trigger',
onTriggerClick : function(e) {
UserSelector.getView(function(ids, names) {
var store = grid.getStore();
var record = store.getAt(row);
record.set('userId', ids);
record.set('username', names);
}).show();
}
});
var roleEditor=new Ext.form.TriggerField({
triggerClass : 'x-form-browse-trigger',
onTriggerClick : function(e) {
RoleSelector.getView(function(ids, names) {
var store = grid.getStore();
var record = store.getAt(row);
record.set('roleId', ids);
record.set('roleName', names);
}).show();
}
});
var grid = new Ext.grid.EditorGridPanel({
title:'人员设置',
width : 400,
id:'ProDefinitionSettingGrid'+this.defId,
height : 800,
store : store,
region:'center',
tbar : toolbar,
columns : [new Ext.grid.RowNumberer(),{
header : "assignId",
dataIndex : 'assignId',
hidden : true
}, {
header : "deployId",
dataIndex : 'deployId',
hidden : true
}, {
header : "流程任务",
dataIndex : 'activityName',
width : 100,
sortable : true
}, {
dataIndex:'userId',
header:'userId',
hidden : true
},{
header : "用户",
dataIndex : 'username',
width : 150,
sortable : true,
editor:userEditor
}, {
dataIndex : 'roleId',
hidden:true
}, {
header : '角色',
dataIndex:'roleName',
width:150,
editor:roleEditor
}]
});
var showUserDlg=function(grid){
alert('aa');
}
//Grid this, Number rowIndex, Number columnIndex, Ext.EventObject e
grid.on('cellclick', function(grid,rowIndex,columnIndex,e) {
row=rowIndex;
col=columnIndex;
});
/*# grid - This grid
# record - The record being edited
# field - The field name being edited
# value - The value being set
# originalValue - The original value for the field, before the edit.
# row - The grid row index
# column - The grid column index
# cancel - Set this to true to cancel the edit or return false from your handler*/
grid.on('validateedit', function(e) {
alert('ok');
e.record.set("userId", 1);
return false;
});
return grid;
};
/**
* 角色选择
* @param {} rowIndex
* @param {} colIndex
* @param {} defId
*/
ProDefinitionSetting.roleSelect=function(rowIndex,colIndex,defId){
var grid=Ext.getCmp("ProDefinitionSettingGrid"+defId);
var record=grid.getStore().getAt(rowIndex);
grid.getStore().reload();
grid.doLayout();
};
| JavaScript |
Ext.ns('ProcessRunView');
/**
* 申请列表
*/
var ProcessRunView = function() {
return new Ext.Panel({
id : 'ProcessRunView',
title : '我申请的流程',
autoScroll : true,
items : [new Ext.FormPanel({
height : 35,
frame : true,
id : 'ProcessRunSearchForm',
layout : 'column',
defaults : {
xtype : 'label'
},
items : [{
text : '请输入查询条件:'
}, {
text : '标题'
}, {
xtype : 'textfield',
name : 'Q_subject_S_LK'
}, {
xtype : 'button',
text : '查询',
iconCls : 'search',
handler : function() {
var searchPanel = Ext
.getCmp('ProcessRunSearchForm');
var grid = Ext.getCmp('ProcessRunGrid');
if (searchPanel.getForm().isValid()) {
searchPanel.getForm().submit({
waitMsg : '正在提交查询',
url : __ctxPath + '/flow/listProcessRun.do',
success : function(formPanel, action) {
var result = Ext.util.JSON
.decode(action.response.responseText);
grid.getStore().loadData(result);
}
});
}
}
}]
}), this.setup()]
});
};
/**
* 建立视图
*/
ProcessRunView.prototype.setup = function() {
return this.grid();
};
/**
* 建立DataGrid
*/
ProcessRunView.prototype.grid = function() {
var sm = new Ext.grid.CheckboxSelectionModel();
var cm = new Ext.grid.ColumnModel({
columns : [sm, new Ext.grid.RowNumberer(), {
header : 'runId',
dataIndex : 'runId',
hidden : true
}, {
header : '标题',
dataIndex : 'subject'
},{
header : '时间',
dataIndex : 'createtime',
width:60
}, {
header : "流程状态",
dataIndex : "runStatus",
renderer : function(e) {
if (e == 0) {
return '<font color="red">草稿</font>';
} else {
if (e == 1) {
return '<font color="green">正在运行</font>';
} else {
if (e == 2) {
return '<font color="gray">结束</font>';
}
}
}
}
}, {
header : '管理',
dataIndex : 'runId',
width : 50,
renderer : function(value, metadata, record, rowIndex,
colIndex) {
var runId = record.data.runId;
var defId=record.data.defId;
var piId=record.data.piId;
var subject=record.data.subject;
var s = record.data.runStatus;
var str = '';
if(s==0){
str+='<button title="删除" value=" " class="btn-del" onclick="ProcessRunView.remove('+ runId + ')"></button>';
str += ' <button title="编辑" class="btn-edit" onclick="ProcessRunView.edit(' + runId + ",'" + subject + "')\"></button>";
}
if(piId!=null&&piId!=undefined&&piId!=''){
str += ' <button type="button" title="查看" value=" " class="btn-preview" onclick="ProcessRunView.detail('+
runId+','+defId+',\''+ piId + '\',\''+ subject + '\')"></button>';
}
return str;
}
}],
defaults : {
sortable : true,
menuDisabled : false,
width : 100
}
});
var store = this.store();
store.load({
params : {
start : 0,
limit : 25
}
});
var grid = new Ext.grid.GridPanel({
id : 'ProcessRunGrid',
store : store,
trackMouseOver : true,
disableSelection : false,
loadMask : true,
autoHeight : true,
cm : cm,
sm : sm,
viewConfig : {
forceFit : true,
enableRowBody : false,
showPreview : false
},
bbar : new Ext.PagingToolbar({
pageSize : 25,
store : store,
displayInfo : true,
displayMsg : '当前显示从{0}至{1}, 共{2}条记录',
emptyMsg : "当前没有记录"
})
});
return grid;
};
/**
* 初始化数据
*/
ProcessRunView.prototype.store = function() {
var store = new Ext.data.Store({
proxy : new Ext.data.HttpProxy({
url : __ctxPath + '/flow/listProcessRun.do'
}),
reader : new Ext.data.JsonReader({
root : 'result',
totalProperty : 'totalCounts',
id : 'id',
fields : [{
name : 'runId',
type : 'int'
}, 'subject','createtime','defId', 'piId','runStatus']
}),
remoteSort : true
});
store.setDefaultSort('runId', 'desc');
return store;
};
/**
* 删除单个记录
*/
ProcessRunView.remove = function(id) {
var grid = Ext.getCmp("ProcessRunGrid");
Ext.Msg.confirm('信息确认', '您确认要删除该记录吗?', function(btn) {
if (btn == 'yes') {
Ext.Ajax.request({
url : __ctxPath + '/flow/multiDelProcessRun.do',
params : {
ids : id
},
method : 'post',
success : function() {
Ext.Msg.alert("信息提示", "成功删除所选记录!");
grid.getStore().reload({
params : {
start : 0,
limit : 25
}
});
}
});
}
});
};
/**
*
*/
ProcessRunView.edit = function(runId,name) {
var contentPanel=App.getContentPanel();
var startForm=contentPanel.getItem('ProcessRunStart'+runId);
if(startForm==null){
startForm=new ProcessRunStart(null,name,runId,null);
contentPanel.add(startForm);
}
contentPanel.activate(startForm);
}
/**
* 显示明细
* @param {} runId
* @param {} name
*/
ProcessRunView.detail=function(runId,defId,piId,name){
var contentPanel=App.getContentPanel();
var detailView=contentPanel.getItem('ProcessRunDetail'+runId);
if(detailView==null){
detailView=new ProcessRunDetail(runId,defId,piId,name);
contentPanel.add(detailView);
}
contentPanel.activate(detailView);
};
| JavaScript |
Ext.ns('MyDoProcessRunView');
/**
* 申请列表
*/
var MyDoProcessRunView = function() {
return new Ext.Panel({
id : 'MyDoProcessRunView',
title : '我参与的流程',
autoScroll : true,
items : [new Ext.FormPanel({
height : 35,
frame : true,
id : 'MyDoProcessRunSearchForm',
layout : 'column',
defaults : {
xtype : 'label'
},
items : [{
text : '请输入查询条件:'
}, {
text : '标题'
}, {
xtype : 'textfield',
name : 'Q_subject_S_LK'
}, {
xtype : 'button',
text : '查询',
iconCls : 'search',
handler : function() {
var searchPanel = Ext
.getCmp('MyDoProcessRunSearchForm');
var grid = Ext.getCmp('MyDoProcessRunGrid');
if (searchPanel.getForm().isValid()) {
searchPanel.getForm().submit({
waitMsg : '正在提交查询',
url : __ctxPath + '/flow/listProcessRun.do',
success : function(formPanel, action) {
var result = Ext.util.JSON
.decode(action.response.responseText);
grid.getStore().loadData(result);
}
});
}
}
}]
}), this.setup()]
});
};
/**
* 建立视图
*/
MyDoProcessRunView.prototype.setup = function() {
return this.grid();
};
/**
* 建立DataGrid
*/
MyDoProcessRunView.prototype.grid = function() {
var sm = new Ext.grid.CheckboxSelectionModel();
var cm = new Ext.grid.ColumnModel({
columns : [sm, new Ext.grid.RowNumberer(), {
header : 'runId',
dataIndex : 'runId',
hidden : true
}, {
header : '标题',
dataIndex : 'subject'
},{
header : '时间',
dataIndex : 'createtime',
width:60
}, {
header : "流程状态",
dataIndex : "runStatus",
renderer : function(e) {
if (e == 0) {
return '<font color="red">草稿</font>';
} else {
if (e == 1) {
return '<font color="green">正在运行</font>';
} else {
if (e == 2) {
return '<font color="gray">结束</font>';
}
}
}
}
}, {
header : '管理',
dataIndex : 'runId',
width : 50,
renderer : function(value, metadata, record, rowIndex,
colIndex) {
var runId = record.data.runId;
var defId=record.data.defId;
var piId=record.data.piId;
var runId=record.data.runId;
var subject=record.data.subject;
var s = record.data.runStatus;
var str = '';
if(piId!=null&&piId!=undefined&&piId!=''){
str += ' <button type="button" title="查看" class="btn-preview" onclick="MyDoProcessRunView.detail('+
runId+','+defId+',\''+ piId + '\',\''+ subject + '\')"></button>';
}
return str;
}
}],
defaults : {
sortable : true,
menuDisabled : false,
width : 100
}
});
var store = this.store();
store.load({
params : {
start : 0,
limit : 25
}
});
var grid = new Ext.grid.GridPanel({
id : 'MyDoProcessRunGrid',
store : store,
trackMouseOver : true,
disableSelection : false,
loadMask : true,
autoHeight : true,
cm : cm,
sm : sm,
viewConfig : {
forceFit : true,
enableRowBody : false,
showPreview : false
},
bbar : new Ext.PagingToolbar({
pageSize : 25,
store : store,
displayInfo : true,
displayMsg : '当前显示从{0}至{1}, 共{2}条记录',
emptyMsg : "当前没有记录"
})
});
return grid;
};
/**
* 初始化数据
*/
MyDoProcessRunView.prototype.store = function() {
var store = new Ext.data.Store({
proxy : new Ext.data.HttpProxy({
url : __ctxPath + '/flow/listProcessRun.do'
}),
reader : new Ext.data.JsonReader({
root : 'result',
totalProperty : 'totalCounts',
id : 'id',
fields : [{
name : 'runId',
type : 'int'
}, 'subject','createtime','defId', 'piId','runStatus']
}),
remoteSort : true
});
store.setDefaultSort('runId', 'desc');
return store;
};
/**
* 显示明细
* @param {} runId
* @param {} name
*/
MyDoProcessRunView.detail=function(runId,defId,piId,name){
var contentPanel=App.getContentPanel();
var detailView=contentPanel.getItem('ProcessRunDetail'+runId);
if(detailView==null){
detailView=new ProcessRunDetail(runId,defId,piId,name);
contentPanel.add(detailView);
}
contentPanel.activate(detailView);
};
| JavaScript |
/**
* 流程详细页
*/
var ProDefinitionDetail=function(defId,title){
this.defId=defId;
this.title=title;
return this.getView();
};
ProDefinitionDetail.prototype.getView=function(){
var leftPanel=new Ext.Panel({
title:'流程示意图',
width:500,
height:750,
split:true,
region:'west',
margin:'5 5 5 5',
html:'<img src="'+__ctxPath+ '/jbpmImage?defId='+this.defId+ '"/>'
});
var rightPanel=new Ext.Panel({
title:'流程描述',
width:400,
height:800,
margin:'5 5 5 5',
region:'center',
autoLoad:{
url:__ctxPath+'/flow/processDetail.do?defId='+this.defId
}
});
var topPanel=new Ext.Panel({
id:'ProDefinitionDetail'+this.defId,
title:'流程详细信息-'+this.title,
layout:'border',
items:[
leftPanel,rightPanel
]
});
return topPanel;
}; | JavaScript |
var ProcessRunForm = function(runId) {
this.runId = runId;
var fp = this.setup();
var window = new Ext.Window( {
id : 'ProcessRunFormWin',
title : 'ProcessRun详细信息',
width : 500,
height : 420,
modal : true,
layout : 'anchor',
plain : true,
bodyStyle : 'padding:5px;',
buttonAlign : 'center',
items : [ this.setup() ],
buttons : [ {
text : '保存',
handler : function() {
var fp = Ext.getCmp('ProcessRunForm');
if (fp.getForm().isValid()) {
fp.getForm().submit( {
method : 'post',
waitMsg : '正在提交数据...',
success : function(fp, action) {
Ext.Msg.alert('操作信息', '成功保存信息!');
Ext.getCmp('ProcessRunGrid').getStore().reload();
window.close();
},
failure : function(fp, action) {
Ext.MessageBox.show( {
title : '操作信息',
msg : '信息保存出错,请联系管理员!',
buttons : Ext.MessageBox.OK,
icon : 'ext-mb-error'
});
window.close();
}
});
}
}
}, {
text : '取消',
handler : function() {
window.close();
}
} ]
});
window.show();
};
ProcessRunForm.prototype.setup = function() {
var formPanel = new Ext.FormPanel( {
url : __ctxPath + '/flow/saveProcessRun.do',
layout : 'form',
id : 'ProcessRunForm',
frame : true,
defaults : {
widht : 400,
anchor : '100%,100%'
},
formId : 'ProcessRunFormId',
defaultType : 'textfield',
items : [ {
name : 'processRun.runId',
id : 'runId',
xtype : 'hidden',
value : this.runId == null ? '' : this.runId
}, {
fieldLabel : '标题',
name : 'processRun.subject',
id : 'subject'
}, {
fieldLabel : '创建人',
name : 'processRun.creator',
id : 'creator'
}, {
fieldLabel : '所属用户',
name : 'processRun.userId',
id : 'userId'
}, {
fieldLabel : '所属Jbpm发布ID',
name : 'processRun.deployId',
id : 'deployId'
}, {
fieldLabel : '流程实例ID',
name : 'processRun.piId',
id : 'piId'
}
]
});
if (this.runId != null && this.runId != 'undefined') {
formPanel.getForm().load( {
deferredRender : false,
url : __ctxPath + '/flow/getProcessRun.do?runId=' + this.runId,
waitMsg : '正在载入数据...',
success : function(form, action) {
// Ext.Msg.alert('编辑', '载入成功!');
},
failure : function(form, action) {
// Ext.Msg.alert('编辑', '载入失败');
}
});
}
return formPanel;
};
| JavaScript |
var ProDefinitionForm = function(defId,typeId) {
this.defId = defId;
this.typeId=typeId;
var fp = this.setup();
var window = new Ext.Window({
id : 'ProDefinitionFormWin',
title : '流程定义详细信息',
width : 500,
height : 420,
modal : true,
layout : 'anchor',
plain : true,
bodyStyle : 'padding:5px;',
buttonAlign : 'center',
items : [this.setup()],
buttons : [{
text : '保存',
handler : function() {
var fp = Ext.getCmp('ProDefinitionForm');
if (fp.getForm().isValid()) {
fp.getForm().submit({
method : 'post',
waitMsg : '正在提交数据...',
success : function(fp, action) {
Ext.Msg.alert('操作信息', '成功信息保存!');
Ext.getCmp('ProDefinitionGrid').getStore().reload();
window.close();
},
failure : function(fp, action) {
Ext.MessageBox.show({
title : '操作信息',
msg : '信息保存出错,请联系管理员!',
buttons : Ext.MessageBox.OK,
icon : 'ext-mb-error'
});
window.close();
}
});
}
}
}, {
text : '取消',
handler : function() {
window.close();
}
}]
});
window.show();
};
ProDefinitionForm.prototype.setup = function() {
var typeId=this.typeId;
var _url = __ctxPath + '/flow/listProType.do';
var typeSelector = new TreeSelector('proTypeTreeSelector', _url, '流程分类','proTypeId');
var formPanel = new Ext.FormPanel({
url : __ctxPath + '/flow/saveProDefinition.do',
layout : 'form',
id : 'ProDefinitionForm',
frame : true,
defaults : {
widht : 400,
anchor : '100%,100%'
},
formId : 'ProDefinitionFormId',
defaultType : 'textfield',
items : [{
name : 'proDefinition.defId',
id : 'defId',
xtype : 'hidden',
value : this.defId == null ? '' : this.defId
}, typeSelector, {
xtype : 'hidden',
id : 'proTypeId',
name : 'proDefinition.proTypeId'
}, {
fieldLabel : '流程的名称',
name : 'proDefinition.name',
id : 'name'
}, {
fieldLabel : '描述',
xtype:'textarea',
name : 'proDefinition.description',
id : 'description'
}, {
fieldLabel : '流程定义的XML',
name : 'proDefinition.defXml',
id : 'defXml',
xtype:'textarea',
height:200
}
]
});
var defId=(this.defId==null || this.defId == 'undefined')?'':this.defId;
var typeId=(this.typeId==null||this.typeId=='undefined')?'':this.typeId;
//初次加载用于显示流程分类,若为更新的操作,保存新的xml
formPanel.getForm().load({
deferredRender : false,
url : __ctxPath + '/flow/getProDefinition.do?defId='
+ defId + '&proTypeId='+typeId,
waitMsg : '正在载入数据...',
success : function(form, action) {
var proType=action.result.data.proType;
if(proType!=null){
Ext.getCmp('proTypeTreeSelector').setValue(proType.typeName);
Ext.getCmp('proTypeId').setValue(proType.typeId);
}
},
failure : function(form, action) {
}
});
return formPanel;
};
| JavaScript |
/**
* 流程启动的表单
*/
var ProcessRunStart=function(defId,name,runId,activityName){
this.defId=defId;
this.name=name;
this.activityName=activityName==null?'开始':activityName;
this.runId=runId;
return this.setup();
};
/**
* 流程表单
*/
ProcessRunStart.prototype.setup=function(){
var formPanel = new Ext.FormPanel({
id : 'ProcessRunStart' + this.defId,
frame : true,
title : '流程启动-' + this.name,
items : [
{
xtype : 'hidden',
name : 'runId',
value : this.runId
},
{
xtype : 'hidden',
name : 'defId',
value : this.defId
}, {
xtype : 'hidden',
name : 'activityName',
value : this.activityName
}],
fbar : new Ext.Toolbar({
height : 28,
frame : false,
items : [{
text : '保存',
iconCls : 'btn-save',
handler : function() {
var form = formPanel.getForm();
if (form.isValid()) {
form.submit({
url : __ctxPath + '/flow/saveProcessActivity.do?startFlow=false',
waitMsg : '正在提交信息...',
success : function(userform, o) {
Ext.MessageBox.show({
title : '操作信息',
msg : '成功保存信息!',
buttons : Ext.MessageBox.OK,
icon : Ext.MessageBox.INFO
});
App.removeTab("ProcessRunStart"+ this.defId);
// var e = Ext.getCmp("ProcessRunGrid");
// if (e != null) {
// e.getStore().reload();
// }
}
});
}
}
}, '-', {
text : '提交',
iconCls : 'btn-ok',
handler : function() {
var form = formPanel.getForm();
if (form.isValid()) {
form.submit({
url : __ctxPath+ '/flow/saveProcessActivity.do?startFlow=true',
waitMsg : '正在提交信息...',
success : function(userform, o) {
Ext.MessageBox.show({
title : '操作信息',
msg : '成功提交,请查看流程审批情况!',
buttons : Ext.MessageBox.OK,
icon : Ext.MessageBox.INFO
});
App.removeTab("ProcessRunStart"+ this.defId);
}
});
}
}
}]
})
});
$request({
url:__ctxPath+ "/flow/getProcessActivity.do",
params:{
activityName:this.activityName,
defId:this.defId,
runId:this.runId,
taskId:this.taskId
},
success:function(response,options){
var object=Ext.util.JSON.decode(response.responseText);
formPanel.add(object);
formPanel.doLayout();
}
});
return formPanel;
}; | JavaScript |
/**
*
* @param {} piId 流程实例id
* @param {} name 流程名称
* @param {} defId 流程定义id
*/
var ProcessRunDetail=function(runId,defId,piId,name){
this.runId=runId;
this.defId=defId;
this.piId=piId;
this.name=name;
return this.setup();
};
ProcessRunDetail.prototype.setup=function(){
var leftPanel=new Ext.Panel({
title:'流程示意图',
width:600,
height:800,
split:true,
collapsible: true,
/*collapsed:true,*/
region:'west',
margin:'5 5 5 5',
html:'<img src="'+__ctxPath+ '/jbpmImage?piId='+this.piId+'&defId='+this.defId+'"/>'
});
var rightPanel=this.getRightPanel(this.piId,this.runId);
var topPanel=new Ext.Panel({
id:'ProcessRunDetail'+this.runId,
title:'流程详细-'+this.name,
layout:'border',
autoScroll:true,
items:[
leftPanel,rightPanel
]
});
return topPanel;
};
ProcessRunDetail.prototype.getRightPanel=function(piId,runId){
var panel=new Ext.Panel({
title:'流程审批信息',
region:'center',
width:400,
autoScroll:true,
autoLoad:{
url:__ctxPath+'/flow/processRunDetail.do?piId='+piId + "&runId="+ runId
}
});
return panel;
}; | JavaScript |
Ext.ns("MyTaskView");
var MyTaskView = function() {
var a = new Ext.Panel( {
id : "MyTaskView",
iconCls : "menu-flowWait",
bodyStyle : "padding:2px 2px 2px 2px",
layout : "fit",
title : "待办事项",
autoScroll : true,
items : [ this.setup() ]
});
return a;
};
MyTaskView.prototype.setup = function() {
var b = this.initData();
b.load( {
params : {
start : 0,
limit : 25
}
});
var a = new Ext.grid.ColumnModel(
{
columns : [
new Ext.grid.RowNumberer(),
{
header : "userId",
dataIndex : "userId",
width : 20,
hidden : true,
sortable : true
},
{
header : "事项名称",
dataIndex : "activityName",
width : 120
},
{
header : "执行人",
dataIndex : "assignee",
width : 140,
renderer : function(h, g, d, i, f) {
var e = d.data.assignee;
if (e == null || e == "") {
return '<font color="red">暂无执行人</font>';
} else {
return e;
}
}
},
{
header : "开始时间",
dataIndex : "createTime",
width : 100
},
{
header : "到期时间",
dataIndex : "dueDate",
width : 100,
renderer : function(d) {
if (d == "") {
return "无限制";
} else {
return d;
}
}
},
{
hidden : true,
dataIndex : "executionId"
},
{
hidden : true,
dataIndex : "taskId"
},
{
hidden : "true",
dataIndex : "isMultipleTask"
},
{
header : "管理",
dataIndex : "taskdbid",
width : 50,
renderer : function(m, l, g, k, n) {
var i = g.data.taskId;
var d = g.data.executionId;
var h = g.data.assignee;
var e = g.data.taskName;//activityName;
var f = g.data.isMultipleTask;
var p=g.data.pdId;
var j = "";
if (h == "") {
j += '<button title="锁定任务" class="btn-lock" onclick="MyTaskView.lockTask(' + i + ')"></button>';
} else {
j += '<button title="审核任务" class="btn-task" onclick="MyTaskView.nextStep(\''
+ i + "','" + e + "','" + p + "')\"></button>";
j += ' <button title="任务代办" class="btn-user-sel" onclick="MyTaskView.changeTask('
+ i + ",'" + e + "')\"></button>";
if (f == 1) {
j += ' <button title="解锁任务" class="btn-unlock" onclick="MyTaskView.unlockTask(' + i + ')"></button>';
}
}
return j;
}
} ],
defaults : {
sortable : true,
menuDisabled : true,
width : 100
}
});
var c = new Ext.grid.GridPanel( {
id : "MyTaskGrid",
closable : true,
store : b,
shim : true,
trackMouseOver : true,
loadMask : true,
tbar : new Ext.Toolbar( {
height : 28,
items : [ {
text : "刷新",
iconCls : "btn-refresh",
handler : function() {
Ext.getCmp("MyTaskGrid").getStore().reload();
}
} ]
}),
cm : a,
viewConfig : {
forceFit : true,
showPreview : false
},
bbar : new Ext.PagingToolbar( {
pageSize : 25,
store : b,
displayInfo : true,
displayMsg : "显示{0}-{1}, 共{2}条记录。",
emptyMsg : "当前没有记录。"
})
});
return c;
};
MyTaskView.prototype.initData = function() {
var a = new Ext.data.Store( {
proxy : new Ext.data.HttpProxy( {
url : __ctxPath + "/flow/listTask.do"
}),
reader : new Ext.data.JsonReader( {
root : "result",
totalProperty : "totalCounts",
fields : [ "taskName", "activityName", "assignee", "createTime",
"dueDate", "executionId", "pdId", "taskId",
"isMultipleTask" ]
}),
remoteSort : true
});
a.setDefaultSort("dbId", "desc");
return a;
};
MyTaskView.lockTask = function(a) {
Ext.Ajax.request({
url : __ctxPath + "/flow/lockTask.do",
params : {
taskId : a
},
method : "post",
success : function(b, c) {
var e = Ext.getCmp("MyTaskGrid");
var d = Ext.util.JSON.decode(b.responseText);
if (d.hasAssigned == true) {
Ext.MessageBox.alert("操作提示", "该任务已经被其他用户锁定执行!");
} else {
Ext.MessageBox.alert("操作提示", "该任务已经成功锁定,请执行下一步操作!");
}
e.getStore().reload();
}
});
};
MyTaskView.changeTask = function(b, a) {
new ChangeTaskView(b, a);
};
MyTaskView.unlockTask = function(a) {
Ext.Ajax.request( {
url : __ctxPath + "/flow/unlockTask.do",
params : {
taskId : a
},
method : "post",
success : function(b, c) {
var e = Ext.getCmp("MyTaskGrid");
var d = Ext.util.JSON.decode(b.responseText);
if (d.unlocked == true) {
Ext.MessageBox.alert("操作提示", "该任务已经成功解锁!");
} else {
Ext.MessageBox.alert("操作提示", "该任务解锁失败(任务已经由其他人员执行完成)!");
}
e.getStore().reload();
}
});
};
MyTaskView.nextStep = function(b, d, p) {
var c = App.getContentPanel();
var a = c.getItem("ProcessNextForm" + b);
if (a == null) {
a = new ProcessNextForm({taskId:b,activityName:d,piId:p});
c.add(a);
}
a.title=d;
c.activate(a);
}; | JavaScript |
/**
* 流程管理页
*/
var FlowManagerView=function(){
return this.getView();
};
FlowManagerView.prototype.getView=function(){
var selectedNode;
var proDefView=new ProDefinitionView(true);
var treePanel = new Ext.tree.TreePanel({
region : 'west',
title : '流程分类',
collapsible : true,
split : true,
width : 150,
height : 900,
tbar:new Ext.Toolbar({items:[{
xtype:'button',
iconCls:'btn-refresh',
text:'刷新',
handler:function(){
treePanel.root.reload();
}
},
{
xtype:'button',
text:'添加分类',
iconCls:'btn-add',
handler:function(){
new ProTypeForm();
}
}
]}),
loader : new Ext.tree.TreeLoader({
url : __ctxPath + '/flow/rootProType.do'
}),
root : new Ext.tree.AsyncTreeNode({
expanded : true
}),
rootVisible : false,
listeners : {
'click' : function(node){
proDefView.setTypeId(node.id);
var defGridView=Ext.getCmp('ProDefinitionGrid');
defGridView.getStore().proxy.conn.url=__ctxPath + '/flow/listProDefinition.do?typeId='+node.id;
defGridView.getStore().load({
params : {start : 0,limit : 25}
});
}
}
});
function contextmenu(node, e) {
selectedNode = new Ext.tree.TreeNode({
id : node.id,
text : node.text
});
treeMenu.showAt(e.getXY());
}
//树的右键菜单的
treePanel.on('contextmenu', contextmenu, treePanel);
// 创建右键菜单
var treeMenu = new Ext.menu.Menu({
id : 'treeMenu',
items : [{
text : '新建分类',
scope : this,
iconCls:'btn-add',
handler : createNode
}, {
text : '修改分类',
scope : this,
iconCls:'btn-edit',
handler : editNode
}, {
text : '删除分类',
scope : this,
iconCls:'btn-delete',
handler : deleteNode
}]
});
//新建分类
function createNode() {
new ProTypeForm();
};
//编辑分类
function editNode() {
var typeId=selectedNode.id;
new ProTypeForm(typeId);
};
//删除分类
function deleteNode() {
var typeId=selectedNode.id;
$request({
url:__ctxPath+'/flow/removeProType.do',
params:{typeId:typeId},
success:function(result,request){
treePanel.root.reload();
}
});
};
var panel = new Ext.Panel({
title : '流程管理',
layout : 'border',
id:'FlowManagerView',
height : 800,
items : [treePanel,proDefView.getView()]
});
return panel;
};
| JavaScript |
ProcessNextForm = Ext
.extend(
Ext.Panel,
{
formPanel : null,
formButtons : [],
constructor : function(c) {
Ext.applyIf(this, c);
var a = false;
Ext.Ajax.request( {
params : {
taskId : this.taskId
},
async : false,
scope : this,
url : __ctxPath + "/flow/checkTask.do",
success : function(e, f) {
var d = Ext.util.JSON.decode(e.responseText);
if (d.assigned != undefined) {
if (!d.assigned) {
Ext.ux.Toast.msg("操作信息",
"该任务已经被其他用户锁定执行!");
a = true;
}
if (d.assigned) {
Ext.ux.Toast.msg("操作信息", "该任务已经成功锁定!");
}
}
}
});
if (a) {
var b = Ext.getCmp("TaskPanelView");
if (b != null && b != undefined) {
b.getUpdater().update(__ctxPath + "/flow/displayTask.do");
}
ProcessNextForm.superclass.constructor.call(null);
return;
}
ProcessNextForm.superclass.constructor.call(this, {
id : "ProcessForm" + this.taskId,
iconCls : "btn-approvalTask",
title : this.activityName,
layout : "border",
bodyStyle : "padding:5px",
items : []
});
},
initComponent : function() {
var self = this;
var taskId = this.taskId;
var piId=this.piId;
var formOuterPanel = new Ext.Panel( {
autoHeight : true,
layout : "hbox",
border : false,
layoutConfig : {
padding : "5",
pack : "center",
align : "middle"
},
items : [ new Ext.form.Label( {
text : "正在加载流程表单...",
height : 60
}) ]
});
var detailPanel = new Ext.Panel( {
title : "审批信息",
layout : "fit",
autoHeight : true,
autoScroll : true,
autoLoad : {
url : __ctxPath
+ "/flow/processRunDetail.do?randId="
+ Math.random() + "&taskId=" + taskId+'&piId='+piId
}
});
var leftPanel = new Ext.Panel( {
border : false,
region : "center",
layout : "anchor",
autoScroll : true,
bodyStyle : "padding:5px",
items : [ formOuterPanel, detailPanel ]
});
var rightPanel = new Ext.Panel( {
bodyStyle : "padding:5px",
title : "自由跳转",
region : "east",
collapsible : true,
split : true,
width : 210,
layout : {
type : "vbox",
padding : "5",
align : "left"
},
defaults : {
margins : "0 0 5 0"
}
});
this.items = [ leftPanel, rightPanel ];
this.tbar = new Ext.Toolbar( {
items : [ {
text : "流程示意图",
iconCls : "btn-flow-chart",
handler : function() {
new FlowImageWindow( {taskId : taskId,piId:piId}).show();
}
}, "-" ]
});
ProcessNextForm.superclass.initComponent.call(this);
var activityName = this.activityName;
var destName = "";
Ext.Ajax.request( {
url : __ctxPath+ "/flow/getProcessActivity.do",
params : {
activityName : activityName,
taskId : taskId
},
success : function(response, options) {
try {
var isFormPanel = true;
var formPanel = null;
if (response.responseText.trim().indexOf("[") == 0) {
if (activityName == ""|| activityName == "undefined"|| activityName == null) {
activityName = "开始";
}
eval('formPanel = new Ext.FormPanel({title:"任务表单-'+ activityName
+ '",defaults:{border:false},anchor:"100%",bodyStyle:"padding:8px 8px 8px 8px;",layout:"form",autoHeight:true,items:'
+ response.responseText
+ "});");
} else {
if (response.responseText.indexOf("Ext.extend(Ext.Panel") != -1) {
isFormPanel = false;
eval("formPanel= new ("+ response.responseText+ ")();");
} else {
eval("formPanel= new ("+ response.responseText+ ")();");
}
}
formOuterPanel.removeAll(true);
formOuterPanel.add(formPanel);
if (isFormPanel) {
Ext.Ajax.request( {
url : __ctxPath+ "/flow/transProcessActivity.do",
params : {
piId : piId
},
success : function(response,options) {
var object = Ext.util.JSON.decode(response.responseText);
self.getTopToolbar().add(new Ext.Toolbar.Separator());
for ( var i = 0; i < object.data.length; i++) {
self.getTopToolbar().insert(2 + i,self.genFormButton(formPanel,piId,taskId,object.data[i].name,object.data[i].destination,activityName));
}
self.doLayout();
}
});
} else {
formPanel.setTaskId(taskId);
formOuterPanel.doLayout();
}
var freeTransCombo = new Ext.form.ComboBox({
xtype : "combo",
allowBlank : false,
editable : false,
lazyInit : false,
anchor : "96%,96%",
triggerAction : "all",
listeners : {
select : function(combo,record,index) {
destName = record.data.destName;
}
},
store : new Ext.data.SimpleStore({
autoLoad : true,
url : __ctxPath+ "/flow/freeTransProcessActivity.do?taskId="+ taskId,
fields : ["signalName","destName" ]
}),
displayField : "destName",
valueField : "signalName"
});
rightPanel.add(new Ext.form.Label( {text : "跳转任务:"}));
rightPanel.add(freeTransCombo);
rightPanel.add( {
xtype : "label",
text : "下一任务执行人:"
});
var userAssignNames = new Ext.form.TextField({
name : "nextAssignUserNames",
id:'nextAssignUserNames',
width : 160,
readOnly : true,
allowBlank : false
});
var flowAssignId = "";
var userSelectButton = new Ext.Button({
name : "userSelectButton",
text : "选择执行人",
iconCls : "btn-users",
handler : function() {
UserSelector.getView(function(uIds,uNames) {userAssignNames.setValue(uNames);
flowAssignId = uIds;
},true).show();
}
});
rightPanel.add(userAssignNames);
rightPanel.add(userSelectButton);
rightPanel.add(new Ext.Button(
{
text : "自由跳转",
iconCls : "btn-transition",
handler : function() {
if (destName == "") {
Ext.MessageBox.alert("操作信息","请选择自由跳转的任务!");
return;
}
var nextAssignUserNames = Ext.getCmp("nextAssignUserNames");
if (nextAssignUserNames == "") {
Ext.MessageBox.alert("操作信息","请选择下一任务执行人!");
return;
}
var form = null;
if (!isFormPanel) {
form = formPanel.formPanel.getForm();
} else {
form = formPanel.getForm();
}
if (form.isValid()) {
var signalName = freeTransCombo.getValue();
form.submit( {
url : __ctxPath+ "/flow/nextProcessActivity.do",
method : "post",
waitMsg : "正在提交处理,请稍等",
params : {
taskId : taskId,
signalName : signalName,
activityName : activityName,
destName : destName,
flowAssignId : flowAssignId
},
success : function(fp,action) {
Ext.MessageBox.alert("操作信息","成功保存!");
App.removeTab("ProcessForm"+ this.taskId);
var myTaskGrid = Ext.getCmp("MyTaskGrid");
var appHomeTaskGrid = Ext.getCmp("TaskPanelView");
if (appHomeTaskGrid != null) {
appHomeTaskGrid.getUpdater().update(__ctxPath+ "/flow/displayTask.do");
}
if (myTaskGrid != null) {
myTaskGrid.getStore().reload();
}
},
failure : function(fp,action) {
Ext.MessageBox.alert("操作信息","操作出错,请联系管理员!");
}
});
}
}
}));
rightPanel.doLayout();
} catch (e) {
Ext.MessageBox.alert("表单加载信息","流程表单加载出现异常!" + e);
}
}
});
},
genFormButton : function(b,piId,d, a, e, f) {
var c = b;
return {
iconCls : "btn-transition",
text : "转至 [" + e + "]",
listeners : {
"click" : function() {
var g = c.getForm();
if (g.isValid()) {
g.submit( {
url : __ctxPath+ "/flow/nextProcessActivity.do",
method : "post",
waitMsg : "正在提交处理,请稍等",
params : {
piId:piId,
taskId : d,
signalName : a,
activityName : f,
destName : e
},
success : function(h, j) {
Ext.MessageBox.alert("操作信息","成功保存!");
App.removeTab("ProcessForm"+ d);
var k = Ext.getCmp("MyTaskGrid");
var i = Ext.getCmp("TaskPanelView");
if (i != null) {
i.getUpdater().update(__ctxPath+ "/flow/displayTask.do");
}
if (k != null) {
k.getStore().reload();
}
},
failure : function(h, i) {
Ext.MessageBox.alert("操作信息","操作出错,请联系管理员!");
}
});
}
}
}
};
}
});
FlowImageWindow = Ext.extend(Ext.Window, {
constructor : function(a) {
Ext.applyIf(this, a);
FlowImageWindow.superclass.constructor.call(this, {
autoScroll : true,
iconCls : "btn-flow-chart",
bodyStyle : "background-color:white",
maximizable : true,
title : "流程示意图",
width : 600,
height : 500,
modal : true,
layout : "fit",
html : '<img src="' + __ctxPath + "/jbpmImage?piId="+this.piId+"&taskId="+ this.taskId + "&rand=" + Math.random() + '"/>'
});
}
}); | JavaScript |
Ext.ns('ProDefinitionView');
/**
* 流程列表,可管理
* @param isManager 是否可管理
*/
var ProDefinitionView = function(isManager) {
this.isManager=isManager;
};
ProDefinitionView.prototype.setTypeId=function(typeId){
this.typeId=typeId;
ProDefinitionView.typeId=typeId;
}
ProDefinitionView.prototype.getView = function(){
var typeId=this.typeId;
return new Ext.Panel({
title : '流程列表',
region:'center',
autoScroll : true,
items : [new Ext.FormPanel({
height : 35,
frame : true,
layout : 'column',
defaults : {
xtype : 'label'
},
items : [{
text : '请输入查询条件:'
}, {
xtype : 'hidden',
name : 'typeId',
value : typeId
},{
text : '流程的名称'
}, {
xtype : 'textfield',
name : 'Q_name_S_LK'
}, {
xtype : 'button',
text : '查询',
iconCls : 'search',
handler : function() {
var searchPanel = Ext
.getCmp('ProDefinitionSearchForm');
var grid = Ext.getCmp('ProDefinitionGrid');
if (searchPanel.getForm().isValid()) {
searchPanel.getForm().submit({
waitMsg : '正在提交查询',
url : __ctxPath
+ '/flow/listProDefinition.do',
success : function(formPanel, action) {
var result = Ext.util.JSON
.decode(action.response.responseText);
grid.getStore().loadData(result);
}
});
}
}
}]
}), this.setup()]
});
};
/**
* 建立视图
*/
ProDefinitionView.prototype.setup = function() {
var isManager=this.isManager;
var sm = new Ext.grid.CheckboxSelectionModel();
var cm = new Ext.grid.ColumnModel({
columns : [sm, new Ext.grid.RowNumberer(), {
header : 'defId',
dataIndex : 'defId',
hidden : true
}, {
header : '分类名称',
dataIndex : 'proType',
renderer:function(value){
if(value!=null)return value.typeName;
}
}, {
header : '流程的名称',
dataIndex : 'name'
}, {
header : '描述',
dataIndex : 'description'
}, {
header : '创建时间',
dataIndex : 'createtime'
}, {
header : '工作流id',
dataIndex : 'deployId',
hidden:'true'
}, {
header : '管理',
dataIndex : 'defId',
width : 105,
renderer : function(value, metadata, record, rowIndex,
colIndex) {
var defId = record.data.defId;
var name=record.data.name;
var deployId=record.data.deployId;
var str='';
if(isManager){
str = '<button title="删除" value=" " class="btn-del" onclick="ProDefinitionView.remove('
+ defId + ')"></button>';
str += ' <button title="编辑" value=" " class="btn-edit" onclick="ProDefinitionView.edit('
+ defId + ')"></button>';
if(deployId!=null){
str+=' <button title="人员设置" class="btn-setting" onclick="ProDefinitionView.setting(' +
''+defId + ',\''+name+'\')"></button>';
}
}
str+=' <button title="查看" class="btn-preview" onclick="ProDefinitionView.view('
+defId + ',\''+name+'\')"></button>';
str+=' <button title="新建流程" class="btn-newFlow" onclick="ProDefinitionView.newFlow(' +
''+defId + ',\''+name+'\')"></button>';
return str;
}
}],
defaults : {
sortable : true,
menuDisabled : false,
width : 100
}
});
var tbar=isManager?this.topbar():null;
var store = this.store();
store.load({
params : {
start : 0,
limit : 25
}
});
var grid = new Ext.grid.GridPanel({
id : 'ProDefinitionGrid'+(isManager?'':'0'),
tbar : tbar,
store : store,
trackMouseOver : true,
disableSelection : false,
loadMask : true,
autoHeight : true,
cm : cm,
sm : sm,
viewConfig : {
forceFit : true,
enableRowBody : false,
showPreview : false
},
bbar : new Ext.PagingToolbar({
pageSize : 25,
store : store,
displayInfo : true,
displayMsg : '当前显示从{0}至{1}, 共{2}条记录',
emptyMsg : "当前没有记录"
})
});
// grid.addListener('rowdblclick', function(grid, rowindex, e) {
// grid.getSelectionModel().each(function(rec) {
// ProDefinitionView.edit(rec.data.defId);
// });
// });
return grid;
};
/**
* 初始化数据
*/
ProDefinitionView.prototype.store = function() {
var store = new Ext.data.Store({
proxy : new Ext.data.HttpProxy({
url : __ctxPath + '/flow/listProDefinition.do',
params:{typeId:this.typeId==null?0:this.typeId}
}),
reader : new Ext.data.JsonReader({
root : 'result',
totalProperty : 'totalCounts',
id : 'id',
fields : [{
name : 'defId',
type : 'int'
}
, 'proType', 'name', 'description',
'createtime', 'deployId']
}),
remoteSort : true
});
store.setDefaultSort('defId', 'desc');
return store;
};
/**
* 建立操作的Toolbar
*/
ProDefinitionView.prototype.topbar = function() {
var toolbar = new Ext.Toolbar({
height : 30,
bodyStyle : 'text-align:left',
items : [{
iconCls : 'btn-add',
text : '发布流程',
xtype : 'button',
handler : function() {
new ProDefinitionForm(null,ProDefinitionView.typeId);
}
}, {
iconCls : 'btn-del',
text : '删除流程',
xtype : 'button',
handler : function() {
var grid = Ext.getCmp("ProDefinitionGrid");
var selectRecords = grid.getSelectionModel().getSelections();
if (selectRecords.length == 0) {
Ext.Msg.alert("信息", "请选择要删除的记录!");
return;
}
var ids = Array();
for (var i = 0; i < selectRecords.length; i++) {
ids.push(selectRecords[i].data.defId);
}
ProDefinitionView.remove(ids);
}
}]
});
return toolbar;
};
/**
* 删除单个记录
*/
ProDefinitionView.remove = function(id) {
var grid = Ext.getCmp("ProDefinitionGrid");
Ext.Msg.confirm('信息确认', '您确认要删除该记录吗?', function(btn) {
if (btn == 'yes') {
Ext.Ajax.request({
url : __ctxPath
+ '/flow/multiDelProDefinition.do',
params : {
ids : id
},
method : 'post',
success : function() {
Ext.Msg.alert("信息提示", "成功删除所选记录!");
grid.getStore().reload({
params : {
start : 0,
limit : 25
}
});
}
});
}
});
};
/**
*
*/
ProDefinitionView.edit = function(id) {
new ProDefinitionForm(id);
};
/**
* 流程信息查看
* @param {} id
* @param {} name
* @param {} deployId
*/
ProDefinitionView.view=function(defId,name){
var contentPanel=App.getContentPanel();
var detail=contentPanel.getItem('ProDefinitionDetail'+defId);
if(detail==null){
detail=new ProDefinitionDetail(defId,name);
contentPanel.add(detail);
}
contentPanel.activate(detail);
};
/**
* 流程人员设置
* @param {} id
*/
ProDefinitionView.setting=function(defId,name){
var contentPanel=App.getContentPanel();
var settingView=contentPanel.getItem('ProDefinitionSetting'+defId);
if(settingView==null){
settingView=new ProDefinitionSetting(defId,name);
contentPanel.add(settingView);
}
contentPanel.activate(settingView);
};
/**
* 新建流程
* @param {} defId
* @param {} name
*/
ProDefinitionView.newFlow=function(defId,name){
var contentPanel=App.getContentPanel();
var startForm=contentPanel.getItem('ProcessRunStart'+defId);
if(startForm==null){
startForm=new ProcessRunStart(defId,name);
contentPanel.add(startForm);
}
contentPanel.activate(startForm);
};
| JavaScript |
var ProTypeForm = function(typeId) {
this.typeId = typeId;
var fp = this.setup();
var window = new Ext.Window({
id : 'ProTypeFormWin',
title : '流程分类详细信息',
width : 400,
height : 120,
modal : true,
layout : 'anchor',
plain : true,
bodyStyle : 'padding:5px;',
buttonAlign : 'center',
items : [this.setup()],
buttons : [{
text : '保存',
handler : function() {
var fp = Ext.getCmp('ProTypeForm');
if (fp.getForm().isValid()) {
fp.getForm().submit({
method : 'post',
waitMsg : '正在提交数据...',
success : function(fp, action) {
Ext.Msg.alert('操作信息', '成功保存信息!');
Ext.getCmp('proTypeLeftPanel').root.reload();
window.close();
},
failure : function(fp, action) {
Ext.MessageBox.show({
title : '操作信息',
msg : '信息保存出错,请联系管理员!',
buttons : Ext.MessageBox.OK,
icon : 'ext-mb-error'
});
window.close();
}
});
}
}
}, {
text : '取消',
handler : function() {
window.close();
}
}]
});
window.show();
};
ProTypeForm.prototype.setup = function() {
var formPanel = new Ext.FormPanel({
url : __ctxPath + '/flow/saveProType.do',
layout : 'form',
id : 'ProTypeForm',
frame : true,
defaults : {
widht : 300,
anchor : '100%,100%'
},
formId : 'ProTypeFormId',
defaultType : 'textfield',
items : [{
name : 'proType.typeId',
id : 'typeId',
xtype : 'hidden',
value : this.typeId == null ? '' : this.typeId
}, {
fieldLabel : '分类名称',
name : 'proType.typeName',
id : 'typeName'
}
]
});
if (this.typeId != null && this.typeId != 'undefined') {
formPanel.getForm().load({
deferredRender : false,
url : __ctxPath + '/flow/getProType.do?typeId='
+ this.typeId,
waitMsg : '正在载入数据...',
success : function(form, action) {
// Ext.Msg.alert('编辑', '载入成功!');
},
failure : function(form, action) {
// Ext.Msg.alert('编辑', '载入失败');
}
});
}
return formPanel;
};
| JavaScript |
//首页的设置
Ext.ns("App.home");
var tools= [{
id:'refresh',
handler: function(e, target, panel){
}
}, {
id : 'close',
handler : function(e, target, panel) {
panel.ownerCt.remove(panel, true);
}
}];
App.home = {
portal : {
title : '首页',
iconCls:'menu-company',
style : 'padding:4px 4px 4px 4px;',
closable : false,
xtype : 'portal',
region : 'center',
margins : '5 5 5 0',
items : [{
columnWidth : .33,
style : 'padding:0 0 10px 0',
items : [{
title : '最新公告',
layout : 'fit',
tools : tools,
height:240,
autoScroll:true,
autoLoad : {
url : __ctxPath + '/info/showNotice.do'
}
}
, {
title : '日程管理',
tools : tools,
height:240,
autoScroll:true,
autoLoad : {
url : __ctxPath + '/task/showCalendarPlan.do'
}
}]
}, {
columnWidth : .34,
style : 'padding:0 0 10px 10px',
items : [{
title : '新闻中心',
tools : tools,
height:240,
autoScroll:true,
autoLoad : {
url : __ctxPath + '/info/showNews.do'
}
}, {
title : '我的约会',
tools : tools,
height:240,
autoScroll:true,
autoLoad : {
url : __ctxPath+ '/task/showAppointment.do'
}
}]
}, {
columnWidth : .33,
style : 'padding:0 10px 10px 10px',
items : [{
title : '个人短信',
tools : tools,
height:240,
autoScroll:true,
autoLoad : {
url : __ctxPath+'/info/showShortMessage.do'
}
}, {
title : '待办事项',
tools : tools,
html : '待办事项'
}]
}]
}
}; | JavaScript |
var InStockForm = function(buyId) {
this.buyId = buyId;
var fp = this.setup();
var window = new Ext.Window({
id : 'InStockFormWin',
title : '入库单详细信息',
width : 410,
// height : 325,
autoHight : true,
modal : true,
frame : true,
shadow : false,
// layout : 'anchor',
plain : true,
bodyStyle : 'padding:5px;',
buttonAlign : 'center',
items : [this.setup()],
buttons : [{
text : '保存',
iconCls : 'btn-save',
handler : function() {
var fp = Ext.getCmp('InStockForm');
if (fp.getForm().isValid()) {
fp.getForm().submit({
method : 'post',
waitMsg : '正在提交数据...',
success : function(fp, action) {
Ext.Msg.alert('操作信息', '成功保存信息!');
Ext.getCmp('InStockGrid').getStore()
.reload();
window.close();
},
failure : function(fp, action) {
Ext.MessageBox.show({
title : '操作信息',
msg : '信息保存出错,请联系管理员!',
buttons : Ext.MessageBox.OK,
icon : 'ext-mb-error'
});
window.close();
}
});
}
}
}, {
text : '取消',
iconCls : 'btn-cancel',
handler : function() {
window.close();
}
}]
});
window.show();
};
InStockForm.prototype.setup = function() {
var formPanel = new Ext.FormPanel({
url : __ctxPath + '/admin/saveInStock.do',
id : 'InStockForm',
frame : true,
formId : 'InStockFormId',
items : [{
name : 'inStock.buyId',
id : 'buyId',
xtype : 'hidden',
value : this.buyId == null ? '' : this.buyId
}, {
name : 'inStock.goodsId',
xtype : 'hidden',
id : 'goodsId'
}, {
xtype : 'container',
layout : 'column',
style : 'padding-left:0px;margin-bottom:4px;',
items : [{
xtype : 'label',
text : '商品名称:',
style : 'margin-top:2px;',
width : '27.2%'
}, {
// fieldLabel : '商品名称',
xtype : 'textfield',
name : 'inStock.officeGoods.goodsName',
id : 'goodsName',
allowBlank : false,
readOnly : true,
width : '31%'
}, {
xtype : 'button',
text : '选择商品',
handler : function() {
GoodsSelector.getView(function(id, name) {
var goodsIdField = Ext
.getCmp('goodsId');
goodsIdField.setValue(id);
var goodsNameField = Ext
.getCmp('goodsName');
goodsNameField.setValue(name);
}
, true).show();
}
}, {
xtype : 'button',
text : ' 清除记录',
handler : function() {
var goodsIdField = Ext.getCmp('goodsId');
goodsIdField.setValue('');
var goodsNameField = Ext
.getCmp('goodsName');
goodsNameField.setValue('');
}
}]
}, {
xtype : 'container',
id : 'InStockFormContainer',
defaultType : 'textfield',
style : 'padding-left:3px;',
layout : 'form',
defaults : {
widht : 300,
anchor : '100%,100%'
},
items : [{
fieldLabel : ' 供应商',
name : 'inStock.providerName',
id : 'providerName'
}, {
fieldLabel : ' 入库单号',
name : 'inStock.stockNo',
id : 'stockNo',
allowBlank : false,
xtype : 'textfield',
readOnly : true
}, {
fieldLabel : '价格',
name : 'inStock.price',
allowBlank : false,
id : 'price',
xtype : 'numberfield'
}, {
fieldLabel : ' 总数',
name : 'inStock.inCounts',
allowBlank : false,
id : 'inCounts',
xtype : 'numberfield'
}, {
fieldLabel : ' 统计',
name : 'inStock.amount',
allowBlank : false,
id : 'amount'
}, {
fieldLabel : ' 进货日期',
name : 'inStock.inDate',
allowBlank : false,
readOnly : true,
id : 'inDate',
xtype : 'datefield',
format : 'Y-m-d',
width : 126
}]
}, {
xtype : 'container',
layout : 'column',
style : 'padding-left:0px;margin-bottom:4px;',
border : true,
// layout:'column',
items : [{
xtype : 'label',
text : '购买人:',
style : 'margin-top:2px;',
width : '27.2%'
}, {
// fieldLabel : '商品名称',
xtype : 'textfield',
name : 'inStock.buyer',
id : 'buyer',
allowBlank : false,
readOnly : true,
width : '31%'
}, {
xtype : 'button',
text : '选择人员',
handler : function() {
UserSelector.getView(
function(id, name) {
var buyerField = Ext
.getCmp('buyer');
buyerField
.setValue(name);
}
, false).show();
}
}, {
xtype : 'button',
text : ' 清除记录',
handler : function() {
var buyerField = Ext
.getCmp('buyer');
buyerField.setValue('');
}
}]
}]
});
if (this.buyId != null && this.buyId != 'undefined') {
formPanel.getForm().load({
deferredRender : false,
url : __ctxPath + '/admin/getInStock.do?buyId=' + this.buyId,
method : 'post',
waitMsg : '正在载入数据...',
success : function(form, action) {
// Ext.Msg.alert('编辑', '载入成功!');
var inDate = action.result.data.inDate;
var goodsId = action.result.data.officeGoods.goodsId;
var goodsName = action.result.data.officeGoods.goodsName;
var inDateField = Ext.getCmp('inDate');
var goodsIdField = Ext.getCmp('goodsId');
var goodsNameField = Ext.getCmp('goodsName');
goodsIdField.setValue(goodsId);
goodsNameField.setValue(goodsName);
inDateField.setValue(new Date(getDateFromFormat(inDate, "yyyy-MM-dd HH:mm:ss")));
},
failure : function(form, action) {
// Ext.Msg.alert('编辑', '载入失败');
}
});
}
return formPanel;
};
| JavaScript |
var CarForm = function(carId) {
this.carId = carId;
var fp = this.setup();
var window = new Ext.Window({
id : 'CarFormWin',
title : '车辆详细信息',
width : 700,
autoHeight : true,
shadow : false,
modal : true,
layout : 'anchor',
plain : true,
bodyStyle : 'padding:5px;',
buttonAlign : 'center',
items : [this.setup()],
buttons : [{
text : '保存',
handler : function() {
var fp = Ext.getCmp('CarForm');
if (fp.getForm().isValid()) {
fp.getForm().submit({
method : 'post',
waitMsg : '正在提交数据...',
success : function(fp, action) {
Ext.Msg.alert('操作信息', '成功保存信息!');
Ext.getCmp('CarGrid').getStore()
.reload();
window.close();
},
failure : function(fp, action) {
Ext.MessageBox.show({
title : '操作信息',
msg : '信息保存出错,请联系管理员!',
buttons : Ext.MessageBox.OK,
icon : 'ext-mb-error'
});
window.close();
}
});
}
}
}, {
text : '取消',
handler : function() {
window.close();
}
}]
});
window.show();
};
CarForm.prototype.setup = function() {
var formPanel = new Ext.FormPanel({
url : __ctxPath + '/admin/saveCar.do',
layout : 'column',
id : 'CarForm',
frame : true,
defaults : {
widht : 600,
anchor : '100%,100%'
},
border : false,
formId : 'CarFormId',
items : [{
name : 'car.carId',
id : 'carId',
xtype : 'hidden',
value : this.carId == null ? '' : this.carId
}, {
name : 'car.cartImage',
id : 'cartImage',
xtype : 'hidden'
}, {
xtype : 'tabpanel',
columnWidth : .5,
plain : true,
border : false,
activeTab : 0,
defaults : {
bodyStyle : 'padding:10px'
},
items : [{
title : '基本信息',
layout : 'form',
frame : true,
defaults : {
anchor : '100%,100%'
},
defaultType : 'textfield',
items : [{
fieldLabel : '车牌号码',
name : 'car.carNo',
id : 'carNo',
allowBlank : false
}, {
fieldLabel : '车辆类型',
name : 'car.carType',
id : 'carType',
xtype : 'combo',
mode : 'local',
editable : true,
allowBlank : false,
triggerAction : 'all',
store : [['1', '轿车'], ['2', '货车'],
['3', '商务车']]
}, {
fieldLabel : '发动机型号',
name : 'car.engineNo',
id : 'engineNo'
}, {
fieldLabel : '购买保险时间',
name : 'car.buyInsureTime',
id : 'buyInsureTime',
readOnly : true,
editable : false,
xtype : 'datefield',
format : 'Y-m-d'
}, {
fieldLabel : '年审时间',
name : 'car.auditTime',
id : 'auditTime',
readOnly : true,
editable : false,
xtype : 'datefield',
format : 'Y-m-d'
}, {
fieldLabel : '厂牌型号',
name : 'car.factoryModel',
allowBlank : false,
id : 'factoryModel'
}, {
fieldLabel : '驾驶员',
name : 'car.driver',
allowBlank : false,
id : 'driver'
}, {
fieldLabel : '购置日期',
name : 'car.buyDate',
id : 'buyDate',
allowBlank : false,
editable : false,
readOnly : true,
xtype : 'datefield',
format : 'Y-m-d'
}, {
fieldLabel : '当前状态',// 1=可用2=维修中0=报废
hiddenName : 'car.status',
id : 'status',
xtype : 'combo',
mode : 'local',
allowBlank : false,
editable : false,
readOnly : true,
triggerAction : 'all',
store : [['1', '可用'], ['2', '维修中'],
['0', '已报废']]
}]
// }
// }]
}, {
layout : 'fit',
title : '备注',
frame : true,
border : false,
height:268,
defaults : {
anchor : '100%,100%'
},
items : [{
name : 'car.notes',
xtype : 'textarea',
anchor : '100%,100%',
id : 'notes'
}]
}]
}, {
xtype : 'panel',
id : 'carImageDisplay',
frame:false,
html : '',
height : 295,
columnWidth : .5,
html : '<img src="'
+ __ctxPath
+ '/images/default_image_car.jpg" width="100%" height="100%"/>',
tbar : new Ext.Toolbar({
width : '100%',
height : 30,
items : [{
text : '上传',
iconCls : 'btn-upload',
handler : function() {
var photo = Ext.getCmp('cartImage');
var dialog = App.createUploadDialog({
file_cat : 'admin/car',
callback : uploadCarPhoto,
permitted_extensions : ['jpg']
});
if (photo.getValue() != ''
&& photo.getValue() != null
&& photo.getValue() != 'undefined') {
var msg = '再次上传需要先删除原有图片,';
Ext.Msg.confirm('信息确认', msg + '是否删除?',
function(btn) {
if (btn == 'yes') {
// 删除图片
Ext.Ajax.request({
url : __ctxPath
+ '/system/deleteFileAttach.do',
method : 'post',
params : {
filePath : photo.value
},
success : function() {
dialog.show('queryBtn');
// }
}
});
}
})
} else {
dialog.show('queryBtn');
}
}
}
,
{
text : '删除',
iconCls : 'btn-delete',
handler : function() {
var photo = Ext.getCmp('cartImage');
if (photo.value != null && photo.value != ''
&& photo.value != 'undefined') {
var msg = '照片一旦删除将不可恢复,';
Ext.Msg.confirm('确认信息', msg + '是否删除?',
function(btn) {
if (btn == 'yes') {
Ext.Ajax.request({
url : __ctxPath
+ '/system/deleteFileAttach.do',
method : 'post',
params : {
filePath : photo.value
},
success : function() {
photo.setValue('');
var display = Ext.getCmp('carImageDisplay');
display.body.update('<img src="'+ __ctxPath+ '/images/default_image_car.jpg" width="100%" height="100%" />');
}
});
}
});
}// end if
else {
Ext.Msg.alert('提示信息', '您还未增加照片.');
}
}
}
]
})
}
]
});
if (this.carId != null && this.carId != 'undefined') {
formPanel.getForm().load({
deferredRender : false,
url : __ctxPath + '/admin/getCar.do?carId=' + this.carId,
method : 'post',
waitMsg : '正在载入数据...',
success : function(form, action) {
// Ext.Msg.alert('编辑', '载入成功!');
var buyInsureTime = action.result.data.buyInsureTime;
var auditTime = action.result.data.auditTime;
var buyDate = action.result.data.buyDate;
Ext.getCmp('buyInsureTime').setValue(new Date(getDateFromFormat(buyInsureTime, "yyyy-MM-dd HH:mm:ss")));
Ext.getCmp('auditTime').setValue(new Date(getDateFromFormat(auditTime, "yyyy-MM-dd HH:mm:ss")));
Ext.getCmp('buyDate').setValue(new Date(getDateFromFormat(buyDate, "yyyy-MM-dd HH:mm:ss")));
var carImage = action.result.data.cartImage;
var carPanel = Ext.getCmp('carImageDisplay');
if (carImage != null && carImage != ''
&& carImage != 'undefind' && carPanel.body != null) {
carPanel.body.update('<img src="' + __ctxPath
+ '/attachFiles/' + carImage
+ '" width="100%" height="100%"/>');
}
},
failure : function(form, action) {
// Ext.Msg.alert('编辑', '载入失败');
}
});
}
function uploadCarPhoto(data) {
var photo = Ext.getCmp('cartImage');
var display = Ext.getCmp('carImageDisplay');
photo.setValue(data[0].filepath);
display.body.update('<img src="' + __ctxPath + '/attachFiles/'
+ data[0].filepath + '" width="100%" height="100%"/>');
};
return formPanel;
};
| JavaScript |
var CartRepairForm = function(repairId) {
this.repairId = repairId;
var fp = this.setup();
var window = new Ext.Window({
id : 'CartRepairFormWin',
title : '车辆维修详细信息',
width : 430,
autoHeight : true,
modal : true,
shadow:false,
layout : 'anchor',
plain : true,
bodyStyle : 'padding:5px;',
buttonAlign : 'center',
items : [this.setup()],
buttons : [{
text : '保存',
handler : function() {
var fp = Ext.getCmp('CartRepairForm');
if (fp.getForm().isValid()) {
fp.getForm().submit({
method : 'post',
waitMsg : '正在提交数据...',
success : function(fp, action) {
Ext.Msg.alert('操作信息', '成功保存信息!');
Ext.getCmp('CartRepairGrid').getStore()
.reload();
window.close();
},
failure : function(fp, action) {
Ext.MessageBox.show({
title : '操作信息',
msg : '信息保存出错,请联系管理员!',
buttons : Ext.MessageBox.OK,
icon : 'ext-mb-error'
});
window.close();
}
});
}
}
}, {
text : '取消',
handler : function() {
window.close();
}
}]
});
window.show();
};
CartRepairForm.prototype.setup = function() {
var formPanel = new Ext.FormPanel({
url : __ctxPath + '/admin/saveCartRepair.do',
layout : 'form',
id : 'CartRepairForm',
frame : true,
defaults : {
widht : 400,
anchor : '100%,100%'
},
formId : 'CartRepairFormId',
defaultType : 'textfield',
items : [{
name : 'cartRepair.repairId',
id : 'repairId',
xtype : 'hidden',
value : this.repairId == null ? '' : this.repairId
}, {
xtype:'hidden',
name : 'cartRepair.carId',
id : 'carId'
},{
xtype:'container',
style:'padding-left:0px;margin-bottom:4px;',
layout:'column',
items:[{
xtype:'label',
style:'padding-left:0px;',
text:'车牌号码:',
width:102
},{
id:'carNo',
xtype:'textfield',
name:'carNo',
editable:false,
readOnly:true,
width:130
},{
xtype:'button',
iconCls:'btn-car',
text:'选择车辆',
handler:function(){
CarSelector.getView(
function(id,name){
Ext.getCmp('carId').setValue(id);
Ext.getCmp('carNo').setValue(name);
},true,2
).show();
}
},{
xtype:'button',
text:'消除记录',
handler:function(){
Ext.getCmp('carId').setValue('');
Ext.getCmp('carNo').setValue('');
}
}]},{
fieldLabel : '维护日期',
name : 'cartRepair.repairDate',
id : 'repairDate',
xtype:'datefield',
format:'Y-m-d',
editable:false,
readOnly:true
}, {xtype:'container',
style:'padding-left:0px;margin-bottom:4px;',
layout:'column',
items:[{
xtype:'label',
style:'padding-left:0px;',
text:'经办人:',
width:102
},{
xtype:'textfield',
name : 'cartRepair.executant',
id : 'executant',
editable:false,
readOnly:true,
width:130
},{
xtype:'button',
iconCls:'btn-user-sel',
text:'选择人员',
handler:function(){
UserSelector.getView(
function(id,name){
Ext.getCmp('executant').setValue(name);
},true
).show();
}
},{
xtype:'button',
text:'清除纪录',
handler:function(){
Ext.getCmp('executant').setValue('');
}
}]
}, {
fieldLabel : '维修类型',
name : 'cartRepair.repairType',
id : 'repairType',
xtype : 'combo',
mode : 'local',
editable : false,
readOnly:true,
triggerAction : 'all',
store : [['1', '保养'], ['2', '维修']]
}, {
fieldLabel : '费用',
name : 'cartRepair.fee',
id : 'fee'
}, {
fieldLabel : '维护原因',
name : 'cartRepair.reason',
id : 'reason',
xtype:'textarea'
}, {
fieldLabel : '备注',
name : 'cartRepair.notes',
id : 'notes',
xtype:'textarea'
}
]
});
if (this.repairId != null && this.repairId != 'undefined') {
formPanel.getForm().load({
deferredRender : false,
url : __ctxPath + '/admin/getCartRepair.do?repairId='
+ this.repairId,
waitMsg : '正在载入数据...',
success : function(form, action) {
// Ext.Msg.alert('编辑', '载入成功!');
Ext.getCmp('carNo').setValue(action.result.data.car.carNo);
Ext.getCmp('repairDate').setValue(new Date(getDateFromFormat(action.result.data.repairDate, "yyyy-MM-dd HH:mm:ss")));
},
failure : function(form, action) {
// Ext.Msg.alert('编辑', '载入失败');
}
});
}
return formPanel;
};
| JavaScript |
Ext.ns('OfficeGoodsManageView');
var OfficeGoodsManageView=function(){
var selectedNode;
var officeGoodsView=new OfficeGoodsView();
var treePanel = new Ext.tree.TreePanel({
region : 'west',
id : 'leftOfficeGoodManagePanel',
title : '办公用品类型',
collapsible : true,
split : true,
width : 180,
height : 800,
tbar:new Ext.Toolbar({items:[{
xtype:'button',
iconCls:'btn-refresh',
text:'刷新',
handler:function(){
treePanel.root.reload();
}
},
{
xtype:'button',
text:'展开',
iconCls:'btn-expand',
handler:function(){
treePanel.expandAll();
}
},
{
xtype:'button',
text:'收起',
iconCls:'btn-collapse',
handler:function(){
treePanel.collapseAll();
}
}
]}),
loader : new Ext.tree.TreeLoader({
url : __ctxPath + '/admin/treeOfficeGoodsType.do'
}),
root : new Ext.tree.AsyncTreeNode({
expanded : true
}),
rootVisible : false,
listeners : {
'click' : function(node){
if (node != null) {
officeGoodsView.setTypeId(node.id);
var goodsView=Ext.getCmp('OfficeGoodsView');
if(node.id==0){
goodsView.setTitle('所有用品列表');
}else{
goodsView.setTitle('['+node.text+']类型用品列表');
}
var goodsGrid = Ext.getCmp('OfficeGoodsGrid');
var store=goodsGrid.getStore();
store.url=__ctxPath+'/admin/listOfficeGoods.do';
store.baseParams={'Q_officeGoodsType.typeId_L_EQ':node.id==0?null:node.id};
store.params={start:0,limit:25};
store.reload({params:{start:0,limit:25}});
}
}
}
});
function contextmenu(node, e) {
selectedNode = new Ext.tree.TreeNode({
id : node.id,
text : node.text
});
treeMenu.showAt(e.getXY());
}
//树的右键菜单的
treePanel.on('contextmenu', contextmenu, treePanel);
// 创建右键菜单
var treeMenu = new Ext.menu.Menu({
id : 'treeMenu',
items : [
{
text : '新建类别',
scope : this,
iconCls:'btn-add',
handler : createNode
},{
text : '修改类别',
scope : this,
iconCls:'btn-edit',
handler : editNode
},{
text : '删除类别',
scope : this,
iconCls:'btn-delete',
handler : deleteNode
}
]
});
//新建目录
function createNode() {
new OfficeGoodsTypeForm(null);
};
//编辑目录
function editNode() {
var typeId=selectedNode.id;
if(typeId>0){
new OfficeGoodsTypeForm(typeId);
}else{
Ext.MessageBox.show({
title : '操作信息',
msg : '该处不能被修改',
buttons : Ext.MessageBox.OK,
icon : 'ext-mb-error'
});
}
};
//删除目录,子目录也一并删除
function deleteNode() {
var typeId=selectedNode.id;
Ext.Ajax.request({
url:__ctxPath+'/admin/multiDelOfficeGoodsType.do',
params:{ids:typeId},
method:'post',
success:function(result,request){
Ext.Msg.alert('操作信息','成功删除目录!');
treePanel.root.reload();
},
failure:function(result,request){
Ext.MessageBox.show({
title : '操作信息',
msg : '信息保存出错,请联系管理员!',
buttons : Ext.MessageBox.OK,
icon : 'ext-mb-error'
});
}
});
};
var panel = new Ext.Panel({
id:'OfficeGoodsManageView',
title : '办公用品管理',
iconCls:'menu-goods',
layout : 'border',
height : 800,
items : [treePanel,officeGoodsView.getView()]
});
return panel;
};
| JavaScript |
var FixedAssetsForm = function(assetsId) {
this.assetsId = assetsId;
var fp = this.setup();
var window = new Ext.Window({
id : 'FixedAssetsFormWin',
title : '[FixedAssets]详细信息',
width : 420,
height : 310,
modal : true,
layout : 'anchor',
plain : true,
bodyStyle : 'padding:5px;',
buttonAlign : 'center',
items : [this.setup()],
buttons : [{
text : '保存',
iconCls : 'btn-save',
handler : function() {
var fp = Ext.getCmp('FixedAssetsForm');
if (fp.getForm().isValid()) {
fp.getForm().submit({
method : 'post',
waitMsg : '正在提交数据...',
success : function(fp, action) {
Ext.Msg.alert('操作信息', '成功保存信息!');
Ext.getCmp('FixedAssetsGrid').getStore()
.reload();
window.close();
},
failure : function(fp, action) {
Ext.MessageBox.show({
title : '操作信息',
msg : '信息保存出错,请联系管理员!',
buttons : Ext.MessageBox.OK,
icon : 'ext-mb-error'
});
window.close();
}
});
}
}
}, {
text : '取消',
iconCls : 'btn-cancel',
handler : function() {
window.close();
}
}]
});
window.show();
};
FixedAssetsForm.prototype.setup = function() {
var formPanel = new Ext.FormPanel({
url : __ctxPath + '/admin/saveFixedAssets.do',
layout : 'form',
id : 'FixedAssetsForm',
frame : true,
// defaults : {
// width : 200,
// anchor : '98%,98%'
// },
formId : 'FixedAssetsFormId',
defaultType : 'textfield',
items : [{
name : 'fixedAssets.assetsId',
id : 'assetsId',
xtype : 'hidden',
value : this.assetsId == null ? '' : this.assetsId
}, {
xtype : 'tabpanel',
plain : true,
border : false,
activeTab : 0,
items : [{
layout : 'form',
title : '基本信息(*为必填)',
width : 300,
id : 'assetsFormPanel',
height : 190,
defaults : {
anchor : '98%,98%'
},
defaultType : 'textfield',
items : [{
fieldLabel : '资产名称*',
name : 'fixedAssets.assetsName',
id : 'assetsName',
allowBlank : false
}, {
xtype : 'container',
layout : 'column',
id : 'assetsNoContainer',
style : 'padding-left:0px;padding-bottom:3px;',
items : [{
xtype : 'label',
style : 'padding-left:0px;padding-top:3px;',
text : '资产编号:',
width : 101
}, {
xtype : 'textfield',
name : 'fixedAssets.assetsNo',
id : 'assetsNo',
readOnly : true,
width : 266
}]
}, {
fieldLabel : '资产类别*',
hiddenName : 'fixedAssets.assetsType.assetsTypeId',
id : 'assetsTypeId',
xtype : 'combo',
mode : 'local',
allowBlank : false,
editable : false,
valueField : 'id',
displayField : 'name',
readOnly : true,
triggerAction : 'all',
store : new Ext.data.SimpleStore({
url : __ctxPath
+ '/admin/comboxAssetsType.do',
fields : ['id', 'name']
})
}, {
fieldLabel : '置办日期*',
name : 'fixedAssets.buyDate',
id : 'buyDate',
format : 'Y-m-d',
xtype : 'datefield',
allowBlank : false,
editable : false,
readOnly : true
}, {
fieldLabel : '规格型号',
name : 'fixedAssets.model',
id : 'model'
}, {
fieldLabel : '制造厂商',
name : 'fixedAssets.manufacturer',
id : 'manufacturer'
}, {
fieldLabel : '出厂日期',
name : 'fixedAssets.manuDate',
format : 'Y-m-d',
id : 'manuDate',
xtype : 'datefield',
allowBlank : false,
editable : false,
readOnly : true
}]
}, {
layout : 'form',
id : 'deprePanel',
title : '折旧信息(*为必填)',
height : 190,
defaults : {
anchor : '98%,98%'
},
defaultType : 'textfield',
items : [{
fieldLabel : '折旧类型*',
hiddenName : 'fixedAssets.depreType.depreTypeId',
id : 'depreTypeId',
xtype : 'combo',
mode : 'local',
allowBlank : false,
editable : false,
valueField : 'id',
displayField : 'name',
readOnly : true,
triggerAction : 'all',
store : new Ext.data.SimpleStore({
url : __ctxPath
+ '/admin/comboxDepreType.do',
fields : ['id', 'name', 'method']
}),
listeners : {
select : function(combo, record, index) {
var method = record.data.method;
if (method == '1') {
Ext.getCmp('intendTermContainer')
.show();
Ext.getCmp('intendTermContainer')
Ext.getCmp('WorkGrossPanel').hide();
}
if (method == '2') {
Ext.getCmp('WorkGrossPanel').show();
Ext.getCmp('intendTermContainer')
.hide();
}
}
}
}, {
fieldLabel : '开始折旧日期',
name : 'fixedAssets.startDepre',
id : 'startDepre',
format : 'Y-m-d',
xtype : 'datefield',
editable : false,
readOnly : true
}, {
layout : 'column',
xtype : 'container',
style : 'padding-left:0px;padding-bottom:3px;',
id : 'intendTermContainer',
items : [{
xtype : 'label',
style : 'padding-left:0px;',
text : '预计使用年限*:',
width : 101
}, {
xtype : 'textfield',
name : 'fixedAssets.intendTerm',
id : 'intendTerm',
width : 266
}]
}, {
layout : 'column',
xtype : 'container',
style : 'padding-left:0px;padding-bottom:3px;',
id : 'WorkGrossPanel',
defaults : {
anchor : '100%,100%'
},
items : [{
xtype : 'label',
text : '预使用总工作量*:',
style : 'padding-left:0px;',
width : 101
}, {
xtype : 'textfield',
name : 'fixedAssets.intendWorkGross',
id : 'intendWorkGross'
}, {
xtype : 'label',
text : '单位:'
}, {
xtype : 'textfield',
name : 'fixedAssets.workGrossUnit',
id : 'workGrossUnit',
width : 30
}]
}, {
layout : 'column',
style : 'padding-left:0px;padding-bottom:3px;',
xtype : 'container',
items : [{
xtype : 'label',
text : '残值率*',
style : 'padding-left:0px;padding-top:3px;',
width : 101
}, {
xtype : 'textfield',
name : 'fixedAssets.remainValRate',
id : 'remainValRate',
width : 240,
allowBlank : false
}, {
xtype : 'label',
text : '%',
width : 10
}]
}, {
fieldLabel : '资产值*',
name : 'fixedAssets.assetValue',
id : 'assetValue',
allowBlank : false
}, {
fieldLabel : '资产当前值*',
name : 'fixedAssets.assetCurValue',
id : 'assetCurValue',
allowBlank : false
}]
}, {
layout : 'form',
title : '其他信息(*为必填)',
height : 190,
defaults : {
anchor : '98%,98%'
},
defaultType : 'textfield',
items : [{
layout : 'column',
style : 'padding-left:0px;padding-bottom:3px;',
xtype : 'container',
items : [{
xtype : 'label',
text : '所属部门:',
style : 'padding-left:0px;padding-top:3px;',
width : 101
}, {
xtype : 'textfield',
name : 'fixedAssets.beDep',
id : 'beDep',
allowBlank : false,
readOnly : true,
width : 108
}, {
xtype : 'button',
iconCls : 'btn-dep-sel',
text : '选择部门',
handler : function() {
DepSelector.getView(
function(id, name) {
Ext.getCmp('beDep')
.setValue(name);
}, true).show();
}
}, {
xtype : 'button',
text : '清除记录',
handler : function() {
Ext.getCmp('beDep').setValue('');
}
}]
}, {
layout : 'column',
style : 'padding-left:0px;padding-bottom:3px;',
xtype : 'container',
items : [{
xtype : 'label',
text : '保管人:',
style : 'padding-left:0px;padding-top:3px;',
width : 101
}, {
xtype : 'textfield',
name : 'fixedAssets.custodian',
id : 'custodian',
readOnly : true,
width : 108
}, {
xtype : 'button',
iconCls : 'btn-user-sel',
text : '选择人员',
handler : function() {
UserSelector.getView(
function(id, name) {
Ext.getCmp('custodian')
.setValue(name);
}, true).show();
}
}, {
xtype : 'button',
text : '清除记录',
handler : function() {
Ext.getCmp('custodian')
.setValue('');
}
}]
}, {
fieldLabel : '备注',
name : 'fixedAssets.notes',
id : 'notes',
height : 130,
xtype : 'textarea'
}]
}]
}
]
});
if (this.assetsId != null && this.assetsId != 'undefined') {
formPanel.getForm().load({
deferredRender : false,
url : __ctxPath + '/admin/getFixedAssets.do?assetsId='
+ this.assetsId,
waitMsg : '正在载入数据...',
success : function(form, action) {
// Ext.Msg.alert('编辑', '载入成功!');
var method = action.result.data.depreType.calMethod;
if (method == '2') {
Ext.getCmp('WorkGrossPanel').show();
Ext.getCmp('intendTermContainer').hide();
} else {
Ext.getCmp('WorkGrossPanel').hide();
Ext.getCmp('intendTermContainer').show();
}
Ext.getCmp('buyDate').setValue(new Date(getDateFromFormat(
action.result.data.buyDate, "yyyy-MM-dd HH:mm:ss")));
Ext.getCmp('startDepre').setValue(new Date(getDateFromFormat(
action.result.data.startDepre, "yyyy-MM-dd HH:mm:ss")));
Ext.getCmp('manuDate').setValue(new Date(getDateFromFormat(
action.result.data.manuDate, "yyyy-MM-dd HH:mm:ss")));
},
failure : function(form, action) {
// Ext.Msg.alert('编辑', '载入失败');
}
});
}
return formPanel;
};
| JavaScript |
var BookTypeForm = function(typeId) {
this.typeId = typeId;
var fp = this.setup();
var window = new Ext.Window( {
id : 'BookTypeFormWin',
title : '图书类别详细信息',
autoHeight : true,
width: 300,
autoHeight:true,
modal : true,
layout : 'anchor',
plain : true,
bodyStyle : 'padding:5px;',
buttonAlign : 'center',
items : [ this.setup() ],
buttons : [ {
text : '保存',
iconCls:'btn-save',
handler : function() {
var fp = Ext.getCmp('bookTypeForm');
if (fp.getForm().isValid()) {
fp.getForm().submit( {
method : 'post',
waitMsg : '正在提交数据...',
success : function(fp, action) {
Ext.Msg.alert('操作信息', '成功保存信息!');
if(Ext.getCmp('BookTypeGrid')!=null){
Ext.getCmp('BookTypeGrid').getStore().reload();
}
if(Ext.getCmp('leftBookManagePanel')!=null){
Ext.getCmp('leftBookManagePanel').root.reload();
}
window.close();
},
failure : function(fp, action) {
Ext.MessageBox.show( {
title : '操作信息',
msg : '信息保存出错,请联系管理员!',
buttons : Ext.MessageBox.OK,
icon : 'ext-mb-error'
});
window.close();
}
});
}
}
}, {
text : '取消',
iconCls:'btn-cancel',
handler : function() {
window.close();
}
} ]
});
window.show();
};
BookTypeForm.prototype.setup = function() {
var formPanel = new Ext.FormPanel( {
url : __ctxPath + '/admin/saveBookType.do',
layout : 'form',
id : 'bookTypeForm',
frame : true,
defaults : {
//widht : 400,
anchor : '95%,95%'
},
formId : 'BookTypeFormId',
defaultType : 'textfield',
items : [ {
name : 'bookType.typeId',
id : 'typeId',
xtype : 'hidden',
value : this.typeId == null ? '' : this.typeId
}, {
fieldLabel : '图书类别名称',
name : 'bookType.typeName',
id : 'typeName',
allowBlank : false,
blankText : '图书类别不能为空'
}
]
});
if (this.typeId != null && this.typeId != 'undefined') {
formPanel.getForm().load( {
deferredRender : false,
url : __ctxPath + '/admin/getBookType.do?typeId=' + this.typeId,
method : 'post',
waitMsg : '正在载入数据...',
success : function(form, action) {
// Ext.Msg.alert('编辑', '载入成功!');
},
failure : function(form, action) {
// Ext.Msg.alert('编辑', '载入失败');
}
});
}
return formPanel;
};
| JavaScript |
Ext.ns('GoodsApplyView');
/**
* ������������������列表
*/
var GoodsApplyView = function() {
return new Ext.Panel({
id : 'GoodsApplyView',
title : '办公用品申请列表',
iconCls:'menu-goods-apply',
autoScroll : true,
items : [new Ext.FormPanel({
height : 35,
frame : true,
id : 'GoodsApplySearchForm',
layout : 'column',
defaults : {
xtype : 'label'
},
items : [{
text : '请输入查询条件:'
}, {
text : '商品名称'
}, {
xtype : 'textfield',
name : 'Q_officeGoods.goodsName_S_LK'
}, {
text : '申请号'
}, {
xtype : 'textfield',
name : 'Q_applyNo_S_LK'
},{
text : '申请人'
}, {
xtype : 'textfield',
name : 'Q_proposer_S_LK'
}, {
xtype : 'button',
text : '查询',
iconCls : 'search',
handler : function() {
var searchPanel = Ext
.getCmp('GoodsApplySearchForm');
var grid = Ext.getCmp('GoodsApplyGrid');
if (searchPanel.getForm().isValid()) {
searchPanel.getForm().submit({
waitMsg : '正在提交查询',
url : __ctxPath
+ '/admin/listGoodsApply.do',
success : function(formPanel, action) {
var result = Ext.util.JSON
.decode(action.response.responseText);
grid.getStore().loadData(result);
}
});
}
}
}]
}), this.setup()]
});
};
/**
* 建立视图
*/
GoodsApplyView.prototype.setup = function() {
return this.grid();
};
/**
* 建立DataGrid
*/
GoodsApplyView.prototype.grid = function() {
var sm = new Ext.grid.CheckboxSelectionModel();
var cm = new Ext.grid.ColumnModel({
columns : [sm, new Ext.grid.RowNumberer(), {
header : 'applyId',
dataIndex : 'applyId',
hidden : true
}, {
header : '商品名称',
dataIndex : 'goodsName'
}, {
header : '申请日期',
dataIndex : 'applyDate'
}, {
header : '申请号',
dataIndex : 'applyNo'
}, {
header : '申请数量',
dataIndex : 'useCounts'
}, {
header : '申请人',
dataIndex : 'proposer'
}, {
header : '备注',
dataIndex : 'notes'
}, {
header : '审批状态',
dataIndex : 'approvalStatus',
renderer : function(value) {
if (value == '0') {
return '未审批';
}
if (value == '1') {
return '已审批';
}
}
}, {
header : '管理',
dataIndex : 'applyId',
width : 50,
renderer : function(value, metadata, record, rowIndex,
colIndex) {
var editId = record.data.applyId;
var str = '<button title="删除" value=" " class="btn-del" onclick="GoodsApplyView.remove('
+ editId + ')"> </button>';
str += ' <button title="编辑" value=" " class="btn-edit" onclick="GoodsApplyView.edit('
+ editId + ')"> </button>';
return str;
}
}],
defaults : {
sortable : true,
menuDisabled : false,
width : 100
}
});
var store = this.store();
store.load({
params : {
start : 0,
limit : 25
}
});
var grid = new Ext.grid.GridPanel({
id : 'GoodsApplyGrid',
tbar : this.topbar(),
store : store,
trackMouseOver : true,
disableSelection : false,
loadMask : true,
autoHeight : true,
cm : cm,
sm : sm,
viewConfig : {
forceFit : true,
enableRowBody : false,
showPreview : false
},
bbar : new Ext.PagingToolbar({
pageSize : 25,
store : store,
displayInfo : true,
displayMsg : '当前显示从{0}至{1}, 共{2}条记录',
emptyMsg : "当前没有记录"
})
});
grid.addListener('rowdblclick', function(grid, rowindex, e) {
grid.getSelectionModel().each(function(rec) {
GoodsApplyView.edit(rec.data.applyId);
});
});
return grid;
};
/**
* 初始化数据
*/
GoodsApplyView.prototype.store = function() {
var store = new Ext.data.Store({
proxy : new Ext.data.HttpProxy({
url : __ctxPath + '/admin/listGoodsApply.do'
}),
reader : new Ext.data.JsonReader({
root : 'result',
totalProperty : 'totalCounts',
id : 'id',
fields : [{
name : 'applyId',
type : 'int'
}
,{name:'goodsName',mapping:'officeGoods.goodsName'}, 'applyDate', 'applyNo',
'useCounts', 'proposer', 'notes',
'approvalStatus']
}),
remoteSort : true
});
store.setDefaultSort('applyId', 'desc');
return store;
};
/**
* 建立操作的Toolbar
*/
GoodsApplyView.prototype.topbar = function() {
var toolbar = new Ext.Toolbar({
id : 'GoodsApplyFootBar',
height : 30,
bodyStyle : 'text-align:left',
items : [{
iconCls : 'btn-add',
text : '添加 申请单',
xtype : 'button',
handler : function() {
new GoodsApplyForm();
Ext.getCmp('GoodsApplyForm').remove('applyNo');
Ext.getCmp('GoodsApplyForm').remove('approvalStatus');
}
}, {
iconCls : 'btn-del',
text : '删除申请单',
xtype : 'button',
handler : function() {
var grid = Ext.getCmp("GoodsApplyGrid");
var selectRecords = grid.getSelectionModel()
.getSelections();
if (selectRecords.length == 0) {
Ext.Msg.alert("信息", "请选择要删除的记录!");
return;
}
var ids = Array();
for (var i = 0; i < selectRecords.length; i++) {
ids.push(selectRecords[i].data.applyId);
}
GoodsApplyView.remove(ids);
}
}]
});
return toolbar;
};
/**
* 删除单个记录
*/
GoodsApplyView.remove = function(id) {
var grid = Ext.getCmp("GoodsApplyGrid");
Ext.Msg.confirm('信息确认', '您确认要删除该记录吗?', function(btn) {
if (btn == 'yes') {
Ext.Ajax.request({
url : __ctxPath
+ '/admin/multiDelGoodsApply.do',
params : {
ids : id
},
method : 'post',
success : function() {
Ext.Msg.alert("信息提示", "成功删除所选记录!");
grid.getStore().reload({
params : {
start : 0,
limit : 25
}
});
}
});
}
});
};
/**
*
*/
GoodsApplyView.edit = function(id) {
new GoodsApplyForm(id);
}
| JavaScript |
Ext.ns('InStockView');
/**
* ������������������������������������������������������������列表
*/
var InStockView = function() {
return new Ext.Panel({
id : 'InStockView',
title : '入库用品列表',
iconCls:'menu-instock',
autoScroll : true,
items : [new Ext.FormPanel({
height : 35,
frame : true,
id : 'InStockSearchForm',
layout : 'column',
defaults : {
xtype : 'label'
},
items : [{
text : '请输入查询条件:'
}, {
text : '商品名称'
}, {
xtype : 'textfield',
name : 'Q_officeGoods.goodsName_S_LK'
}, {
text : '供应商'
}, {
xtype : 'textfield',
name : 'Q_providerName_S_LK'
}, {
text : '购买人'
}, {
xtype : 'textfield',
name : 'Q_buyer_S_LK'
}, {
xtype : 'button',
text : '查询',
iconCls : 'search',
handler : function() {
var searchPanel = Ext.getCmp('InStockSearchForm');
var grid = Ext.getCmp('InStockGrid');
if (searchPanel.getForm().isValid()) {
searchPanel.getForm().submit({
waitMsg : '正在提交查询',
url : __ctxPath + '/admin/listInStock.do',
success : function(formPanel, action) {
var result = Ext.util.JSON
.decode(action.response.responseText);
grid.getStore().loadData(result);
}
});
}
}
}]
}), this.setup()]
});
};
/**
* 建立视图
*/
InStockView.prototype.setup = function() {
return this.grid();
};
/**
* 建立DataGrid
*/
InStockView.prototype.grid = function() {
var sm = new Ext.grid.CheckboxSelectionModel();
var cm = new Ext.grid.ColumnModel({
columns : [sm, new Ext.grid.RowNumberer(), {
header : 'buyId',
dataIndex : 'buyId',
hidden : true
}, {
header : '商品名称',
dataIndex : 'goodsName'
}, {
header : '供应商',
dataIndex : 'providerName'
}, {
header : '库存号',
dataIndex : 'stockNo'
}, {
header : '价格',
dataIndex : 'price'
}, {
header : '入货数量',
dataIndex : 'inCounts'
}, {
header : '总额',
dataIndex : 'amount'
}, {
header : '入库日期',
dataIndex : 'inDate'
}, {
header : '购买人',
dataIndex : 'buyer'
}, {
header : '管理',
dataIndex : 'buyId',
sortable:false,
width : 50,
renderer : function(value, metadata, record, rowIndex,
colIndex) {
var editId = record.data.buyId;
var str = '<button title="删除" value=" " class="btn-del" onclick="InStockView.remove('
+ editId + ')"> </button>';
str += ' <button title="编辑" value=" " class="btn-edit" onclick="InStockView.edit('
+ editId + ')"> </button>';
return str;
}
}],
defaults : {
sortable : true,
menuDisabled : false,
width : 100
}
});
var store = this.store();
store.load({
params : {
start : 0,
limit : 25
}
});
var grid = new Ext.grid.GridPanel({
id : 'InStockGrid',
tbar : this.topbar(),
store : store,
trackMouseOver : true,
disableSelection : false,
loadMask : true,
autoHeight : true,
cm : cm,
sm : sm,
viewConfig : {
forceFit : true,
enableRowBody : false,
showPreview : false
},
bbar : new Ext.PagingToolbar({
pageSize : 25,
store : store,
displayInfo : true,
displayMsg : '当前显示从{0}至{1}, 共{2}条记录',
emptyMsg : "当前没有记录"
})
});
grid.addListener('rowdblclick', function(grid, rowindex, e) {
grid.getSelectionModel().each(function(rec) {
InStockView.edit(rec.data.buyId);
});
});
return grid;
};
/**
* 初始化数据
*/
InStockView.prototype.store = function() {
var store = new Ext.data.Store({
proxy : new Ext.data.HttpProxy({
url : __ctxPath + '/admin/listInStock.do'
}),
reader : new Ext.data.JsonReader({
root : 'result',
totalProperty : 'totalCounts',
id : 'id',
fields : [{
name : 'buyId',
type : 'int'
}
, {name:'goodsName',mapping:'officeGoods.goodsName'}, 'providerName', 'stockNo',
'price', 'inCounts', 'amount', 'inDate',
'buyer']
}),
remoteSort : true
});
store.setDefaultSort('buyId', 'desc');
return store;
};
/**
* 建立操作的Toolbar
*/
InStockView.prototype.topbar = function() {
var toolbar = new Ext.Toolbar({
id : 'InStockFootBar',
height : 30,
bodyStyle : 'text-align:left',
items : [{
iconCls : 'btn-add',
text : '添加入库单',
xtype : 'button',
handler : function() {
new InStockForm();
Ext.getCmp('InStockFormContainer').remove('stockNo');
Ext.getCmp('InStockFormContainer').remove('amount');
}
}, {
iconCls : 'btn-del',
text : '删除入库单',
xtype : 'button',
handler : function() {
var grid = Ext.getCmp("InStockGrid");
var selectRecords = grid.getSelectionModel()
.getSelections();
if (selectRecords.length == 0) {
Ext.Msg.alert("信息", "请选择要删除的记录!");
return;
}
var ids = Array();
for (var i = 0; i < selectRecords.length; i++) {
ids.push(selectRecords[i].data.buyId);
}
InStockView.remove(ids);
}
}]
});
return toolbar;
};
/**
* 删除单个记录
*/
InStockView.remove = function(id) {
var grid = Ext.getCmp("InStockGrid");
Ext.Msg.confirm('信息确认', '您确认要删除该记录吗?', function(btn) {
if (btn == 'yes') {
Ext.Ajax.request({
url : __ctxPath + '/admin/multiDelInStock.do',
params : {
ids : id
},
method : 'post',
success : function() {
Ext.Msg.alert("信息提示", "成功删除所选记录!");
grid.getStore().reload({
params : {
start : 0,
limit : 25
}
});
}
});
}
});
};
/**
*
*/
InStockView.edit = function(id) {
new InStockForm(id);
}
| JavaScript |
var BookReturnForm = function(recordId) {
this.recordId = recordId;
var fp = this.setup();
var window = new Ext.Window( {
id : 'BookReturnFormWin',
title : '图书归还详细记录',
width : 500,
//height : 420,
autoHeight : true,
modal : true,
layout : 'anchor',
plain : true,
bodyStyle : 'padding:5px;',
buttonAlign : 'center',
items : [ this.setup() ],
buttons : [ {
text : '归还图书',
iconCls : 'btn-save',
handler : function() {
var fp = Ext.getCmp('BookReturnForm');
if (fp.getForm().isValid()) {
fp.getForm().submit( {
method : 'post',
waitMsg : '正在提交数据...',
success : function(fp, action) {
Ext.Msg.alert('操作信息', '成功保存信息!');
Ext.getCmp('BookReturnGrid').getStore().reload();
window.close();
},
failure : function(fp, action) {
Ext.MessageBox.show( {
title : '操作信息',
msg : '信息保存出错,请联系管理员!',
buttons : Ext.MessageBox.OK,
icon : 'ext-mb-error'
});
window.close();
}
});
}
}
}, {
text : '取消',
iconCls : 'btn-cancel',
handler : function() {
window.close();
}
} ]
});
window.show();
};
BookReturnForm.prototype.setup = function() {
var formPanel = new Ext.FormPanel( {
url : __ctxPath + '/admin/saveReturnBookBorRet.do',
layout : 'form',
id : 'BookReturnForm',
frame : true,
defaults : {
widht : 400,
anchor : '100%,100%'
},
formId : 'BookReturnFormId',
defaultType : 'textfield',
items : [ {
name : 'bookBorRet.recordId',
id : 'recordId',
xtype : 'hidden',
value : this.recordId == null ? '' : this.recordId
}, {
name : 'bookBorRet.bookSnId',
id : 'bookSnId',
xtype : 'hidden'
}, {
xtype : 'container',
layout : 'column',
style : 'padding-left:0px;margin-bottom:4px;',
items : [
{
xtype : 'label',
text : '借出图书名称:',
style : 'padding-left:0px;margin-top:2px;',
width : '100'
},
{
xtype : 'textfield',
name : 'bookBorRet.bookName',
id : 'bookName',
allowBlank : false,
blankText : '借出图书名称不能为空',
readOnly : true,
width : '45%'
},
{
xtype : 'button',
text : '选择图书',
handler : function() {
BookSelector.getView(
function(id, name) {
var bookNameField = Ext
.getCmp('bookName');
bookNameField.setValue(name);
var store = Ext.getCmp(
'borrowIsbn')
.getStore();
store.reload( {
params : {
bookId : id
}
});
}, true).show();
}
}, {
xtype : 'button',
text : ' 清除记录',
handler : function() {
var bookNameField = Ext.getCmp('bookName');
bookNameField.setValue('');
}
} ]
},
{
xtype : 'container',
layout : 'column',
style : 'padding-left:0px;margin-bottom:4px;',
items : [ {
xtype : 'label',
text : '借出图书的ISBN:',
style : 'padding-left:0px;margin-top:2px;',
width : '100'
}, {
hiddenName : 'bookBorRet.borrowIsbn',
id : 'borrowIsbn',
allowBlank : false,
blankText : '借出图书的ISBN不能为空',
//readOnly : true,
width : '45%',
maxHeight : 200,
xtype : 'combo',
mode : 'local',
editable : false,
triggerAction : 'all',
emptyText : '请选择图书系列',
store : new Ext.data.SimpleStore( {
url : __ctxPath + '/admin/getSnBookSn.do',
fields : [ 'bookSnId', 'bookSn' ]
}),
displayField : 'bookSn',
valueField : 'bookSnId',
listeners : {
select : function(combo, record, index) {
Ext.getCmp('bookSnId').setValue(combo.value);
}
}
} ]
}, {
fieldLabel : '借出时间',
name : 'bookBorRet.borrowTime',
id : 'borrowTime',
xtype : 'datefield',
format : 'Y-m-d',
readOnly : true,
allowBlank : false,
blankText : '借出时间不能为空'
}, {
fieldLabel : '应还时间',
name : 'bookBorRet.returnTime',
id : 'returnTime',
xtype : 'datefield',
format : 'Y-m-d',
readOnly : true,
allowBlank : false,
blankText : '应还时间不能为空'
}]
});
if (this.recordId != null && this.recordId != 'undefined') {
formPanel.getForm().load(
{
deferredRender : false,
url : __ctxPath + '/admin/getBookBorRet.do?recordId='
+ this.recordId,
method : 'post',
waitMsg : '正在载入数据...',
success : function(form, action) {
// Ext.Msg.alert('编辑', '载入成功!');
// 对借出日期、应还日期格式化后再进行输出
var borrowTime = action.result.data.borrowTime;
var borrowTimeField = Ext.getCmp('borrowTime');
var returnTime = action.result.data.returnTime;
var returnTimeField = Ext.getCmp('returnTime');
borrowTimeField.setValue(new Date(getDateFromFormat(borrowTime, "yyyy-MM-dd HH:mm:ss")));
returnTimeField.setValue(new Date(getDateFromFormat(returnTime, "yyyy-MM-dd HH:mm:ss")));
},
failure : function(form, action) {
// Ext.Msg.alert('编辑', '载入失败');
}
});
}
return formPanel;
};
| JavaScript |
var DepreTypeForm = function(depreTypeId) {
this.depreTypeId = depreTypeId;
var fp = this.setup();
var window = new Ext.Window({
id : 'DepreTypeFormWin',
title : '折旧类型详细信息',
width : 400,
height : 260,
modal : true,
layout : 'anchor',
plain : true,
bodyStyle : 'padding:5px;',
buttonAlign : 'center',
items : [this.setup()],
buttons : [{
text : '保存',
iconCls : 'btn-save',
handler : function() {
var fp = Ext.getCmp('DepreTypeForm');
if (fp.getForm().isValid()) {
fp.getForm().submit({
method : 'post',
waitMsg : '正在提交数据...',
success : function(fp, action) {
Ext.Msg.alert('操作信息', '成功保存信息!');
Ext.getCmp('DepreTypeGrid').getStore()
.reload();
window.close();
},
failure : function(fp, action) {
Ext.MessageBox.show({
title : '操作信息',
msg : '信息保存出错,请联系管理员!',
buttons : Ext.MessageBox.OK,
icon : 'ext-mb-error'
});
window.close();
}
});
}
}
}, {
text : '取消',
iconCls : 'btn-cancel',
handler : function() {
window.close();
}
}]
});
window.show();
};
DepreTypeForm.prototype.setup = function() {
var formPanel = new Ext.FormPanel({
url : __ctxPath + '/admin/saveDepreType.do',
layout : 'form',
id : 'DepreTypeForm',
frame : true,
defaults : {
width : 400,
anchor : '98%,98%'
},
formId : 'DepreTypeFormId',
defaultType : 'textfield',
items : [{
name : 'depreType.depreTypeId',
id : 'depreTypeId',
xtype : 'hidden',
value : this.depreTypeId == null
? ''
: this.depreTypeId
}, {
fieldLabel : '分类名称',
name : 'depreType.typeName',
id : 'typeName'
},{
xtype:'container',
layout:'column',
style:'padding-left:0px;padding-bottom:3px;',
items:[{
xtype:'label',
text:'折旧率:',
width:101,
style:'padding-left:0px;padding-top:3px;'
},{
xtype:'textfield',
name : 'depreType.depreRate',
id : 'depreRate',
width:220
},{
xtype:'label',
text:'%'
}]
}, {
xtype:'container',
style:'padding-left:0px;padding-bottom:3px;',
layout:'column',
items:[{
xtype:'label',
text:'折旧周期:',
width:101,
style:'padding-left:0px;padding-top:3px;'
},{
xtype:'textfield',
name : 'depreType.deprePeriod',
id : 'deprePeriod',
width:220
},{
xtype:'label',
text:'月'
}]
}, {
fieldLabel : '折旧计算方法',
hiddenName : 'depreType.calMethod',
id : 'calMethod',
xtype : 'combo',
mode : 'local',
editable : false,
readOnly : true,
allowBlank : false,
triggerAction : 'all',
store : [['1', '平均年限法'], ['2', '工作量法'],
['3', '双倍余额递减法'], ['4', '年数总和法']]
}, {
fieldLabel : '类型说明',
name : 'depreType.typeDesc',
id : 'typeDesc',
xtype : 'textarea'
}
]
});
if (this.depreTypeId != null && this.depreTypeId != 'undefined') {
formPanel.getForm().load({
deferredRender : false,
url : __ctxPath + '/admin/getDepreType.do?depreTypeId='
+ this.depreTypeId,
waitMsg : '正在载入数据...',
success : function(form, action) {
// Ext.Msg.alert('编辑', '载入成功!');
},
failure : function(form, action) {
// Ext.Msg.alert('编辑', '载入失败');
}
});
}
return formPanel;
};
| JavaScript |
Ext.ns('FixedAssetsView');
/**
* [FixedAssets]列表
*/
var FixedAssetsView = function() {
}
FixedAssetsView.prototype.setTypeId = function(typeId) {
this.typeId = typeId;
FixedAssetsView.typeId = typeId;
}
FixedAssetsView.prototype.getTypeId = function() {
return this.typeId;
}
FixedAssetsView.prototype.getView = function() {
return new Ext.Panel({
id : 'FixedAssetsView',
title : '固定资产列表',
region : 'center',
autoScroll : true,
items : [new Ext.FormPanel({
height : 35,
frame : true,
id : 'FixedAssetsSearchForm',
layout : 'column',
defaults : {
xtype : 'label'
},
items : [{
text : '查询条件:'
}
// , {
// text : '资产编号'
// }, {
// xtype : 'textfield',
// name : 'Q_assetsNo_S_LK'
// }
, {
text : '资产名称'
}, {
xtype : 'textfield',
name : 'Q_assetsName_S_LK'
},
// {
// text : ''
// }, {
// xtype : 'textfield',
// name : 'Q_assetsTypeId_S_LK'
// }, {
// text : ''
// }, {
// xtype : 'textfield',
// name : 'Q_manufacturer_S_LK'
// }, {
// text : ''
// }, {
// xtype : 'textfield',
// name : 'Q_manuDate_S_LK'
// }, {
// text : ''
// }, {
// xtype : 'textfield',
// name : 'Q_buyDate_S_LK'
// },
{
text : '所属部门'
}, {
xtype : 'textfield',
name : 'Q_beDep_S_LK'
},
// {
// text : ''
// }, {
// xtype : 'textfield',
// name : 'Q_custodian_S_LK'
// }, {
// text : ''
// }, {
// xtype : 'textfield',
// name : 'Q_notes_S_LK'
// }, {
// text : ''
// }, {
// xtype : 'textfield',
// name : 'Q_remainValRate_S_LK'
// }, {
// text : ''
// }, {
// xtype : 'textfield',
// name : 'Q_depreTypeId_S_LK'
// }, {
// text : ''
// }, {
// xtype : 'textfield',
// name : 'Q_startDepre_S_LK'
// }, {
// text : ''
// }, {
// xtype : 'textfield',
// name : 'Q_intendTerm_S_LK'
// }, {
// text : '当折旧的方法选择用工作量法进行计算时,才需要填写'
// }, {
// xtype : 'textfield',
// name : 'Q_intendWorkGross_S_LK'
// }, {
// text : ''
// }, {
// xtype : 'textfield',
// name : 'Q_workGrossUnit_S_LK'
// }, {
// text : ''
// }, {
// xtype : 'textfield',
// name : 'Q_assetValue_S_LK'
// }, {
// text : ''
// }, {
// xtype : 'textfield',
// name : 'Q_assetCurValue_S_LK'
// },
{
xtype : 'button',
text : '查询',
iconCls : 'search',
handler : function() {
var searchPanel = Ext
.getCmp('FixedAssetsSearchForm');
var grid = Ext.getCmp('FixedAssetsGrid');
if (searchPanel.getForm().isValid()) {
searchPanel.getForm().submit({
waitMsg : '正在提交查询',
url : __ctxPath
+ '/admin/listFixedAssets.do',
success : function(formPanel, action) {
var result = Ext.util.JSON
.decode(action.response.responseText);
grid.getStore().loadData(result);
}
});
}
}
}]
}), this.setup()]
});
};
/**
* 建立视图
*/
FixedAssetsView.prototype.setup = function() {
return this.grid();
};
/**
* 建立DataGrid
*/
FixedAssetsView.prototype.grid = function() {
var sm = new Ext.grid.CheckboxSelectionModel();
var cm = new Ext.grid.ColumnModel({
columns : [sm, new Ext.grid.RowNumberer(), {
header : 'assetsId',
dataIndex : 'assetsId',
hidden : true
}, {
header : '资产编号',
dataIndex : 'assetsNo'
}, {
header : '资产名称',
dataIndex : 'assetsName'
}, {
header : '资产类别',
dataIndex : 'assetsTypeName'
},
// {
// header : '所属部门',
// dataIndex : 'beDep'
// }, {
// header : '保管人',
// dataIndex : 'custodian'
// },
{
header : '折旧类型',
dataIndex : 'depType',
renderer:function(value){
return value.typeName;
}
}, {
header : '开始折旧日期',
dataIndex : 'startDepre'
}, {
header : '资产值',
dataIndex : 'assetValue'
},
// {
// header : '资产当前值',
// dataIndex : 'assetCurValue'
// },
{
header : '管理',
dataIndex : 'assetsId',
width : 50,
sortable : false,
renderer : function(value, metadata, record, rowIndex,
colIndex) {
var editId = record.data.assetsId;
var calMethod=record.data.depType.calMethod;
var str = '<button title="开始折算" value=" " class="btn-edit" onclick="FixedAssetsView.depreciate('
+ editId+','+calMethod+')"> </button>';
str += ' <button title="删除" value=" " class="btn-del" onclick="FixedAssetsView.remove('
+ editId + ')"> </button>';
str += ' <button title="编辑" value=" " class="btn-edit" onclick="FixedAssetsView.edit('
+ editId + ')"> </button>';
return str;
}
}],
defaults : {
sortable : true,
menuDisabled : false,
width : 100
}
});
var store = this.store();
store.load({
params : {
start : 0,
limit : 25
}
});
var grid = new Ext.grid.GridPanel({
id : 'FixedAssetsGrid',
tbar : this.topbar(),
store : store,
trackMouseOver : true,
disableSelection : false,
loadMask : true,
autoHeight : true,
cm : cm,
sm : sm,
viewConfig : {
forceFit : true,
enableRowBody : false,
showPreview : false
},
bbar : new Ext.PagingToolbar({
pageSize : 25,
store : store,
displayInfo : true,
displayMsg : '当前显示从{0}至{1}, 共{2}条记录',
emptyMsg : "当前没有记录"
})
});
grid.addListener('rowdblclick', function(grid, rowindex, e) {
grid.getSelectionModel().each(function(rec) {
FixedAssetsView.edit(rec.data.assetsId);
});
});
return grid;
};
/**
* 初始化数据
*/
FixedAssetsView.prototype.store = function() {
var store = new Ext.data.Store({
proxy : new Ext.data.HttpProxy({
url : __ctxPath + '/admin/listFixedAssets.do'
}),
reader : new Ext.data.JsonReader({
root : 'result',
totalProperty : 'totalCounts',
id : 'id',
fields : [{
name : 'assetsId',
type : 'int'
}
, 'assetsNo', 'assetsName', 'model', {
name : 'assetsTypeName',
mapping : 'assetsType.typeName'
}, 'manufacturer', 'manuDate', 'buyDate',
'beDep', 'custodian', 'notes',
'remainValRate', {
name : 'depType',
mapping : 'depreType'
}, 'startDepre', 'intendTerm',
'intendWorkGross', 'workGrossUnit',
'assetValue', 'assetCurValue']
}),
remoteSort : true
});
store.setDefaultSort('assetsId', 'desc');
return store;
};
/**
* 建立操作的Toolbar
*/
FixedAssetsView.prototype.topbar = function() {
var toolbar = new Ext.Toolbar({
id : 'FixedAssetsFootBar',
height : 30,
bodyStyle : 'text-align:left',
items : [{
iconCls : 'btn-add',
text : '创建固定资产项',
xtype : 'button',
handler : function() {
new FixedAssetsForm();
Ext.getCmp('intendTermContainer').hide();
Ext.getCmp('WorkGrossPanel').hide();
Ext.getCmp('depreTypeId').getStore().reload();
Ext.getCmp('assetsTypeId').getStore().reload();
Ext.getCmp('assetsFormPanel')
.remove('assetsNoContainer');
}
}, {
iconCls : 'btn-del',
text : '删除固定资产项',
xtype : 'button',
handler : function() {
var grid = Ext.getCmp("FixedAssetsGrid");
var selectRecords = grid.getSelectionModel()
.getSelections();
if (selectRecords.length == 0) {
Ext.Msg.alert("信息", "请选择要删除的记录!");
return;
}
var ids = Array();
for (var i = 0; i < selectRecords.length; i++) {
ids.push(selectRecords[i].data.assetsId);
}
FixedAssetsView.remove(ids);
}
}]
});
return toolbar;
};
/**
* 删除单个记录
*/
FixedAssetsView.remove = function(id) {
var grid = Ext.getCmp("FixedAssetsGrid");
Ext.Msg.confirm('信息确认', '您确认要删除该记录吗?', function(btn) {
if (btn == 'yes') {
Ext.Ajax.request({
url : __ctxPath
+ '/admin/multiDelFixedAssets.do',
params : {
ids : id
},
method : 'post',
success : function() {
Ext.Msg.alert("信息提示", "成功删除所选记录!");
grid.getStore().reload({
params : {
start : 0,
limit : 25
}
});
}
});
}
});
};
/**
*
*/
FixedAssetsView.edit = function(id) {
new FixedAssetsForm(id);
Ext.getCmp('intendTermContainer').hide();
Ext.getCmp('WorkGrossPanel').hide();
Ext.getCmp('depreTypeId').getStore().reload();
Ext.getCmp('assetsTypeId').getStore().reload();
}
/**
* 折旧
*/
FixedAssetsView.depreciate = function(id,method) {
if(method==2){
new DepreWin(id);
}else if(method==1){
Ext.Msg.confirm('操作提示','你决定开始折算了吗?',function(btn){
if(btn=='yes'){
Ext.Ajax.request({
url : __ctxPath + '/admin/depreciateDepreRecord.do',
params : {ids : id},
method : 'post',
success : function(response, options) {
var result = Ext.util.JSON.decode(response.responseText);
if(result.success){
Ext.Msg.alert("信息提示", "成功产生折旧记录!");
}else{
Ext.Msg.alert("信息提示", result.message);
}
},
failure:function(response, options){
var result = Ext.util.JSON.decode(response.responseText);
Ext.Msg.alert("信息提示",result.message);
}
});
}
});
}else{
Ext.Msg.alert("信息提示","抱歉,该类型的折算方法待实现!");
}
}
| JavaScript |
var OfficeGoodsTypeForm = function(typeId) {
this.typeId = typeId;
var fp = this.setup();
var window = new Ext.Window({
id : 'OfficeGoodsTypeFormWin',
title : '办公用品类型详细信息',
width : 300,
height : 120,
modal : true,
layout : 'anchor',
plain : true,
bodyStyle : 'padding:5px;',
buttonAlign : 'center',
items : [this.setup()],
buttons : [{
text : '保存',
iconCls:'btn-save',
handler : function() {
var fp = Ext.getCmp('OfficeGoodsTypeForm');
if (fp.getForm().isValid()) {
fp.getForm().submit({
method : 'post',
waitMsg : '正在提交数据...',
success : function(fp, action) {
Ext.Msg.alert('操作信息', '成功保存信息!');
Ext.getCmp('leftOfficeGoodManagePanel').root
.reload();
window.close();
},
failure : function(fp, action) {
Ext.MessageBox.show({
title : '操作信息',
msg : '信息保存出错,请联系管理员!',
buttons : Ext.MessageBox.OK,
icon : 'ext-mb-error'
});
window.close();
}
});
}
}
}, {
text : '取消',
iconCls:'btn-cancel',
handler : function() {
window.close();
}
}]
});
window.show();
};
OfficeGoodsTypeForm.prototype.setup = function() {
var formPanel = new Ext.FormPanel({
url : __ctxPath + '/admin/saveOfficeGoodsType.do',
layout : 'form',
id : 'OfficeGoodsTypeForm',
frame : true,
defaults : {
widht : 400,
anchor : '100%,100%'
},
formId : 'OfficeGoodsTypeFormId',
defaultType : 'textfield',
items : [{
name : 'officeGoodsType.typeId',
id : 'typeId',
xtype : 'hidden',
value : this.typeId == null ? '' : this.typeId
}, {
fieldLabel : '分类名称',
name : 'officeGoodsType.typeName',
id : 'typeName',
allowBlank:false
}
]
});
if (this.typeId != null && this.typeId != 'undefined') {
formPanel.getForm().load({
deferredRender : false,
url : __ctxPath + '/admin/getOfficeGoodsType.do?typeId='
+ this.typeId,
waitMsg : '正在载入数据...',
success : function(form, action) {
// Ext.Msg.alert('编辑', '载入成功!');
},
failure : function(form, action) {
// Ext.Msg.alert('编辑', '载入失败');
}
});
}
return formPanel;
};
| JavaScript |
Ext.ns('DepreTypeView');
/**
* [DepreType]列表
*/
var DepreTypeView = function() {
return new Ext.Panel({
id : 'DepreTypeView',
title : '折算类型列表',
iconCls:'menu-depre-type',
autoScroll : true,
items : [new Ext.FormPanel({
height : 35,
frame : true,
id : 'DepreTypeSearchForm',
layout : 'column',
defaults : {
xtype : 'label'
},
items : [{
text : '请输入查询条件:'
}, {
text : '类型名称'
}, {
xtype : 'textfield',
name : 'Q_typeName_S_LK'
},
// {
// text : ''
// }, {
// xtype : 'textfield',
// name : 'Q_depreRate_S_LK'
// }, {
// text : '单位为月'
// }, {
// xtype : 'textfield',
// name : 'Q_deprePeriod_S_LK'
// }, {
// text : ''
// }, {
// xtype : 'textfield',
// name : 'Q_typeDesc_S_LK'
// },
{
text : '折算类型' //1=平均年限法2=工作量法 加速折旧法3=双倍余额递减法4=年数总和法
}, {
xtype : 'textfield',
hiddenName : 'Q_calMethod_SN_EQ',
xtype : 'combo',
allowBlank : false,
mode : 'local',
editable : false,
triggerAction : 'all',
store : [['1', '平均年限法'], ['2', '工作量法'],['3','双倍余额递减法'],['4','年数总和法']]
}, {
xtype : 'button',
text : '查询',
iconCls : 'search',
handler : function() {
var searchPanel = Ext.getCmp('DepreTypeSearchForm');
var grid = Ext.getCmp('DepreTypeGrid');
if (searchPanel.getForm().isValid()) {
searchPanel.getForm().submit({
waitMsg : '正在提交查询',
url : __ctxPath + '/admin/listDepreType.do',
success : function(formPanel, action) {
var result = Ext.util.JSON
.decode(action.response.responseText);
grid.getStore().loadData(result);
}
});
}
}
}]
}), this.setup()]
});
};
/**
* 建立视图
*/
DepreTypeView.prototype.setup = function() {
return this.grid();
};
/**
* 建立DataGrid
*/
DepreTypeView.prototype.grid = function() {
var sm = new Ext.grid.CheckboxSelectionModel();
var cm = new Ext.grid.ColumnModel({
columns : [sm, new Ext.grid.RowNumberer(), {
header : 'depreTypeId',
dataIndex : 'depreTypeId',
hidden : true
}, {
header : '分类名称',
dataIndex : 'typeName'
}, {
header : '折旧率',
dataIndex : 'depreRate'
}, {
header : '折旧周期',
dataIndex : 'deprePeriod'
}, {
header : '折旧方法',
dataIndex : 'calMethod',
renderer:function(value){
if(value=='1'){
return '平均年限法';
}
if(value=='2'){
return '工作量法';
}
if(value=='3'){
return '双倍余额递减法';
}
if(value=='4'){
return '年数总和法';
}
}
}, {
header : '方法描述',
dataIndex : 'typeDesc'
}, {
header : '管理',
dataIndex : 'depreTypeId',
width : 50,
sortable : false,
renderer : function(value, metadata, record, rowIndex,
colIndex) {
var editId = record.data.depreTypeId;
var str = '<button title="删除" value=" " class="btn-del" onclick="DepreTypeView.remove('
+ editId + ')"> </button>';
str += ' <button title="编辑" value=" " class="btn-edit" onclick="DepreTypeView.edit('
+ editId + ')"> </button>';
return str;
}
}],
defaults : {
sortable : true,
menuDisabled : false,
width : 100
}
});
var store = this.store();
store.load({
params : {
start : 0,
limit : 25
}
});
var grid = new Ext.grid.GridPanel({
id : 'DepreTypeGrid',
tbar : this.topbar(),
store : store,
trackMouseOver : true,
disableSelection : false,
loadMask : true,
autoHeight : true,
cm : cm,
sm : sm,
viewConfig : {
forceFit : true,
enableRowBody : false,
showPreview : false
},
bbar : new Ext.PagingToolbar({
pageSize : 25,
store : store,
displayInfo : true,
displayMsg : '当前显示从{0}至{1}, 共{2}条记录',
emptyMsg : "当前没有记录"
})
});
grid.addListener('rowdblclick', function(grid, rowindex, e) {
grid.getSelectionModel().each(function(rec) {
DepreTypeView.edit(rec.data.depreTypeId);
});
});
return grid;
};
/**
* 初始化数据
*/
DepreTypeView.prototype.store = function() {
var store = new Ext.data.Store({
proxy : new Ext.data.HttpProxy({
url : __ctxPath + '/admin/listDepreType.do'
}),
reader : new Ext.data.JsonReader({
root : 'result',
totalProperty : 'totalCounts',
id : 'id',
fields : [{
name : 'depreTypeId',
type : 'int'
}
, 'typeName', 'depreRate', 'deprePeriod',
'typeDesc', 'calMethod']
}),
remoteSort : true
});
store.setDefaultSort('depreTypeId', 'desc');
return store;
};
/**
* 建立操作的Toolbar
*/
DepreTypeView.prototype.topbar = function() {
var toolbar = new Ext.Toolbar({
id : 'DepreTypeFootBar',
height : 30,
bodyStyle : 'text-align:left',
items : [{
iconCls : 'btn-add',
text : '添加折旧类型',
xtype : 'button',
handler : function() {
new DepreTypeForm();
}
}, {
iconCls : 'btn-del',
text : '删除折旧类型',
xtype : 'button',
handler : function() {
var grid = Ext.getCmp("DepreTypeGrid");
var selectRecords = grid.getSelectionModel()
.getSelections();
if (selectRecords.length == 0) {
Ext.Msg.alert("信息", "请选择要删除的记录!");
return;
}
var ids = Array();
for (var i = 0; i < selectRecords.length; i++) {
ids.push(selectRecords[i].data.depreTypeId);
}
DepreTypeView.remove(ids);
}
}]
});
return toolbar;
};
/**
* 删除单个记录
*/
DepreTypeView.remove = function(id) {
var grid = Ext.getCmp("DepreTypeGrid");
Ext.Msg.confirm('信息确认', '您确认要删除该记录吗?', function(btn) {
if (btn == 'yes') {
Ext.Ajax.request({
url : __ctxPath + '/admin/multiDelDepreType.do',
params : {
ids : id
},
method : 'post',
success : function() {
Ext.Msg.alert("信息提示", "成功删除所选记录!");
grid.getStore().reload({
params : {
start : 0,
limit : 25
}
});
}
});
}
});
};
/**
*
*/
DepreTypeView.edit = function(id) {
new DepreTypeForm(id);
}
| JavaScript |
var AssetsTypeForm = function(assetsTypeId) {
this.assetsTypeId = assetsTypeId;
var fp = this.setup();
var window = new Ext.Window({
id : 'AssetsTypeFormWin',
title : '[AssetsType]详细信息',
width : 500,
height : 420,
modal : true,
layout : 'anchor',
plain : true,
bodyStyle : 'padding:5px;',
buttonAlign : 'center',
items : [this.setup()],
buttons : [{
text : '保存',
iconCls : 'btn-save',
handler : function() {
var fp = Ext.getCmp('AssetsTypeForm');
if (fp.getForm().isValid()) {
fp.getForm().submit({
method : 'post',
waitMsg : '正在提交数据...',
success : function(fp, action) {
Ext.Msg.alert('操作信息', '成功保存信息!');
// Ext.getCmp('AssetsTypeGrid').getStore()
// .reload();
Ext.getCmp('leftFixedAssetsManagePanel').root.reload();
window.close();
},
failure : function(fp, action) {
Ext.MessageBox.show({
title : '操作信息',
msg : '信息保存出错,请联系管理员!',
buttons : Ext.MessageBox.OK,
icon : 'ext-mb-error'
});
window.close();
}
});
}
}
}, {
text : '取消',
iconCls : 'btn-cancel',
handler : function() {
window.close();
}
}]
});
window.show();
};
AssetsTypeForm.prototype.setup = function() {
var formPanel = new Ext.FormPanel({
url : __ctxPath + '/admin/saveAssetsType.do',
layout : 'form',
id : 'AssetsTypeForm',
frame : true,
defaults : {
width : 400,
anchor : '98%,98%'
},
formId : 'AssetsTypeFormId',
defaultType : 'textfield',
items : [{
name : 'assetsType.assetsTypeId',
id : 'assetsTypeId',
xtype : 'hidden',
value : this.assetsTypeId == null
? ''
: this.assetsTypeId
}, {
fieldLabel : '分类名称',
name : 'assetsType.typeName',
id : 'typeName'
}
]
});
if (this.assetsTypeId != null && this.assetsTypeId != 'undefined') {
formPanel.getForm().load({
deferredRender : false,
url : __ctxPath + '/admin/getAssetsType.do?assetsTypeId='
+ this.assetsTypeId,
waitMsg : '正在载入数据...',
success : function(form, action) {
// Ext.Msg.alert('编辑', '载入成功!');
},
failure : function(form, action) {
// Ext.Msg.alert('编辑', '载入失败');
}
});
}
return formPanel;
};
| JavaScript |
Ext.ns('CarApplyView');
/**
* [CarApply]列表
*/
var CarApplyView = function() {
return new Ext.Panel({
id : 'CarApplyView',
title : '车辆申请列表',
iconCls:'menu-car_apply',
autoScroll : true,
items : [new Ext.FormPanel({
height : 35,
frame : true,
id : 'CarApplySearchForm',
layout : 'column',
defaults : {
xtype : 'label'
},
items : [{
text : '请输入查询条件:'
}, {
text : '车牌号'
}, {
xtype : 'textfield',
name : 'Q_car.carNo_S_LK'
},
// {
// text : '用车部门'
// }, {
// xtype : 'textfield',
// name : 'Q_department_S_LK'
// }, {
// text : '用车人'
// }, {
// xtype : 'textfield',
// name : 'Q_userFullname_S_LK'
// },
{
text : '审批状态'
}, {
xtype : 'textfield',
hiddenName : 'Q_approvalStatus_SN_EQ',
xtype : 'combo',
mode : 'local',
allowBlank:false,
editable : false,
readOnly:true,
triggerAction : 'all',
store : [['0', '未审批'], ['1', '已审批']]
},{
xtype : 'button',
text : '查询',
iconCls : 'search',
handler : function() {
var searchPanel = Ext.getCmp('CarApplySearchForm');
var grid = Ext.getCmp('CarApplyGrid');
if (searchPanel.getForm().isValid()) {
searchPanel.getForm().submit({
waitMsg : '正在提交查询',
url : __ctxPath + '/admin/listCarApply.do',
success : function(formPanel, action) {
var result = Ext.util.JSON
.decode(action.response.responseText);
grid.getStore().loadData(result);
}
});
}
}
}]
}), this.setup()]
});
};
/**
* 建立视图
*/
CarApplyView.prototype.setup = function() {
return this.grid();
};
/**
* 建立DataGrid
*/
CarApplyView.prototype.grid = function() {
var sm = new Ext.grid.CheckboxSelectionModel();
var cm = new Ext.grid.ColumnModel({
columns : [sm, new Ext.grid.RowNumberer(), {
header : 'applyId',
dataIndex : 'applyId',
hidden : true
}, {
header : '车辆车牌号',
dataIndex : 'carNo'
}, {
header : '用车部门',
dataIndex : 'department'
}, {
header : '用车人',
dataIndex : 'userFullname'
}, {
header : '申请日期',
dataIndex : 'applyDate'
}, {
header : '原因',
dataIndex : 'reason'
}, {
header : '开始时间',
dataIndex : 'startTime'
}, {
header : '结束时间',
dataIndex : 'endTime'
}, {
header : '申请人',
dataIndex : 'proposer'
},{
header : '审批状态',
dataIndex : 'approvalStatus',
renderer:function(value){
if(value=='0'){
return '未审批';
}
if(value=='1'){
return '已审批';
}
}
}, {
header : '管理',
dataIndex : 'applyId',
width : 50,
sortable : false,
renderer : function(value, metadata, record, rowIndex,
colIndex) {
var editId = record.data.applyId;
var str = '<button title="删除" value=" " class="btn-del" onclick="CarApplyView.remove('
+ editId + ')"> </button>';
str += ' <button title="编辑" value=" " class="btn-edit" onclick="CarApplyView.edit('
+ editId + ')"> </button>';
return str;
}
}],
defaults : {
sortable : true,
menuDisabled : false,
width : 100
}
});
var store = this.store();
store.load({
params : {
start : 0,
limit : 25
}
});
var grid = new Ext.grid.GridPanel({
id : 'CarApplyGrid',
tbar : this.topbar(),
store : store,
trackMouseOver : true,
disableSelection : false,
loadMask : true,
autoHeight : true,
cm : cm,
sm : sm,
viewConfig : {
forceFit : true,
enableRowBody : false,
showPreview : false
},
bbar : new Ext.PagingToolbar({
pageSize : 25,
store : store,
displayInfo : true,
displayMsg : '当前显示从{0}至{1}, 共{2}条记录',
emptyMsg : "当前没有记录"
})
});
grid.addListener('rowdblclick', function(grid, rowindex, e) {
grid.getSelectionModel().each(function(rec) {
CarApplyView.edit(rec.data.applyId);
});
});
return grid;
};
/**
* 初始化数据
*/
CarApplyView.prototype.store = function() {
var store = new Ext.data.Store({
proxy : new Ext.data.HttpProxy({
url : __ctxPath + '/admin/listCarApply.do'
}),
reader : new Ext.data.JsonReader({
root : 'result',
totalProperty : 'totalCounts',
id : 'id',
fields : [{
name : 'applyId',
type : 'int'
}
, {name:'carNo',
mapping:'car.carNo'
}, 'department', 'userFullname',
'applyDate', 'reason', 'startTime',
'endTime', 'proposer', 'mileage', 'oilUse',
'notes', 'approvalStatus']
}),
remoteSort : true
});
store.setDefaultSort('applyId', 'desc');
return store;
};
/**
* 建立操作的Toolbar
*/
CarApplyView.prototype.topbar = function() {
var toolbar = new Ext.Toolbar({
id : 'CarApplyFootBar',
height : 30,
bodyStyle : 'text-align:left',
items : [{
iconCls : 'btn-carapply-add',
text : '添加车辆申请单',
xtype : 'button',
handler : function() {
new CarApplyForm();
Ext.getCmp('CarApplyForm').remove('depContainer');
Ext.getCmp('CarApplyForm').remove('approvalStatus');
}
}, {
iconCls : 'btn-carapply-del',
text : '删除车辆申请单',
xtype : 'button',
handler : function() {
var grid = Ext.getCmp("CarApplyGrid");
var selectRecords = grid.getSelectionModel()
.getSelections();
if (selectRecords.length == 0) {
Ext.Msg.alert("信息", "请选择要删除的记录!");
return;
}
var ids = Array();
for (var i = 0; i < selectRecords.length; i++) {
ids.push(selectRecords[i].data.applyId);
}
CarApplyView.remove(ids);
}
}]
});
return toolbar;
};
/**
* 删除单个记录
*/
CarApplyView.remove = function(id) {
var grid = Ext.getCmp("CarApplyGrid");
Ext.Msg.confirm('信息确认', '您确认要删除该记录吗?', function(btn) {
if (btn == 'yes') {
Ext.Ajax.request({
url : __ctxPath + '/admin/multiDelCarApply.do',
params : {
ids : id
},
method : 'post',
success : function() {
Ext.Msg.alert("信息提示", "成功删除所选记录!");
grid.getStore().reload({
params : {
start : 0,
limit : 25
}
});
}
});
}
});
};
/**
*
*/
CarApplyView.edit = function(id) {
new CarApplyForm(id);
}
| JavaScript |
Ext.ns('CarView');
/**
* [Car]列表
*/
var CarView= function() {
return new Ext.Panel({
id : 'CarView',
title : '车辆列表',
iconCls:'menu-car',
autoScroll : true,
items : [
new Ext.FormPanel({
height : 35,
frame : true,
id : 'CarSearchForm',
layout : 'column',
defaults : {
xtype : 'label'
},
items : [{
text : '请输入查询条件:'
}, {
text : '车牌号码'
}, {
xtype : 'textfield',
name : 'Q_carNo_S_LK'
}, {
text : '车类型'
}, {
xtype : 'textfield',
name : 'Q_carType_S_LK',
xtype : 'combo',
anchor : '95%',
mode : 'local',
editable : true,
triggerAction : 'all',
store : [['1', '轿车'], ['2', '货车'],['3','商务车']]
}, {
text : '当前状态' // 1=可用2=维修中 0=报废
}, {
xtype : 'textfield',
hiddenName : 'Q_status_SN_EQ',
xtype : 'combo',
anchor : '95%',
mode : 'local',
editable : true,
triggerAction : 'all',
store : [['1', '可用'], ['2', '维修中'],['0','已报废']]
},{
xtype : 'button',
text : '查询',
iconCls : 'search',
handler : function() {
var searchPanel = Ext.getCmp('CarSearchForm');
var grid = Ext.getCmp('CarGrid');
if (searchPanel.getForm().isValid()) {
searchPanel.getForm().submit({
waitMsg : '正在提交查询',
url : __ctxPath + '/admin/listCar.do',
success : function(formPanel, action) {
var result = Ext.util.JSON
.decode(action.response.responseText);
grid.getStore().loadData(result);
}
});
}
}
}]
}),
this.setup()]
});
};
/**
* 建立视图
*/
CarView.prototype.setup = function() {
return this.grid();
};
/**
* 建立DataGrid
*/
CarView.prototype.grid = function() {
var sm = new Ext.grid.CheckboxSelectionModel();
var cm = new Ext.grid.ColumnModel({
columns : [sm, new Ext.grid.RowNumberer(), {
header : 'carId',
dataIndex : 'carId',
hidden : true
}, {
header : '车牌号码',
dataIndex : 'carNo'
}, {
header : '车辆类型',
dataIndex : 'carType'
}, {
header : '发动机型号',
dataIndex : 'engineNo'
}, {
header : '购买保险时间',
dataIndex : 'buyInsureTime'
}, {
header : '年审时间',
dataIndex : 'auditTime'
}, {
header : '厂牌型号',
dataIndex : 'factoryModel'
}, {
header : '驾驶员',
dataIndex : 'driver'
}, {
header : '购置日期',
dataIndex : 'buyDate'
}, {
header : '当前状态', // 1=可用2=维修中0=报废
dataIndex : 'status',
renderer:function(value){
if(value=='1'){
return '可用';
}
if(value=='2'){
return '维修中';
}
if(value=='0'){
return '已报废';
}
}
},{
header : '管理',
dataIndex : 'carId',
width : 50,
sortable : false,
renderer : function(value, metadata, record, rowIndex,
colIndex) {
var editId = record.data.carId;
var str = '<button title="删除" value=" " class="btn-del" onclick="CarView.remove('
+ editId + ')"> </button>';
str += ' <button title="编辑" value=" " class="btn-edit" onclick="CarView.edit('
+ editId + ')"> </button>';
return str;
}
}],
defaults : {
sortable : true,
menuDisabled : false,
width : 100
}
});
var store = this.store();
store.load({
params : {
start : 0,
limit : 25
}
});
var grid = new Ext.grid.GridPanel({
id : 'CarGrid',
tbar : this.topbar(),
store : store,
trackMouseOver : true,
disableSelection : false,
loadMask : true,
autoHeight : true,
cm : cm,
sm : sm,
viewConfig : {
forceFit : true,
enableRowBody : false,
showPreview : false
},
bbar : new Ext.PagingToolbar({
pageSize : 25,
store : store,
displayInfo : true,
displayMsg : '当前显示从{0}至{1}, 共{2}条记录',
emptyMsg : "当前没有记录"
})
});
grid.addListener('rowdblclick', function(grid, rowindex, e) {
grid.getSelectionModel().each(function(rec) {
CarView.edit(rec.data.carId);
});
});
return grid;
};
/**
* 初始化数据
*/
CarView.prototype.store = function() {
var store = new Ext.data.Store({
proxy : new Ext.data.HttpProxy({
url : __ctxPath + '/admin/listCar.do'
}),
reader : new Ext.data.JsonReader({
root : 'result',
totalProperty : 'totalCounts',
id : 'id',
fields : [{
name : 'carId',
type : 'int'
}
, 'carNo', 'carType', 'engineNo',
'buyInsureTime', 'auditTime', 'notes',
'factoryModel', 'driver', 'buyDate',
'status', 'cartImage']
}),
remoteSort : true
});
store.setDefaultSort('carId', 'desc');
return store;
};
/**
* 建立操作的Toolbar
*/
CarView.prototype.topbar = function() {
var toolbar = new Ext.Toolbar({
id : 'CarFootBar',
height : 30,
bodyStyle : 'text-align:left',
items : [
{
iconCls : 'btn-car_add',
text : '添加车辆',
xtype : 'button',
handler : function() {
new CarForm();
}
},
{
iconCls : 'btn-car_del',
text : '删除车辆',
xtype : 'button',
handler : function() {
var grid = Ext.getCmp("CarGrid");
var selectRecords = grid.getSelectionModel()
.getSelections();
if (selectRecords.length == 0) {
Ext.Msg.alert("信息", "请选择要删除的记录!");
return;
}
var ids = Array();
for (var i = 0; i < selectRecords.length; i++) {
ids.push(selectRecords[i].data.carId);
}
CarView.remove(ids);
}
}]
});
return toolbar;
};
/**
* 删除单个记录
*/
CarView.remove = function(id) {
var grid = Ext.getCmp("CarGrid");
Ext.Msg.confirm('信息确认', '您确认要删除该记录吗?', function(btn) {
if (btn == 'yes') {
Ext.Ajax.request({
url : __ctxPath + '/admin/multiDelCar.do',
params : {
ids : id
},
method : 'post',
success : function() {
Ext.Msg.alert("信息提示", "成功删除所选记录!");
grid.getStore().reload({
params : {
start : 0,
limit : 25
}
});
}
});
}
});
};
/**
*
*/
CarView.edit = function(id) {
new CarForm(id);
}
| JavaScript |
var BookBorrowForm = function(recordId) {
this.recordId = recordId;
var fp = this.setup();
var window = new Ext.Window( {
id : 'BookBorrowFormWin',
title : '图书借出详细记录',
width : 500,
//height : 420,
autoHeight : true,
modal : true,
layout : 'anchor',
plain : true,
bodyStyle : 'padding:5px;',
buttonAlign : 'center',
items : [ this.setup() ],
buttons : [ {
text : '借出图书',
iconCls : 'btn-save',
handler : function() {
var fp = Ext.getCmp('BookBorrowForm');
if (fp.getForm().isValid()) {
fp.getForm().submit( {
method : 'post',
waitMsg : '正在提交数据...',
success : function(fp, action) {
Ext.Msg.alert('操作信息', '成功保存信息!');
Ext.getCmp('BookBorrowGrid').getStore().reload();
window.close();
},
failure : function(fp, action) {
Ext.MessageBox.show( {
title : '操作信息',
msg : '信息保存出错,请联系管理员!',
buttons : Ext.MessageBox.OK,
icon : 'ext-mb-error'
});
window.close();
}
});
}
}
}, {
text : '取消',
iconCls : 'btn-cancel',
handler : function() {
window.close();
}
} ]
});
window.show();
};
BookBorrowForm.prototype.setup = function() {
var formPanel = new Ext.FormPanel( {
url : __ctxPath + '/admin/saveBorrowBookBorRet.do',
layout : 'form',
id : 'BookBorrowForm',
frame : true,
defaults : {
widht : 400,
anchor : '100%,100%'
},
formId : 'BookBorrowFormId',
defaultType : 'textfield',
items : [ {
name : 'bookBorRet.recordId',
id : 'recordId',
xtype : 'hidden',
value : this.recordId == null ? '' : this.recordId
}, {
name : 'bookBorRet.bookSnId',
id : 'bookSnId',
xtype : 'hidden'
}, {
fieldLabel : '应还时间',
name : 'bookBorRet.returnTime',
id : 'returnTime',
xtype : 'datefield',
format : 'Y-m-d',
readOnly : true,
allowBlank : false,
blankText : '应还时间不能为空'
}, {
xtype : 'container',
layout : 'column',
style : 'padding-left:0px;margin-bottom:4px;',
items : [
{
xtype : 'label',
text : '借出图书名称:',
style : 'padding-left:0px;margin-top:2px;',
width : '100'
},
{
xtype : 'textfield',
name : 'bookBorRet.bookName',
id : 'bookName',
allowBlank : false,
blankText : '借出图书名称不能为空',
readOnly : true,
width : '45%'
},
{
xtype : 'button',
text : '选择图书',
handler : function() {
BookSelector.getView(
function(id, name) {
var bookNameField = Ext
.getCmp('bookName');
bookNameField.setValue(name);
var store = Ext.getCmp(
'borrowIsbn')
.getStore();
store.reload( {
params : {
bookId : id
}
});
}, true).show();
}
}, {
xtype : 'button',
text : ' 清除记录',
handler : function() {
var bookNameField = Ext.getCmp('bookName');
bookNameField.setValue('');
}
} ]
},
{
xtype : 'container',
layout : 'column',
style : 'padding-left:0px;margin-bottom:4px;',
items : [ {
xtype : 'label',
text : '借出图书的ISBN:',
style : 'padding-left:0px;margin-top:2px;',
width : '100'
}, {
name : 'bookBorRet.borrowIsbn',
id : 'borrowIsbn',
allowBlank : false,
blankText : '借出图书的ISBN不能为空',
//readOnly : true,
width : '45%',
maxHeight : 200,
xtype : 'combo',
mode : 'local',
editable : false,
triggerAction : 'all',
emptyText : '请选择图书系列',
store : new Ext.data.SimpleStore( {
url : __ctxPath + '/admin/getSnBookSn.do',
fields : [ 'bookSnId', 'bookSn' ]
}),
displayField : 'bookSn',
valueField : 'bookSnId',
// valueField : 'bookSn',
listeners : {
select : function(combo, record, index) {
Ext.getCmp('bookSnId').setValue(combo.value);
}
}
} ]
} ]
});
if (this.recordId != null && this.recordId != 'undefined') {
formPanel.getForm().load(
{
deferredRender : false,
url : __ctxPath + '/admin/getBookBorRet.do?recordId='
+ this.recordId,
//method : 'post',
waitMsg : '正在载入数据...',
success : function(form, action) {
// Ext.Msg.alert('编辑', '载入成功!');
// 对应还日期格式化后再进行输出
var returnTime = action.result.data.returnTime;
var returnTimeField = Ext.getCmp('returnTime');
returnTimeField.setValue(new Date(getDateFromFormat(returnTime, "yyyy-MM-dd HH:mm:ss")));
},
failure : function(form, action) {
// Ext.Msg.alert('编辑', '载入失败');
}
});
}
return formPanel;
};
| JavaScript |
Ext.ns('FixedAssetsManageView');
var FixedAssetsManageView = function() {
var selectedNode;
var fixedAssetsView = new FixedAssetsView();
var treePanel = new Ext.tree.TreePanel({
region : 'west',
id : 'leftFixedAssetsManagePanel',
title : '资产类型',
collapsible : true,
split : true,
width : 130,
height : 800,
tbar : new Ext.Toolbar({
items : [{
xtype : 'button',
iconCls : 'btn-refresh',
text : '刷新',
handler : function() {
treePanel.root.reload();
}
}, {
xtype : 'button',
text : '展开',
iconCls : 'btn-expand',
handler : function() {
treePanel.expandAll();
}
}, {
xtype : 'button',
text : '收起',
iconCls : 'btn-collapse',
handler : function() {
treePanel.collapseAll();
}
}]
}),
loader : new Ext.tree.TreeLoader({
url : __ctxPath + '/admin/treeAssetsType.do'
}),
root : new Ext.tree.AsyncTreeNode({
expanded : true
}),
rootVisible : false,
listeners : {
'click' : function(node) {
if (node != null) {
fixedAssetsView.setTypeId(node.id);
var fixedView = Ext.getCmp('FixedAssetsView');
if (node.id == 0) {
fixedView.setTitle('所有固定资产列表');
} else {
fixedView.setTitle('[' + node.text
+ ']类型固定资产列表');
}
var fixedAssetsGrid = Ext.getCmp('FixedAssetsGrid');
var store = fixedAssetsGrid.getStore();
store.url = __ctxPath + '/admin/listFixedAssets.do';
store.baseParams = {
'Q_assetsType.assetsTypeId_L_EQ' : node.id == 0
? null
: node.id
};
store.params = {
start : 0,
limit : 25
};
store.reload({
params : {
start : 0,
limit : 25
}
});
}
}
}
});
function contextmenu(node, e) {
selectedNode = new Ext.tree.TreeNode({
id : node.id,
text : node.text
});
treeMenu.showAt(e.getXY());
}
// 树的右键菜单的
treePanel.on('contextmenu', contextmenu, treePanel);
// 创建右键菜单
var treeMenu = new Ext.menu.Menu({
id : 'treeMenu',
items : [{
text : '新建类型',
scope : this,
iconCls : 'btn-add',
handler : createNode
}, {
text : '修改类型',
scope : this,
iconCls : 'btn-edit',
handler : editNode
}, {
text : '删除类型',
scope : this,
iconCls : 'btn-delete',
handler : deleteNode
}]
});
// 新建目录
function createNode() {
new AssetsTypeForm(null);
};
// 编辑目录
function editNode() {
var typeId = selectedNode.id;
if (typeId > 0) {
new OfficeGoodsTypeForm(typeId);
} else {
Ext.MessageBox.show({
title : '操作信息',
msg : '该处不能被修改',
buttons : Ext.MessageBox.OK,
icon : 'ext-mb-error'
});
}
};
// 删除目录,子目录也一并删除
function deleteNode() {
var typeId = selectedNode.id;
Ext.Ajax.request({
url : __ctxPath + '/admin/multiDelOfficeGoodsType.do',
params : {
ids : typeId
},
method : 'post',
success : function(result, request) {
Ext.Msg.alert('操作信息', '成功删除目录!');
treePanel.root.reload();
},
failure : function(result, request) {
Ext.MessageBox.show({
title : '操作信息',
msg : '信息保存出错,请联系管理员!',
buttons : Ext.MessageBox.OK,
icon : 'ext-mb-error'
});
}
});
};
var panel = new Ext.Panel({
id : 'FixedAssetsManageView',
title : '固定资产管理',
iconCls:'menu-assets',
layout : 'border',
height : 800,
items : [treePanel, fixedAssetsView.getView()]
});
return panel;
};
| JavaScript |
Ext.ns('BookTypeTree');
var BookTypeTree=function(){
return this.setup();
};
BookTypeTree.prototype.setup=function(){
var selected;//右键菜单所点的树结点
//图书类别管理树
var treePanel = new Ext.tree.TreePanel({
id:'typeTree',
title:'图书类别',
region : 'west',
width : 200,
height:480,
autoScroll: true,
collapsible : true,
split: true,
tbar:new Ext.Toolbar({
width: '100%',
height: 30,
items: [
{
text: '添加',
iconCls:'add-info',
handler: function() {
var bookTypeForm = Ext.getCmp('bookTypeForm');
if(bookTypeForm==null){
new BookTypeForm();
}else{
bookTypeForm.getForm().reset();
}
}
},{
xtype:'button',
iconCls:'btn-refresh',
text:'刷新',
handler:function(){
treePanel.root.reload();
}
}
]
}),
loader: new Ext.tree.TreeLoader({url:__ctxPath+'/admin/treeBookType.do'}),
root:
new Ext.tree.AsyncTreeNode({
expanded: true
}),
rootVisible: false,
listeners: {
'click': BookTypeTree.clickNode
}
});
//树的右键菜单的
treePanel.on('contextmenu', contextmenu, treePanel);
// 创建右键菜单
var treeMenu = new Ext.menu.Menu( {
id : 'treeMenu',
items : [
{
text : '新建',
scope : this,
handler :createNode
},
{
text : '修改',
scope : this,
handler : editNode
},{
text : '删除',
scope : this,
handler : deteleNode
}
]
});
function contextmenu(node, e) {
selected = new Ext.tree.TreeNode({
id:node.id,
text:node.text
});
treeMenu.showAt(e.getXY());
}
/**
* 菜单事件
*/
function createNode(){//增加结点
var bookTypeForm = Ext.getCmp('bookTypeForm');
if(bookTypeForm==null){
new BookTypeForm();
}
}
function deteleNode(){//删除结点
var typeId = selected.id;
var type = Ext.getCmp('typeTree');
if(typeId>0){
Ext.Msg.confirm('删除操作','你确定删除图书类别吗?',function(btn){
if(btn=='yes'){
Ext.Ajax.request({
url:__ctxPath+'/admin/removeBookType.do',
params:{typeId:typeId},
method:'post',
success:function(){
Ext.Msg.alert('操作信息','删除成功!');
var bookTypeGrid = Ext.getCmp('BookTypeView');
if(bookTypeGrid!=null){
bookTypeGrid.getStore().reload();
}
if(type!=null){type.root.reload();}
}
});
}
});
}
}
function editNode(){//修改结点
var typeId = selected.id;
var bookTypeForm = Ext.getCmp('bookTypeForm');
if(bookTypeForm==null){
new BookTypeForm(null);
bookTypeForm = Ext.getCmp('bookTypeForm');
}
bookTypeForm.form.load({
url:__ctxPath+'/admin/getBookType.do',
params:{typeId:typeId},
method:'post',
deferredRender :true,
layoutOnTabChange :true,
waitMsg : '正在载入数据...',
success : function() {
//Ext.Msg.alert('编辑', '载入成功!');
},
failure : function() {
Ext.Msg.alert('编辑', '载入失败');
}
});
}
return treePanel;
}
/**
*按类别查找图书
*/
BookTypeTree.clickNode=function(node){
if (node != null) {
var book = Ext.getCmp('BookGrid');
var store=book.getStore();
store.proxy =new Ext.data.HttpProxy({url:__ctxPath+'/admin/categoryBook.do'});
store.baseParams={typeId:node.id};
store.reload({params:{start:0,limit:25}});
}
} | JavaScript |
Ext.ns('BookReturnView');
/**
* 图书归还列表
*/
var BookReturnView = function() {
return new Ext.Panel(
{
id : 'BookReturnView',
title : '图书归还列表',
iconCls:'menu-book-return',
autoScroll : true,
items : [
new Ext.FormPanel(
{
height : 35,
frame : true,
id : 'BookReturnSearchForm',
layout : 'column',
defaults : {
xtype : 'label'
},
items : [
{
text : '请输入查询条件:'
},
{
text : '借出图书名称'
},
{
xtype : 'textfield',
name : 'Q_bookName_S_LK'
},
{
text : '借出图书的ISBN'
},
{
xtype : 'textfield',
name : 'Q_borrowIsbn_S_LK'
},
{
xtype : 'button',
text : '查询',
iconCls : 'search',
handler : function() {
var searchPanel = Ext
.getCmp('BookReturnSearchForm');
var grid = Ext
.getCmp('BookReturnGrid');
if (searchPanel.getForm()
.isValid()) {
searchPanel
.getForm()
.submit(
{
waitMsg : '正在提交查询',
url : __ctxPath + '/admin/listBookBorRet.do',
success : function(
formPanel,
action) {
var result = Ext.util.JSON
.decode(action.response.responseText);
grid
.getStore()
.loadData(
result);
}
});
}
}
} ]
}), this.setup() ]
});
};
/**
* 建立视图
*/
BookReturnView.prototype.setup = function() {
return this.grid();
};
/**
* 建立DataGrid
*/
BookReturnView.prototype.grid = function() {
var sm = new Ext.grid.CheckboxSelectionModel();
var cm = new Ext.grid.ColumnModel(
{
columns : [
sm,
new Ext.grid.RowNumberer(),
{
header : 'recordId',
dataIndex : 'recordId',
hidden : true
},
{
header : '图书SN',
dataIndex : 'bookSnId'
},
{
header : '借出时间',
dataIndex : 'borrowTime'
},
{
header : '应还时间',
dataIndex : 'returnTime'
},
{
header : '归还时间',
dataIndex : 'lastReturnTime'
},
{
header : '借出图书ISBN',
dataIndex : 'borrowIsbn'
},
{
header : '借出图书名称',
dataIndex : 'bookName'
},
{
header : '管理',
dataIndex : 'recordId',
sortable:false,
width : 50,
renderer : function(value, metadata, record,
rowIndex, colIndex) {
var editId = record.data.recordId;
var str = '<button title="编辑" value=" " class="btn-edit" onclick="BookBorRetView.edit(' + editId + ')"></button>';
return str;
}
} ],
defaults : {
sortable : true,
menuDisabled : false,
width : 100
}
});
var store = this.store();
store.load( {
params : {
start : 0,
limit : 25
}
});
var grid = new Ext.grid.GridPanel( {
id : 'BookReturnGrid',
tbar : this.topbar(),
store : store,
trackMouseOver : true,
disableSelection : false,
loadMask : true,
autoHeight : true,
cm : cm,
sm : sm,
viewConfig : {
forceFit : true,
enableRowBody : false,
showPreview : false
},
bbar : new Ext.PagingToolbar( {
pageSize : 25,
store : store,
displayInfo : true,
displayMsg : '当前显示从{0}至{1}, 共{2}条记录',
emptyMsg : "当前没有记录"
})
});
grid.addListener('rowdblclick', function(grid, rowindex, e) {
grid.getSelectionModel().each(function(rec) {
BookReturnView.edit(rec.data.recordId);
});
});
return grid;
};
/**
* 初始化数据
*/
BookReturnView.prototype.store = function() {
var store = new Ext.data.Store( {
proxy : new Ext.data.HttpProxy( {
url : __ctxPath + '/admin/listBookBorRet.do'
}),
reader : new Ext.data.JsonReader( {
root : 'result',
totalProperty : 'totalCounts',
id : 'id',
fields : [ {
name : 'recordId',
type : 'int'
}
, {name:'bookSnId',mapping:'bookSn.bookSnId'}, 'borrowTime', 'returnTime', 'lastReturnTime',
'borrowIsbn', 'bookName' ]
}),
remoteSort : true
});
store.setDefaultSort('recordId', 'desc');
return store;
};
/**
* 建立操作的Toolbar
*/
BookReturnView.prototype.topbar = function() {
var toolbar = new Ext.Toolbar( {
id : 'BookReturnFootBar',
height : 30,
bodyStyle : 'text-align:left',
items : [
{
iconCls : 'btn-add',
text : '添加归还记录',
xtype : 'button',
handler : function() {
new BookReturnForm();
}
}
]
});
return toolbar;
};
/**
*
*/
BookReturnView.edit = function(id) {
new BookReturnForm(id);
}
| JavaScript |
Ext.ns('BookSnView');
/**
* TODO: add class/table comments列表
*/
var BookSnView = function() {
return new Ext.Panel(
{
id : 'BookSnView',
title : '图书SN列表',
autoScroll : true,
items : [
new Ext.FormPanel(
{
height : 35,
frame : true,
id : 'BookSnSearchForm',
layout : 'column',
defaults : {
xtype : 'label'
},
items : [
{
text : '请输入查询条件:'
},
{
text : '图书ID'
},
{
xtype : 'textfield',
name : 'Q_bookId_S_LK'
},
{
text : '图书SN号'
},
{
xtype : 'textfield',
name : 'Q_bookSN_S_LK'
},
{
text : '借阅状态'
},
{
xtype : 'textfield',
name : 'Q_status_S_LK'
},
{
xtype : 'button',
text : '查询',
iconCls : 'search',
handler : function() {
var searchPanel = Ext
.getCmp('BookSnSearchForm');
var grid = Ext
.getCmp('BookSnGrid');
if (searchPanel.getForm()
.isValid()) {
searchPanel
.getForm()
.submit(
{
waitMsg : '正在提交查询',
url : __ctxPath + '/admin/listBookSn.do',
success : function(
formPanel,
action) {
var result = Ext.util.JSON
.decode(action.response.responseText);
grid
.getStore()
.loadData(
result);
}
});
}
}
} ]
}), this.setup() ]
});
};
/**
* 建立视图
*/
BookSnView.prototype.setup = function() {
return this.grid();
};
/**
* 建立DataGrid
*/
BookSnView.prototype.grid = function() {
var sm = new Ext.grid.CheckboxSelectionModel();
var cm = new Ext.grid.ColumnModel(
{
columns : [
sm,
new Ext.grid.RowNumberer(),
{
header : 'bookSnId',
dataIndex : 'bookSnId',
hidden : true
},
{
header : '书名',
dataIndex : 'bookName'
},
{
header : '图书SN号',
dataIndex : 'bookSN'
},
{
header : '借阅状态',
dataIndex : 'status',
//格式化输出借阅状态
renderer : function(value){
if(value=='0'){
return "未借出";
}else if(value=='1'){
return "已借出";
}else if(value=='2'){
return "预订";
}else{
return "注销";
}
}
},
{
header : '管理',
dataIndex : 'bookSnId',
width : 50,
renderer : function(value, metadata, record,
rowIndex, colIndex) {
var editId = record.data.bookSnId;
var str = '<input type="button" title="删除" value=" " class="btn-del" onclick="BookSnView.remove(' + editId + ')"/>';
str += ' <input type="button" title="编辑" value=" " class="btn-edit" onclick="BookSnView.edit(' + editId + ')"/>';
return str;
}
} ],
defaults : {
sortable : true,
menuDisabled : false,
width : 100
}
});
var store = this.store();
store.load( {
params : {
start : 0,
limit : 25
}
});
var grid = new Ext.grid.GridPanel( {
id : 'BookSnGrid',
tbar : this.topbar(),
store : store,
trackMouseOver : true,
disableSelection : false,
loadMask : true,
autoHeight : true,
cm : cm,
sm : sm,
viewConfig : {
forceFit : true,
enableRowBody : false,
showPreview : false
},
bbar : new Ext.PagingToolbar( {
pageSize : 25,
store : store,
displayInfo : true,
displayMsg : '当前显示从{0}至{1}, 共{2}条记录',
emptyMsg : "当前没有记录"
})
});
grid.addListener('rowdblclick', function(grid, rowindex, e) {
grid.getSelectionModel().each(function(rec) {
BookSnView.edit(rec.data.bookSnId);
});
});
return grid;
};
/**
* 初始化数据
*/
BookSnView.prototype.store = function() {
var store = new Ext.data.Store( {
proxy : new Ext.data.HttpProxy( {
url : __ctxPath + '/admin/listBookSn.do'
}),
reader : new Ext.data.JsonReader( {
root : 'result',
totalProperty : 'totalCounts',
id : 'id',
fields : [ {
name : 'bookSnId',
type : 'int'
}
, {name:'bookName',mapping:'book.bookName'}, 'bookSN', 'status' ]
}),
remoteSort : true
});
store.setDefaultSort('bookSnId', 'desc');
return store;
};
/**
* 建立操作的Toolbar
*/
BookSnView.prototype.topbar = function() {
var toolbar = new Ext.Toolbar( {
id : 'BookSnFootBar',
height : 30,
bodyStyle : 'text-align:left',
items : [ {
iconCls : 'btn-add',
text : '添加图书Sn',
xtype : 'button',
handler : function() {
new BookSnForm();
}
}, {
iconCls : 'btn-del',
text : '删除图书Sn',
xtype : 'button',
handler : function() {
var grid = Ext.getCmp("BookSnGrid");
var selectRecords = grid.getSelectionModel().getSelections();
if (selectRecords.length == 0) {
Ext.Msg.alert("信息", "请选择要删除的记录!");
return;
}
var ids = Array();
for ( var i = 0; i < selectRecords.length; i++) {
ids.push(selectRecords[i].data.bookSnId);
}
BookSnView.remove(ids);
}
} ]
});
return toolbar;
};
/**
* 删除单个记录
*/
BookSnView.remove = function(id) {
var grid = Ext.getCmp("BookSnGrid");
Ext.Msg.confirm('信息确认', '您确认要删除该记录吗?', function(btn) {
if (btn == 'yes') {
Ext.Ajax.request( {
url : __ctxPath + '/admin/multiDelBookSn.do',
params : {
ids : id
},
method : 'post',
success : function() {
Ext.Msg.alert("信息提示", "成功删除所选记录!");
grid.getStore().reload( {
params : {
start : 0,
limit : 25
}
});
}
});
}
});
};
/**
*
*/
BookSnView.edit = function(id) {
new BookSnForm(id);
}
| JavaScript |
Ext.ns('BookBorrowView');
/**
* 图书借阅列表
*/
var BookBorrowView = function() {
return new Ext.Panel(
{
id : 'BookBorrowView',
title : '图书借阅列表',
iconCls:'menu-book-borrow',
autoScroll : true,
items : [
new Ext.FormPanel(
{
height : 35,
frame : true,
id : 'BookBorrowSearchForm',
layout : 'column',
defaults : {
xtype : 'label'
},
items : [
{
text : '请输入查询条件:'
},
{
text : '借出图书名称'
},
{
xtype : 'textfield',
name : 'Q_bookName_S_LK'
},
{
text : '借出图书的ISBN'
},
{
xtype : 'textfield',
name : 'Q_borrowIsbn_S_LK'
},
{
xtype : 'button',
text : '查询',
iconCls : 'search',
handler : function() {
var searchPanel = Ext
.getCmp('BookBorrowSearchForm');
var grid = Ext
.getCmp('BookBorrowGrid');
if (searchPanel.getForm()
.isValid()) {
searchPanel
.getForm()
.submit(
{
waitMsg : '正在提交查询',
url : __ctxPath + '/admin/listBookBorRet.do',
success : function(
formPanel,
action) {
var result = Ext.util.JSON
.decode(action.response.responseText);
grid
.getStore()
.loadData(
result);
}
});
}
}
} ]
}), this.setup() ]
});
};
/**
* 建立视图
*/
BookBorrowView.prototype.setup = function() {
return this.grid();
};
/**
* 建立DataGrid
*/
BookBorrowView.prototype.grid = function() {
var sm = new Ext.grid.CheckboxSelectionModel();
var cm = new Ext.grid.ColumnModel(
{
columns : [
sm,
new Ext.grid.RowNumberer(),
{
header : 'recordId',
dataIndex : 'recordId',
hidden : true
},
{
header : '图书SN',
dataIndex : 'bookSnId'
},
{
header : '借出时间',
dataIndex : 'borrowTime'
},
{
header : '应还时间',
dataIndex : 'returnTime'
},
{
header : '归还时间',
dataIndex : 'lastReturnTime'
},
{
header : '借出图书ISBN',
dataIndex : 'borrowIsbn'
},
{
header : '借出图书名称',
dataIndex : 'bookName'
},
{
header : '管理',
dataIndex : 'recordId',
sortable:false,
width : 50,
renderer : function(value, metadata, record,
rowIndex, colIndex) {
var editId = record.data.recordId;
var str = '<button title="编辑" value=" " class="btn-edit" onclick="BookBorrowView.edit(' + editId + ')"></button>';
return str;
}
} ],
defaults : {
sortable : true,
menuDisabled : false,
width : 100
}
});
var store = this.store();
store.load( {
params : {
start : 0,
limit : 25
}
});
var grid = new Ext.grid.GridPanel( {
id : 'BookBorrowGrid',
tbar : this.topbar(),
store : store,
trackMouseOver : true,
disableSelection : false,
loadMask : true,
autoHeight : true,
cm : cm,
sm : sm,
viewConfig : {
forceFit : true,
enableRowBody : false,
showPreview : false
},
bbar : new Ext.PagingToolbar( {
pageSize : 25,
store : store,
displayInfo : true,
displayMsg : '当前显示从{0}至{1}, 共{2}条记录',
emptyMsg : "当前没有记录"
})
});
grid.addListener('rowdblclick', function(grid, rowindex, e) {
grid.getSelectionModel().each(function(rec) {
BookBorrowView.edit(rec.data.recordId);
});
});
return grid;
};
/**
* 初始化数据
*/
BookBorrowView.prototype.store = function() {
var store = new Ext.data.Store( {
proxy : new Ext.data.HttpProxy( {
url : __ctxPath + '/admin/listBookBorRet.do'
}),
reader : new Ext.data.JsonReader( {
root : 'result',
totalProperty : 'totalCounts',
id : 'id',
fields : [ {
name : 'recordId',
type : 'int'
}
, {name:'bookSnId',mapping:'bookSn.bookSnId'}, 'borrowTime', 'returnTime', 'lastReturnTime',
'borrowIsbn', 'bookName' ]
}),
remoteSort : true
});
store.setDefaultSort('recordId', 'desc');
return store;
};
/**
* 建立操作的Toolbar
*/
BookBorrowView.prototype.topbar = function() {
var toolbar = new Ext.Toolbar( {
id : 'BookBorrowFootBar',
height : 30,
bodyStyle : 'text-align:left',
items : [ {
iconCls : 'btn-add',
text : '添加借出记录 ',
xtype : 'button',
handler : function() {
new BookBorrowForm();
}
}
]
});
return toolbar;
};
/**
*
*/
BookBorrowView.edit = function(id) {
new BookBorrowForm(id);
}
| JavaScript |
Ext.ns('DepreRecordView');
/**
* [DepreRecord]列表
*/
var DepreRecordView = function() {
return new Ext.Panel({
id : 'DepreRecordView',
title : '固定资产折旧记录列表',
autoScroll : true,
items : [new Ext.FormPanel({
height : 35,
frame : true,
id : 'DepreRecordSearchForm',
layout : 'column',
defaults : {
xtype : 'label'
},
items : [{
text : '请输入查询条件:'
}, {
text : '资产名称'
}, {
xtype : 'textfield',
name : 'Q_assetsId_S_LK'
}, {
text : '工作量'
}, {
xtype : 'textfield',
name : 'Q_workCapacity_S_LK'
}, {
text : '折旧金额'
}, {
xtype : 'textfield',
name : 'Q_depreAmount_S_LK'
}, {
text : '执行时间'
}, {
xtype : 'textfield',
name : 'Q_calTime_S_LK'
}, {
xtype : 'button',
text : '查询',
iconCls : 'search',
handler : function() {
var searchPanel = Ext
.getCmp('DepreRecordSearchForm');
var grid = Ext.getCmp('DepreRecordGrid');
if (searchPanel.getForm().isValid()) {
searchPanel.getForm().submit({
waitMsg : '正在提交查询',
url : __ctxPath
+ '/admin/listDepreRecord.do',
success : function(formPanel, action) {
var result = Ext.util.JSON
.decode(action.response.responseText);
grid.getStore().loadData(result);
}
});
}
}
}]
}), this.setup()]
});
};
/**
* 建立视图
*/
DepreRecordView.prototype.setup = function() {
return this.grid();
};
/**
* 建立DataGrid
*/
DepreRecordView.prototype.grid = function() {
var sm = new Ext.grid.CheckboxSelectionModel();
var cm = new Ext.grid.ColumnModel({
columns : [sm, new Ext.grid.RowNumberer(), {
header : 'recordId',
dataIndex : 'recordId',
hidden : true
}, {
header : '资产名称',
dataIndex : 'assets'
}, {
header : '工作量',
id:'workCapacity',
dataIndex : 'workCapacity'
}, {
header : '折旧后值',
dataIndex : 'depreAmount'
}, {
header : '计算时间',
dataIndex : 'calTime'
}, {
header : '管理',
dataIndex : 'recordId',
width : 50,
sortable : false,
renderer : function(value, metadata, record, rowIndex,
colIndex) {
var editId = record.data.recordId;
var str = '<button title="删除" value=" " class="btn-del" onclick="DepreRecordView.remove('
+ editId + ')"> </button>';
// str += ' <input type="button" title="编辑" value=" " class="btn-edit" onclick="DepreRecordView.edit('
// + editId + ')"/>';
return str;
}
}],
defaults : {
sortable : true,
menuDisabled : false,
width : 100
}
});
var store = this.store();
store.load({
params : {
start : 0,
limit : 25
}
});
var grid = new Ext.grid.GridPanel({
id : 'DepreRecordGrid',
tbar : this.topbar(),
store : store,
trackMouseOver : true,
disableSelection : false,
loadMask : true,
autoHeight : true,
cm : cm,
sm : sm,
viewConfig : {
forceFit : true,
enableRowBody : false,
showPreview : false
},
bbar : new Ext.PagingToolbar({
pageSize : 25,
store : store,
displayInfo : true,
displayMsg : '当前显示从{0}至{1}, 共{2}条记录',
emptyMsg : "当前没有记录"
})
});
// grid.addListener('rowdblclick', function(grid, rowindex, e) {
// grid.getSelectionModel().each(function(rec) {
// DepreRecordView.edit(rec.data.recordId);
// });
// });
return grid;
};
/**
* 初始化数据
*/
DepreRecordView.prototype.store = function() {
var store = new Ext.data.Store({
proxy : new Ext.data.HttpProxy({
url : __ctxPath + '/admin/listDepreRecord.do'
}),
reader : new Ext.data.JsonReader({
root : 'result',
totalProperty : 'totalCounts',
id : 'id',
fields : [{
name : 'recordId',
type : 'int'
}
,{ name:'assets',
mapping:'fixedAssets.assetsName'
}, 'workCapacity',
'depreAmount', 'calTime']
}),
remoteSort : true
});
store.setDefaultSort('recordId', 'desc');
return store;
};
/**
* 建立操作的Toolbar
*/
DepreRecordView.prototype.topbar = function() {
var toolbar = new Ext.Toolbar({
id : 'DepreRecordFootBar',
height : 30,
bodyStyle : 'text-align:left',
items : [{
iconCls : 'btn-add',
text : '添加折旧记录',
xtype : 'button',
handler : function() {
new DepreRecordForm();
}
}, {
iconCls : 'btn-del',
text : '删除折旧记录',
xtype : 'button',
handler : function() {
var grid = Ext.getCmp("DepreRecordGrid");
var selectRecords = grid.getSelectionModel()
.getSelections();
if (selectRecords.length == 0) {
Ext.Msg.alert("信息", "请选择要删除的记录!");
return;
}
var ids = Array();
for (var i = 0; i < selectRecords.length; i++) {
ids.push(selectRecords[i].data.recordId);
}
DepreRecordView.remove(ids);
}
}]
});
return toolbar;
};
/**
* 删除单个记录
*/
DepreRecordView.remove = function(id) {
var grid = Ext.getCmp("DepreRecordGrid");
Ext.Msg.confirm('信息确认', '您确认要删除该记录吗?', function(btn) {
if (btn == 'yes') {
Ext.Ajax.request({
url : __ctxPath
+ '/admin/multiDelDepreRecord.do',
params : {
ids : id
},
method : 'post',
success : function() {
Ext.Msg.alert("信息提示", "成功删除所选记录!");
grid.getStore().reload({
params : {
start : 0,
limit : 25
}
});
}
});
}
});
};
/**
*
*/
DepreRecordView.edit = function(id) {
new DepreRecordForm(id);
}
| JavaScript |
var OfficeGoodsForm = function(goodsId) {
this.goodsId = goodsId;
var fp = this.setup();
var window = new Ext.Window({
id : 'OfficeGoodsFormWin',
title : '办公用品详细信息',
width : 540,
autoHeight : true,
modal : true,
shadow : false,
layout : 'anchor',
plain : true,
bodyStyle : 'padding:5px;',
buttonAlign : 'center',
items : [this.setup()],
buttons : [{
text : '保存',
iconCls : 'btn-save',
handler : function() {
var fp = Ext.getCmp('OfficeGoodsForm');
if(Ext.getCmp('stockCounts')!=null){
var newStockCounts = Ext.getCmp('stockCounts').getValue();
var counts = Ext.getCmp('counts').getValue();
}
if (newStockCounts != counts) {
Ext.Msg.confirm('操作信息', '你已经修改了库存,是否继续保存?', function(btn) {
if (btn == 'yes') {
if (fp.getForm().isValid()) {
fp.getForm().submit({
method : 'post',
waitMsg : '正在提交数据...',
success : function(fp, action) {
Ext.Msg.alert('操作信息', '成功保存信息!');
Ext.getCmp('OfficeGoodsGrid')
.getStore().reload();
window.close();
},
failure : function(fp, action) {
Ext.MessageBox.show({
title : '操作信息',
msg : '信息保存出错,请联系管理员!',
buttons : Ext.MessageBox.OK,
icon : 'ext-mb-error'
});
window.close();
}
});
}
}
});
} else {
if (fp.getForm().isValid()) {
fp.getForm().submit({
method : 'post',
waitMsg : '正在提交数据...',
success : function(fp, action) {
Ext.Msg.alert('操作信息', '成功保存信息!');
Ext.getCmp('OfficeGoodsGrid').getStore()
.reload();
window.close();
},
failure : function(fp, action) {
Ext.MessageBox.show({
title : '操作信息',
msg : '信息保存出错,请联系管理员!',
buttons : Ext.MessageBox.OK,
icon : 'ext-mb-error'
});
window.close();
}
});
}
}
}
}, {
text : '取消',
iconCls : 'btn-cancel',
handler : function() {
window.close();
}
}]
});
window.show();
};
OfficeGoodsForm.prototype.setup = function() {
var _url = __ctxPath + '/admin/treeOfficeGoodsType.do';
var goodsTypeSelector = new TreeSelector('goodsTypeSelect', _url, '所属分类',
'typeId');
var formPanel = new Ext.FormPanel({
url : __ctxPath + '/admin/saveOfficeGoods.do',
id : 'OfficeGoodsForm',
frame : true,
defaults : {
widht : 500
},
formId : 'OfficeGoodsFormId',
items : [{
name : 'officeGoods.goodsId',
id : 'goodsId',
xtype : 'hidden',
value : this.goodsId == null ? '' : this.goodsId
}, {
name : 'officeGoods.officeGoodsType.typeId',
id : 'typeId',
xtype : 'hidden'
}, {
layout : 'column',
xtype : 'fieldset',
style : 'padding:0px',
border : false,
items : [{
layout : 'form',
columnWidth : .6,
defaultType : 'textfield',
id : 'OfficeGoodsFormItems',
items : [goodsTypeSelector, {
fieldLabel : '物品名称',
name : 'officeGoods.goodsName',
id : 'goodsName',
allowBlank:false,
// anchor:'95%'
width : 168
}, {
fieldLabel : '编号',
name : 'officeGoods.goodsNo',
id : 'goodsNo',
width : 168,
allowBlank:false,
readOnly : true
}, {
fieldLabel : '规格',
name : 'officeGoods.specifications',
id : 'specifications',
allowBlank:false,
width : 168
}]
}, {
layout : 'form',
columnWidth : .4,
id : 'OfficeGoodsFormS',
defaultType : 'textfield',
items : [{
fieldLabel : '计量单位',
name : 'officeGoods.unit',
id : 'unit',
allowBlank:false,
anchor : '95%'
}, {
fieldLabel : '库存总数',
name : 'officeGoods.stockCounts',
id : 'stockCounts',
xtype:'numberfield',
allowBlank:false,
anchor : '95%'
}, {
name : 'counts',
id : 'counts',
xtype : 'hidden'
}, {
fieldLabel : '是否启用库存警示',
xtype : 'combo',
anchor : '95%',
allowBlank : false,
hiddenName : 'officeGoods.isWarning',
id : 'isWarning',
mode : 'local',
editable : false,
triggerAction : 'all',
store : [['0', '否'], ['1', '是']],
value : 0
}, {
fieldLabel : '警报库存数',
name : 'officeGoods.warnCounts',
id : 'warnCounts',
allowBlank:false,
xtype:'numberfield',
anchor : '95%'
}]
}]
},{ xtype:'container',
style : 'margin-left:4px;pading-top:0px;',
layout : 'form',
items : [{
fieldLabel : '备注',
name : 'officeGoods.notes',
id : 'notes',
xtype : 'textarea',
width : 378
}]
}
]
});
if (this.goodsId != null && this.goodsId != 'undefined') {
formPanel.getForm().load({
deferredRender : false,
url : __ctxPath + '/admin/getOfficeGoods.do?goodsId='
+ this.goodsId,
method : 'post',
waitMsg : '正在载入数据...',
success : function(form, action) {
var goodsTypeId = Ext.getCmp('typeId');
var goodsTypeName = Ext.getCmp('goodsTypeSelect');
var typeId = action.result.data.officeGoodsType.typeId;
var typeName = action.result.data.officeGoodsType.typeName;
goodsTypeId.setValue(typeId);
goodsTypeName.setValue(typeName);
var counts = action.result.data.stockCounts;
var countsField = Ext.getCmp('counts');
countsField.setValue(counts);
},
failure : function(form, action) {
// Ext.Msg.alert('编辑', '载入失败');
}
});
}
return formPanel;
};
| JavaScript |
var CarApplyForm = function(applyId) {
this.applyId = applyId;
var fp = this.setup();
var window = new Ext.Window({
id : 'CarApplyFormWin',
title : '车辆申请详细信息',
width : 520,
// height : 500,
autoHeight:true,
shadow:false,
modal : true,
layout : 'anchor',
plain : true,
bodyStyle : 'padding:5px;',
buttonAlign : 'center',
items : [this.setup()],
buttons : [{
text : '保存',
handler : function() {
var fp = Ext.getCmp('CarApplyForm');
if (fp.getForm().isValid()) {
fp.getForm().submit({
method : 'post',
waitMsg : '正在提交数据...',
success : function(fp, action) {
Ext.Msg.alert('操作信息', '成功保存信息!');
Ext.getCmp('CarApplyGrid').getStore()
.reload();
window.close();
},
failure : function(fp, action) {
Ext.MessageBox.show({
title : '操作信息',
msg : '信息保存出错,请联系管理员!',
buttons : Ext.MessageBox.OK,
icon : 'ext-mb-error'
});
window.close();
}
});
}
}
}, {
text : '取消',
handler : function() {
window.close();
}
}]
});
window.show();
};
CarApplyForm.prototype.setup = function() {
var formPanel = new Ext.FormPanel({
url : __ctxPath + '/admin/saveCarApply.do',
layout : 'form',
id : 'CarApplyForm',
frame : true,
defaults : {
widht : 400,
anchor : '100%,100%'
},
formId : 'CarApplyFormId',
defaultType : 'textfield',
items : [{
name : 'carApply.applyId',
id : 'applyId',
xtype : 'hidden',
value : this.applyId == null ? '' : this.applyId
},{
xtype:'hidden',
id:'carId',
name:'carApply.carId'
},{
xtype:'hidden',
id:'userId',
name:'userId'
}, {
xtype:'container',
layout:'column',
style:'padding-left:0px;margin-bottom:4px;',
items:[{
xtype:'label',
style:'padding-left:0px;',
text:'车牌号码:',
width:102
},{
xtype:'textfield',
name : 'carNo',
id : 'carNo',
allowBlank:false,
editable : false,
readOnly:true,
blankText:'不能为空!',
width:220
},{
xtype:'button',
iconCls:'btn-car',
text:'选择车辆',
handler:function(){
CarSelector.getView(
function(id,name){
Ext.getCmp('carNo').setValue(name);
Ext.getCmp('carId').setValue(id);
},true,1 //1表示可用的车
).show();
}
},{
xtype:'button',
text:'清除记录',
handler:function(){
Ext.getCmp('carNo').setValue('');
Ext.getCmp('carId').setValue('');
}
}]},{
xtype:'container',
style:'padding-left:0px;margin-bottom:4px;',
id:'depContainer',
layout:'column',
items:[{
xtype:'label',
style:'padding-left:0px;',
text:'用车部门:',
width:102
},{
xtype:'textfield',
name : 'carApply.department',
id : 'department',
allowBlank:false,
editable : false,
readOnly:true,
width:220
},{
xtype:'button',
iconCls:'btn-dep-sel',
text:'选择部门',
handler:function(){
DepSelector.getView(
function(id,name){
Ext.getCmp('department').setValue(name);
}
).show();
}
},{
xtype:'button',
text:'清除记录',
handler:function(){
Ext.getCmp('department').setValue('');
}
}]}, {
xtype:'container',
style:'padding-left:0px;margin-bottom:4px;',
layout:'column',
items:[{
xtype:'label',
style:'padding-left:0px;',
text:'用车人:',
width:102
},{
xtype:'textfield',
name : 'carApply.userFullname',
id : 'userFullname',
allowBlank:false,
editable : false,
readOnly:true,
width:220
},{
xtype:'button',
iconCls:'btn-user-sel',
text:'选择人员',
handler:function(){
UserSelector.getView(
function(id,name){
Ext.getCmp('userFullname').setValue(name);
Ext.getCmp('userId').setValue(id);
}
).show();
}
},{
xtype:'button',
text:'清除记录',
handler:function(){
Ext.getCmp('userFullname').setValue('');
}
}]}, {
xtype:'container',
layout:'column',
style:'padding-left:0px;margin-bottom:4px;',
items:[{
xtype:'label',
style:'padding-left:0px;',
text:'申请人:',
width:102
},{
xtype:'textfield',
name : 'carApply.proposer',
id : 'proposer',
editable : false,
allowBlank:false,
readOnly:true,
width:220
},{
xtype:'button',
iconCls:'btn-user-sel',
text:'选择人员',
handler:function(){
UserSelector.getView(
function(id,name){
Ext.getCmp('proposer').setValue(name);
},true
).show();
}
},{
xtype:'button',
text:'清除记录',
handler:function(){
Ext.getCmp('proposer').setValue('');
}
}]}, {
fieldLabel : '申请时间',
name : 'carApply.applyDate',
id : 'applyDate',
xtype:'datefield',
format:'Y-m-d',
allowBlank:false,
editable : false,
readOnly:true
}, {
fieldLabel : '原因',
name : 'carApply.reason',
id : 'reason',
allowBlank:false,
xtype:'textarea'
}, {
fieldLabel : '审批状态',
hiddenName : 'carApply.approvalStatus',
id : 'approvalStatus',
xtype : 'combo',
mode : 'local',
allowBlank:false,
editable : false,
readOnly:true,
triggerAction : 'all',
store : [['0', '未审批'], ['1', '已审批']]
}, {
fieldLabel : '开始时间',
name : 'carApply.startTime',
id : 'startTime',
xtype:'datefield',
format:'Y-m-d',
allowBlank:false,
editable : false,
readOnly:true
}, {
fieldLabel : '结束时间',
name : 'carApply.endTime',
id : 'endTime',
xtype:'datefield',
format:'Y-m-d'
}, {
fieldLabel : '里程',
name : 'carApply.mileage',
id : 'mileage'
}, {
fieldLabel : '油耗',
name : 'carApply.oilUse',
id : 'oilUse'
}, {
fieldLabel : '备注',
name : 'carApply.notes',
id : 'notes',
xtype:'textarea'
}
]
});
if (this.applyId != null && this.applyId != 'undefined') {
formPanel.getForm().load({
deferredRender : false,
url : __ctxPath + '/admin/getCarApply.do?applyId='
+ this.applyId,
waitMsg : '正在载入数据...',
success : function(form, action) {
// Ext.Msg.alert('编辑', '载入成功!');
Ext.getCmp('carNo').setValue(action.result.data.car.carNo);
Ext.getCmp('carId').setValue(action.result.data.car.carId);
Ext.getCmp('applyDate').setValue(new Date(getDateFromFormat(action.result.data.applyDate, "yyyy-MM-dd HH:mm:ss")));
Ext.getCmp('startTime').setValue(new Date(getDateFromFormat(action.result.data.startTime, "yyyy-MM-dd HH:mm:ss")));
Ext.getCmp('endTime').setValue(new Date(getDateFromFormat(action.result.data.endTime, "yyyy-MM-dd HH:mm:ss")));
},
failure : function(form, action) {
// Ext.Msg.alert('编辑', '载入失败');
}
});
}
return formPanel;
};
| JavaScript |
var DepreRecordForm = function(recordId) {
this.recordId = recordId;
var fp = this.setup();
var window = new Ext.Window({
id : 'DepreRecordFormWin',
title : '固定资产折旧记录详细信息',
width : 500,
height : 420,
modal: true,
layout : 'anchor',
plain : true,
bodyStyle : 'padding:5px;',
buttonAlign : 'center',
items : [this.setup()],
buttons : [{
text : '保存',
iconCls:'btn-save',
handler : function() {
var fp=Ext.getCmp('DepreRecordForm');
if (fp.getForm().isValid()) {
fp.getForm().submit({
method: 'post',
waitMsg : '正在提交数据...',
success : function(fp,action) {
Ext.Msg.alert('操作信息', '成功保存信息!');
Ext.getCmp('DepreRecordGrid').getStore().reload();
window.close();
},
failure : function(fp,action) {
Ext.MessageBox.show({
title: '操作信息',
msg: '信息保存出错,请联系管理员!',
buttons: Ext.MessageBox.OK,
icon:'ext-mb-error'
});
window.close();
}
});
}
}
}, {
text : '取消',
iconCls:'btn-cancel',
handler : function() {
window.close();
}
}]
});
window.show();
};
DepreRecordForm.prototype.setup = function() {
var formPanel = new Ext.FormPanel({
url : __ctxPath+ '/admin/saveDepreRecord.do',
layout : 'form',
id:'DepreRecordForm',
frame : true,
defaults : {
width : 400,
anchor : '98%,98%'
},
formId:'DepreRecordFormId',
defaultType : 'textfield',
items : [{
name : 'depreRecord.recordId',
id : 'recordId',
xtype:'hidden',
value : this.recordId == null ? '' : this.recordId
}
,{
fieldLabel : '',
name : 'depreRecord.assetsId',
id : 'assetsId'
}
,{
fieldLabel : '',
name : 'depreRecord.workCapacity',
id : 'workCapacity'
}
,{
fieldLabel : '',
name : 'depreRecord.depreAmount',
id : 'depreAmount'
}
,{
fieldLabel : '',
name : 'depreRecord.calTime',
id : 'calTime'
}
]
});
if(this.recordId!=null&&this.recordId!='undefined'){
formPanel.getForm().load({
deferredRender :false,
url : __ctxPath + '/admin/getDepreRecord.do?recordId=' + this.recordId,
waitMsg : '正在载入数据...',
success : function(form, action) {
// Ext.Msg.alert('编辑', '载入成功!');
},
failure : function(form, action) {
// Ext.Msg.alert('编辑', '载入失败');
}
});
}
return formPanel;
};
| JavaScript |
Ext.ns('BookManageView');
var BookManageView=function(){
var selectedNode;
var bookView=new BookView();
var treePanel = new Ext.tree.TreePanel({
region : 'west',
id : 'leftBookManagePanel',
title : '图书类别',
collapsible : true,
split : true,
width : 200,
height : 800,
tbar:new Ext.Toolbar({items:[{
text: '添加类别',
iconCls:'add-info',
handler: function() {
var bookTypeForm = Ext.getCmp('bookTypeForm');
if(bookTypeForm==null){
new BookTypeForm();
}else{
bookTypeForm.getForm().reset();
}
}
},{
xtype:'button',
iconCls:'btn-refresh',
text:'刷新',
handler:function(){
treePanel.root.reload();
}
}
]}),
loader : new Ext.tree.TreeLoader({
url : __ctxPath + '/admin/treeBookType.do'
}),
root : new Ext.tree.AsyncTreeNode({
expanded : true
}),
rootVisible : false,
listeners : {
'click' : function(node){
if (node != null) {
bookView.setTypeId(node.id);
var bView=Ext.getCmp('BookView');
if(node.id==0){
bView.setTitle('所有图书列表');
}else{
bView.setTitle('['+node.text+']列表');
}
var bGrid = Ext.getCmp('BookGrid');
var store=bGrid.getStore();
store.url=__ctxPath+'/admin/listBook.do';
store.baseParams={'Q_bookType.typeId_L_EQ':node.id==0?null:node.id};
store.params={start:0,limit:25};
store.reload({params:{start:0,limit:25}});
}
}
}
});
function contextmenu(node, e) {
selectedNode = new Ext.tree.TreeNode({
id : node.id,
text : node.text
});
treeMenu.showAt(e.getXY());
}
//树的右键菜单的
treePanel.on('contextmenu', contextmenu, treePanel);
// 创建右键菜单
var treeMenu = new Ext.menu.Menu({
id : 'treeMenu',
items : [
{
text : '添加类别',
scope : this,
iconCls:'btn-add',
handler : createNode
},{
text : '修改类别',
scope : this,
iconCls:'btn-edit',
handler : editNode
},{
text : '删除类别',
scope : this,
iconCls:'btn-delete',
handler : deleteNode
}
]
});
//新建目录
function createNode() {
new BookTypeForm(null);
};
//编辑目录
function editNode() {
var typeId=selectedNode.id;
if(typeId>0){
new BookTypeForm(typeId);
}else{
Ext.MessageBox.show({
title : '操作信息',
msg : '该处不能被修改',
buttons : Ext.MessageBox.OK,
icon : 'ext-mb-error'
});
}
};
//删除目录,子目录也一并删除
function deleteNode() {
var typeId=selectedNode.id;
Ext.Ajax.request({
url:__ctxPath+'/admin/multiDelBookType.do',
params:{ids:typeId},
method:'post',
success:function(result,request){
Ext.Msg.alert('操作信息','成功删除目录!');
treePanel.root.reload();
},
failure:function(result,request){
Ext.MessageBox.show({
title : '操作信息',
msg : '信息保存出错,请联系管理员!',
buttons : Ext.MessageBox.OK,
icon : 'ext-mb-error'
});
}
});
};
var panel = new Ext.Panel({
id:'BookManageView',
title : '图书管理',
iconCls : 'menu-book-manage',
layout : 'border',
height : 800,
items : [treePanel,bookView.getView()]
});
return panel;
};
| JavaScript |
var DepreWin=function(assetsId){
var formPanel=new Ext.form.FormPanel({
id:'workCapacityForm',
layout:'form',
url : __ctxPath + '/admin/depreciateDepreRecord.do',
style:'padding-top:7px;',
frame:true,
items:[{
xtype:'hidden',
name:'ids',
value:assetsId
},{
xtype:'hidden',
name:'depreRecord.recordId'
},{
fieldLabel : '当前折旧工作量',
xtype:'textfield',
name:'depreRecord.workCapacity',
anchor : '100%',
allowBlank:false
}]
});
var window = new Ext.Window({
id:'depreWin',
title: '按工作量折算',
region:'west',
width: 500,
height:350,
layout: 'form',
plain:true,
bodyStyle:'padding:5px;',
buttonAlign:'center',
items:[this.setup(assetsId),formPanel],
buttons:[{
text : '保存',
iconCls : 'btn-save',
handler : function() {
var fp = Ext.getCmp('workCapacityForm');
if (fp.getForm().isValid()) {
fp.getForm().submit({
method : 'post',
waitMsg : '正在提交数据...',
success : function(fp, action) {
Ext.Msg.alert('操作信息', '成功保存信息!');
// Ext.getCmp('DepreTypeGrid').getStore()
// .reload();
window.close();
},
failure : function(fp, action) {
Ext.MessageBox.show({
title : '操作信息',
msg : '信息保存出错,请联系管理员!',
buttons : Ext.MessageBox.OK,
icon : 'ext-mb-error'
});
window.close();
}
});
}
}
}, {
text : '取消',
iconCls : 'btn-cancel',
handler : function() {
window.close();
}
}]
});
window.show();
}
DepreWin.prototype.setup = function(assetsId) {
return this.grid(assetsId);
};
/**
* 建立DataGrid
*/
DepreWin.prototype.grid = function(assetsId) {
var cm = new Ext.grid.ColumnModel({
columns : [new Ext.grid.RowNumberer(), {
header : 'recordId',
dataIndex : 'recordId',
hidden : true
}, {
header : '资产名称',
dataIndex : 'assets'
}
, {
header : '工作量',
id:'workCapacity',
dataIndex : 'workCapacity'
}
,{
header : '折旧后值',
dataIndex : 'depreAmount'
}
, {
header : '计算时间',
dataIndex : 'calTime'
}],
defaults : {
sortable : true,
menuDisabled : false,
width : 100
}
});
var store = this.initData(assetsId);
store.load({
params : {
start : 0,
limit : 6
}
});
var grid = new Ext.grid.GridPanel({
title:'折旧记录',
store : store,
trackMouseOver : true,
disableSelection : false,
loadMask : true,
height:223,
cm : cm,
viewConfig : {
forceFit : true,
enableRowBody : false,
showPreview : false
},
bbar : new Ext.PagingToolbar({
pageSize : 6,
store : store,
displayInfo : true,
displayMsg : '当前显示从{0}至{1}, 共{2}条记录',
emptyMsg : "当前没有记录"
})
});
return grid;
};
DepreWin.prototype.initData=function(assetsId){
var store = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url: __ctxPath+'/admin/listDepreRecord.do'
}),
baseParams : {'Q_fixedAssets.assetsId_L_EQ':assetsId},
reader: new Ext.data.JsonReader({
root : 'result',
totalProperty : 'totalCounts',
id : 'id',
fields : [{
name : 'recordId',
type : 'int'
}
,{ name:'assets',
mapping:'fixedAssets.assetsName'
}, 'workCapacity',
'depreAmount', 'calTime']
}),remoteSort : true
});
store.setDefaultSort('recordId', 'desc');
return store;
};
| JavaScript |
Ext.ns('CartRepairView');
/**
* [CartRepair]列表
*/
var CartRepairView = function() {
return new Ext.Panel({
id : 'CartRepairView',
title : '车辆维修列表',
iconCls:'menu-car_repair',
autoScroll : true,
items : [new Ext.FormPanel({
height : 35,
frame : true,
id : 'CartRepairSearchForm',
layout : 'column',
defaults : {
xtype : 'label'
},
items : [{
text : '请输入查询条件:'
}, {
text : '车牌号码'
}, {
xtype : 'textfield',
name : 'Q_car.carNo_S_LK'
},
// {
// text : '维护日期'
// }, {
// xtype : 'textfield',
// name : 'Q_repairDate_S_LK'
// }, {
// text : '维护原因'
// }, {
// xtype : 'textfield',
// name : 'Q_reason_S_LK'
// }, {
// text : '经办人'
// }, {
// xtype : 'textfield',
// name : 'Q_executant_S_LK'
// }, {
// text : '备注'
// }, {
// xtype : 'textfield',
// name : 'Q_notes_S_LK'
// },
{
text : '维修类型'
}, {
xtype : 'textfield',
name : 'Q_repairType_S_LK'
},{
xtype : 'button',
text : '查询',
iconCls : 'search',
handler : function() {
var searchPanel = Ext
.getCmp('CartRepairSearchForm');
var grid = Ext.getCmp('CartRepairGrid');
if (searchPanel.getForm().isValid()) {
searchPanel.getForm().submit({
waitMsg : '正在提交查询',
url : __ctxPath
+ '/admin/listCartRepair.do',
success : function(formPanel, action) {
var result = Ext.util.JSON
.decode(action.response.responseText);
grid.getStore().loadData(result);
}
});
}
}
}]
}), this.setup()]
});
};
/**
* 建立视图
*/
CartRepairView.prototype.setup = function() {
return this.grid();
};
/**
* 建立DataGrid
*/
CartRepairView.prototype.grid = function() {
var sm = new Ext.grid.CheckboxSelectionModel();
var cm = new Ext.grid.ColumnModel({
columns : [sm, new Ext.grid.RowNumberer(), {
header : 'repairId',
dataIndex : 'repairId',
hidden : true
}, {
header : '车辆车牌号',
dataIndex : 'carNo'
}, {
header : '维护日期',
dataIndex : 'repairDate'
}, {
header : '维护原因',
dataIndex : 'reason'
}, {
header : '经办人',
dataIndex : 'executant'
}, {
header : '备注',
dataIndex : 'notes'
}, {
header : '维修类型',
dataIndex : 'repairType'
}, {
header : '费用',
dataIndex : 'fee'
}, {
header : '管理',
dataIndex : 'repairId',
width : 50,
sortable : false,
renderer : function(value, metadata, record, rowIndex,
colIndex) {
var editId = record.data.repairId;
var str = '<button title="删除" value=" " class="btn-del" onclick="CartRepairView.remove('
+ editId + ')"> </button>';
str += ' <button title="编辑" value=" " class="btn-edit" onclick="CartRepairView.edit('
+ editId + ')"> </button>';
return str;
}
}],
defaults : {
sortable : true,
menuDisabled : false,
width : 100
}
});
var store = this.store();
store.load({
params : {
start : 0,
limit : 25
}
});
var grid = new Ext.grid.GridPanel({
id : 'CartRepairGrid',
tbar : this.topbar(),
store : store,
trackMouseOver : true,
disableSelection : false,
loadMask : true,
autoHeight : true,
cm : cm,
sm : sm,
viewConfig : {
forceFit : true,
enableRowBody : false,
showPreview : false
},
bbar : new Ext.PagingToolbar({
pageSize : 25,
store : store,
displayInfo : true,
displayMsg : '当前显示从{0}至{1}, 共{2}条记录',
emptyMsg : "当前没有记录"
})
});
grid.addListener('rowdblclick', function(grid, rowindex, e) {
grid.getSelectionModel().each(function(rec) {
CartRepairView.edit(rec.data.repairId);
});
});
return grid;
};
/**
* 初始化数据
*/
CartRepairView.prototype.store = function() {
var store = new Ext.data.Store({
proxy : new Ext.data.HttpProxy({
url : __ctxPath + '/admin/listCartRepair.do'
}),
reader : new Ext.data.JsonReader({
root : 'result',
totalProperty : 'totalCounts',
id : 'id',
fields : [{
name : 'repairId',
type : 'int'
}
, {
name:'carNo',
mapping:'car.carNo'
}, 'repairDate', 'reason',
'executant', 'notes', 'repairType', 'fee']
}),
remoteSort : true
});
store.setDefaultSort('repairId', 'desc');
return store;
};
/**
* 建立操作的Toolbar
*/
CartRepairView.prototype.topbar = function() {
var toolbar = new Ext.Toolbar({
id : 'CartRepairFootBar',
height : 30,
bodyStyle : 'text-align:left',
items : [{
iconCls : 'btn-add',
text : '添加维修单',
xtype : 'button',
handler : function() {
new CartRepairForm();
}
}, {
iconCls : 'btn-del',
text : '删除维修单',
xtype : 'button',
handler : function() {
var grid = Ext.getCmp("CartRepairGrid");
var selectRecords = grid.getSelectionModel()
.getSelections();
if (selectRecords.length == 0) {
Ext.Msg.alert("信息", "请选择要删除的记录!");
return;
}
var ids = Array();
for (var i = 0; i < selectRecords.length; i++) {
ids.push(selectRecords[i].data.repairId);
}
CartRepairView.remove(ids);
}
}]
});
return toolbar;
};
/**
* 删除单个记录
*/
CartRepairView.remove = function(id) {
var grid = Ext.getCmp("CartRepairGrid");
Ext.Msg.confirm('信息确认', '您确认要删除该记录吗?', function(btn) {
if (btn == 'yes') {
Ext.Ajax.request({
url : __ctxPath
+ '/admin/multiDelCartRepair.do',
params : {
ids : id
},
method : 'post',
success : function() {
Ext.Msg.alert("信息提示", "成功删除所选记录!");
grid.getStore().reload({
params : {
start : 0,
limit : 25
}
});
}
});
}
});
};
/**
*
*/
CartRepairView.edit = function(id) {
new CartRepairForm(id);
}
| JavaScript |
Ext.ns('AssetsTypeView');
/**
* [AssetsType]列表
*/
var AssetsTypeView = function() {
return new Ext.Panel({
id:'AssetsTypeView',
title:'[AssetsType]列表',
autoScroll:true,
items:[
new Ext.FormPanel({
height:35,
frame:true,
id:'AssetsTypeSearchForm',
layout:'column',
defaults:{xtype:'label'},
items:[{text:'请输入查询条件:'}
,{
text : '分类名称'
}, {
xtype : 'textfield',
name : 'Q_typeName_S_LK'
}
,{
xtype:'button',
text:'查询',
iconCls:'search',
handler:function(){
var searchPanel=Ext.getCmp('AssetsTypeSearchForm');
var grid=Ext.getCmp('AssetsTypeGrid');
if(searchPanel.getForm().isValid()){
searchPanel.getForm().submit({
waitMsg:'正在提交查询',
url:__ctxPath+'/admin/listAssetsType.do',
success:function(formPanel,action){
var result=Ext.util.JSON.decode(action.response.responseText);
grid.getStore().loadData(result);
}
});
}
}
}
]
}),
this.setup()
]
});
};
/**
* 建立视图
*/
AssetsTypeView.prototype.setup = function() {
return this.grid();
};
/**
* 建立DataGrid
*/
AssetsTypeView.prototype.grid = function() {
var sm = new Ext.grid.CheckboxSelectionModel();
var cm = new Ext.grid.ColumnModel({
columns : [sm, new Ext.grid.RowNumberer(), {
header : 'assetsTypeId',
dataIndex : 'assetsTypeId',
hidden : true
}
,{
header : '分类名称',
dataIndex : 'typeName'
}
,{
header : '管理',
dataIndex : 'assetsTypeId',
width : 50,
sortable:false,
renderer : function(value, metadata, record, rowIndex,
colIndex) {
var editId = record.data.assetsTypeId;
var str = '<button title="删除" value=" " class="btn-del" onclick="AssetsTypeView.remove('
+ editId + ')"> </button>';
str += ' <button title="编辑" value=" " class="btn-edit" onclick="AssetsTypeView.edit('
+ editId + ')"> </button>';
return str;
}
}],
defaults : {
sortable : true,
menuDisabled : false,
width : 100
}
});
var store = this.store();
store.load({
params : {
start : 0,
limit : 25
}
});
var grid = new Ext.grid.GridPanel({
id : 'AssetsTypeGrid',
tbar : this.topbar(),
store : store,
trackMouseOver : true,
disableSelection : false,
loadMask : true,
autoHeight:true,
cm : cm,
sm : sm,
viewConfig : {
forceFit : true,
enableRowBody : false,
showPreview : false
},
bbar : new Ext.PagingToolbar({
pageSize : 25,
store : store,
displayInfo : true,
displayMsg : '当前显示从{0}至{1}, 共{2}条记录',
emptyMsg : "当前没有记录"
})
});
grid.addListener('rowdblclick', function(grid, rowindex, e) {
grid.getSelectionModel().each(function(rec) {
AssetsTypeView.edit(rec.data.assetsTypeId);
});
});
return grid;
};
/**
* 初始化数据
*/
AssetsTypeView.prototype.store = function() {
var store = new Ext.data.Store({
proxy : new Ext.data.HttpProxy({
url : __ctxPath + '/admin/listAssetsType.do'
}),
reader : new Ext.data.JsonReader({
root : 'result',
totalProperty : 'totalCounts',
id : 'id',
fields : [{
name : 'assetsTypeId',
type : 'int'
}
,'typeName'
]
}),
remoteSort : true
});
store.setDefaultSort('assetsTypeId', 'desc');
return store;
};
/**
* 建立操作的Toolbar
*/
AssetsTypeView.prototype.topbar = function() {
var toolbar = new Ext.Toolbar({
id : 'AssetsTypeFootBar',
height : 30,
bodyStyle:'text-align:left',
items : [
{
iconCls : 'btn-add',
text : '添加[AssetsType]',
xtype : 'button',
handler : function() {
new AssetsTypeForm();
}
}, {
iconCls : 'btn-del',
text : '删除[AssetsType]',
xtype : 'button',
handler : function() {
var grid=Ext.getCmp("AssetsTypeGrid");
var selectRecords=grid.getSelectionModel().getSelections();
if(selectRecords.length==0){
Ext.Msg.alert("信息","请选择要删除的记录!");
return;
}
var ids=Array();
for(var i=0;i<selectRecords.length;i++){
ids.push(selectRecords[i].data.assetsTypeId);
}
AssetsTypeView.remove(ids);
}
}
]
});
return toolbar;
};
/**
* 删除单个记录
*/
AssetsTypeView.remove=function(id){
var grid=Ext.getCmp("AssetsTypeGrid");
Ext.Msg.confirm('信息确认','您确认要删除该记录吗?',function(btn){
if(btn=='yes'){
Ext.Ajax.request({
url:__ctxPath+'/admin/multiDelAssetsType.do',
params:{
ids:id
},
method:'post',
success:function(){
Ext.Msg.alert("信息提示","成功删除所选记录!");
grid.getStore().reload({params:{
start : 0,
limit : 25
}});
}
});
}
});
};
/**
*
*/
AssetsTypeView.edit=function(id){
new AssetsTypeForm(id);
}
| JavaScript |
Ext.ns('BookTypeView');
/**
* 图书类别列表
*/
var BookTypeView = function() {
return new Ext.Panel(
{
id : 'BookTypeView',
title : '图书类别列表',
iconCls:'menu-book-type',
autoScroll : true,
items : [
new Ext.FormPanel(
{
height : 35,
frame : true,
id : 'BookTypeSearchForm',
layout : 'column',
defaults : {
xtype : 'label'
},
items : [
{
text : '请输入查询条件:'
},
{
text : '图书类别'
},
{
xtype : 'textfield',
name : 'Q_typeName_S_LK'
},
{
xtype : 'button',
text : '查询',
iconCls : 'search',
handler : function() {
var searchPanel = Ext
.getCmp('BookTypeSearchForm');
var grid = Ext
.getCmp('BookTypeGrid');
if (searchPanel.getForm()
.isValid()) {
searchPanel
.getForm()
.submit(
{
waitMsg : '正在提交查询',
url : __ctxPath + '/admin/listBookType.do',
success : function(
formPanel,
action) {
var result = Ext.util.JSON
.decode(action.response.responseText);
grid
.getStore()
.loadData(
result);
}
});
}
}
} ]
}), this.setup() ]
});
};
/**
* 建立视图
*/
BookTypeView.prototype.setup = function() {
return this.grid();
};
/**
* 建立DataGrid
*/
BookTypeView.prototype.grid = function() {
var sm = new Ext.grid.CheckboxSelectionModel();
var cm = new Ext.grid.ColumnModel(
{
columns : [
sm,
new Ext.grid.RowNumberer(),
{
header : 'typeId',
dataIndex : 'typeId',
hidden : true
},
{
header : '图书类别',
dataIndex : 'typeName'
},
{
header : '管理',
dataIndex : 'typeId',
sortable : false,
width : 50,
renderer : function(value, metadata, record,
rowIndex, colIndex) {
var editId = record.data.typeId;
var str = '<button title="删除" value=" " class="btn-del" onclick="BookTypeView.remove(' + editId + ')"></button>';
str += ' <button title="编辑" value=" " class="btn-edit" onclick="BookTypeView.edit(' + editId + ')"></button>';
return str;
}
} ],
defaults : {
sortable : true,
menuDisabled : false,
width : 100
}
});
var store = this.store();
store.load( {
params : {
start : 0,
limit : 25
}
});
var grid = new Ext.grid.GridPanel( {
id : 'BookTypeGrid',
tbar : this.topbar(),
store : store,
trackMouseOver : true,
disableSelection : false,
loadMask : true,
autoHeight : true,
cm : cm,
sm : sm,
viewConfig : {
forceFit : true,
enableRowBody : false,
showPreview : false
},
bbar : new Ext.PagingToolbar( {
pageSize : 25,
store : store,
displayInfo : true,
displayMsg : '当前显示从{0}至{1}, 共{2}条记录',
emptyMsg : "当前没有记录"
})
});
grid.addListener('rowdblclick', function(grid, rowindex, e) {
grid.getSelectionModel().each(function(rec) {
BookTypeView.edit(rec.data.typeId);
});
});
return grid;
};
/**
* 初始化数据
*/
BookTypeView.prototype.store = function() {
var store = new Ext.data.Store( {
proxy : new Ext.data.HttpProxy( {
url : __ctxPath + '/admin/listBookType.do'
}),
reader : new Ext.data.JsonReader( {
root : 'result',
totalProperty : 'totalCounts',
id : 'id',
fields : [ {
name : 'typeId',
type : 'int'
}
, 'typeName' ]
}),
remoteSort : true
});
store.setDefaultSort('typeId', 'desc');
return store;
};
/**
* 建立操作的Toolbar
*/
BookTypeView.prototype.topbar = function() {
var toolbar = new Ext.Toolbar( {
id : 'BookTypeFootBar',
height : 30,
bodyStyle : 'text-align:left',
items : [ {
iconCls : 'btn-add',
text : '添加图书类别',
xtype : 'button',
handler : function() {
new BookTypeForm();
}
}, {
iconCls : 'btn-del',
text : '删除图书类别',
xtype : 'button',
handler : function() {
var grid = Ext.getCmp("BookTypeGrid");
var selectRecords = grid.getSelectionModel().getSelections();
if (selectRecords.length == 0) {
Ext.Msg.alert("信息", "请选择要删除的记录!");
return;
}
var ids = Array();
for ( var i = 0; i < selectRecords.length; i++) {
ids.push(selectRecords[i].data.typeId);
}
BookTypeView.remove(ids);
}
} ]
});
return toolbar;
};
/**
* 删除单个记录
*/
BookTypeView.remove = function(id) {
var grid = Ext.getCmp("BookTypeGrid");
Ext.Msg.confirm('信息确认', '您确认要删除该记录吗?', function(btn) {
if (btn == 'yes') {
Ext.Ajax.request( {
url : __ctxPath + '/admin/multiDelBookType.do',
params : {
ids : id
},
method : 'post',
success : function() {
Ext.Msg.alert("信息提示", "成功删除所选记录!");
grid.getStore().reload( {
params : {
start : 0,
limit : 25
}
});
}
});
}
});
};
/**
*
*/
BookTypeView.edit = function(id) {
new BookTypeForm(id);
}
| JavaScript |
var BookForm = function(bookId) {
this.bookId = bookId;
var fp = this.setup();
var window = new Ext.Window({
id : 'BookFormWin',
title : '图书详细信息',
width : 500,
autoHeight : true,
shadow:false,
modal : true,
layout : 'anchor',
plain : true,
bodyStyle : 'padding:5px;',
buttonAlign : 'center',
items : [this.setup()],
buttons : [{
text : '保存',
iconCls : 'btn-save',
handler : function() {
var fp = Ext.getCmp('BookForm');
if (fp.getForm().isValid()) {
fp.getForm().submit({
method : 'post',
waitMsg : '正在提交数据...',
success : function(fp, action) {
Ext.Msg.alert('操作信息', '成功保存信息!');
Ext.getCmp('BookGrid').getStore()
.reload();
window.close();
},
failure : function(fp, action) {
Ext.MessageBox.show({
title : '操作信息',
msg : '信息保存出错,请联系管理员!',
buttons : Ext.MessageBox.OK,
icon : 'ext-mb-error'
});
window.close();
}
});
}
}
}, {
text : '取消',
iconCls : 'btn-cancel',
handler : function() {
window.close();
}
}]
});
window.show();
};
BookForm.prototype.setup = function() {
// 获取图书类别下位选框
var _url = __ctxPath + '/admin/treeBookType.do?opt=treeSelector';
var bookTypeSelector = new TreeSelector('bookTypeSelect', _url, '图书类别',
'typeId');
var formPanel = new Ext.FormPanel({
url : __ctxPath + '/admin/saveBook.do',
layout : 'form',
id : 'BookForm',
frame : true,
defaults : {
widht : 400,
anchor : '100%,100%'
},
formId : 'BookFormId',
defaultType : 'textfield',
items : [{
name : 'book.bookId',
id : 'bookId',
xtype : 'hidden',
value : this.bookId == null ? '' : this.bookId
}, {
name : 'book.typeId',
id : 'typeId',
xtype : 'hidden'
}, {
xtype : 'label'
}, bookTypeSelector, {
fieldLabel : '书名',
name : 'book.bookName',
id : 'bookName',
allowBlank : false,//不允许为空
blankText : '书名不能为空'
}, {
fieldLabel : '作者',
name : 'book.author',
id : 'author',
allowBlank : false,//不允许为空
blankText : '作者不能为空'
}, {
fieldLabel : 'ISBN号',
name : 'book.isbn',
id : 'isbn',
allowBlank : false,//不允许为空
blankText : 'ISBN号不能为空'
}, {
fieldLabel : '出版社',
name : 'book.publisher',
id : 'publisher'
}, {
fieldLabel : '图书价格',
name : 'book.price',
id : 'price',
xtype : 'numberfield',//价格只能输入数字,可以有小数点
nanText : '只能输入数字',
allowBlank : false,//不允许为空
blankText : '价格不能为空'
}, {
fieldLabel : '存放地点',
name : 'book.location',
id : 'location',
allowBlank : false,//不允许为空
blankText : '存放地点不能为空'
},{
xtype : 'container',
layout : 'column',
id : 'amoutContainer',
style : 'padding-left:0px;margin-left:0px;margin-bottom:4px;',
defaultType : 'textfield',
height : 26,
items : [{
xtype : 'label',
text : '数量:',
style : 'padding-left:0px;margin-left:0px;margin-bottom:2px;',
width : 100
}, {
name : 'book.amount',
id : 'amount',
xtype : 'numberfield',//数量只能输入数字
allowDecimals : false,//只允许输入整数
nanText : '只能输入数字',
allowBlank : false,//不允许为空
blankText : '数量不能为空',
minValue : 1,
minText : '图书数量必须大于0'
}, {
xtype : 'button',
id : 'bookAmoutButton',
text : '增加数量',
iconCls : 'btn-select',
width : 80,
handler : function() {
}
}]
}, {
xtype : 'container',
layout : 'column',
style : 'padding-left:0px;margin-left:0px;margin-bottom:4px;',
defaultType : 'textfield',
height : 26,
items : [{
xtype : 'label',
text : '所属部门:',
style : 'padding-left:0px;margin-left:0px;margin-bottom:4px;',
width : 100
}, {
name : 'book.department',
id : 'department',
allowBlank : false,//不允许为空
blankText : '所属部门不能为空'
}, {
xtype : 'button',
text : '选择',
iconCls : 'btn-select',
width : 80,
//部门选择器
handler : function() {
DepSelector.getView(
function(ids, names) {
var department = Ext.getCmp('department');
department.setValue(names);
},true).show();//true表示单选,因为一本书只能属于一个部门
}
}]
},{
xtype:'container',
id:'bookSnContainer',
layout:'form',
items:[{
id:'bookSnPanel',
fieldLabel : '图书标签',
xtype:'panel',
frame:true,
height:80,
autoScroll:true,
html:''
}]}
]
});
if (this.bookId != null && this.bookId != 'undefined') {
formPanel.getForm().load({
deferredRender : false,
url : __ctxPath + '/admin/getBook.do?bookId=' + this.bookId,
//method : 'post',
waitMsg : '正在载入数据...',
success : function(form, action) {
// Ext.Msg.alert('编辑', '载入成功!');
var typeId = Ext.getCmp('typeId');
//从服务端action取得图书类别的值
var typeName = action.result.data.bookType.typeName;
var bookTypeSelect = Ext.getCmp('bookTypeSelect');
bookTypeSelect.setValue(typeName);
var bookId = action.result.data.bookId;
Ext.Ajax.request({
url:__ctxPath+'/admin/getSnBookSn.do?bookId=' + bookId,
method : 'post',
success:function(response){
var result = Ext.util.JSON.decode(response.responseText);
var booksnPanel = Ext.getCmp('bookSnPanel');
for(var i=0;i<result.length;i++){
Ext.DomHelper.append(booksnPanel.body,'<div>'+result[i][1]+' <img class="img-delete" src="'+__ctxPath+'/images/system/delete.gif" alt="删除该本图书" onclick="#"/></div>');
}
}
});
},
failure : function(form, action) {
// Ext.Msg.alert('编辑', '载入失败');
}
});
}
return formPanel;
};
| JavaScript |
var BookSnForm = function(bookSnId) {
this.bookSnId = bookSnId;
var fp = this.setup();
var window = new Ext.Window( {
id : 'BookSnFormWin',
title : '图书Sn详细信息',
width : 500,
height : 420,
modal : true,
layout : 'anchor',
plain : true,
bodyStyle : 'padding:5px;',
buttonAlign : 'center',
items : [ this.setup() ],
buttons : [ {
text : '保存',
handler : function() {
var fp = Ext.getCmp('BookSnForm');
if (fp.getForm().isValid()) {
fp.getForm().submit( {
method : 'post',
waitMsg : '正在提交数据...',
success : function(fp, action) {
Ext.Msg.alert('操作信息', '成功保存信息!');
Ext.getCmp('BookSnGrid').getStore().reload();
window.close();
},
failure : function(fp, action) {
Ext.MessageBox.show( {
title : '操作信息',
msg : '信息保存出错,请联系管理员!',
buttons : Ext.MessageBox.OK,
icon : 'ext-mb-error'
});
window.close();
}
});
}
}
}, {
text : '取消',
handler : function() {
window.close();
}
} ]
});
window.show();
};
BookSnForm.prototype.setup = function() {
var formPanel = new Ext.FormPanel( {
url : __ctxPath + '/admin/saveBookSn.do',
layout : 'form',
id : 'BookSnForm',
frame : true,
defaults : {
widht : 400,
anchor : '100%,100%'
},
formId : 'BookSnFormId',
defaultType : 'textfield',
items : [ {
name : 'bookSn.bookSnId',
id : 'bookSnId',
xtype : 'hidden',
value : this.bookSnId == null ? '' : this.bookSnId
}, {
fieldLabel : '图书ID',
name : 'bookSn.book.bookId',
id : 'bookId',
allowBlank : false,
blankText : '图书ID不能为空'
}, {
fieldLabel : '图书SN号',
name : 'bookSn.bookSN',
id : 'bookSN',
allowBlank : false,
blankText : '图书SN不能为空'
},
{
xtype:'label',
text:'借阅状态:'
},
{
hiddenName:'bookSn.status',
id : 'status',
xtype:'combo',
mode : 'local',
editable : false,
triggerAction : 'all',
emptyText : '请选择',
store:[['0','未借出'], ['1','已借出'],['2','预订'], ['3','注销']]
}
]
});
if (this.bookSnId != null && this.bookSnId != 'undefined') {
formPanel.getForm().load( {
deferredRender : false,
url : __ctxPath + '/admin/getBookSn.do?bookSnId=' + this.bookSnId,
method : 'post',
waitMsg : '正在载入数据...',
success : function(form, action) {
// Ext.Msg.alert('编辑', '载入成功!');
},
failure : function(form, action) {
// Ext.Msg.alert('编辑', '载入失败');
}
});
}
return formPanel;
};
| JavaScript |
Ext.ns('BookView');
/**
* 图书列表
*/
var BookView = function() {
}
BookView.prototype.setTypeId=function(typeId){
this.typeId=typeId;
BookView.typeId=typeId;
};
BookView.prototype.getTypeId=function(){
return this.typeId;
}
/**
* 显示列表
*
* @return {}
*/
BookView.prototype.getView = function() {
return new Ext.Panel(
{
id : 'BookView',
title : '图书列表',
region:'center',
autoScroll:true,
items : [new Ext.FormPanel({
height : 35,
frame : true,
id : 'BookSearchForm',
layout : 'column',
defaults : {
xtype : 'label'
},
items : [
{
text : '请输入查询条件:'
},
{
text : '书名'
},
{
xtype : 'textfield',
name : 'Q_bookName_S_LK'
},
{
text : '作者'
},
{
xtype : 'textfield',
name : 'Q_author_S_LK'
},
{
xtype : 'button',
text : '查询',
iconCls : 'search',
handler : function() {
var searchPanel = Ext
.getCmp('BookSearchForm');
var grid = Ext
.getCmp('BookGrid');
if (searchPanel.getForm()
.isValid()) {
searchPanel
.getForm()
.submit(
{
waitMsg : '正在提交查询',
url : __ctxPath + '/admin/listBook.do',
success : function(
formPanel,
action) {
var result = Ext.util.JSON
.decode(action.response.responseText);
grid
.getStore()
.loadData(
result);
}
});
}
}
} ]
}), this.setup() ]
}
);
};
/**
* 建立视图
*/
BookView.prototype.setup = function() {
return this.grid();
};
/**
* 建立DataGrid
*/
BookView.prototype.grid = function() {
var sm = new Ext.grid.CheckboxSelectionModel();
var cm = new Ext.grid.ColumnModel(
{
columns : [
sm,
new Ext.grid.RowNumberer(),
{
header : 'bookId',
dataIndex : 'bookId',
hidden : true
},
{
header : '图书类别',
dataIndex : 'typeName'
},
{
header : '书名',
dataIndex : 'bookName'
},
{
header : '作者',
dataIndex : 'author'
},
{
header : 'ISBN号',
dataIndex : 'isbn'
},
{
header : '出版社',
dataIndex : 'publisher'
},
{
header : '价格',
dataIndex : 'price'
},
{
header : '存放地点',
dataIndex : 'location'
},
{
header : '所属部门',
dataIndex : 'department'
},
{
header : '图书数量',
dataIndex : 'amount'
},
{
header : '管理',
dataIndex : 'bookId',
sortable : false,
width : 50,
renderer : function(value, metadata, record,
rowIndex, colIndex) {
var editId = record.data.bookId;
var str = '<button title="删除" value=" " class="btn-del" onclick="BookView.remove(' + editId + ')"></button>';
str += ' <button title="编辑" value=" " class="btn-edit" onclick="BookView.edit(' + editId + ')"></button>';
return str;
}
} ],
defaults : {
sortable : true,
menuDisabled : false,
width : 100
}
});
var store = this.store();
store.load( {
params : {
start : 0,
limit : 25
}
});
var grid = new Ext.grid.GridPanel( {
id : 'BookGrid',
tbar : this.topbar(),
store : store,
trackMouseOver : true,
disableSelection : false,
loadMask : true,
autoHeight : true,
cm : cm,
sm : sm,
viewConfig : {
forceFit : true,
enableRowBody : false,
showPreview : false
},
bbar : new Ext.PagingToolbar( {
pageSize : 25,
store : store,
displayInfo : true,
displayMsg : '当前显示从{0}至{1}, 共{2}条记录',
emptyMsg : "当前没有记录"
})
});
grid.addListener('rowdblclick', function(grid, rowindex, e) {
grid.getSelectionModel().each(function(rec) {
BookView.edit(rec.data.bookId);
});
});
return grid;
};
/**
* 初始化数据
*/
BookView.prototype.store = function() {
var store = new Ext.data.Store( {
proxy : new Ext.data.HttpProxy( {
url : __ctxPath + '/admin/listBook.do'
}),
reader : new Ext.data.JsonReader( {
root : 'result',
totalProperty : 'totalCounts',
id : 'id',
fields : [ {
name : 'bookId',
type : 'int'
}
,{name:'typeName',mapping:'bookType.typeName'}, 'bookName', 'author', 'isbn', 'publisher', 'price',
'location', 'department', 'amount' ]
}),
remoteSort : true
});
store.setDefaultSort('bookId', 'desc');
return store;
};
/**
* 建立操作的Toolbar
*/
BookView.prototype.topbar = function() {
var toolbar = new Ext.Toolbar( {
id : 'BookFootBar',
height : 30,
bodyStyle : 'text-align:left',
items : [ {
iconCls : 'btn-add',
text : '添加图书',
xtype : 'button',
handler : function() {
new BookForm();
Ext.getCmp('BookForm').remove('bookSnContainer');
Ext.getCmp('amoutContainer').remove('bookAmoutButton');
}
}, {
iconCls : 'btn-del',
text : '删除图书',
xtype : 'button',
handler : function() {
var grid = Ext.getCmp("BookGrid");
var selectRecords = grid.getSelectionModel().getSelections();
if (selectRecords.length == 0) {
Ext.Msg.alert("信息", "请选择要删除的记录!");
return;
}
var ids = Array();
for ( var i = 0; i < selectRecords.length; i++) {
ids.push(selectRecords[i].data.bookId);
}
BookView.remove(ids);
}
} ]
});
return toolbar;
};
/**
* 删除单个记录
*/
BookView.remove = function(id) {
var grid = Ext.getCmp("BookGrid");
Ext.Msg.confirm('信息确认', '您确认要删除该记录吗?', function(btn) {
if (btn == 'yes') {
Ext.Ajax.request( {
url : __ctxPath + '/admin/multiDelBook.do',
params : {
ids : id
},
method : 'post',
success : function() {
Ext.Msg.alert("信息提示", "成功删除所选记录!");
grid.getStore().reload( {
params : {
start : 0,
limit : 25
}
});
}
});
}
});
};
/**
*
*/
BookView.edit = function(id) {
new BookForm(id);
}
| JavaScript |
Ext.ns('OfficeGoodsView');
/**
* ������������列表
*/
var OfficeGoodsView = function() {
}
OfficeGoodsView.prototype.setTypeId = function(typeId) {
this.typeId = typeId;
OfficeGoodsView.typeId = typeId;
};
OfficeGoodsView.prototype.getTypeId = function() {
return this.typeId;
}
OfficeGoodsView.prototype.getView = function() {
return new Ext.Panel({
id : 'OfficeGoodsView',
title : '办公用品列表',
region : 'center',
autoScroll : true,
items : [new Ext.FormPanel({
height : 35,
frame : true,
id : 'OfficeGoodsSearchForm',
layout : 'column',
defaults : {
xtype : 'label'
},
items : [{
text : '请输入查询条件:'
}, {
text : '物品名称'
}, {
xtype : 'textfield',
name : 'Q_goodsName_S_LK'
}, {
text : '所属分类'
}, {
xtype : 'textfield',
name : 'Q_officeGoodsType.typeName_S_LK'
}, {
xtype : 'button',
text : '查询',
iconCls : 'search',
handler : function() {
var searchPanel = Ext
.getCmp('OfficeGoodsSearchForm');
var grid = Ext.getCmp('OfficeGoodsGrid');
if (searchPanel.getForm().isValid()) {
searchPanel.getForm().submit({
waitMsg : '正在提交查询',
url : __ctxPath
+ '/admin/listOfficeGoods.do',
success : function(formPanel, action) {
var result = Ext.util.JSON
.decode(action.response.responseText);
grid.getStore().loadData(result);
}
});
}
}
}]
}), this.setup()]
});
};
/**
* 建立视图
*/
OfficeGoodsView.prototype.setup = function() {
return this.grid();
};
/**
* 建立DataGrid
*/
OfficeGoodsView.prototype.grid = function() {
var sm = new Ext.grid.CheckboxSelectionModel();
var cm = new Ext.grid.ColumnModel({
columns : [sm, new Ext.grid.RowNumberer(), {
header : 'goodsId',
dataIndex : 'goodsId',
hidden : true
}, {
header : '所属分类',
dataIndex : 'typeName'
}, {
header : '物品名称',
dataIndex : 'goodsName'
}, {
header : '编号',
dataIndex : 'goodsNo'
}, {
header : '规格',
dataIndex : 'specifications'
}, {
header : '计量单位',
dataIndex : 'unit'
}, {
header : '是否启用库存警示',
dataIndex : 'isWarning',
renderer : function(value) {
if (value == '0') {
return '未启动';
}
if (value == '1') {
return '已启动';
}
}
}, {
header : '备注',
dataIndex : 'notes'
}, {
header : '库存总数',
dataIndex : 'stockCounts',
renderer:function(value,metadata,record,rowIndex,colIndex){
var warnCounts=record.data.warnCounts;
var isWarning=record.data.isWarning;
if(value<=warnCounts&&isWarning=='1'){
return '<a style="color:red;" title="已少于警报库存!">'+value+'</a>';
}else{
return value;
}
}
}, {
header : '管理',
dataIndex : 'goodsId',
width : 50,
renderer : function(value, metadata, record, rowIndex,
colIndex) {
var editId = record.data.goodsId;
var str = '<button title="删除" value=" " class="btn-del" onclick="OfficeGoodsView.remove('
+ editId + ')"> </button>';
str += ' <button title="编辑" value=" " class="btn-edit" onclick="OfficeGoodsView.edit('
+ editId + ')"> </button>';
return str;
}
}],
defaults : {
sortable : true,
menuDisabled : false,
width : 100
}
});
var store = this.store();
store.load({
params : {
start : 0,
limit : 25
}
});
var grid = new Ext.grid.GridPanel({
id : 'OfficeGoodsGrid',
tbar : this.topbar(),
store : store,
trackMouseOver : true,
disableSelection : false,
loadMask : true,
autoHeight : true,
cm : cm,
sm : sm,
viewConfig : {
forceFit : true,
enableRowBody : false,
showPreview : false
},
bbar : new Ext.PagingToolbar({
pageSize : 25,
store : store,
displayInfo : true,
displayMsg : '当前显示从{0}至{1}, 共{2}条记录',
emptyMsg : "当前没有记录"
})
});
grid.addListener('rowdblclick', function(grid, rowindex, e) {
grid.getSelectionModel().each(function(rec) {
OfficeGoodsView.edit(rec.data.goodsId);
});
});
return grid;
};
/**
* 初始化数据
*/
OfficeGoodsView.prototype.store = function() {
var store = new Ext.data.Store({
proxy : new Ext.data.HttpProxy({
url : __ctxPath + '/admin/listOfficeGoods.do'
}),
reader : new Ext.data.JsonReader({
root : 'result',
totalProperty : 'totalCounts',
id : 'id',
fields : [{
name : 'goodsId',
type : 'int'
}
, {
name : 'typeName',
mapping : 'officeGoodsType.typeName'
}, 'goodsName', 'goodsNo',
'specifications', 'unit', 'isWarning','warnCounts',
'notes', 'stockCounts']
}),
remoteSort : true
});
store.setDefaultSort('goodsId', 'desc');
return store;
};
/**
* 建立操作的Toolbar
*/
OfficeGoodsView.prototype.topbar = function() {
var toolbar = new Ext.Toolbar({
id : 'OfficeGoodsFootBar',
height : 30,
bodyStyle : 'text-align:left',
items : [{
iconCls : 'btn-add',
text : '添加办公用品',
xtype : 'button',
handler : function() {
new OfficeGoodsForm();
Ext.getCmp('OfficeGoodsFormItems')
.remove('goodsNo');
Ext.getCmp('OfficeGoodsFormS')
.remove('stockCounts');
}
}, {
iconCls : 'btn-del',
text : '删除办公用品',
xtype : 'button',
handler : function() {
var grid = Ext.getCmp("OfficeGoodsGrid");
var selectRecords = grid.getSelectionModel()
.getSelections();
if (selectRecords.length == 0) {
Ext.Msg.alert("信息", "请选择要删除的记录!");
return;
}
var ids = Array();
for (var i = 0; i < selectRecords.length; i++) {
ids.push(selectRecords[i].data.goodsId);
}
OfficeGoodsView.remove(ids);
}
}]
});
return toolbar;
};
/**
* 删除单个记录
*/
OfficeGoodsView.remove = function(id) {
var grid = Ext.getCmp("OfficeGoodsGrid");
Ext.Msg.confirm('信息确认', '您确认要删除该记录吗?', function(btn) {
if (btn == 'yes') {
Ext.Ajax.request({
url : __ctxPath
+ '/admin/multiDelOfficeGoods.do',
params : {
ids : id
},
method : 'post',
success : function() {
Ext.Msg.alert("信息提示", "成功删除所选记录!");
grid.getStore().reload({
params : {
start : 0,
limit : 25
}
});
}
});
}
});
};
/**
*
*/
OfficeGoodsView.edit = function(id) {
new OfficeGoodsForm(id);
}
| JavaScript |
var GoodsApplyForm = function(applyId) {
this.applyId = applyId;
var fp = this.setup();
var window = new Ext.Window({
id : 'GoodsApplyFormWin',
title : '申请表详细信息',
width : 395,
autoHeight : true,
modal : true,
shadow:false,
layout : 'anchor',
plain : true,
bodyStyle : 'padding:5px;',
buttonAlign : 'center',
items : [this.setup()],
buttons : [{
text : '保存',
iconCls:'btn-save',
handler : function() {
var fp = Ext.getCmp('GoodsApplyForm');
if (fp.getForm().isValid()) {
fp.getForm().submit({
method : 'post',
waitMsg : '正在提交数据...',
success : function(fp, action) {
Ext.Msg.alert('操作信息', '成功保存信息!');
Ext.getCmp('GoodsApplyGrid').getStore()
.reload();
window.close();
},
failure : function(fp, action) {
Ext.MessageBox.show({
title : '操作信息',
msg : '信息保存出错,请联系管理员!',
buttons : Ext.MessageBox.OK,
icon : 'ext-mb-error'
});
window.close();
}
});
}
}
}, {
text : '取消',
iconCls:'btn-cancel',
handler : function() {
window.close();
}
}]
});
window.show();
};
GoodsApplyForm.prototype.setup = function() {
var formPanel = new Ext.FormPanel({
url : __ctxPath + '/admin/saveGoodsApply.do',
layout : 'form',
id : 'GoodsApplyForm',
frame : true,
defaults : {
widht : 400,
anchor : '100%,100%'
},
formId : 'GoodsApplyFormId',
defaultType : 'textfield',
items : [{
name : 'goodsApply.applyId',
id : 'applyId',
xtype : 'hidden',
value : this.applyId == null ? '' : this.applyId
}, {
name : 'goodsApply.goodsId',
id : 'goodsId',
xtype : 'hidden'
}, {
xtype : 'container',
layout : 'column',
style : 'padding-left:0px;margin-bottom:4px;',
items : [{
xtype : 'label',
text : '商品名称:',
style : 'margin-top:2px;',
width : '27.2%'
}, {
// fieldLabel : '商品名称',
xtype : 'textfield',
name : 'inStock.officeGoods.goodsName',
id : 'goodsName',
allowBlank:false,
readOnly : true,
width : '31%'
}, {
xtype : 'button',
text : '选择商品',
handler : function() {
GoodsSelector.getView(
function(id, name) {
var goodsIdField = Ext
.getCmp('goodsId');
goodsIdField
.setValue(id);
var goodsNameField = Ext
.getCmp('goodsName');
goodsNameField
.setValue(name);
}
, true).show();
}
}, {
xtype : 'button',
text : ' 清除记录',
handler : function() {
var goodsIdField = Ext
.getCmp('goodsId');
goodsIdField.setValue('');
var goodsNameField = Ext
.getCmp('goodsName');
goodsNameField.setValue('');
}
}]
}, {
fieldLabel : '申请日期',
name : 'goodsApply.applyDate',
id : 'applyDate',
xtype : 'datefield',
format : 'Y-m-d',
allowBlank:false,
readOnly:true
}, {
fieldLabel : '申请号',
name : 'goodsApply.applyNo',
id : 'applyNo',
readOnly:true
}, {
fieldLabel : '申请数量',
name : 'goodsApply.useCounts',
allowBlank:false,
xtype:'numberfield',
id : 'useCounts'
},{
xtype : 'container',
layout : 'column',
style : 'padding-left:0px;margin-bottom:4px;',
border : true,
// layout:'column',
items : [{
xtype : 'label',
text : '购买人:',
style : 'margin-top:2px;',
width : '27%'
}, {
// fieldLabel : '商品名称',
xtype : 'textfield',
name : 'goodsApply.proposer',
id : 'proposer',
allowBlank:false,
readOnly : true,
width : '31%'
}, {
xtype : 'button',
text : '选择人员',
handler : function() {
UserSelector.getView(
function(id, name) {
var proposerField = Ext
.getCmp('proposer');
proposerField
.setValue(name);
}
, false).show();
}
}, {
xtype : 'button',
text : ' 清除记录',
handler : function() {
var proposerField = Ext
.getCmp('proposer');
proposerField.setValue('');
}
}]
}
, {
fieldLabel : '审批状态 ',
hiddenName : 'goodsApply.approvalStatus',
id : 'approvalStatus',
xtype : 'combo',
mode : 'local',
editable : false,
triggerAction : 'all',
store : [['1', '已审批'], ['0', '未审批']]
}, {
fieldLabel : '备注',
name : 'goodsApply.notes',
id : 'notes',
xtype:'textarea'
}
]
});
if (this.applyId != null && this.applyId != 'undefined') {
formPanel.getForm().load({
deferredRender : false,
url : __ctxPath + '/admin/getGoodsApply.do?applyId=' + this.applyId,
method:'post',
waitMsg : '正在载入数据...',
success : function(form, action) {
// Ext.Msg.alert('编辑', '载入成功!');
var applyDate = action.result.data.applyDate;
var applyDateField = Ext.getCmp('applyDate');
applyDateField.setValue(new Date(getDateFromFormat(applyDate, "yyyy-MM-dd HH:mm:ss")));
var goodsId=action.result.data.officeGoods.goodsId;
var goodsName=action.result.data.officeGoods.goodsName;
var goodsIdField=Ext.getCmp('goodsId');
var goodsNameField=Ext.getCmp('goodsName');
goodsIdField.setValue(goodsId);
goodsNameField.setValue(goodsName);
},
failure : function(form, action) {
// Ext.Msg.alert('编辑', '载入失败');
}
});
}
return formPanel;
};
| JavaScript |
/**
* 个人短信详情
*/
var MessageDetail = function(id){
var win = new Ext.Window({
title : '个人短信详情',
autoHeight :true,
//autoWidth :true,
width : 500,
buttonAlign : 'center',
autoLoad : {url:__ctxPath+'/info/detailInMessage.do?receiveId='+id},
buttons: [{
text : '关闭',
handler : function(){
win.close();
}
}]
});
win.show();
} | JavaScript |
var MessageForm = function() {
var formPanel = this.initUI();
var panel = new Ext.Panel( {
// title : '发送信息',
buttonAlign : 'center',
border:false,
items : formPanel
});
return panel;
}
MessageForm.prototype.initUI = function() {
var formPanel = new Ext.form.FormPanel( {
id : 'mFormPanel',
title:'发送信息',
frame : true,
border:false,
style:'margin-top:10%;margin-left:20%;',
width : 380,
height : 220,
defaultType : 'textarea',
url : __ctxPath + '/info/sendShortMessage.do',
method : 'post',
reader : new Ext.data.JsonReader( {
root : 'data',
id : 'messageId'
}, [ {
name : 'userId',
mapping : 'senderId'
}, {
name : 'userFullname',
mapping : 'sender'
} ]),
defaults : {
allowBlank : false,
selectOnFocus : true,
msgTarget : 'side'
},
modal : true,
layout:'form',
plain : true,
scope:this,
buttonAlign : 'center',
items : [{
xtype : 'hidden',
name : 'userId',
id : 'userId'
},{
xtype:'fieldset',
style:'padding:0px',
border:false,
hight:70,
layout:'column',
items:[{
xtype:'label',
text:'收信人:',
width:50
},{
xtype : 'textarea',
name : 'userFullname',
id : 'userFullname',
allowBlank : false,
readOnly : true,
width:200,
height:50
}, {
xtype:'container',
border:true,
width:100,
heigth:30,
items:[{
xtype : 'button',
iconCls:'btn-mail_recipient',
text : '添加联系人 ',
width:80,
handler :function(){
UserSelector.getView(function(userIds,fullnames){
var userId=Ext.getCmp('userId');
var userFullname=Ext.getCmp('userFullname');
if(userId.getValue()!=''&&userFullname.getValue()!=''){
var stId=(userId.getValue()+',').concat(userIds);
var stName=(userFullname.getValue()+',').concat(fullnames);
var ids=uniqueArray(stId.split(','));
var names=uniqueArray(stName.split(','));
userId.setValue(ids.toString());
userFullname.setValue(names.toString());
}else{
userId.setValue(userIds);
userFullname.setValue(fullnames);
}
}).show();
}
}, {
xtype : 'button',
text : '清除联系人',
iconCls:'btn-del',
width:80,
handler : function() {
var name = Ext.getCmp('userFullname');
var id = Ext.getCmp('userId');
name.reset();
id.reset();
}}]
}]},{
xtype:'fieldset',
border:false,
style:'padding:0px',
layout:'column',
height:70,
items:[{
xtype:'label',
text:'内容:',
width:50
},{
id : 'sendContent',
xtype : 'textarea',
name : 'content',
width:290
}]} ],
buttons : [ {
text : '发送',
iconCls:'btn-mail_send',
handler : function() {
var message = Ext.getCmp('mFormPanel');
if (message.getForm().isValid()) {
message.getForm().submit( {
waitMsg : '正在 发送信息',
success : function(message, o) {
var message = Ext.getCmp('mFormPanel');
Ext.Msg.alert('操作信息', '信息发送成功!');
message.getForm().reset();
}
});
}
}
}, {
text : '重置',
iconCls:'reset',
handler : function() {
var message = Ext.getCmp('mFormPanel');
message.getForm().reset();
}
} ]
});
return formPanel;
} | JavaScript |
/**
* 公告详情
*/
var NoticeDetail = function(id){
var win = new Ext.Window({
title : '公告详情',
autoHeight :true,
//autoWidth :true,
width : 500,
buttonAlign : 'center',
autoLoad : {url:__ctxPath+'/pages/info/noticedetail.jsp?noticeId='+id},
buttons: [{
text : '关闭',
handler : function(){
win.close();
}
}]
});
win.show();
} | JavaScript |
var NoticeForm = function(noticeId) {
this.noticeId = noticeId;
var fp = this.setup();
var window = new Ext.Window({
id : 'NoticeFormWin',
title : '公告详细信息',
width : 800,
autoHeight : true,
modal : true,
layout : 'anchor',
plain : true,
bodyStyle : 'padding:5px;',
buttonAlign : 'center',
items : [this.setup()],
buttons : [{
text : '保存',
iconCls : 'btn-save',
handler : function() {
var fp = Ext.getCmp('NoticeForm');
if (fp.getForm().isValid()) {
fp.getForm().submit({
method : 'post',
waitMsg : '正在提交数据...',
success : function(fp, action) {
Ext.Msg.alert('操作信息', '成功信息保存!');
Ext.getCmp('NoticeGrid').getStore()
.reload();
window.close();
},
failure : function(fp, action) {
Ext.MessageBox.show({
title : '操作信息',
msg : '信息保存出错,请联系管理员!',
buttons : Ext.MessageBox.OK,
icon : 'ext-mb-error'
});
window.close();
}
});
}
}
}, {
text : '取消',
iconCls : 'btn-cancel',
handler : function() {
window.close();
}
}]
});
window.show();
};
//开启表单提示功能
Ext.QuickTips.init();
NoticeForm.prototype.setup = function() {
var formPanel = new Ext.FormPanel({
url : __ctxPath + '/info/saveNotice.do',
layout : 'form',
id : 'NoticeForm',
frame : true,
defaults : {
widht : 400,
anchor : '100%,100%'
},
formId : 'NoticeFormId',
defaultType : 'textfield',
items : [{
name : 'notice.noticeId',
id : 'noticeId',
xtype : 'hidden',
value : this.noticeId == null ? '' : this.noticeId
}, {
fieldLabel : '发布者',
name : 'notice.postName',
id : 'postName',
allowBlank : false,
blankText : '发布者不能为空'
}, {
fieldLabel : '公告标题',
name : 'notice.noticeTitle',
id : 'noticeTitle',
allowBlank : false,
blankText : '公告标题不能为空'
}, {
fieldLabel : '公告内容',
name : 'notice.noticeContent',
id : 'noticeContent',
xtype : 'htmleditor',
height : 200,
allowBlank : false,
blankText : '公告内容不能为空'
}, {
fieldLabel : '生效日期',
name : 'notice.effectiveDate',
id : 'effectiveDate',
xtype : 'datefield',
format : 'Y-m-d',
anchor:'30%'
}, {
fieldLabel : '失效日期',
name : 'notice.expirationDate',
id : 'expirationDate',
xtype : 'datefield',
format : 'Y-m-d',
anchor:'30%'
},
{
xtype : 'combo',
fieldLabel: '发布状态',
allowBlank:false,
hiddenName: 'notice.state',
id:'state',
emptyText : '请选择发布状态',
mode : 'local',
editable : false,
triggerAction : 'all',
store : [['0','草稿'],['1','立即发布']],
anchor:'30%'
}
]
});
if (this.noticeId != null && this.noticeId != 'undefined') {
formPanel.getForm().load({
deferredRender : false,
url : __ctxPath + '/info/getNotice.do?noticeId='
+ this.noticeId,
waitMsg : '正在载入数据...',
success : function(form, action) {
// Ext.Msg.alert('编辑', '载入成功!');
var effectiveDate = action.result.data.effectiveDate;
var effectiveDateField = Ext.getCmp('effectiveDate');
var expirationDate = action.result.data.expirationDate;
var expirationDateField = Ext.getCmp('expirationDate');
effectiveDateField.setValue(new Date(getDateFromFormat(effectiveDate, "yyyy-MM-dd HH:mm:ss")));
expirationDateField.setValue(new Date(getDateFromFormat(expirationDate, "yyyy-MM-dd HH:mm:ss")));
},
failure : function(form, action) {
// Ext.Msg.alert('编辑', '载入失败');
}
});
}
return formPanel;
};
| JavaScript |
Ext.ns('MessageView');
var MessageView=function(){
return this.setup();
};
MessageView.prototype.setup=function(){
var topbar=this.initTopToolbar();
var formPanel=new MessageForm();
var receiveStore=MessageView.prototype.initReceiveData();
receiveStore.load({params:{start:0, limit:12}});
var receiveTopbar=MessageView.prototype.initReceiveTopToolbar();
var sm=new Ext.grid.CheckboxSelectionModel();
var cm = new Ext.grid.ColumnModel({
columns:[sm,new Ext.grid.RowNumberer(),
{
header: "状态",
dataIndex: 'readFlag',
width: 60,
renderer:function(value) {
return value == '1' ? "<img src='"+__ctxPath+"/images/info/email_open.png'/>" : "<img src='"+__ctxPath+"/images/info/email.png'/>";
}
},{
header: "类别",
dataIndex: 'msgType',
width: 60,
renderer:function(value) {
if(value=='1'){
return "<p style='color:green;'>个人信息</p>";
}else if(value=='2'){
return "<p style='color:green;'>日程安排</p>";
}else if(value=='3'){
return "<p style='color:green;'>计划任务</p>";
}else if(value=='4'){
return "<p style='color:green;'>系统信息</p>";
}else{
return "<p style='color:green;'>其他</p>";
}
}
},{
header: "发送人",
dataIndex: 'sender',
width: 100
},
{
header: "内容",
dataIndex: 'content',
width: 80
},{
header: "发送时间",
dataIndex: 'sendTime',
width: 90
},
{
header:'操作',
dataIndex:'receiveId',
width:120,
renderer:function(value,metadata,record,rowIndex,colIndex){
var replyId=record.data.receiveId;
var msgType=record.data.msgType;
var str='<button title="删除" value=" " class="btn-del" onclick="MessageView.removeReceiveMessage('+replyId+')"> </button>';
if(msgType=='1'){ //1为个人信息
str+=' <button title="回复" value=" " class="btn-update" onclick="MessageView. reply('+replyId+')"> </button>';
}
return str;}
}],
defaults: {
sortable: true,
menuDisabled: true,
width: 100
},
listeners: {
hiddenchange: function(cm, colIndex, hidden) {
saveConfig(colIndex, hidden);
}
}
});
var gridReceive=new Ext.grid.GridPanel({
id:'ReceiveMessageV',
autoHeight : true,
title:'已收信息显示',
tbar:receiveTopbar,
store: receiveStore,
shim: true,
trackMouseOver:true,
disableSelection:false,
autoScroll:true,
loadMask: true,
draggable :true,
cm:cm,
sm:sm,
viewConfig: {
forceFit:true,
enableRowBody:false,
showPreview:false
},
bbar: new Ext.PagingToolbar({
pageSize: 12,
store: receiveStore,
displayInfo: true,
displayMsg: '当前显示从{0}至{1}, 共{2}条记录',
emptyMsg: "当前没有记录"
})
});
var panel=new Ext.Panel({
id:'MessageView',
iconCls:"menu-message",
title:'内部信息',
height:800,
tbar:topbar,
closable:true,
frame:false,
items:gridReceive
});
return panel;
}
MessageView.prototype.initReceiveTopToolbar=function(){
var searchPanelR=new Ext.FormPanel({
height:20,
// frame:true,
id:'receiveSearchForm',
layout:'column',
url:__ctxPath+'/info/listShortMessage.do',
defaults:{xtype:'label'},
bodyStyle : "backgroundColor:#DFE8F9;",
border:false,
items:[
{
border:false,
text : '类型'
}, {
border:false,
xtype : 'textfield',
name : 'shortMessage.msgType'
}, {
border:false,
text : '发送人'
}, {
border:false,
xtype : 'textfield',
name : 'shortMessage.sender'
},{
border:false,
text:'从'
}
,{
border:false,
xtype:'datefield',
format:'Y-m-d',
name:'from',
readOnly:true
},
{
border:false,
text:'到'
},
{
border:false,
xtype:'datefield',
format:'Y-m-d',
name:'to',
readOnly:true
},
{
xtype:'hidden',
name:'start',
value:0
},
{
xtype:'hidden',
name:'limit',
value:12
}
]
});
var toolbar=new Ext.Toolbar({
id:'search',
width: '100%',
height: 25,
items: [
searchPanelR
,{
text:'查询',
iconCls:'search',
handler:function(){
var receiveGrid = Ext.getCmp('ReceiveMessage');
searchPanelR.getForm().submit({
waitMsg:'正在提交查询信息',
success: function(searchPanelR, action){
var receiveStore = receiveGrid.getStore();
var rsText=action.response.responseText.replace('success:true,',"");
var result=Ext.util.JSON.decode(rsText);
receiveStore.loadData(result,false);
},
failure:function(searchPanelR, action){
alert('something wrong');
}
});
}
}
,{
text:'重置'
,iconCls:'reset',
handler:function(){
searchPanelR.getForm().reset();
}
},
{
iconCls : 'btn-del',
text : '删除信息',
xtype : 'button',
handler : function() {
var grid=Ext.getCmp("ReceiveMessage");
var selectRecords=grid.getSelectionModel().getSelections();
if(selectRecords.length==0){
Ext.Msg.alert("信息","请选择要删除的记录!");
return;
}
var ids=Array();
for(var i=0;i<selectRecords.length;i++){
ids.push(selectRecords[i].data.roleId);
}
MessageView.removeReceiveMessage(ids);
}
}
]
});
return toolbar;
};
MessageView.prototype.initSendTopToolbar=function(){
var searchPanelS=new Ext.FormPanel({
height:20,
// frame:true,
id:'sendSearchForm',
layout:'column',
url:__ctxPath+'/info/listInMessage.do',
defaults:{xtype:'label'},
border:false,
bodyStyle : "backgroundColor:#DFE8F9;",
items:[
{
text : '收信人'
}, {
xtype : 'textfield',
name : 'inMessage.userFullname'
},{
text:'从'
}
,{
xtype:'datefield',
format:'Y-m-d',
name:'from',
readOnly:true
},
{
text:'到'
},
{
xtype:'datefield',
format:'Y-m-d',
name:'to',
readOnly:true
},
{
xtype:'hidden',
name:'start',
value:0
},
{
xtype:'hidden',
name:'limit',
value:12
}
]
});
var toolbar=new Ext.Toolbar({
id:'search',
width: '100%',
height: 25,
items: [
searchPanelS
,{
text:'查询',
iconCls:'search',
handler:function(){
var sendGrid = Ext.getCmp('sendMessage');
searchPanelS.getForm().submit({
waitMsg:'正在提交查询信息',
success: function(searchPanelS, action){
var sendStore = sendGrid.getStore();
var rsText=action.response.responseText.replace('success:true,',"");
var result=Ext.util.JSON.decode(rsText);
sendStore.loadData(result,false);
}
});
}
}
,{
text:'重置'
,iconCls:'reset',
handler:function(){
searchPanelS.getForm().reset();
}
}
]
});
return toolbar;
};
MessageView.prototype.initTopToolbar=function(){
var sm=new Ext.grid.CheckboxSelectionModel();
var cm = new Ext.grid.ColumnModel({
columns:[sm,new Ext.grid.RowNumberer(),
{
header: "状态",
dataIndex: 'readFlag',
width: 60,
renderer:function(value) {
return value == '1' ? "<img src='"+__ctxPath+"/images/info/email_open.png'/>" : "<img src='"+__ctxPath+"/images/info/email.png'/>";
}
},{
header: "类别",
dataIndex: 'msgType',
width: 60,
renderer:function(value) {
if(value=='1'){
return "<p style='color:green;'>个人信息</p>";
}else if(value=='2'){
return "<p style='color:green;'>日程安排</p>";
}else if(value=='3'){
return "<p style='color:green;'>计划任务</p>";
}else if(value=='4'){
return "<p style='color:green;'>系统信息</p>";
}else{
return "<p style='color:green;'>其他</p>";
}
}
},{
header: "发送人",
dataIndex: 'sender',
width: 100
},
{
header: "内容",
dataIndex: 'content',
width: 80
},{
header: "发送时间",
dataIndex: 'sendTime',
width: 90
},
{
header:'操作',
dataIndex:'receiveId',
width:120,
renderer:function(value,metadata,record,rowIndex,colIndex){
var replyId=record.data.receiveId;
var msgType=record.data.msgType;
var str='<button title="删除" value=" " class="btn-del" onclick="MessageView.removeReceiveMessage('+replyId+')"> </button>';
if(msgType=='1'){ //1为个人信息
str+=' <button title="回复" value=" " class="btn-update" onclick="MessageView. reply('+replyId+')"> </button>';
}
return str;}
}],
defaults: {
sortable: true,
menuDisabled: true,
width: 100
},
listeners: {
hiddenchange: function(cm, colIndex, hidden) {
saveConfig(colIndex, hidden);
}
}
});
var cms = new Ext.grid.ColumnModel({
columns:[sm,new Ext.grid.RowNumberer(),
// {
// header: "类别",
// dataIndex: 'msgType',
// width: 60,
// renderer:function(value) {
// return value == '1' ? "<p style='color:green;'>个人信息</p>" : "<p style='color:red;'>其他</p>";
// }
// },
{
header: "收信人",
dataIndex: 'userFullname',
width: 100
},
{
header: "内容",
dataIndex: 'content',
width: 80
},{
header: "发送时间",
dataIndex: 'sendTime',
width: 90
},{
header:'操作',
dataIndex:'receiveId',
width:120,
renderer:function(value,metadata,record,rowIndex,colIndex){
var editId=record.data.receiveId;
var str=' <button title="重发" value=" " class="btn-update" onclick="MessageView.reSend('+editId+')"> </button>';
return str;
}
}],
defaults: {
sortable: true,
menuDisabled: true,
width: 100
},
listeners: {
hiddenchange: function(cm, colIndex, hidden) {
saveConfig(colIndex, hidden);
}
}
});
var toolbar=new Ext.Toolbar({
width: '100%',
height: 30,
layout:'column',
items: [new Ext.Button({text: '发送信息',
iconCls:'btn-sendM',
handler: function() {
var reView=Ext.getCmp('MessageView');
reView.removeAll();
reView.add(new MessageForm());
reView.doLayout(true);
}
}),{text: '已发信息',
iconCls:'btn-sendMessage',
handler: function() {
var reView1=Ext.getCmp('MessageView');
reView1.removeAll();
var sendStore=MessageView.prototype.initSendData();
sendStore.load({params:{start:0, limit:12}});
var sendTopbar=MessageView.prototype.initSendTopToolbar();
reView1.add(
new Ext.grid.GridPanel({
id:'sendMessage',
autoHeight : true,
title:'已发信息显示',
tbar:sendTopbar,
store: sendStore,
shim: true,
trackMouseOver:true,
disableSelection:false,
autoScroll:true,
loadMask: true,
draggable :true,
cm:cms,
sm:sm,
viewConfig: {
forceFit:true,
enableRowBody:false,
showPreview:false
},
bbar: new Ext.PagingToolbar({
pageSize: 12,
store: sendStore,
displayInfo: true,
displayMsg: '当前显示从{0}至{1}, 共{2}条记录',
emptyMsg: "当前没有记录"
})
}));
reView1.doLayout(true);
}
},{text: '已收信息',
iconCls:'btn-receiveMessage',
handler: function() {
var reView2=Ext.getCmp('MessageView');
reView2.removeAll();
var receiveStore=MessageView.prototype.initReceiveData();
receiveStore.load({params:{start:0, limit:12}});
var receiveTopbar=MessageView.prototype.initReceiveTopToolbar();
reView2.add(new Ext.grid.GridPanel({
id:'ReceiveMessage',
autoHeight : true,
title:'已收信息显示',
tbar:receiveTopbar,
store: receiveStore,
shim: true,
trackMouseOver:true,
disableSelection:false,
autoScroll:true,
loadMask: true,
draggable :true,
cm:cm,
sm:sm,
viewConfig: {
forceFit:true,
enableRowBody:false,
showPreview:false
},
bbar: new Ext.PagingToolbar({
pageSize: 12,
store: receiveStore,
displayInfo: true,
displayMsg: '当前显示从{0}至{1}, 共{2}条记录',
emptyMsg: "当前没有记录"
})
}));
reView2.doLayout(true);
}
}]
});
return toolbar;
};
MessageView.prototype.initReceiveData=function(){
var receiveStore = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url: __ctxPath+'/info/listShortMessage.do'
}),
reader: new Ext.data.JsonReader({
root: 'result',
totalProperty: 'totalCounts',
id: 'id',
fields: [
{name:'receiveId',type:'int'},
{name:'messageId',mapping:'shortMessage.messageId',type:'int'},
{name:'msgType',mapping:'shortMessage.msgType',type:'int'},
{name:'senderId',mapping:'shortMessage.senderId',type:'int'},
{name:'sender',mapping:'shortMessage.sender'},
{name:'content',mapping:'shortMessage.content'},
{name:'sendTime',mapping:'shortMessage.sendTime'},
{name:'readFlag'}
]
}),
remoteSort: true
});
receiveStore.setDefaultSort('id', 'desc');
MessageView.sendStore=receiveStore;
return receiveStore;
};
MessageView.prototype.initSendData=function(){
var sendStore = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url: __ctxPath+'/info/listInMessage.do'
}),
reader: new Ext.data.JsonReader({
root: 'result',
totalProperty: 'totalCounts',
id: 'id',
fields: [
{name:'receiveId',type:'int'},
{name:'messageId',mapping:'shortMessage.messageId',type:'int'},
{name:'msgType',mapping:'shortMessage.msgType' ,type:'int'},
{name:'content',mapping:'shortMessage.content'},
{name:'userId',type:'int'},
'userFullname',
{name:'sendTime',mapping:'shortMessage.sendTime'}
]
}),
remoteSort: true
});
sendStore.setDefaultSort('id', 'desc');
MessageView.sendStore=sendStore;
return sendStore;
};
MessageView.reply=function(replyId){
var reView1=Ext.getCmp('MessageView');
reView1.removeAll();
var message=new MessageForm();
reView1.add(message);
var reply=Ext.getCmp('mFormPanel');
reView1.doLayout(true);
reply.form.load({
url:__ctxPath+'/info/replyInMessage.do',
params:{receiveId:replyId},
method:'post',
deferredRender :true,
layoutOnTabChange :true,
success : function() {
Ext.Ajax.request({
url: __ctxPath+'/info/knowInMessage.do',
method:'POST',
params:{receiveId:replyId},
success: function(response,options){
},
failure: function(response,options){
},
scope:this
});
},
failure : function() {
}
});
}
MessageView.reSend=function(receiveId){
var grid=Ext.getCmp('sendMessage');
var rows=grid.getSelectionModel().getSelections();
if(rows.length>0){
var userId=rows[0].data.userId;
var content=rows[0].data.content;
Ext.Ajax.request(
{
url:__ctxPath+'/info/sendShortMessage.do',
params:{userId:userId+',',content:content},
method:'post',
success: function(){
Ext.Msg.alert('操作信息','重发成功!');
grid.getStore().reload();
}
}
);
}
}
MessageView.removeReceiveMessage=function(receiveId){
var receive = Ext.getCmp('ReceiveMessage');
Ext.Msg.confirm('删除操作','你确定要删除该信息吗?',function(btn){
if(btn=='yes'){
//alert(newsId)
Ext.Ajax.request(
{
url:__ctxPath+'/info/multiRemoveInMessage.do',
params:{ids:receiveId},
method:'post',
success: function(){
Ext.Msg.alert('操作信息','删除信息成功!')
receive.getStore().reload();
}
}
);
}
});
};
| JavaScript |
var ContactWin = function() {
var panel = this.initWin();
var window = new Ext.Window({
title : '选择联系人',
width : 440,
height : 500,
items : [panel],
buttonAlign:'center',
buttons : [{
text : '确认',
handler : function() {
var grid = Ext.getCmp('contactGrid');
var rows = grid.getSelectionModel().getSelections();
if (rows.length == 0) {
Ext.Msg.alert("信息", "请选择要添加的联系人!");
return;
}
var strId = '';
var strName = '';
var checkName = Ext.getCmp('userFullname');
var checkId = Ext.getCmp('userId');
for (var i = 0; i < rows.length; i++) {
var ids = checkId.getValue().split(',');
var id = rows[i].data.userId;
var bool = false;
for (var j = 0; j < ids.length; j++) {
if (ids[j] == id) {
bool = true;
Ext.Msg.alert('警告', '已经存在了');
return bool;
}
}
if (!bool) {
strId = strId + id + ',';
strName = strName + rows[i].data.fullname + ',';
}
}
checkId.setValue(checkId.getValue() + strId);
checkName.setValue(checkName.getValue() + strName);
}
}, {
text : '关闭',
handler : function() {
window.close();
}
}]
});
window.show();
}
ContactWin.prototype.initWin = function() {
var store = this.initData();
store.load({
params : {
start : 0,
limit : 10
}
});
var sm = new Ext.grid.CheckboxSelectionModel();
var cm = new Ext.grid.ColumnModel({
columns : [sm, new Ext.grid.RowNumberer(), {
header : "用户名",
dataIndex : 'fullname',
width : 60
}],
defaults : {
sortable : true,
menuDisabled : true,
width : 100
},
listeners : {
hiddenchange : function(cm, colIndex, hidden) {
saveConfig(colIndex, hidden);
}
}
});
var treePanel = new Ext.tree.TreePanel({
id : 'treePanels',
title : '按部门分类 ',
loader : new Ext.tree.TreeLoader({
url : __ctxPath + '/system/listDepartment.do'
}),
root : new Ext.tree.AsyncTreeNode({
expanded : true
}),
rootVisible : false,
listeners : {
'click' : ContactWin.clickNode
}
});
var rolePanel = new Ext.tree.TreePanel({
id : 'rolePanel',
title : '按角色分类 ',
loader : new Ext.tree.TreeLoader({
url : __ctxPath + '/system/treeAppRole.do'
}),
root : new Ext.tree.AsyncTreeNode({
expanded : true
}),
rootVisible : false,
listeners : {
'click' : ContactWin.clickRoleNode
}
});
var onlinePanel = new Ext.Panel({
id : 'onlinePanel',
title : '在线人员 '
});
var contactGrid = new Ext.grid.GridPanel({
id : 'contactGrid',
height : 400,
store : store,
shim : true,
trackMouseOver : true,
disableSelection : false,
loadMask : true,
cm : cm,
sm : sm,
viewConfig : {
forceFit : true,
enableRowBody : false,
showPreview : false
},
bbar : new Ext.PagingToolbar({
pageSize : 10,
store : store,
displayInfo : true,
displayMsg : '当前显示从{0}至{1}, 共{2}条记录',
emptyMsg : "当前没有记录"
})
});
var contactPanel = new Ext.Panel({
id : 'contactPanel',
width : 400,
height : 420,
layout : 'border',
border:false,
items : [{
region : 'west',
split : true,
collapsible : true,
width : 150,
margins:'5 0 5 5',
layout:'accordion',
items: [treePanel, rolePanel, onlinePanel]
}, {
region : 'center',
margins:'5 0 5 5',
width : 220,
items : [contactGrid]
}]
});
return contactPanel;
};
ContactWin.prototype.initData = function() {
var store = new Ext.data.Store({
proxy : new Ext.data.HttpProxy({
url : __ctxPath + '/system/selectAppUser.do'
}),
reader : new Ext.data.JsonReader({
root : 'result',
totalProperty : 'totalCounts',
id : 'id',
fields : [{
name : 'userId',
type : 'int'
}, 'fullname']
}),
remoteSort : true
});
store.setDefaultSort('id', 'desc');
return store;
};
ContactWin.clickNode = function(node) {
if (node != null) {
var users = Ext.getCmp('contactGrid');
var store = users.getStore();
store.url = __ctxPath + '/system/selectAppUser.do';
store.baseParams = {
depId : node.id
};
store.params = {
start : 0,
limit : 10
};
store.reload({
params : {
start : 0,
limit : 10
}
});
}
}
ContactWin.clickRoleNode = function(node) {
if (node != null) {
var users = Ext.getCmp('contactGrid');
var store = users.getStore();
store.url = __ctxPath + '/system/findAppUser.do';
store.baseParams = {
roleId : node.id
};
store.params = {
start : 0,
limit : 10
};
store.reload({
params : {
start : 0,
limit : 10
}
});
}
} | JavaScript |
var MessageWin=function(){
var panel=this.initUI();
var window = new Ext.Window({
id:'win',
title: '信息',
region:'west',
width: 300,
height:200,
x: 5,
y:350,
layout: 'fit',
plain:true,
bodyStyle:'padding:5px;',
buttonAlign:'center',
items:[],
buttons:[{
text:'知道了',
handler:function(){
Ext.Ajax.request({
url: __ctxPath+'/info/knowInMessage.do',
method:'POST',
params:{receiveId:replyId},
success: function(response,options){
},
failure: function(response,options){
},
scope:this
});
var win=Ext.getCmp('win');
win.close();
// var mPanel=Ext.getCmp('mePanel');
// mPanel.removeAll();
}
},{
text:'回复',
handler:function(){
var win=Ext.getCmp('win');
win.close();
var form =Ext.getCmp('mFormPanel');
Ext.Ajax.request({
url: __ctxPath+'/info/knowInMessage.do',
method:'POST',
params:{receiveId:replyId},
success: function(response,options){
},
failure: function(response,options){
},
scope:this
});
new ReMessageWin();
var reply=Ext.getCmp('mmFormPanel');
reply.form.load({
url:__ctxPath+'/info/replyInMessage.do',
params:{receiveId:replyId},
method:'post',
deferredRender :true,
layoutOnTabChange :true,
success : function() {
},
failure : function() {
}
});
}
},{
text:'删除',
handler:function(){
Ext.Ajax.request({
url: __ctxPath+'/info/removeInMessage.do',
method:'POST',
params:{receiveId:replyId},
success: function(response,options){
var win=Ext.getCmp('win');
win.close();
var mPanel=Ext.getCmp('mePanel');
mPanel.removeAll();
Ext.Msg.alert('操作信息', '信息删除成功!');
},
failure: function(response,options){
Ext.Msg.alert('操作信息', '信息删除失败!');
},
scope:this
});
}
}]
});
window.show();
}
var replyId;
MessageWin.prototype.initUI=function(){
var store=this.initData();
store.load();
store.on('load',AJAX_Loaded, store, true);
function AJAX_Loaded(){
var window=Ext.getCmp('win');
window.removeAll();
var rec = store.getAt(0);
replyId=rec.get('receiveId');
var senderId=rec.get("senderId");
var sender=rec.get('sender');
var sendTime=rec.get('sendTime');
var content=rec.get("content");
var panel=new Ext.Panel({
id:'pp',
columnWidth:.33,
height:150,
width:160,
html:'<p> '+sender+' '+sendTime+'</p><p style="color:red;">'+content+'</p>'
});
window.setTitle(sender+'发送的信息');
window.add(panel);
window.doLayout(true);
}
}
MessageWin.prototype.initData=function(){
var store = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url: __ctxPath+'/info/readInMessage.do'
}),
reader: new Ext.data.JsonReader(
{
root: 'data'
},[ {name:'receiveId',type:'int'},
{name:'messageId',type:'int'},
{name:'msgType',type:'int'},
{name:'senderId',type:'int'},
'sender',
'content',
{name:'sendTime'}
]
)
});
return store;
};
| JavaScript |
Ext.ns('NewsTypeTree');
var NewsTypeTree=function(){
return this.setup();
};
NewsTypeTree.prototype.setup=function(){
var selected;//右键菜单所点的树结点
//类别管理树
var treePanel = new Ext.tree.TreePanel({
id:'typeTree',
title:'新闻类别',
region : 'west',
width : 200,
height:480,
autoScroll: true,
collapsible : true,
split: true,
tbar:new Ext.Toolbar({
width: '100%',
height: 30,
items: [
{
text: '添加',
iconCls:'add-info',
handler: function() {
new NewsTypeForm();
}
}
,{
text:'刷新',
iconCls:'refresh',
handler:function(){
treePanel.root.reload();
}
}
]
}),
loader: new Ext.tree.TreeLoader({url:__ctxPath+'/info/treeNewsType.do'}),
root:
new Ext.tree.AsyncTreeNode({
expanded: true
}),
rootVisible: false,
listeners: {
'click': NewsTypeTree.clickNode
}
});
//树的右键菜单的
treePanel.on('contextmenu', contextmenu, treePanel);
// 创建右键菜单
var treeMenu = new Ext.menu.Menu( {
id : 'treeMenu',
items : [
{
text : '新建',
iconCls:'btn-add',
scope : this,
handler :createNode
},
{
text : '修改',
iconCls:'btn-edit',
scope : this,
handler : editNode
},{
text : '删除',
iconCls:'btn-delete',
scope : this,
handler : deteleNode
}
]
});
function contextmenu(node, e) {
selected = new Ext.tree.TreeNode({
id:node.id,
text:node.text
});
treeMenu.showAt(e.getXY());
}
/**
* 菜单事件
*/
function createNode(){//增加结点
var newsTypeForm = Ext.getCmp('newsTypeForm');
if(newsTypeForm==null){
new NewsTypeForm();
}
}
function deteleNode(){//删除结点
var typeId = selected.id;
var type = Ext.getCmp('typeTree');
if(typeId>0){
Ext.Msg.confirm('删除操作','你确定删除新闻类型?',function(btn){
if(btn=='yes'){
Ext.Ajax.request({
url:__ctxPath+'/info/removeNewsType.do',
params:{typeId:typeId},
method:'post',
success:function(){
Ext.Msg.alert('操作信息','删除成功!');
var newsTypeGrid = Ext.getCmp('NewsTypeView');
if(newsTypeGrid!=null){
newsTypeGrid.getStore().reload();
}
if(type!=null){type.root.reload();}
}
});
}
});
}
}
function editNode(){//修改结点
var typeId = selected.id;
var newsTypeForm = Ext.getCmp('newsTypeForm');
if(newsTypeForm==null){
new NewsTypeForm();
newsTypeForm = Ext.getCmp('newsTypeForm');
}
newsTypeForm.form.load({
url:__ctxPath+'/info/detailNewsType.do',
params:{typeId:typeId},
method:'post',
deferredRender :true,
layoutOnTabChange :true,
waitMsg : '正在载入数据...',
success : function() {
//Ext.Msg.alert('编辑', '载入成功!');
},
failure : function() {
Ext.Msg.alert('编辑', '载入失败');
}
});
}
return treePanel;
}
/**
*按类别查找新闻
*/
NewsTypeTree.clickNode=function(node){
if (node != null) {
var news = Ext.getCmp('NewsGrid');
var store=news.getStore();
store.proxy =new Ext.data.HttpProxy({url:__ctxPath+'/info/categoryNews.do'});
store.baseParams={typeId:node.id};
store.reload({params:{start:0,limit:25}});
}
} | JavaScript |
Ext.ns('NoticeView');
/**
* 公告列表
*/
var NoticeView = function() {
return new Ext.Panel({
id : 'NoticeView',
title : '公告列表',
iconCls : 'menu-notice',
autoScroll : true,
items : [new Ext.FormPanel({
height : 35,
frame : true,
id : 'NoticeSearchForm',
layout : 'column',
defaults : {
xtype : 'label'
},
items : [{
text : '请输入查询条件:'
}, {
text : '发布者'
}, {
xtype : 'textfield',
name : 'Q_postName_S_LK'
}, {
text : '标题'
}, {
xtype : 'textfield',
name : 'Q_noticeTitle_S_LK'
}, {
text : '内容'
},
{
xtype : 'textfield',
name : 'Q_noticeContent_S_LK'
},
{
xtype : 'button',
text : '查询',
iconCls : 'search',
handler : function() {
var searchPanel = Ext.getCmp('NoticeSearchForm');
var grid = Ext.getCmp('NoticeGrid');
if (searchPanel.getForm().isValid()) {
searchPanel.getForm().submit({
waitMsg : '正在提交查询',
url : __ctxPath + '/info/listNotice.do',
success : function(formPanel, action) {
var result = Ext.util.JSON
.decode(action.response.responseText);
grid.getStore().loadData(result);
}
});
}
}
}, {
xtype : 'button',
text : '重置',
iconCls : 'reset',
handler : function() {
var searchPanel = Ext.getCmp('NoticeSearchForm');
searchPanel.getForm().reset();
}
}]
}), this.setup()]
});
};
/**
* 建立视图
*/
NoticeView.prototype.setup = function() {
return this.grid();
};
/**
* 建立DataGrid
*/
NoticeView.prototype.grid = function() {
var sm = new Ext.grid.CheckboxSelectionModel();
var cm = new Ext.grid.ColumnModel({
columns : [sm, new Ext.grid.RowNumberer(), {
header : 'noticeId',
dataIndex : 'noticeId',
hidden : true
}, {
header : '发布者',
dataIndex : 'postName'
}, {
header : '公告标题',
dataIndex : 'noticeTitle'
}, {
header : '公告内容',
dataIndex : 'noticeContent'
}, {
header : '生效日期',
dataIndex : 'effectiveDate'
}, {
header : '失效日期',
dataIndex : 'expirationDate'
}, {
header : '状态',
dataIndex : 'state',
renderer : function(value){
return value == "1"?"正式发布":"草稿";
}
}, {
header : '管理',
dataIndex : 'noticeId',
sortable : false,
width : 50,
renderer : function(value, metadata, record, rowIndex,
colIndex) {
var editId = record.data.noticeId;
var str = '<button title="删除" value=" " class="btn-del" onclick="NoticeView.remove('
+ editId + ')"></button>';
str += ' <button title="编辑" value=" " class="btn-edit" onclick="NoticeView.edit('
+ editId + ')"></button>';
return str;
}
}],
defaults : {
sortable : true,
menuDisabled : false,
width : 100
}
});
var store = this.store();
store.load({
params : {
start : 0,
limit : 25
}
});
var grid = new Ext.grid.GridPanel({
id : 'NoticeGrid',
tbar : this.topbar(),
store : store,
trackMouseOver : true,
disableSelection : false,
loadMask : true,
autoHeight : true,
cm : cm,
sm : sm,
viewConfig : {
forceFit : true,
enableRowBody : false,
showPreview : false
},
bbar : new Ext.PagingToolbar({
pageSize : 25,
store : store,
displayInfo : true,
displayMsg : '当前显示从{0}至{1}, 共{2}条记录',
emptyMsg : "当前没有记录"
})
});
grid.addListener('rowdblclick', function(grid, rowindex, e) {
grid.getSelectionModel().each(function(rec) {
NoticeView.edit(rec.data.noticeId);
});
});
return grid;
};
/**
* 初始化数据
*/
NoticeView.prototype.store = function() {
var store = new Ext.data.Store({
proxy : new Ext.data.HttpProxy({
url : __ctxPath + '/info/listNotice.do'
}),
reader : new Ext.data.JsonReader({
root : 'result',
totalProperty : 'totalCounts',
id : 'id',
fields : [{
name : 'noticeId',
type : 'int'
}
, 'postName', 'noticeTitle',
'noticeContent', 'effectiveDate',
'expirationDate', 'state']
}),
remoteSort : true
});
store.setDefaultSort('noticeId', 'desc');
return store;
};
/**
* 建立操作的Toolbar
*/
NoticeView.prototype.topbar = function() {
var toolbar = new Ext.Toolbar({
id : 'NoticeFootBar',
height : 30,
bodyStyle : 'text-align:left',
items : [{
iconCls : 'btn-add',
text : '添加公告',
xtype : 'button',
handler : function() {
new NoticeForm();
}
}, {
iconCls : 'btn-del',
text : '删除公告',
xtype : 'button',
handler : function() {
var grid = Ext.getCmp("NoticeGrid");
var selectRecords = grid.getSelectionModel()
.getSelections();
if (selectRecords.length == 0) {
Ext.Msg.alert("信息", "请选择要删除的记录!");
return;
}
var ids = Array();
for (var i = 0; i < selectRecords.length; i++) {
ids.push(selectRecords[i].data.noticeId);
}
NoticeView.remove(ids);
}
}]
});
return toolbar;
};
/**
* 删除单个记录
*/
NoticeView.remove = function(id) {
var grid = Ext.getCmp("NoticeGrid");
Ext.Msg.confirm('信息确认', '您确认要删除该记录吗?', function(btn) {
if (btn == 'yes') {
Ext.Ajax.request({
url : __ctxPath + '/info/multiDelNotice.do',
params : {
ids : id
},
method : 'post',
success : function() {
Ext.Msg.alert("信息提示", "成功删除所选记录!");
grid.getStore().reload({
params : {
start : 0,
limit : 25
}
});
}
});
}
});
};
/**
*
*/
NoticeView.edit = function(id) {
new NoticeForm(id);
}
| JavaScript |
Ext.ns('NewsTypeView');
var NewsTypeView = function() {
return new Ext.Panel({
id : 'NewsTypeView',
title : '新闻类别',
iconCls:'menu-news_type',
autoScroll : true,
items : [new Ext.FormPanel({
height : 35,
frame : true,
id : 'NewTypeSearchForm',
layout : 'column',
defaults : {
xtype : 'label'
},
items : [{
text : '查询条件:'
}, {
text : '类别名称'
}, {
xtype : 'textfield',
name : 'Q_typeName_S_LK'
}, {
text : '类别顺序'
}, {
xtype : 'textfield',
name : 'Q_sn_S_LK'
},{
text:'查询',
xtype : 'button',
iconCls:'search',
handler:function(){
var newsTypeGrid = Ext.getCmp('NewsTypeGrid');
var searchForm=Ext.getCmp("NewTypeSearchForm");
if (searchForm.getForm().isValid()) {
searchForm.getForm().submit({
waitMsg : '正在提交查询',
url : __ctxPath + '/info/searchNewsType.do',
success : function(
formPanel,
action) {
var result = Ext.util.JSON.decode(action.response.responseText);
newsTypeGrid.getStore().loadData(result);
}
});
}
}
}
,{
text:'重置',
xtype : 'button',
iconCls:'reset',
handler:function(){
var searchForm=Ext.getCmp("NewTypeSearchForm");
searchForm.getForm().reset();
}
}]
}), this.setup()]
});
};
NewsTypeView.prototype.setup=function(){
var store=this.initData();
var topbar=this.initTopToolbar();
store.load({params:{start:0, limit:25}});
var sm=new Ext.grid.CheckboxSelectionModel();
var cm = new Ext.grid.ColumnModel({
columns:[sm,new Ext.grid.RowNumberer(),{
header: "类别ID",
dataIndex: 'typeId',
width: 40
},{
header: "类别名",
dataIndex: 'typeName',
width: 100
},{
header: "类别顺序",
dataIndex: 'sn',
width: 50
},{
header:'管理',
dataIndex:'typeId',
width:150,
renderer:function(value,metadata,record,rowIndex,colIndex){
var editId=record.data.typeId;
var str='<button title="删除" value=" " class="btn-del" onclick="NewsTypeView.remove('+editId+')"> </button>';
str+=' <button title="编辑" value=" " class="btn-edit" onclick="NewsTypeView.edit('+editId+')"> </button>';
str+=' <button title="置顶" value=" " class="btn-top" onclick="NewsTypeView.sort('+editId+','+1+')"> </button>'
str+=' <button title="上移" value=" " class="btn-up" onclick="NewsTypeView.sort('+editId+','+2+')"> </button>'
str+=' <button title="下移" value=" " class="btn-down" onclick="NewsTypeView.sort('+editId+','+3+')"> </button>'
str+=' <button title="置末" value=" " class="btn-last" onclick="NewsTypeView.sort('+editId+','+4+')"> </button>'
return str;
}
}
],
defaults: {
menuDisabled: true,
width: 100
},
listeners: {
hiddenchange: function(cm, colIndex, hidden) {
saveConfig(colIndex, hidden);
}
}
});
var grid = new Ext.grid.GridPanel({
id:'NewsTypeGrid',
autoWidth:true,
autoHeight:true,
tbar:topbar,
closable:true,
store: store,
trackMouseOver:true,
disableSelection:false,
loadMask: true,
cm:cm,
sm:sm,
// customize view config
viewConfig: {
forceFit:true,
enableRowBody:false,
showPreview:false
},
// paging bar on the bottom
bbar: new Ext.PagingToolbar({
pageSize: 25,
store: store,
displayInfo: true,
displayMsg: '当前显示从{0}至{1}, 共{2}条记录',
emptyMsg: "当前没有记录"
})
});
//为Grid增加双击事件,双击行可编辑
grid.addListener('rowdblclick', rowdblclickFn);
function rowdblclickFn(grid, rowindex, e){
grid.getSelectionModel().each(function(rec){
NewsTypeView.edit(rec.data.typeId);
});
}
return grid;
};
NewsTypeView.prototype.initData=function(){
var store = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url: __ctxPath+'/info/listNewsType.do'
}),
// create reader that reads the Topic records
reader: new Ext.data.JsonReader({
root: 'result',
totalProperty: 'totalCounts',
id: 'typeId',
fields: [
{name:'typeId',type:'int'}, 'typeName', {name:'sn',type:'int'}
]
}),
remoteSort: true
});
return store;
};
//初始化操作菜单
NewsTypeView.prototype.initTopToolbar=function(){
var toolbar=new Ext.Toolbar({
width: '100%',
height: 30,
items: [
{
text: '添加',
iconCls:'add-info',
handler: function() {
new NewsTypeForm();
}
}
,{
text: '删除'
,iconCls:'delete-info'
,handler:function(){
var newsTypeGrid = Ext.getCmp('NewsTypeGrid');
var selectRecords =newsTypeGrid.getSelectionModel().getSelections();
if (selectRecords.length == 0) {
Ext.Msg.alert("信息", "请选择要删除的记录!");
return;
}
var ids = Array();
for ( var i = 0; i < selectRecords.length; i++) {
ids.push(selectRecords[i].data.typeId);
}
NewsTypeView.remove(ids);
}
}]
});
return toolbar;
};
/**
* 类别删除
* @param {} userId
*/
NewsTypeView.remove=function(typeId){
Ext.Msg.confirm('删除操作','你确定要删除该类别吗?',function(btn){
var newsTypeView = Ext.getCmp('NewsTypeView');
var type = Ext.getCmp('typeTree');
if(btn=='yes'){
Ext.Ajax.request({
url: __ctxPath+'/info/removeNewsType.do',
method:'post',
params:{typeId:typeId},
success:function(){
var typeTree = Ext.getCmp('typeTree');
Ext.Msg.alert("操作信息","类别删除成功");
Ext.getCmp('NewsTypeGrid').getStore().reload();
if(typeTree!=null){
typeTree.root.reload();
}
},
failure:function(){
Ext.Msg.alert("操作信息","类别删除失败");
NewsTypeView.grid.getStore().reload();
}
});
}
});
}
/**
* 类别编辑
* @param {} userId
*/
NewsTypeView.edit=function(typeId){
var newsTypeForm = Ext.getCmp('newsTypeForm');
if(newsTypeForm==null){
new NewsTypeForm();
newsTypeForm = Ext.getCmp('newsTypeForm');
}
newsTypeForm.form.load({
url:__ctxPath+'/info/detailNewsType.do',
params:{typeId:typeId},
method:'post',
deferredRender :true,
layoutOnTabChange :true,
waitMsg : '正在载入数据...',
success : function() {
//Ext.Msg.alert('编辑', '载入成功!');
},
failure : function() {
Ext.Msg.alert('编辑', '载入失败');
}
});
}
/**
* 类别排序
*/
NewsTypeView.sort = function(typeId,opt){
Ext.Ajax.request({
url: __ctxPath+'/info/sortNewsType.do',
method:'post',
params:{typeId:typeId,opt:opt},
success:function(){
var typeTree = Ext.getCmp('typeTree');
Ext.getCmp('NewsTypeGrid').getStore().reload();
if(typeTree!=null){
typeTree.root.reload();
}
},
failure:function(){
Ext.Msg.alert("操作信息","操作失败");
Ext.getCmp('NewsTypeGrid').getStore().reload();
}
});
}
| JavaScript |
/**
* 新闻详情
*/
var NewsDetail = function(id){
var win = new Ext.Window({
title : '新闻详情',
autoHeight :true,
//autoWidth :true,
//height : 500,
width : 500,
buttonAlign : 'center',
autoLoad : {url:__ctxPath+'/pages/info/newsdetail.jsp?newsId='+id},
buttons: [{
text : '关闭',
handler : function(){
win.close();
}
}]
});
win.show();
} | JavaScript |
Ext.ns('NewsView');
/**
* 新闻列表
*/
var NewsView = function() {
return this.getView();
}
/**
* 显示列表
*
* @return {}
*/
NewsView.prototype.getView = function() {
var newsTypeTree = new NewsTypeTree();
return new Ext.Panel(
{
id : 'NewsView',
title : '新闻信息',
iconCls : 'menu-news',
layout : 'border',
width : '100%',
autoScroll : true,
items : [
newsTypeTree,
{
region : 'center',
anchor : '100%',
items : [ {
items : [
new Ext.FormPanel(
{
height : 35,
frame : true,
id : 'NewsSearchForm',
layout : 'column',
defaults : {
xtype : 'label'
},
items : [
{
text : '请输入条件:'
},
{
text : '标题'
},
{
xtype : 'textfield',
name : 'Q_subject_S_LK',
width : 80
},
{
text : '作者'
},
{
xtype : 'textfield',
name : 'Q_author_S_LK',
width : 80
},
// {
// text : '创建时间'
// }, {
// xtype :
// 'textfield',
// name :
// 'Q_createtime_S_LK'
// }, {
// text : '回复次数'
// }, {
// xtype :
// 'textfield',
// name :
// 'Q_replyCounts_S_LK'
// }, {
// text : '浏览数'
// }, {
// xtype :
// 'textfield',
// name :
// 'Q_viewCounts_S_LK'
// }, {
// text : '内容'
// }, {
// xtype :
// 'textfield',
// name :
// 'Q_content_S_LK'
// }, {
// text : '修改时间'
// }, {
// xtype :
// 'textfield',
// name :
// 'Q_updateTime_S_LK'
// }, {
// text : '状态'
// }, {
// xtype :
// 'textfield',
// name :
// 'Q_status_S_LK'
// },
{
xtype : 'button',
text : '查询',
iconCls : 'search',
handler : function() {
var searchPanel = Ext
.getCmp('NewsSearchForm');
var grid = Ext
.getCmp('NewsGrid');
if (searchPanel.getForm().isValid()) {
searchPanel.getForm().submit({
waitMsg : '正在提交查询',
url : __ctxPath + '/info/listNews.do',
success : function(
formPanel,
action) {
var result = Ext.util.JSON.decode(action.response.responseText);
grid.getStore().loadData(result);
}
});
}
}
},
{
xtype : 'button',
text : '重置',
iconCls : 'reset',
handler : function() {
var searchPanel = Ext
.getCmp('NewsSearchForm');
searchPanel
.getForm()
.reset();
}
}
// , {
// xtype : 'button',
// text : '高级查询',
// iconCls : 'search',
// handler : function() {
// Ext.Msg.alrt('信息','');
// }
// }
]
}), this.setup() ]
} ]
} ]
});
};
/**
* 建立视图
*/
NewsView.prototype.setup = function() {
return this.grid();
};
/**
* 建立DataGrid
*/
NewsView.prototype.grid = function() {
var sm = new Ext.grid.CheckboxSelectionModel();
var cm = new Ext.grid.ColumnModel(
{
columns : [
sm,
new Ext.grid.RowNumberer(),
{
header : 'newsId',
dataIndex : 'newsId',
hidden : true
},
// {
// header : '类别',
// dataIndex : 'typeId'
// },
{
header : '新闻图标',
width : 120,
dataIndex : 'subjectIcon',
renderer : function(value, metadata, record,
rowIndex, colIndex) {
var icon = record.data.subjectIcon;
var str = null;
if (icon != '') {
str = '<img style="border:0;" width="30" height="30" src="'
+ __ctxPath
+ '/attachFiles/'
+ icon + '" border="0"/>';
} else {
str = '<img style="border:0;" width="30" height="30" src="' + __ctxPath + '/images/default_newsIcon.jpg" border="0"/>';
}
return str;
}
},
{
header : '新闻标题',
width : 210,
dataIndex : 'subject'
},
{
header : '作者',
width : 120,
dataIndex : 'author'
},
{
header : '创建时间',
width : 210,
dataIndex : 'createtime'
},
{
header : '回复次数',
width : 120,
dataIndex : 'replyCounts'
},
{
header : '浏览数',
width : 120,
dataIndex : 'viewCounts'
},
{
header : '状态',
width : 120,
dataIndex : 'status',
renderer : function(value) {
return value == 0 ? '禁用' : '生效'
}
},
{
header : '管理',
dataIndex : 'newsId',
width : 210,
renderer : function(value, metadata, record,
rowIndex, colIndex) {
var editId = record.data.newsId;
var str = '<button title="删除" value=" " class="btn-del" onclick="NewsView.remove(' + editId + ')"> </button>';
str += ' <button title="编辑" value=" " class="btn-edit" onclick="NewsView.edit(' + editId + ')"> </button>';
return str;
}
} ],
defaults : {
sortable : true,
menuDisabled : false,
width : 100
}
});
var store = this.store();
store.load( {
params : {
start : 0,
limit : 25
}
});
var grid = new Ext.grid.GridPanel( {
id : 'NewsGrid',
tbar : this.topbar(),
store : store,
trackMouseOver : true,
disableSelection : false,
autoScroll : true,
loadMask : true,
height : 445,
sortable : false,
cm : cm,
sm : sm,
viewConfig : {
forceFit : true,
enableRowBody : false,
showPreview : false
},
bbar : new Ext.PagingToolbar( {
pageSize : 25,
store : store,
displayInfo : true,
displayMsg : '当前显示从{0}至{1}, 共{2}条记录',
emptyMsg : "当前没有记录"
})
});
grid.addListener('rowdblclick', function(grid, rowindex, e) {
grid.getSelectionModel().each(function(rec) {
NewsView.edit(rec.data.newsId);
});
});
return grid;
};
/**
* 初始化数据
*/
NewsView.prototype.store = function() {
var store = new Ext.data.Store( {
proxy : new Ext.data.HttpProxy( {
url : __ctxPath + '/info/listNews.do'
}),
reader : new Ext.data.JsonReader( {
root : 'result',
totalProperty : 'totalCounts',
id : 'id',
fields : [ {
name : 'newsId',
type : 'int'
}
, 'typeId', 'subjectIcon', 'subject', 'author', 'createtime',
'replyCounts', 'viewCounts', 'content', 'updateTime',
'status' ]
}),
remoteSort : true
});
store.setDefaultSort('newsId', 'desc');
return store;
};
/**
* 建立操作的Toolbar
*/
NewsView.prototype.topbar = function() {
var toolbar = new Ext.Toolbar( {
id : 'NewsFootBar',
height : 30,
bodyStyle : 'text-align:left',
items : [ {
iconCls : 'btn-add',
text : '添加',
xtype : 'button',
handler : function() {
new NewsForm();
}
}, {
iconCls : 'btn-del',
text : '删除',
xtype : 'button',
handler : function() {
var grid = Ext.getCmp("NewsGrid");
var selectRecords = grid.getSelectionModel().getSelections();
if (selectRecords.length == 0) {
Ext.Msg.alert("信息", "请选择要删除的记录!");
return;
}
var ids = Array();
for ( var i = 0; i < selectRecords.length; i++) {
ids.push(selectRecords[i].data.newsId);
}
NewsView.remove(ids);
}
} ]
});
return toolbar;
};
/**
* 删除单个记录
*/
NewsView.remove = function(id) {
var grid = Ext.getCmp("NewsGrid");
Ext.Msg.confirm('信息确认', '您确认要删除该记录吗?', function(btn) {
if (btn == 'yes') {
Ext.Ajax.request( {
url : __ctxPath + '/info/multiDelNews.do',
params : {
ids : id
},
method : 'post',
success : function() {
Ext.Msg.alert("信息提示", "成功删除所选记录!");
grid.getStore().reload( {
params : {
start : 0,
limit : 25
}
});
}
});
}
});
};
/**
*
*/
NewsView.edit = function(id) {
new NewsForm(id);
}
| JavaScript |
var NewsTypeForm=function(){
var formPanel=this.initUI();
var window = new Ext.Window({
title: '添加新闻类型',
width: 260,
height:150,
layout: 'fit',
modal:true,
plain:true,
bodyStyle:'padding:5px;',
buttonAlign:'center',
items: [this.initUI()],
buttons: [{
text: '保存',
iconCls:'btn-save',
handler:function(){
var newsTypeGrid = Ext.getCmp('NewsTypeGrid');
var type = Ext.getCmp('typeTree');
var formPanel = Ext.getCmp('newsTypeForm');
if(formPanel.getForm().isValid()){
formPanel.getForm().submit({
waitMsg:'正在提交新闻类型信息',
success: function(formPanel, o){
Ext.Msg.alert('操作信息','添加新闻类型成功!')
window.close();
if(newsTypeGrid!=null){
newsTypeGrid.getStore().reload();
}
if(type!=null){type.root.reload();}
}
});
}
}
},{
text: '取消',
iconCls:'btn-cancel',
handler:function(){
window.close();
}
}
]
});
window.show();
};
NewsTypeForm.prototype.initUI=function(){
var formPanel = new Ext.FormPanel({
id:'newsTypeForm',
baseCls: 'x-plain',
layout:'absolute',
defaultType: 'textfield',
url:__ctxPath+'/info/addNewsType.do',
defaultType: 'textfield',
reader: new Ext.data.JsonReader(
{
root:'data'
},
[
{name:'typeId',mapping:'typeId'}
,{name:'typeName',mapping:'typeName'}
,{name:'sn',mapping:'sn'}
]
),
defaults: {
anchor: '95%,95%',
allowBlank: false,
selectOnFocus: true,
msgTarget: 'side'
},
items: [
{
xtype:'hidden'
,name:'newsType.typeId'
,id:'typeId'
}
,{
x:0,
y:5,
xtype:'label',
text:'类型名称'
}
,{
x:0,
y:20,
name:'newsType.typeName',
blankText: '类型名称为必填!',
id:'typeName'
}
,{
xtype:'hidden',
name:'newsType.sn',
id:'sn'
}
]
});
return formPanel;
}
| JavaScript |
var ReMessageWin=function(){
var panel=this.initUIWin();
var windowRe = new Ext.Window({
id:'wind',
title:'回复',
width:280,
height:200,
x: 5,
y:400,
items:panel,
buttons : [ {
text : '发送',
handler : function() {
var message = Ext.getCmp('mmFormPanel');
if (message.getForm().isValid()) {
message.getForm().submit( {
waitMsg : '正在 发送信息',
success : function(message, o) {
Ext.Msg.alert('操作信息', '信息发送成功!');
windowRe.close();
}
});
}
}
}, {
text : '重置',
handler : function() {
var message1 = Ext.getCmp('mmFormPanel');
message1.getForm().findField("content").reset();
}
} ]
});
windowRe.show();
}
ReMessageWin.prototype.initUIWin = function(){
var mPanel = new Ext.form.FormPanel( {
id : 'mmFormPanel',
frame : true,
bodyStyle : 'padding:5px 20px 0',
width : 275,
height : 180,
defaultType : 'textarea',
url : __ctxPath + '/info/sendShortMessage.do',
reader : new Ext.data.JsonReader( {
root : 'data'
}, [ {
name : 'userId',
mapping : 'senderId'
}, {
name : 'userFullname',
mapping : 'sender'
} ]),
layout:'absolute',
items : [{
xtype : 'hidden',
name : 'userId',
id : 'userId'
}, {
x:0,
y:10,
xtype:'label',
text:'收信人:'
},
{
x:40,
y:10,
xtype : 'field',
width : 200,
name : 'userFullname',
id : 'userFullname',
allowBlank : false,
readOnly : true
},
// { x:40,
// y:80,
// xtype : 'button',
// text : '添加联系人 ',
// width : 20,
// handler : function() {
// new ContactWin();
// }
// }, {
// x:120,
// y:80,
// xtype : 'button',
// text : '清除联系人',
// width : 20,
// handler : function() {
// var name = Ext.getCmp('userFullname');
// name.reset();
// }
//
// },
{
x:0,
y:40,
xtype:'label',
text:'内容:'
}, { x:40,
y:40,
id : 'sendContent',
xtype : 'textarea',
width : 200,
name : 'content'
} ]
});
return mPanel;
}
| JavaScript |
var NewsForm = function(newsId) {
this.newsId = newsId;
var fp = this.setup();
var window = new Ext.Window({
id : 'NewsFormWin',
title : 'News详细信息',
width : 500,
height : 494,
modal : true,
minWidth : 300,
minHeight : 200,
layout : 'anchor',
plain : true,
bodyStyle : 'padding:5px;',
buttonAlign : 'center',
items : [this.setup()],
buttons : [{
text : '保存',
iconCls:'btn-save',
handler : function() {
var fp = Ext.getCmp('NewsForm');
//alert(Ext.Ajax.serializeForm(fp.getForm().getEl().dom));
//return false;
var typeId=Ext.getCmp("typeId");
if(typeId.getValue()==null||typeId.getValue()==''){
Ext.Msg.alert('操作信息', '新闻类型不能为空!');
return;
}
if (fp.getForm().isValid()) {
fp.getForm().submit({
method : 'post',
waitMsg : '正在提交数据...',
success : function(fp, action) {
Ext.Msg.alert('操作信息', '成功信息保存!');
Ext.getCmp('NewsGrid').getStore()
.reload();
window.close();
},
failure : function(fp, action) {
Ext.MessageBox.show({
title : '操作信息',
msg : '信息保存出错,请联系管理员!',
buttons : Ext.MessageBox.OK,
icon : 'ext-mb-error'
});
window.close();
}
});
}
}
}, {
text : '取消',
iconCls:'btn-delete',
handler : function() {
window.close();
}
}]
});
window.show();
};
NewsForm.prototype.setup = function() {
var _url = __ctxPath+'/info/treeNewsType.do?opt=treeSelector';
var newsTypeSelector = new TreeSelector('newsTypeSelect',_url,'新闻类型','typeId');
var formPanel = new Ext.FormPanel({
url : __ctxPath + '/info/saveNews.do',
layout : 'form',
id : 'NewsForm',
frame : true,
// defaults : {
// widht : 400,
// anchor : '100%,100%'
// },
labelWidth : 55,
formId : 'NewsFormId',
defaultType : 'textfield',
items : [{
name : 'news.newsId',
id : 'newsId',
xtype : 'hidden',
value : this.newsId == null ? '' : this.newsId
}, {
xtype:'container',
layout:'column',
defaultType:'textfield',
height:26,
items:[
{
//fieldLabel : '类别ID',
name : 'news.typeId',
id : 'typeId',
xtype : 'hidden',
allowBlank : false
},{
xtype:'label',
text:'新闻类型:'
},
newsTypeSelector,
{
xtype:'label',
text:'新闻作者:'
},{
name : 'news.author',
width:'155',
id : 'author'
}
]
},
{
xtype:'container',
layout:'column',
defaultType:'textfield',
height:26,
items:[{
xtype:'label',
text:'新闻状态:'
},
{
hiddenName:'news.status',
id : 'status',
xtype:'combo',
mode : 'local',
editable : false,
triggerAction : 'all',
allowBlank : false,
store:[['1','生效'], ['0','禁用']]
},{
xtype:'label',
text:'新闻标题:'
},{
name : 'news.subject',
width:'155',
allowBlank : false,
id : 'subject'
}
]
},{
xtype : 'container',
layout : "column",
defaultType : 'textfield',
height:50,
items:[
{
xtype:'label',
text:'新闻图标:'
},{
xtype:'hidden',
name : 'news.subjectIcon',//新闻图标
width:'255',
id : 'subjectIcon'
},{
id :'displayAtForm',
xtype:'panel',
html:'<img style="border:0;" width="30" height="30" src="'+__ctxPath+'/images/default_newsIcon.jpg" border="0"/>'
},{
xtype:'button',
text:'选择',
iconCls:'btn-choose',
handler:function(){
}
},{
xtype:'button',
iconCls:'btn-upload',
text:'上传',
handler:function(){
var subjectIcon = Ext.getCmp('subjectIcon');
var dialog = App.createUploadDialog({
file_cat : 'info/news',
callback : uploadImage
});
//dialog.show('queryBtn');
if(subjectIcon.value != '' && subjectIcon.value !=null && subjectIcon.value !='undefined'){
var msg = '再次上传需要先删除原有图片,';
Ext.Msg.confirm('信息确认', msg+'是否删除?', function(btn) {
if (btn == 'yes') {
//删除图片
Ext.Ajax.request({
url:__ctxPath + '/system/deleteFileAttach.do',
method:'post',
params:{filePath:subjectIcon.value},
success:function(){
var newsId = Ext.getCmp('newsId').value;
if(newsId != '' && newsId !=null && newsId !='undefined'){
Ext.Ajax.request({
url:__ctxPath + '/info/iconNews.do',
method:'post',
params:{newsId: newsId},
success:function(){
subjectIcon.setValue('');
//改为默认图标
Ext.getCmp('displayAtForm').body.update('<img style="border:0;" width="48" height="48" src="'+__ctxPath+'/images/default_newsIcon.jpg" border="0"/>');
Ext.getCmp('NewsGrid').getStore().reload();
dialog.show('queryBtn');
}
});
}else{
subjectIcon.setValue('');
//改为默认图标
Ext.getCmp('displayAtForm').body.update('<img style="border:0;" width="48" height="48" src="'+__ctxPath+'/images/default_newsIcon.jpg" border="0"/>');
dialog.show('queryBtn');
}
}
});
}
})
}else{
dialog.show('queryBtn');
}
}
},{
xtype:'button',
iconCls:'btn-del',
text:'删除',
handler:function(){
var subjectIcon = Ext.getCmp('subjectIcon');
if(subjectIcon.value != null && subjectIcon.value !='' && subjectIcon.value !='undefined'){
var msg = '图片一旦删除将不可恢复,';
Ext.Msg.confirm('确认信息',msg+'是否删除?',function(btn){
if(btn == 'yes'){
Ext.Ajax.request({
url:__ctxPath + '/system/deleteFileAttach.do',
method:'post',
params:{filePath:subjectIcon.value},
success:function(){
var newsId = Ext.getCmp('newsId').value;
if(newsId != '' && newsId !=null && newsId !='undefined'){
Ext.Ajax.request({
url:__ctxPath + '/info/iconNews.do',
method:'post',
params:{newsId:newsId},
success:function(){
subjectIcon.setValue('');
//这里改为默认图标
Ext.getCmp('displayAtForm').body.update('<img style="border:0;" width="48" height="48" src="'+__ctxPath+'/images/default_newsIcon.jpg" border="0"/>');
Ext.getCmp('NewsGrid').getStore().reload();
}
});
}else{
subjectIcon.setValue('');
//这里改为默认图标
Ext.getCmp('displayAtForm').body.update('<img style="border:0;" width="48" height="48" src="'+__ctxPath+'/images/default_newsIcon.jpg" border="0"/>');
}
}
});
}
});
}// end if
else{
Ext.Msg.alert('提示信息','您还未增加图标.');
}
}
}]
},{
fieldLabel : '内容',
name : 'news.content',
id : 'content',
xtype:'htmleditor',
allowBlank : false,
width:400,
height:300
}
]
});
if (this.newsId != null && this.newsId != 'undefined') {
formPanel.getForm().load({
deferredRender : false,
url : __ctxPath + '/info/getNews.do?newsId=' + this.newsId,
waitMsg : '正在载入数据...',
success : function(form, action) {
var typeId = Ext.getCmp('typeId');
var typeTree = Ext.getCmp('typeTree');
var treeNode = typeTree.getNodeById(typeId.value);
var newsTypeSelect = Ext.getCmp('newsTypeSelect');
newsTypeSelect.setValue(treeNode.text);
//载入成功后载入图片
var display = Ext.getCmp('displayAtForm');
var sub = Ext.getCmp('subjectIcon');
if(sub.value!=''){
display.body.update('<img style="border:0;" width="48" height="48" src="'+__ctxPath+'/attachFiles/'+sub.value+'" border="0"/>');
}
// Ext.Msg.alert('编辑', '载入成功!');
},
failure : function(form, action) {
// Ext.Msg.alert('编辑', '载入失败');
}
});
}
return formPanel;
};
/**
* 上传新闻图标回调函数
* @param {} data
*/
function uploadImage(data){
var display = Ext.getCmp('displayAtForm');
var sub = Ext.getCmp('subjectIcon');
sub.setValue(data[0].filepath);
display.body.update('<img style="border:0;" width="48" height="48" src="'+__ctxPath+'/attachFiles/'+data[0].filepath+'" border="0"/>');
}
| JavaScript |
var WorkPlanForm = function(planId) {
this.planId = planId;
var fp = this.setup();
var window = new Ext.Window({
id : 'WorkPlanFormWin',
title : '工作计划详细信息',
width : 560,
height : 580,
modal : true,
layout : 'anchor',
plain : true,
bodyStyle : 'padding:5px;',
buttonAlign : 'center',
items : [this.setup()],
buttons : [{
text : '保存',
iconCls : 'btn-save',
handler : function() {
var fp = Ext.getCmp('WorkPlanForm');
if (fp.getForm().isValid()) {
fp.getForm().submit({
method : 'post',
waitMsg : '正在提交数据...',
success : function(fp, action) {
Ext.Msg.alert('操作信息', '成功保存信息!');
Ext.getCmp('WorkPlanGrid').getStore().reload();
window.close();
},
failure : function(fp, action) {
Ext.MessageBox.show({
title : '操作信息',
msg : '信息保存出错,请联系管理员!',
buttons : Ext.MessageBox.OK,
icon : 'ext-mb-error'
});
window.close();
}
});
}
}
}, {
text : '取消',
iconCls : 'btn-cancel',
handler : function() {
window.close();
}
}]
});
window.show();
};
WorkPlanForm.prototype.setup = function() {
var formPanel = new Ext.FormPanel({
url : __ctxPath + '/task/saveWorkPlan.do',
layout : 'form',
id : 'WorkPlanForm',
frame : true,
defaults : {
width : 400,
anchor : '98%,98%'
},
formId : 'WorkPlanFormId',
defaultType : 'textfield',
items : [{
name : 'workPlan.planId',
id : 'planId',
xtype : 'hidden',
value : this.planId == null ? '' : this.planId
}, {
fieldLabel : '计划名称',
name : 'workPlan.planName',
id : 'planName'
}, {
fieldLabel : '计划内容',
name : 'workPlan.planContent',
xtype:'htmleditor',
height:150,
id : 'planContent'
},
{
xtype:'container',
height:26,
layout:'column',
style:'padding-left:0px;',
defaultType:'label',
items:[{
text : '时间范围:',
width:101,
style:'padding-left:0px;padding-top:3px;'
},{
text : '从',
style:'padding-left:0px;padding-top:3px;'
},{
xtype:'datefield',
width: 149,
format:'Y-m-d',
readOnly:true,
name : 'workPlan.startTime',
id : 'startTime'
},{
text : '至',
style:'padding-left:0px;padding-top:3px;'
},{
xtype:'datefield',
width: 149,
format:'Y-m-d',
readOnly:true,
name : 'workPlan.endTime',
id : 'endTime'
}]
},{
fieldLabel : '计划类型',
name : 'workPlan.planType',
xtype:'combo',
editable : false,
triggerAction : 'all',
id : 'typeId',
store : new Ext.data.SimpleStore({
autoLoad : true,
url : __ctxPath
+ '/task/comboPlanType.do',
fields : ['typeId', 'typeName']
}),
displayField : 'typeName',
valueField : 'typeId'
}, {
fieldLabel : '发布范围',
name : 'workPlan.issueScope',
id : 'issueScope'
}, {
fieldLabel : '参与人',
name : 'workPlan.participants',
id : 'participants'
}, {
fieldLabel : '负责人',
name : 'workPlan.principal',
id : 'principal'
}, {
fieldLabel : '备注',
name : 'workPlan.note',
xtype:'textarea',
id : 'note'
},{
xtype:'radiogroup',
fieldLabel : '是否启用',
autoHeight: true,
columns :2,
items : [{
boxLabel : '是',
name : 'workPlan.status',
inputValue : 1,
id:'status1',
checked : true
},{
boxLabel : '否',
name : 'workPlan.status',
inputValue : 0,
id:'status0'
}]
},{
xtype:'radiogroup',
fieldLabel : '是否为个人计划',
autoHeight: true,
columns :2,
items : [{
boxLabel : '个人',
name : 'workPlan.isPersonal',
inputValue : 0,
id:'isPersonal0',
checked : true
},{
boxLabel : '部门',
name : 'workPlan.isPersonal',
inputValue : 1,
id:'isPersonal1'
}]
}, {
fieldLabel : '图标',
name : 'workPlan.icon',
id : 'icon'
}
]
});
if (this.planId != null && this.planId != 'undefined') {
formPanel.getForm().load({
deferredRender : false,
url : __ctxPath + '/task/getWorkPlan.do?planId='
+ this.planId,
waitMsg : '正在载入数据...',
success : function(form, action) {
// Ext.Msg.alert('编辑', '载入成功!');
},
failure : function(form, action) {
// Ext.Msg.alert('编辑', '载入失败');
}
});
}
return formPanel;
};
| JavaScript |
/**
* 日程管理详情
*/
var CalendarPlanDetail = function(id){
var win = new Ext.Window({
title : '日程管理详情',
autoHeight :true,
//autoWidth :true,
width : 500,
buttonAlign : 'center',
autoLoad : {url:__ctxPath+'/pages/task/calendarplandetail.jsp?planId='+id},
buttons: [{
text : '关闭',
handler : function(){
win.close();
}
}]
});
win.show();
} | JavaScript |
Ext.ns('WorkPlanView');
/**
* 工作计划列表
*/
var WorkPlanView = function() {
return new Ext.Panel({
id : 'WorkPlanView',
title : '工作计划列表',
autoScroll : true,
items : [new Ext.FormPanel({
height : 35,
frame : true,
id : 'WorkPlanSearchForm',
layout : 'column',
defaults : {
xtype : 'label'
},
items : [{
text : '请输入查询条件:'
}, {
text : '计划名称'
}, {
xtype : 'textfield',
name : 'Q_planName_S_LK'
}, {
text : '计划内容'
}, {
xtype : 'textfield',
name : 'Q_planContent_S_LK'
}, {
text : '开始日期'
}, {
xtype : 'textfield',
name : 'Q_startTime_S_LK'
}, {
text : '结束日期'
}, {
xtype : 'textfield',
name : 'Q_endTime_S_LK'
}, {
text : '计划类型'
}, {
xtype : 'textfield',
name : 'Q_typeId_S_LK'
}, {
text : '员工ID'
}, {
xtype : 'textfield',
name : 'Q_userId_S_LK'
}, {
text : '发布范围'
}, {
xtype : 'textfield',
name : 'Q_issueScope_S_LK'
}, {
text : '参与人'
}, {
xtype : 'textfield',
name : 'Q_participants_S_LK'
}, {
text : '负责人'
}, {
xtype : 'textfield',
name : 'Q_principal_S_LK'
}, {
text : '备注'
}, {
xtype : 'textfield',
name : 'Q_note_S_LK'
}, {
text : '状态'
}, {
xtype : 'textfield',
name : 'Q_status_S_LK'
}, {
text : '是否为个人计划'
}, {
xtype : 'textfield',
name : 'Q_isPersonal_S_LK'
}, {
text : '图标'
}, {
xtype : 'textfield',
name : 'Q_icon_S_LK'
}, {
xtype : 'button',
text : '查询',
iconCls : 'search',
handler : function() {
var searchPanel = Ext.getCmp('WorkPlanSearchForm');
var grid = Ext.getCmp('WorkPlanGrid');
if (searchPanel.getForm().isValid()) {
searchPanel.getForm().submit({
waitMsg : '正在提交查询',
url : __ctxPath + '/task/listWorkPlan.do',
success : function(formPanel, action) {
var result = Ext.util.JSON
.decode(action.response.responseText);
grid.getStore().loadData(result);
}
});
}
}
}]
}), this.setup()]
});
};
/**
* 建立视图
*/
WorkPlanView.prototype.setup = function() {
return this.grid();
};
/**
* 建立DataGrid
*/
WorkPlanView.prototype.grid = function() {
var sm = new Ext.grid.CheckboxSelectionModel();
var cm = new Ext.grid.ColumnModel({
columns : [sm, new Ext.grid.RowNumberer(), {
header : 'planId',
dataIndex : 'planId',
hidden : true
}, {
header : '计划名称',
dataIndex : 'planName'
}, {
header : '开始日期',
dataIndex : 'startTime'
}, {
header : '结束日期',
dataIndex : 'endTime'
}, {
header : '计划类型',
dataIndex : 'typeId'
}, {
header : '员工ID',
dataIndex : 'userId'
}, {
header : '发布范围',
dataIndex : 'issueScope'
}, {
header : '负责人',
dataIndex : 'principal'
},{
header : '状态',
dataIndex : 'status'
}, {
header : '是否为个人计划',
dataIndex : 'isPersonal'
}, {
header : '图标',
dataIndex : 'icon'
}, {
header : '管理',
dataIndex : 'planId',
width : 50,
sortable : false,
renderer : function(value, metadata, record, rowIndex,
colIndex) {
var editId = record.data.planId;
var str = '<input type="button" title="删除" value=" " class="btn-del" onclick="WorkPlanView.remove('
+ editId + ')"/>';
str += ' <input type="button" title="编辑" value=" " class="btn-edit" onclick="WorkPlanView.edit('
+ editId + ')"/>';
return str;
}
}],
defaults : {
sortable : true,
menuDisabled : false,
width : 100
}
});
var store = this.store();
store.load({
params : {
start : 0,
limit : 25
}
});
var grid = new Ext.grid.GridPanel({
id : 'WorkPlanGrid',
tbar : this.topbar(),
store : store,
trackMouseOver : true,
disableSelection : false,
loadMask : true,
autoHeight : true,
cm : cm,
sm : sm,
viewConfig : {
forceFit : true,
enableRowBody : false,
showPreview : false
},
bbar : new Ext.PagingToolbar({
pageSize : 25,
store : store,
displayInfo : true,
displayMsg : '当前显示从{0}至{1}, 共{2}条记录',
emptyMsg : "当前没有记录"
})
});
grid.addListener('rowdblclick', function(grid, rowindex, e) {
grid.getSelectionModel().each(function(rec) {
WorkPlanView.edit(rec.data.planId);
});
});
return grid;
};
/**
* 初始化数据
*/
WorkPlanView.prototype.store = function() {
var store = new Ext.data.Store({
proxy : new Ext.data.HttpProxy({
url : __ctxPath + '/task/listWorkPlan.do'
}),
reader : new Ext.data.JsonReader({
root : 'result',
totalProperty : 'totalCounts',
id : 'id',
fields : [{
name : 'planId',
type : 'int'
}
, 'planName', 'planContent', 'startTime',
'endTime', 'typeId', 'userId',
'issueScope', 'participants', 'principal',
'note', 'status', 'isPersonal', 'icon']
}),
remoteSort : true
});
store.setDefaultSort('planId', 'desc');
return store;
};
/**
* 建立操作的Toolbar
*/
WorkPlanView.prototype.topbar = function() {
var toolbar = new Ext.Toolbar({
id : 'WorkPlanFootBar',
height : 30,
bodyStyle : 'text-align:left',
items : [{
iconCls : 'btn-add',
text : '添加工作计划',
xtype : 'button',
handler : function() {
new WorkPlanForm();
}
}, {
iconCls : 'btn-del',
text : '删除工作计划',
xtype : 'button',
handler : function() {
var grid = Ext.getCmp("WorkPlanGrid");
var selectRecords = grid.getSelectionModel()
.getSelections();
if (selectRecords.length == 0) {
Ext.Msg.alert("信息", "请选择要删除的记录!");
return;
}
var ids = Array();
for (var i = 0; i < selectRecords.length; i++) {
ids.push(selectRecords[i].data.planId);
}
WorkPlanView.remove(ids);
}
}]
});
return toolbar;
};
/**
* 删除单个记录
*/
WorkPlanView.remove = function(id) {
var grid = Ext.getCmp("WorkPlanGrid");
Ext.Msg.confirm('信息确认', '您确认要删除该记录吗?', function(btn) {
if (btn == 'yes') {
Ext.Ajax.request({
url : __ctxPath + '/task/multiDelWorkPlan.do',
params : {
ids : id
},
method : 'post',
success : function() {
Ext.Msg.alert("信息提示", "成功删除所选记录!");
grid.getStore().reload({
params : {
start : 0,
limit : 25
}
});
}
});
}
});
};
/**
*
*/
WorkPlanView.edit = function(id) {
new WorkPlanForm(id);
}
| JavaScript |
Ext.ns('CalendarPlanView');
/**
* 日程列表
*/
var CalendarPlanView = function() {
return new Ext.Panel({
id : 'CalendarPlanView',
iconCls:'menu-cal-plan-view',
title : '日程列表',
autoScroll : true,
items : [new Ext.FormPanel({
frame : true,
id : 'CalendarPlanSearchForm',
bodyStyle:'padding:5px',
defaults:{height:60},
items: [{
layout:'column',
border:false,
items:[
{
columnWidth:.325,
layout: 'form',
border:false,
items: [{
xtype:'datetimefield',
fieldLabel: '开始时间',
name: 'Q_startTime_D_GT',
format: 'Y-m-d H:i:s',
anchor:'95%'
}, {
xtype:'textfield',
fieldLabel: '内容',
name: 'Q_content_S_LK',
anchor:'95%'
}]
},{
columnWidth:.325,
layout: 'form',
border:false,
items: [{
xtype:'datetimefield',
fieldLabel: '结束时间',
format: 'Y-m-d H:i:s',
name: 'Q_endTime_D_GT',
anchor:'95%'
}, {
xtype:'textfield',
fieldLabel: '分配人名',
name: 'Q_assignerName_S_LK',
anchor:'95%'
}]
},{
columnWidth:.2,
layout: 'form',
border:false,
items: [{
xtype : 'combo',
fieldLabel: '紧急程度',
triggerAction : 'all',
hiddenName : 'Q_urgent_SN_EQ',
editable : false,
store :[['0','一般'],['1','重要'],['2','紧急']],
anchor:'95%'
}, {
xtype : 'combo',
fieldLabel: '状态',
triggerAction : 'all',
hiddenName : 'Q_status_SN_EQ',
editable : false,
store :[['0','未完成 '],['1','完成']],
anchor:'95%'
}]
},{
columnWidth:.15,
items:[
{xtype : 'button',
text : '查询',
iconCls : 'search',
handler : function() {
var searchPanel = Ext.getCmp('CalendarPlanSearchForm');
var grid = Ext.getCmp('CalendarPlanGrid');
if (searchPanel.getForm().isValid()) {
searchPanel.getForm().submit({
waitMsg : '正在提交查询',
url : __ctxPath + '/task/listCalendarPlan.do',
success : function(formPanel, action) {
var result = Ext.util.JSON.decode(action.response.responseText);
grid.getStore().loadData(result);
}
});
}
}
},{
xtype:'button',
text:'重置',
iconCls:'btn-reset',
handler:function(){
var searchPanel = Ext.getCmp('CalendarPlanSearchForm');
searchPanel.getForm().reset();
}
}
]
}]
}]
}), this.setup()]
});
};
/**
* 建立视图
*/
CalendarPlanView.prototype.setup = function() {
return this.grid();
};
/**
* 建立DataGrid
*/
CalendarPlanView.prototype.grid = function() {
var sm = new Ext.grid.CheckboxSelectionModel();
var cm = new Ext.grid.ColumnModel({
columns : [sm, new Ext.grid.RowNumberer(), {
header : 'planId',
dataIndex : 'planId',
hidden : true
}, {
header : '开始时间',
width:120,
dataIndex : 'startTime'
}, {
header : '结束时间',
width:120,
dataIndex : 'endTime'
}, {
header : '紧急程度',
width:60,
dataIndex : 'urgent',
renderer:function(value){
if(value==0){
return "一般";
}else if(value==1){
return "重要";
}else{
return "紧急";
}
}
}, {
width:250,
header : '内容',
dataIndex : 'content',
renderer:function(value, metadata, record){
var status=record.data.status;
if(status==1){
return '<font style="text-decoration:line-through;color:red;">' + value + '</font>';
}else{
return value;
}
}
}, {
header : '状态',
width: 50,
dataIndex : 'status',
renderer:function(value){
if(value==1){
return "完成";
}else{
return "未完成";
}
}
}, {
header : '员工名',
width:60,
dataIndex : 'fullname'
}, {
header : '分配人',
width:60,
dataIndex : 'assignerName'
}, {
header : '任务类型',
width:60,
dataIndex : 'taskType',
renderer:function(value){
if(value==1){
return "限期任务";
}else{
return "非限期任务";
}
}
}, {
header : '管理',
dataIndex : 'planId',
width : 60,
sortable : false,
renderer : function(value, metadata, record, rowIndex,
colIndex) {
var editId = record.data.planId;
var str = '<button title="删除" value=" " class="btn-del" onclick="CalendarPlanView.remove('+ editId + ')"></button>';
str += ' <button title="编辑" value=" " class="btn-edit" onclick="CalendarPlanView.edit('+ editId + ')"></button>';
str+=' <button title="完成任务" value="" class="btn-task" onclick="CalendarPlanView.finished('+ editId + ')"></button>';
return str;
}
}],
defaults : {
sortable : true,
menuDisabled : false,
width : 100
}
});
var store = this.store();
store.load({
params : {
start : 0,
limit : 25
}
});
var grid = new Ext.grid.GridPanel({
id : 'CalendarPlanGrid',
tbar : this.topbar(),
store : store,
trackMouseOver : true,
disableSelection : false,
loadMask : true,
autoHeight : true,
cm : cm,
sm : sm,
viewConfig : {
forceFit : true,
enableRowBody : false,
showPreview : false
},
bbar : new Ext.PagingToolbar({
pageSize : 25,
store : store,
displayInfo : true,
displayMsg : '当前显示从{0}至{1}, 共{2}条记录',
emptyMsg : "当前没有记录"
})
});
grid.addListener('rowdblclick', function(grid, rowindex, e) {
grid.getSelectionModel().each(function(rec) {
CalendarPlanView.edit(rec.data.planId);
});
});
return grid;
};
/**
* 初始化数据
*/
CalendarPlanView.prototype.store = function() {
var store = new Ext.data.Store({
proxy : new Ext.data.HttpProxy({
url : __ctxPath + '/task/listCalendarPlan.do'
}),
reader : new Ext.data.JsonReader({
root : 'result',
totalProperty : 'totalCounts',
id : 'id',
fields : [{
name : 'planId',
type : 'int'
}
, 'startTime', 'endTime', 'urgent', 'content',
'status', 'userId', 'fullname', 'assignerId',
'assignerName', 'feedback', 'showStyle', 'taskType']
}),
remoteSort : true
});
store.setDefaultSort('planId', 'desc');
return store;
};
/**
* 建立操作的Toolbar
*/
CalendarPlanView.prototype.topbar = function() {
var toolbar = new Ext.Toolbar({
id : 'CalendarPlanFootBar',
height : 30,
bodyStyle : 'text-align:left',
items : [{
iconCls : 'btn-add',
text : '添加日程',
xtype : 'button',
handler : function() {
new CalendarPlanForm();
}
}, {
iconCls : 'btn-del',
text : '删除日程',
xtype : 'button',
handler : function() {
var grid = Ext.getCmp("CalendarPlanGrid");
var selectRecords = grid.getSelectionModel()
.getSelections();
if (selectRecords.length == 0) {
Ext.Msg.alert("信息", "请选择要删除的记录!");
return;
}
var ids = Array();
for (var i = 0; i < selectRecords.length; i++) {
ids.push(selectRecords[i].data.planId);
}
CalendarPlanView.remove(ids);
}
}]
});
return toolbar;
};
/**
* 删除单个记录
*/
CalendarPlanView.remove = function(id) {
var grid = Ext.getCmp("CalendarPlanGrid");
Ext.Msg.confirm('信息确认', '您确认要删除该记录吗?', function(btn) {
if (btn == 'yes') {
Ext.Ajax.request({
url : __ctxPath
+ '/task/multiDelCalendarPlan.do',
params : {
ids : id
},
method : 'post',
success : function() {
Ext.Msg.alert("信息提示", "成功删除所选记录!");
grid.getStore().reload({
params : {
start : 0,
limit : 25
}
});
}
});
}
});
};
/**
*
*/
CalendarPlanView.edit = function(id) {
new CalendarPlanForm(id);
}
/**
* 完成任务,填写反馈意见
* @param {} id
*/
CalendarPlanView.finished=function(id){
new CalendarPlanFinishForm(id);
}
| JavaScript |
/**
* 我的约会详情
*/
var AppointmentDetail = function(id){
var win = new Ext.Window({
title : '我的约会详情',
autoHeight :true,
//autoWidth :true,
width : 500,
buttonAlign : 'center',
autoLoad : {url:__ctxPath+'/pages/task/appointmentdetail.jsp?appointId='+id},
buttons: [{
text : '关闭',
handler : function(){
win.close();
}
}]
});
win.show();
} | JavaScript |
Ext.ns('AppointmentView');
/**
* 约会列表
*/
var AppointmentView = function() {
return new Ext.Panel({
id : 'AppointmentView',
title : '约会列表',
iconCls:'menu-appointment',
autoScroll : true,
items : [new Ext.FormPanel({
id : 'AppointmentSearchForm',
bodyStyle:'padding:2px',
frame:true,
defaults:{height:60},
items: [{
layout:'column',
border:false,
items:[
{
columnWidth:.325,
layout: 'form',
border:false,
items: [{
xtype:'datetimefield',
fieldLabel: '开始时间',
name: 'Q_startTime_D_GT',
format: 'Y-m-d H:i:s',
anchor:'95%'
}, {
xtype : 'datetimefield',
fieldLabel: '结束时间',
name : 'Q_endTime_D_LT',
format: 'Y-m-d H:i:s',
anchor:'95%'
}]
},//end of one column
{
columnWidth:.325,
layout: 'form',
border:false,
items:[
{
xtype : 'textfield',
name : 'Q_subject_S_LK',
fieldLabel:'标题',
anchor:'95%'
},{
xtype : 'textfield',
name : 'Q_content_S_LK',
fieldLabel:'内容',
anchor:'95%'
}
]
},{
border:false,
columnWidth:.15,
items:[
{xtype : 'button',
text : '查询',
iconCls : 'search',
handler : function() {
var searchPanel = Ext.getCmp('AppointmentSearchForm');
var grid = Ext.getCmp('AppointmentGrid');
if (searchPanel.getForm().isValid()) {
searchPanel.getForm().submit({
waitMsg : '正在提交查询', url : __ctxPath + '/task/listAppointment.do',
success : function(formPanel, action) {
var result = Ext.util.JSON.decode(action.response.responseText);
grid.getStore().loadData(result);
}
});
}
}
},{
xtype:'button',
text:'重置',
iconCls:'btn-reset',
handler:function(){
var searchPanel = Ext.getCmp('CalendarPlanSearchForm');
searchPanel.getForm().reset();
}
}
]
}
]
}]
}), this.setup()]
});
};
/**
* 建立视图
*/
AppointmentView.prototype.setup = function() {
return this.grid();
};
/**
* 建立DataGrid
*/
AppointmentView.prototype.grid = function() {
var sm = new Ext.grid.CheckboxSelectionModel();
var cm = new Ext.grid.ColumnModel({
columns : [sm, new Ext.grid.RowNumberer(), {
header : 'appointId',
dataIndex : 'appointId',
hidden : true
}, {
header : '主题',
dataIndex : 'subject'
}, {
header : '开始时间',
dataIndex : 'startTime'
}, {
header : '结束时间',
dataIndex : 'endTime'
}, {
header : '地点',
dataIndex : 'location'
},{
header : '管理',
dataIndex : 'appointId',
width : 50,
sortable : false,
renderer : function(value, metadata, record, rowIndex,
colIndex) {
var editId = record.data.appointId;
var str = '<button title="删除" value=" " class="btn-del" onclick="AppointmentView.remove('
+ editId + ')"> </button>';
str += ' <button title="编辑" value=" " class="btn-edit" onclick="AppointmentView.edit('
+ editId + ')"> </button>';
return str;
}
}],
defaults : {
sortable : true,
menuDisabled : false,
width : 100
}
});
var store = this.store();
store.load({
params : {
start : 0,
limit : 25
}
});
var grid = new Ext.grid.GridPanel({
id : 'AppointmentGrid',
tbar : this.topbar(),
store : store,
trackMouseOver : true,
disableSelection : false,
loadMask : true,
autoHeight : true,
cm : cm,
sm : sm,
viewConfig : {
forceFit : true,
enableRowBody : false,
showPreview : false
},
bbar : new Ext.PagingToolbar({
pageSize : 25,
store : store,
displayInfo : true,
displayMsg : '当前显示从{0}至{1}, 共{2}条记录',
emptyMsg : "当前没有记录"
})
});
grid.addListener('rowdblclick', function(grid, rowindex, e) {
grid.getSelectionModel().each(function(rec) {
AppointmentView.edit(rec.data.appointId);
});
});
return grid;
};
/**
* 初始化数据
*/
AppointmentView.prototype.store = function() {
var store = new Ext.data.Store({
proxy : new Ext.data.HttpProxy({
url : __ctxPath + '/task/listAppointment.do'
}),
reader : new Ext.data.JsonReader({
root : 'result',
totalProperty : 'totalCounts',
id : 'id',
fields : [{
name : 'appointId',
type : 'int'
}
, 'userId', 'subject', 'startTime',
'endTime', 'content', 'notes', 'location',
'inviteEmails']
}),
remoteSort : true
});
store.setDefaultSort('appointId', 'desc');
return store;
};
/**
* 建立操作的Toolbar
*/
AppointmentView.prototype.topbar = function() {
var toolbar = new Ext.Toolbar({
id : 'AppointmentFootBar',
height : 30,
bodyStyle : 'text-align:left',
items : [{
iconCls : 'btn-add',
text : '添加约会',
xtype : 'button',
handler : function() {
new AppointmentForm();
}
}, {
iconCls : 'btn-del',
text : '删除约会',
xtype : 'button',
handler : function() {
var grid = Ext.getCmp("AppointmentGrid");
var selectRecords = grid.getSelectionModel()
.getSelections();
if (selectRecords.length == 0) {
Ext.Msg.alert("信息", "请选择要删除的记录!");
return;
}
var ids = Array();
for (var i = 0; i < selectRecords.length; i++) {
ids.push(selectRecords[i].data.appointId);
}
AppointmentView.remove(ids);
}
}]
});
return toolbar;
};
/**
* 删除单个记录
*/
AppointmentView.remove = function(id) {
var grid = Ext.getCmp("AppointmentGrid");
Ext.Msg.confirm('信息确认', '您确认要删除该记录吗?', function(btn) {
if (btn == 'yes') {
Ext.Ajax.request({
url : __ctxPath
+ '/task/multiDelAppointment.do',
params : {
ids : id
},
method : 'post',
success : function() {
Ext.Msg.alert("信息提示", "成功删除所选记录!");
grid.getStore().reload({
params : {
start : 0,
limit : 25
}
});
}
});
}
});
};
/**
*
*/
AppointmentView.edit = function(id) {
new AppointmentForm(id);
}
| JavaScript |
Ext.ns('PlanTypeView');
/**
* 计划类型列表
*/
var PlanTypeView = function() {
return new Ext.Panel({
id : 'PlanTypeView',
title : '计划类型列表',
autoScroll : true,
items : [new Ext.FormPanel({
height : 35,
frame : true,
id : 'PlanTypeSearchForm',
layout : 'column',
defaults : {
xtype : 'label'
},
items : [{
text : '请输入查询条件:'
}, {
text : ''
}, {
xtype : 'textfield',
name : 'Q_typeName_S_LK'
}, {
xtype : 'button',
text : '查询',
iconCls : 'search',
handler : function() {
var searchPanel = Ext.getCmp('PlanTypeSearchForm');
var grid = Ext.getCmp('PlanTypeGrid');
if (searchPanel.getForm().isValid()) {
searchPanel.getForm().submit({
waitMsg : '正在提交查询',
url : __ctxPath + '/task/listPlanType.do',
success : function(formPanel, action) {
var result = Ext.util.JSON
.decode(action.response.responseText);
grid.getStore().loadData(result);
}
});
}
}
}]
}), this.setup()]
});
};
/**
* 建立视图
*/
PlanTypeView.prototype.setup = function() {
return this.grid();
};
/**
* 建立DataGrid
*/
PlanTypeView.prototype.grid = function() {
var sm = new Ext.grid.CheckboxSelectionModel();
var cm = new Ext.grid.ColumnModel({
columns : [sm, new Ext.grid.RowNumberer(), {
header : 'typeId',
dataIndex : 'typeId',
hidden : true
}, {
header : '类型名称',
dataIndex : 'typeName'
}, {
header : '管理',
dataIndex : 'typeId',
width : 50,
sortable : false,
renderer : function(value, metadata, record, rowIndex,
colIndex) {
var editId = record.data.typeId;
var str = '<button title="删除" value=" " class="btn-del" onclick="PlanTypeView.remove('
+ editId + ')"></button>';
str += ' <button title="编辑" value=" " class="btn-edit" onclick="PlanTypeView.edit('
+ editId + ')"></button>';
return str;
}
}],
defaults : {
sortable : true,
menuDisabled : false,
width : 100
}
});
var store = this.store();
store.load({
params : {
start : 0,
limit : 25
}
});
var grid = new Ext.grid.GridPanel({
id : 'PlanTypeGrid',
tbar : this.topbar(),
store : store,
trackMouseOver : true,
disableSelection : false,
loadMask : true,
autoHeight : true,
cm : cm,
sm : sm,
viewConfig : {
forceFit : true,
enableRowBody : false,
showPreview : false
},
bbar : new Ext.PagingToolbar({
pageSize : 25,
store : store,
displayInfo : true,
displayMsg : '当前显示从{0}至{1}, 共{2}条记录',
emptyMsg : "当前没有记录"
})
});
grid.addListener('rowdblclick', function(grid, rowindex, e) {
grid.getSelectionModel().each(function(rec) {
PlanTypeView.edit(rec.data.typeId);
});
});
return grid;
};
/**
* 初始化数据
*/
PlanTypeView.prototype.store = function() {
var store = new Ext.data.Store({
proxy : new Ext.data.HttpProxy({
url : __ctxPath + '/task/listPlanType.do'
}),
reader : new Ext.data.JsonReader({
root : 'result',
totalProperty : 'totalCounts',
id : 'id',
fields : [{
name : 'typeId',
type : 'int'
}
, 'typeName']
}),
remoteSort : true
});
store.setDefaultSort('typeId', 'desc');
return store;
};
/**
* 建立操作的Toolbar
*/
PlanTypeView.prototype.topbar = function() {
var toolbar = new Ext.Toolbar({
id : 'PlanTypeFootBar',
height : 30,
bodyStyle : 'text-align:left',
items : [{
iconCls : 'btn-add',
text : '添加计划类型',
xtype : 'button',
handler : function() {
new PlanTypeForm();
}
}, {
iconCls : 'btn-del',
text : '删除计划类型',
xtype : 'button',
handler : function() {
var grid = Ext.getCmp("PlanTypeGrid");
var selectRecords = grid.getSelectionModel()
.getSelections();
if (selectRecords.length == 0) {
Ext.Msg.alert("信息", "请选择要删除的记录!");
return;
}
var ids = Array();
for (var i = 0; i < selectRecords.length; i++) {
ids.push(selectRecords[i].data.typeId);
}
PlanTypeView.remove(ids);
}
}]
});
return toolbar;
};
/**
* 删除单个记录
*/
PlanTypeView.remove = function(id) {
var grid = Ext.getCmp("PlanTypeGrid");
Ext.Msg.confirm('信息确认', '您确认要删除该记录吗?', function(btn) {
if (btn == 'yes') {
Ext.Ajax.request({
url : __ctxPath + '/task/multiDelPlanType.do',
params : {
ids : id
},
method : 'post',
success : function() {
Ext.Msg.alert("信息提示", "成功删除所选记录!");
grid.getStore().reload({
params : {
start : 0,
limit : 25
}
});
}
});
}
});
};
/**
*
*/
PlanTypeView.edit = function(id) {
new PlanTypeForm(id);
}
| JavaScript |
var PlanTypeForm = function(typeId) {
this.typeId = typeId;
var fp = this.setup();
var window = new Ext.Window({
id : 'PlanTypeFormWin',
title : '计划类型详细信息',
width : 400,
height : 120,
modal : true,
layout : 'anchor',
plain : true,
bodyStyle : 'padding:5px;',
buttonAlign : 'center',
items : [this.setup()],
buttons : [{
text : '保存',
iconCls : 'btn-save',
handler : function() {
var fp = Ext.getCmp('PlanTypeForm');
if (fp.getForm().isValid()) {
fp.getForm().submit({
method : 'post',
waitMsg : '正在提交数据...',
success : function(fp, action) {
Ext.Msg.alert('操作信息', '成功保存信息!');
Ext.getCmp('PlanTypeGrid').getStore()
.reload();
window.close();
},
failure : function(fp, action) {
Ext.MessageBox.show({
title : '操作信息',
msg : '信息保存出错,请联系管理员!',
buttons : Ext.MessageBox.OK,
icon : 'ext-mb-error'
});
window.close();
}
});
}
}
}, {
text : '取消',
iconCls : 'btn-cancel',
handler : function() {
window.close();
}
}]
});
window.show();
};
PlanTypeForm.prototype.setup = function() {
var formPanel = new Ext.FormPanel({
url : __ctxPath + '/task/savePlanType.do',
layout : 'form',
id : 'PlanTypeForm',
frame : true,
defaults : {
width : 400,
anchor : '98%,98%'
},
formId : 'PlanTypeFormId',
defaultType : 'textfield',
items : [{
name : 'planType.typeId',
id : 'typeId',
xtype : 'hidden',
value : this.typeId == null ? '' : this.typeId
}, {
fieldLabel : '类型名称',
name : 'planType.typeName',
id : 'typeName'
}
]
});
if (this.typeId != null && this.typeId != 'undefined') {
formPanel.getForm().load({
deferredRender : false,
url : __ctxPath + '/task/getPlanType.do?typeId='
+ this.typeId,
waitMsg : '正在载入数据...',
success : function(form, action) {
// Ext.Msg.alert('编辑', '载入成功!');
},
failure : function(form, action) {
// Ext.Msg.alert('编辑', '载入失败');
}
});
}
return formPanel;
};
| JavaScript |
var MyPlanTaskView=function(){
Ext.QuickTips.init();
return my_calendar();
};
function updateStoreincalendar(){
var viewx = prueba.currentView;
if (viewx=='month'){
var mynewmonth= parseInt(prueba.currentdate.format('m'));
var mymonthday=prueba.currentdate.format('m/d/Y');
calendarStore.baseParams={action:'month',displaymonth:mynewmonth,monthday:mymonthday};
calendarStore.reload();
}else if (viewx=='day'){
var mynewdate= prueba.currentdate.format('m/d/Y');
calendarStore.baseParams={action:'day',day:mynewdate};
calendarStore.reload();
} else if (viewx=='week'){
var mynewdate= parseInt(prueba.currentdate.format('W'));
var myrange = prueba.getDateRangeOfWeek(mynewdate);
calendarStore.baseParams={
action:'week',
weeknumber:mynewdate,
startweek:myrange[0].format('m/d/Y'),
endweek:myrange[1].format('m/d/Y')
};
calendarStore.reload();
} else if (viewx=='schedule'){
// e2cs.schedviews.subView ={ Day: 0, Week: 1, Month: 2, TwoMonths: 3, Quarter: 4};
if (prueba.viewscheduler.listbody.periodType==0){ // day
var mynewdate= prueba.currentdate.format('m/d/Y');
calendarStore.baseParams={action:'day',day:mynewdate};
calendarStore.reload();
} else if (prueba.viewscheduler.listbody.periodType==1){ //week
var mynewdate= parseInt(prueba.currentdate.format('W'));
var myrange = prueba.getDateRangeOfWeek(mynewdate);
calendarStore.baseParams={
action:'week',
weeknumber:mynewdate,
startweek:myrange[0].format('m/d/Y'),
endweek:myrange[1].format('m/d/Y')
};
calendarStore.reload();
} else if (prueba.viewscheduler.listbody.periodType==2){ //month
var mynewmonth= parseInt(prueba.currentdate.format('m'));
var mymonthday=prueba.currentdate.format('m/d/Y');
calendarStore.baseParams={action:'month',displaymonth:mynewmonth,monthday:mymonthday};
calendarStore.reload();
} else if (prueba.viewscheduler.listbody.periodType==3){ // two months
var myrange = prueba.viewscheduler.getDatesforBimonth(prueba.currentdate);
calendarStore.baseParams={
action:'period',
start:myrange[0].format('m/d/Y'),
ends:myrange[1].format('m/d/Y')
};
calendarStore.reload();
} else if (prueba.viewscheduler.listbody.periodType==4){ // Quarter
var myrange = prueba.viewscheduler.getDatesforBimonth(prueba.currentdate);
calendarStore.baseParams={
action:'period',
start:myrange[0].format('m/d/Y'),
ends:myrange[1].format('m/d/Y')
};
calendarStore.reload();
}
}
}
function my_calendar(){
var buttonx1= new Ext.menu.Item({ id: 'buttonx1_task', iconCls:'x-calendar-month-btnmv_task', text: "Custom menu test 1" });
var buttonx2= new Ext.menu.Item({ id: 'buttonx2_task',iconCls:'x-calendar-month-btnmv_task', text: "Custom menu test 2" });
var buttonz1= new Ext.menu.Item({ id: 'buttonz1_task', iconCls:'x-calendar-month-btnmv_task', text: "Custom action 1" });
var buttonz2= new Ext.menu.Item({ id: 'buttonz2_task',iconCls:'x-calendar-month-btnmv_task', text: "Custom action 2" });
var boton_daytimertask = new Ext.menu.Item({ id: 'btnTimerTask', iconCls:'task_time', text: "Set Task Alarm...." });
var boton_daytimertaskb = new Ext.menu.Item({ id: 'btnTimerOff' , iconCls:'task_time_off', text: "Delete Task's Alarm...." });
var button_sched_1= new Ext.menu.Item({ id: 'buttonx1_task',iconCls:'x-calendar-month-btnmv_task',text: "Custom menu on sched test 1" });
var button_sched_2= new Ext.menu.Item({ id: 'buttonx2_task',iconCls:'x-calendar-month-btnmv_task',text: "Custom menu on sched test 2" });
var curDate=new Date();
calendarStore=new Ext.data.Store({
url:__ctxPath+'/task/myCalendarPlan.do',
baseParams:{ action:'all',action:'month',displaymonth:12,monthday:curDate.format('m/d/Y')},
reader: new Ext.data.JsonReader({
root:'records',id: 'id',totalProperty: 'totalCount'
},
[{name:'recid', mapping:'id', type: 'string'},{name:'subject', mapping:'subject', type: 'string'},
{name:'description', mapping:'description', type: 'string'},{name:'startdate', mapping:'startdate', type: 'string'},
{name:'enddate', mapping:'enddate', type: 'string'},{name:'color', mapping:'color', type: 'string'},
{name:'parent', mapping:'parent', type: 'int'},{name:'priority', mapping:'priority', type: 'int'}
]
)
});
prueba = new Ext.ECalendar({
id:'MyPlanTaskView',
name:'MyPlanTaskView',
title:'日程管理',
mytitle:'',
height:500,
fieldsRefer:{ //0.0.11
id:'recid',
subject:'subject',
description:'description',
color:'color',
startdate:'startdate',
enddate:'enddate',
priority:'priority',
parent:'parent',
html:'' //0.0.13 new property
},
storeOrderby:'priority', //0.0.11
storeOrder:'DESC', //0.0.11
showCal_tbar: true,
showRefreshbtn:true,
refreshAction:'data', //0.0.11
currentView: 'month',
currentdate: curDate,//new Date(),//TEST is for data new Date()
dateSelector: true,
dateSelectorIcon: __ctxPath+'/ext3/ux/caltask/images/date.png',
dateSelectorIconCls: 'x-cmscalendar-icon-date-selector',
dateformat :'d/m/Y',
header: true,
title: '我的日程管理',
mytitle: ' ',//001
iconCls: 'x-cmscalendar-icon-main',
dateSelector:true,
store: calendarStore,
monitorBrowserResize:true,
widgetsBind: {bindMonth:null,bindDay:null,binWeek:null},
tplTaskZoom: new Ext.XTemplate(
'<tpl for=".">',
'<div class="ecal-show-basetasktpl-div"><b>主题:</b>{subject}<br>',
'<b>开始:</b>{startdate}<br><b>结束:</b>{enddate}',
'<br><b>明细:</b><div><hr><div>{description}<div>',
'</tpl>'
),
iconToday:__ctxPath+'/ext3/ux/caltask/images/cms_calendar.png',
iconMonthView:__ctxPath+'/ext3/ux/caltask/images/calendar_view_month.png',
iconWeekView:__ctxPath+'/ext3/ux/caltask/images/calendar_view_week.png',
iconDayView:__ctxPath+'/ext3/ux/caltask/images/calendar_view_day.png',
iconSchedView:__ctxPath+'/ext3/ux/caltask/images/calendar_view_schedule.png', //0.0.10 // NEW :)
loadMask:true, //0.0.12
customMaskText:'系统信息<br>请稍等!<br>正在处理日程的信息', //0.0.12
//-------- NEW on 0.0.10 -------------------
sview:{
header: true, headerFormat:'Y-M',
headerButtons: true,
headerAction:'event', //gotoview
periodselector:false,
blankzonebg:'#6C90B4',
//sched_addevent_id
blankHTML:'<div id="{calx}-test-img" class="custom_image_addNewEvent_scheduler" style=" width:100%; background-color:#6C90B4"><div align="center" id="{sched_addevent_id}"><img src="'+__ctxPath+'/ext3/ux/caltask/images/no_events_default.jpg" width="174" height="143"></div><div class="custom_text_addNewEvent_scheduler">点击图片加日程任务</div></div>',
listItems: {
headerTitle:"日程任务",
periodFormats:{
Day: '星期l - d - F - Y',
DayScheduler_format: 'd',
hourFormat: 'h:i a',
startTime: '7:00:00 am',
endTime: '10:00:00 pm',
WeekTPL: '<tpl for=".">Week No.{numweek} Starting on {datestart} Ending on {dateend}</tpl>',
WeekFormat: 'W',
DatesFormat:'d/m/Y',
Month:'M-Y',
TwoMonthsTPL:'<tpl for=".">Period No.{numperiod} Starting on {datestart} Ending on {dateend}</tpl>',
QuarterTPL: '<tpl for=".">Period No.{numperiod} Starting on {datestart} Ending on {dateend}</tpl>'
},
useStoreColor:false,
descriptionWidth:246,
parentLists:false, //to expand collapse Parent Items if false all tasks shown as parent
launchEventOn:'click',
editableEvents:true, // If true a context menu will appear
ShowMenuItems:[1,1,1,1,1,1,1,1], // ADD, EDIT, DELETE, GO NEXT PERIOD , GO PREV PERIOD, Chg Month, Chg Week, CHG Day
taskdd_ShowMenuItems:[1,1,1], // ADD, EDIT, DELETE
moreMenuItems:[button_sched_1,button_sched_2],
taskdd_BaseColor:'#6C90B4',
taskdd_clsOver:'test_taskovercss_sched',
taskdd_showqtip:true,
taskdd_shownames:true
},
listbody:{
//e2cs.schedviews.subView ={ Day: 0, Week: 1, Month: 2, TwoMonths: 3, Quarter: 4};
//e2cs.schedviews.Units ={ Hours:0, Days: 1, Weeks: 2};
periodType:e2cs.schedviews.subView.Month,
headerUnit:e2cs.schedviews.Units.Days,
headerUnitWidth:25
}
},
//-------------------------------------------
mview:{
header: true,
headerFormat:'Y-F',
headerButtons: true,
dayAction:'viewday', //dayAction: //viewday , event, window
moreMenuItems:[buttonx1,buttonx2],
showTaskcount: false,
startDay:0,
taskStyle:'margin-top:2px;', //Css style for text in day(if it has tasks and showtaskcount:true)
showTaskList: true,
showNumTasks:10,
TaskList_launchEventOn:'click', //0.0.11
TaskList_tplqTip: new Ext.XTemplate( '<tpl for=".">{starxl}{startval}<br>{endxl}{endval}<hr color=\'#003366\' noshade>{details}</tpl>' ), //0.0.11
ShowMenuItems:[1,1,1,1,1,1], //0.0.11 - ADD, nextmonth, prevmonth, chg Week , CHG Day, chg Sched,
TaskList_moreMenuItems:[buttonz1,buttonz2], //0.0.11
TaskList_ShowMenuItems:[1,1,1]//0.0.11 - Add, DELETE, EDIT
},
wview:{
headerlabel:'周 #',
headerButtons: true,
dayformatLabel:'D j',
moreMenuItems:[buttonx1,buttonx2],
style: 'google',
alldayTaksMore:'window',
alldayTasksMaxView:6,
store: null,
task_width:25,
tasksOffset:40,
headerDayClick:'viewday',
ShowMenuItems:[1,1,1,1,1,1], //0.0.11 add, go next w , go prev w , chg month , chg day, chg sched
task_ShowMenuItems:[1,1,1,1,1], //0.0.11 add, delete, edit, go next w , go prev w
task_eventLaunch:'click', //0.0.11
startDay:0, //sundays 0.0.14
task_clsOver:'test_taskovercss',
forceTaskFit:true // 0.0.14
},
dview:{
header:true,
headerFormat:'星期l - d - F - Y',
headerButtons: true,
moreMenuItems:[],
// day specific
hourFormat: 'h',
startTime: '00:00:00 am',
endTime: '11:59:59 pm',
// task settings
store: null,
taskBaseColor: '#ffffff',
task_width:60,
taskAdd_dblclick: true, //added on 0.0.7
taskAdd_timer_dblclick:true, //0.0.11
useMultiColorTasks: false,
multiColorTasks:[],
tasks:[],
moreMenuItems:[buttonx1,buttonx2],
//moreMenuItems:[ boton_daytimertask, boton_daytimertaskb ],
task_clsOver:'test_taskovercss',
ShowMenuItems:[1,1,1,1,1,1], //0.0.11 ADD, next day, prev day , chg Month , CHG Week, chg Sched, (for daybody menu)
task_DDeditable:true, //0.0.11
task_eventLaunch:'dblclick', //0.0.11 'click, dblclick, if set to '' then no action is taken
task_ShowMenuItems:[1,1,1,1,1], //0.0.11 ADD, delete, edit, Next day , Prev Day (for Taks/events)
customHTMLinpos:'before', //0.0.13 Feature request
forceTaskFit: true //0.0.14
}
});
prueba.viewscheduler.on({//scheduler only event on this object
'headerClick':{
fn: function(refunit,datex, mviewx, calx) {
// var msgstring = "Header Value clicked -(" + refunit +')<br>';
// if (refunit=='day' || refunit=='hour'){
// msgstring += 'on date -(' + datex.format('d/m/Y h:i:s') +')<br>';
// } else {
// msgstring += 'on Week# ' + datex[0].format('W');
// msgstring += '-(From ' + datex[0].format('d/m/Y h:i:s') +' to ';
// msgstring +=datex[1].format('d/m/Y h:i:s') + ')';
// }
// Ext.Msg.alert('Information', msgstring);
},
scope:this
},
'beforePeriodChange':{
fn:function(refperiod,datexold,datexnew){
if (refperiod==1){ //week
//do your stuff here
} else {
//do your stuff here
}
return true;
},
scope:this
},
'afterPeriodChange':{
fn:function(refperiod,datexnew){
if (refperiod==1){
//alert ("Changed date from " + datexnew[0] + " to " + datexnew[1]);
} else {
//alert ("Changed date to " + datexnew);
}
updateStoreincalendar();
}
}
});
prueba.viewmonth.on({//dayClick only event on this object
'dayClick':{
fn: function(datex, mviewx, calx) {
//alert ("dayclick event for " + datex);
},
scope:this
},
'beforeMonthChange':{
fn: function(currentdate,newdate) {
//alert ("gonna change month to " + newdate.format('m/Y') + ' Actual date=' + currentdate.format('m/Y') );
prueba.currentdate=newdate;
return true;
},
scope:this
},
'afterMonthChange':{
fn: function(newdate) {
//alert ("Month changed to " + newdate.format('m/Y') ) ;
//alert('ok');
updateStoreincalendar(); // refresh the data for that selected month
},
scope:this
}
});
prueba.viewweek.on({
'dblClickTaskAllDay':{
fn: function(task,dxview,calendar) {
// var datatest='任务信息 <br>record No:' + task[0] + '<br>';
// datatest+='ID:' + task[1] + ' ' + task[2] + '<br>';
// datatest+='开始于:' + task[3] + '<br>';
// datatest+='结束于:' + task[4] + '<br>';
// datatest+='内容:' + task[5] + '<br>';
// datatest+='index' + task[6] + '<br>';
// Ext.Msg.alert('日程信息', datatest);
new CalendarPlanForm(task[1]);
},
scope:this
},
'beforeWeekChange':{
fn: function (currentDate, newDate){
return true;
}
},
'afterWeekChange':{
fn: function(newdate){
prueba.currentdate=newdate;
updateStoreincalendar();
return false;
}
}
});
prueba.viewday.on({//'beforeDayChange' and 'afterDayChange' unique events on day view
'beforeDayChange':{
fn: function(currentdate, newdate) {
//alert ("gonna change to " + newdate.format('m/d/Y') + ' Actual date=' + currentdate.format('m/d/Y') );
return true;
},
scope:this
},
'afterDayChange':{
fn: function(newdate) {
prueba.currentdate=newdate;
updateStoreincalendar();
},
scope:this
}
});
prueba.on({
'beforeContextMenuTask': {
fn: function(refview,datatask,showItems,myactions) {
return false;
}
},
'beforeChangeDate': {
fn: function( newdate , calobj){
return true;
}
},
'afterChangeDate':{
fn: function( newdate , calobj){
//alert ("Date changed to:" + newdate.format('d-m-Y'));
updateStoreincalendar(); // refresh the data for that selected date and view
}
},
'onChangeView':{
fn: function(newView, oldView, calobj){
//Ext.get("samplebox_cview").update("<b>Current View:</b> " + newView);
updateStoreincalendar(); // refresh the data for that selected date and view
},scope: this
},
'beforeChangeView':{
fn: function (newView,OldView,calendarOBJ){
if (newView==OldView){ return true; }
var r=confirm("Change from " + OldView + " to " + newView);
return r;
},scope:this
},
'taskAdd':{
fn: function( datex ) {
alert("添加任务TODO");
// var test=tstfunctiontoadd(datex);
// if (test){
// alert ("Adding Task for " + datex);
// }
// do your stuff and then send the data to the php file and updateStoreincalendar();
}
},
'taskDblClick':{
fn: function (task,dxview,calendar,refviewname){
// var datatest='Record No:' + task[0] + '<br>';
// datatest+='id-task:' + task[1] + ' ' + task[2] + '<br>';
// datatest+='开始于:' + task[3] + '<br>';
// datatest+='结束于:' + task[4] + '<br>';
// datatest+='内容' + task[5] + '<br>';
// datatest+='index' + task[6] + '<br>';
// Ext.Msg.alert('日程信息 - ' + refviewname, datatest);
new CalendarPlanForm(task[1]);
},
scope:this
},
'beforeTaskDelete': {
fn: function (datatask,dxview) {
return false;
// do your stuff to check if the event/task could be deleted
}, scope:this
},
'onTaskDelete':{
fn:function(datatask){
var r=confirm("Delete event " + datatask[1] + " " + datatask[2] + "...? YES/NO" );
return r;
// do your stuf for deletion and return the value
},scope:this
},
'afterTaskDelete':{
fn: function(datatask,action){
action ? alert("Event: " + datatask[1] + " " + datatask[2] + " Deleted"): alert("Event Delete was canceled..!");
// perform any action after deleting the event/task
// do your stuff and then send the data to the php file and
updateStoreincalendar();
},scope:this
},
'beforeTaskEdit': {
fn: function (datatask,dxview) {
return false;
}, scope:this
},
'onTaskEdit':{
fn:function(datatask){
//var r=confirm("Edit event " + datatask[1] + " " + datatask[2] + "...? YES/NO" );
return true;
// do your stuff for editing and return the value
},scope:this
},
'afterTaskEdit':{
fn: function(datatask,action){// perform any action after deleting the event/task
if (action){
//alert("Event: " + datatask[1] + " " + datatask[2] + " Edited");
// do your stuff and then send the data to the php file and
// updateStoreincalendar();
} else {
alert("Event Edit was canceled..!");
}
return false;
},scope:this
},
'beforeTaskMove':{
fn: function (datatask,Taskobj,dxview,TaskEl) { // return "true" to cancel or "false" to go on
return false;
}, scope:this
},
'TaskMoved':{
fn: function (newDataTask,Taskobj,dxview,TaskEl) { // do some stuff
var test=21; // use breakpoint in firefox here
task = newDataTask;
// datatest ='Task id:' + task[0] + ' ' + task[2] + '<br>';
// datatest+='recid:' + task[1] + '<br>';
// datatest+='starts:' + task[3] + '<br>';
// datatest+='ends:' + task[4] + '<br>';
// datatest+='contents:' + task[5] + '<br>';
// datatest+='index:' + task[6] + '<br>';
// Ext.Msg.alert('Information Modified task', datatest);
new CalendarPlanForm(task[0]);
// do your stuff and then send the data to the php file and
// updateStoreincalendar();
}, scope:this
},
'customMenuAction':{
fn: function (MenuId, Currentview,datatask,objEl,dxview){
var datatest = '';
if (Currentview=='month'){
// task = datatask;
// datatest ='Element ID :' + task[0] + '<br>';
// datatest+='Task ID :' + task[1] + '<br>';
// datatest+='Menu ID :' + MenuId + '<br>';
// Ext.Msg.alert('(Month) Information- ' + Currentview, datatest);
} else if (Currentview=='day'){
task = datatask;
datatest ='Task id:' + task[0] + ' ' + task[1] + '<br>';
datatest+='starts:' + task[2] + '<br>';
datatest+='Ends:' + task[3] + '<br>';
datatest+='contents:' + task[4] + '<br>';
datatest+='index:' + task[5] + '<br>';
datatest+='Test Menu:' + MenuId + '<br>';
Ext.Msg.alert('(Day) Task information' + Currentview, datatest);
} else if (Currentview=='week'){
//misssing sample
} else if (Currentview=='scheduler'){
task = datatask;
datatest ='Task id:' + task[0] + ':' + task[2] + '<br>';
datatest+='starts:' + task[3] + '<br>';
datatest+='Ends:' + task[4] + '<br>';
datatest+='contents:' + task[5] + '<br>';
datatest+='index:' + task[6] + '<br>';
datatest+='Test Menu:' + MenuId + '<br>';
Ext.Msg.alert('(Scheduler) Task information' + Currentview, datatest);
}
},scope:this
}
});
//prueba.render('calendar');
prueba.on({
'render':{
fn:function(prueba){
calendarStore.load();
myMasktest = new Ext.LoadMask( prueba.id, {msg:e2cs.cal_locale.loadmaskText});
calendarStore.on({
'beforeload':{fn:function(){ prueba.calendarMask.show(); }
},
'load':{
fn:function(success,dataxx,purebax){
if(success==false){
alert ("加载日程任务数据出错!");
} else {
prueba.refreshCalendarView(true);
}
prueba.calendarMask.hide();
}
}
});
Ext.EventManager.onWindowResize( function(){
prueba.refreshCalendarView();
});
}
}
});
return prueba;
}
function testfechas(data) {
var pruebax=Ext.getCmp('MyPlanTaskView');
if (data==1) { alert( pruebax.getCalendarMonth() );
} else if (data==2) { alert( pruebax.getCalendarYear() );
} else if (data==3) { alert( pruebax.getCalendarDay() );
} else if (data==4){ alert( pruebax.getCalendarWeekDay('') );
} else if (data==5){
var test= pruebax.getCalendarWeekDay('str');
alert( test );
} else {
alert( pruebax.getCurrentDate() );
}
}
function hideshow(datatochoose){
var mysamples = Ext.select('tr.' + datatochoose,true);
mysamples.each(function(el, thisobj, index){
var xtest = el;
if (xtest.getStyle('display')=='none'){
xtest.setStyle({display:''});
} else {
xtest.setStyle({display:'none'} );
}
}
);
}
| JavaScript |
var AppointmentForm = function(appointId) {
this.appointId = appointId;
var fp = this.setup();
var window = new Ext.Window({
id : 'AppointmentFormWin',
title : '约会详细信息',
width : 500,
height : 420,
modal : true,
layout : 'anchor',
plain : true,
bodyStyle : 'padding:5px;',
buttonAlign : 'center',
items : [this.setup()],
buttons : [{
text : '保存',
iconCls:'btn-save',
handler : function() {
var fp = Ext.getCmp('AppointmentForm');
if (fp.getForm().isValid()) {
fp.getForm().submit({
method : 'post',
waitMsg : '正在提交数据...',
success : function(fp, action) {
Ext.Msg.alert('操作信息', '成功保存信息!');
Ext.getCmp('AppointmentGrid').getStore()
.reload();
window.close();
},
failure : function(fp, action) {
Ext.MessageBox.show({
title : '操作信息',
msg : '信息保存出错,请联系管理员!',
buttons : Ext.MessageBox.OK,
icon : 'ext-mb-error'
});
window.close();
}
});
}
}
}, {
text : '取消',
iconCls:'btn-cancel',
handler : function() {
window.close();
}
}]
});
window.show();
};
AppointmentForm.prototype.setup = function() {
var formPanel = new Ext.FormPanel({
url : __ctxPath + '/task/saveAppointment.do',
layout : 'form',
id : 'AppointmentForm',
frame : true,
formId : 'AppointmentFormId',
defaultType : 'textfield',
defaults:{
width:300
},
items : [{
name : 'appointment.appointId',
id : 'appointId',
xtype : 'hidden',
value : this.appointId == null? '': this.appointId
}, {
fieldLabel : '主题',
allowBlank:false,
name : 'appointment.subject',
id : 'subject'
}, {
fieldLabel : '开始时间',
name : 'appointment.startTime',
id : 'startTime',
allowBlank:false,
xtype:'datetimefield',
format: 'Y-m-d H:i:s'
}, {
fieldLabel : '结束时间',
name : 'appointment.endTime',
id : 'endTime',
allowBlank:false,
xtype:'datetimefield',
format: 'Y-m-d H:i:s'
}, {
fieldLabel : '约会内容',
name : 'appointment.content',
xtype:'textarea',
allowBlank:false,
id : 'content'
}, {
fieldLabel : '地点',
name : 'appointment.location',
allowBlank:false,
id : 'location'
}, {
fieldLabel : '备注',
name : 'appointment.notes',
xtype:'textarea',
id : 'notes'
}, {
fieldLabel : '受邀人Email',
xtype:'textarea',
name : 'appointment.inviteEmails',
id : 'inviteEmails'
}
]
});
if (this.appointId != null && this.appointId != 'undefined') {
formPanel.getForm().load({
deferredRender : false,
url : __ctxPath + '/task/getAppointment.do?appointId='
+ this.appointId,
waitMsg : '正在载入数据...',
success : function(form, action) {
// Ext.Msg.alert('编辑', '载入成功!');
},
failure : function(form, action) {
// Ext.Msg.alert('编辑', '载入失败');
}
});
}
return formPanel;
};
| JavaScript |
var CalendarPlanForm = function(planId) {
this.planId = planId;
var fp = this.setup();
var window = new Ext.Window({
id : 'CalendarPlanFormWin',
title : '日程详细信息',
width : 560,
height:500,
modal : true,
layout : 'anchor',
plain : true,
bodyStyle : 'padding:5px;',
buttonAlign : 'center',
items : [this.setup()],
buttons : [{
text : '保存',
iconCls: 'btn-save',
handler : function() {
var fp = Ext.getCmp('CalendarPlanForm');
if (fp.getForm().isValid()) {
fp.getForm().submit({
method : 'post',
waitMsg : '正在提交数据...',
success : function(fp, action) {
Ext.Msg.alert('操作信息', '成功保存信息!');
Ext.getCmp('CalendarPlanGrid').getStore().reload();
window.close();
},
failure : function(fp, action) {
Ext.MessageBox.show({
title : '操作信息',
msg : '信息保存出错,请联系管理员!',
buttons : Ext.MessageBox.OK,
icon : 'ext-mb-error'
});
window.close();
}
});
}
}
}, {
text : '取消',
iconCls: 'btn-cancel',
handler : function() {
window.close();
}
}]
});
window.show();
};
CalendarPlanForm.prototype.setup = function() {
var formPanel = new Ext.FormPanel({
url : __ctxPath + '/task/saveCalendarPlan.do',
layout : 'form',
id : 'CalendarPlanForm',
frame : true,
defaults : {
//width : 360
anchor : '98%,98%'
},
formId : 'CalendarPlanFormId',
items : [{
name : 'calendarPlan.planId',
id : 'planId',
xtype : 'hidden',
value : this.planId == null ? '' : this.planId
},{
xtype:'radiogroup',
fieldLabel : '紧急程度',
autoHeight: true,
columns : 3,
items : [{
boxLabel : '一般',
name : 'calendarPlan.urgent',
inputValue : 0,
id:'urgent0',
checked : true
},{
boxLabel : '重要',
name : 'calendarPlan.urgent',
inputValue : 1,
id:'urgent1'
},{
boxLabel : '紧急',
name : 'calendarPlan.urgent',
inputValue : 2,
id:'urgent2'
}]
}, {
fieldLabel : '内容',
xtype:'htmleditor',
height:200,
name : 'calendarPlan.content',
id : 'content',
allowBlank:false
}, {
fieldLabel : '员工ID',
xtype:'hidden',
name : 'calendarPlan.userId',
id : 'userId'
}, {
layout:'column',
autoHeight: true,
items:[
{
columnWidth:.8,
layout : 'form',
items : [
{
fieldLabel:'分配给',
xtype:'textfield',
anchor:'100%,100%',
name : 'calendarPlan.fullname',
id : 'fullname',
allowBlank:false
}]
},{
columnWidth:.2,
xtype:'button',
iconCls:'btn-user-sel',
text:'选择员工',
handler:function(){
UserSelector.getView(function(userId,fullname){
Ext.getCmp("userId").setValue(userId);
Ext.getCmp("fullname").setValue(fullname);
}).show();
}
}
]
}, {
xtype:'radiogroup',
fieldLabel : '任务类型',
autoHeight: true,
columns : 2,
items : [{
boxLabel : '限期任务',
name : 'calendarPlan.taskType',
inputValue : 1,
id:'taskType1',
checked : true,
listeners:{
check:function(ck,bval){
if(bval){
Ext.getCmp("timeDuration").show();
}
}
}
}, {
boxLabel : '非限期任务',
name : 'calendarPlan.taskType',
id:'taskType2',
inputValue : 2,
listeners:{
check:function(ck,bval){
if(bval){
Ext.getCmp("timeDuration").hide();
Ext.getCmp("startTime").setValue('');
Ext.getCmp("endTime").setValue('');
}
}
}
}]
},{
xtype:'fieldset',
border:false,
layout:'form',
id:'timeDuration',
autoHeight:true,
items:[
{
fieldLabel : '开始时间',
name : 'calendarPlan.startTime',
xtype:'datetimefield',
id : 'startTime',
anchor : '98%,98%',
format: 'Y-m-d H:i:s'
}, {
fieldLabel : '结束时间',
name : 'calendarPlan.endTime',
xtype:'datetimefield',
id : 'endTime',
anchor : '98%,98%',
format: 'Y-m-d H:i:s'
}
]
},{
xtype : 'radiogroup',
fieldLabel : '显示方式',
autoHeight: true,
columns : 2,
items : [{
boxLabel : '仅在任务中显示',
name : 'calendarPlan.showStyle',
inputValue : 1,
id: 'showStyle1',
checked : true
}, {
boxLabel : '在日程与任务中显示',
name : 'calendarPlan.showStyle',
id: 'showStyle2',
inputValue : 2
}]
}
]
});
if (this.planId != null && this.planId != 'undefined') {
formPanel.getForm().load({
deferredRender : false,
url : __ctxPath + '/task/getCalendarPlan.do?planId='
+ this.planId,
waitMsg : '正在载入数据...',
success : function(form, action) {
// Ext.Msg.alert('编辑', '载入成功!');
var plan=action.result.data;
Ext.getCmp("urgent" + plan.urgent).setValue(true);
Ext.getCmp("taskType" + plan.taskType).setValue(true);
Ext.getCmp("showStyle" + plan.showStyle).setValue(true);
},
failure : function(form, action) {
}
});
}
return formPanel;
};
| JavaScript |
Ext.ns('CalendarPlanView');
/**
* 今日日程
*/
var TodayPlanView = function() {
return new Ext.Panel({
id : 'TodayPlanView',
title : '今日日程',
autoScroll : true,
items : [this.setup()]
});
};
/**
* 建立视图
*/
TodayPlanView.prototype.setup = function() {
return this.grid();
};
/**
* 建立DataGrid
*/
TodayPlanView.prototype.grid = function() {
var sm = new Ext.grid.CheckboxSelectionModel();
var cm = new Ext.grid.ColumnModel({
columns : [sm, new Ext.grid.RowNumberer(), {
header : 'planId',
dataIndex : 'planId',
hidden : true
}, {
header : '重要程度',
width:60,
dataIndex : 'urgent'
}, {
header: '时间',
width: 80 ,
dataIndex: 'durationTime'
},{
width:250,
header : '内容',
dataIndex : 'content'
}, {
header : '状态',
dataIndex : 'status'
}],
defaults : {
sortable : false,
menuDisabled : false,
width : 100
}
});
var store = this.store();
store.load({
params : {
start : 0,
limit : 25
}
});
var grid = new Ext.grid.GridPanel({
id : 'CalendarPlanGrid',
tbar : this.topbar(),
store : store,
trackMouseOver : true,
disableSelection : false,
loadMask : true,
autoHeight : true,
cm : cm,
sm : sm,
viewConfig : {
forceFit : true,
enableRowBody : false,
showPreview : false
},
bbar : new Ext.PagingToolbar({
pageSize : 25,
store : store,
displayInfo : true,
displayMsg : '当前显示从{0}至{1}, 共{2}条记录',
emptyMsg : "当前没有记录"
})
});
grid.addListener('rowdblclick', function(grid, rowindex, e) {
grid.getSelectionModel().each(function(rec) {
TodayPlanView.edit(rec.data.planId);
});
});
return grid;
};
/**
* 初始化数据
*/
TodayPlanView.prototype.store = function() {
var store = new Ext.data.Store({
proxy : new Ext.data.HttpProxy({
url : __ctxPath + '/task/todayCalendarPlan.do'
}),
reader : new Ext.data.JsonReader({
root : 'result',
totalProperty : 'totalCounts',
id : 'id',
fields : [{
name : 'planId',
type : 'int'
}
,'urgent', 'durationTime','content',
'status']
}),
remoteSort : true
});
return store;
};
/**
* 建立操作的Toolbar
*/
TodayPlanView.prototype.topbar = function() {
var toolbar = new Ext.Toolbar({
height : 30,
bodyStyle : 'text-align:left',
items : [{
iconCls : 'btn-add',
text : '添加日程',
xtype : 'button',
handler : function() {
new CalendarPlanForm();
}
}, {
iconCls : 'btn-del',
text : '删除日程',
xtype : 'button',
handler : function() {
var grid = Ext.getCmp("CalendarPlanGrid");
var selectRecords = grid.getSelectionModel()
.getSelections();
if (selectRecords.length == 0) {
Ext.Msg.alert("信息", "请选择要删除的记录!");
return;
}
var ids = Array();
for (var i = 0; i < selectRecords.length; i++) {
ids.push(selectRecords[i].data.planId);
}
CalendarPlanView.remove(ids);
}
}]
});
return toolbar;
};
/**
* 删除单个记录
*/
TodayPlanView.remove = function(id) {
var grid = Ext.getCmp("TodayPlanView");
Ext.Msg.confirm('信息确认', '您确认要删除该记录吗?', function(btn) {
if (btn == 'yes') {
Ext.Ajax.request({
url : __ctxPath
+ '/task/multiDelCalendarPlan.do',
params : {
ids : id
},
method : 'post',
success : function() {
Ext.Msg.alert("信息提示", "成功删除所选记录!");
grid.getStore().reload({
params : {
start : 0,
limit : 25
}
});
}
});
}
});
};
/**
*
*/
TodayPlanView.edit = function(id) {
new CalendarPlanForm(id);
}
/**
* 完成任务,填写反馈意见
* @param {} id
*/
TodayPlanView.finished=function(id){
new CalendarPlanFinishForm(id);
}
| JavaScript |
var CalendarPlanFinishForm = function(planId) {
this.planId = planId;
var fp = this.setup();
var window = new Ext.Window({
id : 'CalendarPlanFinishFormWin',
title : '完成任务',
width : 560,
height:480,
modal : true,
layout : 'anchor',
plain : true,
bodyStyle : 'padding:5px;',
buttonAlign : 'center',
items : [this.setup()],
buttons : [{
text : '完成任务',
id:'calendarPlanFinishBtn',
iconCls: 'btn-save',
handler : function() {
var fp = Ext.getCmp('CalendarPlanFinishForm');
if (fp.getForm().isValid()) {
fp.getForm().submit({
method : 'post',
params:{'calendarPlan.status':1},
waitMsg : '正在提交数据...',
success : function(fp, action) {
Ext.Msg.alert('操作信息', '成功保存信息!');
Ext.getCmp('CalendarPlanGrid').getStore().reload();
window.close();
},
failure : function(fp, action) {
Ext.MessageBox.show({
title : '操作信息',
msg : '信息保存出错,请联系管理员!',
buttons : Ext.MessageBox.OK,
icon : 'ext-mb-error'
});
window.close();
}
});
}
}
}, {
text : '取消',
iconCls: 'btn-cancel',
handler : function() {
window.close();
}
}]
});
window.show();
};
CalendarPlanFinishForm.prototype.setup = function() {
var formPanel = new Ext.FormPanel({
url : __ctxPath + '/task/saveCalendarPlan.do',
layout : 'form',
id : 'CalendarPlanFinishForm',
frame : true,
defaults : {
anchor : '98%,98%'
},
items : [{
name : 'calendarPlan.planId',
id : 'planId',
xtype : 'hidden',
value : this.planId == null ? '' : this.planId
},
{
fieldLabel : '紧急程度',
xtype : 'combo',
triggerAction : 'all',
hiddenName : 'calendarPlan.urgent',
id : 'urgent',
editable : false,
disabled:true,
store :[['0','一般'],['1','重要'],['2','紧急']]
}, {
fieldLabel : '内容',
xtype:'textarea',
disabled:true,
height:100,
name : 'calendarPlan.content',
id : 'content'
},{
fieldLabel:'分配给',
xtype:'textfield',
anchor:'100%,100%',
name : 'calendarPlan.fullname',
id : 'fullname',
disabled:true
}, {
xtype:'radiogroup',
fieldLabel : '任务类型',
autoHeight: true,
disabled:true,
columns : 2,
items : [{
boxLabel : '限期任务',
name : 'calendarPlan.taskType',
inputValue : 1,
id:'taskType1'
}, {
boxLabel : '非限期任务',
name : 'calendarPlan.taskType',
id:'taskType2',
inputValue : 2
}]
},{
xtype:'fieldset',
border:false,
layout:'form',
id:'timeDuration',
autoHeight:true,
items:[
{
fieldLabel : '开始时间',
name : 'calendarPlan.startTime',
xtype:'datetimefield',
id : 'startTime',
anchor : '98%,98%',
disabled:true,
format: 'Y-m-d H:i:s'
}, {
fieldLabel : '结束时间',
name : 'calendarPlan.endTime',
xtype:'datetimefield',
id : 'endTime',
anchor : '98%,98%',
disabled:true,
format: 'Y-m-d H:i:s'
}
]
},{
xtype : 'radiogroup',
fieldLabel : '显示方式',
autoHeight: true,
disabled:true,
columns : 2,
items : [{
boxLabel : '仅在任务中显示',
name : 'calendarPlan.showStyle',
inputValue : 1,
id: 'showStyle1',
checked : true
}, {
boxLabel : '在日程与任务中显示',
name : 'calendarPlan.showStyle',
id: 'showStyle2',
inputValue : 2
}]
},
{
xtype:'textarea',
fieldLabel:'反馈',
allowBlank:false,
name:'calendarPlan.feedback',
id:'feedback'
}
]
});
if (this.planId != null && this.planId != undefined) {
formPanel.getForm().load({
deferredRender : false,
url : __ctxPath + '/task/getCalendarPlan.do?planId='
+ this.planId,
waitMsg : '正在载入数据...',
success : function(form, action) {
// Ext.Msg.alert('编辑', '载入成功!');
var plan=action.result.data;
Ext.getCmp("taskType" + plan.taskType).setValue(true);
Ext.getCmp("showStyle" + plan.showStyle).setValue(true);
if(plan.status==1){
Ext.getCmp("calendarPlanFinishBtn").setDisabled(true);
}
},
failure : function(form, action) {
}
});
}
return formPanel;
};
| JavaScript |
Ext.ns("App");
Ext.ns("Ext.app");
Ext.util.Observable.observeClass(Ext.data.Connection);
Ext.data.Connection.on('requestcomplete', function(conn, resp,options ){
if(resp.status!=200){
alert('error:' + resp.statusText + " status:" + resp.status);
}
});
Ext.app.MenuLoader = Ext.extend(Ext.ux.tree.XmlTreeLoader, {
processAttributes : function(attr) {
if (attr.tagName == 'Item') {
attr.leaf = true;
} else if (attr.tagName == 'Items') {
attr.loaded = true;
attr.expanded = true;
}
}
});
App.init = function() {
Ext.QuickTips.init();//这句为表单验证必需的代码
Ext.BLANK_IMAGE_URL=__ctxPath+'/ext3/resources/images/default/s.gif';
// requestcomplete //定义一个全局的权限错误标识
//App.login.checkLogin(); // 检查登录,假如没有登录就要跳到登录页面
// 创建流程查看窗口
var tabPanel = new Ext.TabPanel({
id : 'centerTabPanel',
region : 'center',
deferredRender : true,
enableTabScroll : true,
activeTab : 0, // first tab initially active
defaults : {
autoScroll : true,
closable : true
},
items : [App.home.portal]
});
var megBtn = new Ext.Button({
id : 'messageTip',
hidden : true,
width : 50,
height : 20,
// bodyStyle:'padding:5px;',
// iconCls:'menu-receiveMessage',
handler : function() {
var megBtn = Ext.getCmp('messageTip');
var megWin = Ext.getCmp('win');
if (megWin == null) {
new MessageWin();
}
megBtn.hide();
}
});
var addBtn = function(count) {
var megBtn = Ext.getCmp('messageTip');
var megWin = Ext.getCmp('win');
var reMegWin = Ext.getCmp('wind');
if (count > 0 && megWin == null && reMegWin == null) {
megBtn.setText('<img src="' + __ctxPath
+ '/images/newpm.gif"/>你有<strong style="color: red;">'
+ count + '</strong>信息');
megBtn.show();
} else {
megBtn.hide();
}
};
var addBtnFunction = function() {
Ext.Ajax.request({
url : __ctxPath + '/info/countInMessage.do',
method : 'POST',
success : function(response, options) {
var result = Ext.util.JSON
.decode(response.responseText);
count = result.count;
addBtn(count);
// setTimeout(addBtnFunction, 1000 * 8); //设8秒响应一次
},
failure : function(response, options) {
},
scope : this
});
};
addBtnFunction();
var westPanel = new Ext.Panel({
region : 'west',
id : 'west-panel', // see Ext.getCmp() below
title : '导航',
split : true,
width : 200,
autoScroll : true,
layout : 'accordion',
collapsible : true,
margins : '0 0 0 2',
items : [],
bbar: new Ext.Toolbar({
width: '100%',
height: 25,
items:[{
text:'退出系统',
iconCls:'btn-logout',
handler:function(){
App.login.logout();
}
},'->',{
text:'看谁在线',
iconCls:'btn-onlineUser',
handler:function(){
OnlineUserSelector.getView(function(userId,userName){
Ext.Msg.alert("userId:"+userId+",userName:"+userName);
},true).show();
}
}]
})
});
// 构建左边的菜单
Ext.Ajax.request({
url : __ctxPath + '/pages/menu/items.jsp',
success : function(response, options) {
var arr = eval(response.responseText);
var __activedPanelId = getCookie("__activedPanelId");
for (var i = 0; i < arr.length; i++) {
var panel = new Ext.tree.TreePanel({
id : arr[i].id,
title : arr[i].text,
iconCls : arr[i].iconCls,
autoScroll : true,
border : false,
loader : new Ext.app.MenuLoader({
dataUrl : __ctxPath
+ '/pages/menu/itemMenu.jsp?id='
+ arr[i].id
}),
root : new Ext.tree.AsyncTreeNode({
expanded : true
}),
listeners : {
'click' : App.clickNode
},
rootVisible : false
});
westPanel.add(panel);
panel.on('expand', function(p) {
// 记住上次点激的panel
var expires = new Date();
expires.setDate(expires.getDate() + 30);
setCookie("__activedPanelId", p.id,
expires, __ctxPath);
});
// 激活上次点击的panel
if (arr[i].id == __activedPanelId) {
westPanel.layout.activeItem = panel;
}
}
westPanel.doLayout();
}
});
// Configure viewport
var viewport = new Ext.Viewport({
layout : 'border',
items : [{
xtype : 'panel',
frame : true,
region : 'north',
height : 68,
layout : 'border',
bodyStyle : '',
layoutConfig : {
pack : 'left',
align : 'middle'
},
defaults : {
border : false
},
items : [{
region : 'west',
// html : '<img src="' + __ctxPath
// + '/images/logo.png"/>'
}, {
region : 'center',
layout : 'hbox',
layoutConfig : {
padding : '5',
pack : 'center',
align : 'middle'
},
defaults : {
margins : '0 5 0 0'
}//,
// items : [{
// xtype : 'label',
// text : '请输入查询关键字'
// }, {
// xtype : 'textfield',
// name : 'keySearch',
// width : 200,
// id : 'keySearch'
// }, {
// xtype : 'button',
// iconCls : 'btn-search',
// text : '查询',
// handler:function(){
// alert('对不起,目前暂不开放该功能!');
// }
// }]
}, {
region : 'east'//,
// html : '<img src="' + __ctxPath
// + '/images/product.png"/>'
}]
}, westPanel, tabPanel, {
xtype : 'panel',
region : 'south',
height : 28,
border : false,
bbar : [
megBtn,
'->',
{
xtype : "tbfill"
},
new Ext.Toolbar.TextItem('办公管理系统'),
{
xtype : 'tbseparator'
},
new Ext.Toolbar.TextItem('技术支持'),
{
xtype : 'tbseparator'
}, {
pressed : false,
text : '与我们联系',
handler:function(){
// Ext.Msg.alert("联系我们","");
}
}]
}]
});
};
App.clickNode = function(node) {
if (node.id == 'LogOut') {
App.login.logout();
} else {
if(node.id==null || node.id=='' || node.id.indexOf('xnode')!=-1){
return ;
}
var tabs = Ext.getCmp('centerTabPanel');
var tabItem = tabs.getItem(node.id);
if (tabItem == null) {
$ImportJs(node.id, function(view) {
tabItem = tabs.add(view);
tabs.activate(tabItem);
});
}
tabs.activate(tabItem);
}
};
Ext.onReady(App.init); | JavaScript |
/**
* 系统导入的模块js,主要用于后加载方式,需要使用某些js时,需要在此指定加载哪一些。
*/
Ext.ns("App");
App.importJs = {
AppRoleView : [
__ctxPath + '/js/system/AppRoleView.js',
__ctxPath+'/ext3/ux/CheckTreePanel.js',
__ctxPath+'/js/system/RoleGrantRightView.js',
__ctxPath + '/js/system/AppRoleForm.js'],
PersonalDocumentView : [
__ctxPath + '/js/document/PersonalDocumentView.js',
__ctxPath + '/js/document/DocumentView.js',
__ctxPath + '/js/document/DocumentForm.js',
__ctxPath + '/js/document/DocumentSharedForm.js',
__ctxPath + '/js/document/DocFolderForm.js'],
DocumentSharedView : [
__ctxPath + '/js/document/DocumentSharedView.js',
__ctxPath + '/js/document/DocumentSharedWin.js'],
DocFolderSharedView :[
__ctxPath + '/js/document/FindPublicDocumentView.js',
__ctxPath + '/js/document/DocFolderView.js',
__ctxPath +'/js/document/DocFolderForm.js',
__ctxPath + '/js/document/DocFolderSharedView.js',
__ctxPath + '/js/document/DocFolderSharedForm.js',
__ctxPath + '/js/document/DocPrivilegeForm.js',
__ctxPath + '/js/document/DocPrivilegeView.js'],
FindPublicDocumentView :[
__ctxPath + '/js/document/FindPublicDocumentView.js',
__ctxPath + '/js/document/PublicDocumentView.js',
__ctxPath + '/js/document/PublicDocumentDetailWin.js',
__ctxPath + '/js/document/NewPublicDocumentForm.js',
__ctxPath + '/js/document/DocFolderSelector.js'],
NewPublicDocumentForm :[
__ctxPath + '/js/document/NewPublicDocumentForm.js',
__ctxPath + '/js/document/DocFolderSelector.js'],
DocFolderMoveForm : [
__ctxPath + '/js/document/DocFolderMoveForm.js',
__ctxPath + '/js/document/PersonalDocFolderSelector.js'],
NoticeView : [
__ctxPath + '/js/info/NoticeView.js',
__ctxPath + '/js/info/NoticeForm.js',
__ctxPath + '/js/info/NoticeDetail.js'],
ReportTemplateView : [
__ctxPath + '/js/system/ReportTemplateView.js',
__ctxPath + '/js/system/ReportTemplateForm.js'],
MessageView : [
__ctxPath + '/js/info/MessageView.js',
__ctxPath + '/js/info/MessageForm.js',
__ctxPath + '/js/info/MessageWin.js'],
PhoneBookView : [
__ctxPath + '/js/communicate/PhoneBookView.js',
__ctxPath + '/js/communicate/PhoneGroupForm.js',
__ctxPath + '/js/communicate/PhoneBookForm.js'],
DepartmentView : [
__ctxPath + '/js/system/DepartmentView.js',
__ctxPath + '/js/system/DepartmentForm.js',
__ctxPath + '/js/system/AppUserView.js',
__ctxPath + '/js/system/AppUserForm.js'],
AppUserView : [
__ctxPath+'/js/system/AppUserView.js',
__ctxPath+'/js/system/AppUserForm.js'],
MyNewsView : [
__ctxPath + '/js/info/MyNewsView.js',
__ctxPath + '/js/info/MyNewsForm.js',
__ctxPath + '/js/info/MyNewsTypeTree.js',
__ctxPath + '/js/info/MyNewsTypeForm.js'],
NewsView : [
__ctxPath + '/js/info/NewsView.js',
__ctxPath + '/js/info/NewsForm.js',
__ctxPath + '/js/info/NewsTypeTree.js',
__ctxPath + '/js/info/NewsTypeForm.js'],
NewsTypeView : [
__ctxPath + '/js/info/NewsTypeView.js',
__ctxPath + '/js/info/NewsTypeForm.js'],
CompanyView : [
__ctxPath + '/js/system/CompanyView.js'],
FileAttachView : [
__ctxPath + '/js/system/FileAttachView.js',
__ctxPath + '/js/system/FileAttachForm.js',
__ctxPath + '/js/system/FileAttachDetail.js'],
DiaryView : [
__ctxPath + '/js/system/DiaryView.js',
__ctxPath + '/js/system/DiaryForm.js'],
PersonalMailBoxView : [
__ctxPath + '/js/communicate/PersonalMailBoxView.js',
__ctxPath + '/js/communicate/MailView.js',
__ctxPath + '/js/communicate/MailForm.js',
__ctxPath + '/js/communicate/MailFolderForm.js'],
MailForm : [
__ctxPath + '/js/communicate/MailForm.js'],
PersonalPhoneBookView:[
__ctxPath+'/js/communicate/PersonalPhoneBookView.js',
__ctxPath+'/js/communicate/PhoneBookView.js',
__ctxPath+'/js/communicate/PhoneGroupForm.js',
__ctxPath+'/js/communicate/PhoneBookForm.js'],
SharedPhoneBookView:[
__ctxPath+'/js/communicate/SharedPhoneBookView.js',
__ctxPath+'/js/communicate/SharedPhoneBookWin.js'],
FlowManagerView:[
__ctxPath+'/js/flow/ProTypeForm.js',
__ctxPath+'/js/flow/ProDefinitionForm.js',
__ctxPath+'/js/flow/ProDefinitionView.js',
__ctxPath+'/js/flow/FlowManagerView.js',
__ctxPath+'/js/flow/ProDefinitionDetail.js',
__ctxPath+'/js/flow/ProDefinitionView.js',
__ctxPath+'/js/flow/ProDefinitionSetting.js',
__ctxPath+'/js/flow/ProcessRunView.js',
__ctxPath+'/js/flow/ProcessRunDetail.js',
__ctxPath+'/js/flow/MyTaskView.js',
__ctxPath+'/js/flow/ProcessNextForm.js'
],
NewProcess:[
__ctxPath+'/js/flow/NewProcess.js',
__ctxPath+'/js/flow/ProDefinitionView.js',
__ctxPath+'/js/flow/ProDefinitionDetail.js',
__ctxPath+'/js/flow/ProcessRunStart.js'
],
ProcessRunView:[
__ctxPath+'/js/flow/ProcessRunView.js',
__ctxPath+'/js/flow/ProcessRunDetail.js',
__ctxPath+'/js/flow/ProcessRunStart.js'
],
MyDoProcessRunView:[
__ctxPath+'/js/flow/MyDoProcessRunView.js',
__ctxPath+'/js/flow/ProcessRunDetail.js',
__ctxPath+'/js/flow/ProcessRunStart.js'
],
MyTaskView:[
__ctxPath+'/js/flow/MyTaskView.js',
__ctxPath+'/js/flow/ChangeTaskView.js',
__ctxPath+'/js/flow/ProcessNextForm.js'
],
BookManageView:[
__ctxPath+'/js/admin/BookManageView.js',
__ctxPath+'/js/admin/BookView.js',
__ctxPath+'/js/admin/BookForm.js',
__ctxPath+'/js/admin/BookTypeForm.js'],
BookTypeView:[
__ctxPath+'/js/admin/BookTypeView.js',
__ctxPath+'/js/admin/BookTypeForm.js'],
BookBorrowView:[
__ctxPath+'/js/admin/BookBorrowView.js',
__ctxPath+'/js/admin/BookBorrowForm.js',
__ctxPath+'/js/admin/BookReturnForm.js'],
BookReturnView:[
__ctxPath+'/js/admin/BookReturnView.js',
__ctxPath+'/js/admin/BookReturnForm.js',
__ctxPath+'/js/admin/BookBorrowForm.js'],
OfficeGoodsManageView: [
__ctxPath+'/js/admin/OfficeGoodsManageView.js',
__ctxPath+'/js/admin/OfficeGoodsTypeForm.js',
__ctxPath+'/js/admin/OfficeGoodsView.js',
__ctxPath+'/js/admin/OfficeGoodsForm.js'],
InStockView:[
__ctxPath+'/js/admin/InStockView.js',
__ctxPath+'/js/admin/InStockForm.js'],
GoodsApplyView:[
__ctxPath+'/js/admin/GoodsApplyView.js',
__ctxPath+'/js/admin/GoodsApplyForm.js'],
CarView:[
__ctxPath+'/js/admin/CarView.js',
__ctxPath+'/js/admin/CarForm.js'],
CartRepairView:[
__ctxPath+'/js/admin/CartRepairView.js',
__ctxPath+'/js/admin/CartRepairForm.js'],
CarApplyView:[
__ctxPath+'/js/admin/CarApplyView.js',
__ctxPath+'/js/admin/CarApplyForm.js'],
AppointmentView:[
__ctxPath+'/js/task/AppointmentView.js',
__ctxPath+'/js/task/AppointmentForm.js'
],
CalendarPlanView:[
__ctxPath+'/js/task/CalendarPlanView.js',
__ctxPath+'/js/task/CalendarPlanForm.js',
__ctxPath+'/js/task/CalendarPlanFinishForm.js'
],
MyPlanTaskView:[
__ctxPath+'/js/task/CalendarPlanView.js',
__ctxPath+'/js/task/CalendarPlanForm.js',
__ctxPath+'/js/task/CalendarPlanFinishForm.js',
__ctxPath+'/ext3/ux/caltask/e2cs_zh_CN.js',
__ctxPath+'/ext3/ux/caltask/calendar.js',
__ctxPath+'/ext3/ux/caltask/scheduler.js',
__ctxPath+'/ext3/ux/caltask/monthview.js',
__ctxPath+'/ext3/ux/caltask/weekview.js',
__ctxPath+'/ext3/ux/caltask/dayview.js',
__ctxPath+'/ext3/ux/caltask/task.js',
__ctxPath+'/js/task/MyPlanTaskView.js'
],
PlanTypeView:[
__ctxPath+'/js/task/PlanTypeView.js',
__ctxPath+'/js/task/PlanTypeForm.js'
],
WorkPlanView:[
__ctxPath+'/js/task/WorkPlanView.js',
__ctxPath+'/js/task/WorkPlanForm.js'
],
CustomerView:[
__ctxPath+'/js/customer/CustomerView.js',
__ctxPath+'/js/customer/CustomerForm.js',
__ctxPath+'/js/customer/CusLinkmanForm.js'
],
CusLinkmanView:[
__ctxPath+'/js/customer/CusLinkmanView.js',
__ctxPath+'/js/customer/CusLinkmanForm.js'
],
FixedAssetsManageView:[
__ctxPath+'/js/admin/FixedAssetsManageView.js',
__ctxPath+'/js/admin/FixedAssetsView.js',
__ctxPath+'/js/admin/FixedAssetsForm.js',
__ctxPath+'/js/admin/AssetsTypeForm.js',
__ctxPath+'/js/admin/DepreWin.js'
],
DepreTypeView :[
__ctxPath+'/js/admin/DepreTypeForm.js',
__ctxPath+'/js/admin/DepreTypeView.js'
],
DepreRecordView:[
__ctxPath+'/js/admin/DepreRecordForm.js',
__ctxPath+'/js/admin/DepreRecordView.js'
],
CusConnectionView:[
__ctxPath+'/js/customer/CusConnectionView.js',
__ctxPath+'/js/customer/CusConnectionForm.js'
],
ProjectView:[
__ctxPath+'/js/customer/ProjectView.js',
__ctxPath+'/js/customer/ProjectForm.js'
],
ContractView:[
__ctxPath+'/js/customer/ContractView.js',
__ctxPath+'/js/customer/ContractForm.js',
__ctxPath+'/js/customer/ContractConfigView.js'
]
};
| JavaScript |
/**
* 图书选择器
*/
var BookSelector = {
/**
* @param callback
* 回调函数
* @param isSingle
* 是否单选
*/
getView : function(callback, isSingle) {
var treeBook = new Ext.tree.TreePanel({
title : '图书显示',
region : 'west',
width : 180,
height : 300,
split : true,
collapsible : true,
autoScroll : true,
bbar : new Ext.Toolbar({
items : [{
xtype : 'button',
iconCls : 'btn-refresh',
text : '刷新',
handler : function() {
treeBook.root.reload();
}
}, {
xtype : 'button',
text : '展开',
iconCls : 'btn-expand',
handler : function() {
treeBook.expandAll();
}
}, {
xtype : 'button',
text : '收起',
iconCls : 'btn-collapse',
handler : function() {
treeBook.collapseAll();
}
}]
}),
loader : new Ext.tree.TreeLoader({
url : __ctxPath
+ '/admin/treeBookType.do'
}),
root : new Ext.tree.AsyncTreeNode({
expanded : true
}),
rootVisible : false,
listeners : {
'click' : function(node) {
if (node != null) {
var books = Ext.getCmp('BookSelectorGrid');
var store = books.getStore();
store.proxy.conn.url = __ctxPath
+ '/admin/listBook.do';
store.baseParams = {
'Q_bookType.typeId_L_EQ' : node.id == 0
? null
: node.id
};
store.load({
params : {
start : 0,
limit : 12
}
});
}
}
}
});
// ---------------------------------start grid
// panel--------------------------------
var sm = null;
if (isSingle) {
var sm = new Ext.grid.CheckboxSelectionModel({
singleSelect : true
});
} else {
sm = new Ext.grid.CheckboxSelectionModel();
}
var cm = new Ext.grid.ColumnModel({
columns : [sm, new Ext.grid.RowNumberer(), {
header : 'typeId',
dataIndex : 'typeId',
hidden : true
}, {
header : "图书名称",
dataIndex : 'bookName',
width : 60
}]
});
var store = new Ext.data.Store({
proxy : new Ext.data.HttpProxy({
url : __ctxPath + '/admin/listBook.do'
}),
reader : new Ext.data.JsonReader({
root : 'result',
totalProperty : 'totalCounts',
id : 'bookId',
fields : [{
name : 'bookId',
type : 'int'
}, 'bookName']
}),
remoteSort : true
});
var gridPanel = new Ext.grid.GridPanel({
id : 'BookSelectorGrid',
width : 400,
height : 300,
region : 'center',
title : '图书列表',
store : store,
shim : true,
trackMouseOver : true,
disableSelection : false,
loadMask : true,
cm : cm,
sm : sm,
viewConfig : {
forceFit : true,
enableRowBody : false,
showPreview : false
},
// paging bar on the bottom
bbar : new Ext.PagingToolbar({
pageSize : 25,
store : store,
displayInfo : true,
displayMsg : '当前显示从{0}至{1}, 共{2}条记录',
emptyMsg : "当前没有记录"
})
});
store.load({
params : {
start : 0,
limit : 25
}
});
// --------------------------------end grid
// panel-------------------------------------
var formPanel = new Ext.FormPanel({
width : 400,
height : 30,
region : 'north',
frame : true,
id : 'BookForm',
layout : 'column',
defaults : {
xtype : 'label'
},
items : [{
text : '请输入查询条件:'
}, {
text : '图书名称'
}, {
xtype : 'textfield',
name : 'Q_bookName_S_LK'
}, {
xtype : 'button',
text : '查询',
iconCls : 'search',
handler : function() {
var searchPanel = Ext.getCmp('BookForm');
var grid = Ext.getCmp('BookSelectorGrid');
if (searchPanel.getForm().isValid()) {
searchPanel.getForm().submit({
waitMsg : '正在提交查询',
url : __ctxPath
+ '/admin/listBook.do',
success : function(formPanel, action) {
var result = Ext.util.JSON
.decode(action.response.responseText);
grid.getStore().loadData(result);
}
});
}
}
}]
});
var window = new Ext.Window({
title : '图书选择器',
width : 630,
height : 380,
layout : 'border',
border : false,
items : [treeBook, formPanel, gridPanel],
modal : true,
buttonAlign : 'center',
buttons : [{
iconCls : 'btn-ok',
text : '确定',
handler : function() {
var grid = Ext.getCmp('BookSelectorGrid');
var rows = grid.getSelectionModel().getSelections();
var bookIds = '';
var bookNames = '';
for (var i = 0; i < rows.length; i++) {
if (i > 0) {
bookIds += ',';
bookNames += ',';
}
bookIds += rows[i].data.bookId;
bookNames += rows[i].data.bookName;
}
if (callback != null) {
callback.call(this, bookIds, bookNames);
}
window.close();
}
}, {
text : '取消',
iconCls : 'btn-cancel',
handler : function() {
window.close();
}
}]
});
return window;
}
}; | JavaScript |
/**
* 部门选择器
*/
var DepSelector = {
/**
* @param callback 回调函数
* @param isSingle 是否单选
*/
getView : function(callback,isSingle) {
var treeDep = new Ext.tree.TreePanel({
title : '部门信息显示',
region : 'west',
width : 180,
height : 300,
split : true,
collapsible : true,
autoScroll : true,
bbar:new Ext.Toolbar({items:[{
xtype:'button',
iconCls:'btn-refresh',
text:'刷新',
handler:function(){
treeDep.root.reload();
}
},
{
xtype:'button',
text:'展开',
iconCls:'btn-expand',
handler:function(){
treeDep.expandAll();
}
},
{
xtype:'button',
text:'收起',
iconCls:'btn-collapse',
handler:function(){
treeDep.collapseAll();
}
}
]}),
loader : new Ext.tree.TreeLoader({
url : __ctxPath + '/system/listDepartment.do'
}),
root : new Ext.tree.AsyncTreeNode({
expanded : true
}),
rootVisible : false,
listeners : {
'click': function(node){
}
}
});
// ---------------------------------start grid
// panel--------------------------------
var sm=null;
if(isSingle){
var sm=new Ext.grid.CheckboxSelectionModel({singleSelect: true});
}else{
sm = new Ext.grid.CheckboxSelectionModel();
}
var cm = new Ext.grid.ColumnModel({
columns : [sm, new Ext.grid.RowNumberer(), {
header : 'depId',
dataIndex : 'depId',
hidden : true
}, {
header : "部门名称",
dataIndex : 'depName',
renderer:function(value,metadata,record){
var str='';
var level=record.data.depLevel;
if(level!=null&& !isNaN(level)){
for(var i=2;i<=level;i++){
str+='<img src="' + __ctxPath+ '/images/info/down.gif"/>';
}
}
str+=value;
return str;
},
width : 60
}]
});
var store = new Ext.data.Store({
proxy : new Ext.data.HttpProxy({
url : __ctxPath + '/system/selectDepartment.do'
}),
reader : new Ext.data.JsonReader({
root : 'result',
totalProperty : 'totalCounts',
id : 'depId',
fields : [{
name : 'depId',
type : 'int'
}, 'depName',{name:'depLevel',type:'int'}]
}),
remoteSort : true
});
var gridPanel = new Ext.grid.GridPanel({
id : 'DepSelectorGrid',
width : 400,
height : 300,
region : 'center',
title : '部门列表',
store : store,
shim : true,
trackMouseOver : true,
disableSelection : false,
loadMask : true,
cm : cm,
sm : sm,
viewConfig : {
forceFit : true,
enableRowBody : false,
showPreview : false
},
// paging bar on the bottom
bbar : new Ext.PagingToolbar({
pageSize : 25,
store : store,
displayInfo : true,
displayMsg : '当前显示从{0}至{1}, 共{2}条记录',
emptyMsg : "当前没有记录"
})
});
store.load({
params : {
start : 0,
limit : 25
}
});
// --------------------------------end grid
// panel-------------------------------------
var window = new Ext.Window({
title : '部门选择器',
width : 630,
height : 380,
layout:'border',
border:false,
items : [treeDep, gridPanel],
modal : true,
buttonAlign : 'center',
buttons : [{
iconCls:'btn-ok',
text : '确定',
handler : function() {
var grid = Ext.getCmp('DepSelectorGrid');
var rows = grid.getSelectionModel().getSelections();
var depIds = '';
var depNames = '';
for (var i = 0; i < rows.length; i++) {
if (i > 0) {
depIds += ',';
depNames += ',';
}
depIds += rows[i].data.depId;
depNames += rows[i].data.depName;
}
if (callback != null) {
callback.call(this, depIds, depNames);
}
window.close();
}
}, {
text : '取消',
iconCls:'btn-cancel',
handler : function() {
window.close();
}
}]
});
return window;
}
}; | JavaScript |
/**
* 角色选择器
*/
var RoleSelector = {
getView : function(callback,isSingle) {
var gridPanel = this.initGridPanel(isSingle);
var window = new Ext.Window({
title : '角色选择',
width : 630,
height : 380,
layout : 'fit',
border : false,
items : [gridPanel],
modal : true,
buttonAlign : 'center',
buttons : [{
iconCls : 'btn-ok',
text : '确定',
handler : function() {
var grid = Ext.getCmp('RoleSelectorGrid');
var rows = grid.getSelectionModel().getSelections();
var roleIds = '';
var roleNames = '';
for (var i = 0; i < rows.length; i++) {
if (i > 0) {
roleIds += ',';
roleNames += ',';
}
roleIds += rows[i].data.roleId;
roleNames += rows[i].data.roleName;
}
if (callback != null) {
callback.call(this, roleIds, roleNames);
}
window.close();
}
}, {
text : '取消',
iconCls : 'btn-cancel',
handler : function() {
window.close();
}
}]
});
return window;
},
initGridPanel : function(isSingle) {
var sm=null;
if(isSingle){
var sm=new Ext.grid.CheckboxSelectionModel({singleSelect: true});
}else{
sm = new Ext.grid.CheckboxSelectionModel();
}
var cm = new Ext.grid.ColumnModel({
columns : [sm, new Ext.grid.RowNumberer(), {
header : 'roleId',
dataIndex : 'roleId',
hidden : true
}, {
header : "角色名称",
dataIndex : 'roleName',
width : 60
}, {
header : "角色描述",
dataIndex : 'roleDesc',
width : 60
}]
});
var store = new Ext.data.Store({
proxy : new Ext.data.HttpProxy({
url : __ctxPath + '/system/listAppRole.do'
}),
reader : new Ext.data.JsonReader({
root : 'result',
totalProperty : 'totalCounts',
id : 'id',
fields : [{
name : 'roleId',
type : 'int'
}, 'roleName', 'roleDesc']
})
});
store.load({
params : {
start : 0,
limit : 25
}
});
var toolbar = new Ext.Toolbar({
id : 'AppRoleFootBar',
height : 30,
items : ['角色名称:', {
name : 'Q_roleName_S_LK',
xtype : 'textfield',
id:'Q_roleName_S_LK',
width : 200
},' ',{
xtype:'button',
iconCls:'btn-search',
text:'查询',
handler:function(){
var roleName=Ext.getCmp('Q_roleName_S_LK').getValue();
Ext.Ajax.request({
url:__ctxPath+'/system/listAppRole.do',
params:{Q_roleName_S_LK:roleName},
method:'post',
success:function(result,request){
var data=Ext.util.JSON.decode(result.responseText);
var grid=Ext.getCmp('RoleSelectorGrid');
grid.getStore().loadData(data);
},
failure:function(result,request){
//TODO
}
});
}
}
]
});
var grid = new Ext.grid.GridPanel({
id : 'RoleSelectorGrid',
tbar : toolbar,
store : store,
trackMouseOver : true,
disableSelection : false,
loadMask : true,
height : 360,
cm : cm,
sm : sm,
viewConfig : {
forceFit : true,
enableRowBody : false,
showPreview : false
},
bbar : new Ext.PagingToolbar({
pageSize : 25,
store : store,
displayInfo : true,
displayMsg : '当前显示从{0}至{1}, 共{2}条记录',
emptyMsg : "当前没有记录"
})
});
return grid;
}
}; | JavaScript |
/**
* 车辆选择器
*/
var CarSelector = {
/**
* @param callback
* 回调函数
* @param isSingle
* 是否单选
* @param status
* 状态:1,可用;2,维修中,3,报废
*/
getView : function(callback, isSingle,status) {
// ---------------------------------start grid
// panel--------------------------------
var sm = null;
if (isSingle) {
var sm = new Ext.grid.CheckboxSelectionModel({
singleSelect : true
});
} else {
sm = new Ext.grid.CheckboxSelectionModel();
}
var cm = new Ext.grid.ColumnModel({
columns : [sm, new Ext.grid.RowNumberer(), {
header : 'carId',
dataIndex : 'carId',
hidden : true
}, {
header : "车辆车牌号",
dataIndex : 'carNo',
width : 60
}]
});
var store = new Ext.data.Store({
proxy : new Ext.data.HttpProxy({
url : __ctxPath + '/admin/listCar.do'
}),
reader : new Ext.data.JsonReader({
root : 'result',
totalProperty : 'totalCounts',
id : 'carId',
fields : [{
name : 'carId',
type : 'int'
}, 'carNo']
}),
remoteSort : true
});
var gridPanel = new Ext.grid.GridPanel({
id : 'CarSelectorGrid',
width : 400,
height : 300,
region : 'center',
title : '车辆列表',
store : store,
shim : true,
trackMouseOver : true,
disableSelection : false,
loadMask : true,
cm : cm,
sm : sm,
viewConfig : {
forceFit : true,
enableRowBody : false,
showPreview : false
},
// paging bar on the bottom
bbar : new Ext.PagingToolbar({
pageSize : 25,
store : store,
displayInfo : true,
displayMsg : '当前显示从{0}至{1}, 共{2}条记录',
emptyMsg : "当前没有记录"
})
});
store.load({
params : {
start : 0,
limit : 10,
'Q_status_SN_EQ':status
}
});
// --------------------------------end grid
// panel-------------------------------------
var formPanel = new Ext.FormPanel({
width : 400,
height : 30,
region : 'north',
frame : true,
id : 'CarSearchForm',
layout : 'column',
defaults : {
xtype : 'label'
},
items : [{
text : '请输入查询条件:'
}, {
text : '车辆车牌号'
}, {
xtype : 'textfield',
name : 'Q_carNo_S_LK'
}, {
xtype : 'button',
text : '查询',
iconCls : 'search',
handler : function() {
var searchPanel = Ext.getCmp('CarSearchForm');
var grid = Ext.getCmp('CarSelectorGrid');
if (searchPanel.getForm().isValid()) {
searchPanel.getForm().submit({
waitMsg : '正在提交查询',
url : __ctxPath
+ '/admin/listCar.do',
params : {
start : 0,
limit : 10,
'Q_status_SN_EQ':status
},
method:'post',
success : function(formPanel, action) {
var result = Ext.util.JSON
.decode(action.response.responseText);
grid.getStore().loadData(result);
}
});
}
}
}]
});
var window = new Ext.Window({
title : '车辆选择器',
width : 630,
height : 380,
layout : 'border',
border : false,
items : [formPanel, gridPanel],
modal : true,
buttonAlign : 'center',
buttons : [{
iconCls : 'btn-ok',
text : '确定',
handler : function() {
var grid = Ext.getCmp('CarSelectorGrid');
var rows = grid.getSelectionModel().getSelections();
var carIds = '';
var carNos = '';
for (var i = 0; i < rows.length; i++) {
if (i > 0) {
carIds += ',';
carNos += ',';
}
carIds += rows[i].data.carId;
carNos += rows[i].data.carNo;
}
if (callback != null) {
callback.call(this, carIds, carNos);
}
window.close();
}
}, {
text : '取消',
iconCls : 'btn-cancel',
handler : function() {
window.close();
}
}]
});
return window;
}
}; | JavaScript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.