瀏覽代碼

发票审核时限制发票必须为20位

huangguoce 2 月之前
父節點
當前提交
8f1a032c56
共有 2 個文件被更改,包括 24 次插入6 次删除
  1. 11 3
      src/views/cw/invoice/InvoiceFormTask.vue
  2. 13 3
      src/views/finance/invoice/InvoiceFormTask.vue

+ 11 - 3
src/views/cw/invoice/InvoiceFormTask.vue

@@ -659,7 +659,7 @@
 							<vxe-table-column field="number" title="发票号" :edit-render="{}">
 								<template #edit="scope">
 									<el-input :disabled="isDisabled" oninput="value=value.replace(/\D|^/g,'')"
-										placeholder="请填写发票号" maxlength="8"
+										placeholder="请填写发票号" maxlength="20"
 										@blur="checkNumber(scope.row, scope.$rowIndex)" v-model="scope.row.number"
 										clearable>
 									</el-input>
@@ -1457,6 +1457,14 @@ export default {
 							this.$message.warning('发票明细中第 ' + (index + 1) + ' 条数据的 “开票金额” 为空')
 							throw new Error()
 						}
+
+						// 判断item.number是否为20位
+						if (item.number && item.number.length !== 20) {
+							this.loading = false
+							this.$message.warning('发票明细中第 ' + (index + 1) + ' 条数据的 “发票号” 必须为20位')
+							throw new Error()
+						}
+
 						acc = (acc + parseFloat(parseFloat(item.account).toFixed(2)))
 					})
 					if (parseFloat(acc).toFixed(2) !== parseFloat(this.inputForm.account).toFixed(2)) {
@@ -1824,8 +1832,8 @@ export default {
 		},
 		checkNumber(row, rowIndex) {
 			if (!this.commonJS.isEmpty(row.number)) {
-				if (parseInt(row.number) > 99999999) {
-					this.$message.warning('“发票号” 不可以大于 8 位,请重新输入')
+				if (parseInt(row.number) > 99999999999999999999) {
+					this.$message.warning('“发票号” 不可以大于 20 位,请重新输入')
 					row.number = undefined
 					return
 				}

+ 13 - 3
src/views/finance/invoice/InvoiceFormTask.vue

@@ -524,7 +524,7 @@
               </vxe-table-column>
               <vxe-table-column field="number" title="发票号" :edit-render="{}" show-overflow="title">
                 <template #edit="scope">
-                  <el-input oninput="value=value.replace(/\D|^/g,'')" placeholder="请填写发票号" maxlength="8"
+                  <el-input oninput="value=value.replace(/\D|^/g,'')" placeholder="请填写发票号" maxlength="20"
                     @blur="checkNumber(scope.row, scope.$rowIndex)" v-model="scope.row.number" clearable>
                   </el-input>
                 </template>
@@ -1165,6 +1165,7 @@ export default {
         if (this.inputForm.redInvoiceFlag == 1 &&
           (this.inputForm.relatedInvoice == 0 || this.inputForm.invoiceNumberStr == "" || this.inputForm.invoiceNumberStr == null || this.inputForm.invoiceNumberStr.length == 8)) {
           let acc = 0
+
           this.inputForm.financeInvoiceDetailDTOList.forEach((item, index) => {
             if (this.commonJS.isEmpty(item.number)) {
               this.loading = false
@@ -1176,6 +1177,14 @@ export default {
               this.$message.warning('发票明细中第 ' + (index + 1) + ' 条数据的 “开票金额” 为空')
               throw new Error()
             }
+
+            // 判断item.number是否为20位
+            if (item.number && item.number.length !== 20) {
+              this.loading = false
+              this.$message.warning('发票明细中第 ' + (index + 1) + ' 条数据的 “发票号” 必须为20位')
+              throw new Error()
+            }
+
             acc = (acc + parseFloat(parseFloat(item.account).toFixed(2)))
           })
           if (parseFloat(acc).toFixed(2) !== parseFloat(this.inputForm.account).toFixed(2)) {
@@ -1183,6 +1192,7 @@ export default {
             this.$message.warning('发票明细中 “开票金额”总和 与发票详情中 “发票金额” 不等')
             throw new Error()
           }
+
           this.inputForm.financeInvoiceDetailDTOList.forEach((item, index) => {
             this.inputForm.financeInvoiceDetailDTOList.forEach((item2, index2) => {
               if (index !== index2) {
@@ -1451,8 +1461,8 @@ export default {
     },
     checkNumber(row, rowIndex) {
       if (!this.commonJS.isEmpty(row.number)) {
-        if (parseInt(row.number) > 99999999) {
-          this.$message.warning('“发票号” 不可以大于 8 位,请重新输入')
+        if (parseInt(row.number) > 99999999999999999999) {
+          this.$message.warning('“发票号” 不可以大于 20 位,请重新输入')
           row.number = undefined
           return
         }