update 起草组成员信息对接
This commit is contained in:
@@ -12,11 +12,11 @@
|
||||
<a-form :form="form">
|
||||
<a-row v-if="defaultChargeWay">
|
||||
<a-col>
|
||||
<a-form-item label="工作组项目" :labelCol="remarksLabelCol" :wrapperCol="remarksWrapperCol">
|
||||
<a-form-item label="起草组项目" :labelCol="remarksLabelCol" :wrapperCol="remarksWrapperCol">
|
||||
<a-select
|
||||
placeholder="请选择工作组项目"
|
||||
placeholder="请选择起草组项目"
|
||||
show-search
|
||||
v-decorator="['workingGroupId',validatorRules.workingGroupId]"
|
||||
v-decorator="['draftingGroupId',validatorRules.draftingGroupId]"
|
||||
:maxLength='50'
|
||||
:filter-option="filterOption"
|
||||
>
|
||||
@@ -40,18 +40,17 @@
|
||||
</a-col>
|
||||
</a-row>
|
||||
<template
|
||||
v-if="model.payWorkingGroupSubItemContactsList && model.payWorkingGroupSubItemContactsList.length > 0">
|
||||
<a-row v-for="(item, index) in model.payWorkingGroupSubItemContactsList" :key="index + ''">
|
||||
v-if="model.payDraftingGroupSubItemContactsList && model.payDraftingGroupSubItemContactsList.length > 0">
|
||||
<a-row v-for="(item, index) in model.payDraftingGroupSubItemContactsList" :key="index + ''">
|
||||
<a-col :xl="12" :sm="24">
|
||||
<a-form-item :label="`企业联系人${index + 1}`" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<select-contacts :selected-company="selectedCompany"
|
||||
:init-contacts="model.payWorkingGroupSubItemContactsList[index]"
|
||||
:init-contacts="model.payDraftingGroupSubItemContactsList[index]"
|
||||
:placeholder="`请选择企业联系人${index + 1}`"
|
||||
v-decorator="[`payWorkingGroupSubItemContactsList[${index}].contactsId`, {rules: [{ required: index === 0, validator: index === 0 ? validateContactRequired : validateContact }],validateTrigger: 'change'}]"
|
||||
v-decorator="[`payDraftingGroupSubItemContactsList[${index}].contactsId`, {rules: [{ required: index === 0, validator: index === 0 ? validateContactRequired : validateContact }],validateTrigger: 'change'}]"
|
||||
:maxLength='50'
|
||||
:ref="`selectContacts${index}`"
|
||||
@ok="addContactsOneOk"
|
||||
@change="value => contactsChange(value, index)"></select-contacts>
|
||||
@ok="addContactsOneOk"></select-contacts>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xl="9" :sm="20">
|
||||
@@ -59,7 +58,7 @@
|
||||
<a-form-item :label="`备注${index + 1}`" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<a-input
|
||||
:placeholder="`请输入备注${index + 1}`"
|
||||
v-decorator="[`payWorkingGroupSubItemContactsList[${index}].remarks`]"
|
||||
v-decorator="[`payDraftingGroupSubItemContactsList[${index}].remarks`]"
|
||||
:maxLength='50'
|
||||
@change="e => {e.target.value = (e.target.value + '').trim()}">
|
||||
</a-input>
|
||||
@@ -104,7 +103,6 @@
|
||||
<script>
|
||||
import pick from 'lodash.pick'
|
||||
import { httpAction } from '@api/manage'
|
||||
import JUpload from '@comp/jero/JUpload'
|
||||
import CompanySelect from '@comp/company/CompanySelect'
|
||||
import SelectContacts from '@comp/company/SelectContacts'
|
||||
import { getWorkingGroupListByNotCompany } from '../../../api/incomePaymentsApi'
|
||||
@@ -112,13 +110,11 @@ import { getWorkingGroupListByNotCompany } from '../../../api/incomePaymentsApi'
|
||||
import { addZero } from '../../../utils/util'
|
||||
import { money } from '../../../utils/validate'
|
||||
import { checkAssociatedProject } from '../../../utils/projectCheck'
|
||||
import SelectRevenueContract from '../../../components/tools/SelectRevenueContract'
|
||||
import JDictSelectTag from '@comp/dict/JDictSelectTag'
|
||||
import { CalcAmountMixin } from '@/mixins/CalcAmountMixin'
|
||||
|
||||
export default {
|
||||
name: 'WorkingGroupMemberUnitModule',
|
||||
components: { JUpload, CompanySelect, SelectContacts, SelectRevenueContract, JDictSelectTag },
|
||||
components: { CompanySelect, SelectContacts },
|
||||
mixins: [CalcAmountMixin],
|
||||
props: {
|
||||
// 默认来款方式(收入合同新增工作组项目,来款方式默认为2--合同)
|
||||
@@ -191,8 +187,8 @@ export default {
|
||||
sm: { span: 20 }
|
||||
},
|
||||
validatorRules: {
|
||||
workingGroupId: {
|
||||
rules: [{ required: true, message: '请选择工作组项目' }],
|
||||
draftingGroupId: {
|
||||
rules: [{ required: true, message: '请选择起草组项目' }],
|
||||
validateTrigger: 'change'
|
||||
},
|
||||
chargeCompany: {
|
||||
@@ -242,9 +238,8 @@ export default {
|
||||
selectedContact2: null, // 编辑时的联系人
|
||||
selectedContact3: null, // 编辑时的联系人
|
||||
selectedMailContact: null, // 编辑时的邮寄联系人
|
||||
chargeNoticeList: [], // 收费通知号list
|
||||
selectedChargeNotice: null, // 选中的收费通知号
|
||||
workingGroupId: null,
|
||||
draftingGroupId: null,
|
||||
workingGroupList: [],
|
||||
disabledCompany: false, // 企业是否禁用
|
||||
isAssociatedContract: false, // 是否关联合同
|
||||
@@ -252,8 +247,8 @@ export default {
|
||||
// hasContactTwo: false, // 是否选择联系人2
|
||||
// hasContactThree: false, // 是否选择联系人3
|
||||
url: {
|
||||
add: '/project/payWorkingGroupSubitem/add',
|
||||
edit: '/project/payWorkingGroupSubitem/edit'
|
||||
add: '/drafting/payDraftingGroupSubitem/add',
|
||||
edit: '/drafting/payDraftingGroupSubitem/edit'
|
||||
},
|
||||
// 默认的联系人数据
|
||||
defaultPayWorkingGroupSubItemContact: {
|
||||
@@ -328,10 +323,10 @@ export default {
|
||||
this.model.contactsIdTwo = this.model.contactsTemporaryIdTwo || undefined
|
||||
this.model.contactsIdThree = this.model.contactsTemporaryIdThree || undefined
|
||||
// 是否存在从收入合同传入的签订联系人id
|
||||
this.model.mailContactsId = this.signedContactId || this.model.mailContactsTemporaryId || undefined
|
||||
// this.model.mailContactsId = this.signedContactId || this.model.mailContactsTemporaryId || undefined
|
||||
if (this.model.id) {
|
||||
// 传给组件的init-contact值,需要id和name两个属性
|
||||
this.model.payWorkingGroupSubItemContactsList && this.model.payWorkingGroupSubItemContactsList.forEach(item => {
|
||||
this.model.payDraftingGroupSubItemContactsList && this.model.payDraftingGroupSubItemContactsList.forEach(item => {
|
||||
item.name = item.contactsTemporaryName
|
||||
})
|
||||
// this.selectedContact1 = {
|
||||
@@ -362,16 +357,15 @@ export default {
|
||||
// }
|
||||
} else {
|
||||
// 新增处理默认显示的三个企业联系人
|
||||
this.model.payWorkingGroupSubItemContactsList = []
|
||||
this.model.payWorkingGroupSubItemContactsList.push(this.defaultPayWorkingGroupSubItemContact)
|
||||
this.model.payWorkingGroupSubItemContactsList.push(this.defaultPayWorkingGroupSubItemContact)
|
||||
this.model.payWorkingGroupSubItemContactsList.push(this.defaultPayWorkingGroupSubItemContact)
|
||||
this.model.payDraftingGroupSubItemContactsList = []
|
||||
this.model.payDraftingGroupSubItemContactsList.push(this.defaultPayWorkingGroupSubItemContact)
|
||||
this.model.payDraftingGroupSubItemContactsList.push(this.defaultPayWorkingGroupSubItemContact)
|
||||
this.model.payDraftingGroupSubItemContactsList.push(this.defaultPayWorkingGroupSubItemContact)
|
||||
}
|
||||
this.chargeWayType = record.chargeWay
|
||||
this.pickChargeNoticeType(record.charge, true)
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue(pick(this.model, 'chargeCompany', 'contactsIdOne', 'contactsIdTwo', 'contactsIdThree', 'mailContactsId', 'chargeWay', 'charge', 'receivableAmount', 'taxRate', 'tax', 'noTaxAmount', 'contractNum', 'receivableAmount', 'chargeNoticeId', 'needInvoice', 'remarks', 'remarksOne', 'remarksTwo', 'remarksThree', 'payWorkingGroupSubItemContactsList'))
|
||||
this.form.setFieldsValue(pick(this.model, 'chargeCompany', 'contactsIdOne', 'contactsIdTwo', 'contactsIdThree', 'remarks', 'remarksOne', 'remarksTwo', 'remarksThree', 'payDraftingGroupSubItemContactsList'))
|
||||
})
|
||||
},
|
||||
close() {
|
||||
@@ -420,13 +414,13 @@ export default {
|
||||
} else {
|
||||
httpurl += this.url.edit
|
||||
}
|
||||
if (this.workingGroupId) {
|
||||
values.workingGroupId = this.workingGroupId
|
||||
if (this.draftingGroupId) {
|
||||
values.draftingGroupId = this.draftingGroupId
|
||||
}
|
||||
// 企业联系人信息中将没有值的去掉
|
||||
let haveValueContactArr = values.payWorkingGroupSubItemContactsList.filter(tt => tt.contactsId)
|
||||
let haveValueContactArr = values.payDraftingGroupSubItemContactsList.filter(tt => tt.contactsId)
|
||||
let obj = {
|
||||
payWorkingGroupSubItemContactsList: haveValueContactArr
|
||||
payDraftingGroupSubItemContactsList: haveValueContactArr
|
||||
}
|
||||
const formData = Object.assign(this.model, values, obj)
|
||||
console.log('表单提交数据', formData)
|
||||
@@ -451,63 +445,6 @@ export default {
|
||||
handleCancel() {
|
||||
this.close()
|
||||
},
|
||||
/**
|
||||
* 来款方式变化
|
||||
* @param e
|
||||
*/
|
||||
handlechargeWayChange(e) {
|
||||
if (e.target.value === 3) {
|
||||
if (this.chargeNoticeList.length === 0) {
|
||||
this.chargeWayType = null
|
||||
this.model.chargeWay = null
|
||||
this.$message.warn('请先补充该工作组的收费通知信息')
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue(pick(this.model, 'chargeWay'))
|
||||
})
|
||||
return
|
||||
}
|
||||
} else {
|
||||
// 清空之前选中的收费通知号
|
||||
this.selectedChargeNotice = null
|
||||
// 清空未税金额 待确收金额 税额
|
||||
this.form.resetFields(['tax', 'noTaxAmount', 'receivableAmount'])
|
||||
}
|
||||
this.chargeWayType = e.target.value
|
||||
},
|
||||
/**
|
||||
* 收费通知号变化, 回显本年应收款和文件
|
||||
*/
|
||||
handleChargeNoticeChange(e) {
|
||||
let key = e.target.value
|
||||
this.pickChargeNoticeType(key)
|
||||
},
|
||||
/**
|
||||
* 匹配收费通知显隐
|
||||
* @param value
|
||||
*/
|
||||
pickChargeNoticeType(key, isFirst) {
|
||||
this.chargeNoticeList.forEach(item => {
|
||||
if (item.type === 'chargeNoticeA' && key === 'a') {
|
||||
this.selectedChargeNotice = 'A'
|
||||
if (!isFirst) {
|
||||
this.model.receivableAmount = item.yearCharge
|
||||
this.model.chargeNoticeId = item.chargeNoticeId
|
||||
}
|
||||
this.model.chargeNoticeNo = item.value
|
||||
} else if (item.type === 'chargeNoticeB' && key === 'b') {
|
||||
this.selectedChargeNotice = 'B'
|
||||
if (!isFirst) {
|
||||
this.model.receivableAmount = item.yearCharge
|
||||
this.model.chargeNoticeId = item.chargeNoticeId
|
||||
}
|
||||
this.model.chargeNoticeNo = item.value
|
||||
}
|
||||
})
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue(pick(this.model, 'receivableAmount', 'chargeNoticeId'))
|
||||
this.calcAmount()
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 选中企业变化,将联系人的值清空
|
||||
* @param value
|
||||
@@ -522,15 +459,15 @@ export default {
|
||||
// this.model.contactsIdTwo = undefined
|
||||
// this.model.contactsIdThree = undefined
|
||||
// 处理默认显示的三个企业联系人
|
||||
this.model.payWorkingGroupSubItemContactsList = []
|
||||
this.model.payWorkingGroupSubItemContactsList.push(this.defaultPayWorkingGroupSubItemContact)
|
||||
this.model.payWorkingGroupSubItemContactsList.push(this.defaultPayWorkingGroupSubItemContact)
|
||||
this.model.payWorkingGroupSubItemContactsList.push(this.defaultPayWorkingGroupSubItemContact)
|
||||
this.model.mailContactsId = undefined
|
||||
this.model.payDraftingGroupSubItemContactsList = []
|
||||
this.model.payDraftingGroupSubItemContactsList.push(this.defaultPayWorkingGroupSubItemContact)
|
||||
this.model.payDraftingGroupSubItemContactsList.push(this.defaultPayWorkingGroupSubItemContact)
|
||||
this.model.payDraftingGroupSubItemContactsList.push(this.defaultPayWorkingGroupSubItemContact)
|
||||
// this.model.mailContactsId = undefined
|
||||
this.selectedMailContact = null
|
||||
this.model.contractNum = undefined
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue(pick(this.model, 'mailContactsId', 'contractNum', 'payWorkingGroupSubItemContactsList'))
|
||||
this.form.setFieldsValue(pick(this.model, 'contractNum', 'payDraftingGroupSubItemContactsList'))
|
||||
})
|
||||
},
|
||||
/**
|
||||
@@ -587,7 +524,7 @@ export default {
|
||||
*/
|
||||
validateContact(rule, value, callback) {
|
||||
if (value) {
|
||||
let contactsList = this.form.getFieldValue('payWorkingGroupSubItemContactsList')
|
||||
let contactsList = this.form.getFieldValue('payDraftingGroupSubItemContactsList')
|
||||
let hasValueArr = contactsList.filter(tt => tt.contactsId === value)
|
||||
if (hasValueArr.length <= 1) {
|
||||
callback()
|
||||
@@ -597,74 +534,12 @@ export default {
|
||||
}
|
||||
callback()
|
||||
},
|
||||
/**
|
||||
* 企业联系人1、邮寄联系人联动
|
||||
* @param value
|
||||
* @param index
|
||||
*/
|
||||
contactsChange(value, index) {
|
||||
let formData = this.form.getFieldValue('payWorkingGroupSubItemContactsList')
|
||||
formData[index].contactsId = value
|
||||
// 如果没有值,清空对应的备注
|
||||
if (!value) {
|
||||
formData[index].remarks = null
|
||||
} else {
|
||||
// 如果值和初始值不一致,则清除备注
|
||||
if (this.model.payWorkingGroupSubItemContactsList[index].contactsId !== value) {
|
||||
formData[index].remarks = null
|
||||
}
|
||||
let mailContact = Object.values(this.form.getFieldValue(['mailContactsId']))[0]
|
||||
// 邮寄联系人非undefined时赋值
|
||||
if (!mailContact && index === 0) {
|
||||
this.model.mailContactsId = value
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue(pick(this.model, 'mailContactsId'))
|
||||
})
|
||||
}
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue({ payWorkingGroupSubItemContactsList: formData })
|
||||
this.form.validateFields(['payWorkingGroupSubItemContactsList'])
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 企业联系人2变化
|
||||
* @param value
|
||||
*/
|
||||
// contactsTwoChange(value) {
|
||||
// if (!value) {
|
||||
// this.hasContactTwo = false
|
||||
// this.form.setFieldsValue({ remarksTwo: null })
|
||||
// return
|
||||
// }
|
||||
// this.hasContactTwo = true
|
||||
// // 判断联系人是否和原来的一致,不一致则清空备注内容
|
||||
// if (value !== this.model.contactsTemporaryIdTwo) {
|
||||
// this.form.setFieldsValue({ remarksTwo: null })
|
||||
// }
|
||||
// },
|
||||
/**
|
||||
* 企业联系人3变化
|
||||
* @param value
|
||||
*/
|
||||
// contactsThreeChange(value) {
|
||||
// if (!value) {
|
||||
// this.hasContactThree = false
|
||||
// this.form.setFieldsValue({ remarksThree: null })
|
||||
// return
|
||||
// }
|
||||
// this.hasContactThree = true
|
||||
// // 判断联系人是否和原来的一致,不一致则清空备注内容
|
||||
// if (value !== this.model.contactsTemporaryIdThree) {
|
||||
// this.form.setFieldsValue({ remarksThree: null })
|
||||
// }
|
||||
// },
|
||||
/**
|
||||
* 添加联系人
|
||||
* @param index
|
||||
*/
|
||||
handleAddContact(index) {
|
||||
if (this.model.payWorkingGroupSubItemContactsList.length >= 10) {
|
||||
if (this.model.payDraftingGroupSubItemContactsList.length >= 10) {
|
||||
this.$message.warn('最多添加十个企业联系人')
|
||||
return
|
||||
}
|
||||
@@ -672,12 +547,12 @@ export default {
|
||||
contactsId: undefined,
|
||||
remarks: null
|
||||
}
|
||||
this.model.payWorkingGroupSubItemContactsList.splice(index + 1, 0, obj)
|
||||
this.model.payDraftingGroupSubItemContactsList.splice(index + 1, 0, obj)
|
||||
this.$forceUpdate()
|
||||
let formData = this.form.getFieldValue('payWorkingGroupSubItemContactsList')
|
||||
let formData = this.form.getFieldValue('payDraftingGroupSubItemContactsList')
|
||||
formData.splice(index + 1, 0, obj)
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue({ payWorkingGroupSubItemContactsList: formData })
|
||||
this.form.setFieldsValue({ payDraftingGroupSubItemContactsList: formData })
|
||||
})
|
||||
},
|
||||
/**
|
||||
@@ -685,15 +560,15 @@ export default {
|
||||
* @param index
|
||||
*/
|
||||
handleDelContact(index) {
|
||||
if (this.model.payWorkingGroupSubItemContactsList.length === 1) {
|
||||
if (this.model.payDraftingGroupSubItemContactsList.length === 1) {
|
||||
this.$message.warn('最少需要一个企业联系人')
|
||||
return
|
||||
}
|
||||
this.model.payWorkingGroupSubItemContactsList.splice(index, 1)
|
||||
let formData = this.form.getFieldValue('payWorkingGroupSubItemContactsList')
|
||||
this.model.payDraftingGroupSubItemContactsList.splice(index, 1)
|
||||
let formData = this.form.getFieldValue('payDraftingGroupSubItemContactsList')
|
||||
formData.splice(index, 1)
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue({ payWorkingGroupSubItemContactsList: formData })
|
||||
this.form.setFieldsValue({ payDraftingGroupSubItemContactsList: formData })
|
||||
})
|
||||
},
|
||||
// 下拉框的搜索
|
||||
|
||||
Reference in New Issue
Block a user