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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
<template>
  <div class="box-card">
    <v-header title="报到党员总计数据"></v-header>
    <!-- 统计区 -->
    <div class="fl-fw mr-b-10">
      <div class="fl-f mr-r-30">
        <div class="left-lable-dian"></div>
        <div class="fl-co mr-l-10 fz-7">
          <span>报到党员总数</span>
          <span class="mr-t-10 fc-red">{{
            StatusObject.partyMemberTotal || 0
          }}</span>
        </div>
      </div>
      <div class="fl-f mr-r-30">
        <div class="left-lable-dian"></div>
        <div class="fl-co mr-l-10 fz-7">
          <span>机关单位党员</span>
          <span class="mr-t-10 fc-red">{{ StatusObject.organTotal || 0 }}</span>
        </div>
      </div>
      <div class="fl-f mr-r-30">
        <div class="left-lable-dian"></div>
        <div class="fl-co mr-l-10 fz-7">
          <span>企事业单位党员</span>
          <span class="mr-t-10 fc-red">{{
            StatusObject.businessTotal || 0
          }}</span>
        </div>
      </div>
    </div>
    <!-- 按钮区 -->
    <div class="tool">
      <el-radio-group v-model="unitCheckType" @change="unitCheck">
        <el-radio-button :label="1">按单位归属统计</el-radio-button>
        <el-radio-button :label="2"> 按单位统计 </el-radio-button>
      </el-radio-group>
    </div>
    <!-- 正文 -->
    <div>
      <v-tool-table :trs="trs" :tds="tds">
        <template v-slot:partyMemberTotal="item">
          <el-button
            type="text"
            @click="handleClick('partyMemberTotal', item.scope)"
            >{{ item.scope.partyMemberTotal }}</el-button
          >
        </template>
        <template v-slot:organTotal="item">
          <el-button
            type="text"
            @click="handleClick('organTotal', item.scope)"
            >{{ item.scope.organTotal }}</el-button
          >
        </template>
        <template v-slot:businessTotal="item">
          <el-button
            type="text"
            @click="handleClick('businessTotal', item.scope)"
            >{{ item.scope.businessTotal }}</el-button
          >
        </template>
        <template v-slot:count="item">
          <el-button type="text" @click="handleClick('count', item.scope)">{{
            item.scope.count
          }}</el-button>
        </template>
      </v-tool-table>
    </div>
    <div class="page">
      <v-tool-page :item="paged" @on-page="onPage"></v-tool-page>
    </div>
  </div>
</template>
 
<script>
import { mapState } from "vuex";
export default {
  props: {},
  components: {},
  data() {
    return {
      os: {},
      total: 0,
      paged: { page: 0, total: 0, r: 0, limit: 10 },
      trs: [],
      tds: [],
      isZuZhibuUser: false,
      StatusObject: {},
      unitCheckType: 1,
    };
  },
  computed: {
    ...mapState({ vuex_page: "pageReset" }),
  },
  watch: {
    vuex_page: {
      handler(n) {
        if (n.page === this.$route.path) {
          this.paged.page = 1;
          this.unitCheckHandle(this.unitCheckType);
        }
      },
      deep: true,
    },
  },
  methods: {
    // 分页点击
    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.unitCheckHandle(this.unitCheckType);
    },
    unitCheck(val){
      this.paged.page = 1;
      this.paged.limit = 10;
      this.unitCheckHandle(val);
    },
    unitCheckHandle(val) {
      if (val === 1) {
        this.trs = [
          { text: "序号", val: "index" },
          { text: "单位归属", val: "belongTo" },
          { text: "合计报到党员", val: "btn", slot: "partyMemberTotal" },
          { text: "机关单位报到党员", val: "btn", slot: "organTotal" },
          { text: "企事业单位报到党员", val: "btn", slot: "businessTotal" },
        ];
        this.initLeft();
      } else {
        this.trs = [
          { text: "序号", val: "index" },
          { text: "单位名称", val: "name" },
          { text: "单位性质", val: "natureName" },
          { text: "单位归属", val: "belongTo" },
          { text: "服务社区", val: "helpCommunityName" },
          { text: "下沉服务小区(网格)院落", val: "villageName" },
          { text: "已报到党员", val: "btn", slot: "count" },
        ];
        this.initRight();
      }
    },
    // 获取数据
    initLeft() {
      let v = demo.copy(
        Object.assign(this.os, {
          pageNum: this.paged.page,
          pageSize: this.paged.limit,
        })
      );
      if (!this.isZuZhibuUser && demo.$session.get("user").communityId != 0) {
        v.communityId = demo.$session.get("user").communityId;
      }
      this.$api.post("checkUnit/pbStatistics/belong", v, (e) => {
        this.paged.total = e.total;
        e.records.map((item, index) => {
          item.index = (this.paged.page - 1) * this.paged.limit + index + 1;
        });
        this.paged.r++;
        this.tds = e.records || [];
      });
    },
    initRight() {
      let v = demo.copy(
        Object.assign(this.os, {
          pageNum: this.paged.page,
          pageSize: this.paged.limit,
        })
      );
      if (!this.isZuZhibuUser && demo.$session.get("user").communityId != 0) {
        v.communityId = demo.$session.get("user").communityId;
      }
      this.$api.post("checkUnit/pbStatistics/unit", v, (e) => {
        e.records.map((item, index) => {
          item.index = (this.paged.page - 1) * this.paged.limit + index + 1;
        });
        this.paged.total = e.total;
        this.paged.r++;
        this.tds = e.records || [];
      });
    },
    handleClick(type, row) {
      switch (type) {
        case "businessTotal": {
          this.$router.push(
            "/menberDetails?labelCheckType=1&name=企事业单位党员&belongTo=" +
              row.belongTo
          );
          break;
        }
        case "organTotal": {
          this.$router.push(
            "/menberDetails?labelCheckType=1&name=机关单位党员&belongTo=" +
              row.belongTo
          );
          break;
        }
        case "partyMemberTotal": {
          this.$router.push(
            "/menberDetails?labelCheckType=1&name=全部党员&belongTo=" +
              row.belongTo
          );
          break;
        }
        case "count": {
          this.$router.push(
            "/menberDetails?labelCheckType=2&name=全部党员&belongTo=" +
              row.belongTo +
              "&workUnitName=" +
              row.name +
              "&checkUnitId=" +
              row.id
          );
          break;
        }
        default: {
          break;
        }
      }
    },
    getTopData() {
      let obj = {};
      if (demo.$session.get("user").communityId != 0) {
        obj.communityId = demo.$session.get("user").communityId;
      }
      this.$api.get("checkUnit/pbStatistics/top", obj, (e) => {
        this.StatusObject = e;
      });
    },
  },
  mounted() {
    this.getTopData();
    this.isZuZhibuUser = demo.$session.get("user").account == "zuzhibu";
  },
};
</script>
<style lang='less' scoped>
.tab-content {
}
.left-lable-dian {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: rgb(24, 135, 240);
}
</style>