qa-ifish7/web/Application/Admin/View/Info/import.html

118 lines
5.8 KiB
HTML

<include file="Inc:head"/>
<div class="widget-box2" style="margin:0px;">
<div class="widget-content nopadding">
<form action="__SELF__" method="post" class="form-horizontal" onsubmit="return save_form(this,subresult)">
<input type="hidden" name="modelid" value="{$modelid}">
<input type="hidden" name="pubid" value="19890716{$modelid}"><!--注意这里pubid是前面固定几个数+模型ID-->
<div class="control-group">
<label class="control-label">目标栏目<span>(导入到哪个栏目)</span></label>
<div class="controls" style="margin-top:6px;">
<label class="label-radio"><input type="radio" name="cat_type" value="selfCheck" checked/>当前选中栏目</label>
<label class="label-radio"><input type="radio" name="cat_type" value="catName"/>数据包中的栏目名称</label>
<label class="label-radio"><input type="radio" name="cat_type" value="catId"/>数据包中的栏目ID</label>
</div>
</div>
<div class="control-group cat_select">
<label class="control-label">请选择栏目</label>
<div class="controls">
<select name="catid" class="span6 select2"><option value="">请选择分类</option>{$cat}</select>
</div>
</div>
<div class="control-group cat_select2" style='display:none;'>
<label class="control-label">栏目结构</label>
<div class="controls">
<a href="{:U('cat/showCat',array('modelid'=>$modelid))}" target="_blank" style="color:#28b779;font-weight: 600; text-decoration: underline">查看所有栏目结构</a>
</div>
</div>
<div class="control-group">
<label class="control-label">遇到重复的标题如何处理<span>(标题为[title]字段)</span></label>
<div class="controls" style="margin-top:6px;">
<label class="label-radio"><input type="radio" name="check_title" value="update" checked/>更新(更新之前内容)</label>
<label class="label-radio"><input type="radio" name="check_title" value="continue"/>跳过(不做执行任何操作)</label>
<label class="label-radio"><input type="radio" name="check_title" value="add"/>新增(继续增加)</label>
</div>
</div>
<div class="control-group">
<label class="control-label">数据包<span></span></label>
<div class="controls">
<input type="text" name="excel_src" id="info_excel_src" class="span6 modelform_excel_src" readonly/>
<button palcehoder="" type="button" onClick="selectfile('info_excel_src','','file')">上传数据包</button>
&nbsp;&nbsp;&nbsp;&nbsp;<a onclick="getExcelDemo()" class="date badge badge-success" style="padding:5px;">下载数据包结构</a>
</div>
</div>
<div class="form-actions">
<button type="submit" class="btn btn-success form_submit">确定</button>
<button type="button" class="btn btn-danger" id="closeIframe">取消</button>
</div>
</form>
<table class="table table-striped export_result">
</table>
</div>
</div>
<include file="Inc/foot" noiframeauto="true" noautotitle="true"/>
<include file="Inc/info_js"/>
<script>
function getExcelDemo(){
if(confirm('你保证第一行打死也不修改!!!')==true){
var cat_type=$("input[name='cat_type']:checked").val();
if(cat_type=="selfCheck"){
var url="{:U('Model/getExportExcelDemo',array('cat_type'=>'selfCheck','modelid'=>$modelid))}";
}else if(cat_type=="catName"){
var url="{:U('Model/getExportExcelDemo',array('cat_type'=>'catName','modelid'=>$modelid))}";
}else{
var url="{:U('Model/getExportExcelDemo',array('cat_type'=>'catId','modelid'=>$modelid))}";
}
window.location.href=url;
}
}
//
$(function(){
$("input[name='cat_type']").click(function(){
$val=$(this).val();
if($val=="selfCheck"){
$(".cat_select").show();
$(".cat_select2").hide();
}else{
$(".cat_select").hide();
$(".cat_select2").show();
}
})
})
function subresult(data){
console.log(data);
var str="";
for(var r in data){
if(r==0){
var str1="<thead><tr>";
}else{
var str1="<tr>";
}
for(var r2 in data[r]){
if(r==0){
str1=str1+"<th class='first'><div>"+data[r][r2]+"</div></th>";
}else{
if(data[r][r2]=="导入成功"){
str1=str1+"<td class='tab-title'><div><a href='index.php?m=Admin&c=Info&a=editor&id="+data[r]["id"]+"&modelid={$modelid}' target='_blank'>"+data[r][r2]+"</a></div></td>";
}else{
str1=str1+"<td><div>"+data[r][r2]+"</div></td>";
}
}
}
if(r==0){
str1=str1+"</tr></thead>";
}else{
str1=str1+"</tr>";
}
str=str+str1;
}
$(".export_result").html(str);
}
</script>
<style>
.export_result tr td,.export_result tr th{ text-align: center; }
.export_result tr td div{ max-height: 40px; overflow-y: auto;max-width:400px;}
</style>