ComplianceServer/oldcode/WEB/Views/Res/ImportRes/Index.cshtml

231 lines
10 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@using WX.CRM.WebHelper;
@{
ViewBag.Title = "资源导入";
Layout = "~/Views/Shared/_Index_Layout2.cshtml";
}
<div class="mvctool bgb">
@Html.ToolButtonPlain("btnSave", "icon-check", "保存", false, "")
</div>
<!--遮罩层-->
<style type="text/css">
#bg {display: none;position: absolute;top: 0%;left: 0%;width: 100%;height: 100%;background-color: black;z-index: 1001;-moz-opacity: 0.7;opacity: .70;filter: alpha(opacity=70);}
#show {display: none;position: absolute;top: 45%;left: 40%;width: 20%;height: 10%;padding: 8px;border: 8px solid #E8E9F7;background-color: white;z-index: 1002;overflow: auto;}
</style>
<div id="bg"></div>
<div id="show"><br />&nbsp;&nbsp;提示:数据正在处理中……</div>
<form id="frmUpload" method="post" action="/Res/ImportRes/RecFile" enctype="multipart/form-data">
<input id="FileType" name="FileType" type="hidden" value="" />
<input id="HidACTIVITYID" name="HidACTIVITYID" type="hidden" value="" />
<input id="HidResourceId" name="HidResourceId" type="hidden" value="" />
<input id="HidRESOURCETAG" name="HidRESOURCETAG" type="hidden" value="" />
<div class="easyui-tabs" style="height: auto; padding: 0px; margin: 0px;" id="batchMible" data-options="{title:'New Tab',tabHeight:'42'}">
<div title="手机号批量提交" style="padding: 5px;">
<table>
<tr>
<td>资源:</td>
<td>
@Html.DropDownList("ResourctType1")
<select id="cmbActive1" name="cmbActive1">
<option value="0">-请选择-</option>
</select>
</td>
</tr>
<tr>
<td>号码:</td>
<td>
<textarea id='txtMobiles' cols="90" rows="7" name="txtMobiles" style="width:400px;height:170px;"></textarea>
</td>
</tr>
</table>
</div>
<div title="文件上传导入" style="padding: 5px;">
<table>
<tr>
<td>资源:</td>
<td>
@Html.DropDownList("ResourctType2")
<select id="cmbActive2" name="cmbActive2">
<option value="0">-请选择-</option>
</select>
</td>
</tr>
<tr>
<td>文件:</td>
<td>
<br />
文本文件格式如下:<br />
<img src="~/Content/Images/number_txt.bmp" alt="" /><br />
<input id="FileMobile" name="FileMobile" type="file" />
<br />
</td>
</tr>
</table>
</div>
<div title="Excel上传导入" style="padding: 5px;">
<table>
<tr>
<td>资源:</td>
<td>
@Html.DropDownList("ResourctType3")
<select id="cmbActive3" name="cmbActive3">
<option value="0">-请选择-</option>
</select>
</td>
</tr>
<tr>
<td>文件:</td>
<td>
<br />
excel文件格式如下<br />
<img src="~/Content/Images/number_excel.png" alt="" /><br />
<span style="color:red">注意:excel文件第一行必须要加上列头信息</span>
<input id="FileMobile2" name="FileMobile2" type="file" />
<br />
</td>
</tr>
</table>
</div>
</div>
</form>
<div style=" height:2px;"></div>
<div class="bas_datagrid">
<div id="tb" style="padding:5px;height:auto" class="grid_toolbar">
<ul class="toolBar_ul">
<li>&nbsp;</li>
</ul>
</div>
@Html.Raw(ViewBag.gridTable)
</div>
<script type="text/javascript">
$(document).ready(function () {
$('#frmUpload').ajaxForm({
dataType: 'text',
beforeSend: ForEverajaxLoading,
complete: ForEverajaxLoadEnd,
success: function (data) {
if (data == "ok") {
$.messageBox5s('提示', "号码提交成功!");
loadtablegrid();
$("#frmUpload").resetForm();
$("#cmbActive1").get(0).options.length = 0;//清空历史值
$("<option></option>").val("0").text("-请选择-").attr("retag", "").appendTo($("#cmbActive1"));
$("#cmbActive2").get(0).options.length = 0;//清空历史值
$("<option></option>").val("0").text("-请选择-").attr("retag", "").appendTo($("#cmbActive2"));
$("#cmbActive3").get(0).options.length = 0;//清空历史值
$("<option></option>").val("0").text("-请选择-").attr("retag", "").appendTo($("#cmbActive3"));
} else {
$.messageBox5s('提示', data);
}
}
});
$("#btnSave").click(function () {
var pp = $("#batchMible").tabs("getSelected");
var title = $("#batchMible .tabs-selected").text();
$("#FileType").val(title);
$("#HidRESOURCETAG").val("");
$("#HidACTIVITYID").val("");
$("#HidResourceId").val("");
if (title == "手机号批量提交") {
$("#HidRESOURCETAG").val($("#cmbActive1 option:selected").attr("retag"));
$("#HidACTIVITYID").val($("#cmbActive1").val());
$("#HidResourceId").val($("#ResourctType1").val());
} else if (title == "文件上传导入") {
$("#HidRESOURCETAG").val($("#cmbActive2 option:selected").attr("retag"));
$("#HidACTIVITYID").val($("#cmbActive2").val());
$("#HidResourceId").val($("#ResourctType2").val());
} else if (title == "Excel上传导入") {
$("#HidRESOURCETAG").val($("#cmbActive3 option:selected").attr("retag"));
$("#HidACTIVITYID").val($("#cmbActive3").val());
$("#HidResourceId").val($("#ResourctType3").val());
}
if ($("#HidResourceId").val() == "0" || $("#HidACTIVITYID").val() == "0") {
$.messageBox5s('提示', "请先选中资源类型");
return;
}
/*
document.getElementById("bg").style.display = "block";
document.getElementById("show").style.display = "block";
*/
$('#frmUpload').submit();
/*
$("#frmUpload").ajaxSubmit({
url: "/Res/ImportRes/RecFile",
type: "post",
iframe: false,
dataType: 'text',
success: function (data, statusText) {
document.getElementById("bg").style.display = 'none';
document.getElementById("show").style.display = 'none';
if (data == "ok") {
$.messageBox5s('提示', "号码提交成功!");
loadtablegrid();
$("#frmUpload").resetForm();
$("#cmbActive1").get(0).options.length = 0;//清空历史值
$("<option></option>").val("0").text("-请选择-").attr("retag", "").appendTo($("#cmbActive1"));
$("#cmbActive2").get(0).options.length = 0;//清空历史值
$("<option></option>").val("0").text("-请选择-").attr("retag", "").appendTo($("#cmbActive2"));
} else {
$.messageBox5s('提示', data);
}
}, error: function (data) {
document.getElementById("bg").style.display = 'none';
document.getElementById("show").style.display = 'none';
$.messageBox5s('提示', data);
}
});
*/
})
loadtablegrid();
$(window).resize(function () {
$('#tablist').tablegrid('resize', {
height: $(window).height() - 180
});
});
});
function loadtablegrid() {
$("#tablist").tablegrid({
url: '/Res/ImportRes/GetHtmlList',
height: $(window).height() - 180,
loadNow: true
});
}
$("#ResourctType1").change(function () {
var selec = $("#ResourctType1").val();
$("#cmbActive1").get(0).options.length = 0;//清空历史值
$.getJSON("/Res/ImportRes/ActiveList/" + selec, function (data) {
$.each(data, function (i, item) {
$("<option></option>").val(item["ACTIVITYID"]).text(item["ACTIVITYNAME"]).attr("retag", item["RESOURCETAG"]).appendTo($("#cmbActive1"));
});
});
});
$("#ResourctType2").change(function () {
var selec = $("#ResourctType2").val();
$("#cmbActive2").get(0).options.length = 0;//清空历史值
$.getJSON("/Res/ImportRes/ActiveList/" + selec, function (data) {
$.each(data, function (i, item) {
$("<option></option>").val(item["ACTIVITYID"]).text(item["ACTIVITYNAME"]).attr("retag", item["RESOURCETAG"]).appendTo($("#cmbActive2"));
});
});
});
$("#ResourctType3").change(function () {
var selec = $("#ResourctType3").val();
$("#cmbActive3").get(0).options.length = 0;//清空历史值
$.getJSON("/Res/ImportRes/ActiveList/" + selec, function (data) {
$.each(data, function (i, item) {
$("<option></option>").val(item["ACTIVITYID"]).text(item["ACTIVITYNAME"]).attr("retag", item["RESOURCETAG"]).appendTo($("#cmbActive3"));
});
});
});
</script>