index.vue
3.45 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<!--
* @Description:
* @Date: 2021-06-09 19:05:20
-->
<template>
<div class="bi-photo" ref="bi-photo">
<BiTitle :index="index" :name="name">
<template #handler>
<div class="bi-title-photo-btn" v-if="!isPrint">
<SelectStyle
style="margin: 0 5px"
v-if="showEdit"
:layout="{
imageStyle: value.imageStyle,
imageSize: value.imageSize
}"
@handleSave="selectStyleSave"
/>
<SelectImages
style="margin: 0 5px"
v-if="showEdit"
:imageUrls="value.imageUrls"
@handleSave="selectImgSave"
/>
<Del style="margin: 0 5px" @del="onDel" />
</div>
</template>
</BiTitle>
<BiImages :taskImageInfo="value" @finish="finish" />
</div>
</template>
<script>
import BiTitle from '../../commonComponents/title.vue';
import BiImages from './images';
import SelectImages from './select';
import SelectStyle from './style';
import Del from './del';
import { heightToPage } from '../../chart-type/common';
import mixin from '../../mixin/index';
export default {
name: 'bi-photo-wall',
mixins: [mixin],
components: {
BiTitle,
BiImages,
SelectImages,
SelectStyle,
Del
},
props: {
name: String,
value: {
default() {
return {
isDelete: 0, // 1删除
imageStyle: 2, // 1流式 2平铺 流式不限制高度,但是有max-height,平铺为正方形
imageSize: 2, //图片大小 1 大 2中 3小
imageUrls: [
// {
// id: 1,
// biInfoId: 123, //BI主键
// taskId: 123, //任务记录ID
// imageUrl: '图片地址'
// }
]
};
},
type: Object
},
index: {
type: Number,
default: 4
}
},
computed: {
showEdit() {
return +this.Bi.selectType === 45; // 44自定义-BI报告 45当期-BI报告(显示样式、选择) 46累计-BI报告
}
},
methods: {
finish() {
this.$emit('finish');
},
// 选择图片的保存
selectImgSave(e) {
this.$emit('input', {
...this.value,
imageUrls: e
});
},
// 选择样式的保存
selectStyleSave(e) {
this.$emit('input', {
...this.value,
...e
});
},
onDel() {
this.$emit('input', {
...this.value,
isDelete: 1
});
}
},
watch: {
value: {
handler() {
this.$nextTick(() => {
this.$emit('page', heightToPage(this.$refs['bi-photo'].offsetHeight));
});
},
deep: true,
immediate: true
}
}
};
</script>
<style lang="scss" scoped>
.bi-photo {
page-break-before: always;
// page-break-after: always;
padding-bottom: 50px;
&_btn {
display: inline-block;
min-width: 42px;
height: 42px;
border: 1px solid #bac1ce;
border-radius: 4px;
vertical-align: top;
text-align: center;
line-height: 42px;
padding: 0 15px;
font-size: 16px;
font-weight: 500;
color: #6f7a91;
cursor: pointer;
position: relative;
&_group {
position: absolute;
right: 16px;
top: 50%;
margin-top: -21px;
z-index: 3;
&_item {
& + .bi-chart-title_btn_group_item {
margin-left: 8px;
}
}
}
}
}
.bi-title-photo-btn {
display: flex;
width: 320px;
justify-content: flex-end;
}
</style>