<template>
  <div>
    <el-button type="text" size="mini" @click="query_message(dialogTableVisible = true)">查看留言</el-button>
    <el-dialog title="留言信息" :visible.sync="dialogTableVisible">
       <!-- 表格主题 -->
      <tableLayout :layout="tablecols" :data="list" :opwidth="200" :custom="true">
        <template v-slot:customcol="scope">
          <div v-if="scope.column.columnname === 'usertype'">
            <p v-if="scope.column.data.usertype === 1">企业员工</p>
            <p v-else-if="scope.column.data.usertype === 21">经销商</p>
            <p v-else-if="scope.column.data.usertype === 22">经销商员工</p>
            <p v-else>未知</p>
          </div>
          <p v-else>{{scope.column.data[scope.column.columnname]}}</p>
        </template>
      </tableLayout>
    </el-dialog>
  </div>
</template>

<script>
export default {
  props:['data'],
  data () {
    return {
      dialogTableVisible:false,
      tablecols:[],
      list:[]
    }
  },
  methods:{
    async query_message() {
      const res = await this.$api.requested({
        "classname": "webmanage.saletool.notice.notice",
        "method": "queryReadRecord",
        "content": {
          "sat_noticeid":this.data.sat_noticeid
        }
      })
      this.list = res.data
    }
  },
  mounted () {
  },
  created () {
    this.tablecols = this.tool.tabelCol(this.$route.name)['tableMessage'].tablecols
  }
}

</script>
<style>
</style>