|  | @@ -70,7 +70,7 @@ module.exports = app => {
 | 
	
		
			
				|  |  |           * @param {Number} times - 第几次审批
 | 
	
		
			
				|  |  |           * @return {Boolean} 是否插入成功
 | 
	
		
			
				|  |  |           */
 | 
	
		
			
				|  |  | -        async addAuditor(tid, vid, audit_id, times = 1, is_gdzs = 0) {
 | 
	
		
			
				|  |  | +        async addAuditor(tid, vid, audit_id, times = 1, type, is_gdzs = 0) {
 | 
	
		
			
				|  |  |              const transaction = await this.db.beginTransaction();
 | 
	
		
			
				|  |  |              try {
 | 
	
		
			
				|  |  |                  let newOrder = await this.getNewOrder(vid, times);
 | 
	
	
		
			
				|  | @@ -80,6 +80,7 @@ module.exports = app => {
 | 
	
		
			
				|  |  |                  const record = {
 | 
	
		
			
				|  |  |                      tid,
 | 
	
		
			
				|  |  |                      vid,
 | 
	
		
			
				|  |  | +                    type,
 | 
	
		
			
				|  |  |                      audit_id,
 | 
	
		
			
				|  |  |                      times,
 | 
	
		
			
				|  |  |                      order: newOrder,
 | 
	
	
		
			
				|  | @@ -419,7 +420,7 @@ module.exports = app => {
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        async _checkNoPre(pid, advanceId, checkData, times) {
 | 
	
		
			
				|  |  | +        async _checkNoPre(pid, advanceId, checkData, times, type) {
 | 
	
		
			
				|  |  |              const time = new Date();
 | 
	
		
			
				|  |  |              // 整理当前流程审核人状态更新
 | 
	
		
			
				|  |  |              const audit = await this.getDataByCondition({ vid: advanceId, times, status: auditConst.status.checking });
 | 
	
	
		
			
				|  | @@ -453,6 +454,7 @@ module.exports = app => {
 | 
	
		
			
				|  |  |                  const newAuditors = {
 | 
	
		
			
				|  |  |                      tid: audit.tid,
 | 
	
		
			
				|  |  |                      vid: audit.vid,
 | 
	
		
			
				|  |  | +                    type,
 | 
	
		
			
				|  |  |                      audit_id: preAuditor.audit_id,
 | 
	
		
			
				|  |  |                      times: audit.times,
 | 
	
		
			
				|  |  |                      order: audit.order + 1,
 | 
	
	
		
			
				|  | @@ -463,6 +465,7 @@ module.exports = app => {
 | 
	
		
			
				|  |  |                  const uncheckNewAuditors = {
 | 
	
		
			
				|  |  |                      tid: audit.tid,
 | 
	
		
			
				|  |  |                      vid: audit.vid,
 | 
	
		
			
				|  |  | +                    type,
 | 
	
		
			
				|  |  |                      audit_id: audit.audit_id,
 | 
	
		
			
				|  |  |                      times: audit.times,
 | 
	
		
			
				|  |  |                      order: audit.order + 2,
 | 
	
	
		
			
				|  | @@ -509,7 +512,7 @@ module.exports = app => {
 | 
	
		
			
				|  |  |           * @param {Number} times - 第几次审批
 | 
	
		
			
				|  |  |           * @return {Promise<void>}
 | 
	
		
			
				|  |  |           */
 | 
	
		
			
				|  |  | -        async check(advanceId, checkData, times = 1) {
 | 
	
		
			
				|  |  | +        async check(advanceId, checkData, times = 1, type) {
 | 
	
		
			
				|  |  |              if (checkData.checkType !== auditConst.status.checked && checkData.checkType !== auditConst.status.checkNo && checkData.checkType !== auditConst.status.checkNoPre) {
 | 
	
		
			
				|  |  |                  throw '提交数据错误';
 | 
	
		
			
				|  |  |              }
 | 
	
	
		
			
				|  | @@ -522,7 +525,7 @@ module.exports = app => {
 | 
	
		
			
				|  |  |                      await this._checkNo(pid, advanceId, checkData, times);
 | 
	
		
			
				|  |  |                      break;
 | 
	
		
			
				|  |  |                  case auditConst.status.checkNoPre:
 | 
	
		
			
				|  |  | -                    await this._checkNoPre(pid, advanceId, checkData, times);
 | 
	
		
			
				|  |  | +                    await this._checkNoPre(pid, advanceId, checkData, times, type);
 | 
	
		
			
				|  |  |                      break;
 | 
	
		
			
				|  |  |                  default:
 | 
	
		
			
				|  |  |                      throw '无效审批操作';
 | 
	
	
		
			
				|  | @@ -550,7 +553,7 @@ module.exports = app => {
 | 
	
		
			
				|  |  |                  const checkAgainAuditors = [];
 | 
	
		
			
				|  |  |                  audits.forEach(x => {
 | 
	
		
			
				|  |  |                      checkAgainAuditors.push({
 | 
	
		
			
				|  |  | -                        tid: advance.tid, vid: advance.id, audit_id: x.audit_id, type: x.type,
 | 
	
		
			
				|  |  | +                        tid: advance.tid, vid: advance.id, audit_id: x.audit_id, type: advance.type,
 | 
	
		
			
				|  |  |                          times: x.times, order: maxOrder + 1,
 | 
	
		
			
				|  |  |                          status: auditConst.status.checkAgain,
 | 
	
		
			
				|  |  |                          create_time: time, end_time: time, opinion: '',
 | 
	
	
		
			
				|  | @@ -559,7 +562,7 @@ module.exports = app => {
 | 
	
		
			
				|  |  |                  const checkingAuditors = [];
 | 
	
		
			
				|  |  |                  audits.forEach(x => {
 | 
	
		
			
				|  |  |                      checkingAuditors.push({
 | 
	
		
			
				|  |  | -                        tid: advance.tid, vid: advance.id, audit_id: x.audit_id, type: x.type,
 | 
	
		
			
				|  |  | +                        tid: advance.tid, vid: advance.id, audit_id: x.audit_id, type: advance.type,
 | 
	
		
			
				|  |  |                          times: x.times, order: maxOrder + 2,
 | 
	
		
			
				|  |  |                          status: auditConst.status.checking,
 | 
	
		
			
				|  |  |                          create_time: time,
 | 
	
	
		
			
				|  | @@ -742,7 +745,7 @@ module.exports = app => {
 | 
	
		
			
				|  |  |                  let order = 1;
 | 
	
		
			
				|  |  |                  for (const aid of newIdList) {
 | 
	
		
			
				|  |  |                      newAuditors.push({
 | 
	
		
			
				|  |  | -                        tid: advance.tid, vid: advance.id, audit_id: aid,
 | 
	
		
			
				|  |  | +                        tid: advance.tid, vid: advance.id, type: advance.type, audit_id: aid,
 | 
	
		
			
				|  |  |                          times: advance.times, order, status: auditConst.status.uncheck,
 | 
	
		
			
				|  |  |                      });
 | 
	
		
			
				|  |  |                      order++;
 | 
	
	
		
			
				|  | @@ -771,7 +774,7 @@ module.exports = app => {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                  // 添加终审
 | 
	
		
			
				|  |  |                  const newAuditor = {
 | 
	
		
			
				|  |  | -                    tid: advance.tid, vid: advance.id, audit_id: lastId,
 | 
	
		
			
				|  |  | +                    tid: advance.tid, vid: advance.id, type: advance.type, audit_id: lastId,
 | 
	
		
			
				|  |  |                      times: advance.times, order, status: auditConst.status.uncheck,
 | 
	
		
			
				|  |  |                  };
 | 
	
		
			
				|  |  |                  await transaction.insert(this.tableName, newAuditor);
 |