<template>
    <div>
        <el-card>
            <div style="display: flex;justify-content: space-between;">
                <div class="tit">售后工单</div>
                <div style="display: flex;">
                    <el-form-item label-width="0" prop="field101">
                        <el-select v-model="formData.field101" placeholder="请选择下拉选择下拉选择" clearable
                            :style="{ width: '100%' }">
                            <el-option v-for="(item, index) in field101Options" :key="index" :label="item.label"
                                :value="item.value" :disabled="item.disabled"></el-option>
                        </el-select>
                    </el-form-item>
                    &nbsp;
                    &nbsp;
                    <el-form-item label-width="0" prop="field102">
                        <el-select v-model="formData.field102" placeholder="请选择下拉选择下拉选择" :style="{ width: '100%' }">
                            <el-option v-for="(item, index) in field102Options" :key="index" :label="item.label"
                                :value="item.value" :disabled="item.disabled"></el-option>
                        </el-select>
                    </el-form-item>
                </div>
            </div>
        </el-card>


        <el-form ref="elForm" :model="formData" :rules="rules" size="medium" label-width="100px">
            <el-card>


                <el-row :gutter="10">

                    <el-col :span="12">
                        <el-form-item label="项目名称" prop="field103">
                            <el-input v-model="formData.field103" placeholder="请输入项目名称" clearable
                                :style="{ width: '100%' }">
                            </el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="项目编码" prop="field104">
                            <el-input v-model="formData.field104" placeholder="请输入项目编码" clearable
                                :style="{ width: '100%' }">
                            </el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="客户名称" prop="field105">
                            <el-input v-model="formData.field105" placeholder="请输入客户名称" clearable
                                :style="{ width: '100%' }">
                            </el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="合同号" prop="field106">
                            <el-input v-model="formData.field106" placeholder="请输入合同号" clearable :style="{ width: '100%' }">
                            </el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="联系人" prop="field107">
                            <el-input v-model="formData.field107" placeholder="请输入联系人" clearable :style="{ width: '100%' }">
                            </el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="联系电话" prop="field108">
                            <el-input v-model="formData.field108" placeholder="请输入联系电话" clearable
                                :style="{ width: '100%' }">
                            </el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="日期" prop="field110">
                            <el-date-picker v-model="formData.field110" format="yyyy-MM-dd" value-format="yyyy-MM-dd"
                                :style="{ width: '100%' }" placeholder="请选择日期" clearable></el-date-picker>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="分类" prop="field112">
                            <el-select v-model="formData.field112" placeholder="请选择分类" clearable :style="{ width: '100%' }">
                                <el-option v-for="(item, index) in field112Options" :key="index" :label="item.label"
                                    :value="item.value" :disabled="item.disabled"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="14">
                        <el-form-item label="紧急程度" prop="field113">
                            <el-radio-group v-model="formData.field113" size="medium">
                                <el-radio v-for="(item, index) in field113Options" :key="index" :label="item.value"
                                    :disabled="item.disabled">{{ item.label }}</el-radio>
                            </el-radio-group>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="招待人" prop="field114">
                            <el-input v-model="formData.field114" placeholder="请输入招待人" clearable :style="{ width: '100%' }">
                            </el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="指定处理人" prop="field115">
                            <el-input v-model="formData.field115" placeholder="请输入指定处理人" clearable
                                :style="{ width: '100%' }">
                            </el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="24">
                        <el-form-item label="投诉主题" prop="field116">
                            <el-input v-model="formData.field116" placeholder="请输入投诉主题" clearable
                                :style="{ width: '100%' }">
                            </el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="24">
                        <el-form-item label="问题描述" prop="field117">
                            <el-input v-model="formData.field117" type="textarea" placeholder="请输入问题描述"
                                :autosize="{ minRows: 4, maxRows: 4 }" :style="{ width: '100%' }"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="24">
                        <el-form-item label="备注" prop="field118">
                            <el-input v-model="formData.field118" type="textarea" placeholder="请输入备注"
                                :autosize="{ minRows: 4, maxRows: 4 }" :style="{ width: '100%' }"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="24">
                        <el-form-item label="附件" prop="field119">
                            <el-upload ref="field119" :file-list="field119fileList" :action="field119Action"
                                :before-upload="field119BeforeUpload">
                                <el-button size="small" type="primary" icon="el-icon-upload">点击上传</el-button>
                            </el-upload>
                        </el-form-item>
                    </el-col>
                    <el-col :span="24">
                        <el-form-item size="large">
                            <el-button type="primary" @click="submitForm">提交</el-button>
                            <el-button @click="resetForm">重置</el-button>
                        </el-form-item>
                    </el-col>
                </el-row>
            </el-card>

        </el-form>
    </div>
</template>
<script>
export default {
    components: {},
    props: [],
    data() {
        return {
            formData: {
                field101: undefined,
                field102: undefined,
                field103: undefined,
                field104: undefined,
                field105: undefined,
                field106: undefined,
                field107: undefined,
                field108: undefined,
                field110: null,
                field112: undefined,
                field113: undefined,
                field114: undefined,
                field115: undefined,
                field116: undefined,
                field117: undefined,
                field118: undefined,
                field119: null,
            },
            rules: {
                field101: [],
                field102: [],
                field103: [],
                field104: [],
                field105: [{
                    required: true,
                    message: '请输入客户名称',
                    trigger: 'blur'
                }],
                field106: [{
                    required: true,
                    message: '请输入合同号',
                    trigger: 'blur'
                }],
                field107: [],
                field108: [],
                field110: [{
                    required: true,
                    message: '请选择日期',
                    trigger: 'change'
                }],
                field112: [{
                    required: true,
                    message: '请选择分类',
                    trigger: 'change'
                }],
                field113: [{
                    required: true,
                    message: '紧急程度不能为空',
                    trigger: 'change'
                }],
                field114: [{
                    required: true,
                    message: '请输入招待人',
                    trigger: 'blur'
                }],
                field115: [{
                    required: true,
                    message: '请输入指定处理人',
                    trigger: 'blur'
                }],
                field116: [{
                    required: true,
                    message: '请输入投诉主题',
                    trigger: 'blur'
                }],
                field117: [],
                field118: [],
            },
            field119Action: 'https://jsonplaceholder.typicode.com/posts/',
            field119fileList: [],
            field101Options: [{
                "label": "选项一",
                "value": 1
            }, {
                "label": "选项二",
                "value": 2
            }],
            field102Options: [{
                "label": "选项一",
                "value": 1
            }, {
                "label": "选项二",
                "value": 2
            }],
            field112Options: [{
                "label": "选项一",
                "value": 1
            }, {
                "label": "选项二",
                "value": 2
            }],
            field113Options: [{
                "label": "普通",
                "value": 1
            }, {
                "label": "急",
                "value": 2
            }, {
                "label": "非常急",
                "value": 3
            }],
        }
    },
    computed: {},
    watch: {},
    created() { },
    mounted() { },
    methods: {
        submitForm() {
            this.$refs['elForm'].validate(valid => {
                if (!valid) return
                // TODO 提交表单
            })
        },
        resetForm() {
            this.$refs['elForm'].resetFields()
        },
        field119BeforeUpload(file) {
            let isRightSize = file.size / 1024 / 1024 < 2
            if (!isRightSize) {
                this.$message.error('文件大小超过 2MB')
            }
            return isRightSize
        },
    }
}

</script>
<style>
.el-upload__tip {
    line-height: 1.2;
}

.tit {
    font-size: 17px;

}
</style>
  