天津投入产出系统后端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

125 lines
5.4 KiB

<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/AppMaster.Master"
Inherits="System.Web.Mvc.ViewPage<QMAPP.Web.Models.Sys.FileInfoModel>" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
Edit
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<%=Html.QPEdit("信息", string.IsNullOrEmpty(Model.PID) ? QMFrameWork.WebUI.panelType.Add : QMFrameWork.WebUI.panelType.Update)%>
<table id="editTable">
<tr>
<td>
<table>
<tr>
<th>
<%=Html.QV(p=>p.TYPENO) %>
</th>
<td>
<%=Html.QC(p => p.TYPENO)%>
</td>
</tr>
<tr>
<th>
<%=Html.QV(p=>p.FILENAME) %>
</th>
<td>
<%=Html.QC(p => p.FILENAME)%>
</td>
</tr>
<tr>
<th>
<%=Html.QV(p=>p.REMARK) %>
</th>
<td>
<%=Html.QC(p => p.REMARK)%>
</td>
</tr>
<tr>
<th>
<label style=" color:Red">*</label>
上传附件
</th>
<td colspan="3" >
<input id="ATTACHFILENAME" type="text" style="width:200px;" value="<%=Model.FILESTORAGENAME %>" />
<input id="file" type="file" name="file" onchange="uploadfile(this)" style="width:70px;" />
<label style=" color:Red">(最大上传5M文件)</label>
</td>
</tr>
<tr>
<td colspan="4">
<label style=" color:Red" >
&nbsp;&nbsp;※允许上传文件格式:xls、xlsx、ppt、pptx、doc、docx、txt、</label>
</td>
</tr>
<tr>
<td colspan="4">
<label style=" color:Red" >
&nbsp;&nbsp;&nbsp;&nbsp;bmp、jpg、jpeg、gif、png、rar、zip</label>
</td>
</tr>
</table>
</td>
</tr>
</table>
<%=Html.HiddenFor(p=>p.PID) %>
<%=Html.HiddenFor(p=>p.CREATEDATE) %>
<%=Html.HiddenFor(p=>p.CREATEUSER) %>
<%=Html.HiddenFor(p => p.FILESTORAGENAME)%>
<%=Html.HiddenFor(p => p.ATTACHFILETXT)%>
<%=Html.QPEnd() %>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ToolContent" runat="server">
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td>
<%=Html.QTButtonSave("User", "Save", "return Save();")%>
<%=Html.QTButton("close", "List", "close", "parent.closeAppWindow1();return false;", (s, f) => { return true; })%>
</td>
</tr>
</table>
<script type="text/javascript">
$(function () {
var filepath = document.getElementById("FILESTORAGENAME").value;
document.getElementById("file").value = filepath;
document.getElementById("ATTACHFILENAME").readOnly = "true";
var filename = document.getElementById("ATTACHFILETXT").value;
document.getElementById("ATTACHFILENAME").value = filename;
});
function Save() {
if (isValidate() == false) {
return false;
}
var newfile = document.getElementById("file").value;
var oldfile = document.getElementById("FILESTORAGENAME").value;
if ((newfile == null || newfile == "") && (oldfile == null || oldfile == "")) {
MSI("提示", "请添加附件");
return false;
}
var filePath = document.getElementById("file").value;
if (filePath != "") {
document.getElementById("FILESTORAGENAME").value = filePath;
//判断文件格式
var fileText = filePath.substring(filePath.lastIndexOf(".", filePath.length)); //获取文件扩展名
fileText = fileText.toLowerCase();
if (fileText != ".xls" && fileText != ".ppt" && fileText != ".doc"
&& fileText != ".xlsx" && fileText != ".txt" && fileText != ".docx"
&& fileText != ".bmp" && fileText != ".jpg" && fileText != ".jpeg"
&& fileText != ".gif" && fileText != ".png" && fileText != ".rar"
&& fileText != ".zip" && fileText != ".pptx") {
MSI("错误", "上传文件格式错误");
return false;
}
}
submitByButton("Save");
}
//触发上传文件事件
function uploadfile(t) {
var filepath = document.getElementById("file").value;
document.getElementById("FILESTORAGENAME").value = filepath;
document.getElementById("ATTACHFILENAME").value = filepath;
}
</script>
</asp:Content>