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
| <template>
| <zt-select v-model="selectValue" :url="url" :multiple="multiple" :disabled="disabled" :placeholder="placeholder"
| :clearable="clearable" @change="onSelected"/>
| </template>
| <script>
|
| export default {
| name: 'LocalShipSelector',
| components: {},
| props: {
| value: [String, Array],
| multiple: {
| type: Boolean,
| default: false
| },
| disabled: {
| type: Boolean,
| default: false
| },
| clearable: {
| type: Boolean,
| default: true
| },
| area: {
| type: String,
| default: 'sy'
| },
| placeholder: String
| },
| data() {
| return {
| url: 'ztProduct/getShipList?area='+this.area,
| selectValue: this.value || ''
| }
| },
| watch: {
| 'selectValue'() {
| if (this.multiple) {
| this.$emit('input', (this.selectValue || []).join(','))
| } else {
| this.$emit('input', this.selectValue)
| }
| },
| value(val, oldval) {
| this.selectValue = val
| }
| },
| mounted() {
| this.onSelected()
| },
| methods: {
| onSelected(data) {
| if (this.multiple) {
| this.$emit('input', (this.selectValue || []).join(','))
| } else {
| this.$emit('input', this.selectValue)
| }
| }
| }
| }
| </script>
|
|