From c888afad7b611e6341b8e733eff5e651ae82695b Mon Sep 17 00:00:00 2001 From: username@email.com <yzy2002yzy@163.com> Date: 星期四, 10 六月 2021 14:58:43 +0800 Subject: [PATCH] 计件登记,考勤设计 --- zhengcaioa/zhengcaioa/Views/Signin/AskLeave.cshtml | 277 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 256 insertions(+), 21 deletions(-) diff --git a/zhengcaioa/zhengcaioa/Views/Signin/AskLeave.cshtml b/zhengcaioa/zhengcaioa/Views/Signin/AskLeave.cshtml index c1531ae..b2ccff1 100644 --- a/zhengcaioa/zhengcaioa/Views/Signin/AskLeave.cshtml +++ b/zhengcaioa/zhengcaioa/Views/Signin/AskLeave.cshtml @@ -3,6 +3,15 @@ @using zhengcaioa.Models; @{ Layout = null; + ResultDataEntity<SysAttachmentDTO> attachment = ViewBag.attachment as ResultDataEntity<SysAttachmentDTO>; //闂绫诲瀷 + List<SysAttachmentDTO> attachmentsssss = attachment.DataList; + + if (attachmentsssss == null) + { + attachmentsssss = new List<SysAttachmentDTO>(); + } + + List<SysCodeDtl> Lavetype = ViewData["Lavetype"] as List<SysCodeDtl>; //鎷滆鏂瑰紡 } <!DOCTYPE html> <html> @@ -68,37 +77,80 @@ <table style="width: 100%;text-align: left; background-color:white"> <tbody> <tr> + <td class="title">鍗曟嵁鍚嶇О</td> + <td> + <input type="text" class="form-control" value="@Model.Tittle" name="Tittle" id="Tittle" style="width:150px;margin-right: 4px;" validate="RequiredField" autocomplete="off" readonly="readonly"> + </td> + + </tr> + <tr> + <td class="title">鐢宠浜�</td> + <td> + <input type="text" class="form-control" value="@Model.CreaterName" name="CreaterName" id="CreaterName" style="width:150px;margin-right: 4px;" validate="RequiredField" autocomplete="off" readonly="readonly"> + </td> + + </tr> + <tr> <td class="title">璇峰亣鏃堕棿</td> <td> - <input type="text" class="layui-input layer-date ldate form-control" value="@Model.StratTime.ToString("yyyy-MM-dd HH:mm:ss")" name="StratTime" id="StratTime" style="width:150px;margin-right: 4px;" validate="RequiredField" autocomplete="off" readonly="readonly">- - <input type="text" class="layui-input layer-date ldate form-control" value="@Model.EndTime.ToString("yyyy-MM-dd HH:mm:ss")" name="EndTime" id="EndTime" style="width:150px;margin-right: 4px;" validate="RequiredField" autocomplete="off" readonly="readonly"> + <input type="text" class="layui-input layer-date ldate form-control" value="@Model.StratTimeName" name="StratTime" id="StratTime" style="width:150px;margin-right: 4px;" validate="RequiredField" autocomplete="off" readonly="readonly">- <input type="text" class="layui-input layer-date ldate form-control" value="@Model.EndTimeName" name="EndTime" id="EndTime" style="width:150px;margin-right: 4px;" validate="RequiredField" autocomplete="off" readonly="readonly"> </td> + </tr> + <tr> <td class="title">璇峰亣绫诲瀷</td> <td> <select class="leaveType form-control data" name="Lavetype" id="Lavetype" style="margin-right: 4px;"> - <option value="">璇烽�夋嫨</option> - <option value="1">浜嬪亣</option> - <option value="2">鐥呭亣</option> - <option value="3">骞村亣</option> - <option value="4">涓у亣</option> - <option value="5">濠氬亣</option> - <option value="6">浜у亣</option> + <option value="" hassubinfo="true">璇烽�夋嫨</option> + @foreach (var item in Lavetype) + { + @if (!item.CodeSn.Equals(Model.Lavetype)) + { + <option value="@item.CodeSn" hassubinfo="true"> + @item.Comments + </option> + } + else + { + <option value="@item.CodeSn" hassubinfo="true" selected="selected"> + @item.Comments + </option> + } + + } + + @*<option value="1">浜嬪亣</option> + <option value="2">鐥呭亣</option> + <option value="3">璋冧紤</option> + <option value="4">骞村亣</option> + <option value="5">浜у亣</option> + <option value="6">闄骇鍋�</option> + <option value="7">濠氬亣</option> + <option value="8">渚嬪亣</option> + <option value="9">涓у亣</option> + <option value="10">鍝轰钩鍋�</option>*@ + </select> </td> </tr> <tr> <td class="title">璇峰亣鏃堕暱</td> - <td> - <input class="layui-input data" style="width:100px !important;float: left;" type="number" value="@Model.LaveDay" name="LaveDay" min="0" step="1" >澶� - <input class="layui-input data" style="width:100px !important;" type="number" value="@Model.LavehHour" name="LavehHour" min="0" step="1" >灏忔椂 + <td> + <input class="layui-input data" style="width:100px !important;float: left;" type="number" value="@Model.LaveDay" name="LaveDay" id="LaveDay" min="0" step="1" readonly="readonly">澶� + <input class="layui-input data" style="width:100px !important;" type="number" value="@Model.LavehHour" name="LavehHour" id="LavehHour" min="0" step="1" readonly="readonly">灏忔椂 </td> </tr> <tr> <td class="title">澶� 娉�</td> <td> - <textarea class="form-control data" name="Remark" style="width:374px; vertical-align: top;height:100px">@Model.Remark</textarea> + <textarea class="form-control data" name="Remark" style="width:374px; vertical-align: top;height:100px" maxlength="500">@Model.Remark</textarea> + </td> + </tr> + <tr> + <td class="title">涓婁紶闄勪欢</td> + <td> + <input type="file" name="file" id="fileUp" multiple> </td> </tr> <tr> @@ -111,6 +163,24 @@ </tbody> </table> + <div id='file-list-display' style="width: 100%;text-align: left; background-color:white"> + @{ for (int i = 0; i < attachmentsssss.Count; i++) + { + <div> + <a download href='@attachmentsssss[i].Filepath'>@attachmentsssss[i].Filefullname </a> <a href='javascript: void (0);' onclick='js_method(this,"@attachmentsssss[i].Id")'><i class='glyphicon glyphicon-remove'></i> </a> + <input type="hidden" name="attachmentid" value="@attachmentsssss[i].Id" /> + <input type="hidden" name="Filepath" value="@attachmentsssss[i].Filepath" /> + <input type="hidden" name="Filefullname" value="@attachmentsssss[i].Filefullname" /> + + + </div> + } + + + + } + + </div> </form> <script type="text/javascript"> @@ -140,7 +210,7 @@ $(".ldate").each(function (el) { laydate({ elem: "#" + $(this).attr('id'), //瀵瑰簲id - format: 'YYYY-MM-DD hh:mm:ss', //鏃ユ湡鏍煎紡 // 鍒嗛殧绗﹀彲浠ヤ换鎰忓畾涔夛紝璇ヤ緥瀛愯〃绀哄彧鏄剧ず骞存湀 + format: 'YYYY-MM-DD hh:mm', //鏃ユ湡鏍煎紡 // 鍒嗛殧绗﹀彲浠ヤ换鎰忓畾涔夛紝璇ヤ緥瀛愯〃绀哄彧鏄剧ず骞存湀 min: '2021-01-01', //璁惧畾鏈�灏忔棩鏈熶负褰撳墠鏃ユ湡 max: '2099-06-16', //鏈�澶ф棩鏈� type: 'datetime', @@ -148,15 +218,16 @@ istime: true, 聽 //鏄惁鏄剧ず鏃跺垎绉� istoday: true, //鏄惁鏄粖澶� choose: function (datas) { //閫夋嫨鏃ユ湡瀹屾瘯鐨勫洖璋� - // console.log(this); + // console.log("234234234234324"); // end.min = datas; //寮�濮嬫棩閫夊ソ鍚庯紝閲嶇疆缁撴潫鏃ョ殑鏈�灏忔棩鏈� // end.start = datas //灏嗙粨鏉熸棩鐨勫垵濮嬪�艰瀹氫负寮�濮嬫棩 + checktime(); } }); }); $("#Lavetype").val("@Model.Lavetype"); - $("#SigninId").val("@ViewBag.SigninId"); + }) @@ -164,15 +235,18 @@ function Save() { if ($("#StratTime").val() == '') { - toastr.warning("寮�濮嬫椂闂翠笉鑳戒负绌�"); + toastr.warning("寮�濮嬫棩鏈熶笉鑳戒负绌�"); return; } if ($("#EndTime").val() == '') { - toastr.warning("缁撴潫鏃堕棿涓嶈兘涓虹┖"); + toastr.warning("缁撴潫鏃ユ湡涓嶈兘涓虹┖"); return; } - + if ($("#EndTime").val() <= $("#StratTime").val()) { + toastr.warning("缁撴潫鏃ユ湡涓嶈兘灏忎簬寮�濮嬫棩鏈�"); + return; + } if ($("#Lavetype").val() == '') { toastr.warning("璇峰亣绫诲瀷涓嶈兘涓虹┖"); return; @@ -182,7 +256,15 @@ toastr.warning("璇峰亣澶╂暟涓嶈兘涓虹┖"); return; } - + + if ($("#LavehHour").val() == '') { + toastr.warning("璇峰亣灏忔椂涓嶈兘涓虹┖"); + return; + } + + + + //var data = { id: $("#Id").val(), StartTime:$("#StartTime").val(), Sheng: $("#Sheng").val(), job_level: $("#Job_level").val().toString(), ExistsAttachment: fileId != "" } $.ajax({ type: "POST", @@ -192,7 +274,7 @@ async: false, data: $('form').serializeArray(), success: function (data) { - + if (data.Result) { // parent._afterSave(true); @@ -220,6 +302,159 @@ }); } + + + $("#fileUp").on("change", function () { + + + var fileM = document.querySelector("#fileUp"); + //鑾峰彇鏂囦欢瀵硅薄锛宖iles鏄枃浠堕�夊彇鎺т欢鐨勫睘鎬э紝瀛樺偍鐨勬槸鏂囦欢閫夊彇鎺т欢閫夊彇鐨勬枃浠跺璞★紝绫诲瀷鏄竴涓暟缁� + var fileList = fileM.files; + if (!fileList || fileList.length == 0) { + toastr.warning("璇烽�夋嫨鏂囦欢锛�"); + return + } + + //鍒涘缓formdata瀵硅薄锛宖ormData鐢ㄦ潵瀛樺偍琛ㄥ崟鐨勬暟鎹紝琛ㄥ崟鏁版嵁鏃朵互閿�煎褰㈠紡瀛樺偍鐨勩�� + var formData = new FormData(); + for (var i = 0; i < fileList.length; i++) { + var file = fileList[i]; + + var filePath = file.value; //js涓棤娉曡幏鍙栨枃浠剁殑鐪熸槸璺緞 + + var fileSize = file.size + var isLt10M = fileSize / 1024 / 1024 < 10 + if (!isLt10M) { + + toastr.warning(file.name + " 涓婁紶鏂囦欢澶у皬涓嶈兘瓒呰繃10M"); + file = '' + return + } + formData.append('files', file, file.name); + } + + + + + $.ajax({ + url: "/Systemsetting/fileUpTongYong/", + type: "post", + dataType: "json", + data: formData, + async: false, + cache: false, + contentType: false, + processData: false, + success: function (data) { + if (data.Result) { + parent.layer.msg('涓婁紶鎴愬姛', { icon: 6 }); + var fileListDisplay = $("#file-list-display"); + if (data.DataList && data.DataList.length > 0) { + for (var i = 0; i < data.DataList.length; i++) { + var aaa = "<div><a download href ='" + data.DataList[i].Filepath + "'>" + data.DataList[i].Filefullname + " </a> <a href='javascript: void (0);' onclick='js_method(this,\"\")' ><i class='glyphicon glyphicon-remove'></i> </a> " + aaa += ' <input type="hidden" name="attachmentid" value="" /> '; + aaa += ' <input type="hidden" name="Filepath" value="' + data.DataList[i].Filepath + '" /> '; + aaa += ' <input type="hidden" name="Filefullname" value="' + data.DataList[i].Filefullname + '" /> '; + + aaa += "</div>"; + fileListDisplay.append(aaa); + } + } + + + //$("#Logo1").attr("src", data.Message); + //$("#Logo").val(data.Message); + } + else { + toastr.error("涓婁紶澶辫触"); + + } + }, + }); + }); + + function js_method(obj, id) { + + + + + if (id && id != "") { + + $.ajax({ + url: "/Systemsetting/fileUpremove?id=" + id, + type: "post", + dataType: "json", + data: "", + async: false, + cache: false, + contentType: false, + processData: false, + success: function (data) { + if (data.Result) { + $(obj).parent().remove(); + toastr.error("鍒犻櫎鎴愬姛"); + } + else { + toastr.error("鍒犻櫎澶辫触"); + + } + }, + }); + } else { + $(obj).parent().remove(); + } + + + + } + + + function checktime() { + if ($("#StratTime").val() == '') { + $("#LaveDay").val(0); + $("#LavehHour").val(0); + return; + } + + if ($("#EndTime").val() == '') { + $("#LaveDay").val(0); + $("#LavehHour").val(0); + return; + } + + + + + + + var data = { StratTime: $("#StratTime").val(), EndTime: $("#EndTime").val()} + $.ajax({ + type: "POST", + url: "/Signin/Checktime", + dataType: "json", + global: false, + async: false, + data: data, + success: function (data) { + if (data.Result) { + $("#LaveDay").val(data.DataInfo.LaveDay); + $("#LavehHour").val(data.DataInfo.LavehHour); + } + else { + toastr.error(data.Message); + + } + + + + }, + error: function () { + + parent.layer.msg('澶辫触', { icon: 5 }); + } + }); + } + function _pageAutoClose() { parent.window._reloadPageData(); -- Gitblit v1.9.1