threestepInfo.js 2.24 KB
import {
  getThreestep,
  getBase64,
} from "@/api/business/threestep";

import {getToken} from "@/utils/auth";


import {
  getArea,
  truckList,
} from "@/api/dict";


export default {
  name: "ThreestepInfo",
  props: {
    businessKey: {
      type: String
    }
  },
  data() {
    return {
      areas: [],
      labelName: "工地名称",
      labelName2: "绑定处理场所",
      infoData: {type: 0},
      loading: null,
      showPic: false,
      picImage: null,
      slide1:[]
    }
  },
  created() {
    this.loading = true;
    this.getInfo();


  },
  methods: {
    slides1(img){
      return process.env.VUE_APP_BASE_API + img;
    },
    downloadFile(path) {
      window.location.href = process.env.VUE_APP_BASE_API + "/business/threestep/download?path=" + encodeURI(path);
    },

    getInfo() {
      let id;
      if (this.businessKey.split(":").length == 2) {
        id = this.businessKey.split(":")[1];
      } else {
        id = this.businessKey;
      }

      getThreestep(id).then(response => {
        this.infoData = response.data;

        this.selectType(this.infoData.type);
        this.infoData.type = this.infoData.type + "";


        getArea().then(res => {
          this.areas = res.result;
          this.loading = false;
          for (let i = 0; i < this.areas.length; i++) {
            if (Number(this.infoData.place) == this.areas[i].code) {
              this.infoData.place = this.areas[i].name;
            }
          }
        });

        let query = {
          'page': 1,
          'size': 9999,
          'valid': 0
        }
        truckList(query).then(res => {
          this.truckList = res.result.list;

          let trucks = "";

          for (let i in this.truckList) {
            if (this.infoData.companyTrucks.split(",").indexOf(this.truckList[i].id) > -1) {
              trucks += this.truckList[i].licenseplateNo + ",";
            }
          }
          this.infoData.companyTrucks = trucks;

        });


        });
      },
      selectType(value) {
        if (value == "0") {
          this.labelName = "工地名称";
          this.labelName2 = "绑定处理场所";
        } else {
          this.labelName = "处理场所名称";
          this.labelName2 = "绑定工地";
        }
      },
    }

}