Commit 5fa02845e9f15ec2e842b3ed3beabffb41245fa9
1 parent
569644df
feat(src/packages): 自定义远程网页和加载组态组件,新增全屏按钮自定义颜色
Showing
6 changed files
with
71 additions
and
29 deletions
... | ... | @@ -6,13 +6,17 @@ import cloneDeep from 'lodash/cloneDeep' |
6 | 6 | |
7 | 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 | 20 | public key = OverrideILoadConfigurationframeConfig.key |
17 | 21 | public attr = { ...chartInitConfig, w: 1200, h: 800, zIndex: -1 } |
18 | 22 | public chartConfig = cloneDeep(OverrideILoadConfigurationframeConfig) | ... | ... |
... | ... | @@ -15,16 +15,38 @@ |
15 | 15 | ></n-input-number> |
16 | 16 | </setting-item> |
17 | 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 | 40 | </collapse-item> |
19 | 41 | </template> |
20 | 42 | |
21 | 43 | <script setup lang="ts"> |
22 | -import { PropType, onMounted, ref } from 'vue' | |
44 | +import { PropType, onMounted, ref, watch } from 'vue' | |
23 | 45 | import { option } from './config' |
24 | 46 | import { CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting' |
25 | 47 | import { getConfigurationList } from '@/api/external/common/index' |
26 | 48 | |
27 | -defineProps({ | |
49 | +const props = defineProps({ | |
28 | 50 | optionData: { |
29 | 51 | type: Object as PropType<typeof option>, |
30 | 52 | required: true |
... | ... | @@ -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 | 76 | onMounted(() => { |
44 | - getConfigurationOptions({ page: 1, pageSize: 10 }) | |
77 | + getConfigurationOptions({ page: props.optionData.pages.page, pageSize: props.optionData.pages.pageSize }) | |
45 | 78 | }) |
46 | 79 | </script> | ... | ... |
... | ... | @@ -3,9 +3,9 @@ |
3 | 3 | <div v-show="isShowSvg" @click="handleFullScreen" id="fullscreenButton"> |
4 | 4 | <svg |
5 | 5 | focusable="false" |
6 | - class="" | |
7 | 6 | data-icon="fullscreen" |
8 | 7 | width="4vw" |
8 | + :style="`color:${color}`" | |
9 | 9 | height="4vh" |
10 | 10 | fill="currentColor" |
11 | 11 | aria-hidden="true" |
... | ... | @@ -35,8 +35,7 @@ import { useChartDataFetch } from '@/hooks' |
35 | 35 | import { CreateComponentType } from '@/packages/index.d' |
36 | 36 | import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore' |
37 | 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 | 40 | const props = defineProps({ |
42 | 41 | chartConfig: { |
... | ... | @@ -50,7 +49,7 @@ const isShowSvg = ref(false) |
50 | 49 | const allowfullscreen = ref(false) |
51 | 50 | |
52 | 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 | 54 | const option = shallowReactive({ |
56 | 55 | dataset: '' |
... | ... | @@ -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 | 68 | watch( |
... | ... | @@ -72,7 +71,9 @@ watch( |
72 | 71 | const currentHost = window.location.host |
73 | 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 | 79 | immediate: true | ... | ... |
... | ... | @@ -6,13 +6,13 @@ import cloneDeep from 'lodash/cloneDeep' |
6 | 6 | |
7 | 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 | 16 | public key = OverrideIframeConfig.key |
17 | 17 | public attr = { ...chartInitConfig, w: 1200, h: 800, zIndex: -1 } |
18 | 18 | public chartConfig = cloneDeep(OverrideIframeConfig) | ... | ... |
... | ... | @@ -15,22 +15,26 @@ |
15 | 15 | ></n-input-number> |
16 | 16 | </setting-item> |
17 | 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 | 26 | </collapse-item> |
19 | 27 | </template> |
20 | 28 | |
21 | 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 | 34 | const props = defineProps({ |
31 | 35 | optionData: { |
32 | 36 | type: Object as PropType<typeof option>, |
33 | - required: true, | |
34 | - }, | |
35 | -}); | |
37 | + required: true | |
38 | + } | |
39 | +}) | |
36 | 40 | </script> | ... | ... |
... | ... | @@ -3,9 +3,9 @@ |
3 | 3 | <div v-show="isShowSvg" @click="handleFullScreen" id="fullscreenButton"> |
4 | 4 | <svg |
5 | 5 | focusable="false" |
6 | - class="" | |
7 | 6 | data-icon="fullscreen" |
8 | 7 | width="4vw" |
8 | + :style="`color:${color}`" | |
9 | 9 | height="4vh" |
10 | 10 | fill="currentColor" |
11 | 11 | aria-hidden="true" |
... | ... | @@ -48,7 +48,7 @@ const isShowSvg = ref(false) |
48 | 48 | const allowfullscreen = ref(false) |
49 | 49 | |
50 | 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 | 53 | const option = shallowReactive({ |
54 | 54 | dataset: '' | ... | ... |