diff --git a/src/components/ProjectDetailModal.vue b/src/components/ProjectDetailModal.vue
index 81c0c4a..2f23c56 100644
--- a/src/components/ProjectDetailModal.vue
+++ b/src/components/ProjectDetailModal.vue
@@ -113,140 +113,91 @@
企业联系人信息
-
-
-
- {{ basicInfo.name }}
-
-
-
-
-
-
-
-
-
-
- {{ basicInfo.gender_dictText }}
-
-
-
-
-
-
-
-
-
- {{ basicInfo.phone }}
-
-
-
- {{ basicInfo.email }}
-
-
-
-
-
- {{ basicInfo.postalCodeContacts }}
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+ {{ basicInfo.name }}
+
+
+
+
+
+ {{ basicInfo.gender_dictText }}
+
+
+
+
+
+
+
+
+
+ {{ basicInfo.phone }}
+
+
+
+ {{ basicInfo.email }}
+
+
+
+
+
+ {{ basicInfo.postalCodeContacts }}
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
+
+
-
- {{ basicInfo.genderTwo_dictText }}
+
+ {{ item.gender_dictText }}
-
-
+
+
-
- {{ basicInfo.phoneTwo }}
+
+ {{ item.phone }}
-
- {{ basicInfo.emailTwo }}
+
+ {{ item.email }}
-
- {{ basicInfo.postalCodeContactsTwo }}
+
+ {{ item.postalCodeContacts }}
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ basicInfo.genderThree_dictText }}
-
-
-
-
-
-
-
-
-
- {{ basicInfo.phoneThree }}
-
-
-
- {{ basicInfo.emailThree }}
-
-
-
-
-
- {{ basicInfo.postalCodeContactsThree }}
-
-
-
-
-
-
-
+
+
-
@@ -428,14 +379,14 @@ export default {
}
})
}
- return `${item.person}于${item.time}开票,金额为:${item.money}元,票号:${item.piaoNo},项目:${porjectItem}`
+ return `${ item.person }于${ item.time }开票,金额为:${ item.money }元,票号:${ item.piaoNo },项目:${ porjectItem }`
},
/*
* 查看物流
* */
lookLogistics(record) {
const com = Number(record.sendMethod) === 1 && 'ems' || 'shunfeng'
- window.open(`https://www.kuaidi100.com/chaxun?com=${com}&nu=${record.postNo}`)
+ window.open(`https://www.kuaidi100.com/chaxun?com=${ com }&nu=${ record.postNo }`)
},
/*
* 去合同详情 传入合同id
diff --git a/src/components/company/SelectContacts.vue b/src/components/company/SelectContacts.vue
index 606019b..bf9e798 100644
--- a/src/components/company/SelectContacts.vue
+++ b/src/components/company/SelectContacts.vue
@@ -188,6 +188,7 @@ export default {
* 第一次展开下拉,去掉和初始联系人一样的联系人
*/
handleDropdownOpen() {
+ this.getContactsList()
if (this.isFirstOpen && this.initContacts && this.initContacts.id) {
this.contactsList.forEach((item, index) => {
if (item.id === this.initContacts.id) {
diff --git a/src/views/projectManagement/modules/WorkingGroupMemberUnitModule.vue b/src/views/projectManagement/modules/WorkingGroupMemberUnitModule.vue
index 9fc941e..a144321 100644
--- a/src/views/projectManagement/modules/WorkingGroupMemberUnitModule.vue
+++ b/src/views/projectManagement/modules/WorkingGroupMemberUnitModule.vue
@@ -35,67 +35,96 @@
+
+
+
+
+ contactsChange(value, index)">
+
+
+
+
+
+ {e.target.value = (e.target.value + '').trim()}">
+
+
+
+
+ 添加
+ 删除
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {e.target.value = (e.target.value + '').trim()}">
-
-
-
-
-
- {e.target.value = (e.target.value + '').trim()}">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {e.target.value = (e.target.value + '').trim()}">
-
+ ref="selectMailContacts">
+
@@ -400,12 +417,17 @@ export default {
workingGroupList: [],
disabledCompany: false, // 企业是否禁用
isAssociatedContract: false, // 是否关联合同
- hasContactOne: false, // 是否选择联系人1
- hasContactTwo: false, // 是否选择联系人2
- hasContactThree: false, // 是否选择联系人3
+ // hasContactOne: false, // 是否选择联系人1
+ // hasContactTwo: false, // 是否选择联系人2
+ // hasContactThree: false, // 是否选择联系人3
url: {
add: '/project/payWorkingGroupSubitem/add',
edit: '/project/payWorkingGroupSubitem/edit'
+ },
+ // 默认的联系人数据
+ defaultPayWorkingGroupSubItemContact: {
+ contactsId: undefined,
+ remarks: null
}
}
},
@@ -468,7 +490,7 @@ export default {
this.companyChange(this.selectedCompany)
this.form.resetFields()
record.contractNum = record.contractNum || undefined
- this.model = Object.assign({}, record)
+ 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
@@ -492,22 +514,28 @@ export default {
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
- }
+ // // 是否需要显示联系人备注信息
+ // 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', 'contractNum', 'receivableAmount', 'chargeNoticeId', 'needInvoice', 'remarks', 'remarksOne', 'remarksTwo', 'remarksThree'))
+ this.form.setFieldsValue(pick(this.model, 'chargeCompany', 'contactsIdOne', 'contactsIdTwo', 'contactsIdThree', 'mailContactsId', 'chargeWay', 'charge', 'receivableAmount', 'contractNum', 'receivableAmount', 'chargeNoticeId', 'needInvoice', 'remarks', 'remarksOne', 'remarksTwo', 'remarksThree', 'payWorkingGroupSubItemContactsList'))
})
},
close() {
@@ -523,10 +551,12 @@ export default {
this.isAssociatedContract = false
this.disabledCompany = false
// 清除联系人备注信息
- this.hasContactOne = false
- this.hasContactTwo = false
- this.hasContactThree = false
+ // this.hasContactOne = false
+ // this.hasContactTwo = false
+ // this.hasContactThree = false
this.visible = false
+ this.model = Object.assign({}, {})
+ this.form.resetFields()
},
handleOk() {
if (this.confirmLoading) {
@@ -557,7 +587,12 @@ export default {
if (this.workingGroupId) {
values.workingGroupId = this.workingGroupId
}
- const formData = Object.assign(this.model, values)
+ // 企业联系人信息中将没有值的去掉
+ 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) {
@@ -679,18 +714,6 @@ export default {
* 在新增成功后重新获取联系人列表
*/
addContactsOneOk() {
- this.$refs.selectContacts2.getContactsList()
- this.$refs.selectContacts3.getContactsList()
- this.$refs.selectMailContacts.getContactsList()
- },
- addContactsTwoOk() {
- this.$refs.selectContacts1.getContactsList()
- this.$refs.selectContacts3.getContactsList()
- this.$refs.selectMailContacts.getContactsList()
- },
- addContactsThreeOk() {
- this.$refs.selectContacts1.getContactsList()
- this.$refs.selectContacts2.getContactsList()
this.$refs.selectMailContacts.getContactsList()
},
addMailContactsOk() {
@@ -698,6 +721,12 @@ export default {
this.$refs.selectContacts2.getContactsList()
this.$refs.selectContacts3.getContactsList()
},
+ validateContactRequired(rule, value, callback) {
+ if (value) {
+ callback()
+ }
+ callback('请选择企业联系人1')
+ },
/**
* 校验企业联系人是否重复
* @param rule
@@ -706,21 +735,12 @@ export default {
*/
validateContact(rule, value, callback) {
if (value) {
- // 需要联动验证的字段
- let fieldArr = ['contactsIdOne', 'contactsIdTwo', 'contactsIdThree']
- // 去掉当前更改的字段
- fieldArr = fieldArr.filter(tt => tt !== rule.field)
- const contactObj = this.form.getFieldsValue(['contactsIdOne', 'contactsIdTwo', 'contactsIdThree'])
- const contactArr = Object.values(contactObj)
- contactArr.filter(tt => tt !== undefined)
- if (isRepeat(contactArr)) {
- callback('请选择不同的企业联系人')
- } else {
- // 进行其余两个联系人字段的重复校验
- this.form.validateFields(fieldArr)
+ let contactsList = this.form.getFieldValue('payWorkingGroupSubItemContactsList')
+ let hasValueArr = contactsList.filter(tt => tt.contactsId === value)
+ if (hasValueArr.length <= 1) {
callback()
}
- callback()
+ callback('请选择不同的联系人')
return
}
callback()
@@ -728,58 +748,101 @@ export default {
/**
* 企业联系人1、邮寄联系人联动
* @param value
+ * @param index
*/
- contactsChange(value) {
+ contactsChange(value, index) {
+ let formData = this.form.getFieldValue('payWorkingGroupSubItemContactsList')
+ formData[index].contactsId = value
+ // 如果没有值,清空对应的备注
if (!value) {
- this.hasContactOne = false
- this.form.setFieldsValue({ remarksOne: null })
- return
- }
- this.hasContactOne = true
- // 判断联系人是否和原来的一致,不一致则清空备注内容
- if (value !== this.model.contactsTemporaryIdOne) {
- this.form.setFieldsValue({ remarksOne: null })
- }
- let mailContact = Object.values(this.form.getFieldValue(['mailContactsId']))[0]
- // 邮寄联系人非undefined时赋值
- if (!mailContact) {
- this.model.mailContactsId = value
- this.$nextTick(() => {
- this.form.setFieldsValue(pick(this.model, 'mailContactsId'))
- })
+ 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 })
- }
- },
+ // 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 })
+ // 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
}
- this.hasContactThree = true
- // 判断联系人是否和原来的一致,不一致则清空备注内容
- if (value !== this.model.contactsTemporaryIdThree) {
- this.form.setFieldsValue({ remarksThree: null })
+ 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 })
+ })
}
}
}
@@ -808,4 +871,15 @@ export default {
}
}
}
+
+.contact-btn {
+ display: inline-block;
+ margin: 0 8px;
+ padding: 0;
+ height: 40px;
+}
+
+.del-btn {
+ color: #ff4d4f
+}
\ No newline at end of file