87,993
社区成员
发帖
与我相关
我的任务
分享
function LayoutChg(layoutid)
{
$.ajax({
url: "/sbadmin2/xml/layout.xml",
dataType: 'xml',
type: 'GET',
timeout: 2000,
error: function(xml)
{
alert("XMLファイル読み込みエラー!");
},
success: function(xml)
{
$('#dataTables-category').remove();
var table=$('<table id ="dataTables-category" width="100" class="table table-striped table-bordered table-hover"></table>');
table.appendTo($("#category"));
var thead=$("<thead></thead>");
thead.appendTo(table);
$(xml).find("layout").each(function(i)
{
var id = $(this).attr("id");
if(id == layoutid){
$(this).find("th").each(function(j) {
var tr=$('<tr id="abc"></tr>');
tr.attr("id","level"+id);
id++;
tr.appendTo(thead);
$(this).find("colum").each(function(k) {
var name = $(this).attr("name");
var th_colspan = $(this).children("th_colspan").text();
var th_row = $(this).children("th_rowspan").text();
var th_cla = $(this).children("th_class").text();
var th_bgcolor = $(this).children("th_bgcolor").text();
var a_data_type = $(this).children("a_data_type").text();
var a_id = $(this).children("a_id").text();
var a_class = $(this).children("a_class").text();
var a_style = $(this).children("a_style").text();
var a_name = $(this).children("a_name").text();
var th=$("<th colspan = "+th_colspan + " rowspan = " + th_row + " bgcolor = " + th_bgcolor + " class = " + th_cla + ">" + name +"<a data-type=" + a_data_type + " id ="+ a_id + " onclick =" + a_class + " style =" + a_style +" > " + a_name + " </a> "+" </th> ");
th.appendTo(tr);
})
})
}else{
return true;
}
});
var tbody=$("<tbody></tbody>");
var tbodyDetail ="";
switch(layoutid)
{
case "1":
tbodyDetail
break;
case "2":
tbodyDetail
break;
case "3":
tbodyDetail
break;
case "4":
tbodyDetail break;
case "5":
tbodyDetai break;
case "6":
tbodyDetail
break;
}
tbodyDetail.appendTo(tbody);
tbody.appendTo(table);
}
});
}
//这个是为table添加样式的函数
function searchChange() {
$("#category").on("click","a",function(){
var flag = $(this).text();
var type = $(this).data("type");
var colspan = Number($(this).closest("th").attr("colspan"));
var beginlevel = 2;
var endlevel = 4;
flag = flag.trim();
if("try" == flag){
var lastLevel = null;
var colspanLevel = 0;
//本打算添加个for循环,按照静态页面的js来弄,把那个静态页面的js搬到这个页面中,但是for循环一添加就报错500,不知道原因。
alert("进入判断成功!");
}
})
}
</script>
]
<layout id="1">
<th id="th">
<colum name="DM不要区分">
<th_colspan>5</th_colspan>
<th_rowspan>2</th_rowspan>
<th_class></th_class>
<th_bgcolor>#FFFACD</th_bgcolor>
<a_data_type>a</a_data_type>
<a_class>searchChange</a_class>
<a_style>cursor:pointer</a_style>
<a_name>-</a_name>
</colum>
<colum name="担当情報">
<th_colspan>3</th_colspan>
<th_rowspan>2</th_rowspan>
<th_class></th_class>
<th_bgcolor>#FFFACD</th_bgcolor>
<a_data_type>b</a_data_type>
<a_class>searchChange</a_class>
<a_style>cursor:pointer</a_style>
<a_name>-</a_name>
</colum>
<colum name="顧客情報①">
<th_colspan>7</th_colspan>
<th_rowspan>2</th_rowspan>
<th_class></th_class>
<th_bgcolor>#FFFACD</th_bgcolor>
<a_data_type>c</a_data_type>
<a_class>searchChange</a_class>
<a_style>cursor:pointer</a_style>
<a_name>-</a_name>
</colum>
<colum name="顧客情報②">
<th_colspan>2</th_colspan>
<th_rowspan>2</th_rowspan>
<th_class></th_class>
<th_bgcolor>#FFFACD</th_bgcolor>
<a_data_type>d</a_data_type>
<a_class>searchChange</a_class>
<a_style>cursor:pointer</a_style>
<a_name>-</a_name>
</colum>
<colum name="顧客情報③">
<th_colspan>2</th_colspan>
<th_rowspan>2</th_rowspan>
<th_class></th_class>
<th_bgcolor>#FFFACD</th_bgcolor>
<a_data_type>e</a_data_type>
<a_class>searchChange</a_class>
<a_style>cursor:pointer</a_style>
<a_name>-</a_name>
</colum>
<colum name="決着情報">
<th_colspan>1</th_colspan>
<th_rowspan>2</th_rowspan>
<th_class></th_class>
<th_bgcolor>#FFFACD</th_bgcolor>
<a_data_type>f</a_data_type>
<a_class>searchChange</a_class>
<a_style>cursor:pointer</a_style>
<a_name>-</a_name>
</colum>
<colum name="車両情報①">
<th_colspan>8</th_colspan>
<th_rowspan>2</th_rowspan>
<th_class></th_class>
<th_bgcolor>#FFFACD</th_bgcolor>
<a_data_type>g</a_data_type>
<a_class>searchChange</a_class>
<a_style>cursor:pointer</a_style>
<a_name>-</a_name>
</colum>
<colum name="車両情報②">
<th_colspan>6</th_colspan>
<th_rowspan>2</th_rowspan>
<th_class></th_class>
<th_bgcolor>#FFFACD</th_bgcolor>
<a_data_type>h</a_data_type>
<a_class>searchChange</a_class>
<a_style>cursor:pointer</a_style>
<a_name>-</a_name>
</colum>
<colum name="重点商談対象">
<th_colspan>4</th_colspan>
<th_rowspan>1</th_rowspan>
<th_class></th_class>
<th_bgcolor>#FFE4B5</th_bgcolor>
<a_data_type>i</a_data_type>
<a_class>searchChange</a_class>
<a_style>cursor:pointer</a_style>
<a_name>-</a_name>
</colum>
<colum name="直近投函予定">
<th_colspan>4</th_colspan>
<th_rowspan>1</th_rowspan>
<th_class></th_class>
<th_bgcolor>#FFB6C1</th_bgcolor>
<a_data_type>j</a_data_type>
<a_class>searchChange</a_class>
<a_style>cursor:pointer</a_style>
<a_name>-</a_name>
</colum>
<colum name="直近活動対象">
<th_colspan>8</th_colspan>
<th_rowspan>2</th_rowspan>
<th_class></th_class>
<th_bgcolor>#DDA0DD</th_bgcolor>
<a_data_type>k</a_data_type>
<a_class>searchChange</a_class>
<a_style>cursor:pointer</a_style>
<a_name>-</a_name>
</colum>
<colum name="おすすめコンテンツ">
<th_colspan>6</th_colspan>
<th_rowspan>1</th_rowspan>
<th_class></th_class>
<th_bgcolor>#8FBC8F</th_bgcolor>
<a_data_type>l</a_data_type>
<a_class>searchChange</a_class>
<a_style>cursor:pointer</a_style>
<a_name>-</a_name>
</colum>
<colum name="過去プロモーション情報">
<th_colspan>6</th_colspan>
<th_rowspan>2</th_rowspan>
<th_class></th_class>
<th_bgcolor>#87CEEB</th_bgcolor>
<a_data_type>m</a_data_type>
<a_class>searchChange</a_class>
<a_style>cursor:pointer</a_style>
<a_name>-</a_name>
</colum>
</th>
<th id="th">
<colum name="※初度登録から30ヶ月以上で下記項目に該当">
<th_colspan>4</th_colspan>
<th_rowspan>1</th_rowspan>
<th_class>ichild</th_class>
<th_bgcolor>#FFE4B5</th_bgcolor>
</colum>
<colum name="本部発">
<th_colspan>2</th_colspan>
<th_rowspan>1</th_rowspan>
<th_class>jchild</th_class>
<th_bgcolor>#FFB6C1</th_bgcolor>
</colum>
<colum name="店舗発">
<th_colspan>2</th_colspan>
<th_rowspan>1</th_rowspan>
<th_class>jchild</th_class>
<th_bgcolor>#FFB6C1</th_bgcolor>
</colum>
<colum name="新車系">
<th_colspan>3</th_colspan>
<th_rowspan>1</th_rowspan>
<th_class>lchild</th_class>
<th_bgcolor>#8FBC8F</th_bgcolor>
</colum>
<colum name="サービス・対応系">
<th_colspan>3</th_colspan>
<th_rowspan>1</th_rowspan>
<th_class>lchild</th_class>
<th_bgcolor>#8FBC8F</th_bgcolor>
</colum>
</th>
<th id="th">
<colum name="DM不要区分">
<th_colspan>1</th_colspan>
<th_rowspan>1</th_rowspan>
<th_class>achild</th_class>
<th_bgcolor>#FFFACD</th_bgcolor>
</colum>
<colum name="DM区分_新車">
<th_colspan>1</th_colspan>
<th_rowspan>1</th_rowspan>
<th_class>achild</th_class>
<th_bgcolor>#FFFACD</th_bgcolor>
</colum>
<colum name="DM区分_サービス">
<th_colspan>1</th_colspan>
<th_rowspan>1</th_rowspan>
<th_class>achild</th_class>
<th_bgcolor>#FFFACD</th_bgcolor>
</colum>
<colum name="DM区分_その他">
<th_colspan>1</th_colspan>
<th_rowspan>1</th_rowspan>
<th_class>achild</th_class>
<th_bgcolor>#FFFACD</th_bgcolor>
</colum>
<colum name="個人情報提供同意・不同意区分">
<th_colspan>1</th_colspan>
<th_rowspan>1</th_rowspan>
<th_class>achild</th_class>
<th_bgcolor>#FFFACD</th_bgcolor>
</colum>
<colum name="担当店舗">
<th_colspan>1</th_colspan>
<th_rowspan>1</th_rowspan>
<th_class>bchild</th_class>
<th_bgcolor>#FFFACD</th_bgcolor>
</colum>
<colum name="担当者">
<th_colspan>1</th_colspan>
<th_rowspan>1</th_rowspan>
<th_class>bchild</th_class>
<th_bgcolor>#FFFACD</th_bgcolor>
</colum>
<colum name="サービス工場">
<th_colspan>1</th_colspan>
<th_rowspan>1</th_rowspan>
<th_class>bchild</th_class>
<th_bgcolor>#FFFACD</th_bgcolor>
</colum>
<colum name="お客様NO">
<th_colspan>1</th_colspan>
<th_rowspan>1</th_rowspan>
<th_class>cchild</th_class>
<th_bgcolor>#FFFACD</th_bgcolor>
</colum>
<colum name="お客様名">
<th_colspan>1</th_colspan>
<th_rowspan>1</th_rowspan>
<th_class>cchild</th_class>
<th_bgcolor>#FFFACD</th_bgcolor>
</colum>
<colum name="電話番号">
<th_colspan>1</th_colspan>
<th_rowspan>1</th_rowspan>
<th_class>cchild</th_class>
<th_bgcolor>#FFFACD</th_bgcolor>
</colum>
<colum name="法人区分">
<th_colspan>1</th_colspan>
<th_rowspan>1</th_rowspan>
<th_class>cchild</th_class>
<th_bgcolor>#FFFACD</th_bgcolor>
</colum>
<colum name="現状保有台数">
<th_colspan>1</th_colspan>
<th_rowspan>1</th_rowspan>
<th_class>cchild</th_class>
<th_bgcolor>#FFFACD</th_bgcolor>
</colum>
<colum name="顧客層別">
<th_colspan>1</th_colspan>
<th_rowspan>1</th_rowspan>
<th_class>cchild</th_class>
<th_bgcolor>#FFFACD</th_bgcolor>
</colum>
</layout>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>项目页面</title>
<link rel="stylesheet" href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="../jquery-1.11.0.js"></script>
<script type="text/javascript">
<!--
// 検索条件表示切替
function searchChange() {
}
$(function(){
$(".searchChange").click(function(){
var flag = $(this).html();
var type = $(this).data("type");
var beginlevel = 2;
var endlevel = 6;
if("-" == flag){
for(var i = beginlevel; i <= endlevel; i++){
var lastLevel = null;
var colspanLevel = 0;
$("#level" + i).children("." + type + "child").each(function(){
var colspan = Number($(this).attr("colspan"));
if(Number.isNaN(colspan)){
colspan = 1;
}
colspanLevel += colspan;
$(this).css("display", "none");
lastLevel = $(this);
});
if(null != lastLevel && i != 3 && i!= 2){
lastLevel.after($("<td>").attr("colspan", colspanLevel).addClass(type + "temp"));
}
if(i == 3){
if("i" == type){lastLevel.after($("<td>").attr("colspan", colspanLevel).attr("style", "background-color:#FFE4B5").addClass(type + "temp"));}
if("j" == type){lastLevel.after($("<td>").attr("colspan", colspanLevel).attr("style", "background-color:#FFB6C1").addClass(type + "temp"));}
if("k" == type){lastLevel.after($("<td>").attr("colspan", colspanLevel).attr("style", "background-color:#DDA0DD").addClass(type + "temp"));}
if("l" == type){lastLevel.after($("<td>").attr("colspan", colspanLevel).attr("style", "background-color:#8FBC8F").addClass(type + "temp"));}
if("m" == type){lastLevel.after($("<td>").attr("colspan", colspanLevel).attr("style", "background-color:#87CEEB").addClass(type + "temp"));}
if("a" == type || "b" == type || "c" == type || "d" == type || "e" == type || "f" == type || "g" == type || "h" == type){
lastLevel.after($("<td>").attr("colspan", colspanLevel).attr("style", "background-color:#FFFACD").addClass(type + "temp"));
}
}else if( i==2){
if("i" == type){lastLevel.after($("<td>").attr("colspan", colspanLevel).attr("style", "background-color:#FFE4B5").addClass(type + "temp"));}
if("j" == type){lastLevel.after($("<td>").attr("colspan", colspanLevel).attr("style", "background-color:#FFB6C1").addClass(type + "temp"));}
if("l" == type){lastLevel.after($("<td>").attr("colspan", colspanLevel).attr("style", "background-color:#8FBC8F").addClass(type + "temp"));}
}
}
$(this).html("+");
} else {
for(var i = beginlevel; i <= endlevel; i++){
var lastLevel = null;
var colspanLevel = 0;
$("#level" + i).children("." + type + "temp").each(function(){
$(this).remove();
});
$("#level" + i).children("." + type + "child").each(function(){
$(this).css("display", "");
});
}
$(this).html("-");
}
});
})
// -->
</script>
</head>
<body>
<div class="row clearfix">
<table id="tb" width="30%" class="table table-striped table-bordered table-hover" style="width:500px">
<thead>
<!-- 一级标题 -->
<tr id="level1">
<th colspan="5" rowspan="2" bgcolor="#FFFACD">DM不要区分<br> <a data-type="a" class="searchChange" style="cursor:pointer">-</a></th>
<th colspan="3" rowspan="2" bgcolor="#FFFACD">担報<br><a data-type="b" class="searchChange" style="cursor:pointer">-</a></th>
<th colspan="7" rowspan="2" bgcolor="#FFFACD">顧報①<br><a data-type="c" class="searchChange" style="cursor:pointer">-</a></th>
<th colspan="2" rowspan="2" bgcolor="#FFFACD">顧報②<br><a data-type="d" class="searchChange" style="cursor:pointer">-</a></th>
<th colspan="2" rowspan="2" bgcolor="#FFFACD">顧報③<br><a data-type="e" class="searchChange" style="cursor:pointer">-</a></th>
<th colspan="1" rowspan="2" bgcolor="#FFFACD">報<br><a data-type="f" class="searchChange" style="cursor:pointer">-</a></th>
<th colspan="8" rowspan="2" bgcolor="#FFFACD">車報①<br><a data-type="g" class="searchChange" style="cursor:pointer">-</a></th>
<th colspan="5" rowspan="2" bgcolor="#FFFACD">車②<br><a data-type="h" class="searchChange" style="cursor:pointer">-</a></th>
<th colspan="4" rowspan="1" bgcolor="#FFE4B5">重対象<br><a data-type="i" class="searchChange" style="cursor:pointer">-</a></th>
<th colspan="4" rowspan="1" bgcolor="#FFB6C1">直定<br><a data-type="j" class="searchChange" style="cursor:pointer">-</a></th>
<th colspan="8" rowspan="2" bgcolor="#DDA0DD">直象<br><a data-type="k" class="searchChange" style="cursor:pointer">-</a></th>
<th colspan="6" rowspan="1" bgcolor="#8FBC8F">おすツ<br><a data-type="l" class="searchChange" style="cursor:pointer">-</a></th>
<th colspan="6" rowspan="2" bgcolor="#87CEEB">過去報<br><a data-type="m" class="searchChange" style="cursor:pointer">-</a></th>
</tr>
<!-- 二级标题 -->
<tr id="level2">
<th colspan="4" rowspan="1" bgcolor="#FFE4B5" class="ichild">※該当</th>
<th colspan="2" rowspan="1" bgcolor="#FFB6C1" class="jchild">本発</th>
<th colspan="2" rowspan="1" bgcolor="#FFB6C1" class="jchild">発</th>
<th colspan="3" rowspan="1" bgcolor="#8FBC8F" class="lchild">系</th>
<th colspan="3" rowspan="1" bgcolor="#8FBC8F" class="lchild">系</th>
</tr>
<!--三级标题 -->
<tr id="level3">
<th colspan="1" rowspan="1" bgcolor="#FFFACD" class="achild">D</th>
<th colspan="1" rowspan="1" bgcolor="#FFFACD" class="achild">D</th>
<th colspan="1" rowspan="1" bgcolor="#FFFACD" class="achild">D</th>
<th colspan="1" rowspan="1" bgcolor="#FFFACD" class="achild">DMの他</th>
<th colspan="1" rowspan="1" bgcolor="#FFFACD" class="achild">個人情分</th>
<th colspan="1" rowspan="1" bgcolor="#FFFACD" class="bchild">担当店舗</th>
<th colspan="1" rowspan="1" bgcolor="#FFFACD" class="bchild">担当者</th>
<th colspan="1" rowspan="1" bgcolor="#FFFACD" class="bchild">サービス工場</th>
<th colspan="1" rowspan="1" bgcolor="#FFFACD" class="cchild">お客様NO</th>
<th colspan="1" rowspan="1" bgcolor="#FFFACD" class="cchild">お客様名</th>
<th colspan="1" rowspan="1" bgcolor="#FFFACD" class="cchild">電話番号</th>
<th colspan="1" rowspan="1" bgcolor="#FFFACD" class="cchild">法人区分</th>
<th colspan="1" rowspan="1" bgcolor="#FFFACD" class="cchild">現状保有台数</th>
<th colspan="1" rowspan="1" bgcolor="#FFFACD" class="cchild">顧客層別</th>
<th colspan="1" rowspan="1" bgcolor="#FFFACD" class="cchild">引継後未取引</th>
<th colspan="1" rowspan="1" bgcolor="#FFFACD" class="dchild">郵便番号</th>
<th colspan="1" rowspan="1" bgcolor="#FFFACD" class="dchild">住所</th>
<th colspan="1" rowspan="1" bgcolor="#FFFACD" class="echild">JAF加入区分</th>
<th colspan="1" rowspan="1" bgcolor="#FFFACD" class="echild">日産カード会員区分</th>
<th colspan="1" rowspan="1" bgcolor="#FFFACD" class="fchild">3ヶ月以</th>
<th colspan="1" rowspan="1" bgcolor="#FFFACD" class="gchild">基本</th>
<th colspan="1" rowspan="1" bgcolor="#FFFACD" class="gchild">通称名</th>
<th colspan="1" rowspan="1" bgcolor="#FFFACD" class="gchild">登録NO</th>
<th colspan="1" rowspan="1" bgcolor="#FFFACD" class="gchild">初度登録</th>
<th colspan="1" rowspan="1" bgcolor="#FFFACD" class="gchild">車日</th>
<th colspan="1" rowspan="1" bgcolor="#FFFACD" class="gchild">自他社売り区分</th>
<th colspan="1" rowspan="1" bgcolor="#FFFACD" class="gchild">新</th>
<th colspan="1" rowspan="1" bgcolor="#FFFACD" class="gchild">軽自動車区分</th>
<th colspan="1" rowspan="1" bgcolor="#FFFACD" class="hchild">メンテプロ有効期限</th>
<th colspan="1" rowspan="1" bgcolor="#FFFACD" class="hchild">付保区分</th>
<th colspan="1" rowspan="1" bgcolor="#FFFACD" class="hchild">保険満了日</th>
<th colspan="1" rowspan="1" bgcolor="#FFFACD" class="hchild">損保会社名</th>
<th colspan="1" rowspan="1" bgcolor="#FFFACD" class="hchild">保険担当者コード</th>
<th colspan="1" rowspan="1" bgcolor="#FFE4B5" class="ichild">6ヶ月以内レスポンスあり</th>
<th colspan="1" rowspan="1" bgcolor="#FFE4B5" class="ichild">6ヶ月以内DM回収あり</th>
<th colspan="1" rowspan="1" bgcolor="#FFE4B5" class="ichild">6ヶ月以内返信あり</th>
<th colspan="1" rowspan="1" bgcolor="#FFE4B5" class="ichild">6ヶ月以内入庫あり</th>
<th colspan="1" rowspan="1" bgcolor="#FFB6C1" class="jchild">投函日</th>
<th colspan="1" rowspan="1" bgcolor="#FFB6C1" class="jchild">DM名</th>
<th colspan="1" rowspan="1" bgcolor="#FFB6C1" class="jchild">投函日</th>
<th colspan="1" rowspan="1" bgcolor="#FFB6C1" class="jchild">DM名</th>
<th colspan="1" rowspan="1" bgcolor="#DDA0DD" class="kchild">車内</th>
<th colspan="1" rowspan="1" bgcolor="#DDA0DD" class="kchild">車内</th>
<th colspan="1" rowspan="1" bgcolor="#DDA0DD" class="kchild">翌月来</th>
<th colspan="1" rowspan="1" bgcolor="#DDA0DD" class="kchild">法定N-2以内</th>
<th colspan="1" rowspan="1" bgcolor="#DDA0DD" class="kchild">安内</th>
<th colspan="1" rowspan="1" bgcolor="#DDA0DD" class="kchild">新了6ヶ月</th>
<th colspan="1" rowspan="1" bgcolor="#DDA0DD" class="kchild">メン2ヶ月以内</th>
<th colspan="1" rowspan="1" bgcolor="#DDA0DD" class="kchild">※販社変わる</th>
<th colspan="1" rowspan="1" bgcolor="#8FBC8F" class="lchild">おす①</th>
<th colspan="1" rowspan="1" bgcolor="#8FBC8F" class="lchild">おめ②</th>
<th colspan="1" rowspan="1" bgcolor="#8FBC8F" class="lchild">お③</th>
<th colspan="1" rowspan="1" bgcolor="#8FBC8F" class="lchild">おめ④</th>
<th colspan="1" rowspan="1" bgcolor="#8FBC8F" class="lchild">おめ⑤</th>
<th colspan="1" rowspan="1" class="lchild">お⑥</th>
<th colspan="1" rowspan="1" class="mchild">6カ月以チ①</th>
<th colspan="1" rowspan="1" class="mchild">6カ月以内①</th>
<th colspan="1" rowspan="1" class="mchild">6カ月②</th>
<th colspan="1" rowspan="1" class="mchild">6カ月以</th>
<th colspan="1" rowspan="1" class="mchild">6カ月以</th>
<th colspan="1" rowspan="1" class="mchild">6カ</th>
</tr>
</thead>
<tbody>
由于字数限制,表格内容见3楼
</tbody>
</table>
</div>
</body>
</html>