|  | @@ -236,17 +236,72 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |          toastr.success('已还原到上次保存状态');
 | 
	
		
			
				|  |  |      });
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    // 审批人分组选择
 | 
	
		
			
				|  |  | -    $('#account_group').change(function () {
 | 
	
		
			
				|  |  | -        let account_html = '<option value="0">选择审批人</option>';
 | 
	
		
			
				|  |  | -        for (const account of accountList) {
 | 
	
		
			
				|  |  | -            if (parseInt($(this).val()) === 0 || parseInt($(this).val()) === account.account_group) {
 | 
	
		
			
				|  |  | -                const role = account.role !== '' ? '(' + account.role + ')' : '';
 | 
	
		
			
				|  |  | -                const company = account.company !== '' ? ' -' + account.company : '';
 | 
	
		
			
				|  |  | -                account_html += '<option value="' + account.id + '">' + account.name + role + company + '</option>';
 | 
	
		
			
				|  |  | +    let timer = null
 | 
	
		
			
				|  |  | +    let oldSearchVal = null
 | 
	
		
			
				|  |  | +    // 获取审核相关url
 | 
	
		
			
				|  |  | +    function getUrlPre () {
 | 
	
		
			
				|  |  | +        const path = window.location.pathname.split('/');
 | 
	
		
			
				|  |  | +        return _.take(path, 6).join('/');
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    $('#gr-search').bind('input propertychange', function(e) {
 | 
	
		
			
				|  |  | +        oldSearchVal = e.target.value
 | 
	
		
			
				|  |  | +        timer && clearTimeout(timer)
 | 
	
		
			
				|  |  | +        timer = setTimeout(() => {
 | 
	
		
			
				|  |  | +            const newVal = $('#gr-search').val()
 | 
	
		
			
				|  |  | +            let html = ''
 | 
	
		
			
				|  |  | +            if (newVal && newVal === oldSearchVal) {
 | 
	
		
			
				|  |  | +                accountList.filter(item => item && cur_uid !== item.id && (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>`
 | 
	
		
			
				|  |  | +                })
 | 
	
		
			
				|  |  | +                $('.book-list').empty()
 | 
	
		
			
				|  |  | +                $('.book-list').append(html)
 | 
	
		
			
				|  |  | +            } else {
 | 
	
		
			
				|  |  | +                if (!$('.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 !== cur_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>'
 | 
	
		
			
				|  |  | +                    })
 | 
	
		
			
				|  |  | +                    $('.book-list').empty()
 | 
	
		
			
				|  |  | +                    $('.book-list').append(html)
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | +        }, 400);
 | 
	
		
			
				|  |  | +    })
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    // 添加审批流程按钮逻辑
 | 
	
		
			
				|  |  | +    $('.book-list').on('click', 'dt', function () {
 | 
	
		
			
				|  |  | +        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')
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            })
 | 
	
		
			
				|  |  | +        } 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')
 | 
	
		
			
				|  |  | +            })
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        $('#account_list').html(account_html);
 | 
	
		
			
				|  |  | +        return false
 | 
	
		
			
				|  |  |      });
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      $('#hideSp').click(function () {
 | 
	
	
		
			
				|  | @@ -254,50 +309,56 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |      });
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      // 添加到审批流程中
 | 
	
		
			
				|  |  | -    $('body').on('change', '#account_list', function () {
 | 
	
		
			
				|  |  | -        let id = $(this).val();
 | 
	
		
			
				|  |  | -        id = parseInt(id);
 | 
	
		
			
				|  |  | -        if (id !== 0) {
 | 
	
		
			
				|  |  | -            let auditListIdData = [];
 | 
	
		
			
				|  |  | +    $('dl').on('click', 'dd', function () {
 | 
	
		
			
				|  |  | +        const id = parseInt($(this).data('id'));
 | 
	
		
			
				|  |  | +        if (id) {
 | 
	
		
			
				|  |  | +            const auditListIdData = [];
 | 
	
		
			
				|  |  |              $('#auditList li').each(function () {
 | 
	
		
			
				|  |  | -                let aid = $(this).data('auditid');
 | 
	
		
			
				|  |  | +                const aid = $(this).data('auditid');
 | 
	
		
			
				|  |  |                  auditListIdData.push(aid);
 | 
	
		
			
				|  |  |              });
 | 
	
		
			
				|  |  |              if (!in_array(auditListIdData, id)) {
 | 
	
		
			
				|  |  | -                const accountInfo = accountList.find(function (item) {
 | 
	
		
			
				|  |  | -                    return item.id === id;
 | 
	
		
			
				|  |  | -                });
 | 
	
		
			
				|  |  | -                const user = accountInfo.id + '/%/' + accountInfo.name + '/%/' + accountInfo.role + '/%/' + accountInfo.company;
 | 
	
		
			
				|  |  | -                const addhtml = '<li class="list-group-item" data-auditmsg="' + user + '"' +
 | 
	
		
			
				|  |  | -                    'data-auditid="' + accountInfo.id + '" >' +
 | 
	
		
			
				|  |  | -                    '<a href="javascript:void(0);" class="text-danger pull-right remove_audit_btn">移除</a>' +
 | 
	
		
			
				|  |  | -                    '<span>' + (auditListIdData.length+1) + '</span> ' + accountInfo.name + '  <small class="text-muted">' + accountInfo.role + '</small>' +
 | 
	
		
			
				|  |  | -                    '<p class="m-0 ml-2"><small class="text-muted">' + accountInfo.company + '</small></p>' +
 | 
	
		
			
				|  |  | -                    '</li>';
 | 
	
		
			
				|  |  | -                $('#auditList').append(addhtml);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -                // 重新上报时。令其它的审批人流程图标转换
 | 
	
		
			
				|  |  | -                $('#shenpi-audit-list li i').removeClass('fa-stop-circle').addClass('fa-chevron-circle-down');
 | 
	
		
			
				|  |  | -                $('#shenpi-audit-list2 li i').removeClass('fa-stop-circle').addClass('fa-chevron-circle-down');
 | 
	
		
			
				|  |  | -                // 添加新审批人
 | 
	
		
			
				|  |  | -                const addhtml1 = '<li class="list-group-item" data-auditid="' + accountInfo.id + '" >' +
 | 
	
		
			
				|  |  | -                    '<i class="fa fa-stop-circle"></i> ' +
 | 
	
		
			
				|  |  | -                    accountInfo.name + ' <small class="text-muted">' + accountInfo.role + '</small><span class="pull-right">终审</span>' +
 | 
	
		
			
				|  |  | -                    '</li>';
 | 
	
		
			
				|  |  | -                const addhtml2 = '<li class="list-group-item" data-auditid="' + accountInfo.id + '" >' +
 | 
	
		
			
				|  |  | -                    '<h5 class="card-title"><i class="fa fa-stop-circle"></i> ' +
 | 
	
		
			
				|  |  | -                    accountInfo.name + ' <small class="text-muted">' + accountInfo.role + '</small><span class="pull-right">终审</span>' +
 | 
	
		
			
				|  |  | -                    '</h5></li>';
 | 
	
		
			
				|  |  | -                for (let i = 0; i < $('#shenpi-audit-list li').length; i++) {
 | 
	
		
			
				|  |  | -                    $('#shenpi-audit-list li').eq(i).find('.pull-right').text(transFormToChinese(i) + '审');
 | 
	
		
			
				|  |  | -                    $('#shenpi-audit-list2 li').eq(i).find('.pull-right').text(transFormToChinese(i) + '审');
 | 
	
		
			
				|  |  | +                if (shenpi_status === shenpiConst.sp_status.gdzs) {
 | 
	
		
			
				|  |  | +                    auditListIdData.splice(-1,0,id);
 | 
	
		
			
				|  |  | +                } else {
 | 
	
		
			
				|  |  | +                    auditListIdData.push(id);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                const html = [];
 | 
	
		
			
				|  |  | +                const auditorshtml = [];
 | 
	
		
			
				|  |  | +                auditListIdData.unshift(changesUid);
 | 
	
		
			
				|  |  | +                for (const [index,ids] of auditListIdData.entries()) {
 | 
	
		
			
				|  |  | +                    const accountInfo = _.find(accountList, { 'id': ids });
 | 
	
		
			
				|  |  | +                    if (index !== 0) {
 | 
	
		
			
				|  |  | +                        const user = accountInfo.id + '/%/' + accountInfo.name + '/%/' + accountInfo.role + '/%/' + accountInfo.company;
 | 
	
		
			
				|  |  | +                        html.push('<li class="list-group-item" data-auditmsg="' + user + '" data-auditid="'+ ids +'">');
 | 
	
		
			
				|  |  | +                        if (shenpi_status === shenpiConst.sp_status.sqspr || (shenpi_status === shenpiConst.sp_status.gdzs && index+1 !== auditListIdData.length)) {
 | 
	
		
			
				|  |  | +                            html.push('<a href="javascript:void(0);" class="text-danger pull-right remove_audit_btn">移除</a>');
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                        html.push('<span>');
 | 
	
		
			
				|  |  | +                        html.push(index + ' ');
 | 
	
		
			
				|  |  | +                        html.push('</span> ');
 | 
	
		
			
				|  |  | +                        html.push(accountInfo.name + ' ');
 | 
	
		
			
				|  |  | +                        html.push('<small class="text-muted">');
 | 
	
		
			
				|  |  | +                        html.push(accountInfo.role);
 | 
	
		
			
				|  |  | +                        html.push('</small>');
 | 
	
		
			
				|  |  | +                        html.push('<p class="m-0 ml-2"><small class="text-muted">' + accountInfo.company + '</small></p>');
 | 
	
		
			
				|  |  | +                        html.push('</li>');
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    // 添加新审批人流程修改
 | 
	
		
			
				|  |  | +                    auditorshtml.push('<li class="list-group-item" ' + (index !== 0 ? 'data-auditid="' + accountInfo.id + '"' : '') + '>');
 | 
	
		
			
				|  |  | +                    auditorshtml.push('<i class="fa ' + (index+1 === auditListIdData.length ? 'fa-stop-circle' : 'fa-chevron-circle-down') + '"></i> ');
 | 
	
		
			
				|  |  | +                    auditorshtml.push(accountInfo.name + ' <small class="text-muted">' + accountInfo.role + '</small>');
 | 
	
		
			
				|  |  | +                    if (index === 0) {
 | 
	
		
			
				|  |  | +                        auditorshtml.push('<span class="pull-right">原报</span>');
 | 
	
		
			
				|  |  | +                    } else if (index+1 === auditListIdData.length) {
 | 
	
		
			
				|  |  | +                        auditorshtml.push('<span class="pull-right">终审</span>');
 | 
	
		
			
				|  |  | +                    } else {
 | 
	
		
			
				|  |  | +                        auditorshtml.push('<span class="pull-right">'+ transFormToChinese(index) +'审</span>');
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    auditorshtml.push('</li>');
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  | -                $('#shenpi-audit-list li').eq(0).find('.pull-right').text('原报');
 | 
	
		
			
				|  |  | -                $('#shenpi-audit-list2 li').eq(0).find('.pull-right').text('原报');
 | 
	
		
			
				|  |  | -                $('#shenpi-audit-list li i').eq(0).removeClass('fa-chevron-circle-down').addClass('fa-play-circle');
 | 
	
		
			
				|  |  | -                $('#shenpi-audit-list2 li i').eq(0).removeClass('fa-chevron-circle-down').addClass('fa-play-circle');
 | 
	
		
			
				|  |  | -                $('#shenpi-audit-list').append(addhtml1);
 | 
	
		
			
				|  |  | -                $('#shenpi-audit-list2').append(addhtml2);
 | 
	
		
			
				|  |  | +                $('#auditList').html(html.join(''));
 | 
	
		
			
				|  |  | +                $('#shenpi-audit-list').html(auditorshtml.join(''));
 | 
	
		
			
				|  |  |              } else {
 | 
	
		
			
				|  |  |                  toastr.error('审批流程中已存在该用户!');
 | 
	
		
			
				|  |  |              }
 | 
	
	
		
			
				|  | @@ -320,21 +381,14 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |          // 重新上报时。移除审批流程
 | 
	
		
			
				|  |  |          // 令最后一个图标转换
 | 
	
		
			
				|  |  |          $('#shenpi-audit-list li[data-auditid="' + uid + '"]').remove();
 | 
	
		
			
				|  |  | -        $('#shenpi-audit-list2 li[data-auditid="' + uid + '"]').remove();
 | 
	
		
			
				|  |  |          if ($('#shenpi-audit-list li').length !== 0 && !$('#shenpi-audit-list li i').hasClass('fa-stop-circle')) {
 | 
	
		
			
				|  |  |              $('#shenpi-audit-list li').eq($('#shenpi-audit-list li').length-1).children('i')
 | 
	
		
			
				|  |  |                  .removeClass('fa-chevron-circle-down').addClass('fa-stop-circle');
 | 
	
		
			
				|  |  | -            $('#shenpi-audit-list2 li').eq($('#shenpi-audit-list2 li').length-1).children('i')
 | 
	
		
			
				|  |  | -                .removeClass('fa-chevron-circle-down').addClass('fa-stop-circle');
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          for (let i = 0; i < $('#shenpi-audit-list li').length; i++) {
 | 
	
		
			
				|  |  | -            $('#shenpi-audit-list li').eq(i).find('.pull-right').text((i+1 === $('#shenpi-audit-list li').length ? '终' : transFormToChinese(i+1)) + '审');
 | 
	
		
			
				|  |  | -            $('#shenpi-audit-list2 li').eq(i).find('.pull-right').text((i+1 === $('#shenpi-audit-list2 li').length ? '终' : transFormToChinese(i+1)) + '审');
 | 
	
		
			
				|  |  | +            $('#shenpi-audit-list li').eq(i).find('.pull-right').text(i === 0 ? '原报' : (i+1 === $('#shenpi-audit-list li').length ? '终' : transFormToChinese(i)) + '审');
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        $('#shenpi-audit-list li').eq(0).find('.pull-right').text('原报');
 | 
	
		
			
				|  |  | -        $('#shenpi-audit-list2 li').eq(0).find('.pull-right').text('原报');
 | 
	
		
			
				|  |  |          $('#shenpi-audit-list li i').eq(0).removeClass('fa-chevron-circle-down').addClass('fa-play-circle');
 | 
	
		
			
				|  |  | -        $('#shenpi-audit-list2 li i').eq(0).removeClass('fa-chevron-circle-down').addClass('fa-play-circle');
 | 
	
		
			
				|  |  |      });
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      // 打开签约清单modal并删除之前的操作
 |