|
@@ -9,8 +9,8 @@
|
|
|
*/
|
|
|
|
|
|
$(document).ready(function () {
|
|
|
- let timer = null
|
|
|
- let oldSearchVal = null
|
|
|
+ let timer = null;
|
|
|
+ let oldSearchVal = null;
|
|
|
$('body').bind('input propertychange', '.gr-search', function(e) {
|
|
|
oldSearchVal = e.target.value;
|
|
|
timer && clearTimeout(timer);
|
|
@@ -40,10 +40,10 @@ $(document).ready(function () {
|
|
|
<p class="mb-0 d-flex"><span class="text-primary">${item.name}</span><span
|
|
|
class="ml-auto">${item.mobile || ''}</span></p>
|
|
|
<span class="text-muted">${item.role || ''}</span>
|
|
|
- </dd>`
|
|
|
+ </dd>`;
|
|
|
}
|
|
|
});
|
|
|
- html += '</div>'
|
|
|
+ html += '</div>';
|
|
|
});
|
|
|
$('.book-list').empty();
|
|
|
$('.book-list').append(html);
|
|
@@ -54,18 +54,18 @@ $(document).ready(function () {
|
|
|
|
|
|
// 添加审批流程按钮逻辑
|
|
|
$('body').on('click', '.book-list dt', function () {
|
|
|
- const idx = $(this).find('.acc-btn').attr('data-groupid')
|
|
|
- const type = $(this).find('.acc-btn').attr('data-type')
|
|
|
+ const idx = $(this).find('.acc-btn').attr('data-groupid');
|
|
|
+ const type = $(this).find('.acc-btn').attr('data-type');
|
|
|
if (type === 'hide') {
|
|
|
$(this).parent().find(`div[data-toggleid="${idx}"]`).show(() => {
|
|
|
- $(this).children().find('i').removeClass('fa-plus-square').addClass('fa-minus-square-o')
|
|
|
- $(this).find('.acc-btn').attr('data-type', 'show')
|
|
|
+ $(this).children().find('i').removeClass('fa-plus-square').addClass('fa-minus-square-o');
|
|
|
+ $(this).find('.acc-btn').attr('data-type', 'show');
|
|
|
|
|
|
})
|
|
|
} else {
|
|
|
$(this).parent().find(`div[data-toggleid="${idx}"]`).hide(() => {
|
|
|
- $(this).children().find('i').removeClass('fa-minus-square-o').addClass('fa-plus-square')
|
|
|
- $(this).find('.acc-btn').attr('data-type', 'hide')
|
|
|
+ $(this).children().find('i').removeClass('fa-minus-square-o').addClass('fa-plus-square');
|
|
|
+ $(this).find('.acc-btn').attr('data-type', 'hide');
|
|
|
})
|
|
|
}
|
|
|
return false;
|
|
@@ -78,25 +78,41 @@ $(document).ready(function () {
|
|
|
const this_code = $(this).data('code');
|
|
|
const spt = sp_status_list[this_status];
|
|
|
$(this).parents('.form-group').siblings('.alert-warning').text(spt.name + ':' + spt.msg);
|
|
|
- if (this_status === sp_status.sqspr) {
|
|
|
- $(this).parents('.form-group').siblings('.lc-show').html('');
|
|
|
- } else if (this_status === sp_status.gdspl) {
|
|
|
- let addhtml = '<ul class="list-unstyled">\n';
|
|
|
- addhtml += makeSelectAudit(this_code, '一');
|
|
|
- addhtml += '</ul>\n';
|
|
|
- $(this).parents('.form-group').siblings('.lc-show').html(addhtml);
|
|
|
- } else if (this_status === sp_status.gdzs) {
|
|
|
- let addhtml = '<ul class="list-unstyled">\n' +
|
|
|
- ' <li class="d-flex justify-content-start mb-3">\n' +
|
|
|
- ' <span class="col-auto">授权审批人</span>\n' +
|
|
|
- ' <span class="col-7">\n' +
|
|
|
- ' <span class="d-inline-block"></span>\n' +
|
|
|
- ' </span>\n' +
|
|
|
- ' </li>\n';
|
|
|
- addhtml += makeSelectAudit(this_code);
|
|
|
- addhtml += '</ul>\n';
|
|
|
- $(this).parents('.form-group').siblings('.lc-show').html(addhtml);
|
|
|
- }
|
|
|
+ // 拼接post json
|
|
|
+ const prop = {
|
|
|
+ code: this_code,
|
|
|
+ status: this_status
|
|
|
+ };
|
|
|
+ const _self = $(this);
|
|
|
+ const tenderId = window.location.pathname.split('/')[2];
|
|
|
+ postData('/tender/' + tenderId + '/shenpi/save', prop, function (data) {
|
|
|
+ if (this_status === sp_status.sqspr) {
|
|
|
+ _self.parents('.form-group').siblings('.lc-show').html('');
|
|
|
+ } else if (this_status === sp_status.gdspl) {
|
|
|
+ let addhtml = '<ul class="list-unstyled">\n';
|
|
|
+ if (data.length !== 0) {
|
|
|
+ for(const [i, audit] of data.entries()) {
|
|
|
+ addhtml += makeAudit(audit, transFormToChinese(i+1));
|
|
|
+ }
|
|
|
+ addhtml += '<li class="pl-3"><a href="javascript:void(0);" class="add-audit"><i class="fa fa-plus"></i> 添加流程</a></li>';
|
|
|
+ } else {
|
|
|
+ addhtml += makeSelectAudit(this_code, '一');
|
|
|
+ }
|
|
|
+ addhtml += '</ul>\n';
|
|
|
+ _self.parents('.form-group').siblings('.lc-show').html(addhtml);
|
|
|
+ } else if (this_status === sp_status.gdzs) {
|
|
|
+ let addhtml = '<ul class="list-unstyled">\n' +
|
|
|
+ ' <li class="d-flex justify-content-start mb-3">\n' +
|
|
|
+ ' <span class="col-auto">授权审批人</span>\n' +
|
|
|
+ ' <span class="col-7">\n' +
|
|
|
+ ' <span class="d-inline-block"></span>\n' +
|
|
|
+ ' </span>\n' +
|
|
|
+ ' </li>\n';
|
|
|
+ addhtml += data ? makeAudit(data) : makeSelectAudit(this_code);
|
|
|
+ addhtml += '</ul>\n';
|
|
|
+ _self.parents('.form-group').siblings('.lc-show').html(addhtml);
|
|
|
+ }
|
|
|
+ });
|
|
|
});
|
|
|
|
|
|
// 选中审批人
|
|
@@ -106,8 +122,8 @@ $(document).ready(function () {
|
|
|
const user = _.find(accountList, function (item) {
|
|
|
return item.id === id;
|
|
|
});
|
|
|
-
|
|
|
const this_status = parseInt($(this).parents('.lc-show').siblings('.form-group').find('input:checked').val());
|
|
|
+ const this_code = $(this).parents('.lc-show').siblings('.form-group').find('input:checked').data('code');
|
|
|
if (this_status === sp_status.gdspl) {
|
|
|
// 判断是否已存在审批人
|
|
|
const aid_num = $(this).parents('ul').find('.remove-audit').length;
|
|
@@ -118,11 +134,23 @@ $(document).ready(function () {
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
- $(this).parents('ul').append('<li class="pl-3"><a href="javascript:void(0);" class="add-audit"><i class="fa fa-plus"></i> 添加流程</a></li>');
|
|
|
- }
|
|
|
- $(this).parents('.spr-span').html('<span class="d-inline-block"></span>\n' +
|
|
|
- '<span class="d-inline-block"><span class="badge badge-light">'+ user.name +' <a href="javascript:void(0);" class="remove-audit btn-sm text-danger px-1" title="移除" data-id="'+ user.id +'"><i class="fa fa-remove"></i></a></span> </span>');
|
|
|
|
|
|
+ }
|
|
|
+ const prop = {
|
|
|
+ status: this_status,
|
|
|
+ code: sp_type[this_code],
|
|
|
+ audit_id: id,
|
|
|
+ type: 'add',
|
|
|
+ };
|
|
|
+ const _self = $(this);
|
|
|
+ const tenderId = window.location.pathname.split('/')[2];
|
|
|
+ postData('/tender/' + tenderId + '/shenpi/audit/save', prop, function (data) {
|
|
|
+ if (this_status === sp_status.gdspl) {
|
|
|
+ _self.parents('ul').append('<li class="pl-3"><a href="javascript:void(0);" class="add-audit"><i class="fa fa-plus"></i> 添加流程</a></li>');
|
|
|
+ }
|
|
|
+ _self.parents('.spr-span').html('<span class="d-inline-block"></span>\n' +
|
|
|
+ '<span class="d-inline-block"><span class="badge badge-light">'+ user.name +' <a href="javascript:void(0);" class="remove-audit btn-sm text-danger px-1" title="移除" data-id="'+ user.id +'"><i class="fa fa-remove"></i></a></span> </span>');
|
|
|
+ });
|
|
|
}
|
|
|
});
|
|
|
|
|
@@ -131,32 +159,42 @@ $(document).ready(function () {
|
|
|
const id = parseInt($(this).data('id'));
|
|
|
const this_status = parseInt($(this).parents('.lc-show').siblings('.form-group').find('input:checked').val());
|
|
|
const this_code = $(this).parents('.lc-show').siblings('.form-group').find('input:checked').data('code');
|
|
|
- if (this_status === sp_status.gdspl) {
|
|
|
- const _self = $(this).parents('.lc-show');
|
|
|
- $(this).parents('li').remove();
|
|
|
- const aid_num = parseInt(_self.children('ul').find('li.d-flex').length);
|
|
|
- if (aid_num === 0) {
|
|
|
- let addhtml = '<ul class="list-unstyled">\n';
|
|
|
- addhtml += makeSelectAudit(this_code, '一');
|
|
|
- addhtml += '</ul>\n';
|
|
|
- _self.html(addhtml);
|
|
|
- } else {
|
|
|
- for (let i = 0; i < aid_num; i++) {
|
|
|
- _self.find('li.d-flex').eq(i).find('.col-auto').text(transFormToChinese(i+1) + '审');
|
|
|
+ const prop = {
|
|
|
+ status: this_status,
|
|
|
+ code: sp_type[this_code],
|
|
|
+ audit_id: id,
|
|
|
+ type: 'del',
|
|
|
+ };
|
|
|
+ const _self = $(this);
|
|
|
+ const tenderId = window.location.pathname.split('/')[2];
|
|
|
+ postData('/tender/' + tenderId + '/shenpi/audit/save', prop, function (data) {
|
|
|
+ if (this_status === sp_status.gdspl) {
|
|
|
+ const _selflc = _self.parents('.lc-show');
|
|
|
+ _self.parents('li').remove();
|
|
|
+ const aid_num = parseInt(_selflc.children('ul').find('li.d-flex').length);
|
|
|
+ if (aid_num === 0) {
|
|
|
+ let addhtml = '<ul class="list-unstyled">\n';
|
|
|
+ addhtml += makeSelectAudit(this_code, '一');
|
|
|
+ addhtml += '</ul>\n';
|
|
|
+ _selflc.html(addhtml);
|
|
|
+ } else {
|
|
|
+ for (let i = 0; i < aid_num; i++) {
|
|
|
+ _selflc.find('li.d-flex').eq(i).find('.col-auto').text(transFormToChinese(i+1) + '审');
|
|
|
+ }
|
|
|
}
|
|
|
+ } else if (this_status === sp_status.gdzs) {
|
|
|
+ let addhtml = '<ul class="list-unstyled">\n' +
|
|
|
+ ' <li class="d-flex justify-content-start mb-3">\n' +
|
|
|
+ ' <span class="col-auto">授权审批人</span>\n' +
|
|
|
+ ' <span class="col-7">\n' +
|
|
|
+ ' <span class="d-inline-block"></span>\n' +
|
|
|
+ ' </span>\n' +
|
|
|
+ ' </li>\n';
|
|
|
+ addhtml += makeSelectAudit(this_code);
|
|
|
+ addhtml += '</ul>\n';
|
|
|
+ _self.parents('.lc-show').html(addhtml);
|
|
|
}
|
|
|
- } else if (this_status === sp_status.gdzs) {
|
|
|
- let addhtml = '<ul class="list-unstyled">\n' +
|
|
|
- ' <li class="d-flex justify-content-start mb-3">\n' +
|
|
|
- ' <span class="col-auto">授权审批人</span>\n' +
|
|
|
- ' <span class="col-7">\n' +
|
|
|
- ' <span class="d-inline-block"></span>\n' +
|
|
|
- ' </span>\n' +
|
|
|
- ' </li>\n';
|
|
|
- addhtml += makeSelectAudit(this_code);
|
|
|
- addhtml += '</ul>\n';
|
|
|
- $(this).parents('.lc-show').html(addhtml);
|
|
|
- }
|
|
|
+ })
|
|
|
});
|
|
|
|
|
|
// 固定审批流-添加流程
|
|
@@ -168,6 +206,17 @@ $(document).ready(function () {
|
|
|
$(this).parents('li').remove();
|
|
|
});
|
|
|
|
|
|
+ // 审批流程-审批人html 生成
|
|
|
+ function makeAudit(audit, i = '终') {
|
|
|
+ return '<li class="d-flex justify-content-start mb-3">\n' +
|
|
|
+ ' <span class="col-auto">'+ i +'审</span>\n' +
|
|
|
+ ' <span class="col-7 spr-span">\n' +
|
|
|
+ ' <span class="d-inline-block"></span>\n' +
|
|
|
+ ' <span class="d-inline-block"><span class="badge badge-light">'+ audit.name +' <a href="javascript:void(0);" class="remove-audit btn-sm text-danger px-1" title="移除" data-id="'+ audit.audit_id +'"><i class="fa fa-remove"></i></a></span> </span>\n' +
|
|
|
+ ' </span>\n' +
|
|
|
+ ' </li>';
|
|
|
+ }
|
|
|
+
|
|
|
// 审批流程-选择审批人html 生成
|
|
|
function makeSelectAudit(code, i = '终') {
|
|
|
let divhtml = '';
|