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
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
<template>
  <div class="page_member">
    <div class="nav">
      <h3>报到单位管理</h3>
      <el-tree
        :props="defaultProps"
        :load="loadNode"
        node-key="id"
        lazy
        :expand-on-click-node="false"
        :default-expanded-keys="defaultExpandedKeys"
        @check-change="handleCheckChange"
        @node-click="handleNodeClick"
      >
      </el-tree>
    </div>
    <div class="main">
      <v-header :title="''" search :bar="bar" @on-search="onSearch"></v-header>
      <!-- 按钮区 -->
      <div class="tool" v-if="isZuZhibuUser">
        <el-button size="medium" type="primary" @click="add">新增</el-button>
        <!-- <el-button size="medium" type="primary" @click="send">导入</el-button>
        <el-button size="medium" type="primary" @click="out">导出</el-button> -->
      </div>
      <!-- 正文 -->
      <div class="cen">
        <!-- list列表 -->
        <!-- <div class="list">
          <p class="text_overflow">党组织名称</p>
          <v-tool-scroll ids="member-list-scroll" class="lists">
            <ul>
              <li
                v-for="(i, j) in list"
                :key="j"
                class="text_overflow"
                :class="{ active: listIndex === j }"
                @click.stop="onList(i, j)"
              >
                {{ i.name }}
              </li>
            </ul>
          </v-tool-scroll>
        </div> -->
        <!-- 表格+分页 -->
        <div class="tab_data">
          <div class="tab">
            <v-table :trs="trs" :tds="tds" :height="450">
              <template v-slot:btn="item">
                <div class="table_flex">
                  <el-button type="text" size="small"  @click="edit(item.scope)" v-if="backstageType != 1"
                    >编辑</el-button
                  >
                  <!-- <span @click="detail(item.scope)">查看</span> -->
                  <el-button type="text" size="small"
                    @click="del(item.scope)"
                    v-if="backstageType != 1 && backstageType != 4"
                    >删除</el-button
                  >
                  <el-button type="text" size="small"
                    @click="addAccount(item.scope)"
                    v-if="backstageType != 1 && backstageType != 4"
                    >添加账号</el-button
                  >
                  <el-button type="text" size="small"
                    @click="addProject(item.scope)"
                    v-if="backstageType != 1 && backstageType != 4"
                    >关联项目</el-button
                  >
                </div>
              </template>
              <template v-slot:pic="item">
                <div class="table_flex">
                  <img
                    :src="item.scope.photoPath || '/static/image/dh.jpg'"
                    @click="onScaleImage(item.scope)"
                  />
                </div>
              </template>
              <template v-slot:acc="item">
                <div class="table_flex">
                  <b class="col_primary unline">{{ item.scope.phone }}</b>
                </div>
              </template>
            </v-table>
          </div>
          <div class="page">
            <v-tool-page :item="paged" @on-page="onPage"></v-tool-page>
          </div>
        </div>
      </div>
    </div>
    <el-dialog
      :close-on-click-modal="false"
      :title="dialogTitle"
      :visible.sync="dialogVisible"
      :before-close="handleClose"
      center
      append-to-body
    >
      <el-form
        :model="formInfo"
        :rules="rules"
        label-position="right"
        ref="ruleForm"
        label-width="130px"
        class="demo-ruleForm"
      >
        <div>
          <el-form-item label="登录账号" prop="account">
            <el-input
              style="width: 300px"
              class="input-width"
              maxlength="16"
              placeholder="请输入4-16位字母的组合"
              v-model.trim="formInfo.account"
            ></el-input>
          </el-form-item>
          <el-form-item label="登录密码" prop="password">
            <el-input
              type="password"
              style="width: 300px"
              class="input-width"
              maxlength="20"
              placeholder="请输入8-16位,且包含字母、数字、字符"
              v-model.trim="formInfo.password"
            >
            </el-input>
          </el-form-item>
          <el-form-item label="确认密码" prop="confirmPssword">
            <el-input
              type="password"
              style="width: 300px"
              maxlength="20"
              placeholder="请输入8-16位,且包含字母、数字、字符"
              v-model.trim="formInfo.confirmPssword"
            ></el-input>
          </el-form-item>
        </div>
      </el-form>
      <div class="fl-cen">
        <el-button @click="handleClose">取 消</el-button>
        <el-button type="primary" @click="handleSubmit" :loading="btnloading"
          >提交</el-button
        >
      </div>
    </el-dialog>
  </div>
</template>
 
<script>
import { mapState } from "vuex";
import { areaAccountReturn } from "../../../utils/common";
const REX_VAL = /^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z\W_!@#$%^&*.`~()-+=]+$)(?![a-z0-9]+$)(?![a-z\W_!@#$%^&.*`~()-+=]+$)(?![0-9\W_!@#$%^.&*`~()-+=]+$)[a-zA-Z0-9\W_!@#$%^&.*`~()-+=]{8,16}$/;
export default {
  props: {},
  components: {},
  data() {
    const USER_NAME = (rule, value, callback) => {
      const regExp = /^[A-Za-z]{4,16}$/;
      if (!value) return callback(new Error("不能为空"));
      if (regExp.test(value) === false) {
        callback(new Error("请输入4-16位字母的组合"));
      } else {
        callback();
      }
    };
    const VALIDATE_PASSWOID = (rule, value, callback) => {
      const regExp = REX_VAL;
      if (!value) return callback(new Error("不能为空"));
      if (regExp.test(value) === false) {
        callback(new Error("请输入4-请输入8-16位,且包含字母、数字、字符"));
      } else {
        callback();
      }
    };
    const COMFIRM_PASSWOID = (rule, value, callback) => {
      if (!value) return callback(new Error("不能为空"));
      if (value !== this.formInfo.password) {
        callback(new Error("两次密码不一样"));
      } else {
        callback();
      }
    };
 
    return {
      bar: [
        {
          title: "关键字",
          name: "keyWord",
          plac: "单位名称、党组织负责人、党组织负责人电话",
          width: "320px !important"
        },
        {
          title: "职能特长及服务意愿",
          name: "specialtyName",
          plac: "请选择",
          type: "select",
          list: [
            { label: "党建指导", value: 1, checkType: false },
            { label: "政策宣讲", value: 2, checkType: false },
            { label: "教育培训", value: 3, checkType: false },
            { label: "就业服务", value: 4, checkType: false },
            { label: "志愿服务", value: 5, checkType: false },
            { label: "维修服务", value: 6, checkType: false },
            { label: "家政服务", value: 7, checkType: false },
            { label: "其他", value: 8, checkType: false }
          ]
        },
        {
          title: "所属党组织",
          name: "orgName",
          plac: "请选择",
          type: "select",
          list: []
        },
        {
          title: "单位归属",
          name: "belongTo",
          plac: "请选择",
          type: "select",
          list: [
            {
              label: "市直属",
              value: "市直属"
            },
            {
              label: "西区",
              value: "西区"
            },
            {
              label: "东区",
              value: "东区"
            },
            {
              label: "仁和区",
              value: "仁和区"
            },
            {
              label: "盐边县",
              value: "盐边县"
            },
            {
              label: "米易县",
              value: "米易县"
            },
            {
              label: "钒钛高新区",
              value: "钒钛高新区"
            }
          ]
        }
      ],
      skillList: [],
      total: 0,
      os: { keyWord: "", account: "", name: "" },
      paged: { page: 0, total: 0, r: 0, limit: 10 },
      listIndex: -1,
      areaType: false,
      backstageType: "",
      formInfo: {
        account: "",
        password: "",
        confirmPssword: ""
      }, // 表单
      rules: {
        account: [
          {
            required: true,
            trigger: "blur",
            validator: USER_NAME
          }
        ],
        password: [
          {
            required: true,
            trigger: "blur",
            validator: VALIDATE_PASSWOID
          }
        ],
        confirmPssword: [
          {
            required: true,
            trigger: "blur",
            validator: COMFIRM_PASSWOID
          }
        ]
      }, // 表单验证
      trs: [
        // {
        //   text: "账号",
        //   val: "btn",
        //   slot: "acc",
        //   color: true,
        //   table_status: [{ val: 0, key: "#38f" }],
        // },
        { text: "序号", val: "id" , width: "200px"},
        { text: "所属党组织", val: "orgName"  , width: "150px"},
        { text: "单位归属", val: "belongTo"  , width: "100px"},
        { text: "单位名称", val: "name"  , width: "100px"},
        { text: "单位性质", val: "natureName"  , width: "100px"},
        { text: "服务社区", val: "helpCommunityName"  , width: "100px"},
        {
          text: "下沉服务小区(网格)院落",
          val: "villageName",
          width: "220px"
        },
        { text: "社区联系人", val: "helpCommunityContactsName" , width: "100px" },
        {
          text: "社区联系人电话",
          val: "helpCommunityContacts",
          width: "150px"
        },
        { text: "党组织负责人", val: "contacts"  , width: "120px"},
        { text: "党组织负责人电话", val: "phone", width: "180px" },
        { text: "职能特长及服务意愿", val: "specialtyName", width: "200px" },
        // { text: "单位管理员", val: "adminName" },
        // { text: "管理员手机号", val: "adminPhone" },
        // { text: "党员照片", val: "btn", slot: "pic" },
        // { text: "党员类型", val: "btn", slot: "type" },
        // { text: "手机号", val: "phone" },
        // { text: "常住社区", val: "communityName" },
        // { text: "小区院落", val: "villageName" },
        // { text: "职能特长及服务意愿", val: "specialtyName" },
        // { text: "工作单位", val: "checkUnitName" },
        // { text: "报到社区", val: "communityName" },
        // {
        //   text: "状态",
        //   val: "status",
        // },
        { text: "操作", val: "btn", width: "300px" ,fixed:"right"}
      ],
      tds: [],
      list: [],
      isZuZhibuUser: false,
      dialogVisible: false,
      btnloading: false,
      dialogTitle: "新增账号",
      isUnitUser: "",
      communityList: ["东区", "仁和区", "米易县", "盐边县", "西区"],
      treeData: [],
      defaultProps: {
        children: "children",
        label: "name"
      },
      count: 1,
      defaultExpandedKeys: []
    };
  },
  computed: {
    ...mapState({ vuex_page: "pageReset" })
  },
  watch: {
    vuex_page: {
      handler(n) {
        if (n.page === this.$route.path) {
          this.paged.page = 1;
          this.init();
        }
      },
      deep: true
    }
  },
  methods: {
    handleCheckChange(data, checked, indeterminate) {
      console.log(data, checked, indeterminate);
    },
    handleNodeClick(data, node) {
      console.log(data, node);
      switch (node.level) {
        case 2:
          this.paged.page = 1;
          this.paged.limit = 10;
          this.os.belongTo = data.name;
          this.init();
          break;
        case 3:
          this.paged.page = 1;
          this.paged.limit = 10;
          this.os.orgName = data.name;
          this.init();
          break;
        case 4:
          this.paged.page = 1;
          this.paged.limit = 10;
          this.os.keyWord = data.name;
          this.init();
          break;
        default:
          break;
      }
    },
    async loadNode(node, resolve) {
      console.log(node);
      const { level } = node;
      let data = [];
      let results = [];
      switch (level) {
        case 0:
          data = [{ name: "组织部", id: "001" }];
          resolve(data);
          this.defaultExpandedKeys = ["001"];
          break;
        case 1:
          data = [
            {
              name: "市直属",
              id: "001001"
            },
            {
              name: "西区",
              id: "001002"
            },
            {
              name: "东区",
              id: "001003"
            },
            {
              name: "仁和区",
              id: "001004"
            },
            {
              name: "盐边县",
              id: "001005"
            },
            {
              name: "米易县",
              id: "001006"
            },
            {
              name: "钒钛高新区",
              id: "001007"
            }
          ];
          resolve(data);
          break;
        case 2:
          results = await this.getTreeList({ name: node.data.name });
          if (results) {
            data = results
              .filter(i => i.orgName && i.orgName)
              .map(v => {
                return { name: v.orgName, id: v.id };
              });
          }
          resolve(data);
          break;
        case 3:
          results = await this.getTreeList({ orgName: node.data.name });
          if (results) {
            data = results
              .filter(i => i.name && i.name)
              .map(v => {
                return { name: v.name, id: v.id };
              });
          }
          resolve(data);
          break;
        case 4:
          resolve(data);
          break;
        default:
          resolve(data);
          break;
      }
    },
    getTreeList(parameter) {
      return new Promise((resolve, reject) => {
        this.$api.post(
          "checkUnit/treeList",
          parameter,
          res => {
            resolve(res);
          },
          err => {
            console.log(err);
            reject([]);
          }
        );
      });
    },
    // 所属党组织列表
    getOrgnameList() {
      // comPbCheckUnit/orgList
      this.$api.get(
        "checkUnit/orgList",
        {},
        res => {
          const data = res.map(i => {
            return { label: i.orgName, value: i.orgName };
          });
          for (let i = 0; i < this.bar.length; i++) {
            if (this.bar[i].name == "orgName") {
              this.bar[i].list = data;
              break;
            }
          }
        },
        err => {
          console.log(err);
        }
      );
    },
    // 查看大图
    onScaleImage(v) {
      this.$store.dispatch("setImage", {
        time: Date.now(),
        title: v.name,
        pic: v.photoPath,
        tool: true
      });
    },
    addAccount(row) {
      console.log(row.id);
      this.formInfo.checkUnitId = row.id;
      this.dialogVisible = true;
    },
    addProject(row) {
      console.log(row.id);
      this.$router.push(
        "/unitProjectList?id=" + row.id + "&communityId=" + row.communityId
      );
    },
    handleClose() {
      this.$refs.ruleForm.resetFields(); // 重置form表单
      this.formInfo = {
        account: "",
        password: "",
        confirmPssword: ""
      };
      this.dialogVisible = false;
      this.btnloading = false;
    },
    handleSubmit() {
      this.$refs.ruleForm.validate(val => {
        if (val) {
          this.btnloading = true;
          this.$api.post("checkUnit/addComPbCheckUser", this.formInfo, () => {
            this.btnloading = false;
            demo.toast(this.dialogTitle + "成功");
            this.handleClose();
          });
        }
      });
    },
    // 分页点击
    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() {
      let v = demo.copy(
        Object.assign(this.os, {
          pageNum: this.paged.page,
          pageSize: this.paged.limit
        })
      );
      console.log(v);
      if (!this.isZuZhibuUser) {
        v.communityId = demo.$session.get("user").communityId;
      }
      this.$api.post("checkUnit/page", v, e => {
        this.paged.total = e.total;
        this.paged.r++;
        this.tds = e.records || [];
      });
    },
    // 删除
    del(v) {
      let t = this;
      t.$js.model("删除单位", "是否删除单位[" + v.name + "]", res => {
        if (res) {
          t.$api.get(
            "/checkUnit/delete",
            {
              id: v.id
            },
            e => {
              demo.toast("删除成功");
              t.$nextTick(() => {
                t.init();
              });
            }
          );
        }
      });
    },
    // 档案
    detail(v) {
      demo.$session.set("member-detail", v);
      this.$router.push(this.$nav.url("/unitInformation/" + v.id));
    },
    _open(type, title, data) {
      let data2 = {
        type,
        title,
        data
      };
      this.$store.dispatch("setFixed", {
        event: "add",
        data: {
          type,
          title,
          data
        },
        time: Date.now()
      });
    },
    // 编辑
    edit(v) {
      this.$router.push("/addUnit?id=" + v.id);
      //   v.orgId = v.orgId || "";
      //   this._open("member-add", "编辑", v);
    },
    // 新增
    add() {
      // this._open("member-add", "新增", { id: 0 });
      this.$router.push("/addUnit");
    },
    // 导入
    send() {
      this._open("member-import");
    },
    out() {
      this.$api.post("communitypartybuilding/member/export", this.os, e => {
        // demo.location(e, { target: "open" });
        window.location.href = e;
      });
    },
    // 查询
    onSearch(v) {
      this.os = v;
      this.paged.page = 1;
      //  this.listIndex = -1;
      this.init();
    },
    // 点击党组织
    onList(i, j) {
      this.listIndex = j;
      this.os.orgName = i.name;
      this.init();
    },
    setlist() {
      // this.$api.get(
      //   "communitypartybuilding/listpartyorganization",
      //   {
      //     communityId: demo.$session.get("user").communityId,
      //   },
      //   (e) => {
      //     this.list = e;
      //   }
      // );
      // this.$api.party((e) => {
      //   this.list = e;
      // });
    }
  },
  mounted() {
    this.isZuZhibuUser = demo.$session.get("user").account == "zuzhibu";
    this.isUnitUser = demo.$session.get("user").bindingCheckUnitId;
    this.backstageType = demo.$session.get("user").backstageType;
    this.is_community = this.communityList.indexOf(
      demo.$session.get("user").name
    );
    this.areaType = areaAccountReturn(demo.$session.get("user").name);
    if (this.areaType) {
      this.bar.splice(2, 1);
    }
    this.setlist();
    this.getOrgnameList();
    // this.$api.post(
    //   "neighbor/pageNeighborTopicByAdmin",
    //   { pageNum: 1, pageSize: 9999 },
    //   (e) => {
    //     e.records.forEach((item) => {
    //       item.label = item.name;
    //       item.value = item.name;
    //     });
    //     this.bar[1].list = e.records;
    //   }
    // );
  }
};
</script>
<style lang="less" scoped>
.page_member {
  display: flex;
  overflow-y: auto;
  padding-top: 20px;
  .nav {
    width: 252px;
    height: 100%;
    overflow: auto;
    > h3 {
      padding-bottom: 16px;
    }
    /deep/ .el-tree-node__label {
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
  }
 
  .main {
    margin-left: 16px;
    width: calc(100% - 252px - 16px);
  }
 
  .tool {
    margin: 5px 0 15px;
  }
  .cen {
    display: flex;
    height: 500px;
    > div {
      height: 100%;
      position: relative;
    }
    .list {
      width: 160px;
      p {
        background-color: #f2f2f2;
        font-size: 14px;
        font-weight: 650;
      }
      .lists {
        height: calc(~"100% - 40px");
      }
      p,
      li {
        height: 40px;
        line-height: 40px;
      }
      li {
        cursor: pointer;
        transition: all 0.2s;
        font-size: 13px;
        text-indent: 5px;
      }
      li.active {
        background-color: #1890ff;
        color: #fff;
      }
    }
    .tab_data {
      width:100%;
 
      .tab {
        height: calc(~"100% - 50px");
        width:100%;
      }
      .page {
        height: 50px;
        box-sizing: border-box;
        padding-top: 10px;
      }
    }
  }
}
</style>