<template>
    <div class="cloudUser">
        <el-form :model="queryParams" ref="queryForm" :inline="true">
            <el-form-item label="职位名称" prop="title">
                <el-input
                    v-model="queryParams.title"
                    placeholder="请输入职位名称"
                    clearable
                    size="small"
                    @keyup.enter.native="handleQuery"
                />
            </el-form-item>
            <el-form-item label="工作地点" prop="city">
                <el-input
                    v-model="queryParams.city"
                    placeholder="请输入工作地点"
                    clearable
                    size="small"
                    @keyup.enter.native="handleQuery"
                />
            </el-form-item>
            <el-form-item label="职位发布者" prop="company">
                <el-input
                    v-model="queryParams.company"
                    placeholder="请输入职位发布者"
                    clearable
                    size="small"
                    @keyup.enter.native="handleQuery"
                />
            </el-form-item>
            <el-form-item label="手机号" prop="phonenumber">
                <el-input
                    v-model="queryParams.phonenumber"
                    placeholder="请输入手机号"
                    clearable
                    size="small"
                    @keyup.enter.native="handleQuery"
                />
            </el-form-item>
            <el-form-item>
                <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
                <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
            </el-form-item>
        </el-form>

        <el-table v-loading="loading" :data="cloudUserList">
            <el-table-column label="用户编号" align="center" prop="user_id" />
            <el-table-column label="用户昵称" align="center" prop="nick_name" />
            <el-table-column label="性别" align="center" prop="sex" />
            <el-table-column label="手机号" align="center" prop="phonenumber" />
            <el-table-column label="职位名称" align="center" prop="title" />
            <el-table-column label="职位薪酬" align="center" prop="emolument" />
            <el-table-column label="职位发布者" align="center" prop="company" />
            <el-table-column label="工作地点" align="center" prop="city" />
            <!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
                <template slot-scope="scope">
                    <el-button size="mini" type="text" icon="el-icon-delete" @click="delFn(scope.row)">删除</el-button>
                    <el-button size="mini" type="text" icon="el-icon-view" @click="detailFn(scope.row)"
                        >查看详情</el-button
                    >
                </template>
            </el-table-column> -->
        </el-table>
        <pagination
            v-show="total > 0"
            :total="total"
            :page.sync="queryParams.pageNum"
            :limit.sync="queryParams.pageSize"
            @pagination="getList"
        />
        <!-- 审核弹层 -->
        <el-dialog title="详情" :visible.sync="detailOpen" width="500px" append-to-body> </el-dialog>
    </div>
</template>

<script>
import { getJobEdList } from '@/api/cloudUser'
export default {
    data() {
        return {
            loading: false,
            cloudUserList: [],
            detailOpen: false,
            total: 0,
            queryParams: {
                pageNum: 1,
                pageSize: 10,
                title: null,
                city: null,
                company: null,
                phonenumber: null,
            },
        }
    },
    created() {
        this.getList()
    },
    methods: {
        getList() {
            this.loading = true
            getJobEdList(this.queryParams)
                .then((res) => {
                    this.loading = false
                    this.total = res.total
                    this.cloudUserList = res.rows
                })
                .catch((error) => {
                    this.loading = false
                })
        },
        delFn() {
            this.$confirm('此操作将永久云员工, 是否继续?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning',
            })
                .then(() => {
                    this.$message({
                        type: 'success',
                        message: '删除成功!',
                    })
                })
                .catch(() => {})
        },
        detailFn() {
            this.detailOpen = true
        },
        /** 搜索按钮操作 */
        handleQuery() {
            this.getList()
        },
        /** 重置按钮操作 */
        resetQuery() {
            this.resetForm('queryForm')
            this.handleQuery()
        },
    },
}
</script>

<style lang="scss" scoped>
.cloudUser {
    padding: 20px;
}
</style>