Commit e78a2c89 authored by 李苏's avatar 李苏 💬

pdf 64转2进制转blob url / 样式/相机溯源逻辑等等等

parent 999317f7
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<div style="padding: 10px;"> <div style="padding: 10px;">
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="19" class="padding-10 flex-center" > <el-col :span="19" class="padding-10 flex-center" >
<el-input v-model="dqjd" placeholder="请输入查询节点"> <el-input :focus="true" v-model="dqjd" placeholder="请输入查询节点">
</el-input> </el-input>
</el-col> </el-col>
<el-col :span="2"> <el-col :span="2">
......
...@@ -167,7 +167,7 @@ ...@@ -167,7 +167,7 @@
save() { save() {
const ctx = this.$refs.basePage const ctx = this.$refs.basePage
if (ctx.singleItem && ctx.singleItem.id) { if (ctx.singleItem && ctx.singleItem.id) {
this.$emit('getYwxx', ctx.singleItem) this.$emit('getCz', ctx.singleItem)
this.app.showDialog = false this.app.showDialog = false
} else { } else {
this.$warning('请选中一条数据') this.$warning('请选中一条数据')
......
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
* @Description: * @Description:
* @Author: lisu lisu@gavelinfo.com * @Author: lisu lisu@gavelinfo.com
* @LastEditors: lisu lisu@gavelinfo.com * @LastEditors: lisu lisu@gavelinfo.com
* @LastEditTime: 2024-09-25 18:00:01 * @LastEditTime: 2024-09-26 15:41:14
* @FilePath: /zghywpc-vue/src/views/yhlywsytst/yhlywsytst/index.vue * @FilePath: /zghywpc-vue/src/views/yhlywsytst/yhlywsytst/index.vue
--> -->
<template> <template>
<div v-loading='loading' :element-loading-text='loadingText' element-loading-spinner="el-icon-loading" <div v-loading='loading' :element-loading-text='loadingText' element-loading-spinner="el-icon-loading"
element-loading-background="rgba(0, 0, 0, 0.8)" ref="app" class="min_full nullbp"> element-loading-background="rgba(0, 0, 0, 0.8)" ref="app" class="min_full nullbp">
<!-- 弹框组件dialig --> <!-- 弹框组件dialig -->
<ywDialog @getYwxx='getYwxx' :app='this' v-if='showDialog' /> <czDialog @getCz='getCz' :app='this' v-if='showDialog' />
<div class="bigTitle"> <div class="bigTitle">
一回路异物溯源态势图 一回路异物溯源态势图
</div> </div>
...@@ -279,11 +279,12 @@ ...@@ -279,11 +279,12 @@
<span>溯源排查</span> <span>溯源排查</span>
<b class="data-title-right">]</b> <b class="data-title-right">]</b>
</div> </div>
<div class="full " style="height: calc(100% - 14px);padding-top: 12px;padding-left: 25px;"> <div class="full " style="height: calc(100% - 14px);padding-top: 12px;padding-left: 10px;">
<el-row :gutter="20" class="search-row-1" style="width: 100%;"> <el-row :gutter="20" class="search-row-1" style="width: 100%;">
<el-col :span="3" class="search-col"> <el-col :span="3" class="search-col">
<div class="search-item"> <div class="search-item">
<span class="search-span"><span style="color: rgb(255, 73, 73); margin-right: 4px;">*</span>功能位置:</span> <span class="search-span"><span
style="color: rgb(255, 73, 73); margin-right: 4px;position: absolute;left: 11px;">*</span>功能位置:</span>
<el-input v-model="sypcQueryParams.gnwz"></el-input> <el-input v-model="sypcQueryParams.gnwz"></el-input>
</div> </div>
</el-col> </el-col>
...@@ -313,7 +314,9 @@ ...@@ -313,7 +314,9 @@
<el-col :span="3" class="search-col"> <el-col :span="3" class="search-col">
<div class="search-item"> <div class="search-item">
<span class="search-span">材质:</span> <span class="search-span">材质:</span>
<el-input v-model="sypcQueryParams.cz"></el-input> <!-- <el-input v-model="sypcQueryParams.cz"></el-input> -->
<AuxInput :overlayClick='czOverlayClick' :onlyInput='true' />
</div> </div>
</el-col> </el-col>
<el-col :span="3" class="search-col flex-center"> <el-col :span="3" class="search-col flex-center">
...@@ -323,20 +326,32 @@ ...@@ -323,20 +326,32 @@
:match="{value:'id',label:'name'}" v-model='sypcQueryParams.ldtx'></RelSelect> :match="{value:'id',label:'name'}" v-model='sypcQueryParams.ldtx'></RelSelect>
</div> </div>
</el-col> </el-col>
<el-col :span="3" class="search-col flex-center">
<div class="search-item">
<span class="search-span">机组状态:</span>
<RelSelect placeholder='' style="width: 100%;" src='ywxxgl/uywxx/init/zt ' filterable clearable
:match="{value:'id',label:'name'}" v-model='sypcQueryParams.ldtx'></RelSelect>
</div>
</el-col>
<!-- <el-col :span="2" class="search-col flex-center"> <!-- <el-col :span="2" class="search-col flex-center">
</el-col> --> </el-col> -->
<el-col :span="2" class="search-col flex-center" style="padding-left: 20px;"> <el-col :span="3" class="search-col flex-center" style="padding-left: 20px;">
<el-button style="background-color: rgba(7,32,96,0.0);border: 1px solid #68D8FE; color: #68D8FE;"
size="mini" @click="sypc()" type="primary">排查</el-button>
<el-button style="background-color: rgba(7,32,96,0.0);border: 1px solid #68D8FE; color: #68D8FE;" <el-button style="background-color: rgba(7,32,96,0.0);border: 1px solid #68D8FE; color: #68D8FE;"
size="mini" @click="sypc()" type="primary">溯源排查</el-button> size="mini" @click="czmx()" type="primary">重置</el-button>
<el-button @click="savePdf()"
style="background-color: rgba(7,32,96,0.0);border: 1px solid #68D8FE; color: #68D8FE;" size="mini"
type="primary">日志</el-button>
</el-col> </el-col>
<el-col :span="2" class="search-col flex-center" style="padding-left: 20px;"> <!-- <el-col :span="2" class="search-col flex-center" style="padding-left: 20px;">
<el-button style="background-color: rgba(7,32,96,0.0);border: 1px solid #68D8FE; color: #68D8FE;" <el-button style="background-color: rgba(7,32,96,0.0);border: 1px solid #68D8FE; color: #68D8FE;"
size="mini" @click="czmx()" type="primary">重置模型</el-button> size="mini" @click="czmx()" type="primary">重置</el-button>
</el-col> </el-col>
<el-col :span="2" class="search-col flex-center" style="padding-left: 20px;"> <el-col :span="2" class="search-col flex-center" style="padding-left: 20px;">
<el-button @click="savePdf()" style="background-color: rgba(7,32,96,0.0);border: 1px solid #68D8FE; color: #68D8FE;" <el-button @click="savePdf()" style="background-color: rgba(7,32,96,0.0);border: 1px solid #68D8FE; color: #68D8FE;"
size="mini" type="primary">溯源日志</el-button> size="mini" type="primary">日志</el-button>
</el-col> </el-col> -->
...@@ -478,7 +493,7 @@ ...@@ -478,7 +493,7 @@
</template> </template>
<script> <script>
import ywDialog from './ywDialog.vue' import czDialog from './czDialog.vue'
import * as THREE from 'three' import * as THREE from 'three'
import gsap from 'gsap' import gsap from 'gsap'
import ksh33 from './static/ksh33.png' import ksh33 from './static/ksh33.png'
...@@ -497,7 +512,7 @@ ...@@ -497,7 +512,7 @@
}, },
components: { components: {
ywDialog czDialog
}, },
computed: { computed: {
optionSingleHeight() { optionSingleHeight() {
...@@ -512,15 +527,19 @@ ...@@ -512,15 +527,19 @@
}, },
data() { data() {
return { return {
/* 材质辅助输入*/
cztypeConfig:{
},
/* pdf-*/ /* pdf-*/
pdfBytes:'', pdfBytes: '',
mxbshow: false, mxbshow: false,
sblxCode: '', sblxCode: '',
sblxcxwcxdxx: false, sblxcxwcxdxx: false,
sblxcxwcxdxxText: '', sblxcxwcxdxxText: '',
/* 弹框控制参数*/ /* 弹框控制参数*/
showDialog: false, showDialog: false,
DialogTitle: '异物信息', DialogTitle: '材质',
DialogWidth: '65vw', DialogWidth: '65vw',
ywlistData: [], ywlistData: [],
jxlistData: [], jxlistData: [],
...@@ -597,6 +616,12 @@ ...@@ -597,6 +616,12 @@
} }
}, },
methods: { methods: {
getCz(){
},
czOverlayClick(){
this.showDialog=true
},
czmx() { czmx() {
this.viewer.scene.traverse((model) => { this.viewer.scene.traverse((model) => {
if (model.isMesh) { if (model.isMesh) {
...@@ -626,17 +651,43 @@ ...@@ -626,17 +651,43 @@
this.apiJzbm() this.apiJzbm()
}, },
/* 点击按钮弹出异物,然后选中*/ /* 点击按钮弹出异物,然后选中*/
savePdf(){ savePdf() {
if( this.pdfBytes){ if (this.pdfBytes) {
const base64String = this.pdfBytes; const base64String = this.pdfBytes;
const linkSource = `data:application/pdf;base64,${base64String}`; // const linkSource = `data:application/pdf;base64,${base64String}`
const downloadLink = document.createElement('a'); // var linkSource = `data:application/pdf;base64,${base64String}`
const fileName = '排除日志.pdf';
downloadLink.href = linkSource; // 将 Base64 编码的字符串转换为 Blob 对象
downloadLink.download = fileName; function base64ToBlob(base64, contentType) {
downloadLink.click(); var byteCharacters = window.atob(base64);
downloadLink.remove() var byteNumbers = new Array(byteCharacters.length);
}else{ for (var i = 0; i < byteCharacters.length; i++) {
byteNumbers[i] = byteCharacters.charCodeAt(i);
}
var byteArray = new Uint8Array(byteNumbers);
return new Blob([byteArray], {type: contentType});
}
// 创建 Blob 对象并生成 URL
var blob = base64ToBlob(base64String, 'application/pdf');
var url = URL.createObjectURL(blob);
// 设置 <a> 标签的 href 属性
var link = document.createElement('a');
link.href = url;
link.target = '_blank'; // 在新标签页中打开
link.click();
link.remove()
// const downloadLink = document.createElement('a');
// downloadLink.href = linkSource;
// downloadLink.target = '_blank'
// const fileName = '排除日志.pdf';
// downloadLink.download = fileName;
// downloadLink.click();
// downloadLink.remove()
} else {
this.$warning('请溯源后,再保存为排除日志') this.$warning('请溯源后,再保存为排除日志')
} }
}, },
...@@ -658,7 +709,7 @@ ...@@ -658,7 +709,7 @@
// document.body.appendChild(a); // document.body.appendChild(a);
// a.click(); // a.click();
// a.remove() // a.remove()
this.pdfBytes=res.data.records.pdfBytes this.pdfBytes = res.data.records.pdfBytes
/* - /* -
...@@ -725,9 +776,21 @@ ...@@ -725,9 +776,21 @@
this.mxbshow = true this.mxbshow = true
/* 匹配展示数据和本地数据*/ /* 匹配展示数据和本地数据*/
if (this.jzReMaterialQue.length != 0) { if (this.jzReMaterialQue.length != 0) {
this.viewer.cameraControl.fitTo(this.jzReMaterialQue[0].model); let model;
/* 优先选中查询框的设备*/
let sbxxCode=this.sypcQueryParams.gnwz.replace(/\s+/g, '');
this.jzReMaterialQue.forEach(jzitem=>{
if(jzitem.model&&jzitem.model.name&&jzitem.model.name==sbxxCode){
model=jzitem.model
}
})
this.viewer.cameraControl.fitTo(model||this.jzReMaterialQue[0].model);
this.sylbshow = true this.sylbshow = true
this.clickTag(this.jzReMaterialQue[0].model.name) /* */
this.clickTag(model.name||this.jzReMaterialQue[0].model.name)
} else { } else {
this.sylbshow = false this.sylbshow = false
} }
...@@ -1598,6 +1661,11 @@ ...@@ -1598,6 +1661,11 @@
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.search-span {
min-width: 60px;
float: right;
}
.nosbxxTitle { .nosbxxTitle {
color: #68D8FE; color: #68D8FE;
font-size: 18px; font-size: 18px;
...@@ -1944,6 +2012,13 @@ ...@@ -1944,6 +2012,13 @@
background-color: rgba(22, 84, 198, 0.7); background-color: rgba(22, 84, 198, 0.7);
} }
button:hover {
background-color: #26c6f0 !important;
color: #fff !important;
}
.el-icon-search{
color: #61d2f7;
}
.lbbody { .lbbody {
height: calc(100% - 4vh); height: calc(100% - 4vh);
overflow: hidden; overflow: hidden;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment