|
|
<!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="3">使用时间 [时间选择]</option>
|
|
|
<option value="2">车辆选择 [下拉框]</option>
|
|
|
<option value="1">里程(KM)[文本框]</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> 必须添加【时间、车辆、里程】3个控件才能正确统计车辆使用数据。</p></td>
|
|
|
</tr>
|
|
|
</table>
|
|
|
<script type="text/javascript">
|
|
|
var oNode = null;
|
|
|
window.onload = function() {
|
|
|
//弹出窗口初始化函数,这里主要是判断是编辑下拉列表还是新增
|
|
|
if( UE.plugins['car'].editdom ){
|
|
|
oNode = UE.plugins['car'].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='车辆选择';
|
|
|
}else if(sType==3)
|
|
|
{
|
|
|
$G('itemName').value='使用时间';
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
dialog.oncancel = function () {
|
|
|
if( UE.plugins['car'].editdom ) {
|
|
|
delete UE.plugins['car'].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 ==3)
|
|
|
{
|
|
|
oNode = document.createElement("img");
|
|
|
oNode.setAttribute('title',$G('itemName').value.replace("\"","""));
|
|
|
oNode.setAttribute('name','data_' + nItemId);
|
|
|
oNode.setAttribute('class','car');
|
|
|
oNode.setAttribute('className','car_stime');
|
|
|
oNode.setAttribute('src','/Public/diy_tf/image/form/calendar.gif');
|
|
|
editor.execCommand('insertHtml',oNode.outerHTML);
|
|
|
}
|
|
|
else if(sType ==1)
|
|
|
{
|
|
|
oNode = document.createElement('input');
|
|
|
oNode.setAttribute('name','data_' + nItemId);
|
|
|
oNode.setAttribute('class','car');
|
|
|
oNode.setAttribute('type','text');
|
|
|
oNode.setAttribute('className','car_count');
|
|
|
oNode.setAttribute('title',$G('itemName').value.replace("\"","""));
|
|
|
oNode.setAttribute('selecttype',$G('selectType').value);
|
|
|
if( $G('txtWidth').value!=''){
|
|
|
oNode.style.width = $G('txtWidth').value + 'px';
|
|
|
oNode.setAttribute('car_width',$G('txtWidth').value);
|
|
|
} else {
|
|
|
oNode.style.width = '148px';
|
|
|
oNode.setAttribute('car_width','148');
|
|
|
}
|
|
|
if( $G('txtHeight').value!=''){
|
|
|
oNode.style.height = $G('txtHeight').value + 'px';
|
|
|
oNode.setAttribute('car_height',$G('txtHeight').value);
|
|
|
} else {
|
|
|
oNode.style.height = '25px';
|
|
|
oNode.setAttribute('car_height','25');
|
|
|
}
|
|
|
editor.execCommand('insertHtml',oNode.outerHTML + "(KM)");
|
|
|
}else
|
|
|
{
|
|
|
oNode = document.createElement('select');
|
|
|
oNode.setAttribute('name','data_' + nItemId);
|
|
|
oNode.setAttribute('class','car');
|
|
|
oNode.setAttribute('className','car_cat');
|
|
|
oNode.setAttribute('title',$G('itemName').value.replace("\"","""));
|
|
|
oNode.setAttribute('selecttype',$G('selectType').value);
|
|
|
if( $G('txtWidth').value!=''){
|
|
|
oNode.style.width = $G('txtWidth').value + 'px';
|
|
|
oNode.setAttribute('car_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('car_width',$G('txtWidth').value);
|
|
|
} else {
|
|
|
oNode.style.width = '148px';
|
|
|
oNode.setAttribute('car_width','148');
|
|
|
}
|
|
|
if( $G('txtHeight').value!=''){
|
|
|
oNode.style.height = $G('txtHeight').value + 'px';
|
|
|
oNode.setAttribute('car_height',$G('txtHeight').value);
|
|
|
} else {
|
|
|
oNode.style.height = '25px';
|
|
|
oNode.setAttribute('car_height','25');
|
|
|
}
|
|
|
|
|
|
oNode.setAttribute('title',$G('itemName').value.replace("\"","""));
|
|
|
oNode.setAttribute('selecttype',$G('selectType').value);
|
|
|
delete UE.plugins['car'].editdom; //使用后清空这个对象,变回新增模式
|
|
|
}
|
|
|
};
|
|
|
</script>
|
|
|
</body>
|
|
|
</html> |