[update] 收入合同项目关联接口联调;支出合同页面

This commit is contained in:
zhaoxiao
2021-09-07 16:05:39 +08:00
parent 527bb2f593
commit 4549af906c
16 changed files with 1269 additions and 114 deletions
@@ -0,0 +1,210 @@
<template>
<div >
<a-table
ref="table"
size="middle"
bordered
rowKey="id"
:pagination="false"
:columns="columns"
:scroll="{x: 1500}"
:dataSource="associatedProjectDataSource"
:loading="associatedProjectLoading"
class="j-table-force-nowrap associated-project">
<template slot="text" slot-scope="text">
<j-ellipsis :value="text" :length="20"></j-ellipsis>
</template>
<span slot="action" class="action-span-cell" slot-scope="text, record" v-if="canOperate">
<a @click="unlinkProject(record)">取消关联</a>
</span>
</a-table>
<a-button type="primary" @click="submitAduit" :loading="associatedProjectLoading" v-if="canOperate">提交审核</a-button>
</div>
</template>
<script>
import { cancelAssociatedProject, getAssociatedProject, submitAudit } from '../../../../api/incomePaymentsApi'
export default {
name: 'AssociatedProject',
props: {
// 合同id
contractId: {
type: String,
required: false,
default: ''
},
// 是否可以操作,详情页面不可操作则隐藏按钮
canOperate: {
type: Boolean,
required: false,
default: true
}
},
data() {
return {
// 关联项目列表数据
associatedProjectColumns: [
{
title: '序号',
dataIndex: '',
key: 'rowIndex',
width: 60,
align: 'center',
customRender: function (t, r, index) {
return parseInt(index) + 1
}
}, {
title: '来款项目',
align: 'center',
dataIndex: 'chargeProject',
width: 250
}, {
title: '来款用途',
align: 'center',
dataIndex: 'chargeUse_dictText',
width: 250
}, {
title: '来款单位',
align: 'center',
dataIndex: 'chargeCompanyName',
width: 250
}, {
title: '应收金额',
align: 'center',
dataIndex: 'receivableAmount',
width: 250
}, {
title: '实收金额',
align: 'center',
dataIndex: 'paidAmount',
width: 250
}, {
title: '负责人',
align: 'center',
dataIndex: 'principalName',
width: 250
}, {
title: '企业联系人',
align: 'center',
dataIndex: 'contactsName',
width: 250
}, {
title: '创建时间',
align: 'center',
dataIndex: 'createTime',
width: 250
}, {
title: '操作',
dataIndex: 'action',
align: 'center',
fixed: 'right',
width: 160,
scopedSlots: { customRender: 'action' }
}
],
associatedProjectDataSource: [],
associatedProjectLoading: false, // 关联项目表格加载
}
},
computed: {
columns() {
if (this.canOperate) {
return this.associatedProjectColumns
} else {
return this.associatedProjectColumns.filter(tt => tt.dataIndex !== 'action')
}
}
},
created() {
this.loadAssociatedProject()
},
methods: {
/**
* 取消关联
* @param id
*/
unlinkProject(record) {
console.log(record)
const that = this
this.$confirm({
title: '确认取消关联',
content: '确定取消关联该项目吗?如果是创建的打包项目,那么也会取消打包。',
onOk: function () {
that.associatedProjectLoading = true
const param = {
id: record.id,
contractId: that.contractId
}
cancelAssociatedProject(param).then(res => {
if (res.success) {
that.$message.success(res.message)
} else {
that.$message.warn(res.message)
}
}).finally(() => {
that.associatedProjectLoading = false
that.loadAssociatedProject()
})
}
})
},
/**
* 获取关联项目列表
*/
loadAssociatedProject() {
const param = {
contractId: this.contractId
}
if (!this.canOperate) {
this.associatedProjectColumns.filter(item => item.dataIndex !== 'action')
}
this.associatedProjectLoading = true
getAssociatedProject(param).then(res => {
if (res.success) {
this.associatedProjectDataSource = res.result
} else {
this.$message.warn(res.message)
}
}).finally(() => {
this.associatedProjectLoading = false
})
},
/**
* 提交审核
*/
submitAduit() {
if (this.associatedProjectDataSource.length === 0) {
this.$message.warn('请至少关联一个项目')
return
}
this.confirmLoading = true
this.associatedProjectLoading = true
const param = {
id: this.contractId,
status: 2
}
submitAudit(param).then(res => {
if (res.success) {
this.$message.success(res.message)
this.$router.go(-1)
} else {
this.$message.warn(res.message)
}
}).finally(() => {
this.confirmLoading = false
this.associatedProjectLoading = false
})
}
}
}
</script>
<style scoped lang="less">
.associated-project {
padding-bottom: 20px;
}
</style>
@@ -17,12 +17,12 @@
@change="e => {e.target.value = (e.target.value + '').trim()}"></a-input>
</a-form-item>
<a-form-item label="审核" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-radio-group v-decorator="['contractStatus', validatorRules.contractStatus]">
<a-radio :value="0">通过</a-radio>
<a-radio :value="1">拒绝</a-radio>
<a-radio-group v-decorator="['contractStatus', validatorRules.contractStatus]" @change="contractAuditStatuChange">
<a-radio :value="3">通过</a-radio>
<a-radio :value="4">拒绝</a-radio>
</a-radio-group>
</a-form-item>
<a-form-item label="拒绝说明" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-form-item label="拒绝说明" :labelCol="labelCol" :wrapperCol="wrapperCol" v-if="showExplainRemarks">
<a-textarea
placeholder="请输入拒绝说明"
v-decorator="['explainRemarks', validatorRules.explainRemarks]"
@@ -36,6 +36,9 @@
<script>
import { aduitRevenueContract } from '../../../../api/incomePaymentsApi'
import { USER_INFO } from '../../../../store/mutation-types'
import Vue from 'vue'
import pick from 'lodash.pick'
export default {
name: 'RevenueContractAduitModule',
@@ -47,6 +50,7 @@ export default {
confirmLoading: false,
form: this.$form.createForm(this),
contractId: '',
model: {},
labelCol: {
xs: { span: 24 },
sm: { span: 4 }
@@ -68,7 +72,8 @@ export default {
rules: [{ required: true, message: '请输入拒绝说明' }],
validateTrigger: 'blur'
}
}
},
showExplainRemarks: false
}
},
methods: {
@@ -97,10 +102,30 @@ export default {
this.close()
},
open() {
let userInfo = Vue.ls.get(USER_INFO)
console.log(userInfo)
this.model.userName = userInfo.realname
this.visible = true
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model, 'userName'))
})
},
close() {
this.visible = false
},
/**
* 控制拒绝说明显隐
* @param e
*/
contractAuditStatuChange(e) {
console.log(e.target.value)
if (e.target.value === 3) {
this.showExplainRemarks = false
return
}
if (e.target.value === 4) {
this.showExplainRemarks = true
}
}
}
}
@@ -121,6 +121,7 @@
<div class="part-title">
<div class="part-title-text">关联项目</div>
</div>
<associated-project ref="associatedProject" :contract-id="$route.query.revenueId" :can-operate="false"></associated-project>
</div>
<a-divider></a-divider>
@@ -146,10 +147,11 @@
import IconImg from '@/assets/imgs/icon/icon_revenue_contract.png'
import PageHeaderTitle from '@/components/layouts/PageHeaderTitle'
import { getRevenueContractById } from '../../../../api/incomePaymentsApi'
import AssociatedProject from './AssociatedProject'
export default {
name: 'RevenueContractDetail',
components: { PageHeaderTitle },
components: { PageHeaderTitle, AssociatedProject },
data() {
return {
IconImg,
@@ -252,8 +254,9 @@ export default {
return this.otherInfoList.filter(item => this.detailData[item.fieldName] && this.detailData[item.fieldName] !== '') || []
}
},
created() {
mounted() {
this.initDetailData(this.$route.query.revenueId)
this.$refs.associatedProject.loadAssociatedProject()
},
methods: {
initDetailData(id) {
@@ -219,7 +219,7 @@
<div class="part-title">
<div class="part-title-text">分期信息</div>
</div>
<installment-form ref="installmentForm" @ok="installmentFormOk" :disabled="isSaved"></installment-form>
<installment-form ref="installmentForm" @ok="installmentFormOk"></installment-form>
</div>
<!-- /分期信息-->
<a-form-item class="table-operator">
@@ -235,12 +235,21 @@
<a-card :bordered="false" v-if="isSaved" class="associated-project">
<div class="part-title">
<div class="part-title-text">关联项目</div>
<a-button type="link" @click="chooseProject">选择项目</a-button>
<a-button type="link" @click="chooseProject">选择项目
<a-icon type="right"></a-icon>
</a-button>
</div>
<associated-project
:contract-id="contractId"
ref="associatedProject"></associated-project>
</a-card>
<!-- 项目类型选择-->
<project-type-selection ref="projectTypeSelection" @ok="selectProjectTypeOk"></project-type-selection>
<select-project-module ref="selectProjectModule"></select-project-module>
<!-- 项目选择-->
<select-project-module ref="selectProjectModule"
@ok="selectProjectOk"
:default-charge-company="selectedCompany"></select-project-module>
</div>
</template>
@@ -260,6 +269,7 @@ import { getAllUserList } from '../../../../api/api'
import { postAction } from '../../../../api/manage'
import { getRevenueContractById } from '../../../../api/incomePaymentsApi'
import { duplicateCheck } from '../../../../api/api'
import AssociatedProject from './AssociatedProject'
// 普通项目表头
const generalProjectColumns = [
@@ -342,13 +352,6 @@ const generalProjectColumns = [
width: 80,
dataIndex: 'mail',
scopedSlots: { customRender: 'status' }
}, {
title: '操作',
dataIndex: 'action',
align: 'center',
fixed: 'right',
width: 160,
scopedSlots: { customRender: 'action' }
}
]
// 工作组项目表头
@@ -377,13 +380,6 @@ const workingProjectColumns = [
dataIndex: 'obj',
width: 250,
scopedSlots: { customRender: 'rateOfProgress' }
}, {
title: '操作',
dataIndex: 'action',
align: 'center',
fixed: 'right',
width: 180,
scopedSlots: { customRender: 'action' }
}
]
// 会议项目表头
@@ -402,7 +398,8 @@ export default {
JYearDate,
InstallmentForm,
ProjectTypeSelection,
SelectProjectModule
SelectProjectModule,
AssociatedProject
},
data() {
return {
@@ -464,8 +461,8 @@ export default {
url: {
add: '/contract/payIncomeContract/add',
edit: '/contract/payIncomeContract/edit',
generalProjectList: '/project/payCommonProject/list',
workingGroupProjectList: '/project/payWorkingGroup/list',
generalProjectList: '/project/payCommonProject/listAll', // 普通项目
workingGroupProjectList: '/project/payWorkingGroup/queryListByCompany', // 工作组项目
meetingProjectList: '',
memberProjectList: ''
},
@@ -477,12 +474,15 @@ export default {
amountReceivedNum: null, // 输入的未收金额
contractAmountNum: null, // 输入的签订合同总金额
rateNum: null, // 输入的税率
selectedContact: null
selectedContact: null,
associatedProjectLoading: false,
contractId: '' // 收入合同id
}
},
mounted() {
if (this.$route.query.hasOwnProperty.call(this.$route.query, 'revenueId')) {
this.edit(this.$route.query.revenueId)
this.contractId = this.$route.query.revenueId
this.edit(this.contractId)
} else {
this.add()
}
@@ -490,7 +490,7 @@ export default {
methods: {
add() {
this.title = '新建收入合同'
this.$refs.installmentForm.initInstallmentList({})
this.$refs.installmentForm.initInstallmentList([])
},
edit(id) {
this.title = '编辑收入合同'
@@ -529,7 +529,7 @@ export default {
this.form.validateFields((err, values) => {
if (!err) {
this.confirmLoading = true
if (this.installmentList.length > 0) {
if (this.installmentList && this.installmentList.length > 0) {
let formData = {}
values.signedCompanyId = values.signedCompany.id
delete values.signedCompany
@@ -544,6 +544,8 @@ export default {
}
postAction(url, formData).then(res => {
if (res.success) {
this.contractId = res.result.id
this.edit(this.contractId)
this.$message.success(res.message)
// 保存上方表单信息,(应该在表单验证完全正确时置为true)
this.isSaved = true
@@ -553,6 +555,8 @@ export default {
}).finally(() => {
this.confirmLoading = false
})
} else {
this.confirmLoading = false
}
}
})
@@ -721,16 +725,27 @@ export default {
chooseProject() {
this.$refs.projectTypeSelection.open()
},
/**
* 项目类型选择回调,动态传入表头数据
* @param type
*/
selectProjectTypeOk(type) {
let title = ''
switch (type) {
case 1:
this.$refs.selectProjectModule.columns = generalProjectColumns
this.$refs.selectProjectModule.filters = {
chargeCompanyId: this.selectedCompany.id,
pack: this.model.pack
}
this.$refs.selectProjectModule.url.list = this.url.generalProjectList
title = '普通项目列表'
break
case 2:
this.$refs.selectProjectModule.columns = workingProjectColumns
this.$refs.selectProjectModule.filters = {
companyId: this.selectedCompany.id
}
this.$refs.selectProjectModule.url.list = this.url.workingGroupProjectList
title = '工作组项目列表'
break
@@ -745,9 +760,17 @@ export default {
title = '会员项目列表'
break
}
this.$refs.selectProjectModule.contractId = this.model.id
this.$refs.selectProjectModule.projectType = type
this.$refs.selectProjectModule.title = title
this.$refs.selectProjectModule.open()
},
/**
* 项目选中回调
*/
selectProjectOk() {
this.$refs.associatedProject.loadAssociatedProject()
}
}
}
@@ -763,4 +786,8 @@ export default {
.ant-divider-horizontal {
margin: 20px 0;
}
.ant-btn > .anticon + span, .ant-btn > span + .anticon {
margin-left: 0;
}
</style>
@@ -62,36 +62,50 @@
<!-- 表格区域-->
<div>
<a-table
ref="table"
size="middle"
bordered
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:pagination="ipagination"
:loading="loading"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type: 'radio'}"
@change="handleTableChange"
class="j-table-force-nowrap">
<template slot="htmlSlot" slot-scope="text">
<div v-html="text"></div>
</template>
<template slot="imgSlot" slot-scope="text">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
<img v-else :src="getImgView(text)" height="25px" alt=""
style="max-width:80px;font-size: 12px;font-style: italic;"/>
</template>
<template slot="fileSlot" slot-scope="text,record">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
<j-ellipsis @click.native="uploadFile(record.chargeNoticeFileId)" style="color:#219AFF;cursor: pointer"
:value="text" :length="20"/>
</template>
ref="table"
size="middle"
bordered
rowKey="id"
:scroll="{x: 800}"
:columns="columns"
:dataSource="dataSource"
:pagination="false"
:loading="loading"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
@change="handleTableChange"
class="j-table-force-nowrap">
<template slot="text" slot-scope="text">
<j-ellipsis :value="text" :length="30"></j-ellipsis>
<j-ellipsis :value="text" :length="18"></j-ellipsis>
</template>
<!-- 打包、需要发票、到账、开票、邮寄状态-->
<template slot="status" slot-scope="text,record">
<status-slot :statu-obj="record" :status-no="text" :status-type="true"></status-slot>
</template>
<!-- 进度-->
<template slot="rateOfProgress" slot-scope="text">
<progress-bar :data="text"></progress-bar>
</template>
<template slot="status-pack" slot-scope="text,record">
<status-slot :statu-obj="record" :status-no="text"></status-slot>
</template>
</a-table>
</div>
<!-- /表格区域-->
<!-- 普通项目新增-->
<general-project-module ref="generalProjectForm"
v-bind="$attrs"
:disabled-charge-company="true"
@ok="modalFormOk"></general-project-module>
<!-- 工作组项目新增-->
<working-group-member-unit-module ref="workingGroupMemberForm"
@ok="modalFormOk"
v-bind="$attrs"
:disabled-charge-company="true"
:default-charge-way="2"></working-group-member-unit-module>
</j-modal>
</template>
@@ -99,10 +113,15 @@
import { JeroListMixin } from '../../../../mixins/JeroListMixin'
import SelectPrincipal from '../../../../components/company/SelectPrincipal'
import JYearDate from '../../../../components/jero/JYearDate'
import GeneralProjectModule from '../../../projectManagement/modules/GeneralProjectModule'
import StatusSlot from '../../../../components/tools/StatusSlot'
import { associatedProject } from '../../../../api/incomePaymentsApi'
import WorkingGroupMemberUnitModule from '../../../projectManagement/modules/WorkingGroupMemberUnitModule'
import ProgressBar from '../../../../components/ProgressBar'
export default {
name: 'SelectProjectModule',
components: { SelectPrincipal, JYearDate },
components: { SelectPrincipal, JYearDate, GeneralProjectModule, StatusSlot, WorkingGroupMemberUnitModule, ProgressBar },
mixins: [JeroListMixin],
data() {
return {
@@ -119,7 +138,9 @@ export default {
xs: { span: 24 },
sm: { span: 10 }
},
projectType: null,
projectType: null, // 项目类型,1--普通项目;2--工作组项目;3--会议项目;4--会员项目
disableMixinCreated: true,
contractId: '', // 收入合同id
url: {
list: ''
}
@@ -127,20 +148,56 @@ export default {
},
methods: {
open() {
this.loadData()
this.visible = true
console.log(this.columns)
},
close() {
this.visible = false
},
handleOk() {
if (this.selectedRowKeys.length <= 0) {
this.$message.warn('请选择项目后再提交关联')
return
}
let submitData = []
let projectItem
this.selectedRowKeys.forEach(item => {
projectItem = {
contractId: this.contractId,
projectId: item,
projectType: this.projectType
}
submitData.push(projectItem)
})
associatedProject(submitData).then(res => {
if (res.success) {
this.$message.success(res.message)
this.close()
this.$emit('ok')
} else {
this.$message.warn(res.message)
}
})
},
handleCancel() {
this.close()
},
/**
* 打开不同类型项目的新增module
*/
handleAdd() {
switch (this.projectType) {
case 1:
this.$refs.generalProjectForm.add()
this.$refs.generalProjectForm.title = '新增'
this.$refs.generalProjectForm.disableSubmit = false
break
case 2:
this.$refs.workingGroupMemberForm.add()
this.$refs.workingGroupMemberForm.title = '新增'
this.$refs.workingGroupMemberForm.disableSubmit = false
break
}
}
}
}