|
@@ -388,8 +388,11 @@
|
|
|
<div class="modal-body">
|
|
|
<div class="row">
|
|
|
<div class="col-4 modal-height-500" style="overflow: auto">
|
|
|
+ <% if(change.status !== auditConst.status.checked && ctx.session.sessionUser.is_admin) { %>
|
|
|
+ <a href="#sub-sp2" data-toggle="modal" data-category="" data-target="#sub-sp2" id="hideSp">修改审批流程</a>
|
|
|
+ <% } %>
|
|
|
<div class="card mt-3">
|
|
|
- <ul class="list-group list-group-flush">
|
|
|
+ <ul class="list-group list-group-flush auditors-list">
|
|
|
<% for (const [index,a] of auditList2.entries()) { %>
|
|
|
<li class="list-group-item">
|
|
|
<% if (a.usite === 0 ) { %>
|
|
@@ -415,7 +418,7 @@
|
|
|
<% } %>
|
|
|
<div class="<%- idx < auditList3.length - 1 ? 'fold-card' : '' %>">
|
|
|
<div class="text-center text-muted"><%- idx+1 %>#</div>
|
|
|
- <ul class="timeline-list list-unstyled mt-2">
|
|
|
+ <ul class="timeline-list list-unstyled mt-2 <% if (idx === auditList3.length - 1) { %>last-auditor-list<% } %>">
|
|
|
<% auditors.forEach((auditor, index) => { %>
|
|
|
<% if (index === 0) { %>
|
|
|
<li class="timeline-list-item pb-2">
|
|
@@ -441,7 +444,7 @@
|
|
|
</div>
|
|
|
</li>
|
|
|
<% } else {%>
|
|
|
- <li class="timeline-list-item pb-2">
|
|
|
+ <li class="timeline-list-item pb-2 <% if (auditor.status === auditConst.auditStatus.uncheck && idx === auditList3.length - 1) { %>is_uncheck<% } %>">
|
|
|
<div class="timeline-item-date">
|
|
|
<%- ctx.helper.formatDate(auditor.sin_time) %>
|
|
|
</div>
|
|
@@ -519,8 +522,11 @@
|
|
|
<div class="modal-body">
|
|
|
<div class="row">
|
|
|
<div class="col-4 modal-height-500" style="overflow: auto">
|
|
|
+ <% if(change.status !== auditConst.status.checked && ctx.session.sessionUser.is_admin) { %>
|
|
|
+ <a href="#sub-sp2" data-toggle="modal" data-category="" data-target="#sub-sp2" id="hideSp">修改审批流程</a>
|
|
|
+ <% } %>
|
|
|
<div class="card mt-3">
|
|
|
- <ul class="list-group list-group-flush">
|
|
|
+ <ul class="list-group list-group-flush auditors-list">
|
|
|
<% for (const [index,a] of auditList2.entries()) { %>
|
|
|
<% if (a.usite === 0) { %>
|
|
|
<li class="list-group-item">
|
|
@@ -634,7 +640,7 @@
|
|
|
<% } %>
|
|
|
<div class="">
|
|
|
<div class="text-center text-muted"><%- auditList4.length+1 %>#</div>
|
|
|
- <ul class="timeline-list list-unstyled mt-2">
|
|
|
+ <ul class="timeline-list list-unstyled mt-2 last-auditor-list">
|
|
|
<% auditList3.forEach((auditor, index) => { %>
|
|
|
<% if (index === 0) { %>
|
|
|
<li class="timeline-list-item pb-2">
|
|
@@ -660,7 +666,7 @@
|
|
|
</div>
|
|
|
</li>
|
|
|
<% } else {%>
|
|
|
- <li class="timeline-list-item pb-2">
|
|
|
+ <li class="timeline-list-item pb-2 <% if (auditor.status === auditConst.auditStatus.uncheck) { %>is_uncheck<% } %>">
|
|
|
<div class="timeline-item-date">
|
|
|
<%- ctx.helper.formatDate(auditor.sin_time) %>
|
|
|
</div>
|
|
@@ -757,8 +763,11 @@
|
|
|
<div class="modal-body">
|
|
|
<div class="row">
|
|
|
<div class="col-4 modal-height-500" style="overflow: auto">
|
|
|
+ <% if(change.status !== auditConst.status.checked && ctx.session.sessionUser.is_admin) { %>
|
|
|
+ <a href="#sub-sp2" data-toggle="modal" data-category="" data-target="#sub-sp2" id="hideSp">修改审批流程</a>
|
|
|
+ <% } %>
|
|
|
<div class="card mt-3">
|
|
|
- <ul class="list-group list-group-flush">
|
|
|
+ <ul class="list-group list-group-flush auditors-list">
|
|
|
<% for (const [index,a] of auditList2.entries()) { %>
|
|
|
<% if (a.usite === 0) { %>
|
|
|
<li class="list-group-item">
|
|
@@ -810,7 +819,7 @@
|
|
|
</div>
|
|
|
</li>
|
|
|
<% } else {%>
|
|
|
- <li class="timeline-list-item pb-2">
|
|
|
+ <li class="timeline-list-item pb-2 <% if (auditor.status === auditConst.auditStatus.uncheck) { %>is_uncheck<% } %>">
|
|
|
<div class="timeline-item-date">
|
|
|
<%- ctx.helper.formatDate(auditor.sin_time) %>
|
|
|
</div>
|
|
@@ -873,7 +882,7 @@
|
|
|
<% } %>
|
|
|
<div class="">
|
|
|
<div class="text-center text-muted"><%- auditList4.length+1 %>#</div>
|
|
|
- <ul class="timeline-list list-unstyled mt-2">
|
|
|
+ <ul class="timeline-list list-unstyled mt-2 last-auditor-list">
|
|
|
<% auditList3.forEach((auditor, index) => { %>
|
|
|
<% if (index === 0) { %>
|
|
|
<li class="timeline-list-item pb-2">
|
|
@@ -899,7 +908,7 @@
|
|
|
</div>
|
|
|
</li>
|
|
|
<% } else {%>
|
|
|
- <li class="timeline-list-item pb-2">
|
|
|
+ <li class="timeline-list-item pb-2 <% if (auditor.status === auditConst.auditStatus.uncheck) { %>is_uncheck<% } %>">
|
|
|
<div class="timeline-item-date">
|
|
|
<%- ctx.helper.formatDate(auditor.sin_time) %>
|
|
|
</div>
|
|
@@ -1219,6 +1228,138 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<% } %>
|
|
|
+<% if (ctx.change && ctx.change.status !== auditConst.status.checked && ctx.session.sessionUser.is_admin) { %>
|
|
|
+ <!--上报审批-->
|
|
|
+ <div class="modal fade" id="sub-sp2" data-backdrop="static">
|
|
|
+ <div class="modal-dialog" style="max-width: 650px" role="document">
|
|
|
+ <div class="modal-content">
|
|
|
+ <div class="modal-header">
|
|
|
+ <h5 class="modal-title">修改审批流程</h5>
|
|
|
+ </div>
|
|
|
+ <div class="modal-body">
|
|
|
+ <div class="card mt-1">
|
|
|
+ <div class="modal-height-500" style="overflow: auto">
|
|
|
+ <style>
|
|
|
+ #admin-edit-shenpi thead th {
|
|
|
+ border-bottom: 0;
|
|
|
+ }
|
|
|
+ #admin-edit-shenpi td, #admin-edit-shenpi th {
|
|
|
+ padding: 0.75rem;
|
|
|
+ }
|
|
|
+ #admin-edit-shenpi th {
|
|
|
+ background: none;
|
|
|
+ color: #212529;
|
|
|
+ border-top: 0;
|
|
|
+ }
|
|
|
+ </style>
|
|
|
+ <table class="table table-hover" id="admin-edit-shenpi">
|
|
|
+ <thead>
|
|
|
+ <tr class="card-header">
|
|
|
+ <th>审批流程</th>
|
|
|
+ <th width="80" style="text-align: center">审批状态</th>
|
|
|
+ <th width="200" style="text-align: center">操作</th>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ <% for (let i = 0, iLen = change.auditors2.length; i < iLen; i++) { %>
|
|
|
+ <tr>
|
|
|
+ <td><span class="shenpi-order"><%- i+1 %></span> <%- change.auditors2[i].name %> <small class="text-muted"><%- change.auditors2[i].jobs %></small></td>
|
|
|
+ <td style="text-align: center"><span class="<%- auditConst.auditStatusClass[change.auditors2[i].status] %>"><%- change.auditors2[i].status !== auditConst.status.uncheck ? auditConst.auditStatusString[change.auditors2[i].status] : '待审批' %></span></td>
|
|
|
+ <td style="text-align: center">
|
|
|
+ <% if (change.auditors2[i].status === auditConst.status.checking) { %>
|
|
|
+ <span class="dropdown mr-2">
|
|
|
+ <a href="javascript: void(0)" class="add-audit" id="<%- change.auditors2[i].uid %>_add_dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">增加</a>
|
|
|
+ <div class="dropdown-menu dropdown-menu-right" id="<%- change.auditors2[i].uid %>_add_dropdownMenu" aria-labelledby="<%- change.auditors2[i].uid %>_add_dropdownMenuButton" style="width:220px">
|
|
|
+ <div class="mb-2 p-2"><input class="form-control form-control-sm gr-search"
|
|
|
+ placeholder="姓名/手机 检索" autocomplete="off" data-code="<%- change.auditors2[i].uid %>_add"></div>
|
|
|
+ <dl class="list-unstyled book-list" data-aid="<%- change.auditors2[i].uid %>" data-operate="add">
|
|
|
+ <% accountGroup.forEach((group, idx) => { %>
|
|
|
+ <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 => { %>
|
|
|
+ <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>
|
|
|
+ <% });%>
|
|
|
+ </div>
|
|
|
+ <% }) %>
|
|
|
+ </dl>
|
|
|
+ </div>
|
|
|
+ </span>
|
|
|
+ <% } %>
|
|
|
+ <% if (change.auditors2[i].status === auditConst.status.uncheck) { %>
|
|
|
+ <span class="dropdown mr-2">
|
|
|
+ <a href="javascript: void(0)" class="add-audit" id="<%- change.auditors2[i].uid %>_add_dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">增加</a>
|
|
|
+ <div class="dropdown-menu dropdown-menu-right" id="<%- change.auditors2[i].uid %>_add_dropdownMenu" aria-labelledby="<%- change.auditors2[i].uid %>_add_dropdownMenuButton" style="width:220px">
|
|
|
+ <div class="mb-2 p-2"><input class="form-control form-control-sm gr-search"
|
|
|
+ placeholder="姓名/手机 检索" autocomplete="off" data-code="<%- change.auditors2[i].uid %>_add"></div>
|
|
|
+ <dl class="list-unstyled book-list" data-aid="<%- change.auditors2[i].uid %>" data-operate="add">
|
|
|
+ <% accountGroup.forEach((group, idx) => { %>
|
|
|
+ <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 => { %>
|
|
|
+ <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>
|
|
|
+ <% });%>
|
|
|
+ </div>
|
|
|
+ <% }) %>
|
|
|
+ </dl>
|
|
|
+ </div>
|
|
|
+ </span>
|
|
|
+ <span class="dropdown mr-2">
|
|
|
+ <a href="javascript: void(0)" class="change-audit" id="<%- change.auditors2[i].uid %>_change_dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">更换</a>
|
|
|
+ <div class="dropdown-menu dropdown-menu-right" id="<%- change.auditors2[i].uid %>_change_dropdownMenu" aria-labelledby="<%- change.auditors2[i].uid %>_change_dropdownMenuButton" style="width:220px">
|
|
|
+ <div class="mb-2 p-2"><input class="form-control form-control-sm gr-search"
|
|
|
+ placeholder="姓名/手机 检索" autocomplete="off" data-code="<%- change.auditors2[i].uid %>_change"></div>
|
|
|
+ <dl class="list-unstyled book-list" data-aid="<%- change.auditors2[i].uid %>" data-operate="change">
|
|
|
+ <% accountGroup.forEach((group, idx) => { %>
|
|
|
+ <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 => { %>
|
|
|
+ <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>
|
|
|
+ <% });%>
|
|
|
+ </div>
|
|
|
+ <% }) %>
|
|
|
+ </dl>
|
|
|
+ </div>
|
|
|
+ </span>
|
|
|
+ <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="<%- change.auditors2[i].uid %>">移除</button>
|
|
|
+ <button class="btn btn-sm btn-secondary">取消</button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </span>
|
|
|
+ <% } %>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ <% } %>
|
|
|
+ </table>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <form class="modal-footer">
|
|
|
+ <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">关闭</button>
|
|
|
+ </form>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+<% } %>
|
|
|
<script type="text/javascript">
|
|
|
const csrf = '<%= ctx.csrf %>';
|
|
|
const authMobile = '<%= authMobile %>';
|
|
@@ -1364,3 +1505,264 @@
|
|
|
});
|
|
|
<% } %>
|
|
|
</script>
|
|
|
+<% if (auditStatus === 1 || auditStatus === 2 || auditStatus === 9 || ctx.session.sessionUser.is_admin) { %>
|
|
|
+ <script>
|
|
|
+ const accountGroup = JSON.parse(unescape('<%- escape(JSON.stringify(accountGroup)) %>'));
|
|
|
+ const accountList = JSON.parse(unescape('<%- escape(JSON.stringify(accountList)) %>'));
|
|
|
+ </script>
|
|
|
+<% } %>
|
|
|
+<% if (ctx.change && ctx.change.status !== auditConst.status.checked && ctx.session.sessionUser.is_admin) { %>
|
|
|
+ <script>
|
|
|
+ const auditorList = JSON.parse(unescape('<%- escape(JSON.stringify(change.auditors2)) %>'));
|
|
|
+ $(function () {
|
|
|
+ // 退回选择修改审批人流程
|
|
|
+ $('#hideSp').click(function () {
|
|
|
+ $('#sp-list').modal('hide');
|
|
|
+ });
|
|
|
+ $('a[f-target]').click(function () {
|
|
|
+ $($(this).attr('f-target')).modal('show');
|
|
|
+ });
|
|
|
+
|
|
|
+ // 多层modal关闭后的滚动bug修复
|
|
|
+ $('#sp-list').on('hidden.bs.modal', function (e) {
|
|
|
+ $(document.body).addClass('modal-open');
|
|
|
+ });
|
|
|
+
|
|
|
+ // 添加审批流程按钮逻辑
|
|
|
+ $('body').on('click', '#admin-edit-shenpi .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') {
|
|
|
+ $(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')
|
|
|
+ })
|
|
|
+ }
|
|
|
+ return false
|
|
|
+ })
|
|
|
+
|
|
|
+ // 管理员更改审批流程js部分
|
|
|
+ let timer2 = null;
|
|
|
+ let oldSearchVal2 = null;
|
|
|
+ $('body').on('input propertychange', '#admin-edit-shenpi .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.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 => {
|
|
|
+ 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);
|
|
|
+ });
|
|
|
+
|
|
|
+ $('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, { uid: id });
|
|
|
+ if (auditorIndex !== -1) {
|
|
|
+ toastr.warning('该审核人已存在,请勿重复添加');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const order = parseInt($(this).parents('tr').find('.shenpi-order').text());
|
|
|
+ const curAuditorIndex = _.findIndex(auditorList, { uid: this_aid });
|
|
|
+ const prop = {
|
|
|
+ operate: this_operate,
|
|
|
+ old_aid: this_aid,
|
|
|
+ new_aid: user.id,
|
|
|
+ };
|
|
|
+ postData(window.location.pathname + '/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, { uid: user.id, company: user.company, name: user.name, role: user.role });
|
|
|
+ updateOrder(user.id);
|
|
|
+ } else if (this_operate === 'change') {
|
|
|
+ const this_user = _.find(auditorList, { uid: this_aid });
|
|
|
+ this_user.uid = 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);
|
|
|
+ }
|
|
|
+ changeLiucheng(datas);
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ // 移除审批人
|
|
|
+ $('body').on('click', '#admin-edit-shenpi .remove-audit', function () {
|
|
|
+ const id = parseInt($(this).attr('data-id'));
|
|
|
+ const prop = {
|
|
|
+ operate: 'del',
|
|
|
+ old_aid: id,
|
|
|
+ };
|
|
|
+ postData(window.location.pathname + '/audit/save', prop, (datas) => {
|
|
|
+ updateOrder(id, 0);
|
|
|
+ const curAuditorIndex = _.findIndex(auditorList, { uid: id });
|
|
|
+ auditorList.splice(curAuditorIndex, 1);
|
|
|
+ $(this).parents('tr').remove();
|
|
|
+ changeLiucheng(datas);
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ // 比uid大的序号进行调整
|
|
|
+ function updateOrder(uid, num = 1) {
|
|
|
+ const index = _.findIndex(auditorList, { uid });
|
|
|
+ for (let i = index;i < auditorList.length; i++) {
|
|
|
+ $('#admin-edit-shenpi tbody').children('tr').eq(i).find('.shenpi-order').text(i+num);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ function changeLiucheng(datas) {
|
|
|
+ const auditorshtml = [];
|
|
|
+ let lastAuditorHtml = '';
|
|
|
+ for (const [index,data] of datas.entries()) {
|
|
|
+ auditorshtml.push('<li class="list-group-item" data-auditorid="' + data.uid + '">');
|
|
|
+ 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.jobs + '</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>');
|
|
|
+ if (data.status === 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.jobs}</p>\n` +
|
|
|
+ ' </div>\n' +
|
|
|
+ ' </div>\n' +
|
|
|
+ ' </div>\n' +
|
|
|
+ ' </div>\n' +
|
|
|
+ ' </li>';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $('.last-auditor-list .is_uncheck').remove();
|
|
|
+ $('.last-auditor-list').append(lastAuditorHtml);
|
|
|
+ $('.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 += '<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;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ </script>
|
|
|
+<% } %>
|