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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<template>
  <div class="activity_list">
    <v-header
      title="活动报名名单"
      :bar="bar"
      search
      @on-search="onSearch"
    ></v-header>
    <!-- <div class="tool">
      <span>活动名称:{{ title }}</span>
      <span>创建时间:{{ time }}</span>
    </div> -->
    <div class="but mr-b-10">
      <el-button @click="exports" size="small" type="primary">导出</el-button>
    </div>
    <div class="tab">
      <v-tool-table :trs="trs" :tds="tds"></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: "phone" },
        { title: "姓名", name: "name" },
        {
          title: "状态",
          name: "status",
          type: "select",
          list: [
            { value: "1", label: "已报名" },
            { value: "0", label: "已取消" },
          ],
        },
        // {
        //   title: "身份",
        //   name: "type",
        //   type: "select",
        //   list: [
        //     { value: "1", label: "居民" },
        //     { value: "2", label: "志愿者" },
        //     { value: "3", label: "党员" },
        //   ],
        // },
      ],
      trs: [
        { text: "序号", val: "id", width: "80px" },
        { text: "姓名", val: "name" },
        { text: "身份", val: "identity" },
        { text: "手机号", val: "phone" },
        { text: "报名状态", val: "status" },
        { text: "取消原因", val: "reason" },
        { text: "报名次数序号", val: "times" },
        { text: "报名时间", val: "createAt" },
      ],
      tds: [],
      id: -1,
      paged: { page: 0, total: 0, r: 0, limit: 10 },
      search: {},
      os: {},
      title: "",
      time: "",
    };
  },
  watch: {},
  methods: {
    onSearch(v) {
      this.search = v;
      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();
    },
    exports() {
      //导出
      let data = {
        activityId: this.$route.params.id,
      };
      this.$api.post("communityactivity/sign/export/new", data, (e) => {
        window.location.href = e;
      });
    },
    // 获取数据
    init() {
      let v = demo.copy(
        Object.assign(this.os, this.search, {
          pageNum: this.paged.page,
          pageSize: this.paged.limit,
          activityId: this.id,
        })
      );
      this.$api.post("communityactivity/listactivitysign", v, (e) => {
        e.records.forEach((item) => {
          item.status = item.status == 1 ? "已报名" : "已取消";
          item.dy = '党员'
        });
        let page = e.records || {};
        this.paged.total = e.total;
        this.paged.r++;
        this.tds = page || [];
      });
    },
  },
  mounted() {
    this.id = this.$route.params.id;
  },
};
</script>
<style lang='less' scoped>
.activity_list {
  .tool {
    display: flex;
    flex-wrap: wrap;
    font-size: 13px;
    margin: 5px 0 10px;
    span {
      margin-right: 50px;
      &:last-child {
        margin-right: 0;
      }
    }
  }
  .tab {
    margin-bottom: 10px;
  }
}
</style>