项目关键人员新增资格证书下拉选功能优化
This commit is contained in:
parent
47ebe7c7af
commit
d42c728470
|
|
@ -165,6 +165,7 @@
|
|||
v-model="item.diploma"
|
||||
placeholder="请选择资格证书"
|
||||
@change="onDiplomaChange($event, index)"
|
||||
@blur="onDiplomaBlur($event, index)"
|
||||
>
|
||||
<el-option
|
||||
v-for="j in item.diplomaList"
|
||||
|
|
@ -663,10 +664,7 @@ export default {
|
|||
diplomaNum: '',
|
||||
level: '',
|
||||
diplomaImg: [],
|
||||
diplomaList: [
|
||||
{ name: '注册建造师', value: '注册建造师' },
|
||||
{ name: '项目经理B证', value: '项目经理B证' },
|
||||
],
|
||||
diplomaList: this.diplomaList,
|
||||
})
|
||||
},
|
||||
// 删除资格证书
|
||||
|
|
@ -685,6 +683,19 @@ export default {
|
|||
this.addAndEditForm.certificateList[index].diplomaList.push({ name: value })
|
||||
}
|
||||
},
|
||||
|
||||
// 资格证书失去焦点
|
||||
onDiplomaBlur(event, index) {
|
||||
console.log(event, index)
|
||||
if (!event.target.value) return
|
||||
const isRepeat = this.addAndEditForm.certificateList[index].diplomaList.some(
|
||||
(item) => item.name === event.target.value,
|
||||
)
|
||||
if (!isRepeat) {
|
||||
this.addAndEditForm.certificateList[index].diplomaList.push({ name: event.target.value })
|
||||
this.addAndEditForm.certificateList[index].diploma = event.target.value
|
||||
}
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
editRow: {
|
||||
|
|
@ -694,12 +705,9 @@ export default {
|
|||
|
||||
if (this.addAndEditForm.certificateList.length > 0) {
|
||||
this.addAndEditForm.certificateList.forEach((item, index) => {
|
||||
this.$set(this.addAndEditForm.certificateList[index], 'diplomaList', [
|
||||
{ name: '注册建造师', value: '注册建造师' },
|
||||
{ name: '项目经理B证', value: '项目经理B证' },
|
||||
])
|
||||
this.$set(this.addAndEditForm.certificateList[index], 'diplomaList', this.diplomaList)
|
||||
|
||||
if (!['注册建造师', '项目经理B证'].includes(item.diploma)) {
|
||||
if (!this.diplomaList.includes(item.diploma)) {
|
||||
this.addAndEditForm.certificateList[index].diplomaList.push({
|
||||
name: item.diploma,
|
||||
value: item.diploma,
|
||||
|
|
|
|||
Loading…
Reference in New Issue