zmc
2023-12-01 d404f7f0ffb8b7b8b930a2b583afe2037cffc3f8
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
<!--下拉框显示店铺名称 
  可多选
返回父组件已选择的店铺
-->
<script >
import axiosInstance from '../utils/request.js'
  export default {
    emits:['submitShops'],
    data() {
      return{
        selectedShopNames:[],
        shopNames:[]
      }
    },
    mounted(){
        this.getAllShopNames()
    },
    methods: {
        getAllShopNames(){
            axiosInstance.get('/fume/device').then(response =>{
                 response.data.data.forEach(item => {
                    this.shopNames.push(item.diName)
                 }
                 );
            })
        }
     }
 
}
</script>
 
<template>
  <div>
    <el-select
      v-model="selectedShopNames"
      multiple
      placeholder="Select"
      style="width: 400px"
      @change="$emit('submitShops',this.selectedShopNames)"
    >
      <el-option
        v-for="item in shopNames"
        :key="item"
        :label="item"
        :value="item"
      />
    </el-select>
  </div>
</template>