|
|
@@ -79,87 +79,35 @@ $(document).ready(function () {
|
|
|
const id = parseInt($(this).data('id'));
|
|
|
if (id) {
|
|
|
postData(preUrl + '/audit/add', { auditorId: id }, (datas) => {
|
|
|
- const html = [];
|
|
|
- // 如果是重新上报,添加到重新上报列表中
|
|
|
- const auditorshtml = [];
|
|
|
- for (const [index,data] of datas.entries()) {
|
|
|
- if (index !== 0) {
|
|
|
- html.push('<li class="list-group-item" auditorId="'+ data.aid +'">');
|
|
|
- html.push('<a href="javascript: void(0)" class="text-danger pull-right">移除</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>');
|
|
|
- }
|
|
|
- // 添加新审批人流程修改
|
|
|
- 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>');
|
|
|
- if (index === 0) {
|
|
|
- auditorshtml.push('<span class="pull-right">原报</span>');
|
|
|
- } else if (index+1 === datas.length) {
|
|
|
- auditorshtml.push('<span class="pull-right">终审</span>');
|
|
|
- } else {
|
|
|
- auditorshtml.push('<span class="pull-right">'+ transFormToChinese(index) +'审</span>');
|
|
|
- }
|
|
|
- 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(''));
|
|
|
+ makeSpHtml(datas);
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
// 删除审批人
|
|
|
- $('body').on('click', '#auditors li>a', function () {
|
|
|
- const li = $(this).parent();
|
|
|
+ $('body').on('click', '#auditors li a', function () {
|
|
|
+ const li = $(this).parents('li');
|
|
|
const data = {
|
|
|
auditorId: parseInt(li.attr('auditorId')),
|
|
|
};
|
|
|
+ console.log(data);
|
|
|
postData(preUrl + '/audit/delete', data, (result) => {
|
|
|
li.remove();
|
|
|
- for (const rst of result) {
|
|
|
- const aLi = $('li[auditorId=' + rst.aid + ']');
|
|
|
- $('span', aLi).text(rst.order + ' ' + rst.name + ' ');
|
|
|
- }
|
|
|
+ let index = 1;
|
|
|
+ $('#auditors li').each(function () {
|
|
|
+ $(this).children('.col-auto').eq(0).text(index);
|
|
|
+ index++;
|
|
|
+ });
|
|
|
|
|
|
// 如果是重新上报
|
|
|
// 令最后一个图标转换
|
|
|
- $('#auditors-list li[data-auditorid="' + data.auditorId + '"]').remove();
|
|
|
+ $('#auditors-list li[data-auditorId="' + data.auditorId + '"]').remove();
|
|
|
if ($('#auditors-list li').length !== 0 && !$('#auditors-list li i').hasClass('fa-stop-circle')) {
|
|
|
- $('#auditors-list li').eq($('#auditors-list li').length-1).children('i')
|
|
|
+ console.log($('#auditors-list li').length-1, $('#auditors-list li').eq($('#auditors-list li').length-1).find('i'));
|
|
|
+ $('#auditors-list li').eq($('#auditors-list li').length-1).find('i')
|
|
|
.removeClass('fa-chevron-circle-down').addClass('fa-stop-circle');
|
|
|
}
|
|
|
- // $('#auditors-list2 li[data-auditid="' + data.auditorId + '"]').remove();
|
|
|
- // if ($('#auditors-list2 li').length !== 0 && !$('#auditors-list2 li i').hasClass('fa-stop-circle')) {
|
|
|
- // $('#auditors-list2 li').eq($('#auditors-list2 li').length-1).children('i')
|
|
|
- // .removeClass('fa-chevron-circle-down').addClass('fa-stop-circle');
|
|
|
- // }
|
|
|
for (let i = 0; i < $('#auditors-list li').length; i++) {
|
|
|
- $('#auditors-list li').eq(i).find('.pull-right').text(i === 0 ? '原报' : (i+1 === $('#auditors-list li').length ? '终' : transFormToChinese(i)) + '审');
|
|
|
- // $('#auditors-list2').eq(i).find('.pull-right').text((i+1 === $('#auditors-list2').length ? '终' : transFormToChinese(i+1)) + '审');
|
|
|
+ $('#auditors-list li').eq(i).find('.badge-pill').children('small').text(i === 0 ? '原报' : (i+1 === $('#auditors-list li').length ? '终' : transFormToChinese(i)) + '审');
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
@@ -188,11 +136,13 @@ $(document).ready(function () {
|
|
|
</a> ${group.groupName}</dt>
|
|
|
<div class="dd-content" data-toggleid="${idx}">`
|
|
|
group.groupList.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>`
|
|
|
+ if (item.id !== change.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>'
|
|
|
})
|
|
|
@@ -261,6 +211,22 @@ $(document).ready(function () {
|
|
|
});
|
|
|
});
|
|
|
|
|
|
+ // 切换审批组
|
|
|
+ $('#change-sp-group').change(function () {
|
|
|
+ const data = {
|
|
|
+ type: 'change_sp_group',
|
|
|
+ sp_group: parseInt($(this).val()),
|
|
|
+ }
|
|
|
+ if (!data.sp_group) {
|
|
|
+ toastr.error('请选择固定审批组');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ console.log(data);
|
|
|
+ postData(preUrl + '/audit/spgroup', data, (datas) => {
|
|
|
+ makeSpHtml(datas);
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
// 退回选择修改审批人流程
|
|
|
$('#hideSp').click(function () {
|
|
|
$('#sp-list').modal('hide');
|
|
|
@@ -273,7 +239,102 @@ $(document).ready(function () {
|
|
|
$('#sp-list').on('hidden.bs.modal', function (e) {
|
|
|
$(document.body).addClass('modal-open');
|
|
|
});
|
|
|
+
|
|
|
+ // 管理员更改审批流程js部分
|
|
|
+ let timer3 = null;
|
|
|
+ let oldSearchVal3 = null;
|
|
|
+ $('body').on('input propertychange', '#admin-edit-shenpi .gr-search', function(e) {
|
|
|
+ oldSearchVal3 = e.target.value;
|
|
|
+ timer3 && clearTimeout(timer3);
|
|
|
+ timer3 = setTimeout(() => {
|
|
|
+ const newVal = $(this).val();
|
|
|
+ const code = $(this).attr('data-code');
|
|
|
+ let html = '';
|
|
|
+ if (newVal && newVal === oldSearchVal3) {
|
|
|
+ accountList.filter(item => item && item.id !== change.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 !== change.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);
|
|
|
+ });
|
|
|
});
|
|
|
+function makeSpHtml(datas) {
|
|
|
+ const html = [];
|
|
|
+ // 如果是重新上报,添加到重新上报列表中
|
|
|
+ const auditorshtml = [];
|
|
|
+ for (const [index,data] of datas.entries()) {
|
|
|
+ if (index !== 0) {
|
|
|
+ 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" auditorId="${auditor.uid}"><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">');
|
|
|
+ // todo 添加会签或签时
|
|
|
+ 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>`);
|
|
|
+ }
|
|
|
+ // html.push('<span class="badge badge-pill badge-primary badge-bg-small"><small></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('</div>');
|
|
|
+ html.push('</li>');
|
|
|
+ }
|
|
|
+ // 添加新审批人流程修改
|
|
|
+ auditorshtml.push('<li class="list-group-item d-flex justify-content-between align-items-center" data-auditorid="' + data[0].aid + '">');
|
|
|
+ auditorshtml.push('<span class="mr-1"><i class="fa ' + (index === 0 ? 'fa-play-circle fa-rotate-90' : index+1 === datas.length ? 'fa-stop-circle' : 'fa-chevron-circle-down') + '"></i></span>');
|
|
|
+ auditorshtml.push('<span class="text-muted">');
|
|
|
+ for (const auditor of data) {
|
|
|
+ auditorshtml.push(`<small class="d-inline-block text-dark mx-1" title="${auditor.role}" data-auditorId="${auditor.uid}">${auditor.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>');
|
|
|
+ }
|
|
|
+ $('#auditors').html(html.join(''));
|
|
|
+ $('#auditors-list').html(auditorshtml.join(''));
|
|
|
+}
|
|
|
// 检查上报情况
|
|
|
function checkAuditorFrom () {
|
|
|
if ($('#auditors li').length === 0) {
|