文件版本diff

53 阅读1分钟

监听弹框是否显示 value === isShow

watch: {
    value() {
      if (this.value) {
        this.loading = true
        const jobList = [{ version: this.testJobVersion, val: 'testJob' }, { version: this.runHistoryVersion, val: 'runningJob' }]
        Promise.all(jobList.map(v => {
          return this.getTaskDetailInfo(v.version)
        })).then(res => {
          jobList.forEach((v, i) => {
            const { dataMap } = res[i]
            dataMap.checkpoint = dataMap?.checkpoint === 'true'
            dataMap.autoscaler = dataMap?.autoscaler === 'true'
            this[v.val] = dataMap
          })
          Object.keys(this.testJob).forEach(v => {
            this.testJob['diff-' + v] = this.testJob[v] !== this.runningJob[v]
          })
          this.loading = false
        })
      }
    }
  },