diff --git a/src/main/resources/static/assets/js/project_budget.js b/src/main/resources/static/assets/js/project_budget.js index 8b3f62f..3eec308 100644 --- a/src/main/resources/static/assets/js/project_budget.js +++ b/src/main/resources/static/assets/js/project_budget.js @@ -58,9 +58,11 @@ // }; var result = 0; +var check = 0; $(function () { - generateFileupload('icon'); + + generateFileupload2('icon'); $("input[name='costCompanyManageTaxExclude']").change(function () { digitalSelf("costCompanyManageTaxExclude", "input[name='costCompanyManageTaxExclude']"); @@ -202,6 +204,10 @@ $(function () { $("#collaboratorUrl").val($("#collaboratorUrl_span").text()); checkIfFillIn(); + if (check === 1) { + $("#saveApprove").attr('disabled', false); + return; + } var dataIncome = collectData("am-modal-prompt-input-income"); if (dataIncome.length <= 5) { @@ -334,7 +340,9 @@ function checkIfFillIn() { var startTime = $("#startDateBudget").val(); var endTime = $("#endDateBudget").val(); var underwrittenMode = $("#underwrittenModeBudget").val(); + var cooperateType = $("#cooperateTypeBudget").val(); var collaborator = $("#collaboratorBudget").val(); + var collaboratorUrl = $("#collaboratorUrlBudget").val(); var advanceInterestAmount = $("#advanceInterestAmountBudget").val(); var advancePeakAmount = $("#advancePeakAmountBudget").val(); var contractAmount = $("#contractAmountBudget").val(); @@ -394,12 +402,18 @@ function checkIfFillIn() { // return; // } - if (underwrittenMode == 1 && (collaborator == undefined || collaborator.length <= 0)) { + if (cooperateType == 1 && (collaborator == undefined || collaborator.length <= 0 )) { window.confirm('合作对象不能为空'); check = 1; return; } + if (cooperateType == 1 && (collaboratorUrl == undefined || collaboratorUrl.length <= 0 )) { + window.confirm('合作对象附件不能为空'); + check = 1; + return; + } + if (underwrittenMode > 2 && (advanceInterestAmount == undefined || advanceInterestAmount.length <= 0)) { window.confirm('垫资利息不能为空'); diff --git a/src/main/resources/templates/admin/project_budget_edit.ftl b/src/main/resources/templates/admin/project_budget_edit.ftl index f5e811d..494b99e 100644 --- a/src/main/resources/templates/admin/project_budget_edit.ftl +++ b/src/main/resources/templates/admin/project_budget_edit.ftl @@ -1575,6 +1575,66 @@ }); } + var generateFileupload2 = function (name) { + var progressArea = $("#progress-area-" + name);//div + var progressText = $("#progress-text-" + name);//进度条提示 + var progressBar = $(".am-progress-bar");//进度条 + + $("#file_upload_icon").fileupload({ + url: "${base}/file/upload", + dataType: 'json', + maxFileSize: 50 * 1024 * 1024, + maxNumberOfFiles: 1, + start: function (e) { + progressArea.removeClass("am-hide"); + progressText.removeClass("am-text-danger"); + progressText.html(""); + progressBar.css("width", "0%"); + }, + done: function (e, data) { + console.log(data); + //设置服务器返回的url + $("#collaboratorUrlBudget").val(data.result.data.url); + $("#collaboratorUrl_span").text(data.result.data.url); + $("#collaboratorUrl_check").text("已上传"); + // console.log("collboratorUrl: " + $("#collaboratorUrl").val()); + setTimeout(function () { + progressArea.addClass("am-hide"); + }, 1500); + }, + progressall: function (e, data) { + var progress = parseInt(data.loaded / data.total * 100, 10); + console.log(progress); + progressBar.css("width", progress + "%"); + progressText.html(progress + "%"); + }, + error: function (jqXHR2, textStatus, errorThrown) { + progressArea.removeClass("am-hide"); + progressText.addClass("am-text-danger"); + progressText.html("imageupload error!"); + progressBar.css("width", "0%"); + setTimeout(function () { + progressArea.addClass("am-hide"); + }, 2000); + }, + fail: function (jqXHR2, textStatus) { + progressArea.removeClass("am-hide"); + progressText.addClass("am-text-danger"); + progressText.html("imageupload fail!"); + progressBar.css("width", "0%"); + setTimeout(function () { + progressArea.addClass("am-hide"); + }, 2000); + }, + processfail: function (e, data) { + var currentFile = data.files[data.index]; + if (data.files.error && currentFile.error) { + parent.layer.msg(currentFile.error); + } + } + }); + }; + var generateFileupload = function (name) { var progressArea = $("#progress-area-" + name);//div var progressText = $("#progress-text-" + name);//进度条提示