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.

216 lines
8.3 KiB

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<%@include file="/wdk/theme/je/module/public/common.jsp"%>
<!-- 上述3个meta标签*必须*放在最前面,任何其他内容都*必须*跟随其后! -->
<title>应用云平台-服务管理-编辑服务</title>
</head>
<body class="easyui-layout" data-options="fit:true">
<div data-options="region:'north',border:false,collapsed:false" class="page-title" style="overflow:hidden">
<div class="page-toolbar">
<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'fa fa-save'" id="btn_submit">保存</a>
<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'fa fa-close'" id="cancel">取消</a>
<span style="display: inline-block;"></span>
</div>
</div>
<div data-options="region:'center',border:false,collapsed:false">
<div class="edit-container-win1" id="ss_form">
<div class="row">
<div class="formgroup col-12">
<label class="required">服务别名</label>
<div>
<input type="text" class="easyui-validatebox nospaceinside" id="service_alias" name="service_alias" value="" data-options="required:true,validType:['length[0,20]'],tipPosition:'bottom'" title=""/>
</div>
</div>
</div>
<div class="row">
<div class="formgroup col-6">
<label class="required">服务分组</label>
<div>
<input type="text" class="easyui-validatebox nospaceinside" id="group_uuid" name="group_uuid" value="" title=""/>
</div>
</div>
</div>
<div class="row">
<div class="formgroup col-6">
<label class="required">显示顺序</label>
<div>
<input type="text" class="easyui-validatebox nospaceinside" id="display_order" name="display_order" value="" data-options="required:true,validType:['isInteger','length[0,5]'],tipPosition:'bottom'" title=""/>
</div>
</div>
</div>
<div class="row">
<div class="formgroup col-12">
<label class="required">服务实现类</label>
<div>
<input type="text" class="easyui-validatebox nospaceinside" id="class_name" name="class_name" value="" data-options="required:true,validType:['length[0,100]'],tipPosition:'bottom'" title=""/>
</div>
</div>
</div>
<div class="row">
<div class="formgroup col-12">
<label>服务访问地址</label>
<div>
<input type="text" class="easyui-validatebox nospaceinside" id="access_url" name="access_url" value="" data-options="validType:['length[0,100]'],tipPosition:'bottom'" title=""/>
</div>
</div>
</div>
<div class="row" style="height:50px;">
<div class="formgroup col-12">
<label>备注</label>
<div>
<textarea class="easyui-validatebox" id="remark" name="remark" data-options="validType:['length[0,100]'],tipPosition:'bottom'" title=""></textarea>
</div>
</div>
</div>
<input type="hidden" name="service_uuid" id="service_uuid">
</div>
</div>
</body>
<script>
var param = $.getURLParam('param');
var jparam = $.str2json($.urlparam_decode(param));
var _actionflag = jparam.queryParams.actionflag; //操作类型:add-新增,edit-修改,(读取原信息)view-查看
var _selected_id = jparam.queryParams.selected_id;
var wid = $.getURLParam("wid");
var _op_acc = $.getSessionUser().account_id;
var _appsrv = 'service.portal.appkey';
$(function() {
//消息分类
combo_box('group_uuid', 'PF_SRV_GROUP');
if(_actionflag === 'view') {
$("#btn_submit").remove();
$("#cancel").linkbutton({
iconCls: 'fa fa-check',
text: '确定'
});
$("form").find("[name]").each(function() {
$(this).prop("readonly", true);
});
}
if(_actionflag === 'edit' || _actionflag === 'view'){
$.wait_open();
var data = {};
data.service_uuid = _selected_id;
data.resultfields = '';
var dataParam = {
_SRVNAME: _appsrv,
_SRVMETHOD: 'querySrvInfoByID',
_DATA: $.json2str(data)
};
//通过界面直接调用服务
$.cuajax({
url: 'wdk?action=wdk.pub&method=call_service&ajaxparam=' + new Date().getTime(),
method: "post",
timeout: WDK_Timeout,
data: dataParam,
success: function(result) {
$.wait_close();
//返回值字符串转json
var jres = $.str2json(result);
if(jres.code=="1"){ //查询成功
$.setFieldValue(jres.result, "#ss_form");
}else{
alert(jres.desc);
}
},
error:function(result){
$.wait_close();
alert('网络错误!result=' + result);
}
});
}
//提交
$("#btn_submit").on("click", function(e){
e.preventDefault();
var isValid = $('#ss_form').form('validate');
if (!isValid){
alert('尚有必填项未填或输入有误,请检查后提交!');
return false;
}
//打开旋转
$.wait_open();
var jfield = $.getFieldValue({formid: 'ss_form'});
var srvmethod = "createSvr";
if(_actionflag === 'edit'){
srvmethod = "changeSvr";
jfield.service_uuid = _selected_id;
}
var data = {
op_acc: _op_acc,
srv_info: jfield
};
var dataParam = {
_SRVNAME: _appsrv,
_SRVMETHOD: srvmethod,
_DATA: $.json2str(data)
};
//通过界面直接调用服务
$.cuajax({
url: 'wdk?action=wdk.pub&method=call_service&ajaxparam=' + new Date().getTime(),
method: "post",
timeout: WDK_Timeout,
data: dataParam,
success: function(result) {
$.wait_close();
//返回值字符串转json
var jres = $.str2json(result);
if(jres.code=="1"){ //操作成功
closewin(jres.code);
}else{
alert(jres.desc);
}
},
error: function(result){
$.wait_close();
alert('网络错误!result=' + result);
}
});
});
$('#cancel').on("click", function(){
closewin();
});
// 关闭模态框
function closewin(){
$.closeWin(wid);
}
});
//下拉框
function combo_box(id, moduleCode){
$.combobox({
id: id,
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'
},
isinitselect: true
});
}
</script>
</html>