<template>
  <div>
    <el-table
      :data="tableData"
      style="width: 100%">
      <el-table-column
        prop="nickname"
        label="昵称"
        width="180">
        <template slot-scope="scope">
 <span class="lblue point">
              <a
                :href="scope.row.user_url"
                target="_blank"
              > {{ scope.row.userinfo ? scope.row.userinfo.nickname : '-' }}({{ scope.row.uid }})</a>
            </span>
        </template>
      </el-table-column>
      <el-table-column
        prop="create_time_name"
        label="日期"
        width="180">
      </el-table-column>

      <el-table-column
        prop="content"
        label="备注内容">
      </el-table-column>
    </el-table>
    <div>
      <el-pagination
        @current-change="getDatas"
        :current-page.sync="pageInfo.page"
        :page-size="pageInfo.size"
        layout="total, prev, pager, next"
        :total="pageInfo.total"
      ></el-pagination>
    </div>

  </div>
</template>

<script>
export default {
  name: "remark_list",
  data() {
    return {
      tableData: [],
      formData: {
        obj_id: 0,
        type: 2
      },
      pageInfo: {
        page: 1,
        size: 20,
        total: 0,
      },
    }
  },
  mounted() {
    this.queryDataFormat();
  },
  methods: {
    queryDataFormat() {
      let query = this.$route.query;
      if (JSON.stringify(query) === "{}") {
        this.$message.error('参数错误');
        return;
      }
      this.formData.obj_id = query.obj_id || 0;
      this.formData.type = query.type || 0;
      this.getDatas();
    },
    async getDatas() {
      const res = await this.$post("/api/admin/kaifawu/remarkList", {
        type: this.formData.type,
        obj_id: this.formData.obj_id,
        page: this.pageInfo.page,
      });
      let data = res.data;
      this.tableData = data.list;
      this.pageInfo.total = Number(data.total);
      this.pageInfo.page = data.totalPage;
    }
  }
}
</script>

<style scoped>

</style>
