|
@@ -764,21 +764,32 @@ module.exports = app => {
|
|
|
}
|
|
|
}
|
|
|
const tenders = await ctx.service.tender.getList('', null, 1);
|
|
|
+ const removeTenders = [];
|
|
|
for (const tender of tenders) {
|
|
|
- tender.shenpiInfo = await ctx.service.tenderInfo.getTenderShenpiInfo(tender.id);
|
|
|
- // 获取所有的固定审批流或固定终审
|
|
|
- const shenpiauditList = {};
|
|
|
- for (const shenpi in tender.shenpiInfo) {
|
|
|
- if (tender.shenpiInfo[shenpi] === shenpiConst.sp_status.gdspl) {
|
|
|
- const shenpiList = await ctx.service.shenpiAudit.getAllDataByCondition({ where: { tid: tender.id, sp_type: shenpiConst.sp_type[shenpi], sp_status: tender.shenpiInfo[shenpi] } });
|
|
|
- const shenpiIdList = ctx.helper._.map(shenpiList, 'audit_id');
|
|
|
- shenpiauditList[shenpi] = shenpiIdList.length ? shenpiIdList : null;
|
|
|
- } else if (tender.shenpiInfo[shenpi] === shenpiConst.sp_status.gdzs) {
|
|
|
- const shenpiInfo = await ctx.service.shenpiAudit.getDataByCondition({ tid: tender.id, sp_type: shenpiConst.sp_type[shenpi], sp_status: tender.shenpiInfo[shenpi] });
|
|
|
- shenpiauditList[shenpi] = shenpiInfo && shenpiInfo.audit_id ? [shenpiInfo.audit_id] : null;
|
|
|
+ const shenpiInfo = await ctx.service.tenderInfo.getTenderShenpiInfo(tender.id);
|
|
|
+ if (!shenpiInfo) {
|
|
|
+ removeTenders.push(tender.id);
|
|
|
+ } else {
|
|
|
+ tender.shenpiInfo = shenpiInfo;
|
|
|
+ // 获取所有的固定审批流或固定终审
|
|
|
+ const shenpiauditList = {};
|
|
|
+ for (const shenpi in tender.shenpiInfo) {
|
|
|
+ if (tender.shenpiInfo[shenpi] === shenpiConst.sp_status.gdspl) {
|
|
|
+ const shenpiList = await ctx.service.shenpiAudit.getAllDataByCondition({ where: { tid: tender.id, sp_type: shenpiConst.sp_type[shenpi], sp_status: tender.shenpiInfo[shenpi] } });
|
|
|
+ const shenpiIdList = ctx.helper._.map(shenpiList, 'audit_id');
|
|
|
+ shenpiauditList[shenpi] = shenpiIdList.length ? shenpiIdList : null;
|
|
|
+ } else if (tender.shenpiInfo[shenpi] === shenpiConst.sp_status.gdzs) {
|
|
|
+ const shenpiInfo = await ctx.service.shenpiAudit.getDataByCondition({ tid: tender.id, sp_type: shenpiConst.sp_type[shenpi], sp_status: tender.shenpiInfo[shenpi] });
|
|
|
+ shenpiauditList[shenpi] = shenpiInfo && shenpiInfo.audit_id ? [shenpiInfo.audit_id] : null;
|
|
|
+ }
|
|
|
}
|
|
|
+ tender.shenpiauditList = shenpiauditList;
|
|
|
}
|
|
|
- tender.shenpiauditList = shenpiauditList;
|
|
|
+ }
|
|
|
+ if (removeTenders.length > 0) {
|
|
|
+ ctx.helper._.remove(tenders, function(n) {
|
|
|
+ return removeTenders.indexOf(n.id) !== -1;
|
|
|
+ });
|
|
|
}
|
|
|
const categoryData = await ctx.service.category.getAllCategory(ctx.session.sessionProject.id);
|
|
|
const renderData = {
|