printTemplate.vue
2.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<!--
* @Description:
* @Autor: renchao
* @LastEditTime: 2023-08-24 16:15:01
-->
<template>
<div id="box">
<div class="tbalede" v-for="(el, indexx) in datass" :key="indexx" style="page-break-after: always">
<div class="title">{{ title }}</div>
<table class="xxTable">
<tr v-for="(item) in columns" :key="item.name">
<td>
{{ item.despriction }}
</td>
<td v-for="(row, index) in el" :key="index+'2'">
{{ row[item.name] }}
</td>
<td v-show="el.emptycolNum" v-for="count in emptycolNum" :key="count"></td>
</tr>
</table>
</div>
</div>
</template>
<script>
import { datas } from "./qlxxFormData.js";
import { getSjlx } from "@/utils/dictionary.js";
import { getFieldListByQlxx } from "@/api/SysDjbFieldDO.js";
export default {
data() {
return {
title: this.$parent.title,
checkList: datas.columns().checkList,
//列表数据
//空列值个数
emptycolNum:3,
//列名称对象
columns: [],
datass:[],
};
},
props: {
propsParam: {
type: Object,
default: () => {},
},
tableData: {
type: Array,
default: () => [],
},
},
created() {
},
watch: {
tableData: {
handler (newValue, oldValue) {
this.tableData=newValue
this.loadData()
},
}
},
methods: {
/**
* @description: loadData
* @author: renchao
*/
loadData() {
getFieldListByQlxx({
qllx: this.propsParam.qllx
}).then((res) => {
if (res.code === 200) {
this.columns = res.result;
}
});
this.tableData.forEach((item) => {
item.sjlx = getSjlx(item.sjlx);
})
for (let i = 0; i < this.tableData.length; i+=3) {
this.datass.push(this.tableData.slice(i,i+3))
}
let num=this.datass[this.datass.length-1].length
if (num < 3) {
this.emptycolNum =
3 - num;
this.datass[this.datass.length-1].emptycolNum=true
} else {
this.emptycolNum = 0;
}
},
},
};
</script>
<style lang="scss" scoped>
.tbalede {
width: 794px;
// height: 1123px;
margin: auto;
.title {
width: 100%;
font-weight: 700;
font-size: 16px;
text-align: center;
height: 62px;
line-height: 62px;
position: relative;
margin: 0 3px;
}
.xxTable {
width: 100%;
border-collapse: collapse;
tr td {
border: 2px solid rgb(227, 226, 226);
text-align: center;
height: 40px;
font-size: 13px;
min-width: 80px;
z-index: 1;
min-width: 80px;
padding: 5px;
}
}
}
</style>