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
<template>
  <div class="box-a">
    <v-header
      title="签到签退记录"
      :bar="bar"
      search
      @on-search="onSearch"
      :reset="headerReset"
    ></v-header>
    <div class="but">
      <el-button @click="exports" size="small" type="primary">导出</el-button>
    </div>
    <div>
      <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 {
  name: "index",
  props: [],
  components: {},
  data() {
    return {
      retsub: false, //防连点 节流
      dialogVisible: false,
      Authorization: "",
      bar: [
        { title: "手机号", name: "phone" },
        { title: "姓名", name: "name" },
        { title: "签到时间", name: "timeArr", type: "times" },
        {
          title: "人群标签",
          name: "tags",
          type: "select",
          list: [],
        },
      ],
      tds: [],
      trs: [
        { text: "序号", val: "index" },
        { text: "签到时间", val: "startTime" },
        { text: "签退时间", val: "endTime" },
        { text: "姓名", val: "name" },
        { text: "身份", val: "identity" },
        { text: "参加次数序号", val: "times" },
        { text: "人群标签", val: "tags" },
        { text: "电话", val: "phone" },
      ],
      search: {},
      os: {
        areaId: "",
        cardNo: "",
        userName: "",
        mobile: "",
        brand: "",
        plateNum: "",
        color: "",
      },
      options: [], //小区列表
      paged: { page: 0, total: 10, r: 0, limit: 10 },
      headerReset: 0,
      dialogVisibleTitle: false, // 编辑为true
      tagsList: [],
    };
  },
  created() {
    this.Authorization = "Bearer " + demo.$session.get("token") || "";
    this.init();
  },
  mounted() {
    this.getPersonTags();
  },
  watch: {},
  computed: {},
  methods: {
    exports() {
      //导出
      let data = Object.assign(this.search, {
        pageNum: this.paged.page,
        pageSize: this.paged.limit,
        activityId: this.$route.params.id,
        activityType:2
      });
      this.$api.post("communityactivity/regist/export", data, (e) => {
        window.location.href = e;
      });
    },
    onSearch(e) {
      console.log(e);
      e.startTime = e.timeArr ? e.timeArr[0] : "";
      e.endTime = e.timeArr ? e.timeArr[1] : "";
      delete e.timeArr;
      this.search = e;
      // const regExp = /^([1][3,4,5,6,7,8,9])\d{9}$/
      // if (regExp.test(e.phone) === false) {
      //   return demo.toast("请输入正确的手机号码")
      // }
      this.init();
    },
    // 获取人员标签
    getPersonTags() {
      this.$api.get("communityactivity/userTags/getList", {}, (e) => {
        e.forEach((item) => {
          this.bar[3].list.push({
            value: item,
            label: item,
          });
        });
      });
    },
    init() {
      let data = Object.assign(this.search, {
        pageNum: this.paged.page,
        pageSize: this.paged.limit,
        activityId: this.$route.params.id,
        activityType:2
      });
      this.$api.post("communityactivity/regist/page", data, (e) => {
        e.records.map((item, index) => {
          item.index = (this.paged.page - 1) * this.paged.limit + index + 1;
        });
        this.paged.total = e.total;
        this.tds = e.records;
      });
    },
    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();
    },
  },
};
</script>
<style scoped>
.box-a {
  overflow: scroll;
}
.but {
  padding-bottom: 20px;
  display: flex;
}
.upload-box {
  margin: 0 16px;
}
</style>