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

        <el-form :model="data" :rules="rules"  ref="form" label-width="120px" look>
            <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="time">
                <el-form-content ele="datePicker" type="date" valueFormat="yyyy-MM-dd" v-model="data.time"></el-form-content>
            </el-form-item>
            <el-form-item label="上传文件" prop="serviceStandardFileList">
                <el-form-content ele="upload" v-model="data.serviceStandardFileList">
                    <el-button size="small" type="primary">点击上传</el-button>
                    <div slot="tip" class="el-upload__tip">只能上传jpg/png文件，且不超过500kb</div>
                </el-form-content>
            </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-title>标题</el-title>
        </el-form>
        <el-table
                :data="tableData"
                style="width: 100%">
            <el-table-column
                    prop="date"
                    label="日期">
            </el-table-column>
            <el-table-column
                    prop="name"
                    label="姓名">
            </el-table-column>
            <el-table-column prop="address" label="地址" width="140px"></el-table-column>
            <el-table-column prop="address" label="地址" width="140px"></el-table-column>
            <el-table-column prop="address" label="地址" width="140px"></el-table-column>
            <el-table-column prop="address" label="地址" width="140px"></el-table-column>
            <el-table-column prop="address" label="地址" width="140px"></el-table-column>
            <el-table-column prop="address" label="地址" width="140px"></el-table-column>
            <el-table-column prop="address" label="地址" width="140px"></el-table-column>
            <el-table-column prop="address" label="地址" width="140px"></el-table-column>
            <el-table-column prop="address" label="地址" width="140px"></el-table-column>
            <el-table-column prop="address" label="地址" width="140px"></el-table-column>
            <el-table-column prop="address" label="地址" width="140px"></el-table-column>
            <el-table-column prop="address" label="地址" width="140px"></el-table-column>
            <el-table-column prop="address" label="地址" width="140px"></el-table-column>
            <el-table-column prop="address" label="地址" width="140px"></el-table-column>
            <el-table-column prop="address" label="地址" width="140px"></el-table-column>
            <el-table-column prop="address" label="操作" width="200px" fixed="right">
                <template slot-scope="{ row }">
                    <el-button @click="handleDelete(row)">删除</el-button>
                    <el-button>测试</el-button>
                </template>
            </el-table-column>
        </el-table>
    </el-drawer>
</template>

<script>
    // import { starRating } from '@/config/dict'
    export default {
        name: 'Detail',
        props: {
            data: {
                type: Object,
                default: () => ({
                    serviceStandardFileList: [
                        {
                            fileName: 'xxxx.png',
                            fileUrl: 'https://hnzy-obs.obs.cn-north-4.myhuaweicloud.com/669259322106298368.png'
                        },
                        {
                            fileName: 'xxxx.png',
                            fileUrl: 'https://hnzy-obs.obs.cn-north-4.myhuaweicloud.com/669259322106298368.png'
                        }
                    ],
                    // time: ['2020-01-01 00:00:00', '2020-12-31 23:59:59']
                    time: '2020-01-01 00:00:00',

                })
            },
        },
        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
                tableData: [
                    { date: '2016-05-02', name: '王小虎', address: '上海市普陀区金沙江路 1518 弄'},
                    { date: '2016-05-02', name: '王小虎', address: '上海市普陀区金沙江路 1518 弄'},
                    { date: '2016-05-02', name: '王小虎', address: '上海市普陀区金沙江路 1518 弄'},
                    { date: '2016-05-02', name: '王小虎', address: '上海市普陀区金沙江路 1518 弄'},
                    { date: '2016-05-02', name: '王小虎', address: '上海市普陀区金沙江路 1518 弄'},
                    { date: '2016-05-02', name: '王小虎', address: '上海市普陀区金沙江路 1518 弄'},
                    { date: '2016-05-02', name: '王小虎', address: '上海市普陀区金沙江路 1518 弄'},
                    { date: '2016-05-02', name: '王小虎', address: '上海市普陀区金沙江路 1518 弄'},
                    { date: '2016-05-02', name: '王小虎', address: '上海市普陀区金沙江路 1518 弄'},
                    { date: '2016-05-02', name: '王小虎', address: '上海市普陀区金沙江路 1518 弄'},
                    { date: '2016-05-02', name: '王小虎', address: '上海市普陀区金沙江路 1518 弄'},
                    { date: '2016-05-02', name: '王小虎', address: '上海市普陀区金沙江路 1518 弄'},
                    { date: '2016-05-02', name: '王小虎', address: '上海市普陀区金沙江路 1518 弄'},
                    { date: '2016-05-02', name: '王小虎', address: '上海市普陀区金沙江路 1518 弄'},
                    // { date: '2016-05-02', name: '王小虎', address: '上海市普陀区金沙江路 1518 弄'},
                    // { date: '2016-05-02', name: '王小虎', address: '上海市普陀区金沙江路 1518 弄'},
                    // { date: '2016-05-02', name: '王小虎', address: '上海市普陀区金沙江路 1518 弄'},
                    // { date: '2016-05-02', name: '王小虎', address: '上海市普陀区金沙江路 1518 弄'},
                    // { date: '2016-05-02', name: '王小虎', address: '上海市普陀区金沙江路 1518 弄'},
                ],
            }
        },
        methods: {
            getLabel(value) {
                let row = menuType.find(item => item.dictValue == value)
                return row ? row.dictLabel : ''
            },
            handleConfirm() {
                this.$refs.form.validate((valid) => {
                    if (valid) {
                        this.$emit('submit', this.data)
                    } else {
                        return false;
                    }
                })
            }
        }
    }
</script>

<style scoped></style>
