图片预览

This commit is contained in:
huangdeliang 2021-03-23 15:07:00 +08:00
parent 424b98ad57
commit 2159605a3b
2 changed files with 222 additions and 264 deletions

View File

@ -36,13 +36,15 @@
/> />
<div v-else> <div v-else>
<span :style="{ color: '#8c8c8c' }">{{ con.title }}:</span> <span :style="{ color: '#8c8c8c' }">{{ con.title }}:</span>
<el-button <el-image
v-if="data[con.value]" title="点击大图预览"
type="text" fit="contain"
size="mini" style="width: auto; height: 80px"
@click="handleOnPreviewClick(data[con.value])" :src="`${window.location.origin}${data[con.value]}`"
>查看</el-button :preview-src-list="[
> `${window.location.origin}${data[con.value]}`,
]"
/>
</div> </div>
</div> </div>
</el-collapse-item> </el-collapse-item>
@ -63,17 +65,6 @@
<el-button @click="onClosed"> </el-button> <el-button @click="onClosed"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
<!-- 预览弹窗 -->
<el-dialog
:visible.sync="previewVisible"
title="体检报告"
class="preview_dialog_wrapper"
>
<div class="preview_content">
<img :src="previewUrl" alt="" class="preview_img" />
</div>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
@ -125,8 +116,6 @@ export default {
return { return {
open: false, open: false,
previewVisible: false,
previewUrl: "",
basicInfo, basicInfo,
healthyInvestigate: [ healthyInvestigate: [
{ {
@ -268,10 +257,6 @@ export default {
} }
}); });
}, },
handleOnPreviewClick(url) {
this.previewVisible = true;
this.previewUrl = `${window.location.origin}${url}`;
},
}, },
}; };
</script> </script>

View File

@ -1,258 +1,233 @@
<template> <template>
<div> <el-dialog
<el-dialog :visible.sync="visible"
:visible.sync="visible" :title="title"
:title="title" append-to-body
append-to-body @closed="onClosed"
@closed="onClosed" :width="dialogWidth"
:width="dialogWidth" >
> <div style="display: flex; flex-direction: row">
<div style="display: flex; flex-direction: row"> <div v-if="showFlag" style="float: left; width: 900px">
<div v-if="showFlag" style="float: left; width: 900px"> <div
<div style="float: right; margin-top: -10px; margin-bottom: 10px"
style="float: right; margin-top: -10px; margin-bottom: 10px" v-show="dataList.length > 0"
v-show="dataList.length > 0" >
<!-- 只有新版健康评估信息才可修改旧的体征数据不支持修改 -->
<el-button
type="info"
v-show="dataType == 0"
@click="generateReport()"
plain
>下载报告</el-button
> >
<!-- 只有新版健康评估信息才可修改旧的体征数据不支持修改 --> <el-button
<el-button type="info"
type="info" v-show="dataType == 0"
v-show="dataType == 0" @click="handleEditGuidanceClick()"
@click="generateReport()" plain
plain >减脂指导</el-button
>下载报告</el-button >
<el-button
v-hasPermi="['custom:healthy:edit']"
type="info"
v-show="dataType == 0"
@click="handleEditRemarkClick()"
plain
>修改备注</el-button
>
<el-button
v-hasPermi="['custom:healthy:edit']"
type="warning"
v-show="dataType == 0"
@click="handleEditHealthyClick()"
plain
>修改信息</el-button
>
<el-button
type="danger"
v-hasPermi="['custom:healthy:remove']"
@click="handleDelete()"
plain
>删除信息</el-button
>
</div>
<!-- 客户健康评估 -->
<div v-if="dataList.length > 0 && dataType == 0">
<!-- 基础信息 -->
<div
v-for="(item, index) in dataList.slice(0, 1)"
style="margin-bottom: 50px"
:key="index"
>
<div>
<p class="p_title_1" style="margin-top: 5px">
{{ titleArray[index] }}
</p>
<table-detail-message :data="item"></table-detail-message>
</div>
<!-- 备注 -->
<el-table
:data="remarkList"
:show-header="false"
border
:cell-style="remarkColumnStyle"
style="width: 100%"
> >
<el-button <el-table-column width="140" prop="remarkTitle">
type="info" </el-table-column>
v-show="dataType == 0" <el-table-column prop="remarkValue">
@click="handleEditGuidanceClick()" <template slot-scope="scope">
plain <auto-hide-message
>减脂指导</el-button :data="scope.row.remarkValue"
> :maxLength="100"
<el-button /></template>
v-hasPermi="['custom:healthy:edit']" </el-table-column>
type="info" </el-table>
v-show="dataType == 0" <!-- 指导 -->
@click="handleEditRemarkClick()" <el-table
plain :data="guidanceList"
>修改备注</el-button :show-header="false"
> border
<el-button :cell-style="remarkColumnStyle"
v-hasPermi="['custom:healthy:edit']" style="width: 100%"
type="warning"
v-show="dataType == 0"
@click="handleEditHealthyClick()"
plain
>修改信息</el-button
>
<el-button
type="danger"
v-hasPermi="['custom:healthy:remove']"
@click="handleDelete()"
plain
>删除信息</el-button
> >
<el-table-column width="140" prop="guidanceTitle">
</el-table-column>
<el-table-column prop="guidanceValue">
<template slot-scope="scope">
<auto-hide-message
:data="scope.row.guidanceValue"
:maxLength="100"
/></template>
</el-table-column>
</el-table>
</div> </div>
<!-- 客户健康评估 --> <!-- 其他信息 -->
<div v-if="dataList.length > 0 && dataType == 0"> <div style="height: 390px; overflow: auto">
<!-- 基础信息 -->
<div <div
v-for="(item, index) in dataList.slice(0, 1)" v-for="(item, index) in dataList.slice(1, 10)"
style="margin-bottom: 50px" style="margin-bottom: 50px"
:key="index" :key="index"
> >
<div> <div>
<p class="p_title_1" style="margin-top: 5px"> <p class="p_title_1" style="margin-top: 5px">
{{ titleArray[index] }} {{ titleArray[index + 1] }}
</p> </p>
<table-detail-message :data="item"></table-detail-message> <table-detail-message
</div> :data="item"
<!-- 备注 --> v-if="index != dataList.length - 2"
<el-table ></table-detail-message>
:data="remarkList" <el-table
:show-header="false" :show-header="false"
border v-if="index == dataList.length - 2"
:cell-style="remarkColumnStyle" :data="item"
style="width: 100%" border
> :cell-style="columnStyle"
<el-table-column width="140" prop="remarkTitle"> style="width: 100%"
</el-table-column> >
<el-table-column prop="remarkValue"> <el-table-column width="140" prop="attr_name_one">
<template slot-scope="scope"> </el-table-column>
<auto-hide-message <el-table-column prop="value_one">
:data="scope.row.remarkValue" <template slot-scope="scope">
:maxLength="100" <el-image
/></template> v-if="scope.row.value_one"
</el-table-column> title="点击大图预览"
</el-table> style="width: auto; height: 80px"
<!-- 指导 --> fit="contain"
<el-table :src="`${window.location.origin}${medicalReportPathArray[0]}`"
:data="guidanceList" :preview-src-list="[
:show-header="false" `${window.location.origin}${medicalReportPathArray[0]}`,
border ]"
:cell-style="remarkColumnStyle" />
style="width: 100%" </template>
> </el-table-column>
<el-table-column width="140" prop="guidanceTitle"> <el-table-column
</el-table-column> width="140"
<el-table-column prop="guidanceValue"> prop="attr_name_two"
<template slot-scope="scope"> ></el-table-column>
<auto-hide-message <el-table-column prop="value_two">
:data="scope.row.guidanceValue" <template slot-scope="scope">
:maxLength="100" <el-image
/></template> v-if="scope.row.value_two"
</el-table-column> title="点击大图预览"
</el-table> fit="contain"
</div> style="width: auto; height: 80px"
<!-- 其他信息 --> :src="`${window.location.origin}${medicalReportPathArray[1]}`"
<div style="height: 390px; overflow: auto"> :preview-src-list="[
<div `${window.location.origin}${medicalReportPathArray[1]}`,
v-for="(item, index) in dataList.slice(1, 10)" ]"
style="margin-bottom: 50px" />
:key="index" </template>
> </el-table-column>
<div> <el-table-column
<p class="p_title_1" style="margin-top: 5px"> width="140"
{{ titleArray[index + 1] }} prop="attr_name_three"
</p> ></el-table-column>
<table-detail-message <el-table-column prop="value_three">
:data="item" <template slot-scope="scope">
v-if="index != dataList.length - 2" <el-image
></table-detail-message> v-if="scope.row.value_two"
<el-table title="点击大图预览"
:show-header="false" fit="contain"
v-if="index == dataList.length - 2" style="width: auto; height: 80px"
:data="item" :src="`${window.location.origin}${medicalReportPathArray[3]}`"
border :preview-src-list="[
:cell-style="columnStyle" `${window.location.origin}${medicalReportPathArray[3]}`,
style="width: 100%" ]"
> />
<el-table-column width="140" prop="attr_name_one"> </template>
</el-table-column> </el-table-column>
<el-table-column prop="value_one"> </el-table>
<template slot-scope="scope">
<!-- <auto-hide-message
:data="
scope.row.value_one == null
? ''
: scope.row.value_one + ''
"
:maxLength="20"
/> -->
<el-button
type="text"
v-show="scope.row.value_one"
@click="downloadFile(medicalReportPathArray[0])"
>查看</el-button
>
</template>
</el-table-column>
<el-table-column
width="140"
prop="attr_name_two"
></el-table-column>
<el-table-column prop="value_two">
<template slot-scope="scope">
<!-- <auto-hide-message
:data="
scope.row.value_two == null
? ''
: scope.row.value_two + ''
"
:maxLength="20"
/> -->
<el-button
type="text"
v-show="scope.row.value_two"
@click="downloadFile(medicalReportPathArray[1])"
>查看</el-button
>
</template>
</el-table-column>
<el-table-column
width="140"
prop="attr_name_three"
></el-table-column>
<el-table-column prop="value_three">
<template slot-scope="scope">
<!-- <auto-hide-message
:data="
scope.row.value_three == null
? ''
: scope.row.value_three + ''
"
:maxLength="20"
/> -->
<el-button
type="text"
v-show="scope.row.value_three"
@click="downloadFile(medicalReportPathArray[2])"
>查看</el-button
>
</template>
</el-table-column>
</el-table>
</div>
</div>
</div>
</div>
<!-- 客户体征 -->
<div v-else>
<table-detail-message
v-show="dataList.length > 0"
:data="dataList"
></table-detail-message>
<div
v-show="dataList.length == 0"
style="font-size: 20px; text-align: center"
>
<VueQr :text="copyValue" :logoSrc="logo" :size="256" />
<div style="text-align: center; margin-top: 20px">
<el-button
icon="el-icon-share"
size="small"
title="点击复制链接"
class="copyBtn"
type="primary"
:data-clipboard-text="copyValue"
@click="handleCopy()"
>健康评估表链接
</el-button>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div style="width: 200px" v-show="guidanceShow"> <!-- 客户体征 -->
<!-- 编辑减脂指导 --> <div v-else>
<physicalSigns-guidance <table-detail-message
ref="physicalSignsGuidanceDialog" v-show="dataList.length > 0"
@close="editGuidanceShow(false)" :data="dataList"
@refreshHealthyData="getCustomerHealthyByCusId()" ></table-detail-message>
></physicalSigns-guidance> <div
v-show="dataList.length == 0"
style="font-size: 20px; text-align: center"
>
<VueQr :text="copyValue" :logoSrc="logo" :size="256" />
<div style="text-align: center; margin-top: 20px">
<el-button
icon="el-icon-share"
size="small"
title="点击复制链接"
class="copyBtn"
type="primary"
:data-clipboard-text="copyValue"
@click="handleCopy()"
>健康评估表链接
</el-button>
</div>
</div>
</div> </div>
</div> </div>
<!-- 编辑 --> <div style="width: 200px" v-show="guidanceShow">
<physicalSigns-edit <!-- 编辑减脂指导 -->
ref="physicalSignsEditDialog" <physicalSigns-guidance
@refreshHealthyData="getCustomerHealthyByCusId()" ref="physicalSignsGuidanceDialog"
></physicalSigns-edit> @close="editGuidanceShow(false)"
<!-- 编辑备注 --> @refreshHealthyData="getCustomerHealthyByCusId()"
<physicalSigns-remark ></physicalSigns-guidance>
ref="physicalSignsRemarkDialog"
@refreshHealthyData="getCustomerHealthyByCusId()"
></physicalSigns-remark>
</el-dialog>
<!-- 预览弹窗 -->
<el-dialog
:visible.sync="previewVisible"
title="体检报告"
class="preview_dialog_wrapper"
>
<div class="preview_content">
<img :src="previewUrl" alt="" class="preview_img" />
</div> </div>
</el-dialog> </div>
</div> <!-- 编辑 -->
<physicalSigns-edit
ref="physicalSignsEditDialog"
@refreshHealthyData="getCustomerHealthyByCusId()"
></physicalSigns-edit>
<!-- 编辑备注 -->
<physicalSigns-remark
ref="physicalSignsRemarkDialog"
@refreshHealthyData="getCustomerHealthyByCusId()"
></physicalSigns-remark>
</el-dialog>
</template> </template>
<script> <script>
import { import {
@ -282,8 +257,6 @@ export default {
data() { data() {
return { return {
logo, logo,
previewVisible: false,
previewUrl: "",
visible: false, visible: false,
showFlag: false, showFlag: false,
title: "", title: "",
@ -796,8 +769,8 @@ export default {
}, },
downloadFile(fileName) { downloadFile(fileName) {
// this.downloadResource(fileName); // this.downloadResource(fileName);
this.previewVisible = true; // this.previewVisible = true;
this.previewUrl = `${window.location.origin}${fileName}`; // this.previewUrl = `${window.location.origin}${fileName}`;
}, },
generateReport() { generateReport() {
let data = this.detailHealthy; let data = this.detailHealthy;