From 30b97ca3cb1266c683d5759f96b7e498377e205f Mon Sep 17 00:00:00 2001 From: jackhoo_98 Date: Wed, 15 Mar 2023 11:29:57 +0800 Subject: [PATCH 1/9] =?UTF-8?q?fix:=20=E6=95=B0=E6=8D=AE=E9=87=87=E9=9B=86?= =?UTF-8?q?=20=E9=80=9A=E9=81=93=E7=AE=A1=E7=90=86=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/DataCollect/Channel/Save/index.vue | 45 ++++++++++++-------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/src/views/DataCollect/Channel/Save/index.vue b/src/views/DataCollect/Channel/Save/index.vue index 8e01b54e..e05b3974 100644 --- a/src/views/DataCollect/Channel/Save/index.vue +++ b/src/views/DataCollect/Channel/Save/index.vue @@ -109,10 +109,7 @@ /> { const changeAuthType = (value: Array) => { formData.value.configuration.authType = value[0]; }; +const isAuthType = computed(() => { + const { authType } = formData.value.configuration; + return isArray(authType) + ? authType[0] === 'username' + : authType === 'username'; +}); +const isSecurityMode = computed(() => { + const { securityMode } = formData.value.configuration; + return securityMode === 'SignAndEncrypt' || securityMode === 'Sign' + ? true + : false; +}); const filterOption = (input: string, option: any) => { return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0; @@ -251,18 +258,22 @@ const filterOption = (input: string, option: any) => { const getOptionsList = async () => { for (let key in Options.value) { const res: any = await queryOptionsList(key); - Options.value[key] = res.result.map((item: any) => ({ - label: item?.text || item, - value: item?.value || item, - })); + if (res.status === 200) { + Options.value[key] = res.result.map((item: any) => ({ + label: item?.text || item, + value: item?.value || item, + })); + } } }; const getCertificateList = async () => { const res: any = await queryCertificateList(); - certificateList.value = res.result.map((item: any) => ({ - value: item.id, - label: item.name, - })); + if (res.status === 200) { + certificateList.value = res.result.map((item: any) => ({ + label: item.name, + value: item.id, + })); + } }; const getProvidersList = async () => { From 0879a35eeb105ce6f15267986191fe720b16d64c Mon Sep 17 00:00:00 2001 From: jackhoo_98 Date: Wed, 15 Mar 2023 13:54:00 +0800 Subject: [PATCH 2/9] =?UTF-8?q?fix:=20=E8=BF=90=E7=BB=B4=E7=AE=A1=E7=90=86?= =?UTF-8?q?=20=E4=BB=AA=E8=A1=A8=E7=9B=98=E4=BF=AE=E5=A4=8D=E9=83=A8?= =?UTF-8?q?=E5=88=86bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/link/DashBoard/components/Cpu.vue | 37 ++++++++++++------ src/views/link/DashBoard/components/Jvm.vue | 35 ++++++++++++----- .../link/DashBoard/components/Network.vue | 39 ++++++++++++------- .../link/DashBoard/components/TopCard.vue | 8 ++-- src/views/link/DashBoard/typings.d.ts | 4 ++ 5 files changed, 84 insertions(+), 39 deletions(-) create mode 100644 src/views/link/DashBoard/typings.d.ts diff --git a/src/views/link/DashBoard/components/Cpu.vue b/src/views/link/DashBoard/components/Cpu.vue index 14ecc946..a637fbad 100644 --- a/src/views/link/DashBoard/components/Cpu.vue +++ b/src/views/link/DashBoard/components/Cpu.vue @@ -33,7 +33,17 @@ > -
+
+ +
+
@@ -50,26 +60,27 @@ import { areaStyleCpu, typeDataLine, } from './tool.ts'; +import { DataType } from '../typings'; const chartRef = ref>({}); const loading = ref(false); -const data = ref({ +const data = ref({ type: 'hour', time: [null, null], }); - +const isEmpty = ref(false); const pickerTimeChange = () => { data.value.type = undefined; }; -const getCPUEcharts = async (val) => { +const getCPUEcharts = async (val: any) => { loading.value = true; - const res = await dashboard(defulteParamsData('cpu', val)); + const res: any = await dashboard(defulteParamsData('cpu', val)); if (res.success) { const _cpuOptions = {}; const _cpuXAxis = new Set(); if (res.result?.length) { - res.result.forEach((item) => { + res.result.forEach((item: any) => { const value = item.data.value; const nodeID = item.data.clusterNodeId; _cpuXAxis.add( @@ -84,15 +95,18 @@ const getCPUEcharts = async (val) => { Number(value.cpuSystemUsage).toFixed(2), ); }); + handleCpuOptions(_cpuOptions, [..._cpuXAxis.keys()]); + } else { + handleCpuOptions([], []); + isEmpty.value = true; } - handleCpuOptions(_cpuOptions, [..._cpuXAxis.keys()]); } setTimeout(() => { loading.value = false; }, 300); }; -const setOptions = (optionsData, key) => ({ +const setOptions = (optionsData: any, key: string) => ({ data: arrayReverse(optionsData[key]), name: key, type: 'line', @@ -101,8 +115,9 @@ const setOptions = (optionsData, key) => ({ areaStyle: areaStyleCpu, }); -const handleCpuOptions = (optionsData, xAxis) => { - const chart = chartRef.value; +const handleCpuOptions = (optionsData: any, xAxis: any) => { + if (optionsData.length === 0 && xAxis.length === 0) return; + const chart: any = chartRef.value; if (chart) { const myChart = echarts.init(chart); const dataKeys = Object.keys(optionsData); @@ -114,7 +129,7 @@ const handleCpuOptions = (optionsData, xAxis) => { }, tooltip: { trigger: 'axis', - valueFormatter: (value) => `${value}%`, + valueFormatter: (value: any) => `${value}%`, }, yAxis: { type: 'value', diff --git a/src/views/link/DashBoard/components/Jvm.vue b/src/views/link/DashBoard/components/Jvm.vue index f77c80c9..399aa347 100644 --- a/src/views/link/DashBoard/components/Jvm.vue +++ b/src/views/link/DashBoard/components/Jvm.vue @@ -33,7 +33,17 @@ > -
+
+ +
+
@@ -50,26 +60,27 @@ import { areaStyleJvm, defulteParamsData, } from './tool.ts'; +import { DataType } from '../typings'; const chartRef = ref>({}); const loading = ref(false); -const data = ref({ +const data = ref({ type: 'hour', time: [null, null], }); - +const isEmpty = ref(false); const pickerTimeChange = () => { data.value.type = undefined; }; -const getJVMEcharts = async (val) => { +const getJVMEcharts = async (val: any) => { loading.value = true; - const res = await dashboard(defulteParamsData('jvm', val)); + const res: any = await dashboard(defulteParamsData('jvm', val)); if (res.success) { const _jvmOptions = {}; const _jvmXAxis = new Set(); if (res.result?.length) { - res.result.forEach((item) => { + res.result.forEach((item: any) => { const value = item.data.value; const memoryJvmHeapFree = value.memoryJvmHeapFree; const memoryJvmHeapTotal = value.memoryJvmHeapTotal; @@ -90,15 +101,18 @@ const getJVMEcharts = async (val) => { ); _jvmOptions[nodeID].push(_value); }); + handleJVMOptions(_jvmOptions, [..._jvmXAxis.keys()]); + } else { + handleJVMOptions([], []); + isEmpty.value = true; } - handleJVMOptions(_jvmOptions, [..._jvmXAxis.keys()]); } setTimeout(() => { loading.value = false; }, 300); }; -const setOptions = (optionsData, key) => ({ +const setOptions = (optionsData: any, key: string) => ({ data: arrayReverse(optionsData[key]), name: key, type: 'line', @@ -106,8 +120,9 @@ const setOptions = (optionsData, key) => ({ symbol: 'none', areaStyle: areaStyleJvm, }); -const handleJVMOptions = (optionsData, xAxis) => { - const chart = chartRef.value; +const handleJVMOptions = (optionsData: any, xAxis: any) => { + if (optionsData.length === 0 && xAxis.length === 0) return; + const chart: any = chartRef.value; if (chart) { const myChart = echarts.init(chart); const dataKeys = Object.keys(optionsData); diff --git a/src/views/link/DashBoard/components/Network.vue b/src/views/link/DashBoard/components/Network.vue index 930f191c..23ed3520 100644 --- a/src/views/link/DashBoard/components/Network.vue +++ b/src/views/link/DashBoard/components/Network.vue @@ -43,7 +43,15 @@
-
+ +
@@ -59,33 +67,34 @@ import { } from './tool.ts'; import moment from 'moment'; import * as echarts from 'echarts'; +import { DataType } from '../typings.d'; const chartRef = ref>({}); const loading = ref(false); -const data = ref({ +const data = ref({ type: 'bytesRead', time: { - type: 'today', + type: 'hour', time: [null, null], }, }); - +const isEmpty = ref(false); const pickerTimeChange = () => { data.value.time.type = undefined; }; -const getNetworkEcharts = async (val) => { +const getNetworkEcharts = async (val: any) => { loading.value = true; - const resp = await dashboard(networkParams(val)); + const resp: any = await dashboard(networkParams(val)); if (resp.success) { const _networkOptions = {}; const _networkXAxis = new Set(); if (resp.result.length) { - resp.result.forEach((item) => { + resp.result.forEach((item: any) => { const value = item.data.value; - const _data = []; + const _data: Array = []; const nodeID = item.data.clusterNodeId; - value.forEach((item) => { + value.forEach((item: any) => { _data.push(item.value); _networkXAxis.add(item.timeString); }); @@ -98,13 +107,14 @@ const getNetworkEcharts = async (val) => { handleNetworkOptions(_networkOptions, [..._networkXAxis.keys()]); } else { handleNetworkOptions([], []); + isEmpty.value = true; } } setTimeout(() => { loading.value = false; }, 300); }; -const networkValueRender = (obj) => { +const networkValueRender = (obj: any) => { const { value } = obj; let _data = ''; if (value >= 1024 && value < 1024 * 1024) { @@ -117,7 +127,7 @@ const networkValueRender = (obj) => { return `${obj?.axisValueLabel}
${obj?.marker}${obj?.seriesName}: ${_data}`; }; -const setOptions = (data, key) => ({ +const setOptions = (data: any, key: string) => ({ data: data[key]._data, // .map((item) => Number((item / 1024 / 1024).toFixed(2))), name: key, type: 'line', @@ -125,8 +135,9 @@ const setOptions = (data, key) => ({ areaStyle, }); -const handleNetworkOptions = (optionsData, xAxis) => { - const chart = chartRef.value; +const handleNetworkOptions = (optionsData: any, xAxis: any) => { + if (optionsData.length === 0 && xAxis.length === 0) return; + const chart: any = chartRef.value; if (chart) { const myChart = echarts.init(chart); const dataKeys = Object.keys(optionsData); @@ -145,7 +156,7 @@ const handleNetworkOptions = (optionsData, xAxis) => { }, tooltip: { trigger: 'axis', - formatter: (_value) => networkValueRender(_value[0]), + formatter: (_value: any) => networkValueRender(_value[0]), }, color: ['#979AFF'], series: dataKeys.length diff --git a/src/views/link/DashBoard/components/TopCard.vue b/src/views/link/DashBoard/components/TopCard.vue index f1b17c9c..2bf79655 100644 --- a/src/views/link/DashBoard/components/TopCard.vue +++ b/src/views/link/DashBoard/components/TopCard.vue @@ -49,7 +49,7 @@ import { getWebSocket } from '@/utils/websocket'; import { map } from 'rxjs/operators'; const serverId = ref(); -const serverNodeOptions = ref([]); +const serverNodeOptions = ref>([]); const topValues = ref({ cpu: 0, jvm: 0, @@ -73,7 +73,7 @@ const getData = () => { interval: '1s', agg: 'avg', }) - .pipe(map((res) => res.payload)) + .pipe(map((res: any) => res.payload)) .subscribe((payload) => { const { value: { cpu, memory, disk }, @@ -103,9 +103,9 @@ const getData = () => { }; onMounted(() => { - serverNode().then((resp) => { + serverNode().then((resp: any) => { if (resp.success) { - serverNodeOptions.value = resp.result.map((item) => ({ + serverNodeOptions.value = resp.result.map((item: any) => ({ label: item.name, value: item.id, })); diff --git a/src/views/link/DashBoard/typings.d.ts b/src/views/link/DashBoard/typings.d.ts new file mode 100644 index 00000000..ffcc8623 --- /dev/null +++ b/src/views/link/DashBoard/typings.d.ts @@ -0,0 +1,4 @@ +export type DataType = { + type: string | undefined; + time: array; +}; From 87824d39bdbc5c7f0bf5729de80d3df8c84924c8 Mon Sep 17 00:00:00 2001 From: jackhoo_98 Date: Wed, 15 Mar 2023 16:16:02 +0800 Subject: [PATCH 3/9] =?UTF-8?q?fix:=20=E8=BF=90=E7=BB=B4=E7=AE=A1=E7=90=86?= =?UTF-8?q?=20=E7=BD=91=E7=BB=9C=E7=BB=84=E4=BB=B6=E5=8F=8A=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/DataCollect/Channel/data.ts | 1 + src/views/link/AccessConfig/data.ts | 12 +- src/views/link/Type/Detail/index.vue | 267 ++++++++++---------------- src/views/link/Type/data.ts | 7 + src/views/link/Type/index.vue | 14 +- src/views/link/Type/type.d.ts | 2 +- 6 files changed, 121 insertions(+), 182 deletions(-) diff --git a/src/views/DataCollect/Channel/data.ts b/src/views/DataCollect/Channel/data.ts index c5fba7be..4330f067 100644 --- a/src/views/DataCollect/Channel/data.ts +++ b/src/views/DataCollect/Channel/data.ts @@ -39,6 +39,7 @@ export const updateStatus = { export const TiTlePermissionButtonStyle = { padding: 0, + 'max-width': 'calc(100% - 90px)', color: ' #1890ff !important', 'font-weight': 700, 'font-size': '16px', diff --git a/src/views/link/AccessConfig/data.ts b/src/views/link/AccessConfig/data.ts index a584099e..4b92ebe1 100644 --- a/src/views/link/AccessConfig/data.ts +++ b/src/views/link/AccessConfig/data.ts @@ -95,39 +95,29 @@ const ColumnsMQTT = [ ]; const ColumnsHTTP = [ - // { - // title: '分组', - // dataIndex: 'group', - // key: 'group', - // ellipsis: true, - // width: 100, - // scopedSlots: { customRender: 'group' }, - // }, { title: '地址', dataIndex: 'address', key: 'address', ellipsis: true, - // scopedSlots: { customRender: 'address' }, }, { title: '示例', dataIndex: 'example', key: 'example', ellipsis: true, - // scopedSlots: { customRender: 'example' }, }, { title: '说明', dataIndex: 'description', key: 'description', ellipsis: true, - // scopedSlots: { customRender: 'description' }, }, ]; const TiTlePermissionButtonStyle = { padding: 0, + 'max-width': 'calc(100% - 90px)', color: ' #1890ff !important', 'font-weight': 700, 'font-size': '16px', diff --git a/src/views/link/Type/Detail/index.vue b/src/views/link/Type/Detail/index.vue index 70805428..17e6a7e1 100644 --- a/src/views/link/Type/Detail/index.vue +++ b/src/views/link/Type/Detail/index.vue @@ -44,21 +44,17 @@ name="shareCluster" :rules="Rules.shareCluster" > -
+ - -
- 节点名称 - * -
-
+ -
+ -
+ -
+ -
- 远程地址 - * -
- -
+ -
+ -
+ + >) => { }; const getSupports = async () => { - const res = await supports(); - options.value = res.result.map((item) => ({ + const res: any = await supports(); + options.value = res.result.map((item: any) => ({ value: item.id, label: item.name, })); diff --git a/src/views/link/Type/type.d.ts b/src/views/link/Type/type.d.ts index 87664902..206f7cdc 100644 --- a/src/views/link/Type/type.d.ts +++ b/src/views/link/Type/type.d.ts @@ -1,7 +1,7 @@ export interface ConfigurationType { parserType: string | undefined; port: string | undefined; - host: string | undefined;; + host: string | undefined; publicPort: string; publicHost: string; remoteHost: string; From 8051989d2cfa203f266a05ea6426eda132517247 Mon Sep 17 00:00:00 2001 From: jackhoo_98 Date: Wed, 15 Mar 2023 17:03:47 +0800 Subject: [PATCH 4/9] =?UTF-8?q?fix:=20=E8=BF=90=E7=BB=B4=E7=AE=A1=E7=90=86?= =?UTF-8?q?=20=E5=8D=8F=E8=AE=AE=E7=AE=A1=E7=90=86=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E9=83=A8=E5=88=86bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/DataCollect/Channel/data.ts | 2 +- .../Collector/Point/Save/SaveOPCUA.vue | 20 +--- src/views/link/Protocol/Save/FileUpload.vue | 4 +- src/views/link/Protocol/Save/index.vue | 101 ++++++++++-------- src/views/link/Protocol/index.vue | 6 +- src/views/link/Protocol/type.d.ts | 8 ++ src/views/link/Type/Detail/index.vue | 6 +- 7 files changed, 76 insertions(+), 71 deletions(-) create mode 100644 src/views/link/Protocol/type.d.ts diff --git a/src/views/DataCollect/Channel/data.ts b/src/views/DataCollect/Channel/data.ts index 4330f067..158b211e 100644 --- a/src/views/DataCollect/Channel/data.ts +++ b/src/views/DataCollect/Channel/data.ts @@ -63,7 +63,7 @@ export const regDomain = new RegExp( ); export const checkEndpoint = (_rule: Rule, value: string): Promise => new Promise(async (resolve, reject) => { - const res = await validateField(value); + const res: any = await validateField(value); return res.result.passed ? resolve('') : reject(res.result.reason); }); export const FormValidate = { diff --git a/src/views/DataCollect/Collector/Point/Save/SaveOPCUA.vue b/src/views/DataCollect/Collector/Point/Save/SaveOPCUA.vue index 08fe3c4d..b6178cab 100644 --- a/src/views/DataCollect/Collector/Point/Save/SaveOPCUA.vue +++ b/src/views/DataCollect/Collector/Point/Save/SaveOPCUA.vue @@ -190,22 +190,4 @@ watch( ); - + diff --git a/src/views/link/Protocol/Save/FileUpload.vue b/src/views/link/Protocol/Save/FileUpload.vue index 015ddc4b..64a77491 100644 --- a/src/views/link/Protocol/Save/FileUpload.vue +++ b/src/views/link/Protocol/Save/FileUpload.vue @@ -58,7 +58,7 @@ const handleChange = async (info: UploadChangeParam) => { if (info.file.status === 'done') { loading.value = false; const result = info.file.response?.result; - const api = await querySystemApi(['paths']); + const api: any = await querySystemApi(['paths']); const path = api.result[0]?.properties ? api.result[0]?.properties['base-path'] : ''; @@ -86,6 +86,8 @@ const handleChange = async (info: UploadChangeParam) => { .upload-box { :deep(.ant-btn) { width: 100px; + border-top-left-radius: 0; + border-bottom-left-radius: 0; } } diff --git a/src/views/link/Protocol/Save/index.vue b/src/views/link/Protocol/Save/index.vue index 6384a442..a9d2eaeb 100644 --- a/src/views/link/Protocol/Save/index.vue +++ b/src/views/link/Protocol/Save/index.vue @@ -11,25 +11,45 @@ :model="formData" name="basic" autocomplete="off" + ref="formRef" > - + - - + - + diff --git a/src/views/device/Product/Detail/index.vue b/src/views/device/Product/Detail/index.vue index 5101ef4f..ac561b62 100644 --- a/src/views/device/Product/Detail/index.vue +++ b/src/views/device/Product/Detail/index.vue @@ -151,7 +151,6 @@ watch( () => route.params.id, (newId) => { if (newId) { - console.log(newId); productStore.tabActiveKey = 'Info'; productStore.refresh(newId as string); } @@ -230,7 +229,7 @@ const getProtocol = async () => { * 详情页跳转到设备页 */ const jumpDevice = () => { - console.log(productStore.current?.id); + // console.log(productStore.current?.id); const searchParams = { column: 'productId', termType: 'eq', diff --git a/src/views/device/Product/DialogTips/index.vue b/src/views/device/Product/DialogTips/index.vue index 72928eb9..afa3fb44 100644 --- a/src/views/device/Product/DialogTips/index.vue +++ b/src/views/device/Product/DialogTips/index.vue @@ -22,8 +22,8 @@
产品创建成功
-
产品ID: {{ idValue.value }}
-
查看详情
+
产品ID: {{ idValue }}
+
查看详情
接下来推荐操作:
1、配置产品接入方式
@@ -49,10 +49,12 @@ import { getImage } from '@/utils/comm.ts'; import { useProductStore } from '@/store/product'; import { CheckCircleOutlined } from '@ant-design/icons-vue'; +import { useMenuStore } from '@/store/menu'; const visible = ref(false); const productStore = useProductStore(); const router = useRouter(); const idValue = ref({}); +const menuStore = useMenuStore(); /** * 弹窗关闭 */ @@ -70,17 +72,12 @@ const show = (id: string) => { * 查看详情 */ const showDetail = () => { - jump(idValue.value); -}; -/** - * 跳转页面 - */ -const jump = (id: string) => { - router.push('/iot/device/product/detail/' + id); + menuStore.jumpPage('device/Product/Detail',{id:idValue.value}) }; defineExpose({ show: show, }); +