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
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
<template>
  <div class="custom-box">
    <div class="title">志愿者队伍</div>
    <div class="titleList">
      <div>
        <span>志愿者组织</span>
        <b>{{ navList.orgTotal || 0 }}</b>
      </div>
      <div>
        <span>志愿者队伍</span>
        <b>{{ navList.teamTotal || 0 }}</b>
      </div>
      <div>
        <span>志愿者</span>
        <b>{{ navList.volunteerTotal || 0 }}</b>
      </div>
    </div>
    <div class="serachContent">
      <el-form :inline="true" class="demo-form-inline">
        <!-- <el-form-item label="关键词">
          <el-input v-model="search.keyWord" style="width:350px" size="small"
                    placeholder="请输入志愿者组织、志愿者名称、年龄、身份证关键词进行查找"></el-input>
        </el-form-item> -->
 
        <el-form-item
          label="服务类型"
        >
          <el-select
            v-model="search.serviceTypeId"
            size="small"
            class="iw-180"
            clearable
            filterable
            placeholder="请选择状态"
          >
            <el-option
              v-for="item in serveroptions"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="大学生">
          <el-select
            v-model="search.isUniversity"
            size="small"
            class="iw-180"
            clearable
            filterable
            placeholder="请选择"
          >
            <el-option
              v-for="item in isCollegeList"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-button size="small" type="primary" @click="onSearch()"
            >查询</el-button
          >
          <el-button size="small" @click="Reset()">重置</el-button>
        </el-form-item>
      </el-form>
    </div>
    <div class="addBtn">
      <el-button
        size="small"
        type="primary"
        @click="$router.push('/man_skillAdmin')"
        >技能管理</el-button
      >
      <el-button
        size="small"
        type="primary"
        @click="$router.push('/man_volType')"
        >服务类型管理</el-button
      >
      <el-button size="small" type="primary" @click="addteam"
        >添加组织</el-button
      >
      <el-button size="small" type="primary" @click="addvolunteerHandle"
        >添加志愿者</el-button
      >
    </div>
    <div class="rankContent">
      <!-- 志愿者组织 -->
      <div class="leftCollapse">
        <el-collapse v-model="activeNames" accordion>
          <div v-for="(item, index) in volunteerList" :key="index">
            <el-collapse-item class="custom-collapse" :name="index + 1">
              <div
                slot="title"
                @click="zhuzi(index)"
                class="fl-sb"
                style="width: 300px"
              >
                <span :class="activeName === index + 1 ? 'choose' : ''">{{
                  item.label
                }}</span>
                <span class="icon">
                  <i
                    class="el-icon-circle-plus-outline Brand"
                    @click.stop="addRank(item)"
                  ></i>
                  <i
                    class="el-icon-edit-outline Warning"
                    @click.stop="editRank(item)"
                  ></i>
                  <i
                    class="el-icon-delete Danger"
                    @click="deletesRank(item.value)"
                  ></i
                ></span>
              </div>
              <div>
                <div
                  v-for="(text, index2) in item.children"
                  :key="index2"
                  :class="activeNamesamll === index2 + 1 ? 'choose' : ''"
                  @click="team(index, index2)"
                  class="fl-sb"
                  style="width: 250px"
                >
                  {{ text.label }}
                  <span class="icon">
                    <i
                      class="el-icon-circle-plus-outline Brand"
                      @click="addVolunteer(text, item.id)"
                    ></i>
                    <i
                      class="el-icon-edit-outline Warning"
                      @click="editVolunteer(text, item.id)"
                    ></i>
                    <i
                      class="el-icon-delete Danger"
                      @click="deleteVolunteer(text.id)"
                    ></i
                  ></span>
                </div>
              </div>
            </el-collapse-item>
          </div>
        </el-collapse>
      </div>
      <!-- 队伍列表 -->
      <div class="tableBox">
        <my-eltable
          id="printTable"
          ref="mt"
          :paginationDataSource="tableData"
          :tabheight="tabheight"
          :tableHeader="tableHeader"
          :loading="loading"
          :checkbox="checkboxTable"
          :isIndex="isIndex"
          @onPageSizeChange="onPageSizeChange"
          @onPaginationChange="onPaginationChange"
        >
          <template v-slot:pic="{ scope }">
            <img :src="scope.photoPath" style="width: 70px; height: 70px" />
          </template>
          <template v-slot:isc="{ scope }">
            <span v-if="scope.isUniversity == 1">是</span>
            <span v-if="scope.isUniversity == 2">否</span>
          </template>
          <template v-slot:btn="{ scope }">
            <el-button type="text" @click="edit(scope)">编辑</el-button>
            <el-button type="text" @click="deletes(scope)">删除</el-button>
          </template>
        </my-eltable>
      </div>
    </div>
    <!-- 新增/编辑 志愿者 -->
    <ExamineAdd
      v-model="isShowExamineAdd"
      :data="data"
      @change="isShowExamineAdd = false"
      @success="onExamineAddSuccess"
    ></ExamineAdd>
    <!-- 新增/编辑队伍 -->
    <AddRank
      v-model="isAddRank"
      :rankItem="rankItem"
      :isEdit="isEdit"
      @change="isAddRank = false"
      @success="onAddRankSuccess"
    ></AddRank>
    <!-- 新增/编辑组织 -->
    <AddOrganization
      v-model="isAddOrganization"
      :rankID="rankID"
      @change="isAddOrganization = false"
      @success="OrganizationSuccess"
    ></AddOrganization>
  </div>
</template>
<script>
import MyEltable from "@/components/table/table2";
import ExamineAdd from "./com/ExamineAdd";
import AddRank from "./com/AddRank";
import AddOrganization from "./com/AddOrganization";
export default {
  props: [],
  components: { MyEltable, ExamineAdd, AddRank, AddOrganization },
  data() {
    return {
      isShowExamineAdd: false,
      isAddRank: false,
      isAddOrganization: false,
      activeName: "",
      activeNamesamll: "",
      isShow: false,
      tableData: {},
      loading: false,
      checkboxTable: false,
      isIndex: true,
      tabheight: "100%",
      data: {},
      isCollegeList: [
        {
          label: "是",
          value: 1,
        },
        {
          label: "否",
          value: 2,
        },
      ],
      tableHeader: [
        { label: "志愿者名称", prop: "name" },
        { label: "技能", prop: "skillName" },
        { label: "手机号", prop: "phone" },
        { label: "照片", slot: "pic" },
        { label: "是否是大学生", slot: "isc" },
        { label: "大学名称", prop: "universityName" },
        { label: "身份证", prop: "idCard" },
        { label: "年龄", prop: "age" },
        { label: "志愿者组织", prop: "orgName" },
        { label: "志愿者队伍", prop: "teamName" },
        { label: "服务类型", prop: "serviceTypeName" },
        { label: "操作", slot: "btn", width: "120px" },
      ],
      search: {
        serviceTypeId: "",
        keyWord: "",
        orgId: "",
        teamId: "",
        isUniversity: "",
      },
      activeNames: ["1"],
      serveroptions: [],
      /** 分页参数 */
      paginationParams: {
        currentPage: 1,
        pageSize: 10,
        total: 0,
      },
      volunteerList: [],
      rankItem: {},
      isEdit: false,
      rankID: {},
      navList: {},
    };
  },
  created() {},
  mounted() {
    this.init();
    this.getStatistics();
    this.orgList();
    this.serverList();
  },
  methods: {
    async getStatistics() {
      this.$api.get("volunteer/org/statistics", "", (res) => {
        this.navList = res;
      });
    },
    async serverList() {
      // const res = await organizationServicer.serverList();
      this.$api.get("volunteer/service/type/list", "", (res) => {
        this.serveroptions = res.map((d) => {
          return {
            label: d.name,
            value: d.id,
          };
        });
      });
    },
    onSearch() {
      this.init();
    },
    Reset() {
      this.search = {
        serviceTypeId: "",
        keyword: "",
      };
      this.search.orgId = "";
      this.search.teamId = "";
      this.init();
    },
    init() {
      const params = {
        pageNum: this.paginationParams.currentPage,
        pageSize: this.paginationParams.pageSize,
        ...this.search,
      };
      this.$api.put("communitymanager/pagevolunteer", params, (e) => {
        this.tableData = e;
      });
    },
    /** 新增组织 */
    addteam() {
      this.rankID = {};
      this.isAddOrganization = true;
    },
    /** 编辑组织 */
    editRank(d) {
      this.isAddOrganization = true;
      d.id = d.value;
      this.rankID = d;
    },
    /** 新增志愿者 */
    addVolunteer(d, id) {
      this.data = {
        orgId: id,
        teamId: d.id,
      };
      this.isShowExamineAdd = true;
    },
    addvolunteerHandle() {
      this.data = {
        nameText: "123",
      };
      this.isShowExamineAdd = true;
    },
    /** pageSize 改变时会触发 */
    onPageSizeChange(pageSize) {
      this.paginationParams.pageSize = pageSize;
      this.init();
    },
    /** 分页 */
    onPaginationChange(page) {
      this.paginationParams.currentPage = page;
      this.init();
    },
    /** 编辑志愿者 */
    edit(d) {
      this.data = d;
      this.isShowExamineAdd = true;
    },
    /** 删除志愿者 */
    deletes(d) {
      this.$confirm("确定要删除该内容吗?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          // await organizationServicer.deleteVolunteer(d)
          this.$api.del("communitymanager/volunteer", d, (e) => {
            this.$message.error("删除成功");
            this.init();
          });
        })
        .catch((res) => {
          // this.$message(res.message)
        });
    },
 
    onExamineAddSuccess() {
      this.isShowExamineAdd = false;
      this.init();
    },
    onAddRankSuccess() {
      this.isAddRank = false;
      this.orgList();
    },
    OrganizationSuccess() {
      this.isAddOrganization = false;
      this.orgList();
    },
    /** 删除队伍 */
    async deleteVolunteer(id) {
      this.$confirm("此操作将永久删除队伍, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      }).then(() => {
        this.$api.get("volunteer/org/delete", { id: id }, (res) => {
          this.$message.error("删除成功");
          this.orgList();
        });
        this.orgList();
      });
    },
    /** 新增队伍 */
    addRank(row) {
      this.isEdit = false;
      this.isAddRank = true;
      this.rankItem = {
        parantId: row.id,
      };
    },
    /** 删除志愿者组织 */
    async deletesRank(id) {
      this.$confirm("此操作将永久删除志愿者组织, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      }).then(() => {
        this.$api.get("volunteer/org/delete", { id: id }, (res) => {
          this.$message.success("删除成功");
          this.orgList();
        });
      });
    },
    /** 编辑队伍 */
    editVolunteer(d, parantId) {
      this.isEdit = true;
      this.isAddRank = true;
      this.rankItem = {
        name: d.label,
        id: d.id,
        parantId: parantId,
        serviceTypeId: d.serviceTypeId,
      };
    },
    /** 查询组织下志愿者 */
    zhuzi(index) {
      console.log(index);
      this.activeName = index + 1;
      this.activeNamesamll = "";
      this.search.orgId = this.volunteerList[index].value;
      this.search.teamId = "";
      this.init();
    },
    /** 查询队伍下志愿者
     * index 组织的索引  index2队伍的索引*/
    team(index, index2) {
      this.activeNamesamll = index2 + 1;
      this.activeName = "";
      const parant = this.volunteerList[index];
      this.search.orgId = parant.value;
      this.search.teamId = parant.children[index2].value;
      this.init();
    },
    async orgList() {
      this.$api.get("volunteer/org/list", "", (res) => {
        this.volunteerList = res.map((d) => {
          return {
            value: d.id,
            label: d.name,
            ...d,
            children:
              d.childList &&
              d.childList.map((e) => {
                return {
                  value: e.id,
                  label: e.name,
                  ...e,
                };
              }),
          };
        });
      });
    },
  },
  watch: {},
  computed: {},
};
</script>
<style lang="less" scoped>
/*@import '../../../styles/table.less';*/
.titleList {
  display: flex;
 
  div {
    text-align: center;
    padding: 10px 30px 15px 0;
 
    span {
      display: block;
      text-align: center;
    }
  }
}
 
.custom-collapse {
  .icon {
    padding-left: 20px;
 
    .Brand {
      color: #409eff;
    }
 
    .Warning {
      color: #e6a23c;
    }
 
    .Danger {
      color: #f56c6c;
    }
  }
 
  .choose {
    color: #409eff;
  }
 
  /deep/ .el-collapse-item__header {
    font-size: 15px;
 
    i {
      font-size: 16px;
      margin-left: 10px;
    }
  }
 
  /deep/ .el-collapse-item__content {
    font-size: 14px;
    cursor: pointer;
    padding-left: 15px;
 
    i {
      font-size: 16px;
      margin-left: 10px;
      cursor: pointer;
    }
  }
}
 
.rankContent {
  width: 100%;
 
  .leftCollapse {
    width: 27%;
    float: left;
    margin-right: 10px;
    min-width: 300px;
 
    /deep/ .el-collapse {
      // border: 1px solid #EBEEF5;
    }
  }
 
  .tableBox {
    width: 70%;
    float: left;
  }
}
 
.logo-icon {
  width: 50px;
}
</style>