62 lines
2.7 KiB
Plaintext
62 lines
2.7 KiB
Plaintext
@*文件上传组件*@
|
|
@model ImportFileModel
|
|
@{
|
|
Layout = null;
|
|
}
|
|
<script>
|
|
function uploadChange(event) {
|
|
var fileInput = event.target;
|
|
var file = fileInput.files[0];
|
|
if (file) {
|
|
// 获取文件名并更新按钮的value
|
|
var fileName = file.name;
|
|
$('#uploadfileButton').val(fileName);
|
|
} else {
|
|
// 如果没有文件被选择,可以重置按钮的value
|
|
$('#uploadfileButton').val('请选择...');
|
|
}
|
|
}
|
|
|
|
function uploadfileInit() {
|
|
$('#uploadfile').val([]);
|
|
$('#uploadfileButton').val("请选择...");
|
|
}
|
|
|
|
</script>
|
|
<div style="padding:5px">
|
|
<div class="modal" tabindex="-1" id="modalFileUpload" data-backdrop="static">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content" style="min-width:400px;" id="Content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title">@Model.Title</h5>
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<span>文件:</span>
|
|
<input type="file" accept="@Model.Accept" id="uploadfile" style="display: none" onchange=uploadChange(event)>
|
|
<input style="width:90%; height: 28px; text-align: left;" type="button" id="uploadfileButton" onclick="$('#uploadfile').click();" value="请选择..." />
|
|
<div style="margin-top: 15px;" id="notes">
|
|
@Html.Raw(Model.NotesHtml)
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<div style="margin: 5px; float: right;" id="buttons">
|
|
@foreach (KeyValuePair<string, BtnReq> button in Model.Buttons)
|
|
{
|
|
<button id="@(string.IsNullOrWhiteSpace(button.Value.Id) ? "" : button.Value.Id)"
|
|
class="@(string.IsNullOrWhiteSpace(button.Value.AddClass) ? "btn btn-primary" : button.Value.AddClass)"
|
|
type="button"
|
|
onclick="@(string.IsNullOrWhiteSpace(button.Value.OnClick) ? ";return false;" : button.Value.OnClick)"
|
|
|
|
>
|
|
@button.Key
|
|
</button>
|
|
}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div> |