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.
 
 
 
 
 
 

320 lines
14 KiB

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<%@include file="/wdk/theme/je/module/public/common.jsp"%>
<!-- 上述3个meta标签*必须*放在最前面,任何其他内容都*必须*跟随其后! -->
<script type="text/javascript" src="<%=WDK_ROOT%>/theme/je/core/js/lib/ace/ace.js"></script>
<title>供应商维护-编辑</title>
<style type="text/css">
</style>
<script type="text/javascript">
var param = $.getURLParam('param');
var jparam = $.str2json($.urlparam_decode(param));
var tmpl_uuid = jparam.queryParams.tmpl_uuid;
var _gridcode = 'wdk.module.print.templategrid';
$(function() {
$.radio({
id : 'is_active',
initvalue:'1',
spacing : 2,
panelHeight: 35,
data : [ {
id : '1',
text : '是'
}, {
id : '0',
text : '否'
} ],
onChange : function(data) {
}
});
if ('edit' === jparam.queryParams.actionFlag || 'view' === jparam.queryParams.actionFlag) {
//初始化
initData();
}
if ('view' === jparam.queryParams.actionFlag) {
$('#tmpl_name').attr('readonly', true);
$('#tmpl_code').attr('readonly', true);
$('#display_order').attr('readonly', true);
$('input:radio[name="is_active"]').prop('disabled', true);
editor_content.setReadOnly(true);
editor_data.setReadOnly(true);
$('#detail_rows').attr('readonly', true);
$('#paper_width').attr('readonly', true);
$('#paper_height').attr('readonly', true);
$('#remark').attr('readonly', true);
$('#sys1').css('display', 'block');
$('#sys2').css('display', 'block');
$('#btn_save').css('display', 'none');
}
});
/*
function getAccountInfo(account_uuid, name) {
var dataParam = {
_SRVNAME : 'service.usr.account',
_SRVMETHOD : 'queryAccInfoByID',
_DATA : $.json2str({
op_account_uuid: $.getSessionUser().account_id,
account_uuid: account_uuid,
result_fields: 'account_uuid,login_name,nickname'
})
};
$.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();
var jres = $.str2json(result);
//加载成功
if (jres.code == "1") {
//回填数据
$("input[name='" + name + "']").val(jres.account_info.nickname !== ''?jres.account_info.nickname:jres.account_info.login_name);
} else {
alert(jres.desc);
}
},
error : function(result) {
$.wait_close();
alert('网络错误!result=' + result);
}
});
}
*/
/**
* [initData 初始化数据]
* @return {[type]} [无]
*/
function initData() {
$.wait_open();
//初始化供应商信息
var dataParam = {
_SRVNAME : 'service.wdk.print',
_SRVMETHOD : 'queryTemplateById',
_DATA : $.json2str({
tmpl_uuid: tmpl_uuid
})
};
$.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();
var jres = $.str2json(result);
//加载成功
if (jres.code == "1") {
//回填数据
$.setFieldValue(jres.result, "#edit_form");
if ('' !== jres.result.tmpl_content) {
editor_content.setValue(Base64.decode(jres.result.tmpl_content));
}
if ('' !== jres.result.tmpl_data) {
editor_data.setValue(Base64.decode(jres.result.tmpl_data));
}
} else {
alert(jres.desc);
}
},
error : function(result) {
$.wait_close();
alert('网络错误!result=' + result);
}
});
}
/**
* [opt_save 保存]
* @return {[type]} [无]
*/
function opt_save() {
var template_info = $.getFieldValue('#edit_form');
if ('' !== editor_content.getValue()) {
template_info.tmpl_content = Base64.encode(editor_content.getValue());
} else {
template_info.tmpl_content = '';
}
if ('' !== editor_data.getValue()) {
template_info.tmpl_data = Base64.encode(editor_data.getValue());
} else {
template_info.tmpl_data = '';
}
var dataParam = null;
if ('add' === jparam.queryParams.actionFlag) {
template_info.tmpl_uuid = $.getUUID();
dataParam = {
_SRVNAME:'service.wdk.print',
_SRVMETHOD:'create',
_DATA:$.json2str({
template_info: template_info
})
};
} else if ('edit' === jparam.queryParams.actionFlag) {
dataParam = {
_SRVNAME:'service.wdk.print',
_SRVMETHOD:'change',
_DATA:$.json2str({
template_info: template_info
})
}
}
var isValid = $('#edit_form').form('validate');
if (!isValid){
alert('尚有必填项未填或输入有误,请检查后提交!');
return false;
}
//打开旋转
$.wait_open();
//通过界面直接调用服务
$.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') {
alert(jres.desc);
$.notify(_gridcode, {code : 1});
$.closeActiveTab();
} else {
alert(jres.desc);
}
},
error: function(result){
$.wait_close();
alert('网络错误!result=' + result);
}
});
}
/**
* [opt_close 关闭当前页面]
* @return {[type]} [无]
*/
function opt_close() {
$.closeActiveTab();
}
</script>
</head>
<body class="easyui-layout" data-options="fit:true">
<div data-options="region:'north',border:false,collapsed:false" class="page-title" style="overflow: hidden;height:40px;">
<div class="edit-page-toolbar">
<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'fa fa-save'" onclick="opt_save()" id="btn_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:false,collapsed:false">
<div class="easyui-layout" data-options="fit:true">
<div data-options="region:'center',border:false,collapsed:false">
<div id="edit_form" class="edit-container" style="padding: 0 20px 20px 20px;background-color: white;">
<input type="hidden" id="tmpl_uuid" name="tmpl_uuid"/>
<div class="form-title">
<span class="form-title-text">基本信息</span>
</div>
<div class="row">
<div class="formgroup">
<label class="required">名称</label>
<div>
<input type="text" id="tmpl_name" name="tmpl_name" class="easyui-validatebox" title="" data-options="required:true,validType:['length[0,100]'],tipPosition:'bottom'" />
</div>
</div>
<div class="formgroup">
<label class="required">编码</label>
<div>
<input type="text" id="tmpl_code" name="tmpl_code" class="easyui-validatebox" title="" data-options="required:true,validType:['length[0,100]'],tipPosition:'bottom'" />
</div>
</div>
</div>
<div class="row" style="height: 200px;">
<div class="formgroup" style="width: 100%;">
<label>模板内容</label>
<div>
<div id="tmpl_content" style="width:100%;height:100%;"></div>
</div>
</div>
<script type="text/javascript">
editor_content = ace.edit("tmpl_content");
editor_content.setTheme("ace/theme/twilight");
editor_content.session.setMode("ace/mode/html");
editor_content.setAutoScrollEditorIntoView(true);
//editor.setOption("maxLines", 100);
</script>
</div>
<div class="row" style="height: 200px;">
<div class="formgroup" style="width: 100%;">
<label>测试数据</label>
<div>
<div id="tmpl_data" style="width:100%;height:100%;"></div>
</div>
</div>
<script type="text/javascript">
editor_data = ace.edit("tmpl_data");
editor_data.setTheme("ace/theme/twilight");
editor_data.session.setMode("ace/mode/json");
editor_data.setAutoScrollEditorIntoView(true);
//editor.setOption("maxLines", 100);
</script>
</div>
<div class="row" style="margin-top: 3px;">
<div class="formgroup" style="width: 100%;">
<label class="required">显示顺序</label>
<div>
<input type="text" id="display_order" name="display_order" class="easyui-validatebox" title="" data-options="required:true,validType:['isInteger','length[0,100]'],tipPosition:'bottom'" />
</div>
</div>
</div>
<div class="row">
<div class="formgroup" style="height: 36px;">
<label class="required">是否启用</label>
<div>
<input type="text" id="is_active" name="is_active" class="easyui-validatebox" title="" data-options="required:true,tipPosition:'bottom'" />
</div>
</div>
<div class="formgroup">
<label class="required">明细行数</label>
<div>
<input type="text" id="detail_rows" name="detail_rows" class="easyui-validatebox" title="" data-options="required:true,validType:['isInteger','number[5,0]'],tipPosition:'bottom'" />
</div>
</div>
</div>
<div class="row">
<div class="formgroup">
<label class="required">纸张宽度</label>
<div>
<input type="text" id="paper_width" name="paper_width" class="easyui-validatebox" title="" data-options="required:true,validType:['isAllNumber','number[9,2]'],tipPosition:'bottom'" />
</div>
</div>
<div class="formgroup">
<label class="required">纸张高度</label>
<div>
<input type="text" id="paper_height" name="paper_height" class="easyui-validatebox" title="" data-options="required:true,validType:['isAllNumber','number[9,2]'],tipPosition:'bottom'" />
</div>
</div>
</div>
<div class="row-2" style="margin-top: 6px;">
<div class="formgroup" style="width: 100%;">
<label>备注</label>
<div>
<textarea class="easyui-validatebox" id="remark" name="remark" data-options="validType:['length[0,200]'],tipPosition:'bottom'" title=""></textarea>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>