马宇豪
2025-04-23 34ec919649adfefeecd0418284dd7b02e9ed49b8
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
<template>
    <div class="app-container">
        <div class="filter-container">
            <div>
                <div class="basic_search">
                    <span>企业名称:</span>
                    <el-input v-model.trim="listQuery.filter.companyName" style="width: 300px"/>
                </div>
                <div class="basic_search">
                    <el-button style="margin-left: 10px;" type="primary" @click="reset()">重置</el-button>
                    <el-button style="margin-left: 10px;" type="primary" icon="el-icon-search" @click="search()">查询</el-button>
                </div>
            </div>
        </div>
        <br/>
        <div class="table_content">
            <el-table
                v-loading="listLoading"
                :key="tableKey"
                :data="dataList"
                border
                fit
                highlight-current-row
                style="width: 100%;"
            >
                <el-table-column label="序号" type="index" align="center"></el-table-column>
                <el-table-column label="姓名" prop="personName" align="center"></el-table-column>
                <el-table-column label="企业名称" prop="companyName" align="center"></el-table-column>
                <el-table-column label="人员类型" prop="personType" align="center">
                    <template slot-scope="scope">
                        {{getTypeName(scope.row.personType)}}
                    </template>
                </el-table-column>
                <el-table-column label="联系方式" prop="mb" align="center"></el-table-column>
                <el-table-column label="创建人" prop="createBy" align="center"></el-table-column>
                <el-table-column label="修改人" prop="updateBy" align="center"></el-table-column>
                <el-table-column label="创建时间" prop="createDate" align="center"></el-table-column>
                <el-table-column label="修改时间" prop="updateDate" align="center"></el-table-column>
<!--                <el-table-column label="操作" align="center" width="120" class-name="small-padding fixed-width" fixed="right">-->
<!--                    <template slot-scope="scope">-->
<!--                        <el-button type="text" @click="openDialog('view',scope.row)">查看</el-button>-->
<!--                        <el-button type="text" @click="deleteData(scope.row)">删除</el-button>-->
<!--                    </template>-->
<!--                </el-table-column>-->
            </el-table>
            <br/>
            <div style="display: flex;justify-content: right">
                <el-pagination
                    v-show="recordTotal>0"
                    :current-page="currentPage"
                    :page-sizes="[10, 20, 30, 50]"
                    :page-size="listQuery.pageSize"
                    :total="recordTotal"
                    layout="total, sizes, prev, pager, next, jumper"
                    background
                    @size-change="handleSizeChange"
                    @current-change="handleCurrentChange"
                />
            </div>
        </div>
        <crew-dialog ref="crewDialog"></crew-dialog>
    </div>
</template>
 
<script>
import {computePageCount} from "../../../utils";
import {getOriginalPerson} from "../../../api/monitorAlert"
import crewDialog from "./components/crewDialog"
import Cookies from "js-cookie"
export default {
    name: "crewInfo",
    components: {crewDialog},
    data() {
        return {
            tableKey: '',
            recordTotal: 0,
            currentPage: 1,
            Cookies: Cookies,
            listLoading: false,
            dataList: [],
            listQuery: {
                filter:{
                    companyCode: '',
                    companyName: ''
                },
                pageIndex:1,
                pageSize:10
            },
            typeList: [
                {
                    name: '法定代表人',
                    value: 1
                },
                {
                    name: '主要负责人',
                    value: 2
                },
                {
                    name: '安全负责人',
                    value: 3
                },
                {
                    name: '保管员',
                    value: 4
                },
                {
                    name: '守护员',
                    value: 5
                }
            ]
        }
    },
    created() {
        this.getDataList()
    },
    mounted() {
    },
    watch: {},
    methods: {
        openDialog(type,data){
            this.$refs.crewDialog.open(type,data)
        },
        deleteData(data){
 
        },
        getTypeName(type){
            return this.typeList.find(i=>i.value == type).name
        },
        async getDataList() {
            let res = await getOriginalPerson(this.listQuery)
            if (res.data.code === "200") {
                const data = res.data.result
                if(Array.isArray(data.records)){
                    this.dataList = data.records
                    this.recordTotal = data.total
                    this.currentPage = data.current
                }else{
                    this.dataList = []
                }
            } else {
                this.$message({
                    type: 'warning',
                    message: res.data.message
                })
            }
            this.listLoading = false
        },
        handleSizeChange: function(val) {
            this.listQuery.pageSize = val
            this.getDataList()
        },
        handleCurrentChange: function(val) {
            this.listQuery.pageIndex = val
            this.getDataList()
        },
        reset(){
            this.listQuery = {
                filter:{
                    companyName: ''
                },
                pageIndex:1,
                pageSize:10
            }
            this.getDataList()
        },
        search(){
            this.listQuery.pageIndex = 1
            this.getDataList()
        }
    }
}
</script>
 
<style scoped>
.basic_search {
    display: inline-block;
}
</style>