Commit 5fa02845e9f15ec2e842b3ed3beabffb41245fa9

Authored by fengwotao
1 parent 569644df

feat(src/packages): 自定义远程网页和加载组态组件,新增全屏按钮自定义颜色

@@ -6,13 +6,17 @@ import cloneDeep from 'lodash/cloneDeep' @@ -6,13 +6,17 @@ import cloneDeep from 'lodash/cloneDeep'
6 6
7 export const option = { 7 export const option = {
8 // 网站路径 8 // 网站路径
9 - dataset: "", 9 + dataset: '',
10 // 圆角 10 // 圆角
11 - borderRadius: 10 11 + borderRadius: 10,
  12 + pages: {
  13 + page: 1,
  14 + pageSize: 10
  15 + },
  16 + color: 'black'
12 } 17 }
13 18
14 -export default class Config extends PublicConfigClass implements CreateComponentType  
15 -{ 19 +export default class Config extends PublicConfigClass implements CreateComponentType {
16 public key = OverrideILoadConfigurationframeConfig.key 20 public key = OverrideILoadConfigurationframeConfig.key
17 public attr = { ...chartInitConfig, w: 1200, h: 800, zIndex: -1 } 21 public attr = { ...chartInitConfig, w: 1200, h: 800, zIndex: -1 }
18 public chartConfig = cloneDeep(OverrideILoadConfigurationframeConfig) 22 public chartConfig = cloneDeep(OverrideILoadConfigurationframeConfig)
@@ -15,16 +15,38 @@ @@ -15,16 +15,38 @@
15 ></n-input-number> 15 ></n-input-number>
16 </setting-item> 16 </setting-item>
17 </setting-item-box> 17 </setting-item-box>
  18 + <setting-item-box name="分页">
  19 + <setting-item name="页码">
  20 + <n-input-number v-model:value="optionData.pages.page" size="small" :min="1" placeholder="页码"></n-input-number>
  21 + </setting-item>
  22 + <setting-item name="页数">
  23 + <n-input-number
  24 + disabled
  25 + v-model:value="optionData.pages.pageSize"
  26 + size="small"
  27 + :min="10"
  28 + placeholder="页数"
  29 + ></n-input-number>
  30 + </setting-item>
  31 + </setting-item-box>
  32 + <setting-item-box name="颜色" :alone="true">
  33 + <SettingItem name="颜色">
  34 + <n-color-picker size="small" :modes="['hex']" v-model:value="optionData.color"></n-color-picker>
  35 + </SettingItem>
  36 + <SettingItem>
  37 + <n-button size="small" @click="optionData.color = 'black'"> 恢复默认 </n-button>
  38 + </SettingItem>
  39 + </setting-item-box>
18 </collapse-item> 40 </collapse-item>
19 </template> 41 </template>
20 42
21 <script setup lang="ts"> 43 <script setup lang="ts">
22 -import { PropType, onMounted, ref } from 'vue' 44 +import { PropType, onMounted, ref, watch } from 'vue'
23 import { option } from './config' 45 import { option } from './config'
24 import { CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting' 46 import { CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'
25 import { getConfigurationList } from '@/api/external/common/index' 47 import { getConfigurationList } from '@/api/external/common/index'
26 48
27 -defineProps({ 49 +const props = defineProps({
28 optionData: { 50 optionData: {
29 type: Object as PropType<typeof option>, 51 type: Object as PropType<typeof option>,
30 required: true 52 required: true
@@ -40,7 +62,18 @@ const getConfigurationOptions = async (params: object) => { @@ -40,7 +62,18 @@ const getConfigurationOptions = async (params: object) => {
40 } 62 }
41 } 63 }
42 64
  65 +watch(
  66 + () => props.optionData.pages,
  67 + (newData: any) => {
  68 + getConfigurationOptions({ page: newData.page, pageSize: newData.pageSize })
  69 + },
  70 + {
  71 + deep: true,
  72 + immediate: true
  73 + }
  74 +)
  75 +
43 onMounted(() => { 76 onMounted(() => {
44 - getConfigurationOptions({ page: 1, pageSize: 10 }) 77 + getConfigurationOptions({ page: props.optionData.pages.page, pageSize: props.optionData.pages.pageSize })
45 }) 78 })
46 </script> 79 </script>
@@ -3,9 +3,9 @@ @@ -3,9 +3,9 @@
3 <div v-show="isShowSvg" @click="handleFullScreen" id="fullscreenButton"> 3 <div v-show="isShowSvg" @click="handleFullScreen" id="fullscreenButton">
4 <svg 4 <svg
5 focusable="false" 5 focusable="false"
6 - class=""  
7 data-icon="fullscreen" 6 data-icon="fullscreen"
8 width="4vw" 7 width="4vw"
  8 + :style="`color:${color}`"
9 height="4vh" 9 height="4vh"
10 fill="currentColor" 10 fill="currentColor"
11 aria-hidden="true" 11 aria-hidden="true"
@@ -35,8 +35,7 @@ import { useChartDataFetch } from '@/hooks' @@ -35,8 +35,7 @@ import { useChartDataFetch } from '@/hooks'
35 import { CreateComponentType } from '@/packages/index.d' 35 import { CreateComponentType } from '@/packages/index.d'
36 import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore' 36 import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
37 import { useFullScreen } from '@/packages/components/external/Charts/utls/fullScreen' 37 import { useFullScreen } from '@/packages/components/external/Charts/utls/fullScreen'
38 -import { isDevMode } from '@/utils/external/env';  
39 - 38 +import { isDevMode } from '@/utils/external/env'
40 39
41 const props = defineProps({ 40 const props = defineProps({
42 chartConfig: { 41 chartConfig: {
@@ -50,7 +49,7 @@ const isShowSvg = ref(false) @@ -50,7 +49,7 @@ const isShowSvg = ref(false)
50 const allowfullscreen = ref(false) 49 const allowfullscreen = ref(false)
51 50
52 const { w, h } = toRefs(props.chartConfig.attr) 51 const { w, h } = toRefs(props.chartConfig.attr)
53 -const { borderRadius } = toRefs(props.chartConfig.option) 52 +const { borderRadius, color } = toRefs(props.chartConfig.option)
54 53
55 const option = shallowReactive({ 54 const option = shallowReactive({
56 dataset: '' 55 dataset: ''
@@ -63,7 +62,7 @@ const getStyle = (radius: number) => { @@ -63,7 +62,7 @@ const getStyle = (radius: number) => {
63 } 62 }
64 } 63 }
65 64
66 -const isDev = isDevMode(); 65 +const isDev = isDevMode()
67 66
68 // 编辑更新 67 // 编辑更新
69 watch( 68 watch(
@@ -72,7 +71,9 @@ watch( @@ -72,7 +71,9 @@ watch(
72 const currentHost = window.location.host 71 const currentHost = window.location.host
73 const currentProtocol = window.location.protocol 72 const currentProtocol = window.location.protocol
74 //预览 73 //预览
75 - option.dataset = `${currentProtocol}//${currentHost}/thingskit-scada/${isDev ? '?dev=1&' : '?'}configurationId=${newData}&lightbox=1` 74 + option.dataset = `${currentProtocol}//${currentHost}/thingskit-scada/${
  75 + isDev ? '?dev=1&' : '?'
  76 + }configurationId=${newData}&lightbox=1`
76 }, 77 },
77 { 78 {
78 immediate: true 79 immediate: true
@@ -6,13 +6,13 @@ import cloneDeep from 'lodash/cloneDeep' @@ -6,13 +6,13 @@ import cloneDeep from 'lodash/cloneDeep'
6 6
7 export const option = { 7 export const option = {
8 // 网站路径 8 // 网站路径
9 - dataset: "https://www.thingskit.com/", 9 + dataset: 'https://www.thingskit.com/',
10 // 圆角 10 // 圆角
11 - borderRadius: 10 11 + borderRadius: 10,
  12 + color: 'black'
12 } 13 }
13 14
14 -export default class Config extends PublicConfigClass implements CreateComponentType  
15 -{ 15 +export default class Config extends PublicConfigClass implements CreateComponentType {
16 public key = OverrideIframeConfig.key 16 public key = OverrideIframeConfig.key
17 public attr = { ...chartInitConfig, w: 1200, h: 800, zIndex: -1 } 17 public attr = { ...chartInitConfig, w: 1200, h: 800, zIndex: -1 }
18 public chartConfig = cloneDeep(OverrideIframeConfig) 18 public chartConfig = cloneDeep(OverrideIframeConfig)
@@ -15,22 +15,26 @@ @@ -15,22 +15,26 @@
15 ></n-input-number> 15 ></n-input-number>
16 </setting-item> 16 </setting-item>
17 </setting-item-box> 17 </setting-item-box>
  18 + <setting-item-box name="颜色" :alone="true">
  19 + <SettingItem name="颜色">
  20 + <n-color-picker size="small" :modes="['hex']" v-model:value="optionData.color"></n-color-picker>
  21 + </SettingItem>
  22 + <SettingItem>
  23 + <n-button size="small" @click="optionData.color = 'black'"> 恢复默认 </n-button>
  24 + </SettingItem>
  25 + </setting-item-box>
18 </collapse-item> 26 </collapse-item>
19 </template> 27 </template>
20 28
21 <script setup lang="ts"> 29 <script setup lang="ts">
22 -import { PropType } from "vue";  
23 -import { option } from "./config";  
24 -import {  
25 - CollapseItem,  
26 - SettingItemBox,  
27 - SettingItem,  
28 -} from "@/components/Pages/ChartItemSetting"; 30 +import { PropType } from 'vue'
  31 +import { option } from './config'
  32 +import { CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'
29 33
30 const props = defineProps({ 34 const props = defineProps({
31 optionData: { 35 optionData: {
32 type: Object as PropType<typeof option>, 36 type: Object as PropType<typeof option>,
33 - required: true,  
34 - },  
35 -}); 37 + required: true
  38 + }
  39 +})
36 </script> 40 </script>
@@ -3,9 +3,9 @@ @@ -3,9 +3,9 @@
3 <div v-show="isShowSvg" @click="handleFullScreen" id="fullscreenButton"> 3 <div v-show="isShowSvg" @click="handleFullScreen" id="fullscreenButton">
4 <svg 4 <svg
5 focusable="false" 5 focusable="false"
6 - class=""  
7 data-icon="fullscreen" 6 data-icon="fullscreen"
8 width="4vw" 7 width="4vw"
  8 + :style="`color:${color}`"
9 height="4vh" 9 height="4vh"
10 fill="currentColor" 10 fill="currentColor"
11 aria-hidden="true" 11 aria-hidden="true"
@@ -48,7 +48,7 @@ const isShowSvg = ref(false) @@ -48,7 +48,7 @@ const isShowSvg = ref(false)
48 const allowfullscreen = ref(false) 48 const allowfullscreen = ref(false)
49 49
50 const { w, h } = toRefs(props.chartConfig.attr) 50 const { w, h } = toRefs(props.chartConfig.attr)
51 -const { borderRadius } = toRefs(props.chartConfig.option) 51 +const { borderRadius, color } = toRefs(props.chartConfig.option)
52 52
53 const option = shallowReactive({ 53 const option = shallowReactive({
54 dataset: '' 54 dataset: ''