riku
2024-11-21 9b2b08c3b44de3d2f76069936dfe5ba0e0ece0aa
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
<template>
  <FYImageSelectDialog
    v-loading="loading"
    title="场景图片"
    :typeList="typesList"
    :typeImgMap="typesMap"
  ></FYImageSelectDialog>
</template>
<script>
import mediafileApi from '@/api/fysp/mediafileApi.js';
import { $fysp } from '@/api/index.js';
export default {
  props: {
    subtask: {
      type: Object,
      efault: {}
    }
  },
  data() {
    return {
      // 无数据
      typesList: [],
      typesMap: new Map(),
      loading: true,
    };
  },
  mounted() {
    this.getGroupImgs();
  },
  methods: {
    // 图片分类
    getGroupImgs() {
      mediafileApi.getRoutineByStGuid(this.subtask.stGuid).then((res) => {
        this.loading = true
        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'
          };
          const businesstype = e.businesstype;
          const businesstypeid = e.businesstypeid;
          if (
            typeList.find((item) => item.typeName == businesstype) != undefined
          ) {
            typeMap.get(businesstypeid).push(img);
          } else {
            typeList.push({
              typeId: businesstypeid,
              typeName: businesstype
            });
            typeMap.set(businesstypeid, [img]);
          }
        }
        this.typesList = typeList;
        this.typesMap = typeMap;
      }).finally(() => (this.loading = false));
    }
  }
};
</script>
<style scoped></style>