You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

170 lines
4.5 KiB
Vue

3 weeks ago
<template>
<!-- <vueImg /> -->
2 weeks ago
<div class="relative flex-auto w-1/1 h-1/1">
3 weeks ago
<mt-edit
:use-thumbnail="true"
@on-preview-click="onPreviewClick"
@on-return-click="onReturnClick"
@on-save-click="onSaveClick"
@on-thumbnail-click="onThumbnailClick"
3 weeks ago
></mt-edit>
</div>
</template>
<script setup lang="ts">
import type { IExportJson } from '@/views/teacher/teacherStatistics/components/mt-edit/components/types';
import { useGenThumbnail } from '@/views/teacher/teacherStatistics/components/mt-edit/composables/thumbnail';
import MtEdit from '@/views/teacher/teacherStatistics/components/mt-edit';
import { getCurrentInstance, onBeforeUnmount } from 'vue';
import { leftAsideStore } from '@/views/teacher/teacherStatistics/components/mt-edit/store/left-aside';
3 weeks ago
// xq 组件
import vueSignalGaudy from '@/views/teacher/teacherStatistics/components/vue-xq-test/vue-signal-gaudy.vue';
import VueImg from '@/views/teacher/teacherStatistics/components/vue-xq-test/vue-img.vue';
// F:\vue\workspace\Real-time-monitoring-frontend\src\views\teacher\teacherStatistics\components\vue-xq-test\vue-camera.vue
import VueCamera from '@/views/teacher/teacherStatistics/components/vue-xq-test/vue-camera.vue';
3 weeks ago
const instance = getCurrentInstance();
instance?.appContext.app.component('vue-my-signal-gaudy', vueSignalGaudy);
instance?.appContext.app.component('vue-my-img', VueImg);
instance?.appContext.app.component('vue-my-camera', VueCamera);
leftAsideStore.registerConfig('工作组件', [
3 weeks ago
{
id: 'vue-my-signal-gaudy',
title: 'vue遥信02',
type: 'vue',
thumbnail: `${import.meta.env.BASE_URL}svgs/signal-gaudy.svg`,
// thumbnail:"/svgs/signal-gaudy.svg",
props: {
moduleType: {
type: 'inputTypeTag',
val: '遥信',
title: '四遥类型'
},
moduleId: {
type: 'inputSelectId',
val: '',
title: '绑定ID'
},
location: {
type: 'select',
val: 'bottom',
title: '名称位置',
options: [
{
value: 'top',
label: '上'
},
{
value: 'bottom',
label: '下'
},
{
value: 'left',
label: '左'
},
{
value: 'right',
label: '右'
}
]
}
}
},
{
id: 'vue-my-img',
title: '图形组件',
type: 'vue',
thumbnail: '/svgs/image.svg',
props: {
moduleId: {
type: 'upload',
val: '--',
title: '绑定'
}
}
},
{
id: 'vue-my-camera',
title: '监控组件',
type: 'vue',
thumbnail: '/svgs/image.svg',
props: {
moduleId: {
type: 'upload',
val: '--',
title: '绑定'
}
}
}
3 weeks ago
]);
const electrical_modules_files = import.meta.glob('./assets/svgs/electrical/**.svg', {
eager: true,
as: 'raw'
});
const electrical_stroke_modules_files = import.meta.glob('./assets/svgs/electrical/stroke/**.svg', {
eager: true,
as: 'raw'
});
const electrical_register_config: any = [];
for (const key in electrical_modules_files) {
//根据路径获取svg文件名
const name = key.split('/').pop()!.split('.')[0];
electrical_register_config.push({
id: name,
title: name,
type: 'svg',
thumbnail: 'data:image/svg+xml;utf8,' + encodeURIComponent(electrical_modules_files[key] as string),
svg: electrical_modules_files[key],
props: {
fill: {
type: 'color',
val: '#FF0000',
title: '填充色'
}
}
});
}
for (const key in electrical_stroke_modules_files) {
//根据路径获取svg文件名
const name = key.split('/').pop()!.split('.')[0];
electrical_register_config.push({
id: name,
title: name,
type: 'svg',
thumbnail: 'data:image/svg+xml;utf8,' + encodeURIComponent(electrical_stroke_modules_files[key]),
3 weeks ago
svg: electrical_stroke_modules_files[key],
props: {
stroke: {
type: 'color',
val: '#00ff00',
title: '边框色'
}
}
});
}
const onPreviewClick = (exportJson: IExportJson) => {
sessionStorage.setItem('exportJson', JSON.stringify(exportJson));
// const routeUrl = router.resolve({
// name: 'preview'
// });
// window.open(routeUrl.href, '_blank');
3 weeks ago
};
const onSaveClick = (e: IExportJson) => {
console.log(e, '这是要保存的数据');
};
const onReturnClick = () => {
// router.go(-1);
};
const onThumbnailClick = () => {
useGenThumbnail();
};
</script>
2 weeks ago
<style scoped>
</style>