<template>
        <el-dialog
            :title="rowData.lawKeyword"
            v-model="centerDialogVisible"
            @close="dialogClose"
            width="80%"
            center>
            <p>{{rowData.lawModify}}</p>
            <div>
                <pre>{{lawContent}}</pre>
<!--                <a v-if="filePath" href="javascript:;" @click="toPreview" target="_blank">浏览法规内容</a>-->
                <!-- <iframe v-else :src="hostUrl + filePath" frameborder="0" width="100%" height="100%" style="overflow: auto"></iframe> -->
                <!-- {{lawContent}} -->
                <!-- <el-row> -->
                    <!-- <el-col :span="2">
                        <span class="sort">{{item.sort}}</span>
                    </el-col>
                    <el-col :span="22">
                        <span class="content">{{item.content}}</span>
                    </el-col> -->
                    <!-- <el-col :span="3">
                        <span class="sign"><span v-if="item.sign">● </span>{{item.sign ? '被引用' : '&#x3000;'}}</span>
                    </el-col>
                    <el-col :span="4">
                        <span class="major">{{item.major}}</span>
                    </el-col>
                    <el-col :span="2">
                        <el-button type="success" plain>编辑</el-button>
                    </el-col> -->
                <!-- </el-row> -->
            </div>
        </el-dialog>
</template>
<script>
import request from '@/utils/gw_ajax_request.js'
import { hostUrl } from "@/utils/global_variable.js";
export default {
    props: ['rowData'],
    data(){
        return{
            listData:[
                {
                    sort: '第一条' ,
                    content: '敲黑板，这里可以放重要的信息',
                    sign: 0,
                    major: '前期与设计'
                },
                {
                    sort: '第二条' ,
                    content: '敲黑板，这里可以放重要的信息，或者让人明白，这',
                    sign: 1,
                    major: '前期与设计'
                },
                {
                    sort: '第三条' ,
                    content: '敲黑板，这里可以放重要的信息，或者让人明白，这',
                    sign: 1,
                    major: '前期与设计'
                },
                {
                    sort: '第四条' ,
                    content: '敲黑板，这里可以放重要的信息，或者让人明白，这',
                    sign: 0,
                    major: '前期与设计'
                },
                {
                    sort: '第五条' ,
                    content: '敲黑板，这里可以放重要的信息，或者让人明白，这',
                    sign: 0,
                    major: '前期与设计'
                }
            ],
            lawContent: '',
            centerDialogVisible: true,
            filePath: ''
        }
    },
    computed:{
        hostUrl(){
            return hostUrl
        }
    },
    mounted(){
        // if(!this.rowData.bookContent){
        //     this.getContent()
        // }else{
            this.lawContent = this.rowData.bookContent
            // this.lawContent = this.lawContent.replace(/(\r\n)|(\n\n)/g,'↵');
            this.lawContent = this.lawContent.replace(this.rowData.lawKeyword, '');
            this.lawContent = this.lawContent.replace(this.rowData.lawModify, '');
            //this.getContent()
        // }
    },
    methods:{
        getContent(){
            request.get(`/tac/slb/law/index/${this.rowData.id}`).then(res=>{
                if(res.success){
                    this.filePath = res.data.gwComFile[0].filePath
                }else{
                    this.$message.error(res.message)
                }
            })
        },
        dialogClose(){
            this.$emit('dialogClose')
        },
        toPreview(){
            if(this.filePath){
                window.open(`${this.hostUrl}${this.filePath}`);
            }
        }
    }
}
</script>
<style  scoped>
    .list_wrapper{
        padding: 12px 10px;
        border-bottom: solid 1px #eee;
        font-size: 16px;
        color: #888;
        .sort{
            color: #333;
        }
        .sign{
            font-size: 14px;
            span{
                color: #67C23A;
            }
        }
    }
    p{
        position: relative;
        text-align: center;
        font-size: 16px;
        color: #666;
    }
    pre {
        white-space: pre-wrap;
        word-wrap: break-word;
        line-height: 22px;
        font-size: 16px;
    }
</style>
