頁(yè)面證件打印

<template>
    <a-modal title=""
             :width="1000"
             v-model="visible"
             :maskClosable="false"
             :closable="false"
             okText="返回">

        <div v-for="(item,index) of printDoubleData"
             :key="index"
             :id="'content'+ index"
             class="contentt">
            <!-- <div class="prinLeft">
                <div class="leftContent">
                    <div class="leftContentLeft">應(yīng)急管理部政治部監(jiān)制</div>
                    <div class="leftContentRight">
                        <div></div>
                        <div class="contRightB">政府專(zhuān)職消防員證</div>
                        <div class="contRightC">中華人民共和國(guó)應(yīng)急管理部</div>
                    </div>
                </div>
            </div> -->
            <div class="prinRight">
                <div class="rightNumLeft">
                    <div class="photoDiv">
                        <img class="photo"
                             :src="item.certificatePhoto"
                             alt="">
                    </div>
                    <div style="margin-left:15.83px">
                        <div class="rightTitle">
                            <span>編</span><span style="margin-left:30px;">號(hào)</span><span>粵政消</span> <span style="margin:0 8px;">字第</span><span>{{item.certificateNumber}}</span> <span style="margin-left:3px;">號(hào)</span>
                        </div>
                        <div class="rightTitle">
                            <span>發(fā)證機(jī)關(guān)</span><span style="margin-left:15px">廣東省消防救援總隊(duì)</span>
                        </div>
                        <div class="rightTitle">
                            <span>發(fā)證日期</span><span style="margin:0 10px;">{{item.BeginYear}}</span>年<span style="margin:0 10px;">{{item.BeginMonth}}</span>月<span style="margin:0 10px;">{{item.BeginDo}}</span>日
                        </div>
                        <div class="rightTitles">
                            <span>有效期至</span><span style="margin:0 10px;">{{item.EndYear}}</span>年<span style="margin:0 10px;">{{item.EndMonth}}</span>月<span style="margin:0 10px;">{{item.EndDo}}</span>日
                        </div>
                    </div>
                </div>
                <div class="rightTabRight">
                    <table border="1"
                           style="width:223px;height:318px;margin:0 auto">
                        <tr align="center">
                            <th colspan="1"
                                style="height:14.29%;width: 40px;">姓<br />名</th>
                            <td colspan="7"
                                style="height:14.29%;">{{item.certificateName}}</td>
                        </tr>
                        <tr align="center">
                            <th colspan="1"
                                style="height:14.29%;width: 40px;">出生<br />年月</th>
                            <td colspan="3"
                                style="height:14.29%;">{{item.birthDate}}</td>
                            <th colspan="1"
                                style="height:14.29%;width:25px">性<br />別</th>
                            <td colspan="2"
                                style="height:14.29%;">{{item.sex==1?'女':'男'}}</td>
                        </tr>
                        <tr align="center">
                            <th colspan="1"
                                style="height:14.29%;width: 40px;">籍<br />貫</th>
                            <td colspan="7"
                                style="height:14.29%;">{{item.nativePlace}}</td>
                        </tr>
                        <tr align="center">
                            <th colspan="1"
                                style="height:14.29%;width: 40px;">民<br />族</th>
                            <td colspan="7"
                                style="height:14.29%;">{{item.ethnic}}</td>
                        </tr>
                        <tr align="center">
                            <th colspan="1"
                                style="height:14.29%;width: 40px;">身份<br />證號(hào)</th>
                            <td colspan="7"
                                style="height:14.29%;">{{item.identityCardNumber}}</td>
                        </tr>
                        <tr align="center">
                            <th colspan="1"
                                style="height:14.29%;width: 40px;">單<br />位</th>
                            <td colspan="7"
                                style="height:14.29%;">{{item.deptName}}</td>
                        </tr>
                        <tr align="center">
                            <th colspan="1"
                                style="height:14.29%;width: 40px;">職<br />務(wù)</th>
                            <td colspan="7"
                                style="height:14.29%;">{{item.personnelType==1?'消防文員':item.personnelType==2?'消防文員':'企業(yè)專(zhuān)職'}}</td>
                        </tr>
                    </table>
                </div>
            </div>
        </div>
        <div slot="footer"
             style="text-align:center">
            <a-button style="background-color:#fafafa"
                      @click="back">
                返回
            </a-button>
            <a-button type="primary"
                      @click="handlePrint">
                打印
            </a-button>
        </div>
    </a-modal>

</template>
<script>
const styleSheet = `<style>
.content {width: 522px;height: 385px;}
.prinRight {width: 519.7px;height: 384.2px;display: flex;justify-content: space-between;align-items: center;position: relative;font-family: STFangsong;}
.rightNumLeft {width: 50%;height: 100%;margin-left:12.5px;display: flex;flex-direction: column;justify-content: center;}
.photoDiv {width: 94.15px;height: 131.81px;text-align: center;margin-left:96px;margin-bottom: 12.5px;}
.photo {width: 100%;height: 100%;}
.rightTitle {margin: 14.5px 0;width: 100%;text-align: left;font-size: 15px;font-family: STFangsong;}
.rightTitles {margin: 0 0;width: 100%;text-align: left;font-size: 15px;font-family: STFangsong;}
.rightTabRight {width: 50%;height:100%;display: flex;align-items: center;}
th,td {margin: 0;padding: 0;}table {*border-style: solid;*border-color: #333;*border-width: 1px 0 0 1px;font-size: 13px;border-collapse: collapse;}
table td,table th {font-family: STFangsong;border-width: 1px;*border-width: 0 1px 1px 0;border-style: solid;border-color: #333;box-sizing: border-box;text-justify: inter-ideograph;}
table th {text-align: center;}
table td {color: #000;font-weight: bold;font-size: 17px;}
.border0 {padding: 0;*border-width: 0;}
.border0 table {margin-left: -1px;border-style: hidden;*border-style: solid;border-width: 0;}</style>`
// 公共配置
import COMMON from '@/utils/mixins/common' // 混入公共組件配置
import cloneDeep from 'lodash.clonedeep'
import moment from 'moment'
import { getAllTreeList } from '@/api/common'
import { getSelectOneDetails } from '@/api/smartManagement/smart-data-standing-book/smart-station-important-diary'

import config from '../config'
export default {
    mixins: [COMMON],
    data() {
        return {
            treeFilter: [],
            ...config,
            visible: false,
            printDoubleData: [],
            form: {}
        }
    },
    created() {
        // this.loadDeptList()
    },
    methods: {
        moment,
        handlePrint() {
            //打印
            var newWin = window.open('') //新打開(kāi)一個(gè)空窗口
            this.printDoubleData.map((item, i) => {
                var imageToPrint = document.getElementById('content' + i) //獲取需要打印的內(nèi)容
                newWin.document.write(imageToPrint.outerHTML) //將需要打印的內(nèi)容添加進(jìn)新的窗口
            })
            newWin.document.head.innerHTML = styleSheet //給打印的內(nèi)容加上樣式
            newWin.document.close() //在IE瀏覽器中使用必須添加這一句
            newWin.focus() //在IE瀏覽器中使用必須添加這一句
            setTimeout(function () {
                newWin.print() //打印
                console.log('開(kāi)始打印')
                newWin.close() //關(guān)閉窗口
            }, 100)
        },
        deptid(record) {
            const result = this.findIndexArray(JSON.parse(JSON.stringify(this.treeFilter)), record)
            return result ? result.title : ''
        },
        findIndexArray(data, current) {
            var result = ''
            if (!data) {
                // return; 中斷執(zhí)行
                return
            }
            for (var i in data) {
                var item = data[i]
                if (item.id == current) {
                    result = item
                    break
                } else if (item.childrens && item.childrens.length > 0 && !result) {
                    result = this.findIndexArray(item.childrens, current)
                }
            }
            return result
        },
        info(record) {
            //單個(gè)打印
            this.printDoubleData = []
            console.log('record: ', record)
            const params = {}
            params.certificateNumber = record.certificateNumber //編號(hào)
            params.BeginYear = moment(record.certificateBegin).format('YYYY') //有效年
            params.BeginMonth = moment(record.certificateBegin).format('MM') //有效月
            params.BeginDo = moment(record.certificateBegin).format('Do').split('日')[0] //有效日
            params.EndYear = moment(record.certificateEnd).format('YYYY') //有效至年
            params.EndMonth = moment(record.certificateEnd).format('MM') //有效至月
            params.EndDo = moment(record.certificateEnd).format('Do').split('日')[0] //有效至日
            params.certificateName = record.certificateName //姓名
            params.certificatePhoto = record.certificatePhoto //證件照
            params.birthDate = record.birthDate //出生年月
            params.sex = record.sex //性別
            params.nativePlace = record.nativePlace //籍貫
            params.ethnic = record.ethnic //民族
            params.identityCardNumber = record.identityCardNumber //身份證號(hào)
            params.deptName = record.deptName //單位
            params.personnelType = record.personnelType //職務(wù)
            this.printDoubleData.push(params)
            this.visible = true
        },
        back() {
            this.visible = false
        }
    }
}
</script>
<style lang="less" scoped>
.photo {
    width: 30px;
    height: 30px;
}
</style>

<style scoped lang="less">
.contentt {
    width: 520px;
    height: 385px;
    margin: auto;
    // display: none;
    .prinRight {
        width: 519.7px;
        height: 384.2px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        // background-color: #e2f4d2;
        position: relative;
        font-family: STFangsong;
        .rightNumLeft {
            width: 50%;
            height: 100%;
            display: flex;
            flex-direction: column;
            justify-content: center;
            .photoDiv {
                width: 94.15px;
                height: 131.81px;
                background-color: white;
                text-align: center;
                margin-bottom: 12.5px;
                margin-left: 75.32px;
                .photo {
                    width: 100%;
                    height: 100%;
                    // display: inline-block;
                    // font-size: 11px;
                    // -webkit-writing-mode: vertical-lr;
                    // writing-mode: vertical-lr;
                }
            }
            .rightTitle {
                margin: 14.5px 0;
                width: 100%;
                font-family: STFangsong;
                text-align: left;
                font-size: 15px;
            }
            .rightTitles {
                margin: 5px 0;
                width: 100%;
                text-align: left;
                font-size: 15px;
                font-family: STFangsong;
            }
        }
        .rightTabRight {
            width: 50%;
            height: 100%;
            display: flex;
            align-items: center;
        }
    }
}

th,
td {
    margin: 0;
    padding: 0;
}

table {
    *border-style: solid;
    *border-color: #333;
    *border-width: 1px 0 0 1px;
    font-size: 13px;
    border-collapse: collapse;
}
table td,
table th {
    border-width: 1px;
    *border-width: 0 1px 1px 0;
    border-style: solid;
    border-color: #333;
    // background-color: #e2f4d2;
    box-sizing: border-box;
    text-justify: inter-ideograph;
}
table th {
    // background-color: #dedede;
    text-align: center;
    font-size: 13px;
}
table td {
    color: #000;
    font-weight: bold;
    font-size: 17px;
}
.border0 {
    padding: 0;
    *border-width: 0;
}
.border0 table {
    margin-left: -1px;
    margin-left: 0\9;
    border-style: hidden;
    *border-style: solid;
    border-width: 0;
}
</style>
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個(gè)濱河市,隨后出現(xiàn)的幾起案子棍厌,更是在濱河造成了極大的恐慌,老刑警劉巖闲勺,帶你破解...
    沈念sama閱讀 218,941評(píng)論 6 508
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場(chǎng)離奇詭異扣猫,居然都是意外死亡菜循,警方通過(guò)查閱死者的電腦和手機(jī),發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,397評(píng)論 3 395
  • 文/潘曉璐 我一進(jìn)店門(mén)申尤,熙熙樓的掌柜王于貴愁眉苦臉地迎上來(lái)癌幕,“玉大人衙耕,你說(shuō)我怎么就攤上這事∩自叮” “怎么了橙喘?”我有些...
    開(kāi)封第一講書(shū)人閱讀 165,345評(píng)論 0 356
  • 文/不壞的土叔 我叫張陵,是天一觀的道長(zhǎng)胶逢。 經(jīng)常有香客問(wèn)我厅瞎,道長(zhǎng),這世上最難降的妖魔是什么初坠? 我笑而不...
    開(kāi)封第一講書(shū)人閱讀 58,851評(píng)論 1 295
  • 正文 為了忘掉前任和簸,我火速辦了婚禮,結(jié)果婚禮上碟刺,老公的妹妹穿的比我還像新娘锁保。我一直安慰自己,他們只是感情好南誊,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,868評(píng)論 6 392
  • 文/花漫 我一把揭開(kāi)白布。 她就那樣靜靜地躺著蜜托,像睡著了一般抄囚。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上橄务,一...
    開(kāi)封第一講書(shū)人閱讀 51,688評(píng)論 1 305
  • 那天幔托,我揣著相機(jī)與錄音,去河邊找鬼蜂挪。 笑死重挑,一個(gè)胖子當(dāng)著我的面吹牛,可吹牛的內(nèi)容都是我干的棠涮。 我是一名探鬼主播谬哀,決...
    沈念sama閱讀 40,414評(píng)論 3 418
  • 文/蒼蘭香墨 我猛地睜開(kāi)眼,長(zhǎng)吁一口氣:“原來(lái)是場(chǎng)噩夢(mèng)啊……” “哼严肪!你這毒婦竟也來(lái)了史煎?” 一聲冷哼從身側(cè)響起,我...
    開(kāi)封第一講書(shū)人閱讀 39,319評(píng)論 0 276
  • 序言:老撾萬(wàn)榮一對(duì)情侶失蹤驳糯,失蹤者是張志新(化名)和其女友劉穎篇梭,沒(méi)想到半個(gè)月后,有當(dāng)?shù)厝嗽跇?shù)林里發(fā)現(xiàn)了一具尸體酝枢,經(jīng)...
    沈念sama閱讀 45,775評(píng)論 1 315
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡恬偷,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,945評(píng)論 3 336
  • 正文 我和宋清朗相戀三年,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了帘睦。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片袍患。...
    茶點(diǎn)故事閱讀 40,096評(píng)論 1 350
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡坦康,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出协怒,到底是詐尸還是另有隱情涝焙,我是刑警寧澤,帶...
    沈念sama閱讀 35,789評(píng)論 5 346
  • 正文 年R本政府宣布孕暇,位于F島的核電站仑撞,受9級(jí)特大地震影響,放射性物質(zhì)發(fā)生泄漏妖滔。R本人自食惡果不足惜隧哮,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,437評(píng)論 3 331
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望座舍。 院中可真熱鬧沮翔,春花似錦、人聲如沸曲秉。這莊子的主人今日做“春日...
    開(kāi)封第一講書(shū)人閱讀 31,993評(píng)論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)承二。三九已至榆鼠,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間亥鸠,已是汗流浹背妆够。 一陣腳步聲響...
    開(kāi)封第一講書(shū)人閱讀 33,107評(píng)論 1 271
  • 我被黑心中介騙來(lái)泰國(guó)打工, 沒(méi)想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留负蚊,地道東北人神妹。 一個(gè)月前我還...
    沈念sama閱讀 48,308評(píng)論 3 372
  • 正文 我出身青樓,卻偏偏與公主長(zhǎng)得像家妆,于是被迫代替她去往敵國(guó)和親鸵荠。 傳聞我的和親對(duì)象是個(gè)殘疾皇子,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 45,037評(píng)論 2 355

推薦閱讀更多精彩內(nèi)容