|
@@ -0,0 +1,929 @@
|
|
|
+let auditUtils;
|
|
|
+$(function () {
|
|
|
+ autoFlashHeight();
|
|
|
+
|
|
|
+ $('#tid_select').change(function () {
|
|
|
+ const tid = parseInt($(this).val()) || 0;
|
|
|
+ setSelectValue('tid', tid);
|
|
|
+ });
|
|
|
+
|
|
|
+ $('#status_select .to-log-link').click(function () {
|
|
|
+ const status = parseInt($(this).data('val')) || null;
|
|
|
+ setSelectValue('status', status);
|
|
|
+ });
|
|
|
+
|
|
|
+ $('#used_select .to-log-link').click(function () {
|
|
|
+ const used = $(this).data('val') || null;
|
|
|
+ setSelectValue('used', used);
|
|
|
+ });
|
|
|
+
|
|
|
+ function setSelectValue(select, value) {
|
|
|
+ const routes = [];
|
|
|
+ const tid = select === 'tid' ? value : $('#tid_select').val();
|
|
|
+ if (tid) {
|
|
|
+ routes.push('tid=' + tid);
|
|
|
+ }
|
|
|
+ const status = select === 'status' ? value : $('#status_selected').data('value');
|
|
|
+ if (status) {
|
|
|
+ routes.push('status=' + status);
|
|
|
+ }
|
|
|
+ const used = select === 'used' ? value : $('#used_selected').data('value');
|
|
|
+ if (used) {
|
|
|
+ routes.push('used=' + used);
|
|
|
+ }
|
|
|
+ window.location.href = '/financial/' + spid + '/pay' + (routes.length ? '?' + routes.join('&') : '');
|
|
|
+ }
|
|
|
+
|
|
|
+ let timer = null
|
|
|
+ let oldSearchVal = null
|
|
|
+ $('#liucheng').on('input propertychange', '.gr-search', function(e) {
|
|
|
+ oldSearchVal = e.target.value;
|
|
|
+ timer && clearTimeout(timer);
|
|
|
+ timer = setTimeout(() => {
|
|
|
+ const newVal = $(this).val();
|
|
|
+ const code = $(this).attr('data-code');
|
|
|
+ let html = '';
|
|
|
+ if (newVal && newVal === oldSearchVal) {
|
|
|
+ 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);
|
|
|
+ });
|
|
|
+
|
|
|
+ $('#liucheng').on('show.bs.modal', function (e) {
|
|
|
+ $('#shenpi-tender-list tr').removeClass('bg-warning');
|
|
|
+ if (tenders.length > 0) {
|
|
|
+ $('#shenpi-tender-list tr').eq(0).addClass('bg-warning');
|
|
|
+ auditUtils. makeReportListHtml(tenders[0]);
|
|
|
+ auditUtils.makeShenpiListHtml(tenders[0]);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ $('#shenpi-tender-list').on('click', '.change-tender', function () {
|
|
|
+ if ($(this).hasClass('bg-warning')) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ $('#shenpi-tender-list tr').removeClass('bg-warning');
|
|
|
+ $(this).parents('tr').addClass('bg-warning');
|
|
|
+ const tid = parseInt($(this).parents('tr').data('tid')) || 0;
|
|
|
+ const tender = tenders.find(t => t.id === tid);
|
|
|
+ if (!tender) {
|
|
|
+ toastr.error('请选择标段');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ auditUtils.makeReportListHtml(tender);
|
|
|
+ auditUtils.makeShenpiListHtml(tender);
|
|
|
+ });
|
|
|
+ auditUtils = {
|
|
|
+ makeReportListHtml: function (flow) {
|
|
|
+ let addHtml = '';
|
|
|
+ $('#select-all-ptAudits').prop('checked', false);
|
|
|
+ for (const pl of flow.permissionList) {
|
|
|
+ addHtml += `<tr>
|
|
|
+ <td class="text-center"><input type="checkbox" class="select-ptAudit" data-id="${pl.id}"></td><td>${pl.name}</td><td>${pl.company}</td>
|
|
|
+ <td class="text-center"><input type="checkbox" class="save-report" data-id="${pl.id}" ${pl.is_report ? 'checked' : ''}></td><td class="text-center"><a href="javascript:void(0);" class="text-danger remove-audit" data-id="${pl.id}">移除</a></td>
|
|
|
+ </tr>`;
|
|
|
+ }
|
|
|
+ $('#report-list').html(addHtml);
|
|
|
+ },
|
|
|
+ makeShenpiListHtml: function (flow) {
|
|
|
+ let addhtml = '<ul class="list-unstyled">\n';
|
|
|
+ addhtml += this.getgdsplHtml(flow, 'financial');
|
|
|
+ addhtml += '</ul>\n';
|
|
|
+ $('#shenpi-list').html(addhtml);
|
|
|
+ },
|
|
|
+ getAuditHtml: function(audit, is_report = 0) {
|
|
|
+ return '<span class="d-inline-block"><span class="badge badge-light">'+ audit.name +' <span class="dropdown">\n' +
|
|
|
+ ' <a href="javascript:void(0);" class="btn-sm text-danger px-1" title="移除" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fa fa-remove"></i></a>\n' +
|
|
|
+ ' <div class="dropdown-menu">\n' +
|
|
|
+ ' <a class="dropdown-item" href="javascript:void(0);">确认移除' + ( is_report ? '填报人' : '审批人') + '?</a>\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="' + (is_report ? audit.id : audit.audit_id) + '">移除</button>\n' +
|
|
|
+ ' <button class="btn btn-sm btn-secondary">取消</button>\n' +
|
|
|
+ ' </div>\n' +
|
|
|
+ ' </div>\n' +
|
|
|
+ ' </span> ' +
|
|
|
+ ' </span></span>\n'
|
|
|
+ },
|
|
|
+ getAuditTypeHtml: function(code, type) {
|
|
|
+ const html = [];
|
|
|
+ html.push(`<span class="d-inline-block"><select class="form-control form-control-sm audit-type-key" data-type="${type}">`);
|
|
|
+ for (const t of auditType.types) {
|
|
|
+ if (t.valid && t.valid.indexOf(code) < 0) continue;
|
|
|
+ html.push(`<option value="${t.value}" ${t.value === type ? 'selected' : ''}>${t.name}</option>`);
|
|
|
+ }
|
|
|
+ html.push('</select></span> ');
|
|
|
+ return html.join('');
|
|
|
+ },
|
|
|
+ getSelectAuditHtml: function (code, is_report = 0) {
|
|
|
+ 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';
|
|
|
+ }
|
|
|
+ });
|
|
|
+ const html =
|
|
|
+ ' <span class="d-inline-block">\n' +
|
|
|
+ ' <div class="dropdown text-right">\n' +
|
|
|
+ ' <button class="btn btn-outline-primary btn-sm dropdown-toggle" type="button" id="' + code + '_dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">\n' +
|
|
|
+ ' ' + (is_report ? '添加填报人' : '选择审批人') + '\n' +
|
|
|
+ ' </button>\n' +
|
|
|
+ ' <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">\n' + divhtml +
|
|
|
+ ' </dl>\n' +
|
|
|
+ ' </div>\n' +
|
|
|
+ ' </div>\n' +
|
|
|
+ ' </span>\n';
|
|
|
+ return html;
|
|
|
+ },
|
|
|
+ // 以下i从1开始
|
|
|
+ getAuditGroupInnerHtml: function(code, auditGroup, i) {
|
|
|
+ const html = [];
|
|
|
+ const type = auditGroup.length > 0 ? auditGroup[0].audit_type : auditType.key.common;
|
|
|
+ html.push(`<span class="col-auto">${transFormToChinese(i)}审</span><span class="col-10 spr-span">`);
|
|
|
+ html.push(this.getAuditTypeHtml(code, type));
|
|
|
+ for (const audit of auditGroup) {
|
|
|
+ html.push(this.getAuditHtml(audit));
|
|
|
+ }
|
|
|
+ if (type !== auditType.key.common || auditGroup.length === 0) {
|
|
|
+ html.push(this.getSelectAuditHtml(code));
|
|
|
+ }
|
|
|
+ if (type === auditType.key.union && auditGroup.length > 0) {
|
|
|
+ html.push(`<button class="btn btn-sm btn-outline-primary" sp_type="${code}" audit_order="${i}" name="union-set">协同设置</button>`);
|
|
|
+ }
|
|
|
+ html.push('</span>');
|
|
|
+ return html.join('');
|
|
|
+ },
|
|
|
+ getAuditGroupHtml: function (code, auditGroup, i) {
|
|
|
+ return `<li class="d-flex justify-content-start align-items-center mb-3">${this.getAuditGroupInnerHtml(code, auditGroup, i)}</li>`;
|
|
|
+ },
|
|
|
+ getgdsplHtml(flow, this_code) {
|
|
|
+ let addhtml = '';
|
|
|
+ if (flow.auditGroupList.length !== 0) {
|
|
|
+ for(const [i, auditGroup] of flow.auditGroupList.entries()) {
|
|
|
+ addhtml += this.getAuditGroupHtml(this_code, auditGroup, i + 1);
|
|
|
+ }
|
|
|
+ const addGroupHtml = this_code === 'change' && (!flow.groupList || (flow.groupList && flow.groupList.length === 0)) ?
|
|
|
+ `<span class="pl-3"><a href="javascript:void(0);" class="show-spzsave" data-code="${this_code}"><i class="fa fa-save"></i> 存为审批组</a></span>\n` : '';
|
|
|
+ addhtml += '<li>\n' +
|
|
|
+ ' <span class="pl-3"><a href="javascript:void(0);" class="add-audit" ><i class="fa fa-plus"></i> 添加流程</a></span>\n' + addGroupHtml +
|
|
|
+ ' </li>';
|
|
|
+ } else {
|
|
|
+ addhtml += this.getAuditGroupHtml(this_code, [], 1);
|
|
|
+ }
|
|
|
+ return addhtml;
|
|
|
+ },
|
|
|
+ // 以下i从0开始
|
|
|
+ addAudit: function (tender, user, i) {
|
|
|
+ const flow = tender;
|
|
|
+ if (!flow.auditGroupList) flow.auditGroupList = [];
|
|
|
+ if (!flow.auditGroupList[i]) flow.auditGroupList[i] = [];
|
|
|
+ flow.auditGroupList[i].push(user);
|
|
|
+ return flow.auditGroupList[i];
|
|
|
+ },
|
|
|
+ removeAudit: function (tender, audit_id, i) {
|
|
|
+ const flow = tender;
|
|
|
+ if (flow.auditGroupList[i].length === 1) {
|
|
|
+ flow.auditGroupList.splice(i, 1);
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ flow.auditGroupList[i].splice(flow.auditGroupList[i].findIndex(x => { return x.audit_id === audit_id; }), 1);
|
|
|
+ return flow.auditGroupList[i];
|
|
|
+ },
|
|
|
+ setAuditType: function (tender, audit_type, i) {
|
|
|
+ const flow = tender;
|
|
|
+ if (!flow || !flow.auditGroupList || !flow.auditGroupList[i]) return;
|
|
|
+ flow.auditGroupList[i].forEach(x => { x.audit_type = audit_type});
|
|
|
+ return flow.auditGroupList[i];
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ // 选中填报人
|
|
|
+ $('body').on('click', 'div[id="report_audit_dropdownMenu"] dl dd', function () {
|
|
|
+ const tid = parseInt($('#shenpi-tender-list tr.bg-warning').data('tid'));
|
|
|
+ const tender = tenders.find(t => t.id === tid);
|
|
|
+ if (!tender) {
|
|
|
+ toastr.error('请选择标段');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const id = parseInt($(this).data('id'));
|
|
|
+ if (!id) return;
|
|
|
+ if (!isNaN(id) && id !== 0) {
|
|
|
+ postData('/financial/'+ spid + '/pay/save', {type: 'add-tender-audit', id: id, tid: tender.id }, function (result) {
|
|
|
+ tender.permissionList = result;
|
|
|
+ auditUtils.makeReportListHtml(tender);
|
|
|
+ })
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ // 移除填报人
|
|
|
+ $('body').on('click', '#report-list .remove-audit', function () {
|
|
|
+ const tid = parseInt($('#shenpi-tender-list tr.bg-warning').data('tid'));
|
|
|
+ const tender = tenders.find(t => t.id === tid);
|
|
|
+ if (!tender) {
|
|
|
+ toastr.error('请选择标段');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const id = parseInt($(this).data('id'));
|
|
|
+ deleteAfterHint(function () {
|
|
|
+ postData('/financial/'+ spid + '/pay/save', {type: 'del-tender-audit', id, tid: tender.id }, function (result) {
|
|
|
+ tender.permissionList = result.permissionList;
|
|
|
+ tender.auditGroupList = result.auditGroupList;
|
|
|
+ auditUtils.makeReportListHtml(tender);
|
|
|
+ auditUtils.makeShenpiListHtml(tender);
|
|
|
+ });
|
|
|
+ }, '确认删除该标段用户?');
|
|
|
+ });
|
|
|
+
|
|
|
+ // 勾选是否为填报人
|
|
|
+ $('body').on('click', '#report-list .save-report', function () {
|
|
|
+ const tid = parseInt($('#shenpi-tender-list tr.bg-warning').data('tid'));
|
|
|
+ const tender = tenders.find(t => t.id === tid);
|
|
|
+ if (!tender) {
|
|
|
+ toastr.error('请选择标段');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const id = parseInt($(this).data('id'));
|
|
|
+ const isReport = $(this).prop('checked');
|
|
|
+ const permission = tender.permissionList.find(p => p.id === id);
|
|
|
+ if (!permission) {
|
|
|
+ toastr.error('该用户不存在');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ postData('/financial/'+ spid + '/pay/save', {type: 'save-permission', updateData: { id, is_report: isReport } }, function (result) {
|
|
|
+ permission.is_report = isReport;
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ $('#select-all-ptAudits').click(function () {
|
|
|
+ $('#report-list .select-ptAudit').prop('checked', $(this).prop('checked'));
|
|
|
+ });
|
|
|
+
|
|
|
+ $('#batch-del-ptAudit').click(function () {
|
|
|
+ const tid = parseInt($('#shenpi-tender-list tr.bg-warning').data('tid'));
|
|
|
+ const tender = tenders.find(t => t.id === tid);
|
|
|
+ if (!tender) {
|
|
|
+ toastr.error('请选择标段');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const ids = [];
|
|
|
+ $('#report-list .select-ptAudit:checked').each(function () {
|
|
|
+ ids.push(parseInt($(this).data('id')));
|
|
|
+ });
|
|
|
+ if (ids.length === 0) {
|
|
|
+ toastr.warning('请勾选要删除的用户');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ deleteAfterHint(function () {
|
|
|
+ postData('/financial/'+ spid + '/pay/save', {type: 'del-tender-audit', id: ids, tid: tender.id }, function (result) {
|
|
|
+ tender.permissionList = result.permissionList;
|
|
|
+ tender.auditGroupList = result.auditGroupList;
|
|
|
+ auditUtils.makeReportListHtml(tender);
|
|
|
+ auditUtils.makeShenpiListHtml(tender);
|
|
|
+ });
|
|
|
+ }, '确认删除已勾选的标段用户?');
|
|
|
+ });
|
|
|
+
|
|
|
+ $('#batch-other-ptAudit').click(function () {
|
|
|
+ const cur_tenderid = parseInt($('#shenpi-tender-list tr.bg-warning').data('tid'));
|
|
|
+ const tender = tenders.find(t => t.id === cur_tenderid);
|
|
|
+ if (!tender) {
|
|
|
+ toastr.error('请选择标段');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const ids = [];
|
|
|
+ $('#report-list .select-ptAudit:checked').each(function () {
|
|
|
+ ids.push(parseInt($(this).data('id')));
|
|
|
+ });
|
|
|
+ if (ids.length === 0) {
|
|
|
+ toastr.warning('请勾选要同步的用户');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const num = $('#shenpi-tender-list input:checked').length;
|
|
|
+ if (num === 0 || (num === 1 && parseInt($('#shenpi-tender-list input:checked').eq(0).parents('tr').data('tid')) === cur_tenderid)) {
|
|
|
+ toastr.warning('请选择需要设置审批同步的标段');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const tenderList = [];
|
|
|
+ for (let i = 0; i < num; i++) {
|
|
|
+ const tid = parseInt($('#shenpi-tender-list input:checked').eq(i).parents('tr').data('tid'));
|
|
|
+ if (tid !== cur_tenderid) {
|
|
|
+ tenderList.push(tid);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const data = {
|
|
|
+ type: 'copy-tender-audit',
|
|
|
+ id: ids,
|
|
|
+ this_tid: tender.id,
|
|
|
+ }
|
|
|
+ data.tidList = tenderList.join(',');
|
|
|
+ postData('/financial/'+ spid + '/pay/save', data, function (result) {
|
|
|
+ toastr.success('已同步到其它勾选标段');
|
|
|
+ for (let i = 0; i < num; i++) {
|
|
|
+ const tid = parseInt($('#shenpi-tender-list input:checked').eq(i).parents('tr').data('tid'));
|
|
|
+ if (tid !== cur_tenderid) {
|
|
|
+ const other_tender = tenders.find(t => t.id === tid);
|
|
|
+ const permissionList = _.filter(result.otherPermissionList, { tid: tid });
|
|
|
+ other_tender.permissionList = permissionList;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ // 选中审批人
|
|
|
+ $('body').on('click', '#shenpi-list div[id$="_dropdownMenu"] dl dd', function () {
|
|
|
+ const tid = parseInt($('#shenpi-tender-list tr.bg-warning').data('tid'));
|
|
|
+ const tender = tenders.find(t => t.id === tid);
|
|
|
+ if (!tender) {
|
|
|
+ toastr.error('请选择标段');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const id = parseInt($(this).data('id'));
|
|
|
+ if (!id) return;
|
|
|
+
|
|
|
+ let this_code = 'financial';
|
|
|
+ const user = _.find(accountList, function (item) {
|
|
|
+ return item.id === id;
|
|
|
+ });
|
|
|
+ // 判断是否已存在审批人
|
|
|
+ const aid_num = $(this).parents('ul').find('.remove-audit').length;
|
|
|
+ for (let i = 0; i < aid_num; i++) {
|
|
|
+ const aid = parseInt($(this).parents('ul').find('.remove-audit').eq(i).data('id'));
|
|
|
+ if (aid === id) {
|
|
|
+ toastr.warning('该审核人已存在,请勿重复添加');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const prop = {
|
|
|
+ status: sp_status.gdspl,
|
|
|
+ code: sp_type[this_code],
|
|
|
+ audit_id: id,
|
|
|
+ type: 'add',
|
|
|
+ audit_type: parseInt($(this).parents('li').find('select[class*="audit-type-key"]')[0].value),
|
|
|
+ audit_order: $(this).parents('li').index() + 1,
|
|
|
+ };
|
|
|
+ const _self = $(this);
|
|
|
+ postData('/financial/' + spid + '/pay/save', { type: 'add-shenpi-audit', shenpi: prop, tid }, function (result) {
|
|
|
+ const data = result.shenpi;
|
|
|
+ const auditGroup = auditUtils.addAudit(tender, { audit_id: data.audit_id, name: user.name, audit_type: data.audit_type, audit_order: data.audit_order }, prop.audit_order - 1);
|
|
|
+ if (_self.parents('ul').find('.add-audit').length === 0) {
|
|
|
+ _self.parents('ul').append('<li>\n' +
|
|
|
+ ' <span class="pl-3"><a href="javascript:void(0);" class="add-audit" ><i class="fa fa-plus"></i> 添加流程</a></span>\n' +
|
|
|
+ ' </li>');
|
|
|
+ }
|
|
|
+ _self.parents('li').html(auditUtils.getAuditGroupInnerHtml(this_code, auditGroup, prop.audit_order));
|
|
|
+ tender.permissionList = result.permissionList;
|
|
|
+ auditUtils.makeReportListHtml(tender);
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ // 移除审批人
|
|
|
+ $('body').on('click', '#shenpi-list .remove-audit', function () {
|
|
|
+ const tid = parseInt($('#shenpi-tender-list tr.bg-warning').data('tid'));
|
|
|
+ const tender = tenders.find(t => t.id === tid);
|
|
|
+ if (!tender) {
|
|
|
+ toastr.error('请选择标段');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const id = parseInt($(this).data('id'));
|
|
|
+ const this_code = 'financial';
|
|
|
+ const prop = {
|
|
|
+ status: sp_status.gdspl,
|
|
|
+ code: sp_type[this_code],
|
|
|
+ audit_id: id,
|
|
|
+ type: 'del',
|
|
|
+ };
|
|
|
+ const _self = $(this);
|
|
|
+ postData('/tender/' + tid + '/shenpi/audit/save', prop, function (data) {
|
|
|
+ const index = _self.parents('li').index();
|
|
|
+ const auditGroup = auditUtils.removeAudit(tender, id, index);
|
|
|
+ if (auditGroup) {
|
|
|
+ _self.parents('li').html(auditUtils.getAuditGroupInnerHtml(this_code, auditGroup, index + 1));
|
|
|
+ } else {
|
|
|
+ const _selflc = _self.parents('#shenpi-list');
|
|
|
+ _self.parents('li').remove();
|
|
|
+ const aid_num = parseInt(_selflc.children('ul').find('li.d-flex').length);
|
|
|
+ if (aid_num === 0) {
|
|
|
+ _selflc.children('ul').html(auditUtils.getAuditGroupHtml(this_code, [], 1));
|
|
|
+ } else {
|
|
|
+ for (let i = 0; i < aid_num; i++) {
|
|
|
+ _selflc.find('li.d-flex').eq(i).find('.col-auto').text(transFormToChinese(i+1) + '审');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ });
|
|
|
+
|
|
|
+ $('body').on('click', '#shenpi-list .add-audit', function () {
|
|
|
+ const num = $(this).parents('ul').children('li').length;
|
|
|
+ const this_code = 'financial';
|
|
|
+ const addhtml = auditUtils.getAuditGroupHtml(this_code, [], num);
|
|
|
+ $(this).parents('ul').append(addhtml);
|
|
|
+ $(this).parents('li').remove();
|
|
|
+ });
|
|
|
+
|
|
|
+ // 设置会签、或签
|
|
|
+ $('body').on('change', 'select[class*="audit-type-key"]', function() {
|
|
|
+ const tid = parseInt($('#shenpi-tender-list tr.bg-warning').data('tid'));
|
|
|
+ const tender = tenders.find(t => t.id === tid);
|
|
|
+ if (!tender) {
|
|
|
+ toastr.error('请选择标段');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const removes = $(this).parents('.d-flex').find('.remove-audit');
|
|
|
+ if (removes.length === 0) return;
|
|
|
+
|
|
|
+ const this_status = sp_status.gdspl;
|
|
|
+ const this_code = 'financial';
|
|
|
+ const ids = [];
|
|
|
+ const liParent = $(this).parents('li');
|
|
|
+ removes.each((i, r) => { ids.push(parseInt(r.getAttribute('data-id'))); });
|
|
|
+ const prop = {
|
|
|
+ status: this_status,
|
|
|
+ code: sp_type[this_code],
|
|
|
+ audit_id: ids,
|
|
|
+ audit_type: parseInt(this.value),
|
|
|
+ type: 'audit-type',
|
|
|
+ };
|
|
|
+ if (prop.audit_type === auditType.key.common && ids.length > 1) {
|
|
|
+ toastr.warning('设置个人审批前请先删除多余的审批人');
|
|
|
+ this.value = this.getAttribute('data-type');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const _self = this;
|
|
|
+ postData('/tender/'+ tid +'/shenpi/audit/save', prop, function () {
|
|
|
+ _self.setAttribute('data-type', _self.value);
|
|
|
+ const auditGroup = auditUtils.setAuditType(tender, prop.audit_type, liParent.index());
|
|
|
+ liParent.html(auditUtils.getAuditGroupInnerHtml(this_code, auditGroup, liParent.index() + 1));
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ $('#set-other-tenders').on('click', function () {
|
|
|
+ const cur_tenderid = parseInt($('#shenpi-tender-list tr.bg-warning').data('tid'));
|
|
|
+ const tender = tenders.find(t => t.id === cur_tenderid);
|
|
|
+ if (!tender) {
|
|
|
+ toastr.error('请选择标段');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (tender.auditGroupList.length === 0) {
|
|
|
+ toastr.warning('请先设置审批流程再同步到其它标段');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const this_code = 'financial';
|
|
|
+ const num = $('#shenpi-tender-list input:checked').length;
|
|
|
+ if (num === 0 || (num === 1 && parseInt($('#shenpi-tender-list input:checked').eq(0).parents('tr').data('tid')) === cur_tenderid)) {
|
|
|
+ toastr.warning('请选择需要设置审批同步的标段');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const data = {
|
|
|
+ type: 'copy-shenpi-audit',
|
|
|
+ status: sp_status.gdspl,
|
|
|
+ code: this_code,
|
|
|
+ this_tid: cur_tenderid,
|
|
|
+ };
|
|
|
+ // 二维数组变一维
|
|
|
+ data.auditList = [];
|
|
|
+ for (const auditGroup of tender.auditGroupList) {
|
|
|
+ data.auditList.push(...auditGroup);
|
|
|
+ }
|
|
|
+ const tenderList = [];
|
|
|
+ for (let i = 0; i < num; i++) {
|
|
|
+ const tid = parseInt($('#shenpi-tender-list input:checked').eq(i).parents('tr').data('tid'));
|
|
|
+ if (tid !== cur_tenderid) {
|
|
|
+ tenderList.push(tid);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ data.tidList = tenderList.join(',');
|
|
|
+ console.log(data);
|
|
|
+ postData('/financial/' + spid + '/pay/save', data, function (result) {
|
|
|
+ toastr.success('已同步到其它勾选标段');
|
|
|
+ for (let i = 0; i < num; i++) {
|
|
|
+ const tid = parseInt($('#shenpi-tender-list input:checked').eq(i).parents('tr').data('tid'));
|
|
|
+ if (tid !== cur_tenderid) {
|
|
|
+ const other_tender = tenders.find(t => t.id === tid);
|
|
|
+ other_tender.auditGroupList = tender.auditGroupList;
|
|
|
+ const permissionList = _.filter(result.otherPermissionList, { tid: tid });
|
|
|
+ other_tender.permissionList = permissionList;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ // 添加到成员中
|
|
|
+ $('body').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') {
|
|
|
+ $(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
|
|
|
+ });
|
|
|
+
|
|
|
+ $('#add-pay').on('show.bs.modal', function () {
|
|
|
+ let t = null;
|
|
|
+ if (tenders.length > 0) {
|
|
|
+ if (is_admin) {
|
|
|
+ t = tenders[0];
|
|
|
+ } else {
|
|
|
+ const filterTender = tenders.filter(t => _.includes(fptAuditTids, t.id));
|
|
|
+ if (filterTender.length > 0) {
|
|
|
+ t = filterTender[0];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $('#add-pay-tender').val(t ? t.id : '');
|
|
|
+ changeTender(t);
|
|
|
+ });
|
|
|
+
|
|
|
+ $('#add-pay-tender').on('change', function () {
|
|
|
+ const tender = tenders.find(t => t.id === parseInt($(this).val()));
|
|
|
+ changeTender(tender);
|
|
|
+ });
|
|
|
+
|
|
|
+ $('#add-pay-btn').on('click', function () {
|
|
|
+ const tid = $('#add-pay-tender').val();
|
|
|
+ const tender = tenders.find(t => t.id === parseInt(tid));
|
|
|
+ if (!tender) {
|
|
|
+ toastr.error('请选择支付标段');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const code = $('#add-pay-code').val();
|
|
|
+ if (!code) {
|
|
|
+ toastr.error('请先去标段属性,填写合同编号');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const prop = {
|
|
|
+ tid: tender.id,
|
|
|
+ code: code,
|
|
|
+ used: $('#add-pay-used').val(),
|
|
|
+ };
|
|
|
+ postData('/financial/'+ spid + '/pay/save', { type: 'add-pay', updateData: prop }, function (result) {
|
|
|
+ window.location.href = '/financial/' + spid + '/pay/' + result.id + '/detail';
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ $('body').on('click', '#pay-list .del-pay-btn', function () {
|
|
|
+ const fpid = $(this).data('id');
|
|
|
+ deleteAfterHint(function () {
|
|
|
+ postData('/financial/'+ spid + '/pay/save', {type: 'del-pay', postData: { node: fpid }}, function (result) {
|
|
|
+ window.location.reload();
|
|
|
+ })
|
|
|
+ }, '确认删除该资金支付?');
|
|
|
+ });
|
|
|
+
|
|
|
+ $('#pay-list tr').on('click', function () {
|
|
|
+ const tid = parseInt($(this).data('tid'));
|
|
|
+ const tender = tenders.find(t => t.id === tid);
|
|
|
+ if (tid && tender) {
|
|
|
+ $(this).siblings().removeClass('alert-warning');
|
|
|
+ $(this).addClass('alert-warning');
|
|
|
+ $('#show-pay-account').show();
|
|
|
+ $('#payaccount input[name="tid"]').val(tender.id);
|
|
|
+ } else {
|
|
|
+ $(this).siblings().removeClass('alert-warning');
|
|
|
+ $('#show-pay-account').hide();
|
|
|
+ $('#payaccount input[name="tid"]').val('');
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ $('#payaccount').on('show.bs.modal', function () {
|
|
|
+ const tid = parseInt($('#payaccount input[name="tid"]').val());
|
|
|
+ const tender = tenders.find(t => t.id === tid);
|
|
|
+ $('#payaccount .modal-title').text('付款账号()');
|
|
|
+ $('#payaccount input[name="name"]').val('');
|
|
|
+ $('#payaccount input[name="bank"]').val('');
|
|
|
+ $('#payaccount input[name="bank_account"]').val('');
|
|
|
+ $('#payaccount input[name="contact"]').val('');
|
|
|
+ $('#payaccount input[name="phone"]').val('');
|
|
|
+ if (tid && tender) {
|
|
|
+ $('#payaccount .modal-title').text('付款账号(' + tender.name + ')');
|
|
|
+ $('#payaccount input[name="name"]').val(tender.pt.name);
|
|
|
+ $('#payaccount input[name="bank"]').val(tender.pt.bank);
|
|
|
+ $('#payaccount input[name="bank_account"]').val(tender.pt.bank_account);
|
|
|
+ $('#payaccount input[name="contact"]').val(tender.pt.contact);
|
|
|
+ $('#payaccount input[name="phone"]').val(tender.pt.phone);
|
|
|
+ if (is_admin || (fptAuditTids && _.includes(fptAuditTids, tid))) {
|
|
|
+ $('#payaccount table input').attr('readonly', false);
|
|
|
+ $('#get-form-tender').show();
|
|
|
+ $('#set-pay-btn').show();
|
|
|
+ $('#payaccount input[name="id"]').val(tender.pt.id);
|
|
|
+ } else {
|
|
|
+ $('#payaccount table input').attr('readonly', true);
|
|
|
+ $('#get-form-tender').hide();
|
|
|
+ $('#set-pay-btn').hide();
|
|
|
+ $('#payaccount input[name="id"]').val('');
|
|
|
+ $('#payaccount input[name="tid"]').val('');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ $('#get-form-tender').on('click', function () {
|
|
|
+ const tid = $('#payaccount input[name="tid"]').val();
|
|
|
+ const tender = tenders.find(t => t.id === parseInt(tid));
|
|
|
+ if (!tid || !tender) {
|
|
|
+ toastr.error('标段不存在');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ $('#payaccount input[name="name"]').val(tender.pay_account.name);
|
|
|
+ $('#payaccount input[name="bank"]').val(tender.pay_account.bank);
|
|
|
+ $('#payaccount input[name="bank_account"]').val(tender.pay_account.account);
|
|
|
+ $('#payaccount input[name="contact"]').val(tender.pay_account.contact);
|
|
|
+ $('#payaccount input[name="phone"]').val(tender.pay_account.phone);
|
|
|
+ toastr.success('已同步');
|
|
|
+ });
|
|
|
+
|
|
|
+ $('#set-pay-btn').on('click', function () {
|
|
|
+ const tid = $('#payaccount input[name="tid"]').val();
|
|
|
+ const tender = tenders.find(t => t.id === parseInt(tid));
|
|
|
+ if (!tid || !tender) {
|
|
|
+ toastr.error('标段不存在');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (is_admin || (fptAuditTids && _.includes(fptAuditTids, tender.id))) {
|
|
|
+ const data = {
|
|
|
+ id: parseInt($('#payaccount input[name="id"]').val()),
|
|
|
+ tid: tender.id,
|
|
|
+ name: $('#payaccount input[name="name"]').val(),
|
|
|
+ bank: $('#payaccount input[name="bank"]').val(),
|
|
|
+ bank_account: $('#payaccount input[name="bank_account"]').val(),
|
|
|
+ contact: $('#payaccount input[name="contact"]').val(),
|
|
|
+ phone: $('#payaccount input[name="phone"]').val(),
|
|
|
+ }
|
|
|
+ if (!data.name) {
|
|
|
+ toastr.error('请填写开户名称');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!data.bank) {
|
|
|
+ toastr.error('请填写开户银行');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!data.bank_account) {
|
|
|
+ toastr.error('请填写开户账号');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ postData('/financial/'+ spid + '/pay/save', { type: 'set-pay-tender', updateData: data }, function (result) {
|
|
|
+ toastr.success('保存成功');
|
|
|
+ tender.pt = result;
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ toastr.error('无权限操作');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ $('#pay-list tr').eq(0).click();
|
|
|
+
|
|
|
+ function changeTender(tender) {
|
|
|
+ $('#add-pay-tender').val(tender ? tender.id : '');
|
|
|
+ if (!tender) {
|
|
|
+ toastr.warning('请先为项目添加标段再申请支付');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (tender.dealCode) {
|
|
|
+ $('#add-pay-code').val(tender.dealCode + '-' + moment().format('YYYYMMDD') + '-' + makeNum(tender.startNum));
|
|
|
+ $('#add-pay-code').siblings('span').text('');
|
|
|
+ } else {
|
|
|
+ $('#add-pay-code').val('');
|
|
|
+ $('#add-pay-code').siblings('span').html('请先去<a href="/tender/' + tender.id + '" target="_blank">标段属性</a>,填写合同编号');
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ function makeNum(num) {
|
|
|
+ let str = num.toString();
|
|
|
+ while (str.length < 3) {
|
|
|
+ str = '0' + str;
|
|
|
+ }
|
|
|
+ return str;
|
|
|
+ }
|
|
|
+
|
|
|
+ $('#audit-list').on('click', 'a', function() {
|
|
|
+ const type = $(this).data('target')
|
|
|
+ const auditCard = $(this).parent().parent()
|
|
|
+ if (type === 'show') {
|
|
|
+ $(this).data('target', 'hide')
|
|
|
+ auditCard.find('.fold-card').slideDown('swing', () => {
|
|
|
+ auditCard.find('#end-target').text($(this).data('idx') + '#')
|
|
|
+ auditCard.find('#fold-btn').text('收起历史审核记录')
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ $(this).data('target', 'show')
|
|
|
+ auditCard.find('.fold-card').slideUp('swing', () => {
|
|
|
+ auditCard.find('#end-target').text('1#')
|
|
|
+ auditCard.find('#fold-btn').text('展开历史审核记录')
|
|
|
+ })
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ // 获取审批流程
|
|
|
+ $('a[data-target="#sp-list" ]').on('click', function () {
|
|
|
+ const data = {
|
|
|
+ type: 'get-auditors',
|
|
|
+ id: $(this).attr('c-id'),
|
|
|
+ };
|
|
|
+ postData('/financial/'+ spid + '/pay/save', data, function (result) {
|
|
|
+ const { auditHistory, auditors2, user } = result;
|
|
|
+ let auditorsHTML = [];
|
|
|
+ auditors2.forEach((group, idx) => {
|
|
|
+ if (idx === 0) {
|
|
|
+ auditorsHTML.push(`<li class="list-group-item d-flex justify-content-between align-items-center">
|
|
|
+ <span class="mr-1"><i class="fa fa fa-play-circle fa-rotate-90"></i></span>
|
|
|
+ <span class="text-muted">${getGroupAuditHtml(group)}</span>
|
|
|
+ <span class="badge badge-light badge-pill ml-auto"><small>原报</small></span>
|
|
|
+ </li>`);
|
|
|
+ } else if(idx === auditors2.length -1 && idx !== 0) {
|
|
|
+ auditorsHTML.push(`<li class="list-group-item d-flex justify-content-between align-items-center">
|
|
|
+ <span class="mr-1"><i class="fa fa fa-stop-circle fa-rotate-90"></i></span>
|
|
|
+ <span class="text-muted">${getGroupAuditHtml(group)}</span>
|
|
|
+ <div class="d-flex ml-auto">
|
|
|
+ ${getAuditTypeHtml(group[0].audit_type)}
|
|
|
+ <span class="badge badge-light badge-pill ml-auto"><small>终审</small></span>
|
|
|
+ </div>
|
|
|
+ </li>`);
|
|
|
+ } else {
|
|
|
+ auditorsHTML.push(`<li class="list-group-item d-flex justify-content-between align-items-center">
|
|
|
+ <span class="mr-1"><i class="fa fa fa-chevron-circle-down"></i></span>
|
|
|
+ <span class="text-muted">${getGroupAuditHtml(group)}</span>
|
|
|
+ <div class="d-flex ml-auto">
|
|
|
+ ${getAuditTypeHtml(group[0].audit_type)}
|
|
|
+ <span class="badge badge-light badge-pill"><small>${transFormToChinese(idx)}审</small></span>
|
|
|
+ </div>
|
|
|
+ </li>`);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ $('#auditor-list').empty();
|
|
|
+ $('#auditor-list').append(auditorsHTML.join(''));
|
|
|
+
|
|
|
+ let historyHTML = [];
|
|
|
+ auditHistory.forEach((his, idx) => {
|
|
|
+ if (idx === auditHistory.length - 1 && auditHistory.length !== 1) {
|
|
|
+ historyHTML.push(`<div class="text-right"><a href="javascript: void(0);" id="fold-btn" data-target="show">展开历史审批流程</a></div>`);
|
|
|
+ }
|
|
|
+ historyHTML.push(`<div class="${idx < auditHistory.length - 1 ? 'fold-card' : ''}">`);
|
|
|
+ historyHTML.push(`<div class="text-center text-muted">${idx+1}#</div>`);
|
|
|
+ historyHTML.push(`<ul class="timeline-list list-unstyled mt-2 ${ idx === auditHistory.length - 1 && auditHistory.length !== 1 ? 'last-auditor-list' : '' }">`);
|
|
|
+ his.forEach((group, index) => {
|
|
|
+ if (index === 0) {
|
|
|
+ historyHTML.push(`<li class="timeline-list-item pb-2">
|
|
|
+ <div class="timeline-item-date">
|
|
|
+ ${group.beginYear}
|
|
|
+ <span>${group.beginDate}</span>
|
|
|
+ <span>${group.beginTime}</span>
|
|
|
+ </div>
|
|
|
+ <div class="timeline-item-tail"></div>
|
|
|
+ <div class="timeline-item-icon bg-success text-light"><i class="fa fa-caret-down"></i></div>
|
|
|
+ <div class="timeline-item-content">
|
|
|
+ <div class="py-1">
|
|
|
+ <span class="text-black-50">原报</span>
|
|
|
+ <span class="pull-right text-success">${idx !== 0 ? '重新' : '' }上报审批</span>
|
|
|
+ </div>
|
|
|
+ <div class="card">
|
|
|
+ <div class="card-body px-3 py-0">
|
|
|
+ <div class="card-text p-2 py-3 row">
|
|
|
+ <div class="col">
|
|
|
+ <span class="h6">${user.name}</span>
|
|
|
+ <span class="text-muted ml-1">${user.role}</span>
|
|
|
+ </div>
|
|
|
+ <div class="col">
|
|
|
+ <span class="pull-right text-success"><i class="fa fa-check-circle"></i></span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </li>`);
|
|
|
+ }
|
|
|
+ historyHTML.push(`<li class="timeline-list-item pb-2 ${ group.status === auditConst.status.uncheck && idx === auditHistory.length - 1 && auditHistory.length !== 1 ? 'is_uncheck' : ''}">`);
|
|
|
+ if (group.endYear) {
|
|
|
+ historyHTML.push(`<div class="timeline-item-date">${group.endYear}<span>${group.endDate}</span><span>${group.endTime}</span></div>`);
|
|
|
+ }
|
|
|
+ if (index < his.length - 1) {
|
|
|
+ historyHTML.push('<div class="timeline-item-tail"></div>');
|
|
|
+ }
|
|
|
+ if (group.status === auditConst.status.checked) {
|
|
|
+ historyHTML.push('<div class="timeline-item-icon bg-success text-light"><i class="fa fa-check"></i></div>');
|
|
|
+ } else if (group.status === auditConst.status.checkNo) {
|
|
|
+ historyHTML.push('<div class="timeline-item-icon bg-warning text-light"><i class="fa fa-level-up"></i></div>');
|
|
|
+ } else if (group.status === auditConst.status.checking) {
|
|
|
+ historyHTML.push('<div class="timeline-item-icon bg-warning text-light"><i class="fa fa-ellipsis-h"></i></div>');
|
|
|
+ } else {
|
|
|
+ historyHTML.push('<div class="timeline-item-icon bg-secondary text-light"></div>');
|
|
|
+ }
|
|
|
+
|
|
|
+ historyHTML.push('<div class="timeline-item-content">');
|
|
|
+ historyHTML.push('<div class="py-1">');
|
|
|
+ const statuStr = group.status !== auditConst.status.uncheck ?
|
|
|
+ `<span class="pull-right ${auditConst.statusClass[group.status]}">${auditConst.statusString[group.status]}</span>` : '';
|
|
|
+ historyHTML.push(`
|
|
|
+ <span class="text-black-50">
|
|
|
+ ${ group.audit_order === 0 ? '原报' : !group.is_final ? group.audit_order + '审' : '终审' } ${getAuditTypeText(group.audit_type)}
|
|
|
+ </span>
|
|
|
+ ${statuStr}`);
|
|
|
+ historyHTML.push('</div>');
|
|
|
+ historyHTML.push('<div class="card"><div class="card-body px-3 py-0">');
|
|
|
+ for (const [i, auditor] of group.auditors.entries()) {
|
|
|
+ historyHTML.push(`<div class="card-text p-2 py-3 row ${ ( i > 0 ? 'border-top' : '') }">`);
|
|
|
+ historyHTML.push(`<div class="col"><span class="h6">${auditor.name}</span><span class="text-muted ml-1">${auditor.role}</span></div>`);
|
|
|
+ historyHTML.push('<div class="col">');
|
|
|
+ if (auditor.status === auditConst.status.checked) {
|
|
|
+ historyHTML.push('<span class="pull-right text-success"><i class="fa fa-check-circle"></i></span>');
|
|
|
+ } else if (auditor.status === auditConst.status.checkNo) {
|
|
|
+ historyHTML.push('<span class="pull-right text-warning"><i class="fa fa-share-square fa-rotate-270"></i></span>');
|
|
|
+ } else if (auditor.status === auditConst.status.checking) {
|
|
|
+ historyHTML.push('<span class="pull-right text-warning"><i class="fa fa-commenting"></i></span>');
|
|
|
+ }
|
|
|
+ historyHTML.push('</div>');
|
|
|
+ if (auditor.opinion) {
|
|
|
+ historyHTML.push(`<div class="col-12 py-1 bg-light"><i class="fa fa-commenting-o mr-1"></i>${auditor.opinion}</div>`);
|
|
|
+ }
|
|
|
+ historyHTML.push('</div>');
|
|
|
+ }
|
|
|
+ historyHTML.push('</div></div>');
|
|
|
+ historyHTML.push('</div>');
|
|
|
+ historyHTML.push('</li>');
|
|
|
+ });
|
|
|
+ historyHTML.push('</div>');
|
|
|
+ historyHTML.push('</ul>');
|
|
|
+ });
|
|
|
+ $('#audit-list').empty();
|
|
|
+ $('#audit-list').append(historyHTML.join(''));
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ $.subMenu({
|
|
|
+ menu: '#sub-menu', miniMenu: '#sub-mini-menu', miniMenuList: '#mini-menu-list',
|
|
|
+ toMenu: '#to-menu', toMiniMenu: '#to-mini-menu',
|
|
|
+ key: 'menu.1.0.0',
|
|
|
+ miniHint: '#sub-mini-hint', hintKey: 'menu.hint.1.0.1',
|
|
|
+ callback: function (info) {
|
|
|
+ if (info.mini) {
|
|
|
+ $('.panel-title').addClass('fluid');
|
|
|
+ $('#sub-menu').removeClass('panel-sidebar');
|
|
|
+ } else {
|
|
|
+ $('.panel-title').removeClass('fluid');
|
|
|
+ $('#sub-menu').addClass('panel-sidebar');
|
|
|
+ }
|
|
|
+ autoFlashHeight();
|
|
|
+ }
|
|
|
+ });
|
|
|
+});
|
|
|
+const getGroupAuditHtml = function (group) {
|
|
|
+ return group.map(u => { return `<small class="d-inline-block text-dark mx-1" title="${u.role}" data-auditorId="${u.aid}">${u.name}</small>`; }).join('');
|
|
|
+};
|
|
|
+
|
|
|
+const getAuditTypeHtml = function (type) {
|
|
|
+ if (type === auditType.key.common) return '';
|
|
|
+ return `<div class="li-subscript"><span class="badge badge-pill badge-${auditType.info[type].class} p-1 badge-bg-small"><small>${auditType.info[type].short}</small></span></div>`;
|
|
|
+};
|
|
|
+
|
|
|
+const getAuditTypeText = function (type) {
|
|
|
+ if (type === auditType.key.common) return '';
|
|
|
+ return `<span class="text-${auditType.info[type].class}">${auditType.info[type].long}</span>`;
|
|
|
+};
|