hcong
2024-11-20 d7932d42a9c4a08376d542dbff8301e7d985b787
src/views/fysp/check/components/ArbitraryPhoto.vue
@@ -19,7 +19,7 @@
    return {
      // 无数据
      typesList: [],
      typesMap: new Map(),
      typesMap: new Map()
    };
  },
  mounted() {
@@ -31,19 +31,6 @@
      mediafileApi.getRoutineByStGuid(this.subtask.stGuid).then((res) => {
        let typeList = [];
        let typeMap = new Map();
        function hasThisTypeName(typeName) {
          return typeList.map((item) => item.typeName).indexOf(typeName) != -1;
        }
        function addNewType(typeId, typeName, img) {
          typeList.push({
            typeId: typeId,
            typeName: typeName
          });
          typeMap.set(typeId, [img]);
        }
        function addToThisType(typeId, img) {
          typeMap.get(typeId).push(img);
        }
        const data = res.data;
        for (const e of data) {
          let img = {
@@ -51,13 +38,18 @@
          };
          const businesstype = e.businesstype;
          const businesstypeid = e.businesstypeid;
          if (hasThisTypeName(businesstype)) {
            addToThisType(businesstypeid, img);
          if (
            typeList.find((item) => item.typeName == businesstype) != undefined
          ) {
            typeMap.get(businesstypeid).push(img);
          } else {
            addNewType(businesstypeid, businesstype, img);
            typeList.push({
              typeId: businesstypeid,
              typeName: businesstype
            });
            typeMap.set(businesstypeid, [img]);
          }
        }
        this.typesList = typeList;
        this.typesMap = typeMap;
      });