|
@@ -11,6 +11,7 @@
|
|
|
<el-row :gutter="15">
|
|
|
<vxe-table
|
|
|
border
|
|
|
+ :footer-method="footerMethod2"
|
|
|
show-overflow
|
|
|
show-footer
|
|
|
ref="baseTable"
|
|
@@ -21,6 +22,7 @@
|
|
|
@cell-click=""
|
|
|
@edit-closed=""
|
|
|
highlight-current-row
|
|
|
+ :edit-rules="tableRules"
|
|
|
:edit-config="{trigger: 'click', mode: 'cell', showStatus: true, autoClear: true, icon: '-'}"
|
|
|
>
|
|
|
<vxe-table-column field="programName" align="center" title="项目名称" :edit-render="{}">
|
|
@@ -38,6 +40,14 @@
|
|
|
<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 :readonly="false" 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"/>-->
|
|
@@ -55,6 +65,7 @@
|
|
|
</vxe-table-column>
|
|
|
</vxe-table>
|
|
|
</el-row>
|
|
|
+
|
|
|
<el-divider content-position="left"><i class="el-icon-document"></i> 发票详情</el-divider>
|
|
|
<el-row :gutter="15">
|
|
|
<el-col :span="12">
|
|
@@ -242,31 +253,31 @@
|
|
|
</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
|
|
|
- @input="fixedAccount"
|
|
|
- placeholder="请填写发票金额"
|
|
|
- maxlength="15"
|
|
|
- v-model="inputForm.account"
|
|
|
- >
|
|
|
- </el-input>
|
|
|
-<!-- <el-input-number-->
|
|
|
-<!-- v-model="inputForm.account"-->
|
|
|
-<!-- controls-position="right"-->
|
|
|
-<!-- :controls="false"-->
|
|
|
-<!-- style="width:100%;"-->
|
|
|
-<!-- :max="999999999999999"-->
|
|
|
-<!-- :precision="2"-->
|
|
|
+<!-- <el-col :span="12">-->
|
|
|
+<!-- <el-form-item label="发票金额(元)" prop="account"-->
|
|
|
+<!-- :rules="[-->
|
|
|
+<!-- {required: true, message:'发票金额不能为空', trigger:'blur'}-->
|
|
|
+<!-- ]">-->
|
|
|
+<!-- <el-input-->
|
|
|
+<!-- @input="fixedAccount"-->
|
|
|
<!-- placeholder="请填写发票金额"-->
|
|
|
-<!-- :step="0.01"-->
|
|
|
-<!-- clearable>-->
|
|
|
-<!-- </el-input-number>-->
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
+<!-- maxlength="15"-->
|
|
|
+<!-- v-model="inputForm.account"-->
|
|
|
+<!-- >-->
|
|
|
+<!-- </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">
|
|
|
<el-form-item label="是否多张开票" prop="isMultiple"
|
|
|
:rules="[
|
|
@@ -642,6 +653,7 @@
|
|
|
import SelectUserTree from '@/views/modules/utils/treeUserSelect'
|
|
|
import SelectTree from '@/components/treeSelect/treeSelect.vue'
|
|
|
import WorkClientBillingChooseRadio from '@/views/modules/cw/workClientInfo/WorkClientBillingChooseRadio'
|
|
|
+ import XEUtils from 'xe-utils'
|
|
|
|
|
|
export default {
|
|
|
props: {
|
|
@@ -660,11 +672,17 @@
|
|
|
},
|
|
|
data () {
|
|
|
return {
|
|
|
+ tableRules: {
|
|
|
+ account: [
|
|
|
+ { required: true, message: '请填写发票金额' }
|
|
|
+ ]
|
|
|
+ },
|
|
|
title: '',
|
|
|
method: '',
|
|
|
visible: false,
|
|
|
loading: false,
|
|
|
inputForm: {
|
|
|
+ actualPrice: '',
|
|
|
id: '',
|
|
|
financeInvoiceBaseDTOList: [],
|
|
|
programName: '',
|
|
@@ -771,6 +789,7 @@
|
|
|
this.importVisible = false
|
|
|
this.method = method
|
|
|
this.inputForm = {
|
|
|
+ actualPrice: '',
|
|
|
id: '',
|
|
|
financeInvoiceBaseDTOList: [],
|
|
|
programName: '',
|
|
@@ -891,7 +910,8 @@
|
|
|
this.inputForm.financeInvoiceDetailDTOList.push({
|
|
|
code: '',
|
|
|
number: '',
|
|
|
- account: this.inputForm.account,
|
|
|
+ account: this.inputForm.actualPrice,
|
|
|
+ // account: this.inputForm.account,
|
|
|
rate: '',
|
|
|
amount: '',
|
|
|
tax: '',
|
|
@@ -953,6 +973,7 @@
|
|
|
this.loading = false
|
|
|
throw new Error()
|
|
|
}
|
|
|
+ this.inputForm.account = this.inputForm.actualPrice
|
|
|
if (status === 'save') {
|
|
|
// 暂存
|
|
|
this.loading = true
|
|
@@ -993,6 +1014,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') {
|
|
@@ -1323,7 +1349,8 @@
|
|
|
// 获取发票金额,放到开票明细中第一条数据
|
|
|
getTotalAccount () {
|
|
|
if (!this.commonJS.isEmpty(this.inputForm.account)) {
|
|
|
- this.financeInvoiceDetailDTOList.push({account: this.inputForm.account})
|
|
|
+ this.financeInvoiceDetailDTOList.push({account: this.inputForm.actualPrice})
|
|
|
+ // this.financeInvoiceDetailDTOList.push({account: this.inputForm.account})
|
|
|
}
|
|
|
},
|
|
|
async updateStatusById (type, callback) {
|
|
@@ -1514,6 +1541,56 @@
|
|
|
var result = this.inputForm.account.replace(reg, regStrs[i][1])
|
|
|
this.inputForm.account = result
|
|
|
}
|
|
|
+ },
|
|
|
+ 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.actualPrice = XEUtils.sum(data, column.property)
|
|
|
+ return XEUtils.sum(data, column.property)
|
|
|
+ }
|
|
|
+ if (['actualPrice'].includes(column.property)) {
|
|
|
+ // eslint-disable-next-line no-undef
|
|
|
+ this.inputForm.actualPrice = XEUtils.sum(data, column.property)
|
|
|
+ return XEUtils.sum(data, column.property)
|
|
|
+ }
|
|
|
+ return null
|
|
|
+ })
|
|
|
+ ]
|
|
|
+ console.log('actualPrice', this.inputForm.actualPrice)
|
|
|
+ return footerData
|
|
|
+ },
|
|
|
+ twoDecimalPlaces (num) {
|
|
|
+ let str = num.toString()
|
|
|
+ var len1 = str.substr(0, 1)
|
|
|
+ var len2 = str.substr(1, 1)
|
|
|
+ // eslint-disable-next-line eqeqeq
|
|
|
+ if (str.length > 1 && len1 == 0 && len2 != '.') {
|
|
|
+ str = str.substr(1, 1)
|
|
|
+ }
|
|
|
+ // eslint-disable-next-line eqeqeq
|
|
|
+ if (len1 == '.') {
|
|
|
+ str = ''
|
|
|
+ }
|
|
|
+ // eslint-disable-next-line eqeqeq
|
|
|
+ if (str.indexOf('.') != -1) {
|
|
|
+ var str_ = str.substr(str.indexOf('.') + 1)
|
|
|
+ // eslint-disable-next-line eqeqeq
|
|
|
+ if (str_.indexOf('.') != -1) {
|
|
|
+ str = str.substr(0, str.indexOf('.') + str_.indexOf('.') + 1)
|
|
|
+ }
|
|
|
+ if (str_.length > 2) {
|
|
|
+ this.$message.warning(`金额小数点后只能输入两位,请正确输入!`)
|
|
|
+ return (str = '')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // eslint-disable-next-line no-useless-escape
|
|
|
+ str = str.replace(/[^\d^\.]+/g, '') // 保留数字和小数点
|
|
|
+ return str
|
|
|
}
|
|
|
}
|
|
|
}
|