You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

606 lines
20 KiB

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="org.wdk.WDKConstant"%>
<%@ page import="org.wdk.WDKCore"%>
<%@ page import="org.wdk.WDK"%>
<%@ page import="com.noblelift.imp.platform.module.portal.source.SessionUser"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
String WDK_ROOT = WDKCore.WDK_ROOT;
SessionUser su = (SessionUser)WDK.getSessionUser(request, response);
WDK.writeSessionUser(out, su);
%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- 上述3个meta标签*必须*放在最前面,任何其他内容都*必须*跟随其后! -->
<base href="<%=basePath%>" target="_self">
<title>应用云平台-功能注册(新增)</title>
<style type="text/css">
</style>
<script type="text/javascript" src="<%=WDK_ROOT%>/theme/je/core/js/wdk.js"></script>
<script type="text/javascript">
<% if(null==su){%>
$.timeout();
<%}%>
</script>
</head>
<body class="easyui-layout" data-options="fit:true">
<div data-options="region:'north',border:false,collapsed:false" class="page-title" style="height:45px;line-height:35px;">
<div class="page-title-text"></div>
<div class="page-toolbar">
<a href="javascript:void(0);" id="btnsave" class="easyui-linkbutton" data-options="iconCls:'fa fa-save'" onclick="opt_save()">保存</a>
<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'fa fa-window-close'" onclick="opt_close()">关闭</a>
</div>
</div>
<div data-options="region:'center',border:true,collapsed:false" >
<div class="edit-container-win1">
<form id="functionform" style="width:95%;align:center;">
<input type="hidden" id="app_uuid" name="app_uuid" class="txt">
<input type="hidden" id="func_uuid" name="func_uuid" class="txt">
<!-- <input type="hidden" id="parent_uuid" name="parent_uuid" class="txt"> -->
<div class="row">
<div class="formgroup ">
<label class="required">功能编码:</label>
<div>
<input type="text" class="easyui-validatebox nospaceinside" data-options="required:true,validType:'length[2,20]',tipPosition:'bottom'"id="func_code" name="func_code" value=""/>
</div>
</div>
</div>
<div class="row">
<div class="formgroup">
<label class="required">功能名称</label>
<div>
<input type="text" class="easyui-validatebox nospaceinside" data-options="required:true,validType:'length[2,20]',tipPosition:'bottom'" name="func_name" id="func_name" placeholder="">
</div>
</div>
</div>
<div class="row">
<div class="formgroup ">
<label>功能简称</label>
<div>
<input type="text" class="easyui-validatebox nospaceinside" id="short_name" name="short_name" value=""/>
</div>
</div>
</div>
<!-- <div class="row">
<div class="formgroup ">
<label class="required">功能编码</label>
<div>
<input type="text" class="easyui-validatebox nospaceinside" data-options="required:true,validType:['isNumber','length[2,20]'],tipPosition:'bottom'" id="func_code" name="func_code" value=""/>
</div>
</div>
</div> -->
<div class="row" id="parent_div" >
<div class="formgroup ">
<label>上级目录</label>
<div>
<input type="text" class="easyui-validatebox nospaceinside" id="parent_uuid" name="parent_uuid" value=""/>
</div>
</div>
</div>
<div class="row">
<div class="formgroup ">
<label class="required">功能类型</label>
<div>
<input type="text" class="easyui-validatebox nospaceinside" id="func_type_scode" name="func_type_scode" value=""/>
</div>
</div>
</div>
<div class="row" id="package_func_div">
<div class="formgroup ">
<label id="package_label" >对应应用包功能</label>
<div>
<input type="text" class="easyui-validatebox nospaceinside" id="package_func_uuid" name="package_func_uuid" value=""/>
</div>
</div>
</div>
<div class="row" id="is_system_div">
<div class="formgroup ">
<label>是否系统菜单</label>
<div>
<input type="text" class="easyui-validatebox nospaceinside" id="is_system" name="is_system" value=""/>
</div>
</div>
</div>
<div class="row" id="ico_index_div">
<div class="formgroup ">
<label>功能图标</label>
<div>
<input type="text" class="easyui-validatebox nospaceinside" id="ico_index" name="ico_index" value=""/>
</div>
</div>
</div>
<div class="row" id="select_ico_index_div">
<div class="formgroup ">
<label>选中的功能图标</label>
<div>
<input type="text" class="easyui-validatebox nospaceinside" id="select_ico_index" name="select_ico_index" value=""/>
</div>
</div>
</div>
<div class="row">
<div class="formgroup ">
<label>是否分析类菜单</label>
<div>
<input id="is_anal_menu" name="is_anal_menu" >
</div>
</div>
</div>
<div class="row">
<div class="formgroup ">
<label class="required">是否启用</label>
<div>
<input id="is_active" name="is_active" >
</div>
</div>
</div>
<div class="row">
<div class="formgroup ">
<label>描述</label>
<div>
<textarea class="" name="remark" id="remark" rows="3" style="width:100%;"></textarea>
</div>
</div>
</div>
<div class="row" style="padding-top: 5px;">
<div class="formgroup ">
<label>排序</label>
<div>
<input type="text" class="easyui-validatebox nospaceinside" id="display_order" name="display_order" onKeypress="javascript:if(event.keyCode == 32)event.returnValue = false;" pattern="[0-9]"/>
</div>
</div>
</div>
</form>
</div>
</div>
</body>
<script>
var _wid = $.getURLParam('wid');
var param = $.getURLParam('param');
var jparam = $.str2json($.urlparam_decode(param));
//alert("param="+$.urlparam_decode(param));
var _actionflag = jparam.queryParams.actionflag; //操作标识:add-添加、mdf-修改
var _app_uuid = jparam.queryParams.app_uuid; //添加时,功能所属应用标识
var _func_uuid = jparam.queryParams.func_uuid; //修改时被修改功能标识
var _parent_uuid = jparam.queryParams.parent_uuid;//新增时上级功能标识
$(function() {
if("mdf"==_actionflag || "detail"==_actionflag){
//修改、或查看
$.wait_open();
$.cuajax({
url:'wdk?action=portal.app&method=fundetail&ajaxparam='+new Date().getTime()
,method:"post"
,timeout:WDK_Timeout
,data:{
func_uuid:_func_uuid
}
,success:function(result) {
$.wait_close();
//alert("_func_uuid="+_func_uuid+",result="+result);
var jres = $.str2json(result);
if(jres.code=='1'){
if(jres.data){
//查询上级功能信息,取得上级的功能类型
parentinfo(jres.data.parent_uuid,function(data){
if(data){
//初始化功能类型选择项
init_func_type(data.func_type_scode);
//默认选择功能类型的第一个值,并触发界面显示控制
//functypeChange($.combobox_getValue("#func_type_scode"));
}
//将数据填充到表单中
$.setFieldValue(jres.data, "#functionform");
$('#ico_index').combobox('setValue', jres.data.ico_index);
init_radio('is_active',jres.data.is_active,false);
init_radio('is_system',jres.data.is_system,false);
init_radio('is_anal_menu',jres.data.is_anal_menu,false);
functypeChange($.combobox_getValue({id:"func_type_scode"}));
//初始化应用包
init_package_func_uuid(jres.data.package_func_uuid,jres.data.package_func_uuidname,data.package_func_uuid);
});
//隐藏上级菜单
if(jres.data.func_type_scode != "04"){
$("#parent_div").hide();
}
//初始化应用包
//init_package_func_uuid(jres.data.package_func_uuid,jres.data.package_func_uuidname);
}
} else{
alert(jres.desc);
}
}
,error:function(result){
$.wait_close();
alert('网络错误!result='+result);
}
});
} else{
$("#parent_div").hide();
//新增
if(""==_parent_uuid) _parent_uuid = "-1";
$("#func_uuid").val($.getUUID());
$("#app_uuid").val(_app_uuid);
$("#display_order").val("100");
$("#parent_uuid").val(_parent_uuid);
if(_parent_uuid=="-1"){
//增加顶级节点
init_func_type("");
//默认选择功能类型的第一个值,并触发界面显示控制
functypeChange($.combobox_getValue({id:"func_type_scode"}));
}else{
//增加非顶级节点
parentinfo(_parent_uuid,function(data){
if(data){
//初始化功能类型选择项
init_func_type(data.func_type_scode);
//默认选择功能类型的第一个值,并触发界面显示控制
functypeChange($.combobox_getValue({id:"func_type_scode"}));
init_package_func_uuid('','',data.package_func_uuid);
}
});
}
init_radio('is_active','1',false);
init_radio('is_system','0',false);
init_radio('is_anal_menu','0',false);
}
var dataParam = {
_SRVNAME: 'service.portal.app',
_SRVMETHOD: 'queryAllFunList',
_DATA: $.json2str({
app_uuid: _app_uuid,
parent_uuid: '',
resultfields: '',
orderfields:""
}),
_RSFIELD: 'function_info',
_RSTYPE: 'combotree',
_RSPARAM: $.json2str({
idField: 'func_uuid'
,textField: 'func_name'
,parentField: 'parent_uuid'
,asyn:'0' //是否是异步 0:同步;1:异步
//,asyn_dataField:'parentid' //如果是异步,则从url中取出的参数替换_DATA参数的名
})
};
$('#ico_index').combobox({
data:[{
id: 'iconfont icon-cang',
text: 'iconfont icon-cang',
icon: 'icon-cang.png'
},{
id: 'iconfont icon-ding',
text: 'iconfont icon-ding',
icon: 'icon-ding.png'
},{
id: 'iconfont icon-huo1',
text: 'iconfont icon-huo1',
icon: 'icon-huo1.png'
},{
id: 'iconfont icon-huo2',
text: 'iconfont icon-huo2',
icon: 'icon-huo2.png'
},{
id: 'iconfont icon-huo3',
text: 'iconfont icon-huo3',
icon: 'icon-huo3.png'
},{
id: 'iconfont icon-jin',
text: 'iconfont icon-jin',
icon: 'icon-jin.png'
},{
id: 'iconfont icon-ke1',
text: 'iconfont icon-ke1',
icon: 'icon-ke1.png'
},{
id: 'iconfont icon-pin1',
text: 'iconfont icon-pin1',
icon: 'icon-pin1.png'
},{
id: 'iconfont icon-pin2',
text: 'iconfont icon-pin2',
icon: 'icon-pin2.png'
},{
id: 'iconfont icon-she',
text: 'iconfont icon-she',
icon: 'icon-she.png'
},{
id: 'iconfont icon-shi2',
text: 'iconfont icon-shi2',
icon: 'icon-shi2.png'
},{
id: 'iconfont icon-shi3',
text: 'iconfont icon-shi3',
icon: 'icon-shi3.png'
},{
id: 'iconfont icon-shu',
text: 'iconfont icon-shu',
icon: 'icon-shu.png'
},{
id: 'iconfont icon-xi2',
text: 'iconfont icon-xi2',
icon: 'icon-xi2.png'
},{
id: 'iconfont icon-xiao',
text: 'iconfont icon-xiao',
icon: 'icon-xiao.png'
},{
id: 'iconfont icon-yang',
text: 'iconfont icon-yang',
icon: 'icon-yang.png'
},{
id: 'iconfont icon-zhi',
text: 'iconfont icon-zhi',
icon: 'icon-zhi.png'
},{
id: 'iconfont icon-zhong',
text: 'iconfont icon-zhong',
icon: 'icon-zhong.png'
}
],
valueField:'id',
textField:'text',
formatter:function(row){
var imageFile = 'wdk/theme/je/core/images/menuicon/'+ row.icon;
return '<img class="item-img" src="'+imageFile+'"/> <span class="item-text">'+row.text+'</span>';
}
});
$.combotree({
id:"parent_uuid",
checkbox: false,
expandall: false,
cascadeCheck: false,
asyn: true,
tipPosition:'bottom',
multiple:false,
onlyLeafCheck:true,
url:'wdk?action=wdk.pub&method=call_service&ajaxparam='+new Date().getTime(),
queryParams:dataParam,
onClick:function(node){
var tree = $('#parent_uuid').combotree('tree');
var parent = tree.tree('getParent', node.target);
if(node.state){
$('#parent_uuid').combotree('clear');
alert("只能选择子菜单!");
}
},
onLoadSuccess : function(data){
$('#parent_uuid').combotree('tree').tree("expandAll");
$('#parent_uuid').combotree('setValue', _parent_uuid);
}
});
});
/**
* 初始化单选框
*/
function init_radio(id,initvalue,disabled){
$.radio({
id: id,
initvalue: initvalue,
disabled:disabled,
data:[{id:"1",text:"是"},
{id:"0",text:"否"}
]
});
}
/**
* 初始化应用包
*/
function init_package_func_uuid(initid,inittext,pid){
$.inputpop({
id:'package_func_uuid',
type:'tree',
title:'应用包',
width:320,
height:480,
editable:false,
required:false,
checkbox:false,
asyn:true,
initid: initid,
inittext: inittext,
initvalue:initid,
dataurl:"wdk?action=portal.app&method=pkgfunTree&ajaxparam="+new Date().getTime(),
queryParams:{
rootid:pid
},
onBeforeOpen:'',
callback:function(jparam){
$.inputpop_setValue ({
id:'package_func_uuid',
value_id:jparam.value_id,
value_text:jparam.value_text,
value_value:jparam.value_text
});
}
});
}
//查询上级功能的功能类型信息,查询结果经回调放法回传
//返回参数格式 {func_type_uuid:'01'}
function parentinfo(parent_func_uuid,callback){
if(""==parent_func_uuid || "-1"==parent_func_uuid){
callback({
func_type_scode:''
,package_func_uuid:''
});
}else{
$.wait_open();
$.cuajax({
url:'wdk?action=portal.app&method=fundetail&ajaxparam='+new Date().getTime()
,method:"post"
,timeout:WDK_Timeout
,data:{
func_uuid:parent_func_uuid
}
,success:function(result){
$.wait_close();
var jres = $.str2json(result);
if(jres.code=='1'){
if(jres.data){
callback({
func_type_scode:jres.data.func_type_scode
,package_func_uuid:jres.data.package_func_uuid
});
}
}
}
,error:function(result){
$.wait_close();
alert('网络错误!result='+result);
}
});
}
}
//初始化功能类别(传入参数为上级的功能类别)
function init_func_type(parent_func_type){
var data = [];
var initvalue = "";
if(parent_func_type=="" || parent_func_type=="01"){
data.push({id:'02',text:'子系统'});
data.push({id:'03',text:'模块'});
data.push({id:'04',text:'功能菜单'});
initvalue = "02";
}else if(parent_func_type=="02"){
data.push({id:'02',text:'子系统'});
data.push({id:'03',text:'模块'});
data.push({id:'04',text:'功能菜单'});
initvalue = "03";
}else if(parent_func_type=="03"){
data.push({id:'02',text:'子系统'});
data.push({id:'03',text:'模块'});
data.push({id:'04',text:'功能菜单'});
initvalue = "04";
}else if(parent_func_type=="04"){
data.push({id:'05',text:'按钮'});
initvalue = "05";
}
$.combobox({
id:"func_type_scode"
,data:data
//,width:$('#func_type_scode').css('width')
,initvalue:initvalue
,onChange:function(newValue, oldValue){
//alert("newValue="+newValue+",oldValue="+oldValue);
functypeChange(newValue);
}
});
}
//功能类型发生变化
function functypeChange(func_type){
//alert("functypeChange="+func_type);
if(func_type=="" || func_type=="02"){
//子系统
$("#package_func_div").css('display','none');
$("#is_system_div").css('display','none');
$("#ico_index_div").css('display','block');
$("#select_ico_index_div").css('display','block');
}else if(func_type=="03"){
//模块
$("#package_func_div").css('display','none');
$("#is_system_div").css('display','none');
$("#ico_index_div").css('display','block');
$("#select_ico_index_div").css('display','block');
}else if(func_type=="04"){
//功能菜单
$("#package_func_div").css('display','block');
$("#is_system_div").css('display','block');
$("#ico_index_div").css('display','block');
$("#select_ico_index_div").css('display','block');
//$("#package_func_uuid").attr("data-options","required:true");
$("#package_label").addClass('required');
}else if(func_type=="05"){
//按钮
$("#package_func_div").css('display','block');
$("#is_system_div").css('display','none');
$("#ico_index_div").css('display','none');
$("#select_ico_index_div").css('display','none');
}
}
//保存应用
function opt_save(){
//验证
var isok = $("#functionform").form('validate');
if(!isok){
alert('尚有必填项未填或输入有误,请检查后提交');
return false;
}
//打开旋转
$.wait_open();
//获取所有input和textarea 的输入值
var mainFieldValues = $.getFieldValue({formid:'functionform'});
mainFieldValues.is_active = $("input:radio[name='is_active']:checked").val();
mainFieldValues.is_system = $("input:radio[name='is_system']:checked").val();
var parent_uuid = $("#parent_uuid").combotree('getValue');
if("mdf"==_actionflag || "detail"==_actionflag){
if(!parent_uuid){
parent_uuid = "-1";
}
mainFieldValues.parent_uuid = parent_uuid;
}else{
mainFieldValues.parent_uuid = _parent_uuid;
}
//保存
var _param = {
actionflag:_actionflag,
_FILEDVALUE:$.json2str(mainFieldValues)
};
$.wait_open();
$.cuajax({
url:'wdk?action=portal.app&method=savefun&ajaxparam='+new Date().getTime(),
method:"post",
data:_param,
success:function(result) {
$.wait_close();
var jres = $.str2json(result);
alert(jres.desc);
if(parent_uuid != _parent_uuid){
mainFieldValues.changeParent = true;
}
if(jres.code=="1"){
opt_close(mainFieldValues);
}
},
error:function(result){
$.wait_close();
alert('网络错误!result='+result);
}
});
}
// 关闭模态框
function opt_close(v){
if(v){
$.setWinReturn(_wid,v);
}
$.closeWin(_wid);
}
</script>
</html>