<template>
    <div>
        <el-dialog title="编辑内容" :visible="emailVidable"  @close="cancel" center
            :distroy-on-close="true">
            <div>
                <el-input type="textarea" :rows="6" placeholder="请输入内容" v-model="sendData">
                </el-input>
            </div>
            <div slot="footer" class="dialog-footer">
                <el-button @click="cancel" class="endbutton1" round><span>取 消</span></el-button>
                <el-button @click="submitSend" class="endbutton1" type="primary" round><span>确 认</span></el-button>
            </div>
        </el-dialog>
    </div>
</template>

<script>
import {
    updateSendContent,update
} from "@/api/deliveryRecord/deliveryRecord.js";
export default {
    props: ["emailVidable", "emailRow","queryParams"],
    data() {
        return {
            sendData:''
        };
    },
    watch: {
        emailVidable(val){
            if(val){
                this.sendData = this.emailRow.mailContent;
            }
        }
    },
    methods: {
        cancel() {
            this.$emit("cancelEmail");
        },
        submitSend() {
            console.log(this.emailRow.mailContent)
            this.updateSendContentFn({
                id:this.emailRow.id,
                mailContent:this.sendData
            })
        },
        updateSendContentFn(data){
            update(data).then(res=>{
                this.$message.success('更新成功');
                this.$emit("cancelEmail");
                this.$emit('getList',this.queryParams);
            })
        }
    },
};
</script>

<style lang="scss" scoped></style>