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.

489 lines
15 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-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="func_uuid" name="func_uuid" class="txt">
<input type="hidden" id="pack_uuid" name="pack_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" name="func_name" data-options="required:true,validType:'length[2,20]',tipPosition:'bottom'"id="func_name" placeholder="">
</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>功能简称</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>功能类型</label>
<div>
<input type="text" class="easyui-validatebox nospaceinside" id="func_type" name="func_type" value=""/>
</div>
</div>
</div>
<div class="row" id="func_url_div">
<div class="formgroup ">
<label>功能地址</label>
<div>
<input type="text" class="easyui-validatebox nospaceinside" id="func_url" name="func_url" value=""/>
</div>
</div>
</div>
<div class="row" id="is_ctrl_button_div">
<div class="formgroup ">
<label>是否控制到按钮</label>
<div>
<input type="text" class="easyui-validatebox nospaceinside" id="is_ctrl_button" name="is_ctrl_button" value=""/>
</div>
</div>
</div>
<div class="row" id="org_attr_div">
<div class="formgroup ">
<label class="required">业务组织属性</label>
<div>
<input type="text" class="easyui-validatebox nospaceinside" data-options="required:true,tipPosition:'bottom'" id="org_attr_scode" name="org_attr_scode" value=""/>
</div>
</div>
</div>
<div class="row">
<div class="formgroup ">
<label>是否启用</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));
var _actionflag = jparam.queryParams.actionflag; //操作标识:add-添加、mdf-修改
var _pack_uuid = jparam.queryParams.pack_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.pkgfunction&method=detail&ajaxparam='+new Date().getTime()
,method:"post"
,timeout:WDK_Timeout
,data:{
func_uuid:_func_uuid
}
,success:function(result) {
$.wait_close();
var jres = $.str2json(result);
if(jres.code=='1'){
if(jres.data){
//修改时,功能类型不允许修改
//初始化功能类型选择项
init_func_type(jres.data.func_type,false);
if(jres.data.func_type != "02"){
$("#parent_div").hide();
}
//将数据填充到表单中
$.setFieldValue(jres.data, "#functionform");
init_radio('is_ctrl_button','0',false);
init_radio('is_active','1',false);
combo_box('org_attr_scode','S_ORG_ATTR',jres.data.org_attr_scode);
}
}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());
$("#pack_uuid").val(_pack_uuid);
$("#display_order").val("100");
//$("#parent_uuid").val(_parent_uuid);
if(_parent_uuid=="-1"){
//增加顶级节点
init_func_type("",true);
//默认选择功能类型的第一个值,并触发界面显示控制
functypeChange($.combobox_getValue({id:"func_type"}));
}else{
//增加非顶级节点
parentinfo(_parent_uuid,function(data){
if(data){
//初始化功能类型选择项
init_func_type(data.func_type,true);
//默认选择功能类型的第一个值,并触发界面显示控制
functypeChange($.combobox_getValue({id:"func_type"}));
}
});
}
init_radio('is_active','1',false);
init_radio('is_ctrl_button','0',false);
combo_box('org_attr_scode','S_ORG_ATTR','');
}
var dataParam = {
_SRVNAME: 'service.portal.package',
_SRVMETHOD: 'queryAllFunMenuList',
_DATA: $.json2str({
pack_uuid: _pack_uuid,
parent_uuid: '',
resultfields: '',
orderfields:""
}),
_RSFIELD: 'func_list',
_RSTYPE: 'combotree',
_RSPARAM: $.json2str({
idField: 'func_uuid'
,textField: 'func_name'
,parentField: 'parent_uuid'
,asyn:'0' //是否是异步 0:同步;1:异步
//,asyn_dataField:'parentid' //如果是异步,则从url中取出的参数替换_DATA参数的名
})
};
$.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){
},
onLoadSuccess : function(data){
$('#parent_uuid').combotree('tree').tree("expandAll");
$('#parent_uuid').combotree('setValue', _parent_uuid);
}
});
});
//查询上级功能的功能类型信息,查询结果经回调放法回传
//返回参数格式 {func_type_uuid:'01'}
function parentinfo(parent_func_uuid,callback){
if(""==parent_func_uuid || "-1"==parent_func_uuid){
callback({func_type:''});
}else{
$.wait_open();
$.cuajax({
url:'wdk?action=portal.pkgfunction&method=detail&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:jres.data.func_type});
}
}
}
,error:function(result){
$.wait_close();
alert('网络错误!result='+result);
}
});
}
}
/**
* 下拉框
*/
function combo_box(id, moduleCode,initvalue){
$.combobox({
id:id
,initvalue:initvalue
,url:'wdk?action=wdk.pub&method=call_service&ajaxparam='+new Date().getTime()
,queryParams:{
_SRVNAME:'service.wdk.pub'
,_SRVMETHOD:'wql_queryCombobox'
,_DATA:$.json2str({
modulecode:moduleCode
,jparam:{
condition:''
}
})
,_RSFIELD:'result'
}
});
}
/**
* 初始化单选框
*/
function init_radio(id,initvalue,disabled){
$.radio({
id: id,
initvalue: initvalue,
disabled:disabled,
data:[{id:"1",text:"是"},
{id:"0",text:"否"}
]
});
}
//初始化功能类别(传入参数为上级的功能类别)
function init_func_type(func_type,isparent){
var data = [];
var initvalue = "";
if(isparent){
//根据上级类别初始化下级允许的类别
if(func_type=="" || func_type=="01"){
data.push({id:'01',text:'目录'});
data.push({id:'02',text:'功能'});
initvalue = "01";
}else if(func_type=="02"){
data.push({id:'03',text:'按钮'});
initvalue = "03";
}else if(func_type=="03"){
}
}else{
//
if(func_type=="" || func_type=="01"){
data.push({id:'01',text:'目录'});
initvalue = "01";
}else if(func_type=="02"){
data.push({id:'02',text:'功能'});
initvalue = "02";
}else if(func_type=="03"){
data.push({id:'03',text:'按钮'});
initvalue = "03";
}
}
$.combobox({
id:"func_type"
,data:data
,width:$('#func_type').css('width')
,initvalue:initvalue
,onChange:function(newValue, oldValue){
//alert("newValue="+newValue+",oldValue="+oldValue);
functypeChange(newValue);
}
});
functypeChange(initvalue);
}
//功能类型发生变化
function functypeChange(func_type){
if(func_type=="" || func_type=="01"){
//目录
$("#func_url_div").css('display','none');
$("#is_ctrl_button_div").css('display','none');
$("#org_attr_div").css('display','none');
$.validatebox({
id:'func_url',
required:false,
editable:true,
initvalue: '',
tipPosition:'bottom',
validType:'maxLength[200]'
});
}else if(func_type=="02"){
//功能
$("#func_url_div").css('display','block');
$("#is_ctrl_button_div").css('display','block');
$("#org_attr_div").css('display','block');
$.validatebox({
id:'func_url',
required:true,
editable:true,
initvalue: '',
missingMessage:'不允许为空!',
tipPosition:'bottom',
validType:'maxLength[200]'
});
}else if(func_type=="03"){
//按钮
$("#func_url_div").css('display','none');
$("#is_ctrl_button_div").css('display','none');
$("#org_attr_div").css('display','none');
$.validatebox({
id:'func_url',
required:false,
editable:true,
initvalue: '',
tipPosition:'bottom',
validType:'maxLength[200]'
});
}
}
//保存应用
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_ctrl_button = $("input:radio[name='is_ctrl_button']: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;
}
//mainFieldValues.parent_uuid = $("#parent_uuid").combotree('getValue');
//保存
var _param = {
actionflag:_actionflag,
_FILEDVALUE:$.json2str(mainFieldValues)
};
$.wait_open();
$.cuajax({
url:'wdk?action=portal.pkgfunction&method=save&ajaxparam='+new Date().getTime(),
method:"post",
data:_param,
success:function(result) {
$.wait_close();
var jres = $.str2json(result);
alert(jres.desc);
if(jres.code=="1"){
//不一样说明修改了上级目录
if(parent_uuid != _parent_uuid){
mainFieldValues.changeParent = true;
}
opt_close(mainFieldValues);
}
},
error:function(result){
$.wait_close();
alert('网络错误!result='+result);
}
});
}
// 关闭模态框
function opt_close(v){
if(v){
$.setWinReturn(_wid,v);
}
$.closeWin(_wid);
}
</script>
</html>