<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>
                <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> -->
        <div class="addbtnbtn">
            <el-button type="primary" icon="el-icon-plus" size="mini" @click="addFn">新增</el-button>
        </div>
        <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" class-name="small-padding fixed-width">
                <template slot-scope="scope">
                    <el-button size="mini" type="text" icon="el-icon-edit" @click="editFn(scope.row)">修改</el-button>
                    <el-button size="mini" type="text" icon="el-icon-delete" @click="delFn(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="title" :visible.sync="detailOpen" width="700px" append-to-body @close="closeFn">
            <el-form :model="form" :rules="rules" ref="form" label-width="130px">
                <el-form-item label="云员工技能方向" prop="name">
                    <el-input v-model="form.name"></el-input>
                </el-form-item>
                <el-form-item label="语言" prop="name">
                    <el-input v-model="form.name"></el-input>
                </el-form-item>
                <el-form-item label="云员工技能定义" prop="name">
                    <el-input v-model="form.name"></el-input>
                </el-form-item>
                <el-form-item label="排序" prop="name">
                    <el-input v-model="form.name"></el-input>
                </el-form-item>
            </el-form>
            <span slot="footer" class="dialog-footer">
                <el-button @click="closeFn">取 消</el-button>
                <el-button type="primary" @click="submitFn">确 定</el-button>
            </span>
        </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,
            },
            form: {},
            rules: {},
            title: ''
        }
    },
    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(() => {})
        },
        closeFn() {
            this.form = {}
            this.$refs['form'].resetFields()
            this.detailOpen = false
        },
        addFn() {
            this.detailOpen = true
            this.title = '新增技能方向'
        },
        editFn() {
            this.detailOpen = true
            this.title = '修改技能方向'
        },
        // 提交
        submitFn() {
            this.$refs['form'].validate((valid) => {
                if (valid) {
                    this.closeFn()
                } else {
                    return false
                }
            })
        },
        /** 搜索按钮操作 */
        handleQuery() {
            this.getList()
        },
        /** 重置按钮操作 */
        resetQuery() {
            this.resetForm('queryForm')
            this.handleQuery()
        },
    },
}
</script>

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