From 87101123b14cd2896b8b096f30693ffd95f3993c Mon Sep 17 00:00:00 2001 From: SinoroWu Date: Wed, 7 Dec 2022 09:07:59 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AA=BF=E6=95=B4=20=5FgraphManagement.html=20?= =?UTF-8?q?=E4=B8=8A=E5=82=B3=E6=AA=94=E6=A1=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Frontend/_graphManagement.html | 171 +++++++++++++++++++++++++-------- 1 file changed, 131 insertions(+), 40 deletions(-) diff --git a/Frontend/_graphManagement.html b/Frontend/_graphManagement.html index da6a6cb..2b250c5 100644 --- a/Frontend/_graphManagement.html +++ b/Frontend/_graphManagement.html @@ -253,15 +253,15 @@ building_tag: pageAct.buiTag } objSendData.Data = sendData; - let url = baseApiUrl + "/GraphManage/SaveGraMan"; + let url = baseApiUrl + "/GraphManage/GraManList"; function success(res) { console.log("查看", res); let strHtml = ``; $.each(res, function (index, val) { strHtml = ` - ${res.code} - ${res.code} + ${res.oriOrgName} + ${res.donOrgName} ${res.code} ${res.code} @@ -277,59 +277,138 @@ } // 新增資料 - onEvent('click', '#accManSendBtn', function () { + onEvent('click', '#close', function () { let url = baseApiUrl + "/GraphManage/SaveGraMan"; - pageAct.opeFirmId = $(this).parent().data('id') - objSendData.Data = { id: pageAct.opeFirmId }; - ytAjax = new YourTeam.Ajax(url, objSendData, function (res) { - if (!res || res.code != "0000" || !res.data) { - } else { - pageAct.opeFirmAct = 'edit'; - selSysMain(res.data.device_system_category_layer2); - $('#uploadForm input[id=picNum]').val(res.data.name); - $('#uploadForm input[id=picName]').val(res.data.contact_person); - $('#uploadForm select[id=selMain]').val(res.data.device_system_category_layer2).change(); - $('#uploadForm select[id=selSub]').val(res.data.device_system_category_layer3).change(); - $('#uploadForm input[id=myDesignDiagram]').val(res.data.phone); - $('#uploadForm input[id=myAsBuilt]').val(res.data.email); + let fd = new FormData(); + + fd.append("main_system_tag", $("#upSelMain").val()); + fd.append("sub_system_tag", $("#upSelSub").val()); + fd.append("name", $("#upPicName").val()); + fd.append("oriOrgName", $("#upMyDesignDiagram").val()); + fd.append("donOrgName", $("#upMyAsBuilt").val()); + // fd.append("oriFile", $("#upMyAsBuilt").val()); + // fd.append("donFile", $("#upMyAsBuilt").val()); + fd.append("oriFile", this.files); + // fd.append("donFile", fileHelper2); + // fd.append("product[photos][]", e.target.files[i]); + console.log("查看", fd); + + $.ajax({ + url: url, + type: "POST", + data: fd, + async: false, + cache: false, + contentType: false, + processData: false, + beforeSend: function (xhr) { xhr.setRequestHeader('Authorization', "Bearer " + localStorage.getItem("JWT-Authorization")) }, + success: function (res) { + if (!res || res.code != "0000" || !res.data) { + + } else { + console.log("error"); + } } - }, null, "POST").send() + }); + + // let url = baseApiUrl + "/GraphManage/SaveGraMan"; + // pageAct.opeFirmId = $(this).parent().data('id') + // objSendData.Data = { id: pageAct.opeFirmId }; + // ytAjax = new YourTeam.Ajax(url, objSendData, function (res) { + // if (!res || res.code != "0000" || !res.data) { + + // } else { + // pageAct.opeFirmAct = 'edit'; + // selSysMain(res.data.device_system_category_layer2); + // $('#uploadForm input[id=picNum]').val(res.data.name); + // $('#uploadForm input[id=picName]').val(res.data.contact_person); + // $('#uploadForm select[id=selMain]').val(res.data.device_system_category_layer2).change(); + // $('#uploadForm select[id=selSub]').val(res.data.device_system_category_layer3).change(); + // $('#uploadForm input[id=myDesignDiagram]').val(res.data.phone); + // $('#uploadForm input[id=myAsBuilt]').val(res.data.email); + // } + // }, null, "POST").send() }); - // 取上傳檔名 + // 上傳檔案 + var imageUploadFormOS = 0; $("#upMyDesignDiagram").on("change", function (e) { let fileHelper = new YourTeam.Utility.File(); - let fileName = this.files[0].name; - strHtml = `${fileName}`; - $('#upDesignDiagram').html(strHtml); + if ($('#upForDesignDiagram p').length > 0) { + $("#upForDesignDiagram").html(""); + } + console.log(this.files); + imageUploadFormOS = this.files.length; + + let maxlength = $("#upForDesignDiagram").data("maxlength"); + if (maxlength) { + if (imageUploadFormOS + $('#upForDesignDiagram img').length > maxlength) { + ShowModal("error", "uplImgOverLen", "�L�k�W��", "�̦h�u��W��" + maxlength + "�i�A�z�w�g�W�X�W�Ǽƶq�C"); + $("#upMyDesignDiagram").val(""); + return false; + } + } + fileHelper.readAndPreviewImages(this.files, 'upForDesignDiagram', 0, 86, '
', '
'); + }); - $("#editMyDesignDiagram").on("change", function (e) { - let fileHelper = new YourTeam.Utility.File(); - let fileName = this.files[0].name; + // var imageUploadFormOS = 0; + // $("#upMyAsBuilt").on("change", function (e) { + // let fileHelper = new YourTeam.Utility.File(); - strHtml = `${fileName}`; - $('#editDesignDiagram').html(strHtml); - }); + // if ($('#upForAsBuilt p').length > 0) { + // $("#upForAsBuilt").html(""); + // } + // console.log(this.files); + // imageUploadFormOS = this.files.length; + + // let maxlength = $("#upForAsBuilt").data("maxlength"); + // if (maxlength) { + // if (imageUploadFormOS + $('#upForAsBuilt img').length > maxlength) { + // ShowModal("error", "uplImgOverLen", "�L�k�W��", "�̦h�u��W��" + maxlength + "�i�A�z�w�g�W�X�W�Ǽƶq�C"); + // $("#upMyAsBuilt").val(""); + // return false; + // } + // } + // fileHelper.readAndPreviewImages(this.files, 'upForAsBuilt', 0, 86, '
', '
'); + + // }); // 取上傳檔名 - $("#upMyAsBuilt").on("change", function (e) { - let fileHelper = new YourTeam.Utility.File(); - let fileName = this.files[0].name; + // $("#upMyDesignDiagram").on("change", function (e) { + // let fileHelper = new YourTeam.Utility.File(); + // let fileName = this.files[0].name; - strHtml = `${fileName}`; - $('#upAsBuiltDrawing').html(strHtml); - }); + // strHtml = `${fileName}`; + // $('#upDesignDiagram').html(strHtml); + // }); - $("#editMyAsBuilt").on("change", function (e) { - let fileHelper = new YourTeam.Utility.File(); - let fileName = this.files[0].name; + // $("#editMyDesignDiagram").on("change", function (e) { + // let fileHelper = new YourTeam.Utility.File(); + // let fileName = this.files[0].name; - strHtml = `${fileName}`; - $('#editAsBuiltDrawing').html(strHtml); - }); + // strHtml = `${fileName}`; + // $('#editDesignDiagram').html(strHtml); + // }); + + // 取上傳檔名 + // $("#upMyAsBuilt").on("change", function (e) { + // let fileHelper = new YourTeam.Utility.File(); + // let fileName = this.files[0].name; + + // strHtml = `${fileName}`; + // $('#upAsBuiltDrawing').html(strHtml); + // }); + + // $("#editMyAsBuilt").on("change", function (e) { + // let fileHelper = new YourTeam.Utility.File(); + // let fileName = this.files[0].name; + + // strHtml = `${fileName}`; + // $('#editAsBuiltDrawing').html(strHtml); + // }); // 全選功能 function check_all(obj, cName) { @@ -343,6 +422,18 @@ console.log($("#editPicNum").val()); }); + // 關閉 modal + $('#uploadPicture').on('hidden.bs.modal', function (e) { + console.log("123456789"); + }); + $('#colorModal').on('hidden.bs.modal', function () { + // # 可以设置下拉框为初始值 + $("#colorCodeSelect").val(-1); + // # 清空表单校验信息 + $("#add").Validform().resetForm(); + $(".Validform_checktip").html(""); + }); + // 刪除資料 onEvent('click', '#del', function () { pageAct.opeRecId = null;