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

183 lines
8.5 KiB
Plaintext

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>请假事务控件属性</title>
<script type="text/javascript" src="../internal.js"></script>
<script type="text/javascript" src="../../../jquery.js"></script>
<script type="text/javascript" src="../../../bootstrap/bootstrap.js"></script>
<script type="text/javascript" src="listmenu.js"></script>
<link rel="stylesheet" href="../../../bootstrap/bootstrap.css">
<link rel="stylesheet" href="../../../bootstrap/bootstrap-responsive.css">
<style type="text/css">
*{color: #838383;margin: 0;padding: 0}
html,body {font-size: 12px;}
body {
padding-left: 20px;padding-right: 20px;
}
</style>
</head>
<body>
<table class="table table-striped table-bordered" style="margin-top:18px;margin-bottom: 0;">
<tr>
<th><span>控件类型</span><span class="label label-important">*</span></th>
<th><span>控件名称</span><span class="label label-important">*</span></th>
<th><span>控件样式</span></th>
</tr>
<tr>
<td>
<select id="selectType">
<!--option value="0" selected>选择类型</option-->
<option value="1">请假时间 [时间选择]</option>
<option value="2">请假类别 [下拉框]</option>
</select>
</td>
<td>
<input id="itemName" placeholder="必填项" type="text" size="10" value="请假时间"/><br/>
</td>
<td>
<div class="input-prepend input-append">
<span class="add-on">宽</span><input class="span2" value="150" style="display:inline;width: 32px;" id="txtWidth" type="text"><span class="add-on">px</span>
<span class="add-on">高</span><input class="span2" value="20" style="display:inline;width: 32px;" id="txtHeight" type="text"><span class="add-on">px</span>
</div>
</td>
</tr>
<tr>
<td colspan="3"><p><span class="label label-important">*</span> 必须添加【请假时间、类别】控件才能正确统计请假申请数据。</p></td>
</tr>
</table>
<script type="text/javascript">
var oNode = null;
window.onload = function() {
//弹出窗口初始化函数,这里主要是判断是编辑下拉列表还是新增
if( UE.plugins['leave'].editdom ){
oNode = UE.plugins['leave'].editdom;
$G('itemName').value = oNode.getAttribute('title');
$G('selectType').value = oNode.getAttribute('selecttype');
var sWidth = oNode.style.width;
$G('txtWidth').value = sWidth.substr(0, sWidth.length - 2);//这里的substr是为了去掉末尾的'px'
var sHeight = oNode.style.height;
$G('txtHeight').value = sHeight.substr(0, sHeight.length - 2);
}else
{
//新增
$("#selectType").change(function(){
var sType = $G('selectType').value;
if(sType==1)
{
$G('itemName').value='请假时间';
}else if(sType==2)
{
$G('itemName').value='请假类别';
}
});
}
}
dialog.oncancel = function () {
if( UE.plugins['leave'].editdom ) {
delete UE.plugins['leave'].editdom;
}
};
dialog.onok = function (){
if( $G('itemName').value == '') {
alert('控件名称不能为空');
$G('itemName').focus();
return false;
}
if( !oNode ) {
var sUrl = parent.getItemUrl;
var nItemId = null;
ajax.request(sUrl, {timeout:60000,onsuccess:function (xhr) {
try {
var sType = $G('selectType').value;
nItemId = xhr.responseText;
if(sType ==1)
{
oNode = document.createElement("img");
oNode.setAttribute('title',$G('itemName').value.replace("\"","&quot;"));
oNode.setAttribute('name','data_' + nItemId);
oNode.setAttribute('class','leave');
oNode.setAttribute('className','leave_stime');
oNode.setAttribute('src','/Public/diy_tf/image/form/calendar.gif');
editor.execCommand('insertHtml',oNode.outerHTML);
/*
oNode = document.createElement('input');
oNode.setAttribute('name','data_' + nItemId);
oNode.setAttribute('class','leave');
oNode.setAttribute('className','leave_count');
oNode.setAttribute('title',$G('itemName').value.replace("\"","&quot;"));
oNode.setAttribute('selecttype',$G('selectType').value);
if( $G('txtWidth').value!=''){
oNode.style.width = $G('txtWidth').value + 'px';
oNode.setAttribute('leave_width',$G('txtWidth').value);
} else {
oNode.style.width = '148px';
oNode.setAttribute('leave_width','148');
}
if( $G('txtHeight').value!=''){
oNode.style.height = $G('txtHeight').value + 'px';
oNode.setAttribute('leave_height',$G('txtHeight').value);
} else {
oNode.style.height = '25px';
oNode.setAttribute('leave_height','25');
}
editor.execCommand('insertHtml',oNode.outerHTML + "(小时)");
*/
}else
{
oNode = document.createElement('select');
oNode.setAttribute('name','data_' + nItemId);
oNode.setAttribute('class','leave');
oNode.setAttribute('className','leave_cat');
oNode.setAttribute('title',$G('itemName').value.replace("\"","&quot;"));
oNode.setAttribute('selecttype',$G('selectType').value);
if( $G('txtWidth').value!=''){
oNode.style.width = $G('txtWidth').value + 'px';
oNode.setAttribute('leave_width',$G('txtWidth').value);
}
var oOption = fnAddComboOption( oNode, "请假类别","0" ) ;
fnSetAttribute( oOption, 'selected', 'selected' ) ;
oOption.selected = true ;
editor.execCommand('insertHtml',oNode.outerHTML);
}
return true;
} catch (e) {
alert ( '插入控件出错请联系OA管理员解决 ');
return false;
}
},
error:function () {
alert('Request TimeOut');
return false;
}
})
} else {
if( $G('txtWidth').value!=''){
oNode.style.width = $G('txtWidth').value + 'px';
oNode.setAttribute('leave_width',$G('txtWidth').value);
} else {
oNode.style.width = '148px';
oNode.setAttribute('leave_width','148');
}
if( $G('txtHeight').value!=''){
oNode.style.height = $G('txtHeight').value + 'px';
oNode.setAttribute('leave_height',$G('txtHeight').value);
} else {
oNode.style.height = '25px';
oNode.setAttribute('leave_height','25');
}
oNode.setAttribute('title',$G('itemName').value.replace("\"","&quot;"));
oNode.setAttribute('selecttype',$G('selectType').value);
delete UE.plugins['leave'].editdom; //使用后清空这个对象,变回新增模式
}
};
</script>
</body>
</html>