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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<template>
  <div class="act_list">
    <v-header
      title="活动报名名单"
      search
      :bar="bar"
      @on-search="onSearch"
    ></v-header>
    <!-- <div class="tool">
      <span>活动名称:xxxx</span><span>报名时间:0000-00-00</span>
    </div> -->
    <div class="but">
      <el-button @click="exports" size="small" type="primary">导出</el-button>
    </div>
    <div class="tab">
      <v-tool-table :trs="trs" :tds="tds">
        <template v-slot:status="{scope}">
           {{scope.status ? "已报名" : '已取消'}}
        </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: "phone" },
        { title: "姓名", name: "name" },
        {
          title: "身份",
          name: "identity",
          type: "select",
          list: [
            { label: "居民", value: 1 },
            { label: "党员", value: 2 },
            { label: "志愿者", value: 3 },
          ],
        },
         {
          title: "状态",
          name: "status",
          type: "select",
          list: [
            { label: "已报名", value: 1 },
            { label: "已取消", value: 0 },
          ],
        },
      ],
      trs: [
        { text: "序号", val: "index", width: "50px" },
        { text: "姓名", val: "name" },
        { text: "身份", val: "identity" },
        { text: "报名状态", val: "btn",slot:"status" },
        { text: "取消原因", val: "reason" },
        { text: "参与情况", val: "times" },
        { text: "获得奖励", val: "award" },
        { text: "人员标签", val: "tags" },
        { text: "手机号", val: "phone" },
        { text: "报名时间", val: "createAt" },
        // { text: "报名状态", val: "" },
        // { text: "取消原因", val: "" },
        // { text: "参与情况", val: "" },
        // { text: "参与时长", val: "" },
        // { text: "获得奖励", val: "" },
      ],
      paged: { page: 0, total: 0, r: 0, limit: 10 },
      tds: [],
      id: "",
      search: {},
    };
  },
  watch: {},
  methods: {
    exports() {
      //导出
      let data = {
        activityId: this.$route.params.id,
      };
      this.$api.post("communityactivity/sign/export", data, (e) => {
        window.location.href = e;
      });
    },
    onSearch(v) {
      this.search = v;
      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();
    },
    init() {
      if (!this.id) {
        demo.toast("无效活动");
        return 0;
      }
      let os = demo.copy(
        Object.assign(this.search, {
          activityId: this.id,
          pageNum: this.paged.page,
          pageSize: this.paged.limit,
        })
      );
      this.$api.post("communityactivity/listactivitysign", os, (e) => {
        e.records.map((item, index) => {
          item.index = (this.paged.page - 1) * this.paged.limit + index + 1;
        });
        this.tds = e.records;
        this.paged.total = e.total;
        // this.tds = e;
      });
    },
  },
  mounted() {
    this.id = this.$route.params.id;
    this.init();
    // this.tds = [0, 0, 0, 0, 0, 0, 0, 0].map((k, v) => {
    //   return {
    //     key: v + 1,
    //     id: v + 1,
    //     name: demo.rand(6),
    //     job: demo.rand(3),
    //     time: demo.timeout(),
    //     tel: "135" + demo.rand(8),
    //   };
    // });
  },
};
</script>
<style lang='less' scoped>
.act_list {
  .tab {
    margin: 10px 0;
  }
  .tool {
    display: flex;
    span {
      margin-right: 50px;
      color: rgb(51, 51, 51);
      font-size: 14px;
      &:last-child {
        margin-right: 0;
      }
    }
  }
}
.but {
  padding-bottom: 20px;
  display: flex;
}
</style>