餐饮油烟智能监测与监管一体化平台
riku
2026-03-03 adc9e790a5b1e38f75d39df0b596b1982de4e89e
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<!-- e:\VSprojects\fume-supervision-vue\src\components\monitor\ShopList.vue -->
<template>
  <el-card class="section" shadow="hover">
    <template #header>
      <div class="card-header">
        <span>在线设备和店铺清单</span>
      </div>
    </template>
    <el-row :gutter="20" class="filter-controls">
      <el-col :span="8">
        <el-select
          v-model="localFilter.district"
          @change="handleFilterChange"
          placeholder="行政区划"
        >
          <el-option label="全部行政区划" value="" />
          <el-option
            v-for="district in districts"
            :key="district"
            :label="district"
            :value="district"
          />
        </el-select>
      </el-col>
      <el-col :span="8">
        <el-select
          v-model="localFilter.shopType"
          @change="handleFilterChange"
          placeholder="店铺类型"
        >
          <el-option label="全部店铺类型" value="" />
          <el-option v-for="type in shopTypes" :key="type" :label="type" :value="type" />
        </el-select>
      </el-col>
      <el-col :span="8">
        <el-select v-model="localFilter.status" @change="handleFilterChange" placeholder="状态">
          <el-option label="全部状态" value="" />
          <el-option label="在线" value="online" />
          <el-option label="离线" value="offline" />
        </el-select>
      </el-col>
    </el-row>
    <el-table :data="filteredShops" style="width: 100%" stripe>
      <el-table-column prop="name" label="店铺名称" />
      <el-table-column prop="deviceCount" label="设备数量" />
      <el-table-column prop="status" label="在线情况" />
      <el-table-column prop="district" label="行政区划" />
      <el-table-column prop="type" label="店铺类型" />
    </el-table>
  </el-card>
</template>
 
<script>
export default {
  name: 'ShopList',
  props: {
    shops: {
      type: Array,
      default: () => [],
    },
    shopTypes: {
      type: Array,
      default: () => ['中餐', '西餐', '快餐', '火锅', '烧烤'],
    },
    districts: {
      type: Array,
      default: () => ['东城区', '西城区', '朝阳区', '海淀区', '丰台区'],
    },
    filter: {
      type: Object,
      default: () => ({
        district: '',
        shopType: '',
        status: '',
      }),
    },
  },
  data() {
    return {
      localFilter: { ...this.filter },
    }
  },
  computed: {
    filteredShops() {
      return this.shops.filter((shop) => {
        return (
          (this.localFilter.district === '' || shop.district === this.localFilter.district) &&
          (this.localFilter.shopType === '' || shop.type === this.localFilter.shopType) &&
          (this.localFilter.status === '' || shop.status === this.localFilter.status)
        )
      })
    },
  },
  watch: {
    filter(newVal) {
      this.localFilter = { ...newVal }
    },
  },
  methods: {
    handleFilterChange() {
      this.$emit('filter-change', this.localFilter)
    },
  },
}
</script>
 
<style scoped>
.section {
  margin-bottom: 20px;
}
 
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
 
.filter-controls {
  margin-bottom: 20px;
}
</style>