WYB
2021-03-22 91b8cdad021ab052e4991f3d41834a6f0ddc36b8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<template>
  <section>
    <!--列表-->
    <el-table :data="List" highlight-current-row style="width: 100%">
      <el-table-column type="index" width="50"></el-table-column>
      <el-table-column
        prop="Content"
        label="内容"
        width
        sortable
      ></el-table-column>
      <el-table-column
        prop="CreateRealName"
        label="创建人"
        width="110"
        sortable
      ></el-table-column>
      <el-table-column
        prop="CreateTime"
        label="创建时间"
        width="160"
        :formatter="Com.ElTableTime"
        sortable
      ></el-table-column>
    </el-table>
    <!--工具条-->
    <el-col :span="24" class="toolbar">
      <el-pagination
        layout="prev, pager, next"
        @current-change="ChangePageIndex"
        :page-size="PageSize"
        :total="Total"
      ></el-pagination>
    </el-col>
  </section>
</template>
 
<script>
import axios from "axios";
import Com from "@/com/global";
 
export default {
  name: "LogRow",
  components: {},
  data() {
    return {
      Com: Com,
      List: [],
      PageIndex: 1,
      Total: 0,
      PageSize: 0,
    };
  },
  props: ["ListUrl", "SearchInfo", "Map"],
  methods: {
    //获取列表
    async GetList() {
      let _this = this;
      _this.List=[];
       _this.SearchInfo.PageIndex=_this.PageIndex;
      let prms = { params: _this.SearchInfo };
      let rst = await axios.get(_this.ListUrl, prms);
      let data = rst.data;
      if (!data.success) {
        _this.$message({
          message: data.msg,
          type: "error",
        });
      }
      let lst=data.response.data;
      _this.MapTo(lst);
      _this.List = lst;debugger
      _this.Total = data.response.dataCount;
      _this.PageSize = data.response.PageSize;
    },
    ChangePageIndex(PageIndex) {
      this.PageIndex = PageIndex;
      this.GetList();
    },
    MapTo(List) {
      let map = this.Map;
      for (let i = 0, c = List.length; i < c; i++) {
        let obj = List[i];
        for (let name in map) {
          obj[map[name]] = obj[name];
        }
      }
    },
  },
  mounted() {
    this.GetList();
  },
  watch: {
    SearchInfo: function () {
      this.GetList();
    },
  },
};
</script>