sangwenwei hai 1 ano
pai
achega
9c58f25bc2

+ 7 - 0
src/api/cw/invoice/CwFinanceInvoiceService.js

@@ -139,6 +139,13 @@ export default {
 		});
 	},
 
+	getByNo (no) {
+		return request({
+			url: prefix + '/cw_finance/invoice/getByNo',
+			method: 'get',
+			params: {no: no}
+		})
+	}
 
 
 };

+ 40 - 30
src/views/cw/invoice/InvoiceList.vue

@@ -707,36 +707,46 @@
       },
       // 发起发票作废审批
       invoiceInvalidPush (row) {
-        // 读取流程表单
-        let title = `发起流程【发票作废】`
-        let processTitle = `${this.userName} 发起了 ${row.no} [发票作废]`
-        let status = 'startAndHold'
-        if (row.status === '7') {
-          status = 'startAndClose'
-        } else if (row.status === '8') {
-          status = 'reapplyFlag'
-        }
-        taskService.getTaskDef({ procDefId: this.processDefinitionInvalidId,
-          businessId: row.financeInvoiceInvalidDTO.id,
-          businessTable: 'cw_finance_invoice_invalid'}).then((data) => {
-            this.$router.push({
-              path: '/flowable/task/TaskForm',
-              query: {
-                ...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title'),
-                procDefId: this.processDefinitionInvalidId,
-                procDefKey: this.procDefInvalidKey,
-                title: title,
-                formType: data.formType,
-                formUrl: data.formUrl,
-                formTitle: processTitle,
-                businessTable: 'cw_finance_invoice_invalid',
-                businessId: row.financeInvoiceInvalidDTO.id,
-                isShow: 'false',
-                status: status,
-                routePath: '/cw/invoice/InvoiceList'
-              }
-            })
-          })
+      	//预开票项目且与项目下的报告已完成关联则不允许作废
+		  financeInvoiceService.getByNo(row.no).then((data)=>{
+				if (data){
+					this.$message.error('该发票已与预开票项目中的报告关联,无法作废')
+					throw new Error('该发票已与预开票项目中的报告关联,无法作废')
+				}else {
+					// 读取流程表单
+					let title = `发起流程【发票作废】`
+					let processTitle = `${this.userName} 发起了 ${row.no} [发票作废]`
+					let status = 'startAndHold'
+					if (row.status === '7') {
+						status = 'startAndClose'
+					} else if (row.status === '8') {
+						status = 'reapplyFlag'
+					}
+					taskService.getTaskDef({ procDefId: this.processDefinitionInvalidId,
+						businessId: row.financeInvoiceInvalidDTO.id,
+						businessTable: 'cw_finance_invoice_invalid'}).then((data) => {
+						this.$router.push({
+							path: '/flowable/task/TaskForm',
+							query: {
+								...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title'),
+								procDefId: this.processDefinitionInvalidId,
+								procDefKey: this.procDefInvalidKey,
+								title: title,
+								formType: data.formType,
+								formUrl: data.formUrl,
+								formTitle: processTitle,
+								businessTable: 'cw_finance_invoice_invalid',
+								businessId: row.financeInvoiceInvalidDTO.id,
+								isShow: 'false',
+								status: status,
+								routePath: '/cw/invoice/InvoiceList'
+							}
+						})
+					})
+				}
+		  })
+
+
       },
       // 查看发票申请审批流程结果
       invoiceDetail (row) {