Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
vm.maven.page_js.vm Maven / Gradle / Ivy
// JavaScript Document
/**
* $!{tablePdmXml.name}管理界面
* @type
*/
$!{tablePdmXml.className}Panel = {
version: '1.0',
/**
* $!{tablePdmXml.name}数据
* @type Ext.data.Store
*/
$!{className}Store: null,
/**
* 链接:/$!{className}/{0}.do?txnCode=$!{txnCodePrefix}_{1}
*/
URL_ACTION: '/$!{className}/{0}.do?txnCode=$!{txnCodePrefix}_{1}',
/**
* 标题:$!{tablePdmXml.name}列表
* @type String
*/
TITLE_LIST: '$!{tablePdmXml.name}列表',
/**
* 标题:新增$!{tablePdmXml.name}
* @type String
*/
TITLE_ADD: '新增$!{tablePdmXml.name}',
/**
* 标题:复制$!{tablePdmXml.name}
* @type String
*/
TITLE_COPY: '复制$!{tablePdmXml.name}',
/**
* 标题:修改$!{tablePdmXml.name}
* @type String
*/
TITLE_UPDATE: '修改$!{tablePdmXml.name}',
/**
* 标题:查看$!{tablePdmXml.name}
* @type String
*/
TITLE_VIEW: '查看$!{tablePdmXml.name}',
/**
* 提示信息:没有调入任何参数!
* @type String
*/
MSG_ERR_PARAMS_NULL: '没有调入任何参数!',
/**
* 提示信息:缺少字段信息!
* @type String
*/
MSG_ERR_MODEL_STORE_NULL: '缺少字段信息!',
#foreach($columnPdmXml in $dictionaryList)
/**
* 提示信息:$!{columnPdmXml.name}的Json数据为空!
* @type String
*/
MSG_ERR_JSONDATA_${columnPdmXml.code.toUpperCase()}_NULL: '$!{columnPdmXml.name}的Json数据为空!',
#end
/**
* 对象信息:$!{tablePdmXml.name}
* @type Ext.data.ArrayStore
*/
MODEL_STORE_$!{tablePdmXml.className.toUpperCase()}: null,
#foreach($columnPdmXml in $dictionaryList)
/**
* Json数据:$!{columnPdmXml.name}类型
* @type json
*/
JSONDATA_$!{columnPdmXml.code.toUpperCase()}: [],
#end
/**
* 是否允许查看详细页面
* @type Boolean
*/
IS_VIEW: null,
/**
* 动态表单控件
* @type DevUtil.DynamicForm
*/
dynamicForm: null,
/**
* 已选定记录的编号
* @type String
*/
selectedId: null,
#set($columnLength = 0)
#foreach($columnPdmXml in $dictionaryList)
#set($codeLength = $columnPdmXml.code.length())
#if($columnLength < $codeLength)
#set($columnLength = $codeLength)
#end
#end
#set($columnLength = $columnLength + 9)
#set($exSpace = "")
#set($spaceLength = 12)
#if($columnLength > 11)
#set($spaceLength = $columnLength+2)
#end
#set($length = $spaceLength - 12)
#foreach($i in [1..$length])
#set($exSpace = $exSpace + " ")
#end
/**
* 初始化
* @param {Object} params $!{exSpace}传入参数
* @param {Ext.data.Store} params.model_store$!{exSpace}字段信息数据源
#foreach($columnPdmXml in $dictionaryList)
#set($length = $spaceLength - $columnPdmXml.code.length() - 10)
#set($spaceNum = "")
#foreach($i in [1..$length])
#set($spaceNum = $spaceNum + " ")
#end
* @param {json} params.jsonData_$!{columnPdmXml.code}$!{spaceNum}Json数据:$!{columnPdmXml.name}
#end
* @param {Boolean} params.is_view $!{exSpace}是否允许查看详细页面
*/
init: function(params){
if (params == null){
alert($!{tablePdmXml.className}Panel.MSG_ERR_PARAMS_NULL);
throw $!{tablePdmXml.className}Panel.MSG_ERR_PARAMS_NULL;
}
else if (params.model_store.getCount() == 0){
alert($!{tablePdmXml.className}Panel.MSG_ERR_MODEL_STORE_NULL);
throw $!{tablePdmXml.className}Panel.MSG_ERR_MODEL_STORE_NULL;
}
#foreach($columnPdmXml in $dictionaryList)
else if (params.jsonData_$!{columnPdmXml.code} == null){
alert($!{tablePdmXml.className}Panel.MSG_ERR_JSONDATA_$!{columnPdmXml.code.toUpperCase()}_NULL);
throw $!{tablePdmXml.className}Panel.MSG_ERR_JSONDATA_$!{columnPdmXml.code.toUpperCase()}_NULL;
}
#end
else{
Ext.QuickTips.init();
$!{tablePdmXml.className}Panel.URL_ACTION = DevUtil.contextPath + $!{tablePdmXml.className}Panel.URL_ACTION;
#foreach($columnPdmXml in $dictionaryList)
$!{tablePdmXml.className}Panel.JSONDATA_$!{columnPdmXml.code.toUpperCase()} = params.jsonData_$!{columnPdmXml.code};
#end
$!{tablePdmXml.className}Panel.IS_VIEW = params.is_view == null ? false : params.is_view;
$!{tablePdmXml.className}Panel.MODEL_STORE_$!{tablePdmXml.className.toUpperCase()} = params.model_store;
}
},
#set($columnLength = 0)
#foreach($columnPdmXml in $dictionaryList)
#if($columnLength < $columnPdmXml.code.length())
#set($columnLength = $columnPdmXml.code.length())
#end
#end
#set($columnLength = $columnLength + 9)
#set($exSpace = "")
#set($spaceLength = 17)
#if($columnLength > 15)
#set($spaceLength = $columnLength+2)
#end
#set($length = $spaceLength - 16)
#foreach($i in [1..$length])
#set($exSpace = $exSpace + " ")
#end
/**
* 绘画
* @param {Object} params $!{exSpace}传入参数
* @param {Ext.data.Store} params.model_store $!{exSpace}字段信息数据源
* @param {Ext.data.Store} params.quickSearchText$!{exSpace}快查文字信息
#foreach($columnPdmXml in $dictionaryList)
#set($length = $spaceLength - $columnPdmXml.code.length() - 10)
#set($spaceNum = "")
#foreach($i in [1..$length])
#set($spaceNum = $spaceNum + " ")
#end
* @param {json} params.jsonData_$!{columnPdmXml.code}$!{spaceNum}Json数据:$!{columnPdmXml.name}
#end
* @param {Boolean} params.is_view $!{exSpace}是否允许查看详细页面
*/
render: function(params){
$!{tablePdmXml.className}Panel.init(params);
#set($comma = "")
#if($isSort)
#set($comma = ",")
#end
$!{tablePdmXml.className}Panel.$!{className}Store = new Ext.data.Store({
remoteSort: true, autoLoad: {params:{start: 0, limit: DevUtil.pageSize}},
proxy: new Ext.data.HttpProxy({
url: String.format($!{tablePdmXml.className}Panel.URL_ACTION, 'search', 'SEARCH'), method: 'POST'
}),
reader: new Ext.data.JsonReader({
id: 'id', root: 'results', totalProperty: 'totalCount'
}, DevUtil.createDataRecord($!{tablePdmXml.className}Panel.MODEL_STORE_$!{tablePdmXml.className.toUpperCase()}))$comma
#if($isSort)
listeners:{
'load': function(){
var btn = Ext.getCmp('$!{className}SortBtn');
if (btn) btn.setDisabled($!{tablePdmXml.className}Panel.$!{className}Store.getCount()==0);
}
}
#end
});
var sm = new Ext.grid.CheckboxSelectionModel({
listeners:{
'selectionchange': function(sm){
var records = sm.getSelections();
var isDisabled = (!records || records.length != 1);
var btnIds = ['$!{className}CopyBtn','$!{className}UpdateBtn'];
for(var i = 0, len = btnIds.length; i < len; i++){
var btn = Ext.getCmp(btnIds[i]);
if (btn) btn.setDisabled(isDisabled);
}
$!{tablePdmXml.className}Panel.selectedId = records.length > 0 ? records[0].get('$!{pkCoumnCode}') : null;
if (records){
#set($btnIds = "")
#if($isStatus)
#set($btnIds = ",'"+$className+"StatusBtn'")
#end
isDisabled = records.length == 0;
btnIds = ['$!{className}DelBtn'$!{btnIds}];
for(var i = 0, len = btnIds.length; i < len; i++){
var btn = Ext.getCmp(btnIds[i]);
if (btn) btn.setDisabled(isDisabled);
}
}
}
}
});
var modelLblNameObj = DevUtil.getModelLblNameObj($!{tablePdmXml.className}Panel.MODEL_STORE_$!{tablePdmXml.className.toUpperCase()});
var cm = new Ext.grid.ColumnModel({
defaults:{
width: 200, autoWidth: true
},
columns:[ sm,
#set($isFrist = true)
#foreach($columnPdmXml in $tablePdmXml.columnPdmXmlList)
#if($columnPdmXml.code.toLowerCase().indexOf("id") < 0
&& $columnPdmXml.code != "createUser"
&& $columnPdmXml.code != "createTime"
&& $columnPdmXml.code != "modUser"
&& $columnPdmXml.code != "modTime"
&& $columnPdmXml.code != "remark")
#set($renderer = "")
#set($width = "")
#if($isFrist)
#set($isFrist = false)
#else
,
#end
#if($columnPdmXml.dictionary)
#set($width = " width: 100,")
#if($columnPdmXml.code == "status")
#set($renderer = ", renderer:DevUtil.renderValue("+$!{tablePdmXml.className}+"Panel.JSONDATA_"+$!{columnPdmXml.code.toUpperCase()}+", {columnName: 'status'})")
#else
#set($renderer = ", renderer:DevUtil.renderValue("+$!{tablePdmXml.className}+"Panel.JSONDATA_"+$!{columnPdmXml.code.toUpperCase()}+")")
#end
#end
{ header: modelLblNameObj.$!{columnPdmXml.code}, dataIndex: '$!{columnPdmXml.code}',$!{width} sortable: true$!{renderer} }
#end
#end
]});
var $!{className}Grid = new Ext.grid.GridPanel({
id:'$!{className}Grid_list', title: $!{tablePdmXml.className}Panel.TITLE_LIST,
store: $!{tablePdmXml.className}Panel.$!{className}Store, sm: sm, border: false, region: 'center',
width: DevUtil.getBodyWidth(), height: DevUtil.getBodyHeight(),
viewConfig : {
forceFit:true, loadingText : DevUtil.P.Msg.LOADMASK
},
loadMask: true, cm: cm, renderTo: Ext.getBody(),
tbar: new Ext.Toolbar({
id:'$!{className}Toolbar', enableOverflow: true, items: [
new Ext.ux.form.SearchField({
id:'$!{className}Searchfield', store: $!{tablePdmXml.className}Panel.$!{className}Store, hidden: !params.quickSearchText,
emptyText: DevUtil.P.Txt.QUICK_SEARCH + '(' + params.quickSearchText + ')'
}),'-',
{
text: DevUtil.P.BtnTxt.ADVANCED_SEARCH, iconCls: 'advancedSearch',
handler: function(){
var winId = 'win_$!{className}_Search';
var win = Ext.getCmp(winId);
if (!win){
win = new DevUtil.AdvancedSearch({
id: winId, searchfieldId: '$!{className}Searchfield',
winTitle: $!{tablePdmXml.className}Panel.TITLE_LIST,
ctrlStore: $!{tablePdmXml.className}Panel.MODEL_STORE_$!{tablePdmXml.className.toUpperCase()},
store: $!{tablePdmXml.className}Panel.$!{className}Store
});
}
win.show();
}
},'->']
}),
bbar: new Ext.PagingToolbar({
id: 'pagingToolbar', pageSize: DevUtil.pageSize, store: $!{tablePdmXml.className}Panel.$!{className}Store,
displayInfo: true, items:['-', new DevUtil.PageSizePlugin({
pagingToolbarId: 'pagingToolbar'
})]
}),
listeners:{
'rowdblclick' : function(grid, rowIndex, e){
if ($!{tablePdmXml.className}Panel.IS_VIEW){
var record = $!{tablePdmXml.className}Panel.$!{className}Store.getAt(rowIndex);
$!{tablePdmXml.className}Panel.createDynamicForm('view');
$!{tablePdmXml.className}Panel.dynamicForm.show({
action: 'view',
loadUrl: String.format($!{tablePdmXml.className}Panel.URL_ACTION, 'edit', 'EDIT'),
selectedId: record.get('id'),
title: $!{tablePdmXml.className}Panel.TITLE_VIEW
});
}
}
}
});
Ext.EventManager.onWindowResize(function(w, h){
if (w > 0 && h > 0){
$!{className}Grid.setSize(w, h);
}
});
},
/**
* 添加主页面顶部按钮
* @param {Object} btn 按钮参数
* @param {String} btn.id 按钮编号
* @param {String} btn.text 按钮名称
* @param {String} btn.iconCls 按钮图标
* @param {Boolean} btn.disabled 是否禁用按钮
* @param {String} btn.handler 按钮事件
*/
addToolBar: function(btn){
var toolBar = Ext.getCmp('$!{className}Toolbar');
toolBar.add('-');
toolBar.add({
id: btn.id, text: btn.text, iconCls: btn.iconCls,
disabled: btn.disabled ? btn.disabled : false,
handler: btn.handler
});
},
/**
* 创建表单对象
* @param {String} action 表单类型[save: 新增; copy: 复制; update: 编辑; view: 查看详细页面]
*/
createDynamicForm: function(action){
$!{tablePdmXml.className}Panel.dynamicForm = new DevUtil.DynamicForm({
action: action,
postUrl: String.format($!{tablePdmXml.className}Panel.URL_ACTION,
'copy' == action ? 'save' : action,
action.toUpperCase()),
columnStore: $!{tablePdmXml.className}Panel.MODEL_STORE_$!{tablePdmXml.className.toUpperCase()},
dataStore: $!{tablePdmXml.className}Panel.$!{className}Store
// ,beforCreateCtrlFn: function(ctrlName, action, formId, ctrlObj){
// }
});
},
/**
* 添加新增按钮
*/
addAddBtn: function(){
$!{tablePdmXml.className}Panel.addToolBar({
id: '$!{className}AddBtn',
text: DevUtil.P.BtnTxt.ADD,
iconCls: DevUtil.P.Icons.ADD,
handler: function(){
$!{tablePdmXml.className}Panel.createDynamicForm('save');
$!{tablePdmXml.className}Panel.dynamicForm.on('afterLoad', function(win){
#foreach($columnPdmXml in $dictionaryList)
Ext.getCmp(win.getId()+'_$!{columnPdmXml.code}').setValue(DevUtil.getDefaultValue($!{tablePdmXml.className}Panel.JSONDATA_$!{columnPdmXml.code.toUpperCase()}));
#end
});
$!{tablePdmXml.className}Panel.dynamicForm.show({
title: $!{tablePdmXml.className}Panel.TITLE_ADD
});
}
});
},
/**
* 添加复制按钮
*/
addCopyBtn: function(){
$!{tablePdmXml.className}Panel.addToolBar({
id: '$!{className}CopyBtn',
text: DevUtil.P.BtnTxt.COPY,
iconCls: DevUtil.P.Icons.COPY,
disabled: true,
handler: function(){
$!{tablePdmXml.className}Panel.createDynamicForm('copy');
$!{tablePdmXml.className}Panel.dynamicForm.show({
loadUrl: String.format($!{tablePdmXml.className}Panel.URL_ACTION, 'edit', 'EDIT'),
selectedId: $!{tablePdmXml.className}Panel.selectedId,
title: $!{tablePdmXml.className}Panel.TITLE_COPY
});
$!{tablePdmXml.className}Panel.dynamicForm.on('afterLoad', function(win){
Ext.getCmp(win.getId()+'_id').reset();
#foreach($columnPdmXml in $tablePdmXml.columnPdmXmlList)
#if(!$columnPdmXml.isPK && "String" == $!columnPdmXml.dataType)
var $!{columnPdmXml.code} = Ext.getCmp(win.getId()+'_$!{columnPdmXml.code}');
$!{columnPdmXml.code}.setValue($!{columnPdmXml.code}.getValue()+'_c');
#break
#end
#end
});
}
});
},
/**
* 添加修改按钮
*/
addUpdateBtn: function(){
$!{tablePdmXml.className}Panel.addToolBar({
id: '$!{className}UpdateBtn',
text: DevUtil.P.BtnTxt.UPDATE,
iconCls: DevUtil.P.Icons.UPDATE,
disabled: true,
handler: function(){
$!{tablePdmXml.className}Panel.createDynamicForm('update');
$!{tablePdmXml.className}Panel.dynamicForm.show({
loadUrl: String.format($!{tablePdmXml.className}Panel.URL_ACTION, 'edit', 'EDIT'),
selectedId: $!{tablePdmXml.className}Panel.selectedId,
title: $!{tablePdmXml.className}Panel.TITLE_UPDATE
});
}
});
},
#if($isSort)
/**
* 添加同级排序按钮
*/
addSortBtn: function(){
$!{tablePdmXml.className}Panel.addToolBar({
id: '$!{className}SortBtn',
text: DevUtil.P.BtnTxt.SORT,
iconCls: DevUtil.P.Icons.SORT,
disabled: true,
handler: function(){
if ($!{tablePdmXml.className}Panel.$!{className}Store.getCount()>0){
var id = $!{tablePdmXml.className}Panel.$!{className}Store.getAt(0).get('$!{pkCoumnCode}');
new DevUtil.SortData({
url: String.format($!{tablePdmXml.className}Panel.URL_ACTION, 'searchSort', 'SORT&id='+id),
postUrl: String.format($!{tablePdmXml.className}Panel.URL_ACTION, 'sort', 'SORT'),
store: $!{tablePdmXml.className}Panel.$!{className}Store
}).show();
}
}
});
},
#end
#if($isStatus)
/**
* 添加启用/禁用按钮
*/
addStatusBtn: function(){
$!{tablePdmXml.className}Panel.addToolBar({
id: '$!{className}StatusBtn',
text: DevUtil.P.BtnTxt.STATUS,
iconCls: DevUtil.P.Icons.STATUS,
disabled: true,
handler: function(){
DevUtil.updateStatusRecord({
url: String.format($!{tablePdmXml.className}Panel.URL_ACTION, 'status', 'STATUS'),
sm: Ext.getCmp('$!{className}Grid_list').getSelectionModel(),
store: $!{tablePdmXml.className}Panel.$!{className}Store
});
}
});
},
#end
/**
* 添加删除按钮
*/
addDelBtn: function(){
$!{tablePdmXml.className}Panel.addToolBar({
id: '$!{className}DelBtn',
text: DevUtil.P.BtnTxt.DEL,
iconCls: DevUtil.P.Icons.DEL,
disabled: true,
handler: function(){
DevUtil.deleteRecord({
url: String.format($!{tablePdmXml.className}Panel.URL_ACTION, 'delete', 'DELETE'),
sm: Ext.getCmp('$!{className}Grid_list').getSelectionModel(),
store: $!{tablePdmXml.className}Panel.$!{className}Store
});
}
});
}
}