1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<template>
<div>
<a-row v-for="(item, index) in specList" :key="'specList'+index" type="flex">
<a-col :span="20">
<div class="special-middle">
<div>
<a-form-model-item :prop="'specList.' + index + '.specId'" :rules="{ required: true, message: '*', trigger: 'change',}">
<cascader-select v-model="item.specId" />
</a-form-model-item>
</div>
</div>
</a-col>
<a-col :span="2">
<div class="special-middle">
<a-popconfirm title="确定要删除吗?" ok-text="确定" cancel-text="取消" @confirm="removeArray(item)">
<a-button type="link" size="small">[删除]</a-button>
</a-popconfirm>
</div>
</a-col>
</a-row>
<a-row type="flex">
<a-col :span="24" style="text-align: center;">
<div class="special-middle">
<a-button type="dashed" style="width: 50%" @click="addArray">
<a-icon type="plus" /> 添加
</a-button>
</div>
</a-col>
</a-row>
</div>
</template>
<script>
const Model = {}
import cascaderSelect from '@/views/components/common/cascaderSelect'
export default {
name: 'specSelect',
components: {
cascaderSelect
},
data () {
return {
}
},
props: {
specList: {
type: Array,
default () {
return []
}
},
},
created () {
},
methods: {
addArray () {//添加成员
if (this.specList.length >= 3) {
this.$message.error('最多只能添加三个评审专业!')
} else
this.specList.push({ ...Model })
},
removeArray (item) {//移除成员
let index = this.specList.indexOf(item)
if (index !== -1) {
this.specList.splice(index, 1)
}
},
},
}
</script>