|
@@ -59,7 +59,7 @@ $(document).ready(function () {
|
|
|
})
|
|
|
|
|
|
// 添加审批流程按钮逻辑
|
|
|
- $('.book-list').on('click', 'dt', function () {
|
|
|
+ $('.book-list').on('click', '.book-list dt', function () {
|
|
|
const idx = $(this).find('.acc-btn').attr('data-groupid')
|
|
|
const type = $(this).find('.acc-btn').attr('data-type')
|
|
|
if (type === 'hide') {
|
|
@@ -78,7 +78,7 @@ $(document).ready(function () {
|
|
|
})
|
|
|
|
|
|
// 添加到审批流程中
|
|
|
- $('dl').on('click', 'dd', function () {
|
|
|
+ $('#book-list').on('click', 'dd', function () {
|
|
|
const id = parseInt($(this).data('id'));
|
|
|
if (id) {
|
|
|
postData(getUrlPre() + '/audit/add', { auditorId: id }, (datas) => {
|
|
@@ -87,19 +87,23 @@ $(document).ready(function () {
|
|
|
const auditorshtml = [];
|
|
|
for (const [index,data] of datas.entries()) {
|
|
|
if (index !== 0) {
|
|
|
- html.push('<li class="list-group-item" auditorId="'+ data.aid +'">');
|
|
|
+ html.push('<li class="list-group-item d-flex" auditorId="'+ data[0].aid +'">');
|
|
|
+ html.push(`<div class="col-auto">${index}</div>`);
|
|
|
+ html.push('<div class="col">');
|
|
|
+ for (const auditor of data) {
|
|
|
+ html.push(`<div class="d-inline-block mx-1"><i class="fa fa-user text-muted"></i> ${auditor.name} <small class="text-muted">${auditor.role}</small></div>`);
|
|
|
+ }
|
|
|
+ html.push('</div>');
|
|
|
+ html.push('<div class="col-auto">');
|
|
|
+ if (data[0].audit_type !== auditType.key.common) {
|
|
|
+ html.push(`<span class="badge badge-pill badge-${auditType.info[data[0].audit_type].class} badge-bg-small"><small>${auditType.info[data[0].audit_type].long}</small></span>`);
|
|
|
+ }
|
|
|
if (shenpi_status === shenpiConst.sp_status.sqspr || (shenpi_status === shenpiConst.sp_status.gdzs && index+1 !== datas.length)) {
|
|
|
- html.push('<a href="javascript: void(0)" class="text-danger pull-right">移除</a>');
|
|
|
+ html.push('<a href="javascript: void(0)" class="text-danger pull-right ml-1">移除</a>');
|
|
|
}
|
|
|
- html.push('<span>');
|
|
|
- html.push(data.order + ' ');
|
|
|
- html.push(data.name + ' ');
|
|
|
- html.push('</span>');
|
|
|
- html.push('<small class="text-muted">');
|
|
|
- html.push(data.role);
|
|
|
- html.push('</small></li>');
|
|
|
+ html.push('</div>');
|
|
|
+ html.push('</li>');
|
|
|
}
|
|
|
- // 添加新审批人流程修改
|
|
|
auditorshtml.push('<li class="list-group-item" data-auditorid="' + data.aid + '">');
|
|
|
auditorshtml.push('<i class="fa ' + (index+1 === datas.length ? 'fa-stop-circle' : 'fa-chevron-circle-down') + '"></i> ');
|
|
|
auditorshtml.push(data.name + ' <small class="text-muted">' + data.role + '</small>');
|
|
@@ -113,27 +117,7 @@ $(document).ready(function () {
|
|
|
auditorshtml.push('</li>');
|
|
|
}
|
|
|
$('#auditors').html(html.join(''));
|
|
|
-
|
|
|
-
|
|
|
- // 重新上报时。令其它的审批人流程图标转换
|
|
|
- // $('#auditors-list li i').removeClass('fa-stop-circle').addClass('fa-chevron-circle-down');
|
|
|
- // for (let i = 0; i < $('#auditors-list li').length; i++) {
|
|
|
- // $('#auditors-list li').eq(i).find('.pull-right').text(transFormToChinese(i+1) + '审');
|
|
|
- // $('#auditors-list2 li').eq(i).find('.pull-right').text(transFormToChinese(i+1) + '审');
|
|
|
- // }
|
|
|
-
|
|
|
$('#auditors-list').html(auditorshtml.join(''));
|
|
|
-
|
|
|
- // const auditorshtml2 = [];
|
|
|
- // // 重新上报时。令其它的审批人流程图标转换
|
|
|
- // $('#auditors-list2 li i').removeClass('fa-stop-circle').addClass('fa-chevron-circle-down');
|
|
|
- // // 添加新审批人
|
|
|
- // auditorshtml2.push('<li class="list-group-item" data-auditid="' + data.aid + '">');
|
|
|
- // auditorshtml2.push('<h5 class="card-title"><i class="fa fa-stop-circle"></i> ');
|
|
|
- // auditorshtml2.push(data.name + ' <small class="text-muted">' + data.role + '</small>');
|
|
|
- // auditorshtml2.push('<span class="pull-right">终审</span>');
|
|
|
- // auditorshtml2.push('</h5></li>');
|
|
|
- // $('#auditors-list2').append(auditorshtml2.join(''));
|
|
|
});
|
|
|
}
|
|
|
});
|
|
@@ -147,7 +131,7 @@ $(document).ready(function () {
|
|
|
li.remove();
|
|
|
for (const rst of result) {
|
|
|
const aLi = $('li[auditorId=' + rst.aid + ']');
|
|
|
- $('span', aLi).text(rst.order + ' ' + rst.name + ' ');
|
|
|
+ $('div:first', aLi).text(rst.order);
|
|
|
}
|
|
|
|
|
|
// 如果是重新上报
|
|
@@ -213,6 +197,238 @@ $(document).ready(function () {
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
+
|
|
|
+ // 管理员更改审批流程js部分
|
|
|
+ let timer2 = null;
|
|
|
+ let oldSearchVal2 = null;
|
|
|
+ $('body').on('input propertychange', '.gr-search', function(e) {
|
|
|
+ oldSearchVal2 = e.target.value;
|
|
|
+ timer2 && clearTimeout(timer2);
|
|
|
+ timer2 = setTimeout(() => {
|
|
|
+ const newVal = $(this).val();
|
|
|
+ const code = $(this).attr('data-code');
|
|
|
+ let html = '';
|
|
|
+ if (newVal && newVal === oldSearchVal2) {
|
|
|
+ accountList.filter(item => item && item.id !== material_uid && (item.name.indexOf(newVal) !== -1 || (item.mobile && item.mobile.indexOf(newVal) !== -1))).forEach(item => {
|
|
|
+ html += `<dd class="border-bottom p-2 mb-0 " data-id="${item.id}" >
|
|
|
+ <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>`
|
|
|
+ });
|
|
|
+ $('#' + code + '_dropdownMenu .book-list').empty();
|
|
|
+ $('#' + code + '_dropdownMenu .book-list').append(html);
|
|
|
+ } else {
|
|
|
+ if (!$('#' + code + '_dropdownMenu .acc-btn').length) {
|
|
|
+ accountGroup.forEach((group, idx) => {
|
|
|
+ if (!group) return;
|
|
|
+ html += `<dt><a href="javascript: void(0);" class="acc-btn" data-groupid="${idx}" data-type="hide"><i class="fa fa-plus-square"></i>
|
|
|
+ </a> ${group.groupName}</dt>
|
|
|
+ <div class="dd-content" data-toggleid="${idx}">`;
|
|
|
+ group.groupList.forEach(item => {
|
|
|
+ if (item.id !== material_uid) {
|
|
|
+ html += `<dd class="border-bottom p-2 mb-0 " data-id="${item.id}" >
|
|
|
+ <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>`;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ html += '</div>';
|
|
|
+ });
|
|
|
+ $('#' + code + '_dropdownMenu .book-list').empty();
|
|
|
+ $('#' + code + '_dropdownMenu .book-list').append(html);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }, 400);
|
|
|
+ });
|
|
|
+
|
|
|
+ const getAdminEditShenpiListHtml = function(auditGroup) {
|
|
|
+ const html = [];
|
|
|
+ for (const [i, group] of auditGroup.entries()) {
|
|
|
+ if (i === 0) continue;
|
|
|
+ for (const [j, auditor] of group.entries()) {
|
|
|
+ html.push('<tr>');
|
|
|
+ if (j === 0) {
|
|
|
+ const auditTypeHtml = auditor.type === auditType.key.common ? '' : `<span class="ml-2 badge badge-pill badge-${auditType.info[auditor.audit_type].class} p-1"><small>${auditType.info[auditor.audit_type].short}</small></span>`;
|
|
|
+ html.push(`<td class="text-left d-flex">${i + '审'}${auditTypeHtml}</td>`);
|
|
|
+ } else {
|
|
|
+ html.push(`<td class="text-left d-flex"></td>`);
|
|
|
+ }
|
|
|
+ html.push(`<td></span> ${auditor.name} <small class="text-muted">${auditor.role}</small></td>`);
|
|
|
+ html.push(`<td style="text-align: center"><span class="${sam_auditConst.auditStringClass[auditor.status]}">${ auditor.status !== sam_auditConst.status.uncheck ? sam_auditConst.auditString[auditor.status] : '待审批' }</span></td>`);
|
|
|
+ html.push('<td style="text-align: center">');
|
|
|
+ if (auditor.status === sam_auditConst.status.checking && j === group.length - 1) {
|
|
|
+ html.push('<span class="dropdown mr-2">',
|
|
|
+ `<a href="javascript: void(0)" class="add-audit" id="${auditor.aid}_add_dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">增加</a>`,
|
|
|
+ makeSelectAudit(auditor.aid+'_add', auditor.aid, 'add'),'</div>', '</span>');
|
|
|
+ }
|
|
|
+ if (auditor.status === sam_auditConst.status.uncheck) {
|
|
|
+ if (j === group.length - 1) {
|
|
|
+ html.push('<span class="dropdown mr-2">',
|
|
|
+ `<a href="javascript: void(0)" class="add-audit" id="${auditor.aid}_add_dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">增加</a>`,
|
|
|
+ makeSelectAudit(auditor.aid+'_add', auditor.aid, 'add'),'</div>', '</span>');
|
|
|
+ if (auditor.audit_type !== auditType.key.common) {
|
|
|
+ html.push('<span class="dropdown mr-2">',
|
|
|
+ `<a href="javascript: void(0)" class="add-audit" id="${auditor.aid}_add_dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">平级</a>`,
|
|
|
+ makeSelectAudit(auditor.aid+'_add-sibling', auditor.aid, 'add-sibling'),'</div>', '</span>');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ html.push('<span class="dropdown mr-2">',
|
|
|
+ `<a href="javascript: void(0)" class="add-audit" id="${auditor.aid}_add_dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">更换</a>`,
|
|
|
+ makeSelectAudit(auditor.aid+'_change', auditor.aid, 'change'),'</div>', '</span>');
|
|
|
+ html.push(`<span class="dropdown">
|
|
|
+ <a href="javascript: void(0)" class="text-danger" title="移除" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">移除</a>
|
|
|
+ <div class="dropdown-menu">
|
|
|
+ <span class="dropdown-item" href="javascript:void(0);">确认移除审批人?</span>
|
|
|
+ <div class="dropdown-divider"></div>
|
|
|
+ <div class="px-2 py-1 text-center">
|
|
|
+ <button class="remove-audit btn btn-sm btn-danger" data-id="${auditor.aid}">移除</button>
|
|
|
+ <button class="btn btn-sm btn-secondary">取消</button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </span>`);
|
|
|
+ }
|
|
|
+ html.push('</td>');
|
|
|
+ html.push('</tr>');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return html.join('');
|
|
|
+ };
|
|
|
+
|
|
|
+ $('body').on('click', '#admin-edit-shenpi dl dd', function () {
|
|
|
+ const id = parseInt($(this).attr('data-id'));
|
|
|
+ if (!id) return;
|
|
|
+
|
|
|
+ let this_aid = parseInt($(this).parents('.book-list').attr('data-aid'));
|
|
|
+ let this_operate = $(this).parents('.book-list').attr('data-operate');
|
|
|
+ const user = _.find(accountList, function (item) {
|
|
|
+ return item.id === id;
|
|
|
+ });
|
|
|
+ const auditorIndex = _.findIndex(auditorList, { aid: id });
|
|
|
+ if (auditorIndex !== -1) {
|
|
|
+ toastr.warning('该审核人已存在,请勿重复添加');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const prop = {
|
|
|
+ operate: this_operate,
|
|
|
+ old_aid: this_aid,
|
|
|
+ new_aid: user.id,
|
|
|
+ };
|
|
|
+ postData(getUrlPre() + '/audit/save', prop, (datas) => {
|
|
|
+ $('#admin-edit-shenpi-list').html(getAdminEditShenpiListHtml(datas));
|
|
|
+ changeLiucheng(datas);
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ // 移除审批人
|
|
|
+ $('body').on('click', '.remove-audit', function () {
|
|
|
+ const id = parseInt($(this).attr('data-id'));
|
|
|
+ const prop = {
|
|
|
+ operate: 'del',
|
|
|
+ old_aid: id,
|
|
|
+ };
|
|
|
+ postData(getUrlPre() + '/audit/save', prop, (datas) => {
|
|
|
+ $('#admin-edit-shenpi-list').html(getAdminEditShenpiListHtml(datas));
|
|
|
+ changeLiucheng(datas);
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ const getAuditTypeText = function (type) {
|
|
|
+ if (type === auditType.key.common) return '';
|
|
|
+ return `<span class="text-${auditType.info[type].class}">${auditType.info[type].long}</span>`;
|
|
|
+ };
|
|
|
+
|
|
|
+ function changeLiucheng(datas) {
|
|
|
+ const auditorshtml = [];
|
|
|
+ let lastAuditorHtml = [];
|
|
|
+ for (const [index,data] of datas.entries()) {
|
|
|
+ auditorshtml.push('<li class="list-group-item d-flex justify-content-between align-items-center">');
|
|
|
+ if (index === 0) {
|
|
|
+ auditorshtml.push('<span class="mr-1"><i class="fa fa fa-play-circle fa-rotate-90"></i></span>');
|
|
|
+ } else if (index+1 === datas.length) {
|
|
|
+ auditorshtml.push('<span class="mr-1"><i class="fa fa fa-stop-circle"></i></span>');
|
|
|
+ } else {
|
|
|
+ auditorshtml.push('<span class="mr-1"><i class="fa fa-chevron-circle-down"></i></span>');
|
|
|
+ }
|
|
|
+ auditorshtml.push('<span class="text-muted">');
|
|
|
+ for (const u of data) {
|
|
|
+ auditorshtml.push(`<small class="d-inline-block text-dark mx-1" title="${u.role}" data-auditorId="${u.aid}">${u.name}</small>`);
|
|
|
+ }
|
|
|
+ auditorshtml.push('</span>');
|
|
|
+ auditorshtml.push('<div class="d-flex ml-auto">');
|
|
|
+ if (data[0].audit_type !== auditType.key.common) auditorshtml.push(`<span class="badge badge-pill badge-${auditType.info[data[0].audit_type].class} p-1"><small>${auditType.info[data[0].audit_type].short}</small></span>`);
|
|
|
+ if (index === 0) {
|
|
|
+ auditorshtml.push('<span class="badge badge-light badge-pill ml-auto"><small>原报</small></span>');
|
|
|
+ } else if (index+1 === datas.length) {
|
|
|
+ auditorshtml.push('<span class="badge badge-light badge-pill"><small>终审</small></span>');
|
|
|
+ } else {
|
|
|
+ auditorshtml.push('<span class="badge badge-light badge-pill"><small>'+ transFormToChinese(index) +'审</small></span>');
|
|
|
+ }
|
|
|
+ auditorshtml.push('</div>');
|
|
|
+ auditorshtml.push('</li>');
|
|
|
+ if (data[0].status === sam_auditConst.status.uncheck) {
|
|
|
+ lastAuditorHtml.push('<li class="timeline-list-item pb-2 is_uncheck">');
|
|
|
+ if (index < datas.length - 1) {
|
|
|
+ lastAuditorHtml.push('<div class="timeline-item-tail"></div>');
|
|
|
+ }
|
|
|
+ lastAuditorHtml.push('<div class="timeline-item-icon bg-secondary text-light"></div>');
|
|
|
+
|
|
|
+ lastAuditorHtml.push('<div class="timeline-item-content">');
|
|
|
+ lastAuditorHtml.push(`<div class="py-1">
|
|
|
+ <span class="text-black-50">
|
|
|
+ ${ index !== datas.length - 1 ? data[0].audit_order + '' : '终' }审 ${getAuditTypeText(data[0].audit_type)}
|
|
|
+ </span>
|
|
|
+ </div>`);
|
|
|
+ lastAuditorHtml.push('<div class="card"><div class="card-body px-3 py-0">');
|
|
|
+ for (const [i, auditor] of data.entries()) {
|
|
|
+ lastAuditorHtml.push(`<div class="card-text p-2 py-3 row ${ ( i > 0 ? 'border-top' : '') }">`);
|
|
|
+ lastAuditorHtml.push(`<div class="col"><span class="h6">${auditor.name}</span><span class="text-muted ml-1">${auditor.role}</span></div>`);
|
|
|
+ lastAuditorHtml.push('<div class="col">');
|
|
|
+ lastAuditorHtml.push('</div>');
|
|
|
+ lastAuditorHtml.push('</div>');
|
|
|
+ }
|
|
|
+ lastAuditorHtml.push('</div></div>');
|
|
|
+ lastAuditorHtml.push('</div>');
|
|
|
+ lastAuditorHtml.push('</li>');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $('.last-auditor-list .is_uncheck').remove();
|
|
|
+ $('.last-auditor-list').append(lastAuditorHtml.join(''));
|
|
|
+ $('.auditors-list').html(auditorshtml.join(''));
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ // 审批流程-选择审批人html 生成
|
|
|
+ function makeSelectAudit(code, aid, status) {
|
|
|
+ let divhtml = '';
|
|
|
+ accountGroup.forEach((group, idx) => {
|
|
|
+ let didivhtml = '';
|
|
|
+ if(group) {
|
|
|
+ group.groupList.forEach(item => {
|
|
|
+ didivhtml += item.id !== material_uid ? '<dd class="border-bottom p-2 mb-0 " data-id="' + item.id + '" >\n' +
|
|
|
+ '<p class="mb-0 d-flex"><span class="text-primary">' + item.name + '</span><span\n' +
|
|
|
+ ' class="ml-auto">' + item.mobile + '</span></p>\n' +
|
|
|
+ ' <span class="text-muted">' + item.role + '</span>\n' +
|
|
|
+ ' </dd>\n' : '';
|
|
|
+ });
|
|
|
+ divhtml += '<dt><a href="javascript: void(0);" class="acc-btn" data-groupid="' + idx + '" data-type="hide"><i class="fa fa-plus-square"></i></a> ' + group.groupName + '</dt>\n' +
|
|
|
+ ' <div class="dd-content" data-toggleid="' + idx + '">\n' + didivhtml +
|
|
|
+ ' </div>\n';
|
|
|
+ }
|
|
|
+ });
|
|
|
+ let html = '<div class="dropdown-menu dropdown-menu-right" id="' + code + '_dropdownMenu" aria-labelledby="' + code + '_dropdownMenuButton" style="width:220px">\n' +
|
|
|
+ ' <div class="mb-2 p-2"><input class="form-control form-control-sm gr-search"\n' +
|
|
|
+ ' placeholder="姓名/手机 检索" autocomplete="off" data-code="' + code + '"></div>\n' +
|
|
|
+ ' <dl class="list-unstyled book-list" data-aid="'+ aid +'" data-operate="'+ status +'">\n' + divhtml +
|
|
|
+ ' </dl>\n' +
|
|
|
+ ' </div>\n' +
|
|
|
+ ' </div>\n' +
|
|
|
+ ' </span>\n' +
|
|
|
+ ' </span>\n' +
|
|
|
+ ' </li>';
|
|
|
+ return html;
|
|
|
+ }
|
|
|
});
|
|
|
// 检查上报情况
|
|
|
function checkAuditorFrom () {
|