[update] 打包项目维护来款、开票修改

This commit is contained in:
zhaoxiao
2021-09-14 15:31:11 +08:00
parent 757bb11e7a
commit 551473d78f
4 changed files with 296 additions and 124 deletions
@@ -108,9 +108,9 @@
</template>
<span slot="action" class="action-span-cell" slot-scope="text, record">
<a @click="incomePayment(record.id)">来款</a>
<a @click="incomePayment(record)" :disabled="Number(record.receivableAmount) === 0">来款</a>
<a @click="cancelPack(record.id)">取消打包</a>
<a @click="invoicing(record.id)">开票</a>
<a @click="invoicing(record)" :disabled="record.needInvoice === 0 || Number(record.receivableAmount) === 0">开票</a>
</span>
</a-table>
</div>
@@ -118,17 +118,40 @@
</a-card>
<!-- 打包-->
<pack-project-select-project-module :visible.sync="selectPackProjectVisible"
:pack-id="companyDataById.id"
@ok="modalFormOk"></pack-project-select-project-module>
<pack-project-select-project-module
:visible.sync="selectPackProjectVisible"
:pack-id="companyDataById.id"
@ok="modalFormOk"></pack-project-select-project-module>
<!-- 批量来款-->
<batch-income-payment-module ref="batchIncomePaymentModal" @ok="modalFormOk"></batch-income-payment-module>
<batch-income-payment-module
ref="batchIncomePaymentModal"
:table-data="selectedProject"
:visible.sync="incomeVisible"
@ok="modalFormOk"></batch-income-payment-module>
<!-- 批量开票-->
<batch-invoicing-module ref="batchInvoicingModal" @ok="modalFormOk"></batch-invoicing-module>
<batch-invoicing-module
ref="batchInvoicingModal"
:selected-data="selectedProject"
:visible.sync="batchInvoicingVisible"
@ok="modalFormOk"></batch-invoicing-module>
<!-- 来款阶段-->
<arrive-stage-module ref="arriveStage" @ok="modalFormOk"></arrive-stage-module>
<arrive-stage-module
ref="arriveStage"
:project-id="selectProjectId"
:visible.sync="arriveStageVisible"
@ok="modalFormOk"></arrive-stage-module>
<!-- 开票阶段-->
<invoicing-stage-module ref="invoicingStage" @ok="modalFormOk"></invoicing-stage-module>
<invoicing-stage-module
ref="invoicingStage"
:visible.sync="invoicingStageVisible"
:project-id="selectProjectId"
:project-type="selectProjectType"
:project-name="selectProjectName"
@ok="modalFormOk"></invoicing-stage-module>
</div>
</template>
@@ -293,6 +316,15 @@ export default {
],
disableMixinCreated: true,
selectPackProjectVisible: false,
selectedProject: [], // 选中的项目
batchInvoicingVisible: false, // 批量开票对话框开启状态
incomeVisible: false, // 批量来款对话框开启状态
arriveStageVisible: false, // 来款阶段对话框开启状态
invoicingStageVisible: false, // 开票阶段对话框开启状态
selectProjectId: null, // 选中项目id
selectProjectType: null, // 选中项目类型
selectProjectName: null, // 选中项目名称
selectProjectChargeCompanyName: null, // 选中项目来款企业
url: {
list: '/pack/payPackCompanyProject/listAll',
exportXlsUrl: '/pack/payPackCompanyProject/exportXls'
@@ -369,22 +401,39 @@ export default {
* 批量来款
*/
batchIncomePayment() {
this.$refs.batchIncomePaymentModal.open()
this.selectedProject = []
if (this.selectedRowKeys.length === 0) {
this.$message.warn('请选择至少一个项目')
return
}
this.getProjectListBySelectedKeys(this.selectedRowKeys, 'incomePayment').then(res => {
this.selectedProject = res
this.incomeVisible = true
}).catch(message => {
this.$message.warn(message)
}).finally(() => {
this.onClearSelected()
})
},
/**
* 批量开票
*/
batchInvoicing() {
this.$refs.batchInvoicingModal.open()
},
/**
* 来款
* @param id
*/
incomePayment(id) {
console.log(id)
this.$refs.arriveStage.open()
this.selectedProject = []
if (this.selectedRowKeys.length === 0) {
this.$message.warn('请选择至少一个项目')
return
}
this.getProjectListBySelectedKeys(this.selectedRowKeys, 'invoic').then(res => {
this.selectedProject = res
this.batchInvoicingVisible = true
}).catch((message) => {
this.$message.warn(message)
}).finally(() => {
this.onClearSelected()
})
},
/**
* 取消打包
* @param id
@@ -416,12 +465,51 @@ export default {
})
},
/**
* 开票
* @param id
* 来款
* @param record
*/
invoicing(id) {
console.log(id)
this.$refs.invoicingStage.open()
incomePayment(record) {
this.selectProjectId = record.id
this.arriveStageVisible = true
},
/**
* 开票
* @param record
*/
invoicing(record) {
console.log(record)
this.selectProjectName = record.chargeProject
this.selectProjectId = record.id
this.selectProjectType = record.projectType
this.selectProjectChargeCompanyName = this.companyDataById.companyTemporaryName
this.invoicingStageVisible = true
},
/**
* 通过选中项目id获取数据,并进行相应提示
* @param selectedKeys
* @param operateType
* @returns {Promise<unknown>}
*/
getProjectListBySelectedKeys(selectedKeys, operateType) {
return new Promise((resolve, reject) => {
let arr = []
arr = this.dataSource.filter(tt => selectedKeys.indexOf(tt.id) > -1)
// 开票
if (operateType === 'invoic') {
// 是否存在不需要发票的项目
if (arr.some(item => item.needInvoice === 0 || Number(item.receivableAmount) === 0)){
reject('存在不需要发票的项目!')
}
}
// 来款
if (operateType === 'incomePayment') {
// 是否存在应收金额为0的项目
if (arr.some(item => Number(item.receivableAmount) === 0)) {
reject('存在应收金额为0的项目!')
}
}
resolve(arr)
})
}
}
}