|
|
@@ -5791,35 +5791,96 @@ $(document).ready(() => {
|
|
|
$('.reduction-code').click(function () {
|
|
|
const code = $(this).attr('data-code');
|
|
|
$('input[name="code"]').val(code);
|
|
|
- changeInfo.code = $('input[name="code"]').val();
|
|
|
- judgeChange();
|
|
|
+ updateInfo('code', code);
|
|
|
});
|
|
|
- // 记录变更信息操作
|
|
|
- $('body').on('valuechange', '#change_form input[type="text"]', function (e, previous) {
|
|
|
- changeInfo[$(this).attr('name')] = $(this).val();
|
|
|
- judgeChange();
|
|
|
+
|
|
|
+ // 回车提交
|
|
|
+ $('#change_form input[type="text"]').on('keypress', function () {
|
|
|
+ if(window.event.keyCode === 13) {
|
|
|
+ $(this).blur();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ $('#change_form textarea').on('keypress', function () {
|
|
|
+ if(window.event.keyCode === 13) {
|
|
|
+ $(this).blur();
|
|
|
+ }
|
|
|
});
|
|
|
- $('body').on('valuechange', '#change_form textarea', function (e, previous) {
|
|
|
- changeInfo[$(this).attr('name')] = $(this).val().replace(/[\r\n]/g, '<br><br>');
|
|
|
- judgeChange();
|
|
|
+ $('#change_form input[type="text"]').blur(function () {
|
|
|
+ let val_name = $(this).attr('name');
|
|
|
+ let val = _.trim($(this).val()) !== '' ? _.trim($(this).val()) : null;
|
|
|
+ switch(val_name) {
|
|
|
+ case 'code':
|
|
|
+ if(!val) {
|
|
|
+ toastr.error('申请编号不能为空!');
|
|
|
+ $(this).val(change[val_name]);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ if(val && val.length > 255) {
|
|
|
+ toastr.error('超出字段范围,请缩减');
|
|
|
+ $(this).val(change[val_name]);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ updateInfo(val_name, val);
|
|
|
});
|
|
|
- $('body').on('change', '#change_form select', function (e, previous) {
|
|
|
- changeInfo[$(this).attr('name')] = $(this).val();
|
|
|
- judgeChange();
|
|
|
+
|
|
|
+ $('#change_form textarea').blur(function () {
|
|
|
+ const val_name = $(this).attr('name');
|
|
|
+ let val = _.trim($(this).val()) !== '' ? _.trim($(this).val()) : null;
|
|
|
+ updateInfo(val_name, val);
|
|
|
});
|
|
|
- $('body').on('click', '#change_form input[type="radio"]', function (e, previous) {
|
|
|
- changeInfo[$(this).attr('name')] = $(this).val();
|
|
|
- judgeChange();
|
|
|
+
|
|
|
+ $('#change_form select').change(function () {
|
|
|
+ const val_name = $(this).attr('name');
|
|
|
+ let val = _.trim($(this).val()) !== '' ? _.trim($(this).val()) : null;
|
|
|
+ updateInfo(val_name, val);
|
|
|
});
|
|
|
- $('body').on('click', '#change_form input[type="checkbox"]', function (e, previous) {
|
|
|
+
|
|
|
+ $('#change_form input[type="radio"]').change(function () {
|
|
|
+ const val_name = $(this).attr('name');
|
|
|
+ let val = _.trim($(this).val()) !== '' ? _.trim($(this).val()) : null;
|
|
|
+ updateInfo(val_name, val);
|
|
|
+ });
|
|
|
+
|
|
|
+ $('#change_form input[type="checkbox"]').click(function () {
|
|
|
const typecheck = [];
|
|
|
$.each($('#change_form input[name="type[]"]:checked'), function () {
|
|
|
typecheck.push($(this).val());
|
|
|
});
|
|
|
- changeInfo.type = typecheck.join(',');
|
|
|
- judgeChange();
|
|
|
+ const val_name = 'type';
|
|
|
+ const val = typecheck.join(',');
|
|
|
+ updateInfo(val_name, val);
|
|
|
});
|
|
|
|
|
|
+ // 记录变更信息操作
|
|
|
+ // $('body').on('valuechange', '#change_form input[type="text"]', function (e, previous) {
|
|
|
+ // changeInfo[$(this).attr('name')] = $(this).val();
|
|
|
+ // judgeChange();
|
|
|
+ // });
|
|
|
+ // $('body').on('valuechange', '#change_form textarea', function (e, previous) {
|
|
|
+ // changeInfo[$(this).attr('name')] = $(this).val().replace(/[\r\n]/g, '<br><br>');
|
|
|
+ // judgeChange();
|
|
|
+ // });
|
|
|
+ // $('body').on('change', '#change_form select', function (e, previous) {
|
|
|
+ // changeInfo[$(this).attr('name')] = $(this).val();
|
|
|
+ // judgeChange();
|
|
|
+ // });
|
|
|
+ // $('body').on('click', '#change_form input[type="radio"]', function (e, previous) {
|
|
|
+ // changeInfo[$(this).attr('name')] = $(this).val();
|
|
|
+ // judgeChange();
|
|
|
+ // });
|
|
|
+ // $('body').on('click', '#change_form input[type="checkbox"]', function (e, previous) {
|
|
|
+ // const typecheck = [];
|
|
|
+ // $.each($('#change_form input[name="type[]"]:checked'), function () {
|
|
|
+ // typecheck.push($(this).val());
|
|
|
+ // });
|
|
|
+ // changeInfo.type = typecheck.join(',');
|
|
|
+ // judgeChange();
|
|
|
+ // });
|
|
|
+
|
|
|
// 保存修改ajax提交(不刷新页面)
|
|
|
$('.save_change_btn').on('click', function () {
|
|
|
// 保存修改modal
|
|
|
@@ -6117,42 +6178,51 @@ $(document).ready(() => {
|
|
|
});
|
|
|
|
|
|
if (readOnly && !shenpiPower) {
|
|
|
- // 记录变更信息操作
|
|
|
- $('body').on('valuechange', '#w_code', function (e, previous) {
|
|
|
- const new_w_code = $(this).val();
|
|
|
- if (new_w_code !== w_code) {
|
|
|
- $('#show-save-btn').show();
|
|
|
- $('#sp-btn').hide();
|
|
|
- $('.title-main').addClass('bg-warning');
|
|
|
- } else {
|
|
|
- $('#show-save-btn').hide();
|
|
|
- $('#sp-btn').show();
|
|
|
- $('.title-main').removeClass('bg-warning');
|
|
|
+ $('input[id="w_code"]').on('keypress', function () {
|
|
|
+ if(window.event.keyCode === 13) {
|
|
|
+ $(this).blur();
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
- // 保存修改ajax提交(不刷新页面)
|
|
|
- $('.save_change_btn').on('click', function () {
|
|
|
- const new_w_code = $('#w_code').val();
|
|
|
- // 后改为br
|
|
|
- // 更新至服务器
|
|
|
- postData(window.location.pathname + '/save', { type:'info', updateData: { w_code: new_w_code } }, function (result) {
|
|
|
- toastr.success(result ? result.msg : '');
|
|
|
- $('#show-save-btn').hide();
|
|
|
- $('#sp-btn').show();
|
|
|
- $('.title-main').removeClass('bg-warning');
|
|
|
- w_code = new_w_code;
|
|
|
- });
|
|
|
- return false;
|
|
|
+ $('input[id="w_code"]').blur(function () {
|
|
|
+ updateInfo('w_code', $('#w_code').val());
|
|
|
});
|
|
|
|
|
|
- $('#cancel_change').on('click', function () {
|
|
|
- $('#show-save-btn').hide();
|
|
|
- $('#sp-btn').show();
|
|
|
- $('.title-main').removeClass('bg-warning');
|
|
|
- $('#w_code').val(w_code);
|
|
|
- // toastr.success('已还原到上次保存状态');
|
|
|
- });
|
|
|
+ // 记录变更信息操作
|
|
|
+ // $('body').on('valuechange', '#w_code', function (e, previous) {
|
|
|
+ // const new_w_code = $(this).val();
|
|
|
+ // if (new_w_code !== w_code) {
|
|
|
+ // $('#show-save-btn').show();
|
|
|
+ // $('#sp-btn').hide();
|
|
|
+ // $('.title-main').addClass('bg-warning');
|
|
|
+ // } else {
|
|
|
+ // $('#show-save-btn').hide();
|
|
|
+ // $('#sp-btn').show();
|
|
|
+ // $('.title-main').removeClass('bg-warning');
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ //
|
|
|
+ // // 保存修改ajax提交(不刷新页面)
|
|
|
+ // $('.save_change_btn').on('click', function () {
|
|
|
+ // const new_w_code = $('#w_code').val();
|
|
|
+ // // 后改为br
|
|
|
+ // // 更新至服务器
|
|
|
+ // postData(window.location.pathname + '/save', { type:'info', updateData: { w_code: new_w_code } }, function (result) {
|
|
|
+ // toastr.success(result ? result.msg : '');
|
|
|
+ // $('#show-save-btn').hide();
|
|
|
+ // $('#sp-btn').show();
|
|
|
+ // $('.title-main').removeClass('bg-warning');
|
|
|
+ // w_code = new_w_code;
|
|
|
+ // });
|
|
|
+ // return false;
|
|
|
+ // });
|
|
|
+ //
|
|
|
+ // $('#cancel_change').on('click', function () {
|
|
|
+ // $('#show-save-btn').hide();
|
|
|
+ // $('#sp-btn').show();
|
|
|
+ // $('.title-main').removeClass('bg-warning');
|
|
|
+ // $('#w_code').val(w_code);
|
|
|
+ // // toastr.success('已还原到上次保存状态');
|
|
|
+ // });
|
|
|
}
|
|
|
});
|
|
|
/**
|
|
|
@@ -6456,6 +6526,18 @@ function makePushBwmx(clinfo, listinfo, removeList, updateList, showTips = false
|
|
|
}
|
|
|
return info;
|
|
|
}
|
|
|
+
|
|
|
+function updateInfo(val_name, val) {
|
|
|
+ if(change[val_name] !== val) {
|
|
|
+ // 更新至服务器
|
|
|
+ const updateData = {};
|
|
|
+ updateData[val_name] = val;
|
|
|
+ postData(window.location.pathname + '/save', { type:'info', updateData }, function (result) {
|
|
|
+ change[val_name] = val;
|
|
|
+ });
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
function makeWhiteList(clinfo) {
|
|
|
clinfo.lid = 0;
|
|
|
clinfo.xmj_code = null;
|