modify reject trial auth modal

dev_ec
p31729568 6 years ago
parent aa6e3dddbf
commit dbaed7bc12

@ -51,15 +51,15 @@
</span>
<span>
<input type="checkbox" name="reasons[]" value="其他" id="reject-reason-7" class="ml5 mr5 magic-checkbox" style="float:left; margin-top: 8px;"/>
<input type="checkbox" name="reasons[]" value="其他" id="reject-reason-7" data-type="other" class="ml5 mr5 magic-checkbox" style="float:left; margin-top: 8px;"/>
<label for="reject-reason-7" class="color4C4C4C">其他</label>
</span>
</li>
<li class="clearfix mt10">
<label class="panel-form-label fl">备注说明:</label>
<textarea class="remarktextarea fl panel-box-sizing candiate_answer" name="reject_description" placeholder="为选择的撤销原因补充备注说明...."></textarea>
<label class="panel-form-label fl reject-description-label">备注说明<span class="color-red" style="display: none;">*</span></label>
<textarea class="remarktextarea fl panel-box-sizing candiate_answer" name="reject_description" placeholder="为选择的撤销原因补充备注说明(当选择原因“其他”,备注说明必填)..."></textarea>
</li>
<li class="ml20 error color-red" style="display: none;"></li>
@ -79,8 +79,23 @@
var modal = $(".modal.reject-auth-modal");
var form = modal.find("#reject-auth-form");
var applyIdInput = form.find("input[name='apply_id']");
var rejectDescriptionSpan = form.find(".reject-description-label span");
var needRejectDescription = false;
var error = modal.find(".error");
modal.on("click", "input[name='reasons[]']", function(){
var checkbox = $(this);
if (checkbox.data("type") != "other") { return; }
if (checkbox.prop("checked")) {
needRejectDescription = true;
rejectDescriptionSpan.show();
} else {
needRejectDescription = false;
rejectDescriptionSpan.hide();
}
});
modal.on('click', '.submit-btn', function(){
if (!formValid()) { return; }
form.submit();
@ -88,8 +103,13 @@
var formValid = function () {
error.html("").hide();
if (form.find("input[name='reasons[]']:checked").length == 0 || form.find("textarea[name='reject_description']").val() == '') {
error.html("原因和说明不能为空,请完善后再确认提交").show();
if (form.find("input[name='reasons[]']:checked").length == 0) {
error.html("撤销原因不能为空,请完善后再确认提交").show();
return false;
}
if (needRejectDescription && form.find("textarea[name='reject_description']").val() == '') {
error.html("备注说明不能为空,请完善后再确认提交").show();
return false;
}
@ -100,6 +120,8 @@
applyIdInput.val('');
form.find("textarea[name='reject_description']").val('');
form.find("input[name='reasons[]']").each(function(){this.checked=false;})
needRejectDescription = false;
rejectDescriptionSpan.hide();
modal.hide();
};
// 隐藏弹窗

@ -38,7 +38,9 @@
</li>
<% if authorization.status == 2 %>
<li><span class="color-red">原因:</span><span><%= authorization.reason.blank? ? "空" : authorization.reason %></span></li>
<li><span class="color-red">备注说明:</span><span><%= authorization.reject_description.blank? ? "空" : authorization.reject_description %></span></li>
<% if authorization.reject_description.present? %>
<li><span class="color-red">备注说明:</span><span><%= authorization.reject_description %></span></li>
<% end %>
<% end %>
</ul>
</div>

Loading…
Cancel
Save