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
  | <template> 
 |    <zt-select v-model="selectValue" url="sys/repairer/listRepairerByCriteria" :disabled="disabled" :multiple="multiple" :placeholder="placeholder" 
 |               :datas="datas" :clearable="clearable" @change="onSelected"/> 
 |  </template> 
 |  <script> 
 |    
 |    export default { 
 |      name: 'RepairerSelector', 
 |      components: {}, 
 |      props: { 
 |        datas: [String, Array], 
 |        value: [String, Array], 
 |        multiple: { 
 |          type: Boolean, 
 |          default: false 
 |        }, 
 |        placeholder: String, 
 |        disabled: { 
 |          type: Boolean, 
 |          default: false 
 |        }, 
 |        clearable: { 
 |          type: Boolean, 
 |          default: false 
 |        }, 
 |      }, 
 |      data() { 
 |        return { 
 |          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> 
 |  
  |