|
|
@@ -465,7 +465,7 @@ $(document).ready(function () {
|
|
|
status: this_status
|
|
|
};
|
|
|
const _self = $(this);
|
|
|
- postData('/tender/' + cur_tenderid + '/shenpi/save', prop, function (data) {
|
|
|
+ postTenderApprovalData('/tender/' + cur_tenderid + '/shenpi/save', prop, function (data) {
|
|
|
if (this_status === sp_status.sqspr) {
|
|
|
_self.parents('.form-group').siblings('.lc-show').html('');
|
|
|
} else if (this_status === sp_status.gdspl) {
|
|
|
@@ -537,7 +537,7 @@ $(document).ready(function () {
|
|
|
prop.audit_order = $(this).parents('li').index() + 1;
|
|
|
}
|
|
|
const _self = $(this);
|
|
|
- postData('/tender/' + cur_tenderid + '/shenpi/audit/save', prop, function (data) {
|
|
|
+ postTenderApprovalData('/tender/' + cur_tenderid + '/shenpi/audit/save', prop, function (data) {
|
|
|
if (this_status === sp_status.gdspl) {
|
|
|
const auditGroup = auditUtils.addAudit(this_code, data, prop.audit_order - 1);
|
|
|
if (_self.parents('ul').find('.add-audit').length === 0) {
|
|
|
@@ -580,7 +580,7 @@ $(document).ready(function () {
|
|
|
type: 'del',
|
|
|
};
|
|
|
const _self = $(this);
|
|
|
- postData('/tender/' + cur_tenderid + '/shenpi/audit/save', prop, function (data) {
|
|
|
+ postTenderApprovalData('/tender/' + cur_tenderid + '/shenpi/audit/save', prop, function (data) {
|
|
|
if (this_status === sp_status.gdspl) {
|
|
|
const index = _self.parents('li').index();
|
|
|
const auditGroup = auditUtils.removeAudit(this_code, id, index);
|
|
|
@@ -626,6 +626,11 @@ $(document).ready(function () {
|
|
|
initTenderTree2();
|
|
|
|
|
|
$('body').on('click', '.set-otherTender', function () {
|
|
|
+ if (typeof tenderApprovalEditor !== 'undefined' && tenderApprovalEditor.active && tenderApprovalEditor.active.operations.length) {
|
|
|
+ toastr.warning('请先保存当前修改,再设置其他流程或标段');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
const this_code = $(this).data('code');
|
|
|
const this_status = parseInt($(this).siblings('.lc-show').siblings('.form-group').find('input:checked').val());
|
|
|
const lis = $(this).siblings('.lc-show').find('li');
|
|
|
@@ -638,7 +643,7 @@ $(document).ready(function () {
|
|
|
|
|
|
const select = $(li).find('select[class*="audit-type-key"]');
|
|
|
const audit_type = select.length > 0 ? parseInt(select.val()) : 1;
|
|
|
- const multiData = flow.auditGroupList.find(x => { return x[0].audit_order == i+1; });
|
|
|
+ const multiData = (flow.auditGroupList || []).find(x => { return x[0].audit_order == i+1; }) || [];
|
|
|
for (const remove of removes) {
|
|
|
const auditData = { audit_id: parseInt(remove.getAttribute('data-id')), audit_type, audit_order: i + 1 };
|
|
|
const removeMultiData = multiData.find(x => { return x.audit_id === auditData.audit_id; });
|
|
|
@@ -677,7 +682,7 @@ $(document).ready(function () {
|
|
|
status: parseInt($('#shenpi_status').val()),
|
|
|
code: $('#shenpi_code').val(),
|
|
|
};
|
|
|
- if(data.status !== shenpi_status.gdspl) {
|
|
|
+ if(data.status !== sp_status.gdspl) {
|
|
|
data.auditList = JSON.parse($('#shenpi_auditors').val());
|
|
|
}
|
|
|
// 获取已选中的标段
|
|
|
@@ -689,7 +694,7 @@ $(document).ready(function () {
|
|
|
}
|
|
|
}
|
|
|
data.tidList = tenderList.join(',');
|
|
|
- postData('/tender/' + cur_tenderid + '/shenpi/audit/save', data, function () {
|
|
|
+ postTenderApprovalData('/tender/' + cur_tenderid + '/shenpi/audit/save', data, function () {
|
|
|
toastr.success('设置成功');
|
|
|
setTimeout(function () {
|
|
|
window.location.reload();
|
|
|
@@ -698,6 +703,11 @@ $(document).ready(function () {
|
|
|
});
|
|
|
|
|
|
$('body').on('click', '.set-otherShenpi', function () {
|
|
|
+ if (typeof tenderApprovalEditor !== 'undefined' && tenderApprovalEditor.active && tenderApprovalEditor.active.operations.length) {
|
|
|
+ toastr.warning('请先保存当前修改,再设置其他流程或标段');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
let canSetOther = true;
|
|
|
const this_code = $(this).data('code');
|
|
|
// if (['stage', 'change'].indexOf(this_code) !== -1) {
|
|
|
@@ -748,7 +758,7 @@ $(document).ready(function () {
|
|
|
status: parseInt($('#shenpi_status2').val()),
|
|
|
code: $('#shenpi_code2').val(),
|
|
|
};
|
|
|
- if(data.status !== shenpi_status.gdspl) {
|
|
|
+ if(data.status !== sp_status.gdspl) {
|
|
|
data.flowList = $('#shenpi_auditors2').val();
|
|
|
}
|
|
|
// 获取已选中的标段
|
|
|
@@ -758,7 +768,7 @@ $(document).ready(function () {
|
|
|
shenpiList.push(code);
|
|
|
}
|
|
|
data.shenpiList = shenpiList.join(',');
|
|
|
- postData('/tender/' + cur_tenderid + '/shenpi/audit/save', data, function () {
|
|
|
+ postTenderApprovalData('/tender/' + cur_tenderid + '/shenpi/audit/save', data, function () {
|
|
|
toastr.success('设置成功');
|
|
|
setTimeout(function () {
|
|
|
window.location.reload();
|
|
|
@@ -789,7 +799,7 @@ $(document).ready(function () {
|
|
|
return;
|
|
|
}
|
|
|
const _self = this;
|
|
|
- postData('/tender/'+ cur_tenderid +'/shenpi/audit/save', prop, function () {
|
|
|
+ postTenderApprovalData('/tender/'+ cur_tenderid +'/shenpi/audit/save', prop, function () {
|
|
|
_self.setAttribute('data-type', _self.value);
|
|
|
const auditGroup = auditUtils.setAuditType(this_code, prop.audit_type, liParent.index());
|
|
|
liParent.html(auditUtils.getAuditGroupInnerHtml(this_code, auditGroup, liParent.index() + 1));
|
|
|
@@ -909,7 +919,7 @@ $(document).ready(function () {
|
|
|
this.spread.refresh();
|
|
|
const self = this;
|
|
|
|
|
|
- postData('/tender/' + cur_tenderid + '/shenpi/ass/load', {}, function (data) {
|
|
|
+ postTenderApprovalData('/tender/' + cur_tenderid + '/shenpi/ass/load', {}, function (data) {
|
|
|
self.loaded = true;
|
|
|
self.tid = cur_tenderid;
|
|
|
self.assList = data.auditAssList;
|
|
|
@@ -965,14 +975,14 @@ $(document).ready(function () {
|
|
|
data.update.push({ id: orgAss.id, ass_ledger_id: rela_lid.join(',')});
|
|
|
}
|
|
|
}
|
|
|
- postData('/tender/' + cur_tenderid + '/shenpi/audit/save', data, function (result) {
|
|
|
+ postTenderApprovalData('/tender/' + cur_tenderid + '/shenpi/audit/save', data, function (result) {
|
|
|
self.loadPostData(result);
|
|
|
self.refreshOperate();
|
|
|
});
|
|
|
}
|
|
|
removeAuditAss(assistId) {
|
|
|
const self = this;
|
|
|
- postData('/tender/' + cur_tenderid + '/shenpi/audit/save', { type: 'audit-ass', del: { id: assistId } }, function (result) {
|
|
|
+ postTenderApprovalData('/tender/' + cur_tenderid + '/shenpi/audit/save', { type: 'audit-ass', del: { id: assistId } }, function (result) {
|
|
|
self.loadPostData(result);
|
|
|
self.refreshOperate();
|
|
|
});
|
|
|
@@ -1038,7 +1048,7 @@ $(document).ready(function () {
|
|
|
});
|
|
|
$('#union-ok').click(function() {
|
|
|
const data = self.getUnionAuditLedgerData();
|
|
|
- postData(`/tender/${cur_tenderid}/shenpi/union/save`, data, function(result) {
|
|
|
+ postTenderApprovalData(`/tender/${cur_tenderid}/shenpi/union/save`, data, function(result) {
|
|
|
$('#union').modal('hide');
|
|
|
});
|
|
|
});
|
|
|
@@ -1087,7 +1097,7 @@ $(document).ready(function () {
|
|
|
if (!this.loaded) data.ledger = 1;
|
|
|
|
|
|
const self = this;
|
|
|
- postData(`/tender/${cur_tenderid}/shenpi/union/load`, data, function(result) {
|
|
|
+ postTenderApprovalData(`/tender/${cur_tenderid}/shenpi/union/load`, data, function(result) {
|
|
|
self.loaded = true;
|
|
|
if (result.ledgerList) {
|
|
|
self.tree.loadDatas(result.ledgerList);
|
|
|
@@ -1173,7 +1183,7 @@ $(document).ready(function () {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- postData(`/tender/${cur_tenderid}/shenpi/multi/save`, data, function(result) {
|
|
|
+ postTenderApprovalData(`/tender/${cur_tenderid}/shenpi/multi/save`, data, function(result) {
|
|
|
const flow = sp_lc.find(x => { return x.code === self.sp_type; });
|
|
|
const multiData = flow.auditGroupList.find(x => { return x[0].audit_order == self.audit_order});
|
|
|
for (const d of result) {
|
|
|
@@ -1244,6 +1254,15 @@ $(document).ready(function () {
|
|
|
}
|
|
|
}
|
|
|
const auditMulti = new AuditMulti();
|
|
|
+ $('body').on('tender-approval-edit-open', function () {
|
|
|
+ auditAss.loaded = false;
|
|
|
+ auditAss.assList = [];
|
|
|
+ auditAss.tree.loadDatas([]);
|
|
|
+ SpreadJsObj.loadSheetData(auditAss.sheet, SpreadJsObj.DataType.Tree, auditAss.tree);
|
|
|
+ auditAss.uid = cur_uid;
|
|
|
+ auditAss.refreshOperate();
|
|
|
+ auditUnion.loaded = false;
|
|
|
+ });
|
|
|
$('body').on('click', '[name=multi-set]', function() {
|
|
|
auditMulti.loadData(auditType.key.multi, this.getAttribute('sp_type'), this.getAttribute('audit_order'), this);
|
|
|
});
|
|
|
@@ -1465,7 +1484,7 @@ $(document).ready(function () {
|
|
|
prop.change_type = change_type;
|
|
|
}
|
|
|
console.log(prop);
|
|
|
- postData('/tender/' + cur_tenderid + '/shenpi/audit/save', prop, function (data) {
|
|
|
+ postTenderApprovalData('/tender/' + cur_tenderid + '/shenpi/audit/save', prop, function (data) {
|
|
|
flow.auditGroupList = data.group.auditGroupList || [];
|
|
|
if (groupId) {
|
|
|
const index = flow.groupList.findIndex(x => { return x.id === parseInt(groupId); });
|
|
|
@@ -1497,7 +1516,7 @@ $(document).ready(function () {
|
|
|
type: 'change-group',
|
|
|
groupId,
|
|
|
}
|
|
|
- postData('/tender/' + cur_tenderid + '/shenpi/audit/save', prop, function (data) {
|
|
|
+ postTenderApprovalData('/tender/' + cur_tenderid + '/shenpi/audit/save', prop, function (data) {
|
|
|
flow.groupList.forEach(function (item) {
|
|
|
item.is_select = 0;
|
|
|
});
|
|
|
@@ -1540,7 +1559,7 @@ $(document).ready(function () {
|
|
|
groupId: group.id,
|
|
|
}
|
|
|
console.log(prop);
|
|
|
- postData('/tender/' + cur_tenderid + '/shenpi/audit/save', prop, function (data) {
|
|
|
+ postTenderApprovalData('/tender/' + cur_tenderid + '/shenpi/audit/save', prop, function (data) {
|
|
|
// const flow = findSplc(code);
|
|
|
const index = flow.groupList.findIndex(x => { return x.id === group.id; });
|
|
|
flow.groupList.splice(index, 1);
|
|
|
@@ -1617,3 +1636,68 @@ function makeSelectAudit(code, i = '终') {
|
|
|
' </li>';
|
|
|
return html;
|
|
|
}
|
|
|
+
|
|
|
+function renderTenderApproval(shenpi, tender, revising, target = '#splc') {
|
|
|
+ let html = '';
|
|
|
+ if (shenpi.sp_lc.length > 0) {
|
|
|
+ for (const sp of shenpi.sp_lc) {
|
|
|
+ html += `<div class="card mb-3">
|
|
|
+ <div class="card-body ${sp.code}_div">
|
|
|
+ <a class="pull-right set-otherTender" data-name="${sp.name}" data-code="${sp.code}" href="#batch" data-toggle="modal" data-target="#batch">设置其他标段</a>
|
|
|
+ <a class="pull-right set-otherShenpi mr-3" data-name="${sp.name}" data-code="${sp.code}" href="javascript: void(0);">设置其他流程</a>`;
|
|
|
+ if (sp.code === 'stage' && !revising && tender.ledger_status === auditConst.ledger.status.checked) {
|
|
|
+ html += `<a class="pull-right mr-3" id="stage_cooperation" ${sp.status !== shenpi.sp_status.gdspl ? 'style="display: none"' : '' } data-name="${sp.name}" data-code="${sp.code}" href="#cooperation" data-toggle="modal" data-target="#cooperation">多人协同 <i class="fa fa-lock"></i></a>`;
|
|
|
+ }
|
|
|
+ html += `
|
|
|
+ <h5 class="card-title">${sp.name}</h5>
|
|
|
+ <div class="form-group">
|
|
|
+ <div class="form-group form-check">`;
|
|
|
+ for (const st in shenpi.sp_status_list) {
|
|
|
+ if (shenpi.sp_status_list[st]) {
|
|
|
+ html += `<div class="custom-control custom-checkbox custom-control-inline">
|
|
|
+ <input type="radio" class="custom-control-input" data-code="${sp.code}" value="${shenpi.sp_status_list[st].status}" name="${sp.code}" id="${sp.code}_${shenpi.sp_status_list[st].status}" ${sp.status === shenpi.sp_status_list[st].status ? 'checked' : ''}>
|
|
|
+ <label class="custom-control-label" for="${sp.code}_${shenpi.sp_status_list[st].status}">${shenpi.sp_status_list[st].name}</label>
|
|
|
+ </div>`;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ html += `
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="alert alert-warning">${shenpi.sp_status_list[sp.status].name}:${shenpi.sp_status_list[sp.status].msg}</div>
|
|
|
+ <div class="lc-show">`;
|
|
|
+ if (sp.status === sp_status.sqspr) {
|
|
|
+ html += ``;
|
|
|
+ } else if (sp.status === sp_status.gdspl) {
|
|
|
+ const flow = sp_lc.find(x => { return x.code === sp.code; });
|
|
|
+ flow.auditGroupList = sp.auditGroupList;
|
|
|
+ html += auditUtils.getGroupHtml(flow, sp.code);
|
|
|
+ let addhtml = '<ul class="list-unstyled">\n';
|
|
|
+ addhtml += auditUtils.getgdsplHtml(flow, sp.code);
|
|
|
+ addhtml += '</ul>\n';
|
|
|
+ html += addhtml;
|
|
|
+ } else if (sp.status === sp_status.gdzs) {
|
|
|
+ let addhtml = '<ul class="list-unstyled">\n' +
|
|
|
+ ' <li class="d-flex justify-content-start mb-3">\n' +
|
|
|
+ ' <span class="col-auto">授权审批人</span>\n' +
|
|
|
+ ' <span class="col-7">\n' +
|
|
|
+ ' <span class="d-inline-block"></span>\n' +
|
|
|
+ ' </span>\n' +
|
|
|
+ ' </li>\n';
|
|
|
+ addhtml += sp.audit ? makeAudit(sp.audit) : makeSelectAudit(sp.code);
|
|
|
+ addhtml += '</ul>\n';
|
|
|
+ html += addhtml;
|
|
|
+ }
|
|
|
+ html += ` </div>
|
|
|
+ </div>
|
|
|
+ </div>`;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $(target).html(html);
|
|
|
+}
|
|
|
+
|
|
|
+function postTenderApprovalData(url, data, success, failure, waiting = true, message = '') {
|
|
|
+ if (typeof approvalOnly !== 'undefined' && approvalOnly && typeof tenderApprovalEditor !== 'undefined' && tenderApprovalEditor.active) {
|
|
|
+ return tenderApprovalEditor.request(url, data, success, failure, waiting, message);
|
|
|
+ }
|
|
|
+ return postData(url, data, success, failure, waiting, message);
|
|
|
+}
|