Kaynağa Gözat

登记页(发票金额添加*并设置为必填项)并对金额进行限制

sangwenwei 1 yıl önce
ebeveyn
işleme
4b34e37d27

+ 22 - 23
src/views/cw/invoice/InvoiceFormTask.vue

@@ -22,6 +22,7 @@
 				:footer-cell-class-name="footerCellClassName"
 				style="margin-left: 5em"
 				highlight-current-row
+				:edit-rules="validRules"
 				:edit-config="{trigger: 'click', mode: 'cell', showStatus: true, autoClear: true, icon: '-'}"
 			>
 				<vxe-table-column field="programName" align="center" title="项目名称" :edit-render="{}">
@@ -39,11 +40,16 @@
 						<el-input :readonly="true" placeholder="请填写项目编号" v-model="scope.row.programNo"/>
 					</template>
 				</vxe-table-column>
-				<vxe-table-column  field="account" align="center" title="发票金额(元)" :edit-render="{}" :rules="[
-                        {required: true, message:'发票金额不能为空', trigger:'blur'}
-               ]">
+				<vxe-table-column   field="account" align="center" title="发票金额(元)" :edit-render="{}">
 					<template v-slot:edit="scope">
-						<el-input  placeholder="请填写发票金额" v-model="scope.row.account" />
+						<el-input-number
+							:precision="2"
+							:max="9999999999"
+							:step="0.01"
+							:min="0"
+							:controls="false"
+							clearable
+							placeholder="请填写发票金额" v-model="scope.row.account" />
 					</template>
 				</vxe-table-column>
 				<!--          <vxe-table-column field="clientName" title="委托方" :edit-render="{}">-->
@@ -734,7 +740,12 @@
         yesNoFlag: [{label: '否', value: '0'}, {label: '是', value: '1'}],
         baseKey: '',
         detailKey: '',
-        receivablesKey: ''
+        receivablesKey: '',
+		  validRules: {
+			  account: [
+				  { required: true, message: '必须输入发票金额',trigger:"change"},
+			  ]
+		  }
       }
     },
     created () {
@@ -1015,6 +1026,11 @@
               this.$message.error('第' + (j + 1) + '行的基本信息不能为空')
               throw new Error()
             }
+			  if (this.commonJS.isEmpty(this.inputForm.financeInvoiceBaseDTOList[j].account)) {
+				  this.loading = false
+				  this.$message.error('第' + (j + 1) + '行的发票金额不能为空')
+				  throw new Error()
+			  }
           }
         }
         if (this.inputForm.status === '5') {
@@ -1526,24 +1542,7 @@
           this.inputForm.billingId = ''
         }
       },
-      // 格式化 发票金额  保留两位小数
-      fixedAccount () {
-        if (isNaN(this.inputForm.account) && !/^-$/.test(this.inputForm.account)) {
-          this.inputForm.account = ''
-        }
-        if (!/^[+-]?\d*\.{0,1}\d{0,1}$/.test(this.inputForm.account)) {
-          this.inputForm.account = this.inputForm.account.replace(/\.\d{2,}$/, this.inputForm.account.substr(this.inputForm.account.indexOf('.'), 3))
-        }
-        // 禁止录入整数部分两位以上,但首位为0
-        var regStrs = [
-          ['^(\\-)?0(\\d+)$', '$1']
-        ]
-        for (var i = 0; i < regStrs.length; i++) {
-          var reg = new RegExp(regStrs[i][0])
-          var result = this.inputForm.account.replace(reg, regStrs[i][1])
-          this.inputForm.account = result
-        }
-      },
+
 
 		footerMethod ({ columns, data }) {
 			const footerData = [

+ 5 - 5
src/views/cw/invoice/ProgramPageForm.vue

@@ -48,7 +48,7 @@
 				border="inner"
 				auto-resize
 				resizable
-				height="550px"
+				height="850px"
 				:loading="loading"
 				size="large"
 				ref="projectTable1"
@@ -65,9 +65,9 @@
 			>
 				<vxe-column type="seq" width="60" title="序号"></vxe-column>
 				<vxe-column type="checkbox" width="60px"></vxe-column>
-				<vxe-column min-width="230" align="center" title="项目名称" field="projectName"></vxe-column>
+				<vxe-column min-width="230" align="center" title="项目名称" field="projectName" show-overflow="field"></vxe-column>
 				<vxe-column min-width="230" align="center" title="项目编号" field="projectNumber"></vxe-column>
-				<vxe-column min-width="160" align="center" title="报告文号" field="reportNo"></vxe-column>
+				<vxe-column min-width="230" align="center" title="报告文号" field="reportNo"></vxe-column>
 				<vxe-column min-width="160" align="center" title="合同名称" field="contractName"></vxe-column>
 				<vxe-column min-width="160" align="center" title="报告创建人" field="userName"></vxe-column>
 				<vxe-column min-width="160" align="center" title="报告创建时间" field="createTime"></vxe-column>
@@ -116,7 +116,7 @@
             border="inner"
             auto-resize
             resizable
-            height="550px"
+            height="870px"
             :loading="loading"
             ref="projectTable"
             show-header-overflow
@@ -131,7 +131,7 @@
           >
             <vxe-column type="seq" width="60" title="序号"></vxe-column>
             <vxe-column type="checkbox" width="60px"></vxe-column>
-            <vxe-column min-width="160" align="center" title="项目名称" field="projectName"></vxe-column>
+            <vxe-column min-width="160" align="center" title="项目名称" field="projectName" show-overflow="field"></vxe-column>
             <vxe-column min-width="160" align="center" title="项目编号" field="projectNumber"></vxe-column>
             <vxe-column min-width="160" align="center" title="合同名称" field="contractName"></vxe-column>
             <vxe-column min-width="160" align="center" title="创建人" field="createBy.name"></vxe-column>