diff --git a/Frontend/_alert.html b/Frontend/_alert.html index a3cae03..45414fa 100644 --- a/Frontend/_alert.html +++ b/Frontend/_alert.html @@ -92,7 +92,7 @@
-
@@ -143,9 +143,14 @@
-
+
-
+
+
+
+
+ +
backup @@ -158,11 +163,6 @@
- -
- -
@@ -181,10 +181,11 @@ pageAct.selSysSub = null; pageAct.alr_startdate = null; pageAct.alr_enddate = null; + pageAct.imageFile = []; first = true; $(function () { - $(loadEle).Loading("close"); + initDropzone(); setReturn(false); setConfirm(false); event(); @@ -287,10 +288,15 @@ + alr_tableData.alarmClass.toString().split('_')[1] + "_" + alr_tableData.buildingFloorName_zh.toString().split('-')[1] + "_" + alr_tableData.sourceName_zh.toString().split('-')[0] + "_" + alr_tableData.sourceName_zh.toString().split('-')[1]; - $('#inpFixDoCode').val($(`option[value*=${deviceNumber}]`).val() !== undefined ? $(`option[value*=${deviceNumber}]`).val() : ""); selUser(); selDevice(); selOpeFir(); + + $('#inpFixDoCode option[data-sub=' + alr_tableData.alarmClass.toString().split('_')[1] + '][data-main=' + alr_tableData.alarmClass.toString().split('_')[0] + ']').attr('hidden', false); + $('#inpFixDoCode option[data-sub!=' + alr_tableData.alarmClass.toString().split('_')[1] + '][data-main!=' + alr_tableData.alarmClass.toString().split('_')[0] + ']').attr('hidden', true); + + let alr_fixDoCode = $($('#inpFixDoCode option[data-sub=' + alr_tableData.alarmClass.toString().split('_')[1] + '][data-main=' + alr_tableData.alarmClass.toString().split('_')[0] + ']')[0]).val(); + $('#inpFixDoCode').val(alr_fixDoCode); }); } @@ -486,7 +492,7 @@ "title": "異常類別", "data": "alarmClass", "render": function (data) { - return data.split('_')[1]; + return data.split('_')[0] + "-" + data.split('_')[1]; } }, { @@ -550,7 +556,7 @@ strHtml = ``; $("#inpFixDoCode").html(); $.each(res.data, (index, roleObj) => { - strHtml += ``; + strHtml += ``; if (index == 0) { pageAct.sysMain = roleObj.device_system_tag; @@ -598,4 +604,49 @@ } }, null, "POST").send(); } + + //上傳檔案 dropzone + function initDropzone() { + uploader = $("#alr_dropZone").dropzone({ + url: baseApiUrl + '/api/Upload', + previewsContainer: false, + addRemoveLinks: false, + dictRemoveFile: `delete`, + dictInvalidFileType: `上傳格式錯誤`, + dictCancelUploadConfirmation: `確定要取消上傳此檔案嗎?`, + dictCancelUpload: `cancel`, + maxFilesize: 3, + filesizeBase: 1024, + maxFiles: 50, + acceptedFiles: ".pdf, .docx, .doc, .xls, .xlsm, .xlsx, .ppt, .pptx, .gif, .png, .jpg, .jpeg", + headers: { "Authorization": 'Bearer ' + localStorage.getItem("JWT-Authorization") }, + accept: function (file, done) { + let fileHelper = new YourTeam.Utility.File(); + tmpGuidArr = []; + + if (/\.(jpe?g|png|gif)$/i.test(file.name)) { + fileHelper.readAndPreviewImages(file, 'alr_forImage', 70, 70, '', ''); + + pageAct.imageFile.map(function (v, i) { tmpGuidArr.push(v.file.guid) }); + if (jQuery.inArray(file.guid, tmpGuidArr) == -1) { //not in array + let fd = new FormData(); + let f = file; + fd.append('file', f); + pageAct.imageFile.push({ "ori_file_name": f.name, "save_file_name": f.guid, "file": fd.get("file") }); + } + } + else if (/\.(xls?x|doc?x|ptt?x|pdf|zip|rar|7zip|txt|odt|xml|rtf|ods|odp|pps?x)$/i.test(file.name)) { + fileHelper.readAndPreviewFiles(file, 'alr_forFile', 70, 70, "
", "
"); + + pageAct.imageFile.map(function (v, i) { tmpGuidArr.push(v.file.guid) }); + if (jQuery.inArray(file.guid, tmpGuidArr) == -1) { //not in array + let fd = new FormData(); + let f = file; + fd.append('file', f); + pageAct.imageFile.push({ "ori_file_name": f.name, "save_file_name": f.guid, "file": fd.get("file") }); + } + } + } + }); + } \ No newline at end of file diff --git a/Frontend/_operation.html b/Frontend/_operation.html index a05db5f..7b6e747 100644 --- a/Frontend/_operation.html +++ b/Frontend/_operation.html @@ -7,7 +7,7 @@
- +
@@ -246,9 +246,14 @@
-
+
-
+
+
+
+
+ +
backup @@ -261,11 +266,6 @@
- -
- -
@@ -301,10 +301,13 @@ \ No newline at end of file diff --git a/Frontend/js/n4js/bajatest.js b/Frontend/js/n4js/bajatest.js index ceea87c..c89a906 100644 --- a/Frontend/js/n4js/bajatest.js +++ b/Frontend/js/n4js/bajatest.js @@ -9,7 +9,7 @@ var ordPathForAlarm; //當前點選選單的tag,用來抓出alarm路徑 let baja_subscribe_electricmeter_callback_func; let baja_subscribe_end_electricmeter_callback_func; -var ordPathForElectricmeter; +var ordPathForElectricmeter; var startPageLoading; // 開始 loading var endPageLoading; // 開始 loading @@ -378,11 +378,11 @@ function BajaSubscribeAlarmsByBql(ordPathForAlarm) { /** * 使用者透過BQL指定路徑去訂閱 electricmeter */ - function BajaSubscribeElectricmeterByBql(ordPathForElectricmeter) { +function BajaSubscribeElectricmeterByBql(ordPathForElectricmeter) { require(['baja!'], function (baja) { - console.log("進入Function 準備執行BQL訂閱"); + //console.log("進入Function 準備執行BQL訂閱"); startPageLoading ? startPageLoading() : "" var init_start = new Date(Date.now()); var sub = new baja.Subscriber(); @@ -436,7 +436,7 @@ function BajaSubscribeAlarmsByBql(ordPathForAlarm) { var total_component_index = 0; var totalTargetDevice = []; var readBqlFinish = new Date(Date.now()); - console.log("讀取路徑完成-花費時間", (readBqlFinish.getTime() - init_start.getTime()) / 1000 + "sec"); + //console.log("讀取路徑完成-花費時間", (readBqlFinish.getTime() - init_start.getTime()) / 1000 + "sec"); table.cursor({ before: function () { totalTargetDevice = []; @@ -514,7 +514,7 @@ function BajaSubscribeAlarmsByBql(ordPathForAlarm) { baja_subscribe_end_electricmeter_callback_func(totalTargetDevice); } endPageLoading ? endPageLoading() : "" - console.log("表格完成時間", (tableFinish.getTime() - tableStart.getTime()) / 1000 + "sec"); + //console.log("表格完成時間", (tableFinish.getTime() - tableStart.getTime()) / 1000 + "sec"); }, limit: -1, offset: 0 diff --git a/FrontendWebApi/ApiControllers/FileController.cs b/FrontendWebApi/ApiControllers/FileController.cs index 53be5c5..7e257b5 100644 --- a/FrontendWebApi/ApiControllers/FileController.cs +++ b/FrontendWebApi/ApiControllers/FileController.cs @@ -1,8 +1,10 @@ using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; +using NPOI.SS.Formula.Functions; using Repository.BackendRepository.Interface; using Repository.FrontendRepository.Interface; using System; +using System.Collections.Generic; using System.IdentityModel.Tokens.Jwt; using System.IO; using System.Net; @@ -76,5 +78,17 @@ namespace FrontendWebApi.ApiControllers var filePath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "excel", path); return File(System.IO.File.ReadAllBytes(Path.Combine(filePath, fileName)), "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", fileName); } + + [HttpPost] + [Route("api/Upload")] + public ActionResult DroZonUplFile() + { + var a = HttpContext.Request.Form.Files; + return Json(new + { + code = "0000", + data = HttpContext.Request.Form.Files + }); + } } }