<template>
    <div class="L-public-main yewufazhan-box">
        <div class="yewufazhanbox-left">
            <div class="yewufazhan-title">文本编辑器</div>
            <el-form :model="addFrom" size="small" ref="importFrom" :rules="rules" class="newArticle">
                <el-row :gutter="20">
                    <el-col>
                        <el-form-item class="yewufazhanbox-input" prop="name">
                            <el-input v-model.trim="addFrom.name" placeholder="请输入报告模板标题"></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row :gutter="20">
                    <el-col>
                        <el-form-item class="yewufazhanbox-input" prop="enterUnit">
                            <el-input v-model.trim="addFrom.enterUnit" placeholder="副标题"></el-input>
                        </el-form-item>
                    </el-col>

                </el-row>
                <el-row>
                    <el-col :span="24">
                        <el-form-item prop="enterContent">
                            <myEditor :height="200" v-model="addFrom.enterContent"></myEditor>
                        </el-form-item>
                    </el-col>
                </el-row>

            </el-form>
            <div class="dialog-footer">
                <el-form size="small">
                    <el-form-item class="dialog-from-item">
                        <el-button @click="footbtn('预览')">预览</el-button>
                        <el-button type="primary" @click="footbtn('保存')">保存</el-button>
                        <el-button type="primary" @click="footbtn('一键生成')">一键生成</el-button>
                        <el-button type="primary" @click="footbtn('导出')">导出</el-button>
                    </el-form-item>
                </el-form>
            </div>
        </div>
        <div class="yewufazhanbox-right">
            <div class="yewufazhan-title">文本编辑器</div>
            <div class="yewufazhanbox-right-from">
                <span>年份：</span>
                <el-date-picker v-model="nianfenvalue3" type="year" placeholder="选择年">
                </el-date-picker>
            </div>
            <div class="yewufazhanbox-right-table">
                <el-table :data="tableData" border header-align="center" stripe>
                <el-table-column prop="shuju" label="数据项" width="180" align="center">
                </el-table-column>
                <el-table-column prop="nianfen" label="统计年份" align="center">
                </el-table-column>
                <el-table-column prop="shuzhi" label="数值" align="center">
                </el-table-column>
                <el-table-column prop="shuzhi" label="操作" align="center">
                    <template slot-scope="scope">
                        <div class="yewufazhanbox-charu" @click="charu(scope.row)">插入</div>
                    </template>
                </el-table-column>
            </el-table>
            </div>
       

        </div>
    </div>
</template>

<script>
import myEditor from "@/views/components/myEditor/index.vue"

export default {
    name: '',
    components: { myEditor },
    data() {
        return {
            nianfenvalue3: "",
            addFrom: {
                name: "",
                joinProject: "",
                enterUnit: "",
                policyLevel: "",
            },
            rules: {
                name: [
                    { required: true, message: '请填写政策文件名称', trigger: 'blur' }
                ],
                // joinProject:[
                //   { required: true, message: '请填写政策等级', trigger: 'blur' }
                // ],
                enterUnit: [
                    { required: true, message: '请填写发文单位', trigger: 'blur' }
                ],
                policyLevel: [
                    { required: true, message: '请选择政策等级', trigger: 'change' }
                ],
                enterTime: [
                    { required: true, message: '请选择发文时间', trigger: 'change' }
                ],
            },
            tableData: [
                {
                    shuju: "服务业企业总数 ",
                    nianfen: "2023",
                    shuzhi: "524"
                }, {
                    shuju: "服务业企业总数 ",
                    nianfen: "2023",
                    shuzhi: "524"
                }, {
                    shuju: "服务业企业总数 ",
                    nianfen: "2023",
                    shuzhi: "524"
                }, {
                    shuju: "服务业企业总数 ",
                    nianfen: "2023",
                    shuzhi: "524"
                }, {
                    shuju: "服务业企业总数 ",
                    nianfen: "2023",
                    shuzhi: "524"
                }, {
                    shuju: "服务业企业总数 ",
                    nianfen: "2023",
                    shuzhi: "524"
                }, {
                    shuju: "服务业企业总数 ",
                    nianfen: "2023",
                    shuzhi: "524"
                }, {
                    shuju: "服务业企业总数 ",
                    nianfen: "2023",
                    shuzhi: "524"
                }, {
                    shuju: "服务业企业总数 ",
                    nianfen: "2023",
                    shuzhi: "524"
                }, {
                    shuju: "服务业企业总数 ",
                    nianfen: "2023",
                    shuzhi: "524"
                }, {
                    shuju: "服务业企业总数 ",
                    nianfen: "2023",
                    shuzhi: "524"
                }, {
                    shuju: "服务业企业总数 ",
                    nianfen: "2023",
                    shuzhi: "524"
                }, {
                    shuju: "服务业企业总数 ",
                    nianfen: "2023",
                    shuzhi: "524"
                }, {
                    shuju: "服务业企业总数 ",
                    nianfen: "2023",
                    shuzhi: "524"
                }, {
                    shuju: "服务业企业总数 ",
                    nianfen: "2023",
                    shuzhi: "524"
                }, {
                    shuju: "服务业企业总数 ",
                    nianfen: "2023",
                    shuzhi: "524"
                }, {
                    shuju: "服务业企业总数 ",
                    nianfen: "2023",
                    shuzhi: "524"
                }, {
                    shuju: "服务业企业总数 ",
                    nianfen: "2023",
                    shuzhi: "524"
                }, {
                    shuju: "服务业企业总数 ",
                    nianfen: "2023",
                    shuzhi: "524"
                }, {
                    shuju: "服务业企业总数 ",
                    nianfen: "2023",
                    shuzhi: "524"
                }, {
                    shuju: "服务业企业总数 ",
                    nianfen: "2023",
                    shuzhi: "524"
                }, {
                    shuju: "服务业企业总数 ",
                    nianfen: "2023",
                    shuzhi: "524"
                }, {
                    shuju: "服务业企业总数 ",
                    nianfen: "2023",
                    shuzhi: "524"
                }, {
                    shuju: "服务业企业总数 ",
                    nianfen: "2023",
                    shuzhi: "524"
                }, {
                    shuju: "服务业企业总数 ",
                    nianfen: "2023",
                    shuzhi: "524"
                }, {
                    shuju: "服务业企业总数 ",
                    nianfen: "2023",
                    shuzhi: "524"
                }, {
                    shuju: "服务业企业总数 ",
                    nianfen: "2023",
                    shuzhi: "524"
                }, {
                    shuju: "服务业企业总数 ",
                    nianfen: "2023",
                    shuzhi: "524"
                }, {
                    shuju: "服务业企业总数 ",
                    nianfen: "2023",
                    shuzhi: "524"
                }, {
                    shuju: "服务业企业总数 ",
                    nianfen: "2023",
                    shuzhi: "524"
                }, {
                    shuju: "服务业企业总数 ",
                    nianfen: "2023",
                    shuzhi: "524"
                }, {
                    shuju: "服务业企业总数 ",
                    nianfen: "2023",
                    shuzhi: "524"
                }, {
                    shuju: "服务业企业总数 ",
                    nianfen: "2023",
                    shuzhi: "524"
                }, {
                    shuju: "服务业企业总数 ",
                    nianfen: "2023",
                    shuzhi: "524"
                }, {
                    shuju: "服务业企业总数 ",
                    nianfen: "2023",
                    shuzhi: "524"
                }, {
                    shuju: "服务业企业总数 ",
                    nianfen: "2023",
                    shuzhi: "524"
                }, {
                    shuju: "服务业企业总数 ",
                    nianfen: "2023",
                    shuzhi: "524"
                }, {
                    shuju: "服务业企业总数 ",
                    nianfen: "2023",
                    shuzhi: "524"
                }, {
                    shuju: "服务业企业总数 ",
                    nianfen: "2023",
                    shuzhi: "524"
                }, {
                    shuju: "服务业企业总数 ",
                    nianfen: "2023",
                    shuzhi: "524"
                },
            ]
        }
    },
    created() { },
    mounted() { },
    methods: {
        // 插入
        charu(item){
            console.log(item);
            this.addFrom.enterContent = item.shuzhi
        },
        // 底部按钮

        footbtn(type) {
            if (type == '预览') {

            }
            if (type == '保存') {

            }
            if (type == '一键生成') {

            }
            if (type == '导出') {

            }
        }
    },
    computed: {}
}
</script>
<style scoped lang='scss'></style>
