<template>
    <el-drawer v-bind="$attrs" v-on="$listeners" @confirm="handleConfirm">

        <el-form :model="data" :rules="rules"  ref="form" label-width="120px">
            <el-form-item label="服务标准标题" prop="serviceStandardTitle">
                <el-form-content ele="input" v-model="data.serviceStandardTitle"></el-form-content>
            </el-form-item>
            <el-form-item label="服务标准分类" prop="serviceStandardTypeId">
                <el-form-content ele="input" v-model="data.serviceStandardTypeId"></el-form-content>
                <!--<el-form-content-->
                        <!--ele="dictSelect"-->
                        <!--v-model="data.serviceStandardTypeId"-->
                        <!--:options="types"-->
                        <!--label-key="serviceStandardTypeName"-->
                        <!--value-key="id"-->
                <!--&gt;</el-form-content>-->
            </el-form-item>
            <el-form-item label="发行部门" prop="publishOrgId">
                <!--<el-form-content-->
                        <!--ele="dictSelect"-->
                        <!--v-model="data.publishOrgId"-->
                        <!--:options="orgs"-->
                        <!--label-key="name"-->
                        <!--value-key="id"-->
                <!--&gt;</el-form-content>-->
                <el-form-content ele="input" v-model="data.publishOrgId"></el-form-content>
            </el-form-item>
            <el-form-item label="上传文件" prop="serviceStandardFileList">
                <el-upload v-model="data.serviceStandardFileList" :file-list="data.serviceStandardFileList">
                    <el-button size="small" type="primary">点击上传</el-button>
                    <!--<div slot="tip" class="el-upload__tip">只能上传jpg/png文件，且不超过500kb</div>-->
                </el-upload>
            </el-form-item>
            <el-form-item label="备注" >
                <el-form-content ele="input" type="textarea" v-model="data.note"></el-form-content>
            </el-form-item>
        </el-form>

    </el-drawer>
</template>

<script>
    // import { starRating } from '@/config/dict'
    export default {
        name: 'Detail',
        props: {
            data: {
                type: Object,
                default: () => ({
                    serviceStandardFileList: []
                })
            },
        },
        data() {
            return {
                form: {},
                rules: {
                    serviceStandardTitle: [
                        { required: true, message: '请输入服务标准标题', trigger: 'blur' }
                    ],
                    serviceStandardTypeId: [
                        { required: true, message: '请选择服务标准分类', trigger: 'change' }
                    ],
                    publishOrgId: [
                        { required: true, message: '请选择发行部门', trigger: 'change' }
                    ],
                    serviceStandardFileList: [
                        { required: true, message: '请上传文件', trigger: 'change' }
                    ]
                },
                // starRating
            }
        },
        methods: {
            getLabel(value) {
                let row = menuType.find(item => item.dictValue == value)
                return row ? row.dictLabel : ''
            },
            handleConfirm() {
                console.log(2222222);
                this.$refs.form.validate((valid) => {
                    if (valid) {
                        console.log('this.data', this.data)
                        this.$emit('submit', this.data)
                    } else {
                        return false;
                    }
                })
            }
        }
    }
</script>

<style scoped></style>
