|
@@ -638,10 +638,11 @@ module.exports = app => {
|
|
|
// 1. 审批中的记录(包括首次上报和退回后重新上报)
|
|
// 1. 审批中的记录(包括首次上报和退回后重新上报)
|
|
|
// 2. 被退回需要当前审批人处理的记录
|
|
// 2. 被退回需要当前审批人处理的记录
|
|
|
// 3. 退回后重新上报的记录(status=uncheck AND times>1)
|
|
// 3. 退回后重新上报的记录(status=uncheck AND times>1)
|
|
|
|
|
+ // 4. 合同被退回且当前用户是创建人(需要重新上报)
|
|
|
const sql =
|
|
const sql =
|
|
|
- 'SELECT la.`aid`, la.`times`, la.`order`, la.`begin_time`, la.`end_time`, la.`status` as audit_status, c.`id`, c.`contract_id`, c.`name`, c.`c_code`, c.`uid`, c.`need_shenpi`, c.`spid`, c.`tid`, c.`contract_type`, c.`total_price`, c.`create_time`, c.`exist_pay`, c.`status`, t.`name` as tender_name, t.`project_id`, t.`spid` as tender_spid ' +
|
|
|
|
|
|
|
+ 'SELECT la.`aid`, la.`times`, la.`order`, la.`begin_time`, la.`end_time`, la.`status` as audit_status, c.`id`, c.`contract_id`, c.`name`, c.`c_code`, c.`uid`, c.`need_shenpi`, c.`spid`, c.`tid`, c.`contract_type`, c.`total_price`, c.`create_time`, c.`exist_pay`, c.`status` as contract_status, t.`name` as tender_name, t.`project_id`, t.`spid` as tender_spid ' +
|
|
|
' FROM ?? AS la Left Join ?? AS c ON la.`cid` = c.`id` LEFT JOIN ?? AS t ON c.`tid` = t.`id` ' +
|
|
' FROM ?? AS la Left Join ?? AS c ON la.`cid` = c.`id` LEFT JOIN ?? AS t ON c.`tid` = t.`id` ' +
|
|
|
- ' WHERE ((la.`aid` = ? and (la.`status` = ? OR (la.`status` = ? and la.`times` > 1))) OR (la.`aid` = ? and la.`status` = ? and la.`times` = (SELECT MAX(times) FROM ?? WHERE cid = c.id)))' + spSql +
|
|
|
|
|
|
|
+ ' WHERE ((la.`aid` = ? and (la.`status` = ? OR (la.`status` = ? and la.`times` > 1))) OR (la.`aid` = ? and la.`status` = ? and la.`times` = (SELECT MAX(times) FROM ?? WHERE cid = c.id)) OR (la.`aid` = c.`uid` and c.`status` = ? and la.`times` = c.`times` - 1))' + spSql +
|
|
|
' AND la.cpid IS NULL AND la.csid IS NULL' +
|
|
' AND la.cpid IS NULL AND la.csid IS NULL' +
|
|
|
' AND c.`need_shenpi` = 1' +
|
|
' AND c.`need_shenpi` = 1' +
|
|
|
' AND c.`status` != -3' +
|
|
' AND c.`status` != -3' +
|
|
@@ -656,6 +657,7 @@ module.exports = app => {
|
|
|
auditorId,
|
|
auditorId,
|
|
|
auditConst.status.checkNo, // status = 4 (审批退回)
|
|
auditConst.status.checkNo, // status = 4 (审批退回)
|
|
|
this.tableName,
|
|
this.tableName,
|
|
|
|
|
+ auditConst.status.checkNo, // status = 4 (合同被退回,创建人需要重新上报)
|
|
|
];
|
|
];
|
|
|
|
|
|
|
|
const result = await this.db.query(sql, sqlParam);
|
|
const result = await this.db.query(sql, sqlParam);
|
|
@@ -678,16 +680,8 @@ module.exports = app => {
|
|
|
contract.curAuditorIds = this._.map(contract.curAuditors, 'aid');
|
|
contract.curAuditorIds = this._.map(contract.curAuditors, 'aid');
|
|
|
// 判断是项目合同还是标段合同
|
|
// 判断是项目合同还是标段合同
|
|
|
contract.is_project_contract = !contract.tid || contract.tid === 0;
|
|
contract.is_project_contract = !contract.tid || contract.tid === 0;
|
|
|
- // 根据合同类型设置状态文本
|
|
|
|
|
- if (contract.contract_type === 1) {
|
|
|
|
|
- // 支出合同
|
|
|
|
|
- contract.status_text = contract.exist_pay ? '支付' : '合同';
|
|
|
|
|
- } else if (contract.contract_type === 2) {
|
|
|
|
|
- // 收入合同
|
|
|
|
|
- contract.status_text = contract.exist_pay ? '回款' : '合同';
|
|
|
|
|
- } else {
|
|
|
|
|
- contract.status_text = '合同';
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // 合同级别审批始终显示"合同",支付级别审批由 getAuditContractPay 处理
|
|
|
|
|
+ contract.status_text = '合同';
|
|
|
}
|
|
}
|
|
|
return uniqueResult;
|
|
return uniqueResult;
|
|
|
}
|
|
}
|