This commit is contained in:
hzz 2024-06-29 14:56:56 +08:00
parent 63dfccac8a
commit 83b45364c1
4 changed files with 705 additions and 16 deletions

View File

@ -0,0 +1,28 @@
<template>
<div>
<pdf
:src="pdfUrl"
></pdf>
</div>
</template>
<script>
import pdf from 'vue-pdf'
export default {
components: {
pdf
},
data() {
return {
//pdfSrc: 'path/to/your/pdf/file.pdf'
}
},
props: {
pdfUrl: {
type: String,
required: true
}
}
}
</script>

View File

@ -0,0 +1,554 @@
<!--
* @FilePath: \code\gitscreenFront\src\components\headerBox\header2.vue
* @Author: 王路平
* @文件版本: V1.0.0
* @Date: 2023-02-16 11:04:06
* @Description:
*
* 版权信息 : 2023 by ${再登软件}, All Rights Reserved.
-->
<template>
<div class="header2" :style="{ width: props.width, height: props.height }">
<h1 :class="langJudge() == '简体中文' ? 'zh-title' : 'en-title'">
{{ props.title }}
</h1>
<div class="slot">
<div class="tip" style="display: flex">
<span class="tipspan" v-for="item in props.titleTip">
<div class="colortip" :style="{ backgroundColor: item.color }"></div>
<span class="tipstring">{{ item.name }}</span></span
>
<slot></slot>
</div>
<div v-show="typeObj.comback" class="comeBack" @click="comeBackFun">
<i class="iconfont icon-back"></i>
</div>
<div
v-show="typeObj.AbnormalData"
ref="AbnormalDataRef"
class="AbnormalData"
@click="AbnormalDataFun"
>
<dv-scroll-board
class="dv-scroll-boardclass"
ref="tipList"
:config="listdata"
style="width: 30rem; height: 50px"
/>
<el-badge
:value="AbnormalNum"
class="i-badge"
:hidden="AbnormalNum == 0"
>
<i
:class="
AbnormalNum > 0
? 'iconfont icon-baojingxinxi Abnormal-icon-yellow'
: 'iconfont icon-baojingxinxi'
"
></i>
</el-badge>
</div>
<div v-show="typeObj.time" class="time">
<p ref="Timedom">{{ timeHtml }}</p>
</div>
</div>
<el-popover
ref="popoverRef"
:virtual-ref="AbnormalDataRef"
:visible="Abnormalpopovervisible"
trigger="click"
width="600px"
placement="bottom-start"
virtual-triggering
>
<ul
class="popoverBOX"
ref="popoverliDom"
v-click-outside="noClickAbnormalDataFun"
>
<li class="popoverHeader">
<!-- <span><i class="iconfont icon-lishijilu lishijilu"></i>历史记录</span> -->
</li>
<li v-for="item in powerlist" :key="item.deviceId">
{{ item.context }}
</li>
<li class="lookdown" v-show="onloadlist">
<span @click="clickNextPageAlarmList">{{
t("messages.加载更多")
}}</span>
</li>
</ul>
</el-popover>
</div>
</template>
<script setup lang="ts">
import useNowTime from "@/hook/nowTime";
import { ClickOutside as vClickOutside } from "element-plus";
import { useRoute, useRouter } from "vue-router";
import { devListType } from "@/type/InPlantProducts";
import { getAlarmListData,getAlarmListHistoryData } from "@/http/index";
import {
onMounted,
onUnmounted,
reactive,
ref,
unref,
watch,
computed,
} from "vue";
import { connectWebsocket, closeWebsocket } from "@/utils/websocket";
import { useHeaderStore } from "@/store/components/header";
import { getStoredLanguage } from "@/utils/languageStorage";
import { useI18n } from "vue-i18n";
import { Clock } from "@element-plus/icons-vue";
let { t } = useI18n();
const storeheader = useHeaderStore();
let { timeHtml } = useNowTime();
const router = useRouter();
//
let numkey = ref(0);
let popoverkey = ref(0);
//dom
let AbnormalDataRef = ref();
let popoverRef = ref();
let tipList = ref();
let popoverliDom = ref();
//
let Abnormalpopovervisible = ref(false);
let AbnormalpopovervisibleCtrl = ref(false); //
//dialog
let dialogdata = ref([]);
let onloadlist = computed(() => {
return storeheader.num > powerlist.length;
});
const listdata = reactive<devListType>({
data: [],
rowNum: 2,
oddRowBGC: "#100C2A",
evenRowBGC: "#100C2A",
hoverPause: true,
carousel: "page",
waitTime: 3000,
align: ["left"],
});
let AbnormalNum = ref(0);
//
let powerlist = reactive([]);
let props = defineProps<{
width: string;
height: string;
title: string;
titleTip: any;
typeFun: any[];
alarmType: any[];
}>();
const typeObj = reactive({
comback: false,
AbnormalData: false,
time: false,
});
const AbnormalType = reactive({
pageSize: 5,
pageNum: 1,
type: "",
});
let comeBackFun = () => {
router.go(-1);
};
const changeAbnormalData = (val: any) => {
tipList.value.updateRows(val.data, { ...val });
};
let AbnormalDataFun = () => {
//noClickAbnormalDataFun
//Abnormalpopovervisibled
//
if (Abnormalpopovervisible.value) {
Abnormalpopovervisible.value = false;
} else {
//
if (AbnormalpopovervisibleCtrl.value) {
Abnormalpopovervisible.value = false;
} else {
Abnormalpopovervisible.value = true;
}
}
};
let noClickAbnormalDataFun = () => {
//AbnormalDataFun
// ctrltruefalse
if (Abnormalpopovervisible.value) {
AbnormalpopovervisibleCtrl.value = true;
} else {
AbnormalpopovervisibleCtrl.value = false;
}
Abnormalpopovervisible.value ? (Abnormalpopovervisible.value = false) : "";
};
function typeStatus() {
if (props.typeFun.length == 0) {
return;
}
props.typeFun.forEach((res) => {
for (let key in typeObj) {
if (res == key) {
typeObj[key] = true;
}
}
});
}
function langJudge() {
let lang = getStoredLanguage();
if (lang) {
return lang;
} else {
return "简体中文";
}
}
//
watch(
() => typeObj,
(newVal, oldVal) => {
if (newVal.AbnormalData) {
AbnormalType.type = props.alarmType.join(",");
getAlarmListDatafun();
// connectWebsocket(null, null, getWebsocket, errWebsocket);
setAlarmscrollBoardList();
}
},
{ deep: true, flush: "post" }
);
//
async function getAlarmListDatafun() {
let result: any = await getAlarmListData(AbnormalType);
if (result.code == 200) {
storeheader.setDataList(result);
}
}
//
function clickNextPageAlarmList() {
// if(storeheader.num<=powerlist.length){
// onloadlist.value=false
// return
// }
AbnormalType.pageNum++;
getAlarmListDatafun();
}
//
watch(
() => storeheader.AlarmpopoverList,
(newVal, oldVal) => {
newVal.forEach((res) => {
powerlist.push(res);
});
},
{ deep: true, flush: "post" }
);
//
watch(
() => storeheader.AlarmscrollBoardList,
(newVal, oldVal) => {
// newVal.forEach(res=>{
// let e=res.context.split('')
// listdata.data.push([e[0]])
// listdata.data.push([e[1]])
// })
// changeAbnormalData(listdata)
// numkey.value++
},
{ deep: true, flush: "post" }
);
let AlarmscrollTime = null;
//15
function setAlarmscrollBoardList() {
let start = 0;
let end = 4;
let i = 0;
setTimeout(() => {
storeheader.AlarmscrollBoardList.slice(0, 5).forEach((element) => {
let e = element.context.split("");
listdata.data.push(...[[e[0]], [e[1]]]);
i++;
});
end = end + 5;
start = i >= 5 ? 5 : storeheader.AlarmscrollBoardList.length - 1;
start <= 0 ? (start = 0) : "";
}, 1000);
AlarmscrollTime = setInterval(() => {
if (i == 0) {
listdata.data = [];
}
i = 0;
if (storeheader.AlarmscrollBoardList.length == 0) {
return;
}
if (storeheader.AlarmscrollBoardList.length - 1 < end) {
end = storeheader.AlarmscrollBoardList.length - 1;
}
for (start; start <= end; start++) {
// console.log(storeheader.AlarmscrollBoardList[start],start,end);
// console.log(storeheader.AlarmscrollBoardList.length-1);
let listcontent =
storeheader.AlarmscrollBoardList[start]?.context.split("");
listdata.data.push(...[[listcontent[0]], [listcontent[1]]]);
}
changeAbnormalData(listdata);
numkey.value++;
end = end + 5;
//
if (start == storeheader.AlarmscrollBoardList.length - 1) {
// console.log('2');
start = storeheader.AlarmscrollBoardList.length - 1;
end = storeheader.AlarmscrollBoardList.length - 1;
}
//5
if (
end > storeheader.AlarmscrollBoardList.length - 1 &&
start <= storeheader.AlarmscrollBoardList.length - 1
) {
// console.log('3');
end = storeheader.AlarmscrollBoardList.length - 1;
}
//
if (
start > storeheader.AlarmscrollBoardList.length - 1 &&
end > storeheader.AlarmscrollBoardList.length - 1
) {
// console.log('4',start,end,storeheader.AlarmscrollBoardList.length-1,storeheader.AlarmscrollBoardList);
start = 0;
end = 4;
}
}, 15000);
}
//
watch(
() => storeheader.num,
(newVal, oldVal) => {
AbnormalNum.value = newVal;
numkey.value++;
},
{ deep: true, flush: "post" }
);
function HeadergetWebsocket(val) {
let data = null;
try {
data = JSON.parse(val);
} catch (e) {
console.log(e);
return;
}
if (
props.alarmType.some((e) => {
return e == data.type;
})
) {
// console.log(props.alarmType);
// console.log(props.alarmType.some(e=>{return e==data.type}));
storeheader.changeDataList(data);
}
}
function HeadererrWebsocket(val) {
// console.log(val);
}
onMounted(() => {
//
typeStatus();
});
onUnmounted(() => {
// closeWebsocket();
storeheader.resetData();
AlarmscrollTime ? clearInterval(AlarmscrollTime) : "";
});
defineExpose({
changeAbnormalData,
HeadergetWebsocket,
HeadererrWebsocket,
});
</script>
<style scoped>
@import "@/assets/css/iconfont.css";
.header2 {
width: 100%;
background-image: url(@/assets/header/header1.png);
background-size: 100% 100%;
position: relative;
display: flex;
align-items: center;
justify-content: center;
}
.header2-title {
display: flex;
align-items: center;
justify-content: center;
position: relative;
/* height: 100%; */
width: 100%;
}
h1 {
position: absolute;
top: 10px;
z-index: 2;
}
.zh-title {
margin-top: 6px;
font-size: 3rem;
}
.en-title {
font-size: 2rem;
max-width: 600px;
height: 80px;
display: flex;
align-items: center;
overflow: hidden;
/* line-height: 80px; */
}
/* .header2 p {
position: absolute;
right: 50px;
bottom: 20px;
font-size: 20px;
} */
.slot {
display: flex;
justify-content: center;
align-items: center;
padding: 50px 10px 10px 10px;
}
/* .red {
background-color: rgb(228, 57, 97);
}
.blue {
background-color: rgb(32, 174, 197);
} */
.colortip {
width: 16px;
height: 16px;
border-radius: 8px;
}
.tipstring {
font-size: 20px;
color: #fff;
}
.tip {
margin-top: 15px;
}
.tipspan {
display: flex;
margin-left: 10px;
align-items: center;
}
.comeBack {
position: absolute;
/* width: 2rem;
height: 2rem; */
bottom: 10%;
left: 1.5rem;
font-size: 3rem;
color: #fff;
cursor: pointer;
}
.comeBack > i {
font-size: 3rem;
}
.AbnormalData {
position: absolute;
display: flex;
align-items: center;
/* width: 2rem;
height: 2rem; */
bottom: 20%;
right: 1%;
font-size: 3rem;
color: #fff;
}
.AbnormalData:hover {
cursor: pointer;
}
.AbnormalData > span {
font-size: 1rem;
}
.popoverBOX {
max-height: 15rem;
font-size: 18px;
overflow-y: auto;
}
.popoverBOX li {
padding: 10px 0 10px 0;
}
.lookdown {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
color: #1c78c2;
}
.lookdown:hover {
cursor: pointer;
}
.time {
position: absolute;
width: 20rem;
height: 2rem;
bottom: 30%;
left: 4.2rem;
font-size: 25px;
}
.i-badge {
width: 3rem;
height: 3rem;
}
.i-badge > i {
font-size: 3rem;
position: relative;
top: -5px;
}
/* .dv-scroll-board /deep/ .ceil {
font-size: 1.2rem;
} */
.dv-scroll-boardclass :deep(.ceil) {
font-size: 20px;
}
.el-popper.is-dark:deep() {
background: #14274b !important;
}
.el-popover.el-popper:deep() {
background: #14274b !important;
}
.Abnormal-icon-yellow {
color: #ddb14f;
}
.lishijilu {
font-size: 2rem;
color: #fff;
}
.popoverHeader {
padding: 0 !important;
display: flex;
justify-content: flex-end;
align-items: center;
line-height: 1.5rem;
}
.popoverHeader span {
display: flex;
justify-content: center;
align-items: center;
padding: 5px;
/* border-radius: 50px;
background: linear-gradient(315deg, #404040, #4c4c4c); */
/* box-shadow: -20px -20px 60px #3c3c3c, 20px 20px 60px #525252; */
}
</style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

View File

@ -1,26 +1,51 @@
<template>
<div class="container">
<div>
<div > <!-- 按钮 -->
<!-- <button @click="recOpen">打开录音,请求权限</button> -->
| <el-button type="success" size="large" @click="recOpen">开始录音</el-button>
<el-button type="warning" size="large" @click="recStop">结束录音</el-button>
| <el-button type="primary" size="large" @click="recPlay">本地试听</el-button>
</div>
<div style="padding-top:5px"> <!-- 波形绘制区域 -->
<div style="border:1px solid #ccc;display:inline-block;vertical-align:bottom">
<div style="height:300px;width:600px;" ref="recwave"></div>
<div class="header">
<div class="title">
<header2 ref="headerref" :width="'100%'" :height="'100px'" :title="'游标卡尺物联'" :titleTip="[]"
:typeFun="['time']" :alarmType="[]"></header2>
</div>
</div>
<div class="body-container">
<div class="left-container">
<div class="lt-box">
<el-image :src="workpiece" :preview-src-list="[workpiece]" style="max-width: 100%;height: 500px;"
fit="contain" />
零件图片
</div>
<div class="lb-box">
<!-- <el-image :src="drawing" :preview-src-list="[drawing]" style="max-width: 100%;height: 500px;" fit="contain" /> -->
<!-- <showPdf pdfUrl="./image/drawing.pdf" /> -->
<a style="color: #fff;" href="http://8.130.165.100:9015/profile/upload/2024/06/29/drawing_20240629103947A010.pdf" target="_blank">查看图纸</a>
</div>
</div>
<div class="right-container">
<div class="input-text">
<div class="" :style="{ width: '150px' }">关键尺寸:</div>
<div class="text">
<el-input v-model="text" input-style="font-size:20px;color:#fff;box-shadow:'0 0 0 1px #fff'" :rows="5" type="textarea" readonly />
</div>
</div>
<div style="padding-top:5px;margin-bottom: 10px;"> <!-- 波形绘制区域 -->
<div style="display:inline-block;vertical-align:bottom">
<div style="height:300px;width:600px;" ref="recwave"></div>
</div>
</div>
<div> <!-- 按钮 -->
<!-- <button @click="recOpen">打开录音,请求权限</button> -->
<el-button type="success" size="large" class="btn-class" @mousedown="recOpen"
@mouseup="recStop">按住录音</el-button>
<!-- | <el-button type="primary" size="large" @click="recPlay">本地试听</el-button> -->
</div>
<div class="text">{{ text }}</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { ref, onMounted, onUnmounted } from 'vue'
import header2 from "./components/header2.vue";
//
import Recorder from 'recorder-core'
@ -34,12 +59,17 @@ import 'recorder-core/src/engine/wav'
import 'recorder-core/src/extensions/waveview'
import { postwavUpload } from '@/http/Recorder'
import { upload as fileUpload } from '@/http/index'
// import { el } from 'element-plus/es/locale'
let rec: any = null;
let wave: any = null;
let recwave = ref(null);
let recBlob: any = null
let text = ref('')
let workpiece = require('./image/workpiece.jpg')
// let drawing = require('./image/drawing.png')
//
function recOpen() {
//
@ -166,21 +196,98 @@ function recPlay() {
//revokeObjectURL
setTimeout(function () { URL.revokeObjectURL(audio.src) }, 5000);
}
onMounted(() => {
// recOpen()
document.getElementById('app').style.background = '#fff'
})
onUnmounted(() => {
document.getElementById('app').style.background = 'block'
})
</script>
<style scoped>
.container {
width: 1920px;
height: 1080px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
background-color: #fff;
font-size: 28px;
color: #FFFFFF;
background: url('./../../assets/img/bg.jpg') no-repeat center center / 100% 100%;
background-color: #0E0E0E;
}
.header {
height: 100px;
width: 1920px;
}
.body-container {
width: 1920px;
height: 980px;
display: flex;
justify-content: center;
align-items: center;
}
.left-container {
width: 800px;
height: 100%;
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
}
.left-container .lt-box {
width: 100%;
height: 600px;
/* border: 1px solid #ccc; */
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.left-container .lb-box {
width: 100%;
height: 600px;
/* border: 1px solid #ccc; */
margin-top: 15px;
color: #fff;
display: flex;
justify-content: center;
align-items: center;
}
.right-container {
width: 800px;
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.text {
width: 100%;
margin-top: 15px;
text-align: center;
}
</style>
.btn-class {
width: 200px;
height: 100px;
font-size: 24px;
font-weight: 700;
border-radius: 20px;
}
.input-text {
width: 600px;
display: flex;
justify-content: center;
align-items: center;
}
</style>