調整 _graphManagement.html 上傳檔案
This commit is contained in:
		
							parent
							
								
									7952db1ac3
								
							
						
					
					
						commit
						87101123b1
					
				@ -253,15 +253,15 @@
 | 
				
			|||||||
            building_tag: pageAct.buiTag
 | 
					            building_tag: pageAct.buiTag
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        objSendData.Data = sendData;
 | 
					        objSendData.Data = sendData;
 | 
				
			||||||
        let url = baseApiUrl + "/GraphManage/SaveGraMan";
 | 
					        let url = baseApiUrl + "/GraphManage/GraManList";
 | 
				
			||||||
        function success(res) {
 | 
					        function success(res) {
 | 
				
			||||||
            console.log("查看", res);
 | 
					            console.log("查看", res);
 | 
				
			||||||
            let strHtml = ``;
 | 
					            let strHtml = ``;
 | 
				
			||||||
            $.each(res, function (index, val) {
 | 
					            $.each(res, function (index, val) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                strHtml = `<tr>
 | 
					                strHtml = `<tr>
 | 
				
			||||||
                                <td>${res.code}</td>
 | 
					                                <td>${res.oriOrgName}</td>
 | 
				
			||||||
                                <td>${res.code}</td>
 | 
					                                <td>${res.donOrgName}</td>
 | 
				
			||||||
                                <td>${res.code}</td>
 | 
					                                <td>${res.code}</td>
 | 
				
			||||||
                                <td>${res.code}</td>
 | 
					                                <td>${res.code}</td>
 | 
				
			||||||
                                <td>
 | 
					                                <td>
 | 
				
			||||||
@ -277,59 +277,138 @@
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // 新增資料
 | 
					    // 新增資料
 | 
				
			||||||
    onEvent('click', '#accManSendBtn', function () {
 | 
					    onEvent('click', '#close', function () {
 | 
				
			||||||
        let url = baseApiUrl + "/GraphManage/SaveGraMan";
 | 
					        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 {
 | 
					        let fd = new FormData();
 | 
				
			||||||
                pageAct.opeFirmAct = 'edit';
 | 
					
 | 
				
			||||||
                selSysMain(res.data.device_system_category_layer2);
 | 
					        fd.append("main_system_tag", $("#upSelMain").val());
 | 
				
			||||||
                $('#uploadForm input[id=picNum]').val(res.data.name);
 | 
					        fd.append("sub_system_tag", $("#upSelSub").val());
 | 
				
			||||||
                $('#uploadForm input[id=picName]').val(res.data.contact_person);
 | 
					        fd.append("name", $("#upPicName").val());
 | 
				
			||||||
                $('#uploadForm select[id=selMain]').val(res.data.device_system_category_layer2).change();
 | 
					        fd.append("oriOrgName", $("#upMyDesignDiagram").val());
 | 
				
			||||||
                $('#uploadForm select[id=selSub]').val(res.data.device_system_category_layer3).change();
 | 
					        fd.append("donOrgName", $("#upMyAsBuilt").val());
 | 
				
			||||||
                $('#uploadForm input[id=myDesignDiagram]').val(res.data.phone);
 | 
					        // fd.append("oriFile", $("#upMyAsBuilt").val());
 | 
				
			||||||
                $('#uploadForm input[id=myAsBuilt]').val(res.data.email);
 | 
					        // 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) {
 | 
					    $("#upMyDesignDiagram").on("change", function (e) {
 | 
				
			||||||
        let fileHelper = new YourTeam.Utility.File();
 | 
					        let fileHelper = new YourTeam.Utility.File();
 | 
				
			||||||
        let fileName = this.files[0].name;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        strHtml = `<small>${fileName}</small>`;
 | 
					        if ($('#upForDesignDiagram p').length > 0) {
 | 
				
			||||||
        $('#upDesignDiagram').html(strHtml);
 | 
					            $("#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", "<22>L<EFBFBD>k<EFBFBD>W<EFBFBD><57>", "<22>̦h<CCA6>u<EFBFBD><75>W<EFBFBD><57>" + maxlength + "<22>i<EFBFBD>A<EFBFBD>z<EFBFBD>w<EFBFBD>g<EFBFBD>W<EFBFBD>X<EFBFBD>W<EFBFBD>Ǽƶq<C6B6>C");
 | 
				
			||||||
 | 
					                $("#upMyDesignDiagram").val("");
 | 
				
			||||||
 | 
					                return false;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        fileHelper.readAndPreviewImages(this.files, 'upForDesignDiagram', 0, 86, '<div class="file-item">', '<button class="del-small-trash" name="btnDelImg" ><i class="fa fa-times"></i></button></div>');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $("#editMyDesignDiagram").on("change", function (e) {
 | 
					    // var imageUploadFormOS = 0;
 | 
				
			||||||
        let fileHelper = new YourTeam.Utility.File();
 | 
					    // $("#upMyAsBuilt").on("change", function (e) {
 | 
				
			||||||
        let fileName = this.files[0].name;
 | 
					    //     let fileHelper = new YourTeam.Utility.File();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        strHtml = `<small>${fileName}</small>`;
 | 
					    //     if ($('#upForAsBuilt p').length > 0) {
 | 
				
			||||||
        $('#editDesignDiagram').html(strHtml);
 | 
					    //         $("#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", "<22>L<EFBFBD>k<EFBFBD>W<EFBFBD><57>", "<22>̦h<CCA6>u<EFBFBD><75>W<EFBFBD><57>" + maxlength + "<22>i<EFBFBD>A<EFBFBD>z<EFBFBD>w<EFBFBD>g<EFBFBD>W<EFBFBD>X<EFBFBD>W<EFBFBD>Ǽƶq<C6B6>C");
 | 
				
			||||||
 | 
					    //             $("#upMyAsBuilt").val("");
 | 
				
			||||||
 | 
					    //             return false;
 | 
				
			||||||
 | 
					    //         }
 | 
				
			||||||
 | 
					    //     }
 | 
				
			||||||
 | 
					    //     fileHelper.readAndPreviewImages(this.files, 'upForAsBuilt', 0, 86, '<div class="file-item">', '<button class="del-small-trash" name="btnDelImg" ><i class="fa fa-times"></i></button></div>');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // 取上傳檔名
 | 
					    // 取上傳檔名
 | 
				
			||||||
    $("#upMyAsBuilt").on("change", function (e) {
 | 
					    // $("#upMyDesignDiagram").on("change", function (e) {
 | 
				
			||||||
        let fileHelper = new YourTeam.Utility.File();
 | 
					    //     let fileHelper = new YourTeam.Utility.File();
 | 
				
			||||||
        let fileName = this.files[0].name;
 | 
					    //     let fileName = this.files[0].name;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        strHtml = `<small>${fileName}</small>`;
 | 
					    //     strHtml = `<small>${fileName}</small>`;
 | 
				
			||||||
        $('#upAsBuiltDrawing').html(strHtml);
 | 
					    //     $('#upDesignDiagram').html(strHtml);
 | 
				
			||||||
    });
 | 
					    // });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $("#editMyAsBuilt").on("change", function (e) {
 | 
					    // $("#editMyDesignDiagram").on("change", function (e) {
 | 
				
			||||||
        let fileHelper = new YourTeam.Utility.File();
 | 
					    //     let fileHelper = new YourTeam.Utility.File();
 | 
				
			||||||
        let fileName = this.files[0].name;
 | 
					    //     let fileName = this.files[0].name;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        strHtml = `<small>${fileName}</small>`;
 | 
					    //     strHtml = `<small>${fileName}</small>`;
 | 
				
			||||||
        $('#editAsBuiltDrawing').html(strHtml);
 | 
					    //     $('#editDesignDiagram').html(strHtml);
 | 
				
			||||||
    });
 | 
					    // });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // 取上傳檔名
 | 
				
			||||||
 | 
					    // $("#upMyAsBuilt").on("change", function (e) {
 | 
				
			||||||
 | 
					    //     let fileHelper = new YourTeam.Utility.File();
 | 
				
			||||||
 | 
					    //     let fileName = this.files[0].name;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    //     strHtml = `<small>${fileName}</small>`;
 | 
				
			||||||
 | 
					    //     $('#upAsBuiltDrawing').html(strHtml);
 | 
				
			||||||
 | 
					    // });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // $("#editMyAsBuilt").on("change", function (e) {
 | 
				
			||||||
 | 
					    //     let fileHelper = new YourTeam.Utility.File();
 | 
				
			||||||
 | 
					    //     let fileName = this.files[0].name;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    //     strHtml = `<small>${fileName}</small>`;
 | 
				
			||||||
 | 
					    //     $('#editAsBuiltDrawing').html(strHtml);
 | 
				
			||||||
 | 
					    // });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // 全選功能
 | 
					    // 全選功能
 | 
				
			||||||
    function check_all(obj, cName) {
 | 
					    function check_all(obj, cName) {
 | 
				
			||||||
@ -343,6 +422,18 @@
 | 
				
			|||||||
        console.log($("#editPicNum").val());
 | 
					        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 () {
 | 
					    onEvent('click', '#del', function () {
 | 
				
			||||||
        pageAct.opeRecId = null;
 | 
					        pageAct.opeRecId = null;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user