<template>
    <div class="picture-main">
        <el-dialog title="图片明细" :visible.sync="dialogShow">
            <el-form :model="form">
                <el-form-item label="图片id">
                    <el-input v-model="form.id"></el-input>
                </el-form-item>
                <el-form-item label="图片名称">
                    <el-input v-model="form.name"></el-input>
                </el-form-item>
                <el-form-item label="图片标题">
                    <el-input v-model="form.title"></el-input>
                </el-form-item>
                <el-form-item label="图片描述">
                    <el-input type="textarea" v-model="form.desc" :rows="5"></el-input>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="dialogShow = false">取 消</el-button>
                <el-button type="primary" @click="submit()">确 定</el-button>
            </div>
        </el-dialog>
    </div>
</template>
<script>
import pictureApi from '@/api/picture/picture.js';
export default {
    name:"PictureDetail",
    data() {
        return {
            dialogShow:false,
            form:{}
        }
    },
    methods: {
        // 打开弹窗
        open(item){
            this.dialogShow=true;
            console.log("item==",item);
            this.form=item;
        },
        // 提交
        submit(){
            this.dialogShow=false;
            pictureApi.updateImgList(this.form)
            .then(res=>{
                console.log("编辑成功",res);
                 this.$emit("refresh");
            })
        }
    },
}
</script>