Riku
2025-06-23 ff82e86becbd200adabd2ce56fba1f6b3c6c37e1
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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
<template>
  <el-scrollbar v-if="mapStore.focusMarker" class="wrapper">
    <el-card class="p-events-auto">
      <el-row justify="space-between">
        <!-- <div class="font-small">{{ scene.name }}</div> -->
        <el-text size="large">{{ scene.name }}</el-text>
        <el-button icon="Close" circle @click="mapStore.focusMarker = undefined"></el-button>
      </el-row>
      <el-row justify="space-between">
        <el-text size="small">{{ '地址:' + scene.location }}</el-text>
      </el-row>
      <el-space class="m-t-8">
        <el-tag type="info" effect="plain">
          {{ scene.districtname + scene.townname }}
        </el-tag>
        <el-tag type="info" effect="plain">
          {{ scene.type }}
        </el-tag>
      </el-space>
      <el-divider></el-divider>
      <el-row justify="space-between">
        <el-col :span="8" style="text-align: center">
          <el-text>状态:{{ subtask.status }}</el-text>
        </el-col>
        <el-col :span="8" style="text-align: center">
          <el-text>计划:{{ $fm.formatYMD(subtask.planstarttime) }}</el-text>
        </el-col>
        <el-col v-if="subtask.status != '未执行'" :span="8" style="text-align: center">
          <el-text>
            <span>执行:{{ $fm.formatH(subtask.executionstarttime) }}</span>
            <!-- <span> - </span>
          <span>{{ $fm.formatYMDH(subtask.executionendtime) }}</span> -->
          </el-text>
        </el-col>
      </el-row>
 
      <el-segmented v-model="value" :options="options" block />
      <div v-show="value == '现场问题'">
        <problem-item
          v-for="(item, i) in problemList"
          :key="item.guid"
          :index="i + 1"
          :problem="item"
        ></problem-item>
        <el-empty v-if="problemList.length == 0" description="无现场问题">
          <template #image> </template>
        </el-empty>
      </div>
      <div v-show="value == '场景图片'">
        <FYImageSelectDialog
          readonly
          height="500px"
          :imageWidth="134"
          v-loading="scenePicLoading"
          :typeList="scenePicTypeList"
          :typeImgMap="scenePicTypeMap"
        ></FYImageSelectDialog>
      </div>
      <div v-show="value == '设备设施'">
        
      </div>
    </el-card>
  </el-scrollbar>
</template>
 
<script setup>
import { inject, ref, computed, watch } from 'vue'
import { useMapStore } from '@/stores/map.js'
import { mapStores } from 'pinia'
 
import { $fysp } from '@/api/index.js'
import problemApi from '@/api/fysp/problemApi.js'
import mediafileApi from '@/api/fysp/mediafileApi.js'
import deviceApi from '@/api/fysp/deviceApi'
 
/**
 * 具体巡查任务可视化
 * 包括地图定位信息展示、巡查任务全流程平铺展示
 */
const mapHeight = inject('mapHeight')
const height = 'height:' + mapHeight
 
const mapStore = useMapStore()
const subtask = computed(() => (mapStore.focusMarker ? mapStore.focusMarker.subtask : undefined))
const scene = computed(() => (mapStore.focusMarker ? mapStore.focusMarker.scene : undefined))
const inspection = computed(() =>
  mapStore.focusMarker ? mapStore.focusMarker.inspection : undefined
)
 
const value = ref('现场问题')
const options = ['现场问题', '场景图片', '设备设施']
 
const problemList = ref([])
const problemListLoading = ref(false)
 
const scenePicTypeList = ref([])
const scenePicTypeMap = ref(new Map())
const scenePicLoading = ref(false)
 
watch(subtask, (nV, oV) => {
  if (nV != undefined && nV != oV) {
    fetchProblem(nV.stguid)
    getRoutineByStGuid(nV.stguid)
  }
})
function fetchProblem(stguid) {
  problemListLoading.value = true
  problemApi
    .fetchProblems(stguid)
    .then((res) => {
      problemList.value = res
    })
    .finally(() => (problemListLoading.value = false))
}
 
// 图片分类
function getRoutineByStGuid(stguid) {
  scenePicLoading.value = true
  mediafileApi
    .getRoutineByStGuid(stguid)
    .then((res) => {
      let typeList = []
      let typeMap = new Map()
      const data = res.data
      for (const e of data) {
        let img = {
          url: $fysp.imgUrl + e.extension1 + e.guid + '.jpg',
          data: e
        }
        const businesstype = e.businesstype
        const businesstypeid = e.businesstypeid
        if (typeList.find((item) => item.typeId == businesstypeid) != undefined) {
          typeMap.get(businesstypeid).push(img)
        } else {
          typeList.push({
            typeId: businesstypeid,
            typeName: businesstype
          })
          typeMap.set(businesstypeid, [img])
        }
      }
      scenePicTypeList.value = typeList
      scenePicTypeMap.value = typeMap
    })
    .finally(() => (scenePicLoading.value = false))
}
 
function fetchDevices() {
  deviceApi.fetchDevices(scene.value.guid, this.currSelect.topDeviceTypeId).then((result) => {
    this.initList()
    if (result.data == null || result.data.length <= 0) {
      this.isEmpty = true
      return
    }
    // 标准化属性名
    for (let index = 0; index < result.data.length; index++) {
      var element = this.convertKeys(result.data[index])
      this.initFormData(element)
      // 获取设备状态信息
      let data = {
        deviceId: element.id,
        sceneId: element.sceneGuid,
        deviceTypeId: this.currSelect.topDeviceTypeId
      }
      deviceApi.fetchDeviceStatus(data).then((status) => {
        var statusData = status.data
        var imgPaths = []
        if (statusData) {
          if (statusData.length == 0) {
            this.formInfo.push(element)
            return
          }
          element = this.convertKeys(result.data[index])
          element = this.setDeviceType(element)
          element._picUrls = imgPaths
          for (let index = 0; index < statusData.length; index++) {
            const statusItem = statusData[index]
            // 设备对象添加一个属性列表属性用来保存设备状态
            this.saveStatus(element, statusItem)
            element.dlLocation = statusItem.dlLocation
            this.formInfo.push(element)
          }
        }
      })
    }
  })
}
</script>
 
<style scoped>
.wrapper {
  width: 450px;
  max-height: 800px;
}
 
.el-card {
  --el-card-padding: 8px;
}
</style>