소스 검색

会计、评估OMS开票功能相关代码

huangguoce 2 달 전
부모
커밋
5d1fb13dfa

+ 2 - 2
src/api/cw/invoice/CwFinanceInvoiceService.js

@@ -190,9 +190,9 @@ export default {
 		});
 	},
 
-	invoiceFastRedOMSView(params) {
+	invoiceAllScenarioRedOMSView(params) {
 		return request({
-			url: prefix + "/cw_finance/invoice/invoiceFastRedOMSView",
+			url: prefix + "/cw_finance/invoice/invoiceAllScenarioRedOMSView",
 			method: "get",
 			params: params,
 		});

+ 24 - 0
src/api/finance/invoice/FinanceInvoiceService.js

@@ -108,4 +108,28 @@ export default class FinanceInvoiceService {
 			params: params,
 		});
 	}
+	downLoadOMSInvoiceAttachzip(fileUrl) {
+		return request({
+			url: prefix + "/finance/invoice/downLoadOMSInvoiceAttachzip",
+			method: "get",
+			params: { fileUrl: fileUrl },
+			responseType: "blob",
+		});
+	}
+
+	invoiceOMSView(invoiceId) {
+		return request({
+			url: prefix + "/finance/invoice/invoiceOMSView",
+			method: "get",
+			params: { invoiceId: invoiceId },
+		});
+	}
+
+	invoiceAllScenarioRedOMSView(params) {
+		return request({
+			url: prefix + "/finance/invoice/invoiceAllScenarioRedOMSView",
+			method: "get",
+			params: params,
+		});
+	}
 }

+ 12 - 2
src/views/cw/invoice/InvoiceForm.vue

@@ -44,8 +44,9 @@
                     .replace(/^\./g, '')
                     .replace(/\.{2,}/g, '.')
                     .replace('.', '$#$').replace(/\./g, '').replace('$#$', '.')
-                    .replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3')" v-model="scope.row.account" controls-position="right"
-                    :controls="false" style="width:100%;" placeholder="请输入发票金额(元)" clearable />
+                    .replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3')" v-model="scope.row.account"
+                    controls-position="right" :controls="false" style="width:100%;" placeholder="请输入发票金额(元)"
+                    clearable />
                 </template>
               </vxe-table-column>
               <!--            <vxe-table-column field="clientName" title="委托方" :edit-render="{}">-->
@@ -590,6 +591,7 @@
         </el-form>
       </el-form>
       <!--        附件-->
+      <UpLoadComponent ref="invoiceComponent"></UpLoadComponent>
       <UpLoadComponent ref="uploadComponent"></UpLoadComponent>
       <template #footer>
         <span class="dialog-footer">
@@ -672,6 +674,7 @@ export default {
         procInsId: '',
         processDefinitionId: '',
         workAttachmentDtoList: [],
+        invoiceList: [],
         financeInvoiceDetailDTOList: [],
         financeInvoiceReceivablesDTOList: [],
         financeInvoiceInvalidDTO: {},
@@ -769,6 +772,7 @@ export default {
         procInsId: '',
         processDefinitionId: '',
         workAttachmentDtoList: [],
+        invoiceList: [],
         financeInvoiceDetailDTOList: [],
         financeInvoiceReceivablesDTOList: [],
         financeInvoiceInvalidDTO: {
@@ -830,11 +834,16 @@ export default {
           if (this.commonJS.isEmpty(this.inputForm.workAttachmentDtoList)) {
             this.inputForm.workAttachmentDtoList = []
           }
+          if (this.commonJS.isEmpty(this.inputForm.invoiceList)) {
+            this.inputForm.invoiceList = []
+          }
+
           if (this.commonJS.isNotEmpty(this.inputForm.financeInvoiceDetailDTOList)) {
             this.inputForm.financeInvoiceDetailDTOList.forEach((item) => {
               item.account = parseFloat(parseFloat(item.account).toFixed(2));
             })
           }
+          this.$refs.invoiceComponent.newUpload("view", this.inputForm.invoiceList, 'CW_OMS_invoice_file', null, "发票文件")
           this.$refs.uploadComponent.newUpload(method, this.inputForm.workAttachmentDtoList, 'invoice')
           this.loading = false
         })
@@ -995,6 +1004,7 @@ export default {
         reconciliationArea: '',
         remarks: '',
         name: '',
+        invoiceList: [],
         workAttachmentDtoList: [],
         financeInvoiceDetailDTOList: [],
         financeInvoiceReceivablesDTOList: [],

+ 91 - 64
src/views/cw/invoice/InvoiceFormTask.vue

@@ -324,7 +324,7 @@
 							{{ item.label }}</el-radio>
 					</el-form-item>
 				</el-col>
-				<el-col :span="12" v-if="inputForm.redInvoiceFlag === '1' && inputForm.relatedInvoice === '1'">
+				<el-col :span="12" v-if="inputForm.redInvoiceFlag === '1'">
 					<el-form-item label="红冲原因" prop="redFlushReason" :rules="[
 						{ required: true, message: '红冲原因不能为空', trigger: 'blur' }
 					]">
@@ -394,13 +394,13 @@
 						</el-radio>
 					</el-form-item>
 				</el-col>
-				<el-col :span="24">
+				<!-- <el-col :span="24">
 					<el-form-item label="开票内容要求" prop="billingContentTerms" :rules="[
 					]">
 						<el-input type="textarea" maxlength="500" v-model="inputForm.billingContentTerms"
 							placeholder="开票内容要求" show-word-limit></el-input>
 					</el-form-item>
-				</el-col>
+				</el-col> -->
 
 				<el-col :span="12">
 					<el-form-item label="开票人" prop="billingPeople" :rules="[
@@ -583,13 +583,21 @@
 					</el-form-item>
 				</el-col>
 
-				<el-col :span="24">
-					<el-form-item label="备注" prop="remarks" :rules="[
-					]">
-						<el-input maxlength="500" type="textarea" placeholder="请填写备注" v-model="inputForm.remarks"
-							show-word-limit></el-input>
-					</el-form-item>
-				</el-col>
+
+				<el-form :disabled="status === 'taskFormDetail' || isDisabled" style="width: 100%" :model="inputForm"
+					v-loading="loading" :class="method === 'view' ? 'readonly' : ''" label-width="160px"
+					@submit.native.prevent>
+					<el-row :gutter="15">
+						<el-col :span="24">
+							<el-form-item label="备注" prop="remarks" :rules="[
+							]">
+								<el-input maxlength="500" type="textarea" placeholder="请填写备注"
+									v-model="inputForm.remarks" show-word-limit></el-input>
+							</el-form-item>
+						</el-col>
+					</el-row>
+				</el-form>
+
 			</el-row>
 
 
@@ -761,6 +769,7 @@
 			</div>
 		</el-form>
 		<!--        附件-->
+		<UpLoadComponent ref="invoiceComponent"></UpLoadComponent>
 		<UpLoadComponent ref="uploadComponent"></UpLoadComponent>
 		<UpLoadComponentSignContract ref="uploadComponentSignContract"></UpLoadComponentSignContract>
 
@@ -893,6 +902,7 @@ export default {
 				status: '',
 				procInsId: '',
 				processDefinitionId: '',
+				invoiceList: [],
 				workAttachmentDtoList: [],
 				workAttachmenSignContract: [],
 				financeInvoiceDetailDTOList: [],
@@ -977,6 +987,7 @@ export default {
 			handler(newVal) {
 				this.$emit('changeLoading', newVal)
 				this.$refs.uploadComponent.changeLoading(newVal)
+				this.$refs.invoiceComponent.changeLoading(newVal)
 				this.$refs.uploadComponentSignContract.changeLoading(newVal)
 			}
 		}
@@ -1028,6 +1039,7 @@ export default {
 				status: '',
 				procInsId: '',
 				processDefinitionId: '',
+				invoiceList: [],
 				workAttachmentDtoList: [],
 				workAttachmenSignContract: [],
 				financeInvoiceDetailDTOList: [],
@@ -1077,6 +1089,7 @@ export default {
 				this.$refs.inputForm.resetFields()
 				this.loading = true
 				financeInvoiceService.queryById(this.inputForm.id).then((data) => {
+					this.$refs.invoiceComponent.clearUpload()
 					this.$refs.uploadComponent.clearUpload()
 					this.$refs.uploadComponentSignContract.clearUpload()
 					this.inputForm = this.recover(this.inputForm, data)
@@ -1150,6 +1163,10 @@ export default {
 					if (this.commonJS.isEmpty(this.inputForm.workAttachmentDtoList) || this.inputForm.workAttachmentDtoList.length === 0) {
 						this.inputForm.workAttachmentDtoList = []
 					}
+					if (this.commonJS.isEmpty(this.inputForm.invoiceList) || this.inputForm.invoiceList.length === 0) {
+						this.inputForm.invoiceList = []
+					}
+
 					if (this.commonJS.isEmpty(this.inputForm.workAttachmenSignContract) || this.inputForm.workAttachmenSignContract.length === 0) {
 						this.inputForm.workAttachmenSignContract = []
 					}
@@ -1201,6 +1218,10 @@ export default {
 							allAmount: ''
 						})
 					}
+					if (redInvoice == "1") {
+						this.inputForm.invoiceList = []
+					}
+					this.$refs.invoiceComponent.newUpload("view", this.inputForm.invoiceList, 'CW_OMS_invoice_file', null, "发票文件")
 					this.$refs.uploadComponent.newUpload(method, this.inputForm.workAttachmentDtoList, 'invoice')
 					this.$refs.uploadComponentSignContract.newUpload(method, this.inputForm.workAttachmenSignContract, 'signContract')
 
@@ -1319,6 +1340,7 @@ export default {
 		},
 		// 表单提交
 		async doSubmit(status, callback) {
+
 			this.loading = true
 			if (await this.$refs.uploadComponent.checkProgress()) {
 				this.loading = false
@@ -1421,54 +1443,56 @@ export default {
 				}
 			}
 			if (this.inputForm.status === '5') {
-				let acc = 0
-				this.inputForm.financeInvoiceDetailDTOList.forEach((item, index) => {
-					if (this.commonJS.isEmpty(item.number)) {
-						this.loading = false
-						this.$message.warning('发票明细中第 ' + (index + 1) + ' 条数据的 “发票号” 为空')
-						throw new Error()
-					}
-					if (this.commonJS.isEmpty(item.account)) {
+				if (this.inputForm.redInvoiceFlag == 1 && this.inputForm.relatedInvoice == 0) {
+					let acc = 0
+					this.inputForm.financeInvoiceDetailDTOList.forEach((item, index) => {
+						if (this.commonJS.isEmpty(item.number)) {
+							this.loading = false
+							this.$message.warning('发票明细中第 ' + (index + 1) + ' 条数据的 “发票号” 为空')
+							throw new Error()
+						}
+						if (this.commonJS.isEmpty(item.account)) {
+							this.loading = false
+							this.$message.warning('发票明细中第 ' + (index + 1) + ' 条数据的 “开票金额” 为空')
+							throw new Error()
+						}
+						acc = (acc + parseFloat(parseFloat(item.account).toFixed(2)))
+					})
+					if (parseFloat(acc).toFixed(2) !== parseFloat(this.inputForm.account).toFixed(2)) {
 						this.loading = false
-						this.$message.warning('发票明细中第 ' + (index + 1) + ' 条数据的 “开票金额” 为空')
+						this.$message.warning('发票明细中 “开票金额”总和 与发票详情中 “发票金额” 不等')
 						throw new Error()
 					}
-					acc = (acc + parseFloat(parseFloat(item.account).toFixed(2)))
-				})
-				if (parseFloat(acc).toFixed(2) !== parseFloat(this.inputForm.account).toFixed(2)) {
-					this.loading = false
-					this.$message.warning('发票明细中 “开票金额”总和 与发票详情中 “发票金额” 不等')
-					throw new Error()
-				}
-				this.inputForm.financeInvoiceDetailDTOList.forEach((item, index) => {
-					this.inputForm.financeInvoiceDetailDTOList.forEach((item2, index2) => {
-						if (index !== index2) {
-							if (item.number === item2.number) {
+					this.inputForm.financeInvoiceDetailDTOList.forEach((item, index) => {
+						this.inputForm.financeInvoiceDetailDTOList.forEach((item2, index2) => {
+							if (index !== index2) {
+								if (item.number === item2.number) {
+									this.loading = false
+									this.$message.warning('发票明细中第 ' + (index + 1) + ' 条数据的 “发票号” 存在重复')
+									throw new Error()
+								}
+							}
+						})
+					})
+					for await (let [index, item] of this.inputForm.financeInvoiceDetailDTOList.entries()) {
+						if (this.commonJS.isEmpty(item.number)) {
+							this.loading = false
+							this.$message.warning('发票明细中第 ' + (index + 1) + ' 条数据的 “发票号” 为空')
+							this.err = true
+						}
+						await financeInvoiceService.queryByNumber(item.number, item.id).then((data) => {
+							if (data === true) {
 								this.loading = false
 								this.$message.warning('发票明细中第 ' + (index + 1) + ' 条数据的 “发票号” 存在重复')
-								throw new Error()
+								this.err = data
 							}
-						}
-					})
-				})
-				for await (let [index, item] of this.inputForm.financeInvoiceDetailDTOList.entries()) {
-					if (this.commonJS.isEmpty(item.number)) {
+						})
+					}
+					if (this.err === true) {
 						this.loading = false
-						this.$message.warning('发票明细中第 ' + (index + 1) + ' 条数据的 “发票号” 为空')
-						this.err = true
+						this.err = ''
+						throw new Error()
 					}
-					await financeInvoiceService.queryByNumber(item.number, item.id).then((data) => {
-						if (data === true) {
-							this.loading = false
-							this.$message.warning('发票明细中第 ' + (index + 1) + ' 条数据的 “发票号” 存在重复')
-							this.err = data
-						}
-					})
-				}
-				if (this.err === true) {
-					this.loading = false
-					this.err = ''
-					throw new Error()
 				}
 			}
 			if (this.status === 'audit') {
@@ -1517,20 +1541,21 @@ export default {
 								this.inputForm.title = `${this.$store.state.user.name} 发起了 ${data.no} [财务-发票申请]`
 							}
 						}
-						// 触发开票接口
-						if (this.inputForm.status === '5') {
-							// 区分红票,蓝票
-							if (this.inputForm.redInvoiceFlag === '1') {
-								let params = {
-									allEinvno: this.inputForm.invoiceNumberStr,
-									workInvoiceId: this.inputForm.id
-								}
-								financeInvoiceService.invoiceFastRedOMSView(params)
-							}
-							if (this.inputForm.redInvoiceFlag === '0') {
-								financeInvoiceService.invoiceOMSView(this.inputForm.id)
-							}
-						}
+						// // 请求开票接口
+						// if (this.inputForm.status === '12') {
+						// 	// 区分红票,蓝票
+						// 	if (this.inputForm.redInvoiceFlag === '1') {
+						// 		let params = {
+						// 			originalInvno: this.inputForm.invoiceNumberStr,
+						// 			workInvoiceId: this.inputForm.id,
+						// 			redInvoiceRelevancyId: this.inputForm.redInvoiceRelevancyId
+						// 		}
+						// 		financeInvoiceService.invoiceAllScenarioRedOMSView(params)
+						// 	}
+						// 	if (this.inputForm.redInvoiceFlag === '0') {
+						// 		financeInvoiceService.invoiceOMSView(this.inputForm.id)
+						// 	}
+						// }
 
 						this.inputForm.id = data.businessId
 						callback(data.businessTable, data.businessId, this.inputForm, data.recordType)
@@ -1580,6 +1605,7 @@ export default {
 				reconciliationArea: '',
 				remarks: '',
 				name: '',
+				invoiceList: [],
 				workAttachmentDtoList: [],
 				financeInvoiceDetailDTOList: [],
 				financeInvoiceReceivablesDTOList: [],
@@ -2109,6 +2135,7 @@ export default {
 			if (value === '0') {
 				this.inputForm.redInvoiceRelevancyNumber = ''
 				this.inputForm.invoiceNumberStr = ''
+				this.inputForm.redInvoiceRelevancyId = ''
 			} else {
 				this.inputForm.situationDetail = ''
 			}

+ 10 - 5
src/views/cw/invoice/InvoiceList.vue

@@ -225,7 +225,7 @@
                   $dictUtils.getDictLabel("invoice_status", scope.row.status, '') }} </el-button>
             </template>
           </vxe-column>
-          <vxe-column min-width="110" title="操作" fixed="right" align="center">
+          <vxe-column min-width="200" title="操作" fixed="right" align="center">
             <template #default="scope">
               <div v-if="isAdmin">
                 <el-button v-if="(scope.row.status === '5')" text type="primary"
@@ -236,7 +236,8 @@
               </div>
               <div v-else>
 
-                <el-button text type="primary" @click="handleDownloadAllInvoice(scope.row)">下载所有格式发票</el-button>
+                <el-button v-if="scope.row.omsAttachmentUrl" text type="primary"
+                  @click="handleDownloadAllInvoice(scope.row)">下载所有格式发票</el-button>
                 <el-button
                   v-if="hasPermission('cw_finance:invoice:add') && scope.row.status === '5' && scope.row.account > 0"
                   text type="primary" @click="handleRedInvoice(scope.row)">红冲</el-button>
@@ -1145,9 +1146,13 @@ export default {
         type: 'warning'
       }).then(() => {
         this.loading = true
-        financeInvoiceService.downLoadOMSInvoiceAttachzip(row.omsAttachmentUrl).then((res) => {
+        // 去除第一个/
+        let omsAttachmentUrl = row.omsAttachmentUrl.substring(1)
+        // 去除最后一个/线后面的内容,保留/  
+        omsAttachmentUrl = omsAttachmentUrl.substring(0, omsAttachmentUrl.lastIndexOf('/') + 1)
+        financeInvoiceService.downLoadOMSInvoiceAttachzip(omsAttachmentUrl).then((res) => {
           // 将二进制流文件写入excel表,以下为重要步骤
-          this.$utils.downloadZip(res, '发票文件')
+          this.$utils.downloadZip(res, '发票-' + row.number + '所有发票格式.zip')
           this.loading = false
         }).catch(function (err) {
           this.loading = false
@@ -1156,7 +1161,7 @@ export default {
           }
         })
       })
-    }
+    },
   }
 }
 </script>

+ 10 - 2
src/views/finance/invoice/InvoiceForm.vue

@@ -313,13 +313,13 @@
                 {{ item.label }}</el-radio>
             </el-form-item>
           </el-col>
-          <el-col :span="24">
+          <!-- <el-col :span="24">
             <el-form-item label="开票内容要求" prop="billingContentTerms" :rules="[
             ]">
               <el-input type="textarea" maxlength="500" v-model="inputForm.billingContentTerms" placeholder="开票内容要求"
                 show-word-limit></el-input>
             </el-form-item>
-          </el-col>
+          </el-col> -->
           <el-col :span="12">
             <el-form-item label="开票人" prop="billingPeople" :rules="[
             ]">
@@ -567,6 +567,7 @@
         </el-form>
       </el-form>
       <!--        附件-->
+      <UpLoadComponent ref="invoiceComponent"></UpLoadComponent>
       <UpLoadComponent ref="uploadComponent"></UpLoadComponent>
       <template #footer>
         <span class="dialog-footer">
@@ -640,6 +641,7 @@ export default {
         status: '',
         procInsId: '',
         processDefinitionId: '',
+        invoiceList: [],
         workAttachmentDtoList: [],
         financeInvoiceDetailDTOList: [],
         financeInvoiceReceivablesDTOList: [],
@@ -737,6 +739,7 @@ export default {
         procInsId: '',
         processDefinitionId: '',
         workAttachmentDtoList: [],
+        invoiceList: [],
         financeInvoiceDetailDTOList: [],
         financeInvoiceReceivablesDTOList: [],
         financeInvoiceInvalidDTO: {
@@ -776,7 +779,11 @@ export default {
           if (this.commonJS.isEmpty(this.inputForm.workAttachmentDtoList)) {
             this.inputForm.workAttachmentDtoList = []
           }
+          if (this.commonJS.isEmpty(this.inputForm.invoiceList)) {
+            this.inputForm.invoiceList = []
+          }
           this.$refs.uploadComponent.newUpload(method, this.inputForm.workAttachmentDtoList, 'invoice')
+          this.$refs.invoiceComponent.newUpload("view", this.inputForm.invoiceList, 'PG_OMS_invoice_file', null, "发票文件")
           this.loading = false
         })
       })
@@ -931,6 +938,7 @@ export default {
         reconciliationArea: '',
         remarks: '',
         name: '',
+        invoiceList: [],
         workAttachmentDtoList: [],
         financeInvoiceDetailDTOList: [],
         financeInvoiceReceivablesDTOList: [],

+ 88 - 50
src/views/finance/invoice/InvoiceFormTask.vue

@@ -291,7 +291,7 @@
               {{ item.label }}</el-radio>
           </el-form-item>
         </el-col>
-        <el-col :span="12" v-if="inputForm.redInvoiceFlag === '1' && inputForm.relatedInvoice === '1'">
+        <el-col :span="12" v-if="inputForm.redInvoiceFlag === '1'">
           <el-form-item label="红冲原因" prop="redFlushReason" :rules="[
             { required: true, message: '红冲原因不能为空', trigger: 'blur' }
           ]">
@@ -337,13 +337,13 @@
             </el-radio>
           </el-form-item>
         </el-col>
-        <el-col :span="24">
+        <!-- <el-col :span="24">
           <el-form-item label="开票内容要求" prop="billingContentTerms" :rules="[
           ]">
             <el-input type="textarea" maxlength="500" v-model="inputForm.billingContentTerms" placeholder="开票内容要求"
               show-word-limit></el-input>
           </el-form-item>
-        </el-col>
+        </el-col> -->
         <el-col :span="12">
           <el-form-item label="开票人" prop="billingPeople" :rules="[
           ]">
@@ -455,15 +455,20 @@
               size="large" :accordion="true" @getValue="(value) => { inputForm.reconciliationArea = value }" />
           </el-form-item>
         </el-col>
-        <el-col :span="24">
-          <el-form-item label="备注" prop="remarks" :rules="[
-          ]">
-            <el-input maxlength="500" type="textarea" placeholder="请填写备注" v-model="inputForm.remarks"
-              show-word-limit></el-input>
-          </el-form-item>
-        </el-col>
       </el-row>
 
+      <el-form :disabled="status === 'taskFormDetail' || isDisabled" style="width: 100%" :model="inputForm"
+        v-loading="loading" :class="method === 'view' ? 'readonly' : ''" label-width="160px" @submit.native.prevent>
+        <el-row :gutter="15">
+          <el-col :span="24">
+            <el-form-item label="备注" prop="remarks" :rules="[
+            ]">
+              <el-input maxlength="500" type="textarea" placeholder="请填写备注" v-model="inputForm.remarks"
+                show-word-limit></el-input>
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
 
       <el-form :disabled="status === 'audit' ? false : true">
         <el-divider content-position="left"><i class="el-icon-document"></i>
@@ -622,6 +627,7 @@
       </div>
     </el-form>
     <!--        附件-->
+    <UpLoadComponent ref="invoiceComponent"></UpLoadComponent>
     <UpLoadComponent ref="uploadComponent"></UpLoadComponent>
     <ProgramPageForm ref="programPageForm" @getProgram="getProgram"></ProgramPageForm>
     <ContractForm ref="contractForm" @getContract="getContract"></ContractForm>
@@ -739,6 +745,7 @@ export default {
         procInsId: '',
         processDefinitionId: '',
         workAttachmentDtoList: [],
+        invoiceList: [],
         financeInvoiceDetailDTOList: [],
         financeInvoiceReceivablesDTOList: [],
         financeInvoiceInvalidDTO: {},
@@ -811,6 +818,7 @@ export default {
     'loading': {
       handler(newVal) {
         this.$emit('changeLoading', newVal)
+        this.$refs.invoiceComponent.changeLoading(newVal)
         this.$refs.uploadComponent.changeLoading(newVal)
       }
     }
@@ -860,6 +868,7 @@ export default {
         procInsId: '',
         processDefinitionId: '',
         workAttachmentDtoList: [],
+        invoiceList: [],
         financeInvoiceDetailDTOList: [],
         financeInvoiceReceivablesDTOList: [],
         financeInvoiceInvalidDTO: {
@@ -904,6 +913,7 @@ export default {
         this.$refs.inputForm.resetFields()
         this.loading = true
         this.financeInvoiceService.queryById(this.inputForm.id).then(async (data) => {
+          this.$refs.invoiceComponent.clearUpload()
           await this.$refs.uploadComponent.clearUpload()
           this.inputForm = this.recover(this.inputForm, data)
           if (this.commonJS.isEmpty(this.inputForm.actualDrawerEmailAddress)) {
@@ -923,6 +933,10 @@ export default {
           if (this.commonJS.isEmpty(this.inputForm.workAttachmentDtoList) || this.inputForm.workAttachmentDtoList.length === 0) {
             this.inputForm.workAttachmentDtoList = []
           }
+          if (this.commonJS.isEmpty(this.inputForm.invoiceList) || this.inputForm.invoiceList.length === 0) {
+            this.inputForm.invoiceList = []
+          }
+
           if (this.commonJS.isEmpty(this.inputForm.redInvoiceFlag)) {
             this.inputForm.redInvoiceFlag = '0'
           }
@@ -983,6 +997,10 @@ export default {
             })
           }
 
+          if (redInvoice == "1") {
+            this.inputForm.invoiceList = []
+          }
+          this.$refs.invoiceComponent.newUpload("view", this.inputForm.invoiceList, 'PG_OMS_invoice_file', null, "发票文件")
           this.$refs.uploadComponent.newUpload(method, this.inputForm.workAttachmentDtoList, 'invoice')
 
 
@@ -1144,54 +1162,56 @@ export default {
         }
       }
       if (this.inputForm.status === '5') {
-        let acc = 0
-        this.inputForm.financeInvoiceDetailDTOList.forEach((item, index) => {
-          if (this.commonJS.isEmpty(item.number)) {
-            this.loading = false
-            this.$message.warning('发票明细中第 ' + (index + 1) + ' 条数据的 “发票号” 为空')
-            throw new Error()
-          }
-          if (this.commonJS.isEmpty(item.account)) {
+        if (this.inputForm.redInvoiceFlag == 1 && this.inputForm.relatedInvoice == 0) {
+          let acc = 0
+          this.inputForm.financeInvoiceDetailDTOList.forEach((item, index) => {
+            if (this.commonJS.isEmpty(item.number)) {
+              this.loading = false
+              this.$message.warning('发票明细中第 ' + (index + 1) + ' 条数据的 “发票号” 为空')
+              throw new Error()
+            }
+            if (this.commonJS.isEmpty(item.account)) {
+              this.loading = false
+              this.$message.warning('发票明细中第 ' + (index + 1) + ' 条数据的 “开票金额” 为空')
+              throw new Error()
+            }
+            acc = (acc + parseFloat(parseFloat(item.account).toFixed(2)))
+          })
+          if (parseFloat(acc).toFixed(2) !== parseFloat(this.inputForm.account).toFixed(2)) {
             this.loading = false
-            this.$message.warning('发票明细中第 ' + (index + 1) + ' 条数据的 “开票金额” 为空')
+            this.$message.warning('发票明细中 “开票金额”总和 与发票详情中 “发票金额” 不等')
             throw new Error()
           }
-          acc = (acc + parseFloat(parseFloat(item.account).toFixed(2)))
-        })
-        if (parseFloat(acc).toFixed(2) !== parseFloat(this.inputForm.account).toFixed(2)) {
-          this.loading = false
-          this.$message.warning('发票明细中 “开票金额”总和 与发票详情中 “发票金额” 不等')
-          throw new Error()
-        }
-        this.inputForm.financeInvoiceDetailDTOList.forEach((item, index) => {
-          this.inputForm.financeInvoiceDetailDTOList.forEach((item2, index2) => {
-            if (index !== index2) {
-              if (item.number === item2.number) {
+          this.inputForm.financeInvoiceDetailDTOList.forEach((item, index) => {
+            this.inputForm.financeInvoiceDetailDTOList.forEach((item2, index2) => {
+              if (index !== index2) {
+                if (item.number === item2.number) {
+                  this.loading = false
+                  this.$message.warning('发票明细中第 ' + (index + 1) + ' 条数据的 “发票号” 存在重复')
+                  throw new Error()
+                }
+              }
+            })
+          })
+          for await (let [index, item] of this.inputForm.financeInvoiceDetailDTOList.entries()) {
+            if (this.commonJS.isEmpty(item.number)) {
+              this.loading = false
+              this.$message.warning('发票明细中第 ' + (index + 1) + ' 条数据的 “发票号” 为空')
+              this.err = true
+            }
+            await this.financeInvoiceService.queryByNumber(item.number, item.id).then((data) => {
+              if (data === true) {
                 this.loading = false
                 this.$message.warning('发票明细中第 ' + (index + 1) + ' 条数据的 “发票号” 存在重复')
-                throw new Error()
+                this.err = data
               }
-            }
-          })
-        })
-        for await (let [index, item] of this.inputForm.financeInvoiceDetailDTOList.entries()) {
-          if (this.commonJS.isEmpty(item.number)) {
+            })
+          }
+          if (this.err === true) {
             this.loading = false
-            this.$message.warning('发票明细中第 ' + (index + 1) + ' 条数据的 “发票号” 为空')
-            this.err = true
+            this.err = ''
+            throw new Error()
           }
-          await this.financeInvoiceService.queryByNumber(item.number, item.id).then((data) => {
-            if (data === true) {
-              this.loading = false
-              this.$message.warning('发票明细中第 ' + (index + 1) + ' 条数据的 “发票号” 存在重复')
-              this.err = data
-            }
-          })
-        }
-        if (this.err === true) {
-          this.loading = false
-          this.err = ''
-          throw new Error()
         }
       }
       if (this.status === 'audit') {
@@ -1217,6 +1237,22 @@ export default {
           this.checkEmail()
 
           this.financeInvoiceService.saveForm(this.inputForm).then((data) => {
+            // 请求开票接口
+            // if (this.inputForm.status === '12') {
+            //   // 区分红票,蓝票
+            //   if (this.inputForm.redInvoiceFlag === '1') {
+            //     let params = {
+            //       originalInvno: this.inputForm.invoiceNumberStr,
+            //       workInvoiceId: this.inputForm.id,
+            //       redInvoiceRelevancyId: this.inputForm.redInvoiceRelevancyId
+            //     }
+            //     this.financeInvoiceService.invoiceAllScenarioRedOMSView(params)
+            //   }
+            //   if (this.inputForm.redInvoiceFlag === '0') {
+            //     this.financeInvoiceService.invoiceOMSView(this.inputForm.id)
+            //   }
+            // }
+
             this.inputForm.id = data.businessId
             callback(data.businessTable, data.businessId, this.inputForm)
             this.loading = false
@@ -1263,6 +1299,7 @@ export default {
         remarks: '',
         name: '',
         workAttachmentDtoList: [],
+        invoiceList: [],
         financeInvoiceDetailDTOList: [],
         financeInvoiceReceivablesDTOList: [],
         financeInvoiceInvalidDTO: {},
@@ -1702,6 +1739,7 @@ export default {
       if (value === '0') {
         this.inputForm.redInvoiceRelevancyNumber = ''
         this.inputForm.invoiceNumberStr = ''
+        this.inputForm.redInvoiceRelevancyId = ''
       } else {
         this.inputForm.situationDetail = ''
       }

+ 23 - 0
src/views/finance/invoice/InvoiceList.vue

@@ -206,6 +206,8 @@
           <vxe-column min-width="300" title="操作" fixed="right" align="center">
             <template #default="scope">
 
+              <el-button v-if="scope.row.omsAttachmentUrl" text type="primary"
+                @click="handleDownloadAllInvoice(scope.row)">下载所有格式发票</el-button>
               <el-button
                 v-if="hasPermission('finance:invoice:add') && scope.row.status === '5' && scope.row.account > 0" text
                 type="primary" @click="handleRedInvoice(scope.row)">红冲</el-button>
@@ -924,6 +926,27 @@ export default {
       console.log(user[0].name)
       this.searchForm.operator = user[0].name
     },
+    handleDownloadAllInvoice(row) {
+      this.$confirm(`确定下载当前全部发票文件吗?`, '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        this.loading = true
+        let omsAttachmentUrl = row.omsAttachmentUrl.substring(1)
+        omsAttachmentUrl = omsAttachmentUrl.substring(0, omsAttachmentUrl.lastIndexOf('/') + 1)
+        this.financeInvoiceService.downLoadOMSInvoiceAttachzip(omsAttachmentUrl).then((res) => {
+          // 将二进制流文件写入excel表,以下为重要步骤
+          this.$utils.downloadZip(res, '发票-' + row.number + '所有发票格式.zip')
+          this.loading = false
+        }).catch(function (err) {
+          this.loading = false
+          if (err.response) {
+            console.log(err.response)
+          }
+        })
+      })
+    },
   }
 }
 </script>