<template>
<div>



  <el-dialog :title="'度量结果'" :close-on-click-modal="false" :visible.sync="visible" :before-close="handleClose">
    <el-table
      :data="snoopValueAll"
      style="width: 100%">
      <el-table-column
        prop="measureColumn"
        label="字段名"
        width="180">
      </el-table-column>
      <el-table-column
        prop="measureType"
        label="探查类型"
        width="180">
      </el-table-column>
      <el-table-column
        prop="measureValue"
        label="探查结果">
      </el-table-column>
    </el-table>
<!--    <el-form  :model="snoopValueAll" label-width="100px"  v-loading="measDataListLoading"  style="word-break: break-word">-->
<!--      <el-form-item label="度量名称 :" prop="name">-->
<!--                          <el-input v-model="goal_info.config.name"></el-input>-->
<!--&lt;!&ndash;        <span>{{ snoopValueAll[0].measureType  }}</span>&ndash;&gt;-->
<!--      </el-form-item>-->
<!--      <el-form-item label="度量描述 :">-->
<!--        <span>{{ snoopValueAll[0].measureValue }}</span>-->
<!--        &lt;!&ndash;                  <el-input v-model="goal_info.config.description"></el-input>&ndash;&gt;-->
<!--      </el-form-item>-->
<!--      <el-form-item label="数据源 :">-->
<!--        <span>{{ snoopValueAll[0].measureColumn }}</span>-->
<!--        &lt;!&ndash;                  <el-input v-model="goal_info.equipment.name"></el-input>&ndash;&gt;-->
<!--      </el-form-item>-->
<!--      &lt;!&ndash;                <el-form-item label="查询条件 :">&ndash;&gt;-->
<!--      &lt;!&ndash;                  <span>{{goal_info.config.where}}</span>&ndash;&gt;-->
<!--      &lt;!&ndash;&lt;!&ndash;                  <el-input v-model="goal_info.config.where"></el-input>&ndash;&gt;&ndash;&gt;-->
<!--      &lt;!&ndash;                </el-form-item>&ndash;&gt;-->
<!--&lt;!&ndash;      <el-form-item label="分区信息 :">&ndash;&gt;-->
<!--&lt;!&ndash;        <span>{{snoopValueAll[0].partition}}</span>&ndash;&gt;-->
<!--&lt;!&ndash;        &lt;!&ndash;                                  <el-input v-model="goal_info.config.num" >{{goal_info.config.num + goal_info.config.timetype}}</el-input>&ndash;&gt;&ndash;&gt;-->
<!--&lt;!&ndash;        &lt;!&ndash;                                  <el-input v-model="goal_info.config.timezone"></el-input>&ndash;&gt;&ndash;&gt;-->
<!--&lt;!&ndash;      </el-form-item>&ndash;&gt;-->
<!--      <el-form-item label="度量规则 :">-->
<!--          <template v-for="rule in  goal_info.Cloum">-->
<!--            <li>{{ rule.name }} : {{ rule.infos }}</li>-->
<!--          </template>-->
<!--      </el-form-item>-->
<!--    </el-form>-->


<!--    <span slot="footer" class="dialog-footer">-->
<!--      <el-button @click="visible = false">取消</el-button>-->
<!--      <el-button type="primary" @click="visible=false">确定</el-button>-->
<!--    </span>-->
  </el-dialog>

</div>
</template>

<script>
export default {
  name: 'measureUserWatch',
  data () {
    return {
      goal_info: {},
      visible: false,
      measDataListLoading: false,
      snoopValueAll: []
    }
  },
  methods: {
    init (info) {
      this.visible = true
      this.measDataListLoading = false
      // console.info(info)
      this.getMeasureListById(info.measureID)
    },
    handleClose(done) {
      this.$confirm('确认关闭？')
        .then(_ => {
          done();
          this.snoopValueAll = []
        })
        .catch(_ => {});

    },
    getMeasureListById (id) {
      this.measDataListLoading = true
      this.classificationtag = null
      this.$http({
        url: this.$http.adornUrl('/snoopvalue/selectBySnoopId'),
        methods: 'get',
        params: this.$http.adornParams({
          snoopId: id
        })
      }).then((data) => {
        console.log(data)
        if (data && data.data.code === 0) {
          var res = data.data.snoopvaluelist
          for (let i = 0; i < res.length; i++) {
            var snoopValue = {
              measureType: res[i].measureType,
              measureValue: res[i].measureValue,
              measureColumn: res[i].measureColumn
            }
            this.snoopValueAll.push(snoopValue)
          }
          // var info = data.data
          // this.goal_info.name = info.name
          // this.goal_info.description = info.description
          // var dataScore = info['data.sources'][0].connector.config
          // this.goal_info.dataSources = dataScore.database + '  : ' + dataScore['table.name']
          // this.goal_info.partition = info['data.sources'][0].connector['data.unit']
          // this.goal_info.Cloum = info['rule.description'].details
        }
        console.log('snoopValueAll', this.snoopValueAll)
        this.measDataListLoading = false
      })
    }
  }
}
</script>

<style scoped>

</style>
