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
| <template>
| <el-select
| v-model="dataValue"
| :disabled="disabled"
| style="width: 100%;"
| placeholder="请选择"
| @change="valueChange">
| <el-option
| v-for="(item, index) in option"
| :key="index + 1"
| :label="item.name"
| :value="index + 1"/>
| </el-select>
| </template>
| <script type="text/javascript">
| import stringMixin from './stringMixin'
|
| export default {
| name: 'XhSelect', // 新建 select
| components: {},
| mixins: [stringMixin],
| props: {},
| data () {
| return {
| option: []
| }
| },
| computed: {},
| watch: {
| item: {
| handler (val) {
| if (val && val.data.setting) {
| var settingList = val.data.setting
| if (settingList.length > 0 && typeof settingList[0] === 'string') {
| var array = []
| for (let index = 0; index < settingList.length; index++) {
| const element = settingList[index]
| array.push({ name: element, value: element })
| }
| this.option = array
| } else if (
| settingList.length > 0 &&
| settingList[0].statusId &&
| !settingList[0].value
| ) {
| // 商机阶段
| this.option = settingList.map((item, index, array) => {
| item.value = item.statusId
| return item
| })
| } else {
| this.option = settingList
| }
| } else {
| this.option = []
| }
| },
| deep: true,
| immediate: true
| }
| },
| mounted () {},
| methods: {}
| }
| </script>
| <style lang="less" scoped>
| </style>
|
|