From 9e2c0069b69ee6c18802503cb4fe9f9ae0bc3509 Mon Sep 17 00:00:00 2001
From: easy <1358086367@qq.com>
Date: Fri, 17 Feb 2023 14:37:26 +0800
Subject: [PATCH 1/5] =?UTF-8?q?update:=20=E8=8F=9C=E5=8D=95=E7=AE=A1?=
=?UTF-8?q?=E7=90=86=E3=80=81=E6=9D=83=E9=99=90=E7=AE=A1=E7=90=86=E3=80=81?=
=?UTF-8?q?=E5=85=B3=E7=B3=BB=E9=85=8D=E7=BD=AE=E6=B7=BB=E5=8A=A0=E6=9D=83?=
=?UTF-8?q?=E9=99=90?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/system/Menu/Detail/BasicInfo.vue | 11 +-
src/views/system/Menu/Detail/ButtonMange.vue | 77 ++++----
.../Menu/components/ButtonAddDialog.vue | 16 +-
.../system/Menu/components/PermissChoose.vue | 30 +++-
src/views/system/Menu/index.vue | 80 +++++----
src/views/system/Permission/index.vue | 168 +++++++++---------
src/views/system/Relationship/index.vue | 74 ++++----
7 files changed, 245 insertions(+), 211 deletions(-)
diff --git a/src/views/system/Menu/Detail/BasicInfo.vue b/src/views/system/Menu/Detail/BasicInfo.vue
index ea01abbc..2a52fd3c 100644
--- a/src/views/system/Menu/Detail/BasicInfo.vue
+++ b/src/views/system/Menu/Detail/BasicInfo.vue
@@ -185,16 +185,18 @@
:first-width="3"
max-height="350px"
v-model:value="form.data.permissions"
+ :key="form.data.id || ''"
/>
- 保存
+ 保存
+
@@ -205,6 +207,7 @@
-
+
diff --git a/src/views/system/Relationship/index.vue b/src/views/system/Relationship/index.vue
index e50f04c7..c0e6a011 100644
--- a/src/views/system/Relationship/index.vue
+++ b/src/views/system/Relationship/index.vue
@@ -11,38 +11,39 @@
:defaultParams="{ sorts: [{ name: 'createTime', order: 'desc' }] }"
>
- 新增
+ 新增
+
-
- 编辑
-
-
-
-
-
-
- 删除
-
-
-
-
-
+
+
+
+
+
+
@@ -52,14 +53,16 @@
+
\ No newline at end of file
diff --git a/src/components/Metadata/ArrayParam/index.vue b/src/components/Metadata/ArrayParam/index.vue
new file mode 100644
index 00000000..576c63fa
--- /dev/null
+++ b/src/components/Metadata/ArrayParam/index.vue
@@ -0,0 +1,67 @@
+
+
+
+
+
+
+
+
+
+ 配置元素
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/Metadata/BooleanParam/index.vue b/src/components/Metadata/BooleanParam/index.vue
new file mode 100644
index 00000000..4e14a89a
--- /dev/null
+++ b/src/components/Metadata/BooleanParam/index.vue
@@ -0,0 +1,81 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/Metadata/EnumParam/index.vue b/src/components/Metadata/EnumParam/index.vue
new file mode 100644
index 00000000..bb9daf5d
--- /dev/null
+++ b/src/components/Metadata/EnumParam/index.vue
@@ -0,0 +1,160 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ item.text || '枚举项配置' }}
+
+
+
+
+
+
+
+
+
+
+ 新增枚举型
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/Metadata/JsonParam/index.vue b/src/components/Metadata/JsonParam/index.vue
new file mode 100644
index 00000000..2b77587c
--- /dev/null
+++ b/src/components/Metadata/JsonParam/index.vue
@@ -0,0 +1,172 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ item.name || '配置参数' }}
+
+
+
+
+
+
+
+
+
+
+ 添加参数
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/device/Instance/typings.d.ts b/src/views/device/Instance/typings.d.ts
index 2fbe7f1c..e00c9319 100644
--- a/src/views/device/Instance/typings.d.ts
+++ b/src/views/device/Instance/typings.d.ts
@@ -1,3 +1,5 @@
+import { MetadataItem } from "../Product/typings";
+
export type DeviceInstance = {
id: string;
name: string;
diff --git a/src/views/device/components/Metadata/Base/Edit/PropertyForm.vue b/src/views/device/components/Metadata/Base/Edit/PropertyForm.vue
new file mode 100644
index 00000000..8c58661c
--- /dev/null
+++ b/src/views/device/components/Metadata/Base/Edit/PropertyForm.vue
@@ -0,0 +1,99 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/device/components/Metadata/Base/Edit/ValueTypeForm.vue b/src/views/device/components/Metadata/Base/Edit/ValueTypeForm.vue
new file mode 100644
index 00000000..2efa7b2a
--- /dev/null
+++ b/src/views/device/components/Metadata/Base/Edit/ValueTypeForm.vue
@@ -0,0 +1,151 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 最大长度
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/device/components/Metadata/Base/Edit/index.vue b/src/views/device/components/Metadata/Base/Edit/index.vue
index 5a86c950..d783b65e 100644
--- a/src/views/device/components/Metadata/Base/Edit/index.vue
+++ b/src/views/device/components/Metadata/Base/Edit/index.vue
@@ -1,10 +1,10 @@
-
保存
-
+
\ No newline at end of file
diff --git a/src/views/device/Instance/Detail/Diagnose/Message/Function/EditTable.vue b/src/views/device/Instance/Detail/Diagnose/Message/Function/EditTable.vue
new file mode 100644
index 00000000..975d91fd
--- /dev/null
+++ b/src/views/device/Instance/Detail/Diagnose/Message/Function/EditTable.vue
@@ -0,0 +1,93 @@
+
+
+
+
+
+ {{ text }}
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/device/Instance/Detail/Diagnose/Message/Function/index.vue b/src/views/device/Instance/Detail/Diagnose/Message/Function/index.vue
new file mode 100644
index 00000000..32462129
--- /dev/null
+++ b/src/views/device/Instance/Detail/Diagnose/Message/Function/index.vue
@@ -0,0 +1,127 @@
+
+
+
+
+
+
+
+ 读取属性
+ 修改属性
+ 调用功能
+
+
+
+
+
+
+ {{i.name}}
+
+
+
+
+
+
+
+
+
+
+
+ {{i.name}}
+
+
+
+
+ 发送
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/device/Instance/Detail/Diagnose/Message/Log/index.vue b/src/views/device/Instance/Detail/Diagnose/Message/Log/index.vue
new file mode 100644
index 00000000..81efb838
--- /dev/null
+++ b/src/views/device/Instance/Detail/Diagnose/Message/Log/index.vue
@@ -0,0 +1,3 @@
+
+ log
+
\ No newline at end of file
diff --git a/src/views/device/Instance/Detail/Diagnose/Message/index.vue b/src/views/device/Instance/Detail/Diagnose/Message/index.vue
new file mode 100644
index 00000000..2a185673
--- /dev/null
+++ b/src/views/device/Instance/Detail/Diagnose/Message/index.vue
@@ -0,0 +1,92 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/device/Instance/Detail/Diagnose/Message/util.ts b/src/views/device/Instance/Detail/Diagnose/Message/util.ts
new file mode 100644
index 00000000..30da1df0
--- /dev/null
+++ b/src/views/device/Instance/Detail/Diagnose/Message/util.ts
@@ -0,0 +1,29 @@
+export type MessageType = {
+ up: {
+ text: string;
+ status: 'loading' | 'success' | 'error';
+ };
+ down: {
+ text: string;
+ status: 'loading' | 'success' | 'error';
+ };
+}
+
+export const messageStyleMap = new Map();
+messageStyleMap.set('loading', {
+ background: 'linear-gradient(0deg, rgba(30, 165, 241, 0.03), rgba(30, 165, 241, 0.03)), #FFFFFF',
+ boxShadow: '-2px 0px 0px #1EA5F1',
+});
+messageStyleMap.set('error', {
+ background: 'linear-gradient(0deg, rgba(255, 77, 79, 0.03), rgba(255, 77, 79, 0.03)), #FFFFFF',
+ boxShadow: '-2px 0px 0px #FF4D4F',
+});
+messageStyleMap.set('success', {
+ background: 'linear-gradient(0deg, rgba(50, 212, 164, 0.03), rgba(50, 212, 164, 0.03)), #FFFFFF',
+ boxShadow: '-2px 0px 0px #32D4A4',
+});
+
+export const messageStatusMap = new Map();
+messageStatusMap.set('loading', 'processing');
+messageStatusMap.set('error', 'error');
+messageStatusMap.set('success', 'success');
\ No newline at end of file
diff --git a/src/views/device/Instance/Detail/Diagnose/Status/DiagnosticAdvice.tsx b/src/views/device/Instance/Detail/Diagnose/Status/DiagnosticAdvice.tsx
new file mode 100644
index 00000000..acb456ff
--- /dev/null
+++ b/src/views/device/Instance/Detail/Diagnose/Status/DiagnosticAdvice.tsx
@@ -0,0 +1,101 @@
+import { Badge, Descriptions, Modal, Tooltip } from "ant-design-vue"
+import TitleComponent from '@/components/TitleComponent/index.vue'
+import styles from './index.module.less'
+import AIcon from "@/components/AIcon";
+import _ from "lodash";
+
+const DiagnosticAdvice = defineComponent({
+ props: {
+ data: {
+ type: Object,
+ default: () => { }
+ }
+ },
+ emits: ['close'],
+ setup(props, { emit }) {
+ const { data } = props
+ return () => {
+ emit('close')
+ }}
+ onCancel={() => {
+ emit('close')
+ }}
+ >
+
+
+
+
+
+ 所有诊断均无异常但设备仍未上线,请检查以下内容
+
+
+ {
+ (data?.list || []).map((item: any, index: number) => (
+
+ {item}
+
+ ))
+ }
+
+
+
+
+
+
+
+ {data?.info?.id || ''}
+
+ {data?.info?.address?.length > 0 && (
+
+
+ {(data?.info?.address || []).map((i: any) => (
+
+
+ {i.address}
+
+ ))}
+
+ }
+ >
+
+ {(data?.info?.address || []).slice(0, 1).map((i: any) => (
+
+
+ {i.address}
+
+ ))}
+
+
+
+ )}
+
+ {(_.flatten(_.map(data?.info?.config, 'properties')) || []).map((item: any, index: number) => (
+
+ {item.name}
+
+
+
+
+ ) : (
+ item.name
+ )
+ }
+ >
+ {data?.info?.configValue[item?.property] || ''}
+
+ ))}
+
+
+
+ }
+})
+
+export default DiagnosticAdvice
\ No newline at end of file
diff --git a/src/views/device/Instance/Detail/Diagnose/Status/ManualInspection.tsx b/src/views/device/Instance/Detail/Diagnose/Status/ManualInspection.tsx
new file mode 100644
index 00000000..cd066848
--- /dev/null
+++ b/src/views/device/Instance/Detail/Diagnose/Status/ManualInspection.tsx
@@ -0,0 +1,217 @@
+import AIcon from "@/components/AIcon";
+import { Button, Descriptions, Modal } from "ant-design-vue"
+import styles from './index.module.less'
+
+const ManualInspection = defineComponent({
+ props: {
+ data: {
+ type: Object,
+ default: () => { }
+ }
+ },
+ emits: ['close', 'save'],
+ setup(props, { emit }) {
+
+ const { data } = props
+
+ const dataRender = () => {
+ if (data.type === 'device' || data.type === 'product') {
+ return (
+ <>
+
+
+
+ 请检查配置项是否填写正确,若您确定该项无需诊断可
+
{
+ emit('save', data)
+ }}
+ >
+ 忽略
+
+
+
+
+ {(data?.data?.properties || []).map((item: any) => (
+
+ {data?.configuration[item.property] || ''}
+
+ ))}
+
+
+
+ {data?.data?.description ? (
+
+
诊断项说明
+
{data?.data?.description}
+
+ ) : (
+ ''
+ )}
+ >
+ );
+ } else if (data.type === 'cloud') {
+ return (
+ <>
+
+
+
+ 请检查配置项是否填写正确,若您确定该项无需诊断可
+
{
+ emit('save', data)
+ }}
+ >
+ 忽略
+
+
+
+
+ {data.configuration?.provider === 'OneNet' ? (
+ <>
+
+ {data?.configuration?.configuration?.apiAddress || ''}
+
+
+ {data?.configuration?.configuration?.apiKey || ''}
+
+
+ {data?.configuration?.configuration?.validateToken || ''}
+
+
+ {data?.configuration?.configuration?.aesKey || ''}
+
+ >
+ ) : (
+ <>
+
+ {data?.configuration?.configuration?.apiAddress || ''}
+
+
+ {data?.configuration?.configuration?.appKey || ''}
+
+
+ {data?.configuration?.configuration?.appSecret || ''}
+
+ >
+ )}
+
+
+
+ {data?.configuration?.configuration?.description ? (
+
+
诊断项说明
+
{data?.configuration?.configuration?.description}
+
+ ) : (
+ ''
+ )}
+ >
+ );
+ } else if (data.type === 'media') {
+ return (
+ <>
+
+
+
+ 请检查配置项是否填写正确,若您确定该项无需诊断可
+
{
+ emit('save', data)
+ }}
+ >
+ 忽略
+
+
+
+
+ {data?.configuration?.configuration?.shareCluster ? (
+ <>
+
+ {data?.configuration?.configuration?.domain || ''}
+
+
+ {data?.configuration?.configuration?.sipId || ''}
+
+
+ {data?.configuration?.configuration?.shareCluster ? '共享配置' : '独立配置'}
+
+
+ {`${data?.configuration?.configuration?.hostPort?.host}:${data?.configuration?.configuration?.hostPort?.port}`}
+
+
+ {`${data?.configuration?.configuration?.hostPort?.publicHost}:${data?.configuration?.configuration?.hostPort?.publicPort}`}
+
+ >
+ ) : (
+ <>
+
+ {data?.configuration?.configuration?.domain || ''}
+
+
+ {data?.configuration?.configuration?.sipId || ''}
+
+
+ {data?.configuration?.configuration?.shareCluster ? '共享配置' : '独立配置'}
+
+ {data?.configuration?.configuration?.cluster.map((i: any, it: number) => (
+
+
节点{it + 1}
+
+ {i?.clusterNodeId || ''}
+
+
+ {`${i.host}:${i?.port}`}
+
+
+ {`${i?.publicHost}:${i?.publicPort}`}
+
+
+ ))}
+ >
+ )}
+
+
+
+ {data?.configuration?.configuration.description ? (
+
+
诊断项说明
+
{data?.configuration?.description}
+
+ ) : (
+ ''
+ )}
+ >
+ );
+ } else {
+ return null;
+ }
+ };
+
+ return () => {
+ emit('save', data)
+ }}
+ onCancel={() => {
+ // TODO 跳转设备和产品
+ }}>
+ {dataRender()}
+
+ }
+})
+
+export default ManualInspection
\ No newline at end of file
diff --git a/src/views/device/Instance/Detail/Diagnose/Status/index.module.less b/src/views/device/Instance/Detail/Diagnose/Status/index.module.less
new file mode 100644
index 00000000..ce805739
--- /dev/null
+++ b/src/views/device/Instance/Detail/Diagnose/Status/index.module.less
@@ -0,0 +1,90 @@
+.statusBox {
+ width: 100%;
+
+ .statusHeader {
+ display: flex;
+ }
+
+ .statusContent {
+ width: 100%;
+ margin: 20px 0;
+ border: 1px solid #ececec;
+ border-bottom: none;
+
+ .statusItem {
+ display: flex;
+ justify-content: space-between;
+ padding: 20px;
+ border-bottom: 1px solid #ececec;
+
+ .statusLeft {
+ display: flex;
+
+ .statusImg {
+ width: 32px;
+ height: 32px;
+ margin: 15px 20px 0 0;
+ }
+
+ .statusContext {
+ .statusTitle {
+ color: rgba(0, 0, 0, 0.8);
+ font-weight: 700;
+ font-size: 18px;
+ }
+
+ .statusDesc {
+ color: rgba(0, 0, 0, 0.65);
+ font-size: 14px;
+ }
+
+ .info {
+ margin-top: 10px;
+ color: #646464;
+ font-size: 14px;
+
+ .infoItem {
+ width: 100%;
+ }
+ }
+ }
+ }
+
+ .statusRight {
+ margin-top: 10px;
+ font-weight: 700;
+ font-size: 18px;
+ }
+ }
+ }
+ }
+
+ .loading {
+ animation: loading 2s linear infinite;
+ }
+
+ @keyframes loading {
+ 0% {
+ transform: rotate(0deg);
+ }
+ 25% {
+ transform: rotate(90deg);
+ }
+ 50% {
+ transform: rotate(180deg);
+ }
+ 75% {
+ transform: rotate(270deg);
+ }
+ 100% {
+ transform: rotate(360deg);
+ }
+ }
+
+ .alert {
+ height: 40px;
+ padding-left: 10px;
+ color: rgba(0, 0, 0, 0.55);
+ line-height: 40px;
+ background-color: #f6f6f6;
+ }
\ No newline at end of file
diff --git a/src/views/device/Instance/Detail/Diagnose/Status/index.tsx b/src/views/device/Instance/Detail/Diagnose/Status/index.tsx
new file mode 100644
index 00000000..db57848b
--- /dev/null
+++ b/src/views/device/Instance/Detail/Diagnose/Status/index.tsx
@@ -0,0 +1,1585 @@
+import { Badge, Button, message, Popconfirm, Space } from "ant-design-vue"
+import TitleComponent from '@/components/TitleComponent/index.vue'
+import styles from './index.module.less'
+import type { ListProps } from './util'
+import { networkInitList, childInitList, cloudInitList, mediaInitList, TextColorMap, StatusMap, modifyArrayList, isExit, gatewayList, urlMap } from './util'
+import { useInstanceStore } from "@/store/instance"
+import { startNetwork, startGateway, getGatewayDetail, queryGatewayState, queryProtocolDetail, detail, queryProductState, queryProductConfig, queryDeviceConfig, _deploy } from '@/api/device/instance'
+import { PropType, VNode } from "vue"
+import { _deploy as _deployProduct } from "@/api/device/product"
+import _ from "lodash"
+import DiagnosticAdvice from './DiagnosticAdvice'
+import ManualInspection from './ManualInspection'
+
+type TypeProps = 'network' | 'child-device' | 'media' | 'cloud' | 'channel'
+
+const Status = defineComponent({
+ components: { TitleComponent },
+ props: {
+ providerType: {
+ type: String as PropType,
+ default: undefined
+ }
+ },
+ emits: ['percentChange', 'countChange', 'stateChange'],
+ setup(props, { emit }) {
+ const instanceStore = useInstanceStore()
+ const time = 500;
+
+ const status = ref<'loading' | 'finish'>('loading')
+
+ const device = ref(instanceStore.current)
+ const gateway = ref>>() // 网关信息
+ const parent = ref>>() // 父设备
+ const product = ref>>() // 产品
+
+ const artificialVisible = ref(false)
+ const artificialData = ref>>()
+
+ const diagnoseVisible = ref(false)
+ const diagnoseData = ref>>()
+
+ const bindParentVisible = ref(false)
+
+ const configuration = reactive<{
+ product: Record,
+ device: Record
+ }>({
+ product: {},
+ device: []
+ })
+
+ const list = ref([])
+
+ const manualInspection = (params: any) => {
+ artificialVisible.value = true
+ artificialData.value = params
+ }
+
+ // TODO
+ const jumpAccessConfig = () => {
+ // const purl = getMenuPathByCode(MENUS_CODE['device/Product/Detail']);
+ // if (purl) {
+ // history.push(
+ // `${getMenuPathByParams(MENUS_CODE['device/Product/Detail'], device.productId)}`,
+ // {
+ // tab: 'access',
+ // },
+ // );
+ // } else {
+ // message.error('规则可能有加密处理,请联系管理员');
+ // }
+ };
+
+ const jumpDeviceConfig = () => {
+ instanceStore.tabActiveKey = 'Info'
+ }
+
+ // 网络信息
+ const diagnoseNetwork = () => new Promise(async (resolve) => {
+ if (unref(device).state?.value === 'online') {
+ setTimeout(() => {
+ list.value = modifyArrayList(unref(list), {
+ key: 'network',
+ name: '网络组件',
+ desc: '诊断网络组件配置是否正确,配置错误将导致设备连接失败',
+ status: 'success',
+ text: '正常',
+ info: null,
+ });
+ resolve({})
+ }, time)
+ } else {
+ const _device = unref(device)
+ if (_device.accessId) {
+ const response: Record = await queryGatewayState(_device.accessId)
+ if (response.status === 200) {
+ gateway.value = response.request
+ const address = response.result?.channelInfo?.addresses || [];
+ const _label = address.some((i: any) => i.health === -1);
+ const __label = address.every((i: any) => i.health === 1);
+ const health = _label ? -1 : __label ? 1 : 0;
+ let _item: ListProps | undefined = undefined
+ if (health === 1) {
+ _item = {
+ key: 'network',
+ name: '网络组件',
+ desc: '诊断网络组件配置是否正确,配置错误将导致设备连接失败',
+ status: 'success',
+ text: '正常',
+ info: null,
+ };
+ } else {
+ _item = {
+ key: 'network',
+ name: '网络组件',
+ desc: '诊断网络组件配置是否正确,配置错误将导致设备连接失败',
+ status: 'error',
+ text: '异常',
+ info: health === -1 ? (
+
+
+
网络组件已禁用,请先 {
+ const res = await startNetwork(
+ unref(gateway)?.channelId,
+ );
+ if (res.status === 200) {
+ message.success('操作成功!');
+ list.value = modifyArrayList(
+ list.value,
+ {
+ key: 'network',
+ name: '网络组件',
+ desc: '诊断网络组件配置是否正确,配置错误将导致设备连接失败',
+ status: 'success',
+ text: '正常',
+ info: null,
+ },
+ );
+ }
+ }}
+ >
+ 启用
+
+ }
+ />
+
+
+ ) : (
+
+ ),
+ };
+ }
+ setTimeout(() => {
+ if (_item) {
+ list.value = modifyArrayList(list.value, _item);
+ }
+ resolve({});
+ }, time);
+ } else {
+ message.error('请求发生错误')
+ }
+ } else {
+ message.error('设备不含accessId')
+ }
+ }
+ })
+
+ // 设备接入网关
+ const diagnoseGateway = () => new Promise(async (resolve) => {
+ const desc = props.providerType && ['child-device', 'cloud'].includes(props.providerType)
+ ? '诊断设备接入网关状态是否正常,网关配置是否正确'
+ : '诊断设备接入网关状态是否正常,禁用状态将导致连接失败';
+ if (unref(device).state.value === 'online') {
+ setTimeout(() => {
+ list.value = modifyArrayList(list.value, {
+ key: 'gateway',
+ name: '设备接入网关',
+ desc: desc,
+ status: 'success',
+ text: '正常',
+ info: null,
+ });
+ resolve({});
+ }, time);
+ } else {
+ let _item: ListProps | undefined = undefined
+ if (!unref(gateway)) {
+ const accessId = unref(device)?.accessId
+ if (accessId) {
+ const response: Record = await queryGatewayState(accessId)
+ if (response.status === 200) {
+ gateway.value = response.result
+ if (response.result?.state?.value === 'enabled') {
+ if (props.providerType === 'cloud' || unref(device)?.accessProvider === 'gb28181-2016') {
+ _item = {
+ key: 'gateway',
+ name: '设备接入网关',
+ desc: desc,
+ status: 'warning',
+ text: '可能存在异常',
+ info: (
+
+
+
+ 请 {
+ const config: any = await getGatewayDetail(
+ response.result?.id || '',
+ );
+ if (config.status === 200) {
+ manualInspection({
+ type: props.providerType,
+ key: `gateway`,
+ name: `设备接入网关`,
+ desc: desc,
+ data: { name: `${unref(device)?.accessProvider}配置` },
+ configuration: { ...config.result },
+ });
+ }
+ }}>人工检查 网关配置是否已填写正确,若您确定该项无需诊断可
+ {
+ list.value = modifyArrayList(
+ list.value,
+ {
+ key: 'gateway',
+ name: '设备接入网关',
+ desc: desc,
+ status: 'success',
+ text: '正常',
+ info: null,
+ },
+ );
+ }}
+ >
+ 忽略
+
+
+ }
+ />
+
+
+ ),
+ };
+ } else {
+ _item = {
+ key: 'gateway',
+ name: '设备接入网关',
+ desc: desc,
+ status: 'success',
+ text: '正常',
+ info: null,
+ };
+ }
+ } else {
+ _item = {
+ key: 'gateway',
+ name: '设备接入网关',
+ desc: desc,
+ status: 'error',
+ text: '异常',
+ info: (
+
+
+
设备接入网关已禁用,请先
+ {
+ const resp = await startGateway(unref(device).accessId || '');
+ if (resp.status === 200) {
+ message.success('操作成功!');
+ list.value = modifyArrayList(
+ list.value,
+ {
+ key: 'gateway',
+ name: '设备接入网关',
+ desc: desc,
+ status: 'success',
+ text: '正常',
+ info: null,
+ },
+ );
+ }
+ }}
+ >
+ 启用
+
+ }
+ />
+
+
+ ),
+ };
+ }
+ setTimeout(() => {
+ if (_item) {
+ list.value = modifyArrayList(list.value, _item);
+ }
+ resolve({});
+ }, time);
+ } else {
+ message.error('请求发生错误')
+ }
+ } else {
+ message.error('设备不含accessId')
+ }
+ } else {
+ if (unref(gateway)?.state?.value === 'enabled') {
+ if (props.providerType === 'cloud' || unref(device)?.accessProvider === 'gb28181-2016') {
+ _item = {
+ key: 'gateway',
+ name: '设备接入网关',
+ desc: desc,
+ status: 'warning',
+ text: '可能存在异常',
+ info: (
+
+
+
+ 请 {
+ const config: any = await getGatewayDetail(
+ unref(gateway)?.id || '',
+ );
+ if (config.status === 200) {
+ manualInspection({
+ type: props.providerType,
+ key: `gateway`,
+ name: `设备接入网关`,
+ desc: desc,
+ data: { name: `${unref(device)?.accessProvider}配置` },
+ configuration: { ...config.result },
+ });
+ }
+ }}
+ >人工检查
+ 网关配置是否已填写正确,若您确定该项无需诊断可
+ {
+ list.value = modifyArrayList(
+ list.value,
+ {
+ key: 'gateway',
+ name: '设备接入网关',
+ desc: desc,
+ status: 'success',
+ text: '正常',
+ info: null,
+ },
+ );
+ }}
+ >
+ 忽略
+
+
+ }
+ />
+
+
+ ),
+ };
+ } else {
+ _item = {
+ key: 'gateway',
+ name: '设备接入网关',
+ desc: desc,
+ status: 'success',
+ text: '正常',
+ info: null,
+ };
+ }
+ } else {
+ _item = {
+ key: 'gateway',
+ name: '设备接入网关',
+ desc: desc,
+ status: 'error',
+ text: '异常',
+ info: (
+
+
+
+ 设备接入网关已禁用,请先 {
+ const resp = await startGateway(unref(device).accessId || '');
+ if (resp.status === 200) {
+ message.success('操作成功!');
+ list.value = modifyArrayList(
+ list.value,
+ {
+ key: 'gateway',
+ name: '设备接入网关',
+ desc: desc,
+ status: 'success',
+ text: '正常',
+ info: null,
+ },
+ );
+ }
+ }}
+ >
+ 启用
+
+
+ }
+ />
+
+
+ ),
+ };
+ }
+ setTimeout(() => {
+ if (_item) {
+ list.value = modifyArrayList(list.value, _item);
+ }
+ resolve({});
+ }, time);
+ }
+ }
+ })
+
+ // 网关父设备
+ const diagnoseParentDevice = new Promise(async (resolve) => {
+ if (unref(device).state.value === 'online') {
+ setTimeout(() => {
+ list.value = modifyArrayList(unref(list), {
+ key: 'parent-device',
+ name: '网关父设备',
+ desc: '诊断网关父设备状态是否正常,禁用或离线将导致连接失败',
+ status: 'success',
+ text: '正常',
+ info: null,
+ });
+ resolve({});
+ }, time);
+ } else {
+ const _device = unref(device)
+ if (!_device?.parentId) {
+ setTimeout(() => {
+ list.value = modifyArrayList(unref(list), {
+ key: 'parent-device',
+ name: '网关父设备',
+ desc: '诊断网关父设备状态是否正常,禁用或离线将导致连接失败',
+ status: 'error',
+ text: '异常',
+ info: (
+
+
+
+ 未绑定父设备,请先
+ {
+ bindParentVisible.value = true
+ }}
+ >
+ 绑定
+
+ 父设备后重试
+
+ }
+ />
+
+
+ ),
+ });
+ resolve({});
+ }, time);
+ } else {
+ let _item: ListProps | undefined = undefined;
+ const response = await detail(_device?.parentId);
+ parent.value = response.result
+ if (response.status === 200) {
+ if (response?.result?.state?.value === 'notActive') {
+ _item = {
+ key: 'parent-device',
+ name: '网关父设备',
+ desc: '诊断网关父设备状态是否正常,禁用或离线将导致连接失败',
+ status: 'error',
+ text: '异常',
+ info: (
+
+
+
+ 网关父设备已禁用,请先 {
+ const resp = await _deploy(response?.result?.id || '');
+ if (resp.status === 200) {
+ message.success('操作成功!');
+ list.value = modifyArrayList(
+ list.value,
+ {
+ key: 'parent-device',
+ name: '网关父设备',
+ desc: '诊断网关父设备状态是否正常,禁用或离线将导致连接失败',
+ status: 'success',
+ text: '正常',
+ info: null,
+ },
+ );
+ }
+ }}
+ >
+ 启用
+
+
+ }
+ />
+
+
+ ),
+ };
+ } else if (response?.result?.state?.value === 'online') {
+ _item = {
+ key: 'parent-device',
+ name: '网关父设备',
+ desc: '诊断网关父设备状态是否正常,禁用或离线将导致连接失败',
+ status: 'success',
+ text: '正常',
+ info: null,
+ };
+ } else {
+ _item = {
+ key: 'parent-device',
+ name: '网关父设备',
+ desc: '诊断网关父设备状态是否正常,禁用或离线将导致连接失败',
+ status: 'error',
+ text: '异常',
+ info: (
+
+
+ 网关父设备已离线,请先排查网关设备故障}
+ />
+
+
+ ),
+ };
+ }
+ setTimeout(() => {
+ if (_item) {
+ list.value = modifyArrayList(unref(list), _item);
+ }
+ resolve({});
+ }, time);
+ }
+ }
+ }
+ })
+
+ // 产品状态
+ const diagnoseProduct = () => new Promise(async (resolve) => {
+ if (unref(device).state?.value === 'online') {
+ setTimeout(() => {
+ list.value = modifyArrayList(unref(list), {
+ key: 'product',
+ name: '产品状态',
+ desc: '诊断产品状态是否正常,禁用状态将导致设备连接失败',
+ status: 'success',
+ text: '正常',
+ info: null,
+ });
+ resolve({});
+ }, time);
+ } else {
+ const _device = unref(device)
+ if (_device.productId) {
+ const response: Record = await queryProductState(_device.productId)
+ if (response.status === 200) {
+ product.value = response.result
+ let _item: ListProps | undefined = undefined
+ const state = response.result?.state
+ _item = {
+ key: 'product',
+ name: '产品状态',
+ desc: '诊断产品状态是否正常,禁用状态将导致设备连接失败',
+ status: state === 1 ? 'success' : 'error',
+ text: state === 1 ? '正常' : '异常',
+ info:
+ state === 1 ? null : (
+
+
+
+ 产品已禁用,请 {
+ const resp = await _deployProduct(unref(device).productId || '');
+ if (resp.status === 200) {
+ message.success('操作成功!');
+ list.value = modifyArrayList(
+ list.value,
+ {
+ key: 'product',
+ name: '产品状态',
+ desc: '诊断产品状态是否正常,禁用状态将导致设备连接失败',
+ status: 'success',
+ text: '正常',
+ info: null,
+ },
+ );
+ }
+ }}
+ >
+ 启用
+
+ 产品
+
+ }
+ />
+
+
+ ),
+ };
+ setTimeout(() => {
+ if (_item) {
+ list.value = modifyArrayList(unref(list), _item);
+ }
+ resolve({});
+ }, time);
+ }
+ }
+ }
+ })
+
+ // 设备状态
+ const diagnoseDevice = () => new Promise(resolve => {
+ const _device = unref(device)
+ if (_device.state?.value === 'online') {
+ setTimeout(() => {
+ list.value = modifyArrayList(unref(list), {
+ key: 'device',
+ name: '设备状态',
+ desc: '诊断设备状态是否正常,禁用状态将导致设备连接失败',
+ status: 'success',
+ text: '正常',
+ info: null,
+ });
+ resolve({});
+ }, time);
+ } else {
+ let item: ListProps | undefined = undefined;
+ if (_device.state?.value === 'notActive') {
+ item = {
+ key: 'device',
+ name: '设备状态',
+ desc: '诊断设备状态是否正常,禁用状态将导致设备连接失败',
+ status: 'error',
+ text: '异常',
+ info: (
+
+
+
+ 设备已禁用,请 {
+ const resp = await _deploy(unref(device)?.id || '');
+ if (resp.status === 200) {
+ instanceStore.current.state = { value: 'offline', text: '离线' }
+ message.success('操作成功!');
+ list.value = modifyArrayList(
+ list.value,
+ {
+ key: 'device',
+ name: '设备状态',
+ desc: '诊断设备状态是否正常,禁用状态将导致设备连接失败',
+ status: 'success',
+ text: '正常',
+ info: null,
+ },
+ );
+ }
+ }}
+ >
+ 启用
+ 设备
+
+ }
+ />
+
+
+ ),
+ };
+ } else {
+ item = {
+ key: 'device',
+ name: '设备状态',
+ desc: '诊断设备状态是否正常,禁用状态将导致设备连接失败',
+ status: 'success',
+ text: '正常',
+ info: null,
+ };
+ }
+ setTimeout(() => {
+ if (item) {
+ list.value = modifyArrayList(unref(list), item);
+ }
+ resolve({});
+ }, time);
+ }
+ })
+
+ // 产品认证配置
+ const diagnoseProductAuthConfig = () => new Promise(async (resolve) => {
+ const _device = unref(device)
+ if (_device.productId) {
+ const response: Record = await queryProductConfig(_device.productId)
+ if (response.status === 200 && response.result.length > 0) {
+ configuration.product = response.result;
+ const _configuration = unref(product)?.configuration || {};
+ response.result.map((item: any, i: number) => {
+ const _list = [...list.value];
+ if (!_.map(_list, 'key').includes(`product-auth${i}`)) {
+ list.value = modifyArrayList(
+ list.value,
+ {
+ key: `product-auth${i}`,
+ name: `产品-${item?.name}`,
+ desc: '诊断产品MQTT认证配置是否正确,错误的配置将导致连接失败',
+ status: 'loading',
+ text: '正在诊断中...',
+ info: null,
+ },
+ list.value.length,
+ );
+ }
+ const properties = _.map(item?.properties, 'property');
+ if (unref(device).state?.value === 'online') {
+ setTimeout(() => {
+ list.value = modifyArrayList(list.value, {
+ key: `product-auth${i}`,
+ name: `产品-${item?.name}`,
+ desc: '诊断产品MQTT认证配置是否正确,错误的配置将导致连接失败',
+ status: 'success',
+ text: '正常',
+ info: null,
+ });
+ resolve({});
+ }, time);
+ } else if (
+ !isExit(
+ properties,
+ Object.keys(_configuration).filter((k: string) => !!_configuration[k]),
+ )
+ ) {
+ setTimeout(() => {
+ list.value = modifyArrayList(list.value, {
+ key: `product-auth${i}`,
+ name: `产品-${item?.name}`,
+ desc: '诊断产品MQTT认证配置是否正确,错误的配置将导致连接失败',
+ status: 'error',
+ text: '异常',
+ info: (
+
+
+
+ 请根据设备接入配置需要
+ {
+ jumpAccessConfig();
+ }}
+ >
+ 填写
+
+ ,若您确定该项无需诊断可
+ {
+ list.value = modifyArrayList(
+ list.value,
+ {
+ key: `product-auth${i}`,
+ name: `产品-${item?.name}`,
+ desc: '诊断产品MQTT认证配置是否正确,错误的配置将导致连接失败',
+ status: 'success',
+ text: '正常',
+ info: null,
+ },
+ );
+ }}
+ >
+ 忽略
+
+
+ }
+ />
+
+
+ ),
+ });
+ resolve({});
+ }, time);
+ } else {
+ setTimeout(() => {
+ list.value = modifyArrayList(list.value, {
+ key: `product-auth${i}`,
+ name: `产品-${item?.name}`,
+ desc: '诊断产品MQTT认证配置是否正确,错误的配置将导致连接失败',
+ status: 'warning',
+ text: '可能存在异常',
+ info: (
+
+
+
+ 请
+ {
+ manualInspection({
+ type: 'product',
+ key: `product-auth${i}`,
+ name: `产品-${item?.name}`,
+ desc: '诊断产品MQTT认证配置是否正确,错误的配置将导致连接失败',
+ data: { ...item },
+ configuration,
+ productId: unref(device).productId,
+ });
+ }}
+ >
+ 人工检查
+
+ 产品{item.name}
+ 配置是否已填写正确,若您确定该项无需诊断可
+ {
+ list.value = modifyArrayList(
+ list.value,
+ {
+ key: `product-auth${i}`,
+ name: `产品-${item?.name}`,
+ desc: '诊断产品MQTT认证配置是否正确,错误的配置将导致连接失败',
+ status: 'success',
+ text: '正常',
+ info: null,
+ },
+ );
+ }}
+ >
+ 忽略
+
+
+ }
+ />
+
+
+ ),
+ });
+ resolve({});
+ }, time);
+ }
+ });
+ } else {
+ resolve({});
+ }
+ }
+ })
+
+ // 设备认证配置
+ const diagnoseDeviceAuthConfig = () => new Promise(async (resolve) => {
+ const _device = unref(device)
+ if (_device.id) {
+ const response: Record = await queryDeviceConfig(_device.id)
+ if (response.status === 200 && response.result.length > 0) {
+ configuration.device = response.result;
+ const _configuration = _device?.configuration || {};
+ response.result.map((item: any, i: number) => {
+ const _list = [...list.value];
+ if (!_.map(_list, 'key').includes(`device-auth${i}`)) {
+ list.value = modifyArrayList(
+ list.value,
+ {
+ key: `device-auth${i}`,
+ name: `设备-${item?.name}`,
+ desc: '诊断设备MQTT认证配置是否正确,错误的配置将导致连接失败',
+ status: 'loading',
+ text: '正在诊断中...',
+ info: null,
+ },
+ list.value.length,
+ );
+ }
+ const properties = _.map(item?.properties, 'property');
+ if (_device.state?.value === 'online') {
+ setTimeout(() => {
+ list.value = modifyArrayList(list.value, {
+ key: `device-auth${i}`,
+ name: `设备-${item?.name}`,
+ desc: '诊断设备MQTT认证配置是否正确,错误的配置将导致连接失败',
+ status: 'success',
+ text: '正常',
+ info: null,
+ });
+ resolve({});
+ }, time);
+ } else if (
+ !isExit(
+ properties,
+ Object.keys(_configuration).filter((k: string) => !!_configuration[k]),
+ )
+ ) {
+ setTimeout(() => {
+ list.value = modifyArrayList(list.value, {
+ key: `device-auth${i}`,
+ name: `设备-${item?.name}`,
+ desc: '诊断设备MQTT认证配置是否正确,错误的配置将导致连接失败',
+ status: 'error',
+ text: '异常',
+ info: (
+
+
+
+ 请根据设备接入配置需要
+ {
+ jumpDeviceConfig();
+ }}
+ >
+ 填写
+
+ ,若您确定该项无需诊断可
+ {
+ list.value = modifyArrayList(
+ list.value,
+ {
+ key: `device-auth${i}`,
+ name: `设备-${item?.name}`,
+ desc: '诊断设备MQTT认证配置是否正确,错误的配置将导致连接失败',
+ status: 'success',
+ text: '正常',
+ info: null,
+ },
+ );
+ }}
+ >
+ 忽略
+
+
+ }
+ />
+
+
+ ),
+ });
+ resolve({});
+ }, time);
+ } else {
+ setTimeout(() => {
+ list.value = modifyArrayList(list.value, {
+ key: `device-auth${i}`,
+ name: `设备-${item?.name}`,
+ desc: '诊断设备MQTT认证配置是否正确,错误的配置将导致连接失败',
+ status: 'warning',
+ text: '可能存在异常',
+ info: (
+
+
+
+ 请
+ {
+ manualInspection({
+ type: 'device',
+ key: `device-auth${i}`,
+ name: `设备-${item?.name}`,
+ desc: '诊断设备MQTT认证配置是否正确,错误的配置将导致连接失败',
+ data: { ...item },
+ configuration,
+ productId: unref(device).productId,
+ });
+ }}
+ >
+ 人工检查
+
+ 设备{item.name}
+ 配置是否已填写正确,若您确定该项无需诊断可
+ {
+ list.value = modifyArrayList(
+ list.value,
+ {
+ key: `device-auth${i}`,
+ name: `设备-${item?.name}`,
+ desc: '诊断设备MQTT认证配置是否正确,错误的配置将导致连接失败',
+ status: 'success',
+ text: '正常',
+ info: null,
+ },
+ );
+ }}
+ >
+ 忽略
+
+
+ }
+ />
+
+
+ ),
+ });
+ resolve({});
+ }, time);
+ }
+ });
+ } else {
+ resolve({});
+ }
+ }
+ })
+
+ // onenet
+ const diagnoseOnenet = () => new Promise(async (resolve) => {
+ const _device = unref(device)
+ if (_device?.accessProvider === 'OneNet') {
+ const response: any = await queryDeviceConfig(_device?.id || '');
+ configuration.device = response.result;
+ const _configuration = _device?.configuration || {};
+ let item: ListProps | undefined = undefined;
+ if (
+ _device.configuration?.onenet_imei ||
+ _device.configuration?.onenet_imsi ||
+ (unref(product)?.configuration &&
+ unref(product)?.configuration['api-key'])
+ ) {
+ item = {
+ key: `onenet`,
+ name: `设备-OneNet配置`,
+ desc: '诊断设备OneNet是否已配置,未配置将导致连接失败',
+ status: 'warning',
+ text: '可能存在异常',
+ info: (
+
+
+ 请
+
{
+ manualInspection({
+ type: 'device',
+ key: `onenet`,
+ name: `设备-OneNet配置`,
+ desc: '诊断设备OneNet是否已配置,未配置将导致连接失败',
+ data: { ...response.result[0] },
+ configuration: _configuration,
+ });
+ }}
+ >
+ 人工检查
+
+ 设备-OneNet配置是否已填写正确,若您确定该项无需诊断可
+
{
+ list.value = modifyArrayList(list.value, {
+ key: `onenet`,
+ name: `设备-OneNet配置`,
+ desc: '诊断设备OneNet是否已配置,未配置将导致连接失败',
+ status: 'success',
+ text: '正常',
+ info: null,
+ });
+ }}
+ >
+ 忽略
+
+
+
+ ),
+ };
+ } else {
+ item = {
+ key: `onenet`,
+ name: `设备-OneNet配置`,
+ desc: '诊断设备OneNet是否已配置,未配置将导致连接失败',
+ status: 'error',
+ text: '异常',
+ info: (
+
+
+ 请根据设备接入配置需要
+
{
+ jumpDeviceConfig();
+ }}
+ >
+ 填写
+
+ ,若您确定该项无需诊断可
+
{
+ list.value = modifyArrayList(list.value, {
+ key: `onenet`,
+ name: `设备-OneNet配置`,
+ desc: '诊断设备OneNet是否已配置,未配置将导致连接失败',
+ status: 'success',
+ text: '正常',
+ info: null,
+ });
+ }}
+ >
+ 忽略
+
+
+
+ ),
+ };
+ }
+ setTimeout(() => {
+ if (item) {
+ list.value = modifyArrayList(
+ list.value,
+ item,
+ list.value.length,
+ );
+ }
+ resolve({});
+ }, time);
+ } else {
+ resolve({});
+ }
+ })
+
+ // ctwing
+ const diagnoseCTWing = () => new Promise(async (resolve) => {
+ const _device = unref(device)
+ if (_device?.accessProvider === 'Ctwing') {
+ const response: any = await queryDeviceConfig(_device?.id || '');
+ configuration.device = response.result;
+ const _configuration = _device?.configuration || {};
+ let item: ListProps | undefined = undefined;
+ const config = unref(product)?.configuration;
+ if (
+ _device.configuration?.ctwing_imei ||
+ _device.configuration?.ctwing_imsi ||
+ (config && (config.ctwing_product_id || config.master_key))
+ ) {
+ item = {
+ key: `ctwing`,
+ name: `设备-CTWing配置`,
+ desc: '诊断设备CTWing是否已配置,未配置将导致连接失败',
+ status: 'warning',
+ text: '可能存在异常',
+ info: (
+
+
+ 请
+
{
+ manualInspection({
+ type: 'device',
+ key: `ctwing`,
+ name: `设备-CTWing配置`,
+ desc: '诊断设备CTWing是否已配置,未配置将导致连接失败',
+ data: { ...response.result[0] },
+ configuration: _configuration,
+ });
+ }}
+ >
+ 人工检查
+
+ 设备-CTWing配置是否已填写正确,若您确定该项无需诊断可
+
{
+ list.value = modifyArrayList(list.value, {
+ key: `ctwing`,
+ name: `设备-CTWing配置`,
+ desc: '诊断设备CTWing是否已配置,未配置将导致连接失败',
+ status: 'success',
+ text: '正常',
+ info: null,
+ });
+ }}
+ >
+ 忽略
+
+
+
+ ),
+ };
+ } else {
+ item = {
+ key: `ctwing`,
+ name: `设备-CTWing配置`,
+ desc: '诊断设备CTWing是否已配置,未配置将导致连接失败',
+ status: 'error',
+ text: '异常',
+ info: (
+
+
+ 请根据设备接入配置需要
+
{
+ jumpDeviceConfig();
+ }}
+ >
+ 填写
+
+ ,若您确定该项无需诊断可
+
{
+ list.value = modifyArrayList(list.value, {
+ key: `ctwing`,
+ name: `设备-CTWing配置`,
+ desc: '诊断设备CTWing是否已配置,未配置将导致连接失败',
+ status: 'success',
+ text: '正常',
+ info: null,
+ });
+ }}
+ >
+ 忽略
+
+
+
+ ),
+ };
+ }
+ setTimeout(() => {
+ if (item) {
+ list.value = modifyArrayList(
+ list.value,
+ item,
+ list.value.length,
+ );
+ }
+ resolve({});
+ }, time);
+ } else {
+ resolve({});
+ }
+ })
+
+ const diagnoseNetworkOtherConfig = async () => {
+ if (unref(device).state?.value != 'online') {
+ const item: VNode[] = [];
+ let info: any = {
+ id: unref(device).id,
+ };
+ item.push( );
+ if (props.providerType === 'network') {
+ item.push(
+ 1 ? (
+ <>
+ 请检查设备网络是否畅通,并确保设备已连接到以下地址之一:
+
+ {(unref(gateway)?.channelInfo?.addresses || []).map((i: any) => (
+
+
+ {i.address}
+
+ ))}
+
+ >
+ ) : (
+ <>
+ 请检查设备网络是否畅通,并确保设备已连接到:
+ {(unref(gateway)?.channelInfo?.addresses || []).map((i: any) => (
+
+
+ {i.address}
+
+ ))}
+ >
+ )
+ }
+ />,
+ );
+ if (
+ unref(device)?.protocol &&
+ unref(device)?.accessProvider &&
+ gatewayList.includes(unref(device).accessProvider as string)
+ ) {
+ const response = await queryProtocolDetail(unref(device).protocol, 'MQTT');
+ if (response.status === 200) {
+ if ((response.result?.routes || []).length > 0) {
+ item.push(
+
+ 请根据
+ {
+ jumpAccessConfig();
+ }}
+ >
+ 设备接入配置
+
+ 中${urlMap.get(unref(device)?.accessProvider) || ''}信息,任意上报一条数据
+
+ }
+ />,
+ );
+ } else {
+ item.push(
+
+ 请联系管理员提供${urlMap.get(unref(device)?.accessProvider) || ''}
+ 信息,并根据URL信息任意上报一条数据
+
+ }
+ />,
+ );
+ }
+ }
+ }
+ info = {
+ ...info,
+ address: unref(gateway)?.channelInfo?.addresses || [],
+ config: configuration.device || [],
+ };
+ } else if (props.providerType === 'child-device') {
+ if (unref(device)?.accessProvider === 'gb28181-2016') {
+ const address = unref(gateway)?.channelInfo?.addresses[0];
+ if (address) {
+ item.push(
+
+ 请检查设备网络是否畅通,并确保设备已连接到:SIP{' '}
+
+
+ {address.address}
+
+
+ }
+ />,
+ );
+ info = {
+ ...info,
+ address: [address] || [],
+ };
+ }
+ }
+ } else if (props.providerType === 'media') {
+ if (unref(device)?.accessProvider === 'gb28181-2016') {
+ const address = unref(gateway)?.channelInfo?.addresses[0];
+ if (address) {
+ item.push(
+
+ 请检查设备网络是否畅通,并确保设备已连接到:SIP{' '}
+
+
+ {address.address}
+
+
+ }
+ />,
+ );
+ info = {
+ ...info,
+ address: [address] || [],
+ };
+ }
+ }
+ } else if (props.providerType === 'cloud') {
+ item.push(
+ ,
+ );
+ item.push( );
+ } else if (props.providerType === 'channel') {
+ }
+ info = {
+ ...info,
+ configValue: unref(device)?.configuration || {},
+ };
+ diagnoseData.value = {
+ list: [...item],
+ info,
+ }
+ diagnoseVisible.value = true
+ } else {
+ emit('stateChange', 'success')
+ }
+ };
+
+ const handleSearch = async () => {
+ emit('percentChange', 0)
+ emit('countChange', 0)
+ emit('stateChange', 'loading')
+ status.value = 'loading'
+ const { providerType } = props
+ let arr: any[] = [];
+ if (providerType === 'network') {
+ list.value = [...networkInitList];
+ arr = [
+ diagnoseNetwork,
+ diagnoseGateway,
+ diagnoseProduct,
+ diagnoseDevice,
+ diagnoseProductAuthConfig,
+ diagnoseDeviceAuthConfig,
+ ];
+ } else if (providerType === 'child-device') {
+ list.value = [...childInitList];
+ arr = [
+ diagnoseGateway,
+ diagnoseParentDevice,
+ diagnoseProduct,
+ diagnoseDevice,
+ diagnoseProductAuthConfig,
+ diagnoseDeviceAuthConfig,
+ ];
+ } else if (providerType === 'media') {
+ list.value = [...mediaInitList];
+ arr = [diagnoseGateway, diagnoseProduct, diagnoseDevice];
+ } else if (providerType === 'cloud') {
+ list.value = [...cloudInitList];
+ arr = [diagnoseGateway, diagnoseProduct, diagnoseDevice, diagnoseCTWing, diagnoseOnenet];
+ } else if (providerType === 'channel') {
+ message.error('未开发');
+ return;
+ }
+ if (arr.length > 0) {
+ for (let i = 0; i < arr.length; i++) {
+ await arr[i]();
+ emit('percentChange')
+ }
+ emit('percentChange', 100)
+ status.value = 'finish'
+ }
+ }
+
+ watch(() => props.providerType, (newVal) => {
+ if (newVal) {
+ device.value = instanceStore.current
+ handleSearch()
+ }
+ }, { deep: true, immediate: true })
+
+ watch(() => [list, status], () => {
+ if (status.value === 'finish') {
+ const _list = _.uniq(_.map(unref(list), 'status'));
+ if (unref(device).state?.value !== 'online') {
+ emit('stateChange', 'error')
+ if (_list[0] === 'success' && _list.length === 1) {
+ diagnoseNetworkOtherConfig();
+ }
+ } else {
+ emit('stateChange', 'success')
+ }
+ } else if (status.value === 'loading') {
+ const arr = _.map(unref(list), 'status').filter((i) => i !== 'loading');
+ emit('countChange', arr.length)
+ }
+ }, { deep: true, immediate: true })
+
+ return () =>
+
+
+ {
+ list.value.map(item => (
+
+
+
+
+
+
+
{item?.name}
+
{item.desc}
+
{item?.info}
+
+
+
+ {item?.text}
+
+
+ ))
+ }
+
+ {
+ diagnoseVisible.value &&
{
+ diagnoseVisible.value = false
+ }}
+ />
+ }
+ {artificialVisible.value && (
+ {
+ artificialVisible.value = false
+ }}
+ onSave={(params: any) => {
+ list.value = modifyArrayList(list.value, {
+ key: params.key,
+ name: params.name,
+ desc: params.desc,
+ status: 'success',
+ text: '正常',
+ info: null,
+ });
+ artificialVisible.value = false
+ }}
+ />
+ )}
+
+ },
+})
+
+export default Status
\ No newline at end of file
diff --git a/src/views/device/Instance/Detail/Diagnose/Status/util.ts b/src/views/device/Instance/Detail/Diagnose/Status/util.ts
new file mode 100644
index 00000000..11811906
--- /dev/null
+++ b/src/views/device/Instance/Detail/Diagnose/Status/util.ts
@@ -0,0 +1,262 @@
+import { getImage } from '@/utils/comm';
+import { VNode } from 'vue';
+
+export type ListProps = {
+ key: string;
+ name: string;
+ desc?: string;
+ status: 'loading' | 'error' | 'success' | 'warning';
+ text?: string;
+ info?: VNode | null;
+};
+
+export const TextColorMap = new Map();
+TextColorMap.set('loading', 'black');
+TextColorMap.set('error', 'red');
+TextColorMap.set('success', 'green');
+TextColorMap.set('warning', '#FAB247');
+
+export const StatusMap = new Map();
+StatusMap.set('error', getImage('/diagnose/status/error.png'));
+StatusMap.set('success', getImage('/diagnose/status/success.png'));
+StatusMap.set('warning', getImage('/diagnose/status/warning.png'));
+StatusMap.set('loading', getImage('/diagnose/status/loading.png'));
+
+export const networkInitList: ListProps[] = [
+ // {
+ // key: 'access',
+ // name: '设备接入配置',
+ // desc: '诊断该设备所属产品是否已配置“设备接入”方式,未配置将导致设备连接失败。',
+ // status: 'loading',
+ // text: '正在诊断中...',
+ // info: null,
+ // },
+ {
+ key: 'network',
+ name: '网络组件',
+ desc: '诊断网络组件配置是否正确,配置错误将导致设备连接失败',
+ status: 'loading',
+ text: '正在诊断中...',
+ info: null,
+ },
+ {
+ key: 'gateway',
+ name: '设备接入网关',
+ desc: '诊断设备接入网关状态是否正常,禁用状态将导致连接失败',
+ status: 'loading',
+ text: '正在诊断中...',
+ info: null,
+ },
+ {
+ key: 'product',
+ name: '产品状态',
+ desc: '诊断产品状态是否正常,禁用状态将导致设备连接失败',
+ status: 'loading',
+ text: '正在诊断中...',
+ info: null,
+ },
+ {
+ key: 'device',
+ name: '设备状态',
+ desc: '诊断设备状态是否正常,禁用状态将导致设备连接失败',
+ status: 'loading',
+ text: '正在诊断中...',
+ info: null,
+ },
+];
+
+export const childInitList: ListProps[] = [
+ // {
+ // key: 'access',
+ // name: '设备接入配置',
+ // desc: '诊断该设备所属产品是否已配置“设备接入”方式,未配置将导致设备连接失败。',
+ // status: 'loading',
+ // text: '正在诊断中...',
+ // info: null,
+ // },
+ // {
+ // key: 'network',
+ // name: '网络组件',
+ // desc: '诊断网络组件配置是否正确,配置错误将导致设备连接失败',
+ // status: 'loading',
+ // text: '正在诊断中...',
+ // info: null,
+ // },
+ {
+ key: 'gateway',
+ name: '设备接入网关',
+ desc: '诊断设备接入网关状态是否正常,网关配置是否正确',
+ status: 'loading',
+ text: '正在诊断中...',
+ info: null,
+ },
+ {
+ key: 'parent-device',
+ name: '网关父设备',
+ desc: '诊断网关父设备状态是否正常,禁用或离线将导致连接失败',
+ status: 'loading',
+ text: '正在诊断中...',
+ info: null,
+ },
+ {
+ key: 'product',
+ name: '产品状态',
+ desc: '诊断产品状态是否正常,禁用状态将导致设备连接失败',
+ status: 'loading',
+ text: '正在诊断中...',
+ info: null,
+ },
+ {
+ key: 'device',
+ name: '设备状态',
+ desc: '诊断设备状态是否正常,禁用状态将导致设备连接失败',
+ status: 'loading',
+ text: '正在诊断中...',
+ info: null,
+ },
+];
+
+export const cloudInitList: ListProps[] = [
+ // {
+ // key: 'access',
+ // name: '设备接入配置',
+ // desc: '诊断该设备所属产品是否已配置“设备接入”方式,未配置将导致设备连接失败。',
+ // status: 'loading',
+ // text: '正在诊断中...',
+ // info: null,
+ // },
+ {
+ key: 'gateway',
+ name: '设备接入网关',
+ desc: '诊断设备接入网关状态是否正常,网关配置是否正确',
+ status: 'loading',
+ text: '正在诊断中...',
+ info: null,
+ },
+ {
+ key: 'product',
+ name: '产品状态',
+ desc: '诊断产品状态是否正常,禁用状态将导致设备连接失败',
+ status: 'loading',
+ text: '正在诊断中...',
+ info: null,
+ },
+ {
+ key: 'device',
+ name: '设备状态',
+ desc: '诊断设备状态是否正常,禁用状态将导致设备连接失败',
+ status: 'loading',
+ text: '正在诊断中...',
+ info: null,
+ },
+];
+
+export const channelInitList: ListProps[] = [
+ // {
+ // key: 'access',
+ // name: '设备接入配置',
+ // desc: '诊断该设备所属产品是否已配置“设备接入”方式,未配置将导致设备连接失败。',
+ // status: 'loading',
+ // text: '正在诊断中...',
+ // info: null,
+ // },
+ {
+ key: 'gateway',
+ name: '设备接入网关',
+ desc: '诊断设备接入网关状态是否正常,禁用状态将导致连接失败',
+ status: 'loading',
+ text: '正在诊断中...',
+ info: null,
+ },
+ {
+ key: 'product',
+ name: '产品状态',
+ desc: '诊断产品状态是否正常,禁用状态将导致设备连接失败',
+ status: 'loading',
+ text: '正在诊断中...',
+ info: null,
+ },
+ {
+ key: 'device',
+ name: '设备状态',
+ desc: '诊断设备状态是否正常,禁用状态将导致设备连接失败',
+ status: 'loading',
+ text: '正在诊断中...',
+ info: null,
+ },
+];
+
+export const mediaInitList: ListProps[] = [
+ // {
+ // key: 'access',
+ // name: '设备接入配置',
+ // desc: '诊断该设备所属产品是否已配置“设备接入”方式,未配置将导致设备连接失败。',
+ // status: 'loading',
+ // text: '正在诊断中...',
+ // info: null,
+ // },
+ {
+ key: 'gateway',
+ name: '设备接入网关',
+ desc: '诊断设备接入网关状态是否正常,禁用状态将导致连接失败',
+ status: 'loading',
+ text: '正在诊断中...',
+ info: null,
+ },
+ {
+ key: 'product',
+ name: '产品状态',
+ desc: '诊断产品状态是否正常,禁用状态将导致设备连接失败',
+ status: 'loading',
+ text: '正在诊断中...',
+ info: null,
+ },
+ {
+ key: 'device',
+ name: '设备状态',
+ desc: '诊断设备状态是否正常,禁用状态将导致设备连接失败',
+ status: 'loading',
+ text: '正在诊断中...',
+ info: null,
+ },
+];
+
+export const modifyArrayList = (oldList: ListProps[], item: ListProps, index?: number) => {
+ let newList: ListProps[] = [];
+ if (index !== 0 && !index) {
+ // 添加
+ for (let i = 0; i < oldList.length; i++) {
+ const dt = oldList[i];
+ if (item.key === dt.key) {
+ newList.push(item);
+ } else {
+ newList.push(dt);
+ }
+ }
+ } else {
+ // 修改
+ oldList.splice(index, 0, item);
+ newList = [...oldList];
+ }
+ return newList;
+};
+
+export const isExit = (arr1: any[], arr2: any[]) => {
+ return arr1.find((item) => arr2.includes(item));
+};
+
+export const gatewayList = [
+ 'websocket-server',
+ 'http-server-gateway',
+ 'udp-device-gateway',
+ 'coap-server-gateway',
+ 'mqtt-client-gateway',
+ 'tcp-server-gateway',
+];
+
+export const urlMap = new Map();
+urlMap.set('mqtt-client-gateway', 'topic');
+urlMap.set('http-server-gateway', 'url');
+urlMap.set('websocket-server', 'url');
+urlMap.set('coap-server-gateway', 'url');
+
diff --git a/src/views/device/Instance/Detail/Diagnose/index.vue b/src/views/device/Instance/Detail/Diagnose/index.vue
new file mode 100644
index 00000000..c1180ffc
--- /dev/null
+++ b/src/views/device/Instance/Detail/Diagnose/index.vue
@@ -0,0 +1,201 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/device/Instance/Detail/Diagnose/util.ts b/src/views/device/Instance/Detail/Diagnose/util.ts
new file mode 100644
index 00000000..ad5ac915
--- /dev/null
+++ b/src/views/device/Instance/Detail/Diagnose/util.ts
@@ -0,0 +1,30 @@
+import { getImage } from '@/utils/comm';
+
+export const headerImgMap = new Map();
+headerImgMap.set('loading', getImage('/diagnose/loading-2.png'));
+headerImgMap.set('error', getImage('/diagnose/error.png'));
+headerImgMap.set('success', getImage('/diagnose/success.png'));
+
+export const headerColorMap = new Map();
+headerColorMap.set('loading', 'linear-gradient(89.95deg, #E6F5FF 0.03%, #E9EAFF 99.95%)');
+headerColorMap.set(
+ 'error',
+ 'linear-gradient(89.95deg, rgba(231, 173, 86, 0.1) 0.03%, rgba(247, 111, 93, 0.1) 99.95%)',
+);
+headerColorMap.set('success', 'linear-gradient(89.95deg, #E8F8F7 0.03%, #EBEFFA 99.95%)');
+
+
+export const headerTitleMap = new Map();
+headerTitleMap.set('loading', '正在诊断中');
+headerTitleMap.set('error', '发现连接问题');
+headerTitleMap.set('success', '连接状态正常');
+
+export const headerDescMap = new Map();
+headerDescMap.set('loading', '已诊断XX个');
+headerDescMap.set('error', '请处理连接异常');
+headerDescMap.set('success', '现在可调试消息通信');
+
+export const progressMap = new Map();
+progressMap.set('loading', '#597EF7');
+progressMap.set('error', '#FAB247');
+progressMap.set('success', '#32D4A4');
diff --git a/src/views/device/Instance/Detail/index.vue b/src/views/device/Instance/Detail/index.vue
index 2e4c2609..d7a90c8e 100644
--- a/src/views/device/Instance/Detail/index.vue
+++ b/src/views/device/Instance/Detail/index.vue
@@ -44,6 +44,7 @@ import Info from './Info/index.vue';
import Running from './Running/index.vue'
import Metadata from '../../components/Metadata/index.vue';
import ChildDevice from './ChildDevice/index.vue';
+import Diagnose from './Diagnose/index.vue'
import { _deploy, _disconnect } from '@/api/device/instance'
import { message } from 'ant-design-vue';
import { getImage } from '@/utils/comm';
@@ -52,7 +53,7 @@ const route = useRoute();
const instanceStore = useInstanceStore()
const statusMap = new Map();
-statusMap.set('online', 'processing');
+statusMap.set('online', 'success');
statusMap.set('offline', 'error');
statusMap.set('notActive', 'warning');
@@ -72,7 +73,11 @@ const list = [
{
key: 'ChildDevice',
tab: '子设备'
- }
+ },
+ {
+ key: 'Diagnose',
+ tab: '设备诊断'
+ },
]
const tabs = {
@@ -80,6 +85,7 @@ const tabs = {
Metadata,
Running,
ChildDevice,
+ Diagnose
}
watch(
diff --git a/src/views/device/Instance/index.vue b/src/views/device/Instance/index.vue
index 4ef603ac..3270902a 100644
--- a/src/views/device/Instance/index.vue
+++ b/src/views/device/Instance/index.vue
@@ -1,6 +1,10 @@
-
+
>({});
@@ -290,33 +301,172 @@ const columns = [
title: 'ID',
dataIndex: 'id',
key: 'id',
+ search: {
+ type: 'string',
+ },
},
{
title: '设备名称',
dataIndex: 'name',
key: 'name',
+ search: {
+ type: 'string',
+ },
},
{
title: '产品名称',
dataIndex: 'productName',
key: 'productName',
+ search: {
+ type: 'select',
+ options: () =>
+ new Promise((resolve) => {
+ queryNoPagingPost({ paging: false }).then((resp: any) => {
+ resolve(
+ resp.result.map((item: any) => ({
+ label: item.name,
+ value: item.id,
+ })),
+ );
+ });
+ }),
+ },
},
{
title: '创建时间',
dataIndex: 'createTime',
key: 'createTime',
scopedSlots: true,
+ search: {
+ type: 'date',
+ },
},
{
title: '状态',
dataIndex: 'state',
key: 'state',
scopedSlots: true,
+ search: {
+ type: 'select',
+ options: [
+ { label: '禁用', value: 'notActive' },
+ { label: '离线', value: 'offline' },
+ { label: '在线', value: 'online' },
+ ],
+ },
+ },
+ {
+ key: 'classifiedId',
+ dataIndex: 'classifiedId',
+ title: '产品分类',
+ hideInTable: true,
+ search: {
+ type: 'treeSelect',
+ options: () =>
+ new Promise((resolve) => {
+ queryTree({ paging: false }).then((resp: any) => {
+ resolve(resp.result);
+ });
+ }),
+ },
+ },
+ {
+ key: 'accessProvider',
+ title: '网关类型',
+ dataIndex: 'accessProvider',
+ valueType: 'select',
+ hideInTable: true,
+ search: {
+ type: 'select',
+ options: () =>
+ new Promise((resolve) => {
+ getProviders().then((resp: any) => {
+ resolve(
+ resp.result.map((item: any) => ({
+ label: item.name,
+ value: `accessProvider is ${item.id}`,
+ })),
+ );
+ });
+ }),
+ },
+ },
+ {
+ key: 'productId$product-info',
+ dataIndex: 'productId$product-info',
+ title: '接入方式',
+ hideInTable: true,
+ search: {
+ type: 'select',
+ options: () =>
+ new Promise((resolve) => {
+ queryGatewayList({}).then((resp: any) => {
+ resolve(
+ resp.result.map((item: any) => ({
+ label: item.name,
+ value: `accessId is ${item.id}`,
+ })),
+ );
+ });
+ }),
+ },
+ },
+ {
+ dataIndex: 'deviceType',
+ title: '设备类型',
+ valueType: 'select',
+ hideInTable: true,
+ search: {
+ type: 'select',
+ options: [
+ { label: '直连设备', value: 'device' },
+ { label: '网关子设备', value: 'childrenDevice' },
+ { label: '网关设备', value: 'gateway' },
+ ],
+ },
+ },
+ {
+ dataIndex: 'id$dim-assets',
+ title: '所属组织',
+ hideInTable: true,
+ search: {
+ type: 'treeSelect',
+ options: () =>
+ new Promise((resolve) => {
+ queryOrgThree({}).then((resp: any) => {
+ const formatValue = (list: any[]) => {
+ const _list: any[] = [];
+ list.forEach((item) => {
+ if (item.children) {
+ item.children = formatValue(item.children);
+ }
+ _list.push({
+ ...item,
+ id: JSON.stringify({
+ assetType: 'device',
+ targets: [
+ {
+ type: 'org',
+ id: item.id,
+ },
+ ],
+ }),
+ });
+ });
+ return _list;
+ };
+ resolve(formatValue(resp.result));
+ });
+ }),
+ },
},
{
title: '说明',
dataIndex: 'describe',
key: 'describe',
+ search: {
+ type: 'string',
+ },
},
{
title: '操作',
@@ -543,4 +693,9 @@ const saveBtn = () => {
visible.value = false;
instanceRef.value?.reload();
};
+
+const handleSearch = (_params: any) => {
+ console.log(_params);
+ params.value = _params;
+};
diff --git a/src/views/northbound/AliCloud/Detail/index.vue b/src/views/northbound/AliCloud/Detail/index.vue
index 10b99894..80c8e421 100644
--- a/src/views/northbound/AliCloud/Detail/index.vue
+++ b/src/views/northbound/AliCloud/Detail/index.vue
@@ -11,143 +11,312 @@
>
-
-
+
+
-
+
服务地址
-
+
+ style="margin-left: 2px"
+ />
-
- {{item.name}}
+
+ {{ item.name }}
-
+
实例ID
-
+
+ style="margin-left: 2px"
+ />
-
+
-
+
accessKey
-
+
+ style="margin-left: 2px"
+ />
-
+
-
+
accessSecret
-
+
+ style="margin-left: 2px"
+ />
-
+
-
+ }"
+ >
网桥产品
-
+
+ style="margin-left: 2px"
+ />
-
- {{item.productName}}
+
+ {{
+ item.productName
+ }}
产品映射
-
-
-
+
+
+
-
-
- {{i.productName}}
+
+
+ {{
+ i.productName
+ }}
-
-
- {{i.name}}
+
+
+ {{
+ i.name
+ }}
@@ -156,17 +325,26 @@
-
+
添加
+ style="margin-left: 2px"
+ />添加
-
+
@@ -190,8 +373,14 @@
\ No newline at end of file
diff --git a/src/views/northbound/AliCloud/index.vue b/src/views/northbound/AliCloud/index.vue
index 3d4e8ccc..52228bac 100644
--- a/src/views/northbound/AliCloud/index.vue
+++ b/src/views/northbound/AliCloud/index.vue
@@ -1,6 +1,6 @@
-
+
i.key !== 'view');
return actions;
};
+
+const handleSearch = (_params: any) => {
+ params.value = _params
+}
diff --git a/src/views/northbound/DuerOS/Detail/command/index.vue b/src/views/northbound/DuerOS/Detail/command/index.vue
index 8a42b9b9..22271343 100644
--- a/src/views/northbound/DuerOS/Detail/command/index.vue
+++ b/src/views/northbound/DuerOS/Detail/command/index.vue
@@ -127,10 +127,15 @@ const funcChange = (val: string) => {
const saveBtn = () => new Promise((resolve) => {
formRef.value.validate()
.then(() => {
- resolve(toRaw(modelRef))
+ const _arr = toRaw(modelRef).value?.message?.inputs || []
+ if(_arr.length && !_arr.every((_a: any) => _a.value)){
+ resolve(false)
+ } else {
+ resolve(toRaw(modelRef))
+ }
})
.catch((err: any) => {
- resolve(false)
+ resolve(err)
});
})
diff --git a/src/views/northbound/DuerOS/Detail/index.vue b/src/views/northbound/DuerOS/Detail/index.vue
index 12db64a3..95102292 100644
--- a/src/views/northbound/DuerOS/Detail/index.vue
+++ b/src/views/northbound/DuerOS/Detail/index.vue
@@ -11,98 +11,247 @@
>
-
-
+
+
-
-
- {{item.name}}
+
+
+ {{ item.name }}
-
+ }"
+ >
设备类型
-
+
+ style="margin-left: 2px"
+ />
-
- {{item.name}}
+
+ {{ item.name }}
-
-
+
+
动作映射
-
-
-
+
+
+
-
+
动作
-
-
+
+
-
- {{i.name}}
+
+ {{
+ i.name
+ }}
-
+
操作
-
-
+
+
-
- 下发指令
- 获取历史数据
+
+ 下发指令
+ 获取历史数据
-
-
-
+
+
+
@@ -110,35 +259,118 @@
-
+
新增动作
+ style="margin-left: 2px"
+ />新增动作
属性映射
-
-
-
+
+
+
-
-
- {{i.name}}
+
+
+ {{
+ i.name
+ }}
-
-
- {{i.name}}
+
+
+ {{
+ i.name
+ }}
@@ -147,17 +379,26 @@
-
+
新增属性
+ style="margin-left: 2px"
+ />新增属性
-
+
@@ -181,9 +427,14 @@
\ No newline at end of file
diff --git a/src/views/northbound/DuerOS/index.vue b/src/views/northbound/DuerOS/index.vue
index c35da774..b1079742 100644
--- a/src/views/northbound/DuerOS/index.vue
+++ b/src/views/northbound/DuerOS/index.vue
@@ -1,6 +1,10 @@
-
+
-
+
@@ -43,9 +43,7 @@
-
- 产品
-
+ 产品
{{ slotProps?.productName }}
@@ -103,7 +101,7 @@
/>
- {{slotProps.applianceType.text}}
+ {{ slotProps.applianceType.text }}
@@ -145,12 +143,7 @@
From bc93563d12d3ca25a6022552cf43e3425e65c02c Mon Sep 17 00:00:00 2001
From: jackhoo_98
Date: Fri, 17 Feb 2023 18:14:09 +0800
Subject: [PATCH 4/5] =?UTF-8?q?feat:=20=E7=BD=91=E7=BB=9C=E7=BB=84?=
=?UTF-8?q?=E4=BB=B6=E8=AF=A6=E6=83=85=20=E4=BB=A3=E7=A0=81=E4=BC=98?=
=?UTF-8?q?=E5=8C=96=EF=BC=8C=E5=85=B1=E4=BA=AB/=E7=8B=AC=E7=AB=8B?=
=?UTF-8?q?=E9=85=8D=E7=BD=AE=E8=A1=A8=E5=8D=95=E6=A0=A1=E9=AA=8C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/link/Type/Detail/index copy.vue | 2238 --------------
src/views/link/Type/Detail/index.vue | 3267 ++++++++-------------
src/views/link/Type/data.ts | 216 +-
src/views/link/Type/type.d.ts | 63 +-
4 files changed, 1390 insertions(+), 4394 deletions(-)
delete mode 100644 src/views/link/Type/Detail/index copy.vue
diff --git a/src/views/link/Type/Detail/index copy.vue b/src/views/link/Type/Detail/index copy.vue
deleted file mode 100644
index fca55914..00000000
--- a/src/views/link/Type/Detail/index copy.vue
+++ /dev/null
@@ -1,2238 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 共享配置
- 独立配置
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/views/link/Type/Detail/index.vue b/src/views/link/Type/Detail/index.vue
index 3cc498d0..81191769 100644
--- a/src/views/link/Type/Detail/index.vue
+++ b/src/views/link/Type/Detail/index.vue
@@ -1,2025 +1,1084 @@
-
+
+
+
+ 新增
+
+
+
-
-
-
- 新增
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -2032,97 +1091,56 @@
-
-
-
diff --git a/src/views/link/Type/data.ts b/src/views/link/Type/data.ts
index 4de555c9..f8ebaaf3 100644
--- a/src/views/link/Type/data.ts
+++ b/src/views/link/Type/data.ts
@@ -1,7 +1,7 @@
-const configuration = {
+export const Configuration = {
parserType: undefined,
port: undefined,
- host: '0.0.0.0',
+ host: undefined,
publicPort: '',
publicHost: '',
remoteHost: '',
@@ -11,7 +11,7 @@ const configuration = {
password: '',
topicPrefix: '',
maxMessageSize: '',
- certId: '',
+ certId: undefined,
privateKeyAlias: '',
clientId: '',
parserConfiguration: {
@@ -29,24 +29,21 @@ export const FormStates = {
name: '',
type: 'UDP',
shareCluster: true,
- // configuration,
description: '',
};
export const FormStates2 = {
serverId: undefined,
- configuration,
+ configuration: Configuration,
};
-
-
-// export const DefaultCluster = {
-
-// }
-export const DefaultFormStates = {
- ...FormStates,
- cluster: [{ ...FormStates2, id: 1 }],
-};
+export const TCPList = [
+ 'TCP_SERVER',
+ 'WEB_SOCKET_SERVER',
+ 'HTTP_SERVER',
+ 'MQTT_SERVER',
+];
+export const UDPList = ['UDP', 'COAP_SERVER'];
const VisibleMost = [
'COAP_SERVER',
@@ -63,6 +60,7 @@ export const VisibleData = {
host: VisibleMost,
publicPort: VisibleMost,
publicHost: VisibleMost,
+ serverId: ['MQTT_CLIENT'],
remoteHost: ['MQTT_CLIENT'],
remotePort: ['MQTT_CLIENT'],
secure: ['TCP_SERVER', 'UDP', 'COAP_SERVER'],
@@ -114,3 +112,193 @@ export const Validator = {
),
regOnlyNumber: new RegExp(/^\d+$/),
};
+
+export const Rules = {
+ name: [
+ {
+ required: true,
+ message: '请输入名称',
+ },
+ {
+ max: 64,
+ message: '最大可输入64个字符',
+ },
+ ],
+ type: [
+ {
+ required: true,
+ message: '请选择类型',
+ },
+ ],
+ shareCluster: [
+ {
+ required: true,
+ message: '请选择集群',
+ },
+ ],
+ host: [
+ {
+ required: true,
+ message: '请选择本地地址',
+ },
+ ],
+ port: [
+ {
+ required: true,
+ message: '请选择本地端口',
+ },
+ ],
+ publicHost: [
+ {
+ required: true,
+ message: '请输入公网地址',
+ },
+ {
+ pattern: Validator.regIp || Validator.regDomain,
+ message: '请输入IP或者域名',
+ },
+ ],
+ publicPort: [
+ {
+ required: true,
+ message: '请输入公网端口',
+ },
+ {
+ pattern: Validator.regOnlyNumber,
+ message: '请输入1-65535之间的正整数',
+ },
+ ],
+ remoteHost: [
+ {
+ required: true,
+ message: '请输入远程地址',
+ },
+ {
+ pattern: Validator.regIp || Validator.regDomain,
+ message: '请输入IP或者域名',
+ },
+ ],
+ remotePort: [
+ {
+ required: true,
+ message: '输入远程端口',
+ },
+ {
+ pattern: Validator.regOnlyNumber,
+ message: '请输入1-65535之间的正整数',
+ },
+ ],
+ clientId: [
+ {
+ required: true,
+ message: '请输入ClientId',
+ },
+ {
+ max: 64,
+ message: '最大可输入64个字符',
+ },
+ ],
+ username: [
+ {
+ required: true,
+ message: '请输入用户名',
+ },
+ {
+ max: 64,
+ message: '最大可输入64个字符',
+ },
+ ],
+ password: [
+ {
+ required: true,
+ message: '请输入密码',
+ },
+ {
+ max: 64,
+ message: '最大可输入64个字符',
+ },
+ ],
+ topicPrefix: [
+ {
+ max: 64,
+ message: '最大可输入64个字符',
+ },
+ ],
+ maxMessageSize: [
+ {
+ max: 64,
+ message: '最大可输入64个字符',
+ },
+ ],
+ secure: [
+ {
+ required: true,
+ },
+ ],
+ certId: [
+ {
+ required: true,
+ message: '请选择证书',
+ },
+ ],
+ privateKeyAlias: [
+ {
+ required: true,
+ message: '请输入私钥别名',
+ },
+ {
+ max: 64,
+ message: '最大可输入64个字符',
+ },
+ ],
+ parserType: [
+ {
+ required: true,
+ message: '请选择粘拆包规则',
+ },
+ ],
+ delimited: [
+ {
+ required: true,
+ message: '请输入分隔符',
+ },
+ {
+ max: 64,
+ message: '最大可输入64个字符',
+ },
+ ],
+ lang: [
+ {
+ required: true,
+ message: '请选择脚本语言',
+ },
+ {
+ max: 64,
+ message: '最大可输入64个字符',
+ },
+ ],
+ script: [
+ {
+ required: true,
+ message: '请输入脚本',
+ },
+ ],
+ size: [
+ {
+ required: true,
+ message: '请输入长度值',
+ },
+ ],
+ length: [
+ {
+ required: true,
+ message: '请选择长度',
+ },
+ ],
+ offset: [
+ {
+ pattern: Validator.regOnlyNumber,
+ message: '请输入0-65535之间的正整数',
+ },
+ ],
+};
diff --git a/src/views/link/Type/type.d.ts b/src/views/link/Type/type.d.ts
index 7d33cc3b..ff456664 100644
--- a/src/views/link/Type/type.d.ts
+++ b/src/views/link/Type/type.d.ts
@@ -1,31 +1,38 @@
-export interface Form2 {
- id: number;
- serverId: string | undefined;
- configuration: {
- parserType: undefined;
- port: undefined;
- host: string;
- publicPort: string;
- publicHost: string;
- remoteHost: string;
- remotePort: string;
- secure: boolean;
- username: string;
- password: string;
- topicPrefix: string;
- maxMessageSize: string;
- certId: string;
- privateKeyAlias: string;
- clientId: string;
- parserConfiguration: {
- delimited: string;
- lang: string;
- script: string;
- size: string;
- length: string;
- offset: string;
- little: string | boolean;
- };
+export interface ConfigurationType {
+ parserType: string | undefined;
+ port: string | undefined;
+ host: string | undefined;;
+ publicPort: string;
+ publicHost: string;
+ remoteHost: string;
+ remotePort: string;
+ secure: boolean;
+ username: string;
+ password: string;
+ topicPrefix: string;
+ maxMessageSize: string;
+ certId: string | undefined;
+ privateKeyAlias: string;
+ clientId: string;
+ parserConfiguration: {
+ delimited: string;
+ lang: string;
+ script: string;
+ size: string;
+ length: string;
+ offset: string;
+ little: string | boolean;
};
+}
+
+export interface FormDataType {
+ name: string;
+ type: string;
+ shareCluster: boolean;
description: string;
}
+export interface FormData2Type {
+ id?: number | string;
+ serverId?: string | undefined;
+ configuration: ConfigurationType;
+}
From 42d49a308353a5ef01f43363b84e046cde347c09 Mon Sep 17 00:00:00 2001
From: easy <1358086367@qq.com>
Date: Fri, 17 Feb 2023 18:16:49 +0800
Subject: [PATCH 5/5] =?UTF-8?q?feat:=20=E7=B3=BB=E7=BB=9F=E7=AE=A1?=
=?UTF-8?q?=E7=90=86-=E6=95=B0=E6=8D=AE=E6=BA=90=E7=AE=A1=E7=90=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/system/dataSource.ts | 11 +
.../DataSource/components/EditDialog.vue | 224 +++++++++++++
src/views/system/DataSource/index.vue | 304 ++++++++++++++++++
src/views/system/DataSource/typing.d.ts | 24 ++
.../components/EditPermissionDialog.vue | 2 +-
src/views/system/Department/device/index.vue | 2 +-
src/views/system/Department/typing.d.ts | 4 +-
src/views/system/Relationship/index.vue | 6 +-
8 files changed, 570 insertions(+), 7 deletions(-)
create mode 100644 src/api/system/dataSource.ts
create mode 100644 src/views/system/DataSource/components/EditDialog.vue
create mode 100644 src/views/system/DataSource/index.vue
create mode 100644 src/views/system/DataSource/typing.d.ts
diff --git a/src/api/system/dataSource.ts b/src/api/system/dataSource.ts
new file mode 100644
index 00000000..46a59cff
--- /dev/null
+++ b/src/api/system/dataSource.ts
@@ -0,0 +1,11 @@
+import server from '@/utils/request';
+
+
+// 获取数据源列表
+export const getDataSourceList_api = (data: object) => server.post(`/datasource/config/_query/`, data);
+
+// 获取数据库类型字典
+export const getDataTypeDict_api = () => server.get(`/datasource/config/types`);
+
+// 修改数据源状态
+export const changeStatus_api = (id:string, status:'_disable'|'_enable') => server.put(`/datasource/config/${id}/${status}`);
\ No newline at end of file
diff --git a/src/views/system/DataSource/components/EditDialog.vue b/src/views/system/DataSource/components/EditDialog.vue
new file mode 100644
index 00000000..de689045
--- /dev/null
+++ b/src/views/system/DataSource/components/EditDialog.vue
@@ -0,0 +1,224 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/system/DataSource/index.vue b/src/views/system/DataSource/index.vue
new file mode 100644
index 00000000..0190f7e8
--- /dev/null
+++ b/src/views/system/DataSource/index.vue
@@ -0,0 +1,304 @@
+
+
+
+
+
+
+
+ 新增
+
+
+
+
+
+
+
+ {{
+ (table.typeOptions.value.length &&
+ table.getTypeLabel(slotProps.typeId)) ||
+ ''
+ }}
+
+
+
+
+
+
+
+ router.push(
+ `/system/DataSource/Management?id=${slotProps.id}`,
+ )
+ "
+ >
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/system/DataSource/typing.d.ts b/src/views/system/DataSource/typing.d.ts
new file mode 100644
index 00000000..1ece8c43
--- /dev/null
+++ b/src/views/system/DataSource/typing.d.ts
@@ -0,0 +1,24 @@
+export type dictItemType = {
+ id: string,
+ name: string
+}
+export type optionItemType = {
+ label: string,
+ value: string
+}
+export type sourceItemType = {
+ id?: string,
+ name: string,
+ state: { text: string, value: "enabled" | 'disabled' },
+ typeId: string,
+ shareConfig:{
+ url:string,
+ adminUrl:string,
+ addresses:string,
+ username:string,
+ password:string,
+ virtualHost:string,
+ schema:string
+ }
+ description: string
+}
\ No newline at end of file
diff --git a/src/views/system/Department/components/EditPermissionDialog.vue b/src/views/system/Department/components/EditPermissionDialog.vue
index 3a32b6a2..42182b6f 100644
--- a/src/views/system/Department/components/EditPermissionDialog.vue
+++ b/src/views/system/Department/components/EditPermissionDialog.vue
@@ -20,7 +20,7 @@