[update]起草组
This commit is contained in:
@@ -0,0 +1,743 @@
|
||||
<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 v-if="defaultChargeWay">
|
||||
<a-col>
|
||||
<a-form-item label="工作组项目" :labelCol="remarksLabelCol" :wrapperCol="remarksWrapperCol">
|
||||
<a-select
|
||||
placeholder="请选择工作组项目"
|
||||
show-search
|
||||
v-decorator="['workingGroupId',validatorRules.workingGroupId]"
|
||||
:maxLength='50'
|
||||
:filter-option="filterOption"
|
||||
>
|
||||
<a-select-option v-for="item in workingGroupList" :key="item.id" :value="item.id">
|
||||
{{ item.workingGroupProject }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col>
|
||||
<a-form-item label="成员单位" :labelCol="remarksLabelCol" :wrapperCol="remarksWrapperCol">
|
||||
<company-select placeholder="请选择成员单位"
|
||||
v-decorator="['chargeCompany',validatorRules.chargeCompany]"
|
||||
:disabled="disabledCompany"
|
||||
@change="companyChange"
|
||||
:maxLength='50'>
|
||||
</company-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<template
|
||||
v-if="model.payWorkingGroupSubItemContactsList && model.payWorkingGroupSubItemContactsList.length > 0">
|
||||
<a-row v-for="(item, index) in model.payWorkingGroupSubItemContactsList" :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]"
|
||||
:placeholder="`请选择企业联系人${index + 1}`"
|
||||
v-decorator="[`payWorkingGroupSubItemContactsList[${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>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xl="9" :sm="20">
|
||||
<!-- v-show="hasContactOne"-->
|
||||
<a-form-item :label="`备注${index + 1}`" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<a-input
|
||||
:placeholder="`请输入备注${index + 1}`"
|
||||
v-decorator="[`payWorkingGroupSubItemContactsList[${index}].remarks`]"
|
||||
:maxLength='50'
|
||||
@change="e => {e.target.value = (e.target.value + '').trim()}">
|
||||
</a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xl="3" :sm="4">
|
||||
<a-button type="link" class="contact-btn" @click="handleAddContact(index)">添加</a-button>
|
||||
<a-button type="link" class="contact-btn del-btn" @click="handleDelContact(index)">删除</a-button>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</template>
|
||||
<!--<a-row>-->
|
||||
<!-- <a-col :xl="12" :sm="24">-->
|
||||
<!-- <a-form-item label="邮寄联系人" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
|
||||
<!-- <select-contacts :selected-company="selectedCompany"-->
|
||||
<!-- :init-contacts="selectedMailContact"-->
|
||||
<!-- placeholder="请选择邮寄联系人"-->
|
||||
<!-- v-decorator="['mailContactsId',validatorRules.mailContactsId]"-->
|
||||
<!-- :maxLength='50'-->
|
||||
<!-- ref="selectMailContacts">-->
|
||||
<!-- </select-contacts>-->
|
||||
<!-- </a-form-item>-->
|
||||
<!-- </a-col>-->
|
||||
<!--</a-row>-->
|
||||
<a-row>
|
||||
<a-col>
|
||||
<a-form-item label="备注" :labelCol="remarksLabelCol" :wrapperCol="remarksWrapperCol">
|
||||
<a-textarea
|
||||
placeholder="请输入备注"
|
||||
:auto-size="{ minRows: 3, maxRows: 6 }"
|
||||
v-decorator="['remarks']"
|
||||
:maxLength='200'
|
||||
@change="e => {e.target.value = (e.target.value + '').trim()}"/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</a-spin>
|
||||
</j-modal>
|
||||
</template>
|
||||
|
||||
<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'
|
||||
// import { isRepeat } from '../../../utils/util'
|
||||
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 },
|
||||
mixins: [CalcAmountMixin],
|
||||
props: {
|
||||
// 默认来款方式(收入合同新增工作组项目,来款方式默认为2--合同)
|
||||
defaultChargeWay: {
|
||||
type: Number,
|
||||
required: false,
|
||||
default: null
|
||||
},
|
||||
// 收入合同关联时传入的企业信息,不可修改
|
||||
defaultChargeCompany: {
|
||||
type: Object,
|
||||
required: false,
|
||||
default: () => {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
// 是否可以修改来款企业
|
||||
disabledChargeCompany: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: false
|
||||
},
|
||||
// 收入合同新增项目时带入合同号且不可修改
|
||||
defaultContractNum: {
|
||||
type: String,
|
||||
requirde: false,
|
||||
default: null
|
||||
},
|
||||
// 合同号是否可编辑
|
||||
isContractNumDisabled: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: false
|
||||
},
|
||||
// 企业的签订联系人id,收入合同新增企业联系人、邮寄联系人默认为签订联系人
|
||||
signedContactId: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: undefined
|
||||
},
|
||||
// 收入合同新增时为1
|
||||
flag: {
|
||||
type: Number,
|
||||
requirded: false,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
title: '操作',
|
||||
width: 800,
|
||||
visible: false,
|
||||
confirmLoading: false,
|
||||
form: this.$form.createForm(this),
|
||||
model: {},
|
||||
labelCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 8 }
|
||||
},
|
||||
wrapperCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 16 }
|
||||
},
|
||||
remarksLabelCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 4 }
|
||||
},
|
||||
remarksWrapperCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 20 }
|
||||
},
|
||||
validatorRules: {
|
||||
workingGroupId: {
|
||||
rules: [{ required: true, message: '请选择工作组项目' }],
|
||||
validateTrigger: 'change'
|
||||
},
|
||||
chargeCompany: {
|
||||
rules: [{ required: true, validator: this.checkCompany }],
|
||||
validateTrigger: 'change'
|
||||
},
|
||||
taxRate: {
|
||||
rules: [{ required: true, message: '请选择税率' }],
|
||||
validateTrigger: 'change', initialValue: '0.06'
|
||||
},
|
||||
contactsIdOne: {
|
||||
rules: [{ required: true, message: '请选择企业联系人1' }],
|
||||
validateTrigger: 'change'
|
||||
},
|
||||
contactsRepeat: {
|
||||
rules: [{ required: false, validator: this.validateContact }],
|
||||
validateTrigger: 'change'
|
||||
},
|
||||
mailContactsId: {
|
||||
rules: [{ required: true, message: '请选择邮寄联系人' }],
|
||||
validateTrigger: 'blur'
|
||||
},
|
||||
chargeWay: {
|
||||
rules: [{ required: true, message: '请选择来款方式' }],
|
||||
validateTrigger: 'change'
|
||||
},
|
||||
receivableAmount: {
|
||||
rules: [{ required: true, validator: this.checkMoney }],
|
||||
validateTrigger: 'blur'
|
||||
},
|
||||
contractNum: {
|
||||
rules: [{ required: true, message: '请选择合同号' }],
|
||||
validateTrigger: 'change'
|
||||
},
|
||||
charge: {
|
||||
rules: [{ required: true, message: '请输入收费通知号' }],
|
||||
validateTrigger: 'blur'
|
||||
},
|
||||
needInvoice: {
|
||||
rules: [{ required: true, message: '请选择发票类型' }],
|
||||
validateTrigger: 'change'
|
||||
}
|
||||
},
|
||||
chargeWayType: null,
|
||||
selectedCompany: null, // 当前选中的企业
|
||||
selectedContact1: null, // 编辑时的联系人
|
||||
selectedContact2: null, // 编辑时的联系人
|
||||
selectedContact3: null, // 编辑时的联系人
|
||||
selectedMailContact: null, // 编辑时的邮寄联系人
|
||||
chargeNoticeList: [], // 收费通知号list
|
||||
selectedChargeNotice: null, // 选中的收费通知号
|
||||
workingGroupId: null,
|
||||
workingGroupList: [],
|
||||
disabledCompany: false, // 企业是否禁用
|
||||
isAssociatedContract: false, // 是否关联合同
|
||||
// hasContactOne: false, // 是否选择联系人1
|
||||
// hasContactTwo: false, // 是否选择联系人2
|
||||
// hasContactThree: false, // 是否选择联系人3
|
||||
url: {
|
||||
add: '/project/payWorkingGroupSubitem/add',
|
||||
edit: '/project/payWorkingGroupSubitem/edit'
|
||||
},
|
||||
// 默认的联系人数据
|
||||
defaultPayWorkingGroupSubItemContact: {
|
||||
contactsId: undefined,
|
||||
remarks: null,
|
||||
name: null
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
addZero,
|
||||
add() {
|
||||
this.edit({})
|
||||
// 判断默认来款用途是否为合同(收入合同新增)
|
||||
if (this.defaultChargeWay) {
|
||||
this.loadWorkingGroupList()
|
||||
this.chargeWayType = 2
|
||||
}
|
||||
// 判断是否存在默认合同号(收入合同新增)
|
||||
if (this.defaultContractNum && this.defaultContractNum !== '') {
|
||||
this.model.contractNum = this.defaultContractNum
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue(pick(this.model, 'contractNum'))
|
||||
})
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 获取工作组列表
|
||||
*/
|
||||
loadWorkingGroupList() {
|
||||
let param = {
|
||||
companyId: this.defaultChargeCompany.id
|
||||
}
|
||||
getWorkingGroupListByNotCompany(param).then(res => {
|
||||
if (res.success) {
|
||||
this.workingGroupList = res.result
|
||||
} else {
|
||||
this.$message.warn(res.message)
|
||||
}
|
||||
})
|
||||
},
|
||||
edit(record) {
|
||||
// 存在默认选中企业时显示默认企业
|
||||
if (this.defaultChargeCompany.hasOwnProperty.call(this.defaultChargeCompany, 'id')) {
|
||||
record.chargeCompany = {
|
||||
id: this.defaultChargeCompany.id,
|
||||
companyName: this.defaultChargeCompany.companyName
|
||||
}
|
||||
} else {
|
||||
record.chargeCompany = {
|
||||
id: record.chargeCompanyId,
|
||||
companyName: record.chargeCompanyTemporaryName
|
||||
}
|
||||
}
|
||||
// 验证项目是否关联收入合同,项目来款、开票、邮寄、打包、关联合同后,企业不可更改
|
||||
if (record.id) {
|
||||
checkAssociatedProject(record.id).then(res => {
|
||||
this.disabledCompany = this.disabledChargeCompany || res || (!!record.inAccount && record.inAccount !== 0) || (!!record.makeInvoice && record.makeInvoice !== 0) || (!!record.mail && record.mail !== 0)
|
||||
this.isAssociatedContract = res
|
||||
})
|
||||
} else {
|
||||
this.disabledCompany = this.disabledChargeCompany
|
||||
}
|
||||
// 回显选中的企业
|
||||
this.selectedCompany = record.chargeCompany
|
||||
this.companyChange(this.selectedCompany)
|
||||
this.form.resetFields()
|
||||
record.contractNum = record.contractNum || undefined
|
||||
this.model = Object.assign({}, JSON.parse(JSON.stringify(record)))
|
||||
// 是否存在从收入合同传入的签订联系人id
|
||||
this.model.contactsIdOne = this.signedContactId || this.model.contactsTemporaryIdOne || undefined
|
||||
this.model.contactsIdTwo = this.model.contactsTemporaryIdTwo || undefined
|
||||
this.model.contactsIdThree = this.model.contactsTemporaryIdThree || undefined
|
||||
// 是否存在从收入合同传入的签订联系人id
|
||||
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 => {
|
||||
item.name = item.contactsTemporaryName
|
||||
})
|
||||
// this.selectedContact1 = {
|
||||
// id: this.model.contactsTemporaryIdOne,
|
||||
// name: this.model.contactsTemporaryNameOne
|
||||
// }
|
||||
// this.selectedContact2 = {
|
||||
// id: this.model.contactsTemporaryIdTwo,
|
||||
// name: this.model.contactsTemporaryNameTwo
|
||||
// }
|
||||
// this.selectedContact3 = {
|
||||
// id: this.model.contactsTemporaryIdThree,
|
||||
// name: this.model.contactsTemporaryNameThree
|
||||
// }
|
||||
this.selectedMailContact = {
|
||||
id: this.model.mailContactsTemporaryId,
|
||||
name: this.model.mailContactsTemporaryName
|
||||
}
|
||||
// // 是否需要显示联系人备注信息
|
||||
// if (this.model.contactsTemporaryIdOne) {
|
||||
// this.hasContactOne = true
|
||||
// }
|
||||
// if (this.model.contactsTemporaryIdTwo) {
|
||||
// this.hasContactTwo = true
|
||||
// }
|
||||
// if (this.model.contactsTemporaryIdThree) {
|
||||
// this.hasContactThree = true
|
||||
// }
|
||||
} else {
|
||||
// 新增处理默认显示的三个企业联系人
|
||||
this.model.payWorkingGroupSubItemContactsList = []
|
||||
this.model.payWorkingGroupSubItemContactsList.push(this.defaultPayWorkingGroupSubItemContact)
|
||||
this.model.payWorkingGroupSubItemContactsList.push(this.defaultPayWorkingGroupSubItemContact)
|
||||
this.model.payWorkingGroupSubItemContactsList.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'))
|
||||
})
|
||||
},
|
||||
close() {
|
||||
this.$emit('close')
|
||||
this.chargeWayType = null
|
||||
this.selectedCompany = null
|
||||
// 清除选中联系人信息
|
||||
this.selectedContact1 = null
|
||||
this.selectedContact2 = null
|
||||
this.selectedContact3 = null
|
||||
this.selectedMailContact = null
|
||||
// 清除企业、来款方式、合同号的限制
|
||||
this.isAssociatedContract = false
|
||||
this.disabledCompany = false
|
||||
// 清除联系人备注信息
|
||||
// this.hasContactOne = false
|
||||
// this.hasContactTwo = false
|
||||
// this.hasContactThree = false
|
||||
this.visible = false
|
||||
this.model = Object.assign({}, {})
|
||||
this.form.resetFields()
|
||||
},
|
||||
handleOk() {
|
||||
if (this.confirmLoading) {
|
||||
return
|
||||
}
|
||||
this.confirmLoading = true
|
||||
const that = this
|
||||
// 触发表单验证
|
||||
this.form.validateFields((err, values) => {
|
||||
if (!err) {
|
||||
that.confirmLoading = true
|
||||
// 收入合同新建项目手动赋值
|
||||
if (this.defaultChargeWay === 2) {
|
||||
values.chargeWay = 2
|
||||
}
|
||||
if (this.flag === 1) {
|
||||
values.flag = this.flag
|
||||
}
|
||||
values.chargeCompanyTemporaryName = values.chargeCompany.companyName
|
||||
values.chargeCompanyId = values.chargeCompany.id
|
||||
let httpurl = ''
|
||||
let method = 'post'
|
||||
if (!this.model.id) {
|
||||
httpurl += this.url.add
|
||||
} else {
|
||||
httpurl += this.url.edit
|
||||
}
|
||||
if (this.workingGroupId) {
|
||||
values.workingGroupId = this.workingGroupId
|
||||
}
|
||||
// 企业联系人信息中将没有值的去掉
|
||||
let haveValueContactArr = values.payWorkingGroupSubItemContactsList.filter(tt => tt.contactsId)
|
||||
let obj = {
|
||||
payWorkingGroupSubItemContactsList: haveValueContactArr
|
||||
}
|
||||
const formData = Object.assign(this.model, values, obj)
|
||||
console.log('表单提交数据', formData)
|
||||
httpAction(httpurl, formData, method).then((res) => {
|
||||
if (res.success) {
|
||||
that.$message.success(res.message)
|
||||
that.$emit('ok')
|
||||
that.close()
|
||||
} else {
|
||||
that.$message.warning(res.message)
|
||||
}
|
||||
}).finally(() => {
|
||||
setTimeout(() => {
|
||||
this.confirmLoading = false
|
||||
}, 1000)
|
||||
})
|
||||
} else {
|
||||
this.confirmLoading = false
|
||||
}
|
||||
})
|
||||
},
|
||||
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
|
||||
*/
|
||||
companyChange(value) {
|
||||
// 当前选中的企业和之前选中的企业一致,就不修改了
|
||||
if (this.selectedCompany && value && this.selectedCompany.id === value.id) {
|
||||
return
|
||||
}
|
||||
this.selectedCompany = value
|
||||
// this.model.contactsIdOne = undefined
|
||||
// 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.selectedMailContact = null
|
||||
this.model.contractNum = undefined
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue(pick(this.model, 'mailContactsId', 'contractNum', 'payWorkingGroupSubItemContactsList'))
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 企业必填校验
|
||||
* @param rules
|
||||
* @param value
|
||||
* @param callback
|
||||
*/
|
||||
checkCompany(rules, value, callback) {
|
||||
if (value.id && value.companyName) {
|
||||
callback()
|
||||
return
|
||||
}
|
||||
callback('请选择成员单位')
|
||||
},
|
||||
/**
|
||||
* 校验金额格式
|
||||
* @param rules
|
||||
* @param value
|
||||
* @param callback
|
||||
*/
|
||||
checkMoney(rules, value, callback) {
|
||||
if (value) {
|
||||
if (money(value)) {
|
||||
callback()
|
||||
return
|
||||
}
|
||||
callback('请输入合法的金额数字,最多2位小数,10位整数')
|
||||
}
|
||||
callback('请输入待确收金额')
|
||||
},
|
||||
/**
|
||||
* 在新增成功后重新获取联系人列表
|
||||
*/
|
||||
addContactsOneOk() {
|
||||
this.$refs.selectMailContacts.getContactsList()
|
||||
},
|
||||
addMailContactsOk() {
|
||||
this.$refs.selectContacts1.getContactsList()
|
||||
this.$refs.selectContacts2.getContactsList()
|
||||
this.$refs.selectContacts3.getContactsList()
|
||||
},
|
||||
validateContactRequired(rule, value, callback) {
|
||||
if (value) {
|
||||
callback()
|
||||
}
|
||||
callback('请选择企业联系人1')
|
||||
},
|
||||
/**
|
||||
* 校验企业联系人是否重复
|
||||
* @param rule
|
||||
* @param value
|
||||
* @param callback
|
||||
*/
|
||||
validateContact(rule, value, callback) {
|
||||
if (value) {
|
||||
let contactsList = this.form.getFieldValue('payWorkingGroupSubItemContactsList')
|
||||
let hasValueArr = contactsList.filter(tt => tt.contactsId === value)
|
||||
if (hasValueArr.length <= 1) {
|
||||
callback()
|
||||
}
|
||||
callback('请选择不同的联系人')
|
||||
return
|
||||
}
|
||||
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) {
|
||||
this.$message.warn('最多添加十个企业联系人')
|
||||
return
|
||||
}
|
||||
let obj = {
|
||||
contactsId: undefined,
|
||||
remarks: null
|
||||
}
|
||||
this.model.payWorkingGroupSubItemContactsList.splice(index + 1, 0, obj)
|
||||
this.$forceUpdate()
|
||||
let formData = this.form.getFieldValue('payWorkingGroupSubItemContactsList')
|
||||
formData.splice(index + 1, 0, obj)
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue({ payWorkingGroupSubItemContactsList: formData })
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 删除联系人
|
||||
* @param index
|
||||
*/
|
||||
handleDelContact(index) {
|
||||
if (this.model.payWorkingGroupSubItemContactsList.length === 1) {
|
||||
this.$message.warn('最少需要一个企业联系人')
|
||||
return
|
||||
}
|
||||
this.model.payWorkingGroupSubItemContactsList.splice(index, 1)
|
||||
let formData = this.form.getFieldValue('payWorkingGroupSubItemContactsList')
|
||||
formData.splice(index, 1)
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue({ payWorkingGroupSubItemContactsList: formData })
|
||||
})
|
||||
},
|
||||
// 下拉框的搜索
|
||||
filterOption(input, option) {
|
||||
return (
|
||||
option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
||||
)
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
.charge-notice-no {
|
||||
width: 100%;
|
||||
|
||||
/deep/ .ant-radio-wrapper {
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
|
||||
span.ant-radio + * {
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
|
||||
span {
|
||||
vertical-align: bottom;
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.contact-btn {
|
||||
display: inline-block;
|
||||
margin: 0 8px;
|
||||
padding: 0;
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.del-btn {
|
||||
color: #ff4d4f
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user