Sfoglia il codice sorgente

审核驳回页面进行发票金额回显

sangwenwei 1 anno fa
parent
commit
1489c78e36

+ 63 - 22
src/views/cw/invoice/InvoiceForm.vue

@@ -21,6 +21,7 @@
           <el-col :span="24">
 			  <vxe-table
 				  border
+				  :footer-method="footerMethod2"
 				  show-overflow
 				  show-footer
 				  ref="baseTable"
@@ -45,6 +46,19 @@
 						  <el-input :readonly="true" :disabled="method==='view'" placeholder="请填写项目编号" v-model="scope.row.programNo"/>
 					  </template>
 				  </vxe-table-column>
+				  <vxe-table-column   field="account" align="center" title="发票金额(元)" :edit-render="{}">
+					  <template v-slot:edit="scope">
+						  <el-input-number
+							  :readonly="true"
+							  :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="{}">-->
 				  <!--              <template v-slot:edit="scope">-->
 				  <!--                <el-input :readonly="true" placeholder="请填写委托方" v-model="scope.row.clientName"/>-->
@@ -247,26 +261,22 @@
               </el-select>
             </el-form-item>
           </el-col>
-          <el-col :span="12">
-            <el-form-item label="发票金额(元)" prop="account"
-                          :rules="[
-                          {required: true, message:'发票金额不能为空', trigger:'blur'}
-                 ]">
-              <el-input-number
-				  :disabled="method==='view'"
-                v-model="inputForm.account"
-                controls-position="right"
-                :controls="false"
-                style="width:100%;"
-                :max="999999999999999"
-                :precision="2"
-                placeholder="请填写发票金额"
-                :step="0.01"
-                :min="0"
-                clearable>
-              </el-input-number>
-            </el-form-item>
-          </el-col>
+			<el-col :span="12">
+				<el-form-item label="发票金额(元)" prop="accountTotal"
+							  :rules="[
+                        {required: true, message:'发票金额不能为空', trigger:'blur'}
+               ]">
+					<el-input
+						@input="fixedAccount"
+						placeholder="请填写发票金额"
+						maxlength="15"
+						v-model="inputForm.accountTotal"
+						:disabled="true"
+					>
+
+					</el-input>
+				</el-form-item>
+			</el-col>
           <el-col :span="12">
             <el-form-item label="是否多张开票" prop="isMultiple"
                           :rules="[
@@ -621,6 +631,7 @@
   import WorkClientForm from '../workClientInfo/WorkClientChooseRadio'
   import SelectUserTree from '@/views/utils/treeUserSelect'
   import SelectTree from '@/components/treeSelect/treeSelect.vue'
+  import XEUtils from 'xe-utils'
   export default {
     data () {
       return {
@@ -712,6 +723,7 @@
         }
         this.method = method
         this.inputForm = {
+		  accountTotal:'',
           id: '',
           financeInvoiceBaseDTOList: [],
           programName: '',
@@ -916,6 +928,7 @@
         this.$refs.uploadComponent.clearUpload()
         this.$refs.inputForm.resetFields()
         this.inputForm = {
+        	accountTotal:'',
           id: '',
           financeInvoiceBaseDTOList: [],
           programName: '',
@@ -1022,6 +1035,9 @@
             r.programNo = item.projectNumber
             r.contractId = item.contractId
             r.programId = item.id
+			  r.reportNo = item.reportNo
+			  r.account=item.account
+			  r.accountTotal=item.accountTotal
             this.inputForm.financeInvoiceBaseDTOList[this.programRow] = r
           } else {
             let r = {
@@ -1029,7 +1045,10 @@
               contractName: item.contractName,
               programNo: item.projectNumber,
               contractId: item.contractId,
-              programId: item.id
+              programId: item.id,
+				reportNo:item.reportNo,
+				account:item.account,
+				accountTotal:item.accountTotal
             }
             this.inputForm.financeInvoiceBaseDTOList.push(r)
           }
@@ -1253,7 +1272,29 @@
           })
         }
         this.$message.success('导入完成')
-      }
+      },
+	  footerMethod2 ({ columns, data }) {
+			const footerData = [
+				columns.map((column, columnIndex) => {
+					if (columnIndex === 0) {
+						return '发票金额汇总(元)'
+					}
+					if (['account'].includes(column.property)) {
+						// eslint-disable-next-line no-undef
+						this.inputForm.accountTotal = XEUtils.sum(data, column.property)
+						return XEUtils.sum(data, column.property)
+					}
+					if (['accountTotal'].includes(column.property)) {
+						// eslint-disable-next-line no-undef
+						this.inputForm.accountTotal = XEUtils.sum(data, column.property)
+						return XEUtils.sum(data, column.property)
+					}
+					return null
+				})
+			]
+			console.log('accountTotal', this.inputForm.accountTotal)
+			return footerData
+		},
     }
   }
 </script>

+ 38 - 31
src/views/cw/invoice/InvoiceFormTask.vue

@@ -12,20 +12,19 @@
         <el-col :span="24">
 			<vxe-table
 				border
-				show-overflow
+
 				show-footer
 				ref="baseTable"
 				:key="baseKey"
 				class="vxe-table-element"
 				:data="inputForm.financeInvoiceBaseDTOList"
 				:footer-method="footerMethod"
-				: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="{}">
+				<vxe-table-column field="programName" align="center" title="项目名称" :edit-render="{}" show-overflow="title">
 					<template v-slot:edit="scope">
 						<el-input @focus="openProgramPageForm(scope.$rowIndex)" placeholder="请填写项目名称" :readonly="true" v-model="scope.row.programName"/>
 					</template>
@@ -43,13 +42,17 @@
 				<vxe-table-column   field="account" align="center" title="发票金额(元)" :edit-render="{}">
 					<template v-slot:edit="scope">
 						<el-input-number
+							style="width: 240px"
+							:readonly="false"
 							:precision="2"
 							:max="9999999999"
 							:step="0.01"
 							:min="0"
 							:controls="false"
 							clearable
-							placeholder="请填写发票金额" v-model="scope.row.account" />
+							placeholder="请填写发票金额"
+							v-model="scope.row.account"
+							@input="fixedAccount"/>
 					</template>
 				</vxe-table-column>
 				<!--          <vxe-table-column field="clientName" title="委托方" :edit-render="{}">-->
@@ -260,12 +263,11 @@
           </el-form-item>
         </el-col>
         <el-col :span="12">
-          <el-form-item label="发票金额(元)" prop="accountTotal"
+          <el-form-item label="发票金额(元)" prop="account"
                         :rules="[
                         {required: true, message:'发票金额不能为空', trigger:'blur'}
                ]">
             <el-input
-              @input="fixedAccount"
               placeholder="请填写发票金额"
               maxlength="15"
               v-model="inputForm.accountTotal"
@@ -273,17 +275,6 @@
             >
 
             </el-input>
-<!--            <el-input-number-->
-<!--              v-model="inputForm.account"-->
-<!--              controls-position="right"-->
-<!--              :controls="false"-->
-<!--              style="width:100%;"-->
-<!--              :max="999999999999999"-->
-<!--              :precision="2"-->
-<!--              placeholder="请填写发票金额"-->
-<!--              :step="0.01"-->
-<!--              clearable>-->
-<!--            </el-input-number>-->
           </el-form-item>
         </el-col>
         <el-col :span="12">
@@ -696,7 +687,6 @@
           programName: '',
           contractName: '',
           programNo: '',
-		  account:'',
           clientName: '',
           reportNo: '',
           type: '1',
@@ -741,11 +731,11 @@
         baseKey: '',
         detailKey: '',
         receivablesKey: '',
-		  validRules: {
-			  account: [
-				  { required: true, message: '必须输入发票金额',trigger:"change"},
-			  ]
-		  }
+		  // validRules: {
+			//   account: [
+			// 	  { required: true, message: '必须输入发票金额',trigger:"change"},
+			//   ]
+		  // }
       }
     },
     created () {
@@ -805,7 +795,6 @@
           programName: '',
           contractName: '',
           programNo: '',
-		  account:'',
           clientName: '',
           reportNo: '',
           type: '1',
@@ -920,10 +909,16 @@
             }
             if (!this.commonJS.isEmpty(this.status) && this.status === 'audit' && (this.commonJS.isEmpty(this.inputForm.financeInvoiceDetailDTOList) || this.inputForm.financeInvoiceDetailDTOList.length === 0)) {
               this.inputForm.financeInvoiceDetailDTOList = []
+			  let i = this.inputForm.financeInvoiceBaseDTOList.length
+			  let sun = 0
+			  for (let j = 0; j < i; j++) {
+				sun += parseFloat(this.inputForm.financeInvoiceBaseDTOList[j].account)
+			  }
+			  console.log(sun)
               this.inputForm.financeInvoiceDetailDTOList.push({
                 code: '',
                 number: '',
-                account: this.inputForm.account,
+                account: sun,
                 rate: '',
                 amount: '',
                 tax: '',
@@ -986,6 +981,8 @@
           this.loading = false
           throw new Error()
         }
+        this.inputForm.account=this.inputForm.accountTotal
+		  console.log(this.inputForm.account)
         if (status === 'save') {
           // 暂存
           this.loading = true
@@ -1127,7 +1124,6 @@
           programName: '',
           contractName: '',
           programNo: '',
-		  account:'',
           clientName: '',
           reportNo: '',
           type: '1',
@@ -1180,6 +1176,8 @@
         }
         if (type === 'detail') {
           this.$refs.detailTable.insert().then((data) => {
+          	console.log(this.inputForm.accountTotal)
+          	data.account=this.inputForm.accountTotal
             this.inputForm.financeInvoiceDetailDTOList.push(data)
 			  this.detailKey  = Math.random()
           })
@@ -1225,18 +1223,18 @@
             r.programName = item.projectName
             r.contractName = item.contractName
             r.programNo = item.projectNumber
-		    r.account=item.account
             r.contractId = item.contractId
             r.programId = item.id
+			  r.reportNo = item.reportNo
             this.inputForm.financeInvoiceBaseDTOList[this.programRow] = r
           } else {
             let r = {
               programName: item.projectName,
               contractName: item.contractName,
               programNo: item.projectNumber,
-			  account:item.account,
               contractId: item.contractId,
-              programId: item.id
+              programId: item.id,
+				reportNo: item.reportNo
             }
             this.$refs.baseTable.insertAt(r)
             this.inputForm.financeInvoiceBaseDTOList.push(r)
@@ -1366,7 +1364,7 @@
       // 获取发票金额,放到开票明细中第一条数据
       getTotalAccount () {
         if (!this.commonJS.isEmpty(this.inputForm.account)) {
-          this.financeInvoiceDetailDTOList.push({account: this.inputForm.account})
+          this.financeInvoiceDetailDTOList.push({account: this.inputForm.accountTotal})
         }
       },
       async updateStatusById (type, callback) {
@@ -1548,18 +1546,27 @@
 			const footerData = [
 				columns.map((column, columnIndex) => {
 					if (columnIndex === 0) {
-						return '汇总'
+						return '发票金额汇总(元)'
 					}
 					if (['account'].includes(column.property)) {
 						// eslint-disable-next-line no-undef
 						this.inputForm.accountTotal = XEUtils.sum(data, column.property)
 						return XEUtils.sum(data, column.property)
 					}
+					// if (['accountTotal'].includes(column.property)) {
+					// 	// eslint-disable-next-line no-undef
+					// 	this.inputForm.accountTotal = XEUtils.sum(data, column.property)
+					// 	return XEUtils.sum(data, column.property)
+					// }
 					return null
 				})
 			]
 			return footerData
 		},
+		// 格式化 发票金额  保留两位小数
+		fixedAccount () {
+		this.inputForm.account=this.inputForm.account.replace(/[^\d.]/g,'').replace(/(\.\d+)\.+/g, '$1').replace(/(\..*)\./g, '$1')
+		},
     }
   }
 </script>

+ 5 - 0
src/views/cw/invoice/InvoiceFormTaskInvalid.vue

@@ -36,6 +36,11 @@
 						<el-input :readonly="true" placeholder="请填写项目编号" v-model="scope.row.programNo"/>
 					</template>
 				</vxe-table-column>
+				<vxe-table-column field="account" align="center" title="发票金额(元)" :edit-render="{}">
+					<template v-slot:edit="scope">
+						<el-input :disabled="true" placeholder="请填写发票金额" v-model="scope.row.account" @blur="scope.row.account = twoDecimalPlaces(scope.row.account)" maxlength="15"/>
+					</template>
+				</vxe-table-column>
 				<!--          <vxe-table-column field="clientName" title="委托方" :edit-render="{}">-->
 				<!--            <template v-slot:edit="scope">-->
 				<!--              <el-input :readonly="true" placeholder="请填写委托方" v-model="scope.row.clientName"/>-->

+ 4 - 4
src/views/cw/invoice/InvoiceList.vue

@@ -232,22 +232,22 @@
           </vxe-column>
           <vxe-column min-width="120" title="开票日期" align="center" field="billingDate"></vxe-column>
           <vxe-column min-width="120" title="收款日期" align="center" field="receivablesDate"></vxe-column>
-          <vxe-column min-width="110" fixed="right" align="center" title="是否收款" field="receivablesStatus">
+          <vxe-column min-width="110"  align="center" title="是否收款" field="receivablesStatus">
             <template #default="scope">
               {{$dictUtils.getDictLabel('collect_not', scope.row.receivablesStatus, '')}}
             </template>
           </vxe-column>
-          <vxe-column min-width="110" fixed="right" align="center" title="是否作废" field="invalidStatus">
+          <vxe-column min-width="110"  align="center" title="是否作废" field="invalidStatus">
             <template #default="scope">
               {{scope.row.invalidStatus === '1'?'已作废':'未作废'}}
             </template>
           </vxe-column>
-          <vxe-column  min-width="110px" fixed="right" align="center" title="状态" field="status" >
+          <vxe-column  min-width="110"  align="center" title="状态" field="status" >
             <template #default="scope">
               <el-button @click="invoiceDetail(scope.row)" :type="$dictUtils.getDictLabel('invoice_status_info', scope.row.status, '')" effect="dark" >{{$dictUtils.getDictLabel("invoice_status", scope.row.status, '')}} </el-button>
             </template>
           </vxe-column>
-          <vxe-column min-width="300" title="操作"  fixed="right" align="center">
+          <vxe-column min-width="110" title="操作"  fixed="right" align="center">
             <template  #default="scope">
               <div v-if="isAdmin">
                 <el-button v-if="(scope.row.status === '5')" text type="primary"  @click="editForm(scope.row.id)">修改</el-button>

+ 5 - 0
src/views/cw/invoice/InvoiceUpdateForm.vue

@@ -46,6 +46,11 @@
 						<el-input :readonly="true" placeholder="请填写项目编号" v-model="scope.row.programNo"/>
 					</template>
 				</vxe-table-column>
+				<vxe-table-column field="account" align="center" title="发票金额(元)" :edit-render="{}">
+					<template v-slot:edit="scope">
+						<el-input :disabled="true" placeholder="请填写发票金额" v-model="scope.row.account" @blur="scope.row.account = twoDecimalPlaces(scope.row.account)" maxlength="15"/>
+					</template>
+				</vxe-table-column>
 				<!--          <vxe-table-column field="clientName" title="委托方" :edit-render="{}">-->
 				<!--            <template v-slot:edit="scope">-->
 				<!--              <el-input :readonly="true" placeholder="请填写委托方" v-model="scope.row.clientName"/>-->

+ 0 - 1
src/views/cw/projectRecords/ProjectRecordsForm.vue

@@ -486,7 +486,6 @@
               <vxe-column min-width="150" title="发票号" align="center" field="number"></vxe-column>
               <vxe-column min-width="150" title="实际开票单位" align="center" field="billingWorkplaceReal"></vxe-column>
               <vxe-column min-width="150" title="开票金额(元)" align="center" field="accountDetail"></vxe-column>
-              <vxe-column min-width="150" title="开票总金额(元)" align="center" field="account"></vxe-column>
               <vxe-column min-width="120" title="开票内容" align="center" field="billingContent">
                 <template #default="scope">
                   {{$dictUtils.getDictLabel('invoice_billing_content', scope.row.billingContent, '-')}}