餐饮油烟智能监测与监管一体化平台
riku
2026-03-16 0488cc32d225a28289ba6c70a2a297f347cacdad
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
<template>
  <div class="map-wrapper">
    <SceneMap
      :model-value="seletedSceneList"
      @update:model-value="onUpdateSeletedSceneList"
      :data="scenes"
    >
      <template #left-top>
        <FYOptionSupervisionStatus
          label=""
          :initValue="false"
          :allOption="true"
          v-model:value="supervisionStatus"
        ></FYOptionSupervisionStatus>
      </template>
    </SceneMap>
    <el-row class="p-events-none top-right-wrap" align="middle">
      <el-button
        class="close-btn-left p-events-auto"
        type="success"
        size="small"
        :icon="rightCardShow ? 'ArrowRight' : 'ArrowLeft'"
        @click="rightCardShow = !rightCardShow"
      ></el-button>
      <div class="right-wrapper">
        <div v-show="rightCardShow" class="p-events-auto subtask-select">
          <CompSubTaskSelect
            :model-value="selectedPlans"
            @update:model-value="onUpdateSelectedPlans"
            height="82vh"
            :dayTask="dayTask"
            @submit="handleSubmitDone"
          ></CompSubTaskSelect>
        </div>
      </div>
    </el-row>
  </div>
</template>
<script setup>
import { ref, computed, watch } from 'vue';
 
import CompSubTaskSelect from './CompSubTaskSelect.vue';
 
const props = defineProps({
  // 场景计划
  plans: {
    type: Array,
    default: () => []
  },
  dayTask: {
    type: Object
  }
});
 
const emits = defineEmits(['submit']);
 
const supervisionStatus = ref({
  label: '未巡查',
  value: '0'
});
const rightCardShow = ref(true);
const seletedSceneList = ref([]);
const selectedPlans = ref([]);
 
watch(
  () => props.dayTask,
  (newVal, oldVal) => {
    if (newVal != oldVal) {
      seletedSceneList.value = [];
      selectedPlans.value = [];
    }
  },
  { immediate: true }
);
 
// 监管计划包含的场景点位信息
const scenes = computed(() => {
  return props.plans
    .filter((v) => {
      if (!v.scene.longitude || !v.scene.latitude) {
        return false;
      }
      // 按照监管状态筛选
      if (supervisionStatus.value) {
        const inspectedTimes = v.extension1 ? Number(v.extension1) : 0;
        switch (supervisionStatus.value.value) {
          case '0':
            return inspectedTimes == 0;
          case '1':
            return inspectedTimes == 1;
          case '2':
            return inspectedTimes >= 2;
          default:
            return true;
        }
      } else {
        return true;
      }
    })
    .map((p) => {
      let _stage, _status;
      switch (p?.scene.typeid) {
        // 工地
        case 1:
          _stage = p?.subScene?.siExtension1;
          _status = p?.subScene?.csStatus;
          break;
        // 码头
        case 2:
          _status = p?.subScene?.wStatus;
          break;
        // 搅拌站
        case 3:
          _status = p?.subScene?.mpStatus;
          break;
        // 堆场
        case 14:
          _status = p?.subScene?.syStatus;
          break;
        default:
          break;
      }
      return {
        ...p.scene,
        _stage: _stage,
        _status: _status
      };
    });
});
 
// 监听地图选中场景事件
function onUpdateSeletedSceneList(val) {
  seletedSceneList.value = val;
  selectedPlans.value = seletedSceneList.value.map((s) => {
    return props.plans.find((p) => p.scene.guid == s.guid);
  });
}
 
// 监听子任务移除事件
function onUpdateSelectedPlans(val) {
  selectedPlans.value = val;
  seletedSceneList.value = selectedPlans.value.map((v) => v.scene);
}
 
function handleSubmitDone(e) {
  console.log(e);
  emits('submit', e);
}
</script>
<style scoped>
.map-wrapper {
  position: relative;
  width: 100%;
  height: 90vh;
}
 
.right-wrapper {
  background-color: rgba(255, 255, 255, 0.8);
  box-shadow: var(--el-box-shadow);
  border-radius: 4px;
  height: 80vh;
}
 
.subtask-select {
  width: 330px;
  padding-left: 4px;
  padding-top: 8px;
}
 
.close-btn-left {
  margin-right: 0px;
  height: 60px;
  width: 20px;
}
 
.top-right-wrap {
  position: absolute;
  right: 0px;
  top: 1px;
}
</style>