ComplianceServer/oldcode/WEB/Views/Res/Resource/Import.cshtml

143 lines
5.0 KiB
Plaintext

@using WX.CRM.WebHelper;
@{
ViewBag.Title = "导入分配资源";
Layout = "~/Views/Shared/_Index_Layout2.cshtml";
}
<script src="/Scripts/jquery-ui-1.8.24.min.js" type="text/javascript"></script>
<script src="/Scripts/uploadify/jquery.uploadify.min.js" type="text/javascript"></script>
<script src="/Scripts/op/main_op.js" type="text/javascript"></script>
<link href="/Scripts/uploadify/uploadify.css" rel="stylesheet" type="text/css" />
<div class="mvctool bgb">
<div class="mvctool">
@Html.Action("ToolBar", "Control", ViewBag.ToolBar as ToolBar)
</div>
</div>
<div class="bas_datagrid">
<div id="tb" style="padding:5px;height:auto" class="grid_toolbar">
<ul class="toolBar_ul">
<li>资源类型: @Html.DropDownList("ddlResType", null, new { style="width:220px" })&nbsp;</li>
<li>
资源活动: <select id="ddlActity" style="width:220px"></select>&nbsp;
</li>
<li>分配人: @Html.TextBox("txtDisLeader")&nbsp;</li>
<li>附言: @Html.TextBox("txtSalesRemark")&nbsp;</li>
<li>备注: @Html.TextBox("txtRemark")&nbsp;</li>
</ul>
</div>
<div id="divUpload">
<p><input id="distributefile" name="distributefile" type="file" /></p>
<p style="margin-top:5px;font-size:14px;font-weight:bold;"><span id="result"></span></p>
</div>
<div id="divView" style="display:none;">
@Html.Raw(ViewBag.gridTable)
</div>
</div>
<script lang="javascript">
$(function () {
$("#Other3").hide();
$("#Other2").hide();
$("#ddlResType").change();
//上传
$('#distributefile').uploadify({
//debug: true,
'auto': false,
'buttonText': '请选择上传文件',
'swf': '/Scripts/uploadify/uploadify.swf',
'uploader': '/Resource/Upload',
//'cancelImg': '/Scripts/uploadify/uploadify-cancel.png',
//'button_image_url': '/Scripts/uploadify/browse-btn.png',
'fileTypeDesc': 'excel文件',
'fileTypeExts': '*.csv; *.xls; *.xlsx',
'sizeLimit': 1024 * 1024 * 4, //4M
'multi': false,
'onUploadSuccess': function (file, data, response) {
//$('#' + file.id).find('.data').html(' 上传完毕');
eval("data=" + data);
//alert('文件 ' + file.name + ' 已经上传成功,并返回 ' + response + ' 保存文件名称为 ' + data.SaveName);
$("#Other3").show();
$("#Other1").hide();
$("#Other2").show();
$("#divUpload").hide();
$("#divView").show();
Loadtablist(data.SaveName);
}
});
$("#ddlResType").change(function () {
var selec = $("#ddlResType").val();
$("#ddlActity").get(0).options.length = 0;
$.getJSON("/Resource/GetActivity", { 'resid': selec }, function (data) {
for (var i = 0; i < data.length; i++) {
$("#ddlActity").append("<option value='" + data[i].ACTIVITYID + "'>" + data[i].ACTIVITYNAME + "</option>");
}
});
});
$(window).resize(function () {//自动适应大小
$('#tablist').tablegrid('resize', {
height: $(window).height() - 110
});
});
});
function Upload() {
$('#distributefile').uploadify('upload');
}
function Loadtablist(file) {
$('#tablist').tablegrid({
url: '/Resource/BindResUploadRes?file=' + file,
height: $(window).height() - 110,
loadNow: true,
});
}
function UploadCancel() {
$("#Other3").hide();
$("#divUpload").show();
$("#divView").hide();
$("#Other1").show();
$("#Other2").hide();
}
function SaveDistibute() {
var resType = $("#ddlResType").val();
var actity = $("#ddlActity").val();
var disLeader = $("#txtDisLeader").val();
var salesRemark = $("#txtSalesRemark").val();
var remark = $("#txtRemark").val();
if (resType == "") {
frameReturnByMes("请选择资源类型!");
return;
}
if (actity == "") {
frameReturnByMes("请选择资源活动!");
return;
}
if (disLeader == "") {
frameReturnByMes("请填写分配人!");
return;
}
if (salesRemark == "") {
frameReturnByMes("请填写附言!");
return;
}
if (remark == "") {
frameReturnByMes("请填写备注!");
return;
}
$.post("/Resource/SaveDistibute", {
resType: resType,
actity: actity,
disLeader: disLeader,
salesRemark: salesRemark,
remark: remark
}, function (res) {
frameReturnByMes(res.Message);
})
}
</script>