<template>
    <div class="add-edit-dialog-container">
        <el-dialog
            :title="title"
            :visible.sync="visible"
            width="600px"
            :before-close="close"
            :close-on-click-modal="false"
        >
            <el-form :model="formData" ref="formData" label-width="100px">
                <el-form-item label="公司名称:">
                    <span v-if="formData.company">{{ formData.company.name }}</span>
                </el-form-item>
                <el-form-item label="岗位:">
                    <span>{{ formData.job }}</span>
                </el-form-item>
                <el-form-item label="薪资范围:">
                    <span>{{ formData.lowerSalary| pricePipe(0, '￥', true) }}</span>
                    <span>-</span>
                    <span>{{ formData.upperSalary | pricePipe(0, '', true)}}</span>
                </el-form-item>
                <el-form-item label="学历:">
                    <span>{{ formData.eduLevel | educationStatus }}</span>
                </el-form-item>
                <el-form-item label="工作年限:">
                    <span>{{ formData.lowerWorking }}-{{formData.upperWorking }}</span>
                </el-form-item>
                <el-form-item label="岗位职责:">
                    <span>{{ formData.info }}</span>
                </el-form-item>
                <el-form-item label="省市:">
                    <span
                        v-if="formData.provinceName"
                    >{{ formData.provinceName +'/'+ formData.cityName}}</span>
                </el-form-item>
                <el-form-item label="是否首页展示">
                    <el-switch
                        v-model="formData.hotFlag"
                        active-text="是"
                        inactive-text="否"
                        :active-value="1"
                        :inactive-value="0"
                        disabled
                    ></el-switch>
                </el-form-item>
                <el-form-item label="是否启用">
                    <el-switch
                        v-model="formData.statuz"
                        active-text="是"
                        inactive-text="否"
                        :active-value="1"
                        :inactive-value="0"
                        disabled
                    ></el-switch>
                </el-form-item>
                <el-form-item label="审核状态:">
                    <div>
                        <span class="warn" v-show="formData.checkFlag == 2">待审核</span>
                        <span class="success" v-show="formData.checkFlag == 1">审核通过</span>
                        <span class="danger" v-show="formData.checkFlag === 0">已驳回</span>
                    </div>
                </el-form-item>
                <el-form-item label="驳回原因:" v-show="formData.checkFlag === 0">
                    <span>{{ formData.reason }}</span>
                </el-form-item>
            </el-form>
        </el-dialog>
    </div>
</template>
<script>
import educationStatus from '../../model/education-status';
export default {
    data() {
        return {
            type: null,
            title: '详情',
            submitBtndisabled: false,
            formData: {},
            visible: false,
        };
    },
    methods: {
        open(data) {
            this.formData = { ...data };
            this.visible = true;
            console.log(data, 'da');
        },
        close() {
            this.formData = {};
            this.visible = false;
        },
    },
    filters: {
        educationStatus: eduLevel => {
            let str = '';
            for (let i = 0; i < educationStatus.length; i++) {
                if (educationStatus[i].id === eduLevel) {
                    str = educationStatus[i].name;
                    break;
                }
            }
            return str;
        },
    },
};
</script>
<style lang="stylus" scoped>
.add-edit-dialog-container {
    ::v-deep .el-form-item {
        margin-bottom: 0;
    }

    .images {
        margin-right: 5px;
    }
}
</style>
