|  | @@ -291,6 +291,57 @@ $(document).ready(function () {
 | 
	
		
			
				|  |  |          }, 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="${auditConst.auditStringClass[auditor.status]}">${ auditor.status !== auditConst.status.uncheck ? auditConst.auditString[auditor.status] : '待审批' }</span></td>`);
 | 
	
		
			
				|  |  | +                html.push('<td style="text-align: center">');
 | 
	
		
			
				|  |  | +                if (auditor.status === 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.id+'_add', auditor.id, 'add'),'</div>', '</span>');
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                if (auditor.status === 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.id+'_add', auditor.id, 'add'),'</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.id+'_add-sibling', auditor.id, '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.id+'_change', auditor.id, '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;
 | 
	
	
		
			
				|  | @@ -305,63 +356,13 @@ $(document).ready(function () {
 | 
	
		
			
				|  |  |              toastr.warning('该审核人已存在,请勿重复添加');
 | 
	
		
			
				|  |  |              return;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        const order = parseInt($(this).parents('tr').find('.shenpi-order').text());
 | 
	
		
			
				|  |  | -        const curAuditorIndex = _.findIndex(auditorList, { aid: this_aid });
 | 
	
		
			
				|  |  |          const prop = {
 | 
	
		
			
				|  |  |              operate: this_operate,
 | 
	
		
			
				|  |  |              old_aid: this_aid,
 | 
	
		
			
				|  |  |              new_aid: user.id,
 | 
	
		
			
				|  |  |          };
 | 
	
		
			
				|  |  |          postData(getUrlPre() + '/audit/save', prop, (datas) => {
 | 
	
		
			
				|  |  | -            if (this_operate === 'add') {
 | 
	
		
			
				|  |  | -                const addhtml = '<tr>\n' +
 | 
	
		
			
				|  |  | -                    `                                <td><span class="shenpi-order">${order+1}</span> ${user.name} <small class="text-muted">${user.role}</small></td>\n` +
 | 
	
		
			
				|  |  | -                    `                                <td style="text-align: center"><span class="">待审批</span></td>\n` +
 | 
	
		
			
				|  |  | -                    '                                <td style="text-align: center">\n' +
 | 
	
		
			
				|  |  | -                    '                                    <span class="dropdown mr-2">\n' +
 | 
	
		
			
				|  |  | -                    `                                    <a href="javascript: void(0)" class="add-audit" id="${user.id}_add_dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">增加</a>\n` +
 | 
	
		
			
				|  |  | -                    makeSelectAudit(user.id+'_add', user.id, 'add') +
 | 
	
		
			
				|  |  | -                    '                                        </div>\n' +
 | 
	
		
			
				|  |  | -                    '                                    </span>\n' +
 | 
	
		
			
				|  |  | -                    '                                    <span class="dropdown mr-2">\n' +
 | 
	
		
			
				|  |  | -                    `                                        <a href="javascript: void(0)" class="change-audit" id="${user.id}_change_dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">更换</a>\n` +
 | 
	
		
			
				|  |  | -                    makeSelectAudit(user.id+'_change', user.id, 'change') +
 | 
	
		
			
				|  |  | -                    '                                    </span>\n' +
 | 
	
		
			
				|  |  | -                    '                                    <span class="dropdown">\n' +
 | 
	
		
			
				|  |  | -                    '                                    <a href="javascript: void(0)" class="text-danger" title="移除" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">移除</a>\n' +
 | 
	
		
			
				|  |  | -                    '                                    <div class="dropdown-menu">\n' +
 | 
	
		
			
				|  |  | -                    '                                        <span class="dropdown-item">确认移除审批人?</span>\n' +
 | 
	
		
			
				|  |  | -                    '                                        <div class="dropdown-divider"></div>\n' +
 | 
	
		
			
				|  |  | -                    '                                        <div class="px-2 py-1 text-center">\n' +
 | 
	
		
			
				|  |  | -                    `                                            <button class="remove-audit btn btn-sm btn-danger" data-id="${user.id}">移除</button>\n` +
 | 
	
		
			
				|  |  | -                    '                                            <button class="btn btn-sm btn-secondary">取消</button>\n' +
 | 
	
		
			
				|  |  | -                    '                                        </div>\n' +
 | 
	
		
			
				|  |  | -                    '                                    </div>\n' +
 | 
	
		
			
				|  |  | -                    '                                    </span>\n' +
 | 
	
		
			
				|  |  | -                    '                                </td>\n' +
 | 
	
		
			
				|  |  | -                    '                            </tr>';
 | 
	
		
			
				|  |  | -                $(this).parents('tr').after(addhtml);
 | 
	
		
			
				|  |  | -                auditorList.splice(curAuditorIndex+1, 0, { aid: user.id, company: user.company, name: user.name, role: user.role });
 | 
	
		
			
				|  |  | -                updateOrder(user.id);
 | 
	
		
			
				|  |  | -            } else if (this_operate === 'change') {
 | 
	
		
			
				|  |  | -                const this_user = _.find(auditorList, { aid: this_aid });
 | 
	
		
			
				|  |  | -                this_user.aid = user.id;
 | 
	
		
			
				|  |  | -                this_user.company = user.company;
 | 
	
		
			
				|  |  | -                this_user.role = user.role;
 | 
	
		
			
				|  |  | -                this_user.name = user.name;
 | 
	
		
			
				|  |  | -                auditorList.splice(curAuditorIndex, 1, this_user);
 | 
	
		
			
				|  |  | -                $(this).parents('tr').children('td').eq(0).html(`<span class="shenpi-order">${order}</span> ${user.name} <small class="text-muted">${user.role}</small>`);
 | 
	
		
			
				|  |  | -                // 替换所有aid
 | 
	
		
			
				|  |  | -                $(this).parents('.book-list').attr('data-aid', user.id);
 | 
	
		
			
				|  |  | -                $(this).parents('.dropdown-menu').attr('id', user.id +'_change_dropdownMenu').attr('aria-labelledby', user.id +'_change_dropdownMenuButton');
 | 
	
		
			
				|  |  | -                $(this).parents('.dropdown-menu').children('mb-2').children('input').attr('data-code', user.id +'_change');
 | 
	
		
			
				|  |  | -                $(this).parents('.dropdown-menu').siblings('.change-audit').attr('id', user.id +'_change_dropdownMenuButton');
 | 
	
		
			
				|  |  | -                $(this).parents('td').children('span').eq(0).find('.add-audit').attr('id', user.id +'_add_dropdownMenuButton');
 | 
	
		
			
				|  |  | -                $(this).parents('td').children('span').eq(0).find('.dropdown-menu').attr('id', user.id +'_add_dropdownMenu').attr('aria-labelledby', user.id +'_add_dropdownMenuButton');
 | 
	
		
			
				|  |  | -                $(this).parents('td').children('span').eq(0).find('.dropdown-menu').children('mb-2').children('input').attr('data-code', user.id +'_add');
 | 
	
		
			
				|  |  | -                $(this).parents('td').children('span').eq(0).find('.dropdown-menu').children('.book-list').attr('data-aid', user.id);
 | 
	
		
			
				|  |  | -                $(this).parents('td').children('span').eq(2).find('.remove-audit').attr('data-id', user.id);
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | +            $('#admin-edit-shenpi-list').html(getAdminEditShenpiListHtml(datas));
 | 
	
		
			
				|  |  |              changeLiucheng(datas);
 | 
	
		
			
				|  |  |          });
 | 
	
		
			
				|  |  |      });
 | 
	
	
		
			
				|  | @@ -374,62 +375,72 @@ $(document).ready(function () {
 | 
	
		
			
				|  |  |              old_aid: id,
 | 
	
		
			
				|  |  |          };
 | 
	
		
			
				|  |  |          postData(getUrlPre() + '/audit/save', prop, (datas) => {
 | 
	
		
			
				|  |  | -            updateOrder(id, 0);
 | 
	
		
			
				|  |  | -            const curAuditorIndex = _.findIndex(auditorList, { aid: id });
 | 
	
		
			
				|  |  | -            auditorList.splice(curAuditorIndex, 1);
 | 
	
		
			
				|  |  | -            $(this).parents('tr').remove();
 | 
	
		
			
				|  |  | +            $('#admin-edit-shenpi-list').html(getAdminEditShenpiListHtml(datas));
 | 
	
		
			
				|  |  |              changeLiucheng(datas);
 | 
	
		
			
				|  |  |          });
 | 
	
		
			
				|  |  |      });
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    // 比uid大的序号进行调整
 | 
	
		
			
				|  |  | -    function updateOrder(aid, num = 1) {
 | 
	
		
			
				|  |  | -        const index = _.findIndex(auditorList, { aid });
 | 
	
		
			
				|  |  | -        for (let i = index;i < auditorList.length; i++) {
 | 
	
		
			
				|  |  | -            $('#admin-edit-shenpi tbody').children('tr').eq(i).find('.shenpi-order').text(i+num);
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | +    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 = '';
 | 
	
		
			
				|  |  | +        let lastAuditorHtml = [];
 | 
	
		
			
				|  |  |          for (const [index,data] of datas.entries()) {
 | 
	
		
			
				|  |  | -            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>');
 | 
	
		
			
				|  |  | +            auditorshtml.push('<li class="list-group-item d-flex justify-content-between align-items-center">');
 | 
	
		
			
				|  |  |              if (index === 0) {
 | 
	
		
			
				|  |  | -                auditorshtml.push('<span class="pull-right">原报</span>');
 | 
	
		
			
				|  |  | +                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="pull-right">终审</span>');
 | 
	
		
			
				|  |  | +                auditorshtml.push('<span class="mr-1"><i class="fa fa fa-stop-circle"></i></span>');
 | 
	
		
			
				|  |  |              } else {
 | 
	
		
			
				|  |  | -                auditorshtml.push('<span class="pull-right">'+ transFormToChinese(index) +'审</span>');
 | 
	
		
			
				|  |  | +                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.status === sam_auditConst.status.uncheck) {
 | 
	
		
			
				|  |  | -                lastAuditorHtml += '<li class="timeline-list-item pb-2 is_uncheck">\n' +
 | 
	
		
			
				|  |  | -                    '                                            <div class="timeline-item-date">\n' +
 | 
	
		
			
				|  |  | -                    '                                                \n' +
 | 
	
		
			
				|  |  | -                    '                                            </div>\n' +
 | 
	
		
			
				|  |  | -                    '                                            <div class="timeline-item-icon bg-secondary text-light">\n' +
 | 
	
		
			
				|  |  | -                    '                                            </div>\n' +
 | 
	
		
			
				|  |  | -                    '                                            <div class="timeline-item-content">\n' +
 | 
	
		
			
				|  |  | -                    '                                                <div class="card">\n' +
 | 
	
		
			
				|  |  | -                    '                                                    <div class="card-body p-3">\n' +
 | 
	
		
			
				|  |  | -                    '                                                        <div class="card-text">\n' +
 | 
	
		
			
				|  |  | -                    `                                                            <p class="mb-1"><span class="h5">${data.name}</span>\n` +
 | 
	
		
			
				|  |  | -                    '                                                                <span class="pull-right ">\n' +
 | 
	
		
			
				|  |  | -                    '                                                                </span>\n' +
 | 
	
		
			
				|  |  | -                    '                                                            </p>\n' +
 | 
	
		
			
				|  |  | -                    `                                                            <p class="text-muted mb-0">${data.role}</p>\n` +
 | 
	
		
			
				|  |  | -                    '                                                        </div>\n' +
 | 
	
		
			
				|  |  | -                    '                                                    </div>\n' +
 | 
	
		
			
				|  |  | -                    '                                                </div>\n' +
 | 
	
		
			
				|  |  | -                    '                                            </div>\n' +
 | 
	
		
			
				|  |  | -                    '                                        </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);
 | 
	
		
			
				|  |  | +        $('.last-auditor-list').append(lastAuditorHtml.join(''));
 | 
	
		
			
				|  |  |          $('.auditors-list').html(auditorshtml.join(''));
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      }
 |