普通项目;工作组变更--文件维护接口;批量开票
This commit is contained in:
@@ -47,6 +47,7 @@
|
||||
<!-- 操作按钮区域-->
|
||||
<div class="table-operator">
|
||||
<a-button type="primary" icon="export" @click="handleExportXls('到账开票')">导出</a-button>
|
||||
<a-button type="primary" icon="file-text" @click="batchInvoicing">合并开票</a-button>
|
||||
</div>
|
||||
<!-- 操作按钮区域-end-->
|
||||
|
||||
@@ -87,7 +88,7 @@
|
||||
|
||||
<span slot="action" class="action-span-cell" slot-scope="text, record">
|
||||
<a @click="incomePayment(record.id)">来款</a>
|
||||
<a @click="invoicing(record)">开票</a>
|
||||
<a @click="invoicing(record)" :disabled="record.needInvoice === 0">开票</a>
|
||||
</span>
|
||||
</a-table>
|
||||
</div>
|
||||
@@ -108,6 +109,11 @@
|
||||
:visible.sync="invoicingVisible"
|
||||
:charge-company-name="selectProjectChargeCompanyName"></invoicing-stage-module>
|
||||
<project-detail-modal ref="projectDetail"></project-detail-modal>
|
||||
<!-- 批量开票-->
|
||||
<batch-invoicing-module
|
||||
:selected-data="selectedProject"
|
||||
:visible.sync="batchInvoicingVisible">
|
||||
</batch-invoicing-module>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -121,6 +127,8 @@ import ArriveStageModule from './modules/ArriveStageModule'
|
||||
import InvoicingStageModule from './modules/InvoicingStageModule'
|
||||
import SelectPrincipal from '../../../components/company/SelectPrincipal'
|
||||
import ProjectDetailModal from '../../../components/ProjectDetailModal'
|
||||
import BatchInvoicingModule from '../../packManagement/modules/BatchInvoicingModule'
|
||||
import { isAllEqual } from '../../../utils/util'
|
||||
|
||||
export default {
|
||||
name: 'ArriveAndInvoivingList',
|
||||
@@ -131,7 +139,8 @@ export default {
|
||||
ArriveStageModule,
|
||||
InvoicingStageModule,
|
||||
SelectPrincipal,
|
||||
ProjectDetailModal
|
||||
ProjectDetailModal,
|
||||
BatchInvoicingModule
|
||||
},
|
||||
mixins: [JeroListMixin],
|
||||
data() {
|
||||
@@ -237,7 +246,9 @@ export default {
|
||||
selectProjectName: null, // 选中项目名称open
|
||||
selectProjectChargeCompanyName: null, // 选中项目来款企业
|
||||
invoicingVisible: false,
|
||||
arriveVisible: false
|
||||
arriveVisible: false,
|
||||
selectedProject: [],
|
||||
batchInvoicingVisible: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -260,6 +271,61 @@ export default {
|
||||
this.selectProjectName = record.chargeProject
|
||||
this.selectProjectChargeCompanyName = record.chargeCompanyTemporaryName
|
||||
this.invoicingVisible = true
|
||||
},
|
||||
/**
|
||||
* 批量开票
|
||||
*/
|
||||
batchInvoicing() {
|
||||
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()
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 通过选中项目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('存在不需要发票的项目!')
|
||||
}
|
||||
// 是否存在企业不同的项目
|
||||
let companyArr = []
|
||||
arr.forEach(item => {
|
||||
companyArr.push(item.chargeCompanyTemporaryName)
|
||||
})
|
||||
// 选中项目非同一企业
|
||||
if (!isAllEqual(companyArr)) {
|
||||
reject('请选择来款单位为同一企业的项目合并开票')
|
||||
}
|
||||
}
|
||||
// 来款
|
||||
if (operateType === 'incomePayment') {
|
||||
// 是否存在应收金额为0的项目
|
||||
if (arr.some(item => Number(item.receivableAmount) === 0)) {
|
||||
reject('存在应收金额为0的项目!')
|
||||
}
|
||||
}
|
||||
resolve(arr)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user