|
|
@@ -67,6 +67,8 @@
|
|
|
ref="editData"
|
|
|
@onClose="onClose"
|
|
|
@onRunMcuSingle="onRunMcuSingle"
|
|
|
+ @onReady="onEditRowReady"
|
|
|
+ @onPointChange="switchPreviewPoint"
|
|
|
:addRowData="addRowData"
|
|
|
:disablePointConfig="!isSetting"
|
|
|
/>
|
|
|
@@ -95,11 +97,11 @@ import configInfo from '@/stores/modules/config';
|
|
|
const configInfoStore = configInfo();
|
|
|
|
|
|
const confirm = ()=>{
|
|
|
- hideVideo()
|
|
|
+ hideVideo(currentPointName.value)
|
|
|
emit('confirm')
|
|
|
}
|
|
|
const onClose = ()=>{
|
|
|
- hideVideo()
|
|
|
+ hideVideo(currentPointName.value)
|
|
|
emit('onClose')
|
|
|
}
|
|
|
// 定义 props
|
|
|
@@ -150,11 +152,15 @@ async function checkConfirm(init){
|
|
|
}
|
|
|
if(!init) previewKey.value++;
|
|
|
|
|
|
- showVideo()
|
|
|
showrEditRow.value = true
|
|
|
loading.value = false;
|
|
|
}
|
|
|
|
|
|
+// editRow 数据加载完成后调用 showVideo
|
|
|
+function onEditRowReady(point_name) {
|
|
|
+ showVideo(point_name)
|
|
|
+}
|
|
|
+
|
|
|
const init = ref(true)
|
|
|
function onRunMcuSingle (){
|
|
|
if(init.value) {
|
|
|
@@ -168,31 +174,40 @@ const showrEditRow = ref(false)
|
|
|
|
|
|
|
|
|
let interval:any = null
|
|
|
-function showVideo(){
|
|
|
+let currentPointName = ref('A')
|
|
|
|
|
|
- clientStore.ipc.removeAllListeners(icpList.camera.PreviewShow);
|
|
|
+function showVideo(point_name = 'A'){
|
|
|
+ currentPointName.value = point_name
|
|
|
|
|
|
- clientStore.ipc.send(icpList.camera.PreviewShow);
|
|
|
- clientStore.ipc.on(icpList.camera.PreviewShow, async (event, result) => {
|
|
|
+ clientStore.ipc.removeAllListeners(icpList.camera.PreviewShow);
|
|
|
|
|
|
- setTimeout(()=>{
|
|
|
- interval = setInterval(()=>{
|
|
|
- previewKey.value++;
|
|
|
- },200)
|
|
|
- },500)
|
|
|
+ clientStore.ipc.send(icpList.camera.PreviewShow, { point_name });
|
|
|
+ clientStore.ipc.on(icpList.camera.PreviewShow, async (event, result) => {
|
|
|
|
|
|
- })
|
|
|
+ setTimeout(()=>{
|
|
|
+ interval = setInterval(()=>{
|
|
|
+ previewKey.value++;
|
|
|
+ },200)
|
|
|
+ },500)
|
|
|
|
|
|
-}
|
|
|
+ })
|
|
|
|
|
|
-function hideVideo(){
|
|
|
+}
|
|
|
|
|
|
+function hideVideo(point_name = 'A'){
|
|
|
+ return new Promise((resolve) => {
|
|
|
clientStore.ipc.removeAllListeners(icpList.camera.PreviewHide);
|
|
|
- clientStore.ipc.send(icpList.camera.PreviewHide);
|
|
|
+ clientStore.ipc.send(icpList.camera.PreviewHide, { point_name });
|
|
|
clientStore.ipc.on(icpList.camera.PreviewHide, async (event, result) => {
|
|
|
if(interval) clearInterval(interval)
|
|
|
+ resolve(true)
|
|
|
})
|
|
|
+ })
|
|
|
+}
|
|
|
|
|
|
+async function switchPreviewPoint(point_name = 'A') {
|
|
|
+ await hideVideo(currentPointName.value)
|
|
|
+ showVideo(point_name)
|
|
|
}
|
|
|
|
|
|
function goArts(){
|
|
|
@@ -209,7 +224,7 @@ function takePictures() {
|
|
|
if (clientStore.isClient) {
|
|
|
|
|
|
loading.value = true;
|
|
|
- hideVideo()
|
|
|
+ hideVideo(currentPointName.value)
|
|
|
socketStore.sendMessage({
|
|
|
type: 'run_mcu_single',
|
|
|
data: {
|
|
|
@@ -246,12 +261,12 @@ function createMainImage (file_path){
|
|
|
clientStore.ipc.on(icpList.takePhoto.createMainImage, async (event, result) => {
|
|
|
if(result.code === 0 && result.data?.main_out_path){
|
|
|
imageTplPath.value = result.data?.main_out_path
|
|
|
- hideVideo()
|
|
|
+ hideVideo(currentPointName.value)
|
|
|
step.value = 2
|
|
|
loading.value = false;
|
|
|
}else if(result.msg){
|
|
|
loading.value = false;
|
|
|
- showVideo()
|
|
|
+ showVideo(currentPointName.value)
|
|
|
if(result.code !== 0) ElMessage.error(result.msg)
|
|
|
}
|
|
|
clientStore.ipc.removeAllListeners(icpList.takePhoto.createMainImage);
|
|
|
@@ -267,12 +282,12 @@ clientStore.ipc.on(icpList.socket.message+'_smart_shooter_photo_take', async (ev
|
|
|
console.log(result);
|
|
|
if(result.code === 0 && result.data?.photo_file_name){
|
|
|
imageTplPath.value = result.data?.photo_file_name
|
|
|
- hideVideo()
|
|
|
+ hideVideo(currentPointName.value)
|
|
|
step.value = 2
|
|
|
loading.value = false;
|
|
|
}else {
|
|
|
loading.value = false;
|
|
|
- showVideo()
|
|
|
+ showVideo(currentPointName.value)
|
|
|
if(result.code !== 0 && result.msg) ElMessage.error(result.msg)
|
|
|
}
|
|
|
|
|
|
@@ -286,12 +301,12 @@ clientStore.ipc.on(icpList.socket.message+'_run_mcu_single', async (event, resul
|
|
|
|
|
|
if(result.code === 0 && result.data?.file_path){
|
|
|
imageTplPath.value = result.data?.file_path
|
|
|
- hideVideo()
|
|
|
+ hideVideo(currentPointName.value)
|
|
|
step.value = 2
|
|
|
loading.value = false;
|
|
|
}else {
|
|
|
loading.value = false;
|
|
|
- showVideo()
|
|
|
+ showVideo(currentPointName.value)
|
|
|
if(result.code !== 0 && result.msg) ElMessage.error(result.msg)
|
|
|
}
|
|
|
|
|
|
@@ -326,7 +341,7 @@ onMounted(async ()=>{
|
|
|
* 页面卸载时移除所有事件监听器。
|
|
|
*/
|
|
|
onBeforeUnmount(() => {
|
|
|
- hideVideo()
|
|
|
+ hideVideo(currentPointName.value)
|
|
|
clientStore.ipc.removeAllListeners(icpList.camera.takePictures);
|
|
|
clientStore.ipc.removeAllListeners(icpList.camera.PreviewHide);
|
|
|
clientStore.ipc.removeAllListeners(icpList.camera.PreviewShow);
|