Commit 1a5187744abd884d0548733a5c7c8db2062ebb94

Authored by loveumiko
2 parents b68a8c5d cd1291c3

Merge branch 'perf/main_dev' of http://git.yunteng.com/yunteng/thingskit-scada into fix/zfl

@@ -99,7 +99,7 @@ @@ -99,7 +99,7 @@
99 99
100 .first-text-animation-container svg { 100 .first-text-animation-container svg {
101 display: block; 101 display: block;
102 - font-size: 120px; 102 + font-size: 80px;
103 103
104 /* width: 100vw; 104 /* width: 100vw;
105 height: 100vh; */ 105 height: 100vh; */
@@ -271,9 +271,9 @@ @@ -271,9 +271,9 @@
271 <body class="geEditor"> 271 <body class="geEditor">
272 <div id="geInfo"> 272 <div id="geInfo">
273 <div class="first-text-animation-container"> 273 <div class="first-text-animation-container">
274 - <svg id="first-text-animation" viewBox="0 0 960 300"> 274 + <svg id="first-text-animation" viewBox="0 0 960 100">
275 <symbol id="first-text-animation-text"> 275 <symbol id="first-text-animation-text">
276 - <text text-anchor="middle" x="50%" y="80%"></text> 276 + <text text-anchor="middle" x="50%" y="80%">Scada</text>
277 </symbol> 277 </symbol>
278 <g class="g-ants"> 278 <g class="g-ants">
279 <use xlink:href="#first-text-animation-text" class="text-copy"></use> 279 <use xlink:href="#first-text-animation-text" class="text-copy"></use>
@@ -2069,11 +2069,18 @@ App.prototype.updateDocumentTitle = function () { @@ -2069,11 +2069,18 @@ App.prototype.updateDocumentTitle = function () {
2069 2069
2070 if (file != null) { 2070 if (file != null) {
2071 const filename = (file.getTitle() != null) ? file.getTitle() : this.defaultFilename 2071 const filename = (file.getTitle() != null) ? file.getTitle() : this.defaultFilename
2072 - title = `${filename} - ${title}` 2072 + title = `${filename}`
2073 } 2073 }
2074 2074
2075 if (document.title != title) 2075 if (document.title != title)
2076 document.title = title 2076 document.title = title
  2077 + } else {
  2078 + // TODO Thingskit 设置预览模式title
  2079 + const file = this.getCurrentFile()
  2080 + if (!file) return
  2081 + const filename = (file.getTitle() != null) ? file.getTitle() : this.defaultFilename
  2082 + if (document.title != filename)
  2083 + document.title = filename
2077 } 2084 }
2078 } 2085 }
2079 2086
@@ -2057,7 +2057,10 @@ @@ -2057,7 +2057,10 @@
2057 /** 2057 /**
2058 * Specifies the app name. Default is document.title. 2058 * Specifies the app name. Default is document.title.
2059 */ 2059 */
2060 - Editor.prototype.appName = 'draw.io'; 2060 + // Editor.prototype.appName = 'draw.io';
  2061 +
  2062 + // TODO Thingskit 隐藏title后缀
  2063 + Editor.prototype.appName = '';
2061 2064
2062 /** 2065 /**
2063 * TODO 创建文件时可选类型 2066 * TODO 创建文件时可选类型
@@ -7821,6 +7821,7 @@ @@ -7821,6 +7821,7 @@
7821 */ 7821 */
7822 EditorUi.prototype.importFile = function (data, mimeType, dx, dy, w, h, filename, 7822 EditorUi.prototype.importFile = function (data, mimeType, dx, dy, w, h, filename,
7823 done, file, crop, ignoreEmbeddedXml, evt) { 7823 done, file, crop, ignoreEmbeddedXml, evt) {
  7824 + // TODO Thingskit 拖拽引入文件
7824 crop = (crop != null) ? crop : true; 7825 crop = (crop != null) ? crop : true;
7825 var async = false; 7826 var async = false;
7826 var cells = null; 7827 var cells = null;
@@ -12483,7 +12484,7 @@ @@ -12483,7 +12484,7 @@
12483 this.hoverIcons.update(graph.view.getState(graph.getSelectionCell())); 12484 this.hoverIcons.update(graph.view.getState(graph.getSelectionCell()));
12484 } 12485 }
12485 } 12486 }
12486 - 12487 +
12487 // TODO ThingsKit 移除复制来源cell的无用属性(COPY_SOURCE属性) 12488 // TODO ThingsKit 移除复制来源cell的无用属性(COPY_SOURCE属性)
12488 this.editor.removeSourceCellsUnlessAttrubute(cells) 12489 this.editor.removeSourceCellsUnlessAttrubute(cells)
12489 return cells; 12490 return cells;
@@ -13052,8 +13053,11 @@ @@ -13052,8 +13053,11 @@
13052 this.defaultFilename, temp, fileHandle, desc)); 13053 this.defaultFilename, temp, fileHandle, desc));
13053 } 13054 }
13054 }); 13055 });
13055 -  
13056 if (data != null && data.length > 0) { 13056 if (data != null && data.length > 0) {
  13057 + // TODO Thingskit 导入时打开本地文件不再打开新的页面与弹出提示框
  13058 + fn()
  13059 + return
  13060 +
13057 if (currentFile == null || (!currentFile.isModified() && 13061 if (currentFile == null || (!currentFile.isModified() &&
13058 (mxClient.IS_CHROMEAPP || EditorUi.isElectronApp || fileHandle != null))) { 13062 (mxClient.IS_CHROMEAPP || EditorUi.isElectronApp || fileHandle != null))) {
13059 fn(); 13063 fn();
@@ -46,17 +46,21 @@ const emitData = ref<any[]>([]) @@ -46,17 +46,21 @@ const emitData = ref<any[]>([])
46 const [state] = useRuleFormItem(props, 'value', 'change', emitData) 46 const [state] = useRuleFormItem(props, 'value', 'change', emitData)
47 47
48 const getOptions = computed(() => { 48 const getOptions = computed(() => {
49 - const { numberToString, fieldNames } = props  
50 - const { value: valueField = 'value' } = fieldNames 49 + const { numberToString, fieldNames, aliasField } = props
  50 + const { value: valueField = 'value', label: labelField = 'label' } = fieldNames
51 51
52 const data = unref(optionsRef).reduce((prev, next: any) => { 52 const data = unref(optionsRef).reduce((prev, next: any) => {
53 if (next) { 53 if (next) {
54 const value = get(next, valueField) 54 const value = get(next, valueField)
55 55
56 - prev.push({ 56 + const options = {
57 ...next, 57 ...next,
58 [valueField]: numberToString ? `${value}` : value, 58 [valueField]: numberToString ? `${value}` : value,
59 - } as DefaultOptionType) 59 + } as DefaultOptionType
  60 + if (aliasField)
  61 + Object.assign(options, { [aliasField]: options[aliasField] || options[labelField] })
  62 +
  63 + prev.push(options)
60 } 64 }
61 return prev 65 return prev
62 }, [] as DefaultOptionType[]) 66 }, [] as DefaultOptionType[])
1 <script setup lang="ts"> 1 <script setup lang="ts">
2 import { useIntervalFn } from '@vueuse/core' 2 import { useIntervalFn } from '@vueuse/core'
3 import { ref } from 'vue' 3 import { ref } from 'vue'
4 -import { dateUtil, formatToDateTime } from '@/utils/dateUtil' 4 +import { dateUtil } from '@/utils/dateUtil'
5 import { DateFormatEnum } from '@/enums/timeEnum' 5 import { DateFormatEnum } from '@/enums/timeEnum'
  6 +import type { CreateComponentType } from '@/core/Library/types'
6 7
7 -const date = ref<string>(formatToDateTime(Date.now())) 8 +defineProps<{
  9 + config: CreateComponentType
  10 +}>()
  11 +
  12 +const getNowDate = () => `${dateUtil().format('YYYY年MM月DD日')} ${dateUtil().format(DateFormatEnum.HH_MM_SS)}`
  13 +
  14 +const date = ref<string>(getNowDate())
8 15
9 const week = ['日', '一', '二', '三', '四', '五', '六'] 16 const week = ['日', '一', '二', '三', '四', '五', '六']
10 17
11 useIntervalFn(() => { 18 useIntervalFn(() => {
12 - date.value = `${dateUtil().format(DateFormatEnum.YYYY_MM_DD)} ${dateUtil().format(DateFormatEnum.HH_MM_SS)}` 19 + date.value = getNowDate()
13 }, 1000) 20 }, 1000)
14 </script> 21 </script>
15 22
16 <template> 23 <template>
17 - <main class="w-full h-full flex flex-col justify-center items-center">  
18 - <div class="text-[18px]"> 24 + <main class="w-full h-full flex flex-col justify-center items-center overflow-hidden">
  25 + <div class="text-1em">
19 {{ date.split(' ')?.[0] }} {{ `星期${week[dateUtil().day()]}` }} 26 {{ date.split(' ')?.[0] }} {{ `星期${week[dateUtil().day()]}` }}
20 </div> 27 </div>
21 - <div class="text-[50px] p-1"> 28 + <div class="p-1 text-2em">
22 {{ date.split(' ')?.[1] }} 29 {{ date.split(' ')?.[1] }}
23 </div> 30 </div>
24 </main> 31 </main>
@@ -25,8 +25,6 @@ export const getDefaultOption = (): EChartsOption => { @@ -25,8 +25,6 @@ export const getDefaultOption = (): EChartsOption => {
25 }, 25 },
26 xAxis: { type: 'category' }, 26 xAxis: { type: 'category' },
27 yAxis: {}, 27 yAxis: {},
28 - // Declare several bar series, each will be mapped  
29 - // to a column of dataset.source by default.  
30 series: [ 28 series: [
31 { type: 'line' }, 29 { type: 'line' },
32 ], 30 ],
1 <script lang="ts" setup> 1 <script lang="ts" setup>
2 import { computed, onMounted, onUnmounted, ref, unref } from 'vue' 2 import { computed, onMounted, onUnmounted, ref, unref } from 'vue'
3 -import type { DatasetComponentOption, ECharts, EChartsOption, SeriesOption, XAXisComponentOption } from 'echarts' 3 +import type { DatasetComponentOption, ECharts, EChartsOption } from 'echarts'
4 import { init } from 'echarts' 4 import { init } from 'echarts'
5 import { getDefaultOption } from './index.config' 5 import { getDefaultOption } from './index.config'
6 import type { CreateComponentType, RenderComponentExposeType } from '@/core/Library/types' 6 import type { CreateComponentType, RenderComponentExposeType } from '@/core/Library/types'
@@ -56,16 +56,11 @@ const handlerTimeSeriesData = (commandSource: CommandSource, message: Subscripti @@ -56,16 +56,11 @@ const handlerTimeSeriesData = (commandSource: CommandSource, message: Subscripti
56 const { deviceName } = deviceInfo || {} 56 const { deviceName } = deviceInfo || {}
57 const { ts, latestValue } = useLatestMessageValue(message, attr) 57 const { ts, latestValue } = useLatestMessageValue(message, attr)
58 const option = unref(chartInstance)?.getOption() as EChartsOption 58 const option = unref(chartInstance)?.getOption() as EChartsOption
59 - const oldDataset = (option.dataset as DatasetComponentOption[])?.[0].source  
60 - // const xAxisData = ((option.xAxis as XAXisComponentOption[])?.[0] as { data: string[] }).data  
61 - // const seriesData = ((option.series as SeriesOption[])?.[0].data) as SeriesOption[]  
62 - // console.log(option)  
63 - // oldDataset.  
64 - // xAxisData.push(formatToDateTime(ts))  
65 - // seriesData.push({  
66 - // name: attrInfo.name,  
67 - // data: [],  
68 - // }) 59 + const oldDataset = (option.dataset as DatasetComponentOption[])?.[0].source as Recordable[]
  60 + oldDataset.push({
  61 + ts: formatToDateTime(ts),
  62 + [attr]: latestValue,
  63 + })
69 64
70 unref(chartInstance)?.setOption({ 65 unref(chartInstance)?.setOption({
71 title: { 66 title: {
@@ -73,15 +68,8 @@ const handlerTimeSeriesData = (commandSource: CommandSource, message: Subscripti @@ -73,15 +68,8 @@ const handlerTimeSeriesData = (commandSource: CommandSource, message: Subscripti
73 }, 68 },
74 dataset: { 69 dataset: {
75 dimensions: ['ts', attr], 70 dimensions: ['ts', attr],
76 - source: [  
77 - { ts, [attr]: latestValue },  
78 - ], 71 + source: sliceData(oldDataset),
79 }, 72 },
80 - // legend: {  
81 - // data: [attrInfo.name],  
82 - // },  
83 - // xAxis: { data: sliceData(xAxisData) },  
84 - // series: { data: sliceData(seriesData) },  
85 } as EChartsOption) 73 } as EChartsOption)
86 } 74 }
87 75