hejianhao
2025-04-16 dab2d210ca06c1faa514c6388fbd5de1ab355360
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<template>
  <div class='old_report'>
    <v-header
      title="生存认证报表"
      :bar="bar"
      search
      @on-search="onSearch"
    ></v-header>
    <div class="tips">提示:1.导出时只能导出已认证的老人信息,未认证的老人信息不能导出</div>
    <!---->
    <div class="table">
      <v-tool-table
        :trs="trs"
        :tds="tds"
      >
        <template v-slot:btn="{scope}">
          <div class="table_flex">
            <span @click="onSend(scope)">导出</span>
          </div>
        </template>
      </v-tool-table>
    </div>
    <v-tool-page
      :item="paged"
      @on-page="onPage"
    ></v-tool-page>
  </div>
</template>
 
<script>
export default {
  props: {},
  components: {},
  data() {
    return {
      bar: [
        {
          title: "月份",
          name: "month",
          type: "select",
          list: [],
        },
      ],
      trs: [
        { text: "月份", val: "month", width: "120px" },
        { text: "高龄老人(人)", val: "sum" },
        { text: "已认证(人)", val: "authSum" },
        { text: "未认证(人)", val: "noAuthSum" },
        { text: "操作", val: "btn" },
      ],
      tds: [],
      paged: { page: 0, total: 0, r: 0, limit: 10 },
      search: {},
    };
  },
  watch: {},
  methods: {
    onSearch(x) {
      this.search = x;
      this.paged.page = 1;
      this.init();
    },
    onPage(v) {
      if (v.page === this.paged.page && v.page && !v.reset) {
        return 0;
      }
      this.paged.page = v.page;
      this.paged.limit = v.limit;
      this.init();
    },
    onSend(e) {
      // console.log(e)
      let data = {
        year:e.year,
        month:e.month
      }
      // return
      this.$api.post("elders/history/export",data, (e) => {
        window.location.href = e;
      });
    },
    init() {
      let v = demo.copy(
        Object.assign({}, this.search, {
          pageNum: this.paged.page,
          pageSize: this.paged.limit,
          year: 2021,
        })
      );
      this.$api.post("elders/history/page", v, (e) => {
        this.paged.total = e.total;
        this.paged.r++;
        this.tds = (e.records || []).map((r) => {
          r.is_check = false;
          return r;
        });
      });
    },
  },
  created() {
    for (let i = 0; i <= 12; i++) {
      this.bar[0].list.push({
        label: i === 0 ? "全部" : i + "月",
        value: i === 0 ? "" : i,
      });
    }
  },
  mounted() {},
};
</script>
<style lang='less' scoped>
.old_report {
  overflow-y: auto;
  .tips {
    color: #7f7f7f;
    font-size: 14px;
  }
  .table {
    margin: 20px 0;
  }
}
</style>