[update] 支出合同接口联调;打包、打包成员维护页面;企业选择组件只读
This commit is contained in:
@@ -0,0 +1,265 @@
|
||||
<template>
|
||||
<j-modal
|
||||
:title="title"
|
||||
:width="width"
|
||||
:visible="visible"
|
||||
:confirmLoading="confirmLoading"
|
||||
switchFullscreen
|
||||
@ok="handleOk"
|
||||
@cancel="handleCancel"
|
||||
cancelText="关闭">
|
||||
<a-spin :spinning="confirmLoading">
|
||||
<a-form :form="form">
|
||||
<a-row>
|
||||
<a-col :xl="12" :sm="24">
|
||||
<a-form-item label="来款金额" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<a-input placeholder="请输入来款金额"
|
||||
v-decorator="['incomingAmount', validatorRules.incomingAmount]"
|
||||
:maxLength='50'
|
||||
@change="(e) => {e.target.value = (e.target.value.replace(/[^0-9.]/g,'')).trim()}"
|
||||
@blur="incomingAmountBlur"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xl="12" :sm="24">
|
||||
<a-form-item label="来款日期" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<j-date placeholder="请选择来款日期"
|
||||
style="width: 100%;"
|
||||
v-decorator="['paymentDate', validatorRules.paymentDate]"
|
||||
:trigger-change="true"
|
||||
date-format="YYYY-MM-DD"/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
<!-- /查询区域-->
|
||||
|
||||
<!-- 表格区域-->
|
||||
<div>
|
||||
<!-- :scroll="{x: 1000}"-->
|
||||
<a-table
|
||||
ref="table"
|
||||
size="middle"
|
||||
bordered
|
||||
rowKey="id"
|
||||
:columns="columns"
|
||||
|
||||
:dataSource="dataSource"
|
||||
:pagination="ipagination"
|
||||
:loading="loading"
|
||||
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
|
||||
@change="handleTableChange"
|
||||
class="j-table-force-nowrap">
|
||||
|
||||
<!-- 输入-->
|
||||
<template slot="input-text">
|
||||
<a-input placeholder="请输入备注"
|
||||
v-decorator="['remark']"
|
||||
:maxLength='50'
|
||||
@change="e => {e.target.value = (e.target.value + '').trim()}"></a-input>
|
||||
</template>
|
||||
|
||||
<template slot="text" slot-scope="text">
|
||||
<j-ellipsis :value="text" :length="18"></j-ellipsis>
|
||||
</template>
|
||||
</a-table>
|
||||
</div>
|
||||
</a-spin>
|
||||
</j-modal>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { JeroListMixin } from '../../../mixins/JeroListMixin'
|
||||
import JDate from '../../../components/tools/JDate'
|
||||
import { money } from '../../../utils/validate'
|
||||
|
||||
export default {
|
||||
name: 'BatchIncomePaymentModule',
|
||||
components: { JDate },
|
||||
mixins: [JeroListMixin],
|
||||
data() {
|
||||
return {
|
||||
title: '批量来款',
|
||||
width: 1000,
|
||||
visible: false,
|
||||
confirmLoading: false,
|
||||
form: this.$form.createForm(this),
|
||||
labelCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 6 }
|
||||
},
|
||||
wrapperCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 18 }
|
||||
},
|
||||
url: {
|
||||
list: ''
|
||||
},
|
||||
validatorRules: {
|
||||
incomingAmount: {
|
||||
rules: [{ required: true, validator: this.checkMoney }],
|
||||
validateTrigger: 'blur'
|
||||
},
|
||||
paymentDate: {
|
||||
rules: [{ required: true, message: '请选择来款日期' }],
|
||||
validateTrigger: 'change'
|
||||
}
|
||||
},
|
||||
columns: [
|
||||
{
|
||||
title: '序号',
|
||||
dataIndex: '',
|
||||
key: 'rowIndex',
|
||||
width: 60,
|
||||
align: 'center',
|
||||
customRender: function (t, r, index) {
|
||||
return parseInt(index) + 1
|
||||
}
|
||||
}, {
|
||||
title: '项目名称',
|
||||
align: 'center',
|
||||
// width: 200,
|
||||
dataIndex: 'chargeProject',
|
||||
scopedSlots: { customRender: 'text' }
|
||||
}, {
|
||||
title: '应收金额',
|
||||
align: 'center',
|
||||
width: 100,
|
||||
dataIndex: 'receivableAmount'
|
||||
}, {
|
||||
title: '实收金额',
|
||||
align: 'center',
|
||||
width: 100,
|
||||
dataIndex: 'paidAmount'
|
||||
}, {
|
||||
title: '欠款金额',
|
||||
align: 'center',
|
||||
width: 100,
|
||||
dataIndex: 'amountOwed'
|
||||
}, {
|
||||
title: '本次来款金额',
|
||||
align: 'center',
|
||||
width: 140,
|
||||
dataIndex: 'thisIncomingAmount'
|
||||
}, {
|
||||
title: '备注',
|
||||
align: 'center',
|
||||
width: 200,
|
||||
dataIndex: 'remark',
|
||||
scopedSlots: { customRender: 'input-text' }
|
||||
}
|
||||
],
|
||||
inputIncomingAmount: null, // 输入的来款金额
|
||||
dataSource: [
|
||||
{
|
||||
id: 1,
|
||||
chargeProject: '项目名称',
|
||||
receivableAmount: 100,
|
||||
paidAmount: 0,
|
||||
thisIncomingAmount: null,
|
||||
remark: ''
|
||||
}, {
|
||||
id: 2,
|
||||
chargeProject: '项目名称2',
|
||||
receivableAmount: 200,
|
||||
paidAmount: 0,
|
||||
thisIncomingAmount: null,
|
||||
remark: ''
|
||||
}, {
|
||||
id: 3,
|
||||
chargeProject: '项目名称3',
|
||||
receivableAmount: 5000,
|
||||
paidAmount: 0,
|
||||
thisIncomingAmount: null,
|
||||
remark: ''
|
||||
}
|
||||
],
|
||||
disableMixinCreated: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
loadData() {
|
||||
// 计算项目欠款信息
|
||||
this.dataSource.forEach(item => {
|
||||
item.amountOwed = Number(item.receivableAmount) - Number(item.paidAmount)
|
||||
})
|
||||
this.$forceUpdate()
|
||||
},
|
||||
handleOk() {
|
||||
|
||||
},
|
||||
handleCancel() {
|
||||
this.close()
|
||||
},
|
||||
open() {
|
||||
this.loadData()
|
||||
this.visible = true
|
||||
},
|
||||
close() {
|
||||
this.visible = false
|
||||
},
|
||||
incomingAmountBlur(e) {
|
||||
e.target.value = (e.target.value.replace(/[^0-9.]/g, '')).trim()
|
||||
this.inputIncomingAmount = Number(e.target.value)
|
||||
this.clearThisTimeAmount().then(() => {
|
||||
this.calculateThisTimeAmount()
|
||||
})
|
||||
},
|
||||
clearThisTimeAmount() {
|
||||
return new Promise(resolve => {
|
||||
this.dataSource.forEach(item => {
|
||||
item.thisIncomingAmount = null
|
||||
})
|
||||
resolve()
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 计算此次来款信息
|
||||
*/
|
||||
calculateThisTimeAmount() {
|
||||
if (this.inputIncomingAmount <= 0) {
|
||||
this.$message.warn('请输入大于0的来款金额')
|
||||
return
|
||||
}
|
||||
this.dataSource.forEach(item => {
|
||||
// 当前项目欠款是否 >0
|
||||
if (Number(item.amountOwed) > 0) {
|
||||
// 输入的来款金额是否 >= 当前项目欠款
|
||||
if (this.inputIncomingAmount >= Number(item.amountOwed)) {
|
||||
item.thisIncomingAmount = Number(item.amountOwed)
|
||||
this.inputIncomingAmount -= Number(item.amountOwed)
|
||||
// item.amountOwed = 0
|
||||
} else {
|
||||
// 输入的来款金额小于当前项目欠款且剩余的输入来款金额大于0,则将剩余全部来款算入当前项目的此次来款
|
||||
if (this.inputIncomingAmount > 0) {
|
||||
item.thisIncomingAmount = this.inputIncomingAmount
|
||||
// item.amountOwed = Number(item.amountOwed) - item.thisIncomingAmount
|
||||
this.inputIncomingAmount = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
,
|
||||
/**
|
||||
* 校验金额格式
|
||||
* @param rules
|
||||
* @param value
|
||||
* @param callback
|
||||
*/
|
||||
checkMoney(rules, value, callback) {
|
||||
if (value) {
|
||||
if (money(value)) {
|
||||
callback()
|
||||
return
|
||||
}
|
||||
callback('请输入正确格式的金额')
|
||||
}
|
||||
callback('请输入来款金额')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
Reference in New Issue
Block a user