|
@@ -58,6 +58,15 @@ $(document).ready(() => {
|
|
|
if ($('input[name="p_code"]').val() === '') {
|
|
|
toastr.error('变更令号(批复编号)不能为空!');
|
|
|
returnflag = false;
|
|
|
+ } else if ($('input[name="p_code"]').val() !== undefined) {
|
|
|
+ $('input[name="p_code"]').val($.trim($('input[name="p_code"]').val()));
|
|
|
+ const postData = {
|
|
|
+ p_code: $('input[name="p_code"]').val(),
|
|
|
+ };
|
|
|
+ postDataWithAsync('/tender/' + $('#tenderId').val() + '/change/' + $('#changeId').val() + '/check/codeRepeat',postData, function (result) {
|
|
|
+ }, function (data) {
|
|
|
+ returnflag = false;
|
|
|
+ });
|
|
|
}
|
|
|
// 判断并提交变更清单表格数据到表单中
|
|
|
const clist = [];
|
|
@@ -73,7 +82,8 @@ $(document).ready(() => {
|
|
|
$('#change-list-approval').val(clist.join(','));
|
|
|
|
|
|
if(returnflag) {
|
|
|
- $('input[name="w_code"]').val($('#w_code').val());
|
|
|
+ $('input[name="w_code"]').val($.trim($('#w_code').val()));
|
|
|
+
|
|
|
$('#success-approval').find('textarea').val(sdesc.replace(/\r\n/g, '<br/>').replace(/\n/g, '<br/>').replace(/\s/g, ' '));
|
|
|
$('#success-approval').submit();
|
|
|
}
|
|
@@ -90,9 +100,46 @@ $(document).ready(() => {
|
|
|
}
|
|
|
if(returnflag) {
|
|
|
$('#fail-approval').find('textarea').val(sdesc.replace(/\r\n/g, '<br/>').replace(/\n/g, '<br/>').replace(/\s/g, ' '));
|
|
|
- $('input[name="w_code"]').val($('#w_code').val());
|
|
|
+ $('input[name="w_code"]').val($.trim($('#w_code').val()));
|
|
|
$('#fail-approval').submit();
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
});
|
|
|
+
|
|
|
+const postDataWithAsync = function (url, data, successCallback, errorCallBack, showWaiting = true) {
|
|
|
+ if (showWaiting) showWaitingView();
|
|
|
+ $.ajax({
|
|
|
+ type:"POST",
|
|
|
+ url: url,
|
|
|
+ data: {'data': JSON.stringify(data)},
|
|
|
+ dataType: 'json',
|
|
|
+ cache: false,
|
|
|
+ async: false,
|
|
|
+ timeout: 60000,
|
|
|
+ beforeSend: function(xhr) {
|
|
|
+ let csrfToken = Cookies.get('csrfToken');
|
|
|
+ xhr.setRequestHeader('x-csrf-token', csrfToken);
|
|
|
+ },
|
|
|
+ success: function(result){
|
|
|
+ if (result.err === 0) {
|
|
|
+ if (successCallback) {
|
|
|
+ successCallback(result.data);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ toastr.error(result.msg);
|
|
|
+ if (errorCallBack) {
|
|
|
+ errorCallBack(result.msg);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (showWaiting) closeWaitingView();
|
|
|
+ },
|
|
|
+ error: function(jqXHR, textStatus, errorThrown){
|
|
|
+ toastr.error('error: ' + textStatus + " " + errorThrown);
|
|
|
+ if (errorCallBack) {
|
|
|
+ errorCallBack();
|
|
|
+ }
|
|
|
+ if (showWaiting) closeWaitingView();
|
|
|
+ }
|
|
|
+ });
|
|
|
+};
|