jiangping
2024-08-26 e23a1db0b60437f17d09d65c65f8fd0c8a5d88c7
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
<template>
    <TableLayout :permissions="['business:member:query']">
        <!-- 搜索表单 -->
        <el-form ref="searchForm" slot="search-form" :model="searchForm" label-width="100px" inline>
            <el-form-item label="姓名" prop="name">
                <el-input v-model="searchForm.name" placeholder="请输入姓名" @keypress.enter.native="search"></el-input>
            </el-form-item>
            <el-form-item label="手机号" prop="phone">
                <el-input v-model="searchForm.phone" placeholder="请输入手机号" @keypress.enter.native="search"></el-input>
            </el-form-item>
            <el-form-item label="组织名称" prop="companyName">
                <el-input v-model="searchForm.companyName" placeholder="请输入组织名称" @keypress.enter.native="search"></el-input>
            </el-form-item>
            <el-form-item label="身份证号" prop="idcardNo">
                <el-input v-model="searchForm.idcardNo" placeholder="请输入身份证号" @keypress.enter.native="search"></el-input>
            </el-form-item>
            <section>
                <el-button type="primary" @click="search">搜索</el-button>
                <el-button @click="reset">重置</el-button>
            </section>
        </el-form>
        <!-- 表格和分页 -->
        <template v-slot:table-wrap>
            <ul class="toolbar" v-permissions="['business:member:create', 'business:member:delete']">
                <li><el-button type="primary" v-permissions="['business:member:create']" @click="block">拉黑</el-button></li>
                <li><el-button @click="deleteByIdInBatch" icon="el-icon-delete" v-permissions="['business:member:delete']">删除</el-button></li>
            </ul>
            <el-table
                v-loading="isWorking.search"
                :data="tableData.list"
                stripe
                @selection-change="handleSelectionChange"
            >
                <el-table-column type="selection" width="55"></el-table-column>
                <el-table-column prop="name" label="姓名" min-width="100px"></el-table-column>
                <el-table-column prop="phone" label="手机号" min-width="100px"></el-table-column>
                <el-table-column prop="phone" label="性别" min-width="100px">
                    <template slot-scope="{row}">
                        <span v-if="row.sex === 1">男</span>
                        <span v-if="row.sex === 2">女</span>
                    </template>
                </el-table-column>
                <el-table-column prop="status" label="状态" min-width="100px">
                    <template slot-scope="{row}">
                        <span v-if="(row.status || 0) === 0" style="color: green">正常</span>
                        <span v-else style="color: red">异常</span>
                    </template>
                </el-table-column>
                <el-table-column label="证件类型" min-width="100px">
                    <template slot-scope="{row}">
                        <span v-if="row.idcardType === 0">身份证</span>
                        <span v-if="row.idcardType === 1">港澳证件</span>
                        <span v-if="row.idcardType === 2">护照</span>
                    </template>
                </el-table-column>
                <el-table-column prop="idcardDecode" label="身份证号" width="150px"></el-table-column>
                <el-table-column prop="visitCompanyName" label="组织" min-width="100px"></el-table-column>
                <el-table-column prop="visitsCount" label="拜访次数" min-width="100px"></el-table-column>
                <el-table-column prop="visitsLastDate" label="最后拜访时间" min-width="100px"></el-table-column>
            </el-table>
            <pagination
                @size-change="handleSizeChange"
                @current-change="handlePageChange"
                :pagination="tableData.pagination"
            >
            </pagination>
        </template>
    </TableLayout>
</template>
 
<script>
import BaseTable from '@/components/base/BaseTable'
import TableLayout from '@/layouts/TableLayout'
import Pagination from '@/components/common/Pagination'
import { batchBlock } from '@/api/business/member'
export default {
  name: 'visitorManagement',
  extends: BaseTable,
  components: { TableLayout, Pagination },
  data () {
    return {
      // 搜索
      searchForm: {
        companyName: '',
        name: '',
        phone: '',
        idcardNo: '',
        type: 1
      }
    }
  },
  created () {
    this.config({
      module: '人员信息表',
      api: '/business/member',
      'field.id': 'id',
      'field.main': 'id'
    })
    this.search()
  },
  methods: {
    block () {
      if (this.tableData.selectedRows.length === 0) {
        this.$message.warning('请选择人员')
        return
      }
      this.$confirm('确定要拉黑吗?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        batchBlock(this.tableData.selectedRows.map(item => item.id).join(','))
          .then(res => {
            this.$message.success('拉黑成功')
            this.search()
          })
      }).catch(() => {
 
      })
    }
  }
}
</script>