diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 94cefa4f..2f9b0654 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -19,5 +19,8 @@ module.exports = { rules: { // override/add rules settings here, such as: + }, + globals: { + NodeJS: 'readonly' } }; \ No newline at end of file diff --git a/package.json b/package.json index 2dc2ae7d..ea1e9abf 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "@commitlint/config-conventional": "^17.4.0", "@types/lodash-es": "^4.17.6", "@types/moment": "^2.13.0", - "@types/node": "^18.11.17", + "@types/node": "^18.14.0", "@vitejs/plugin-vue": "^4.0.0", "@vuemap/unplugin-resolver": "^1.0.4", "autoprefixer": "^10.4.13", diff --git a/src/api/comm.ts b/src/api/comm.ts index 29cf4f11..563871fb 100644 --- a/src/api/comm.ts +++ b/src/api/comm.ts @@ -27,4 +27,11 @@ export const deleteSearchHistory = (target:string, id:string) => server.remove server.get<{edition?: string}>('/system/version') \ No newline at end of file +export const systemVersion = () => server.get<{edition?: string}>('/system/version') + +/** + * 聚合查询 + * @param data + * @returns + */ +export const queryDashboard = (data: Record) => server.post(`/dashboard/_multi`, data) \ No newline at end of file diff --git a/src/api/device/instance.ts b/src/api/device/instance.ts index b221d6a8..cac9e9c2 100644 --- a/src/api/device/instance.ts +++ b/src/api/device/instance.ts @@ -315,6 +315,31 @@ export const getGatewayDetail = (id: string) => server.get(`/gateway/device/${id */ export const getUnit = () => server.get(`/protocol/units`) +/** + * 执行功能 + * @param deviceId 设备id + * @param functionId 功能id + * @param data + * @returns + */ +export const executeFunctions = (deviceId: string, functionId: string, data: any) => server.post(`/device/invoked/${deviceId}/function/${functionId}`, data) + +/** + * 读取属性 + * @param deviceId 设备id + * @param data + * @returns + */ +export const readProperties = (deviceId: string, data: any) => server.post(`/device/instance/${deviceId}/properties/_read`, data) + +/** + * 设置属性 + * @param deviceId 设备id + * @param data + * @returns + */ +export const settingProperties = (deviceId: string, data: any) => server.put(`/device/instance/${deviceId}/property`, data) + /** * 设备功能-执行 * @param id 设备id @@ -322,4 +347,4 @@ export const getUnit = () => server.get(`/protocol/units`) * @param data * @returns */ - export const execute = (id: string, action: string, data: any) => server.post(`/device/invoked/${id}/function/${action}`, data) \ No newline at end of file + export const execute = (id: string, action: string, data: any) => server.post(`/device/invoked/${id}/function/${action}`, data) diff --git a/src/api/link/type.ts b/src/api/link/type.ts index 887d395f..70e75bcf 100644 --- a/src/api/link/type.ts +++ b/src/api/link/type.ts @@ -30,3 +30,9 @@ export const allResources = () => server.get(`/network/resources/alive/_all`); export const certificates = () => server.get(`/network/certificate/_query/no-paging?paging=false`); + +export const save = (data: Object) => server.post(`/network/config`, data); + +export const update = (data: Object) => server.patch(`/network/config`, data); + +export const detail = (id: string) => server.get(`/network/config/${id}`); diff --git a/src/api/system/dataSource.ts b/src/api/system/dataSource.ts index 46a59cff..1698d020 100644 --- a/src/api/system/dataSource.ts +++ b/src/api/system/dataSource.ts @@ -3,9 +3,22 @@ import server from '@/utils/request'; // 获取数据源列表 export const getDataSourceList_api = (data: object) => server.post(`/datasource/config/_query/`, data); +// 获取数据源信息 +export const getDataSourceInfo_api = (id: string) => server.get(`/datasource/config/${id}`); // 获取数据库类型字典 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 +export const changeStatus_api = (id: string, status: '_disable' | '_enable') => server.put(`/datasource/config/${id}/${status}`); +// 新增/更新数据源 +export const saveDataSource_api = (data: any) => data.id ? server.patch(`datasource/config`, data) : server.post(`/datasource/config`, data) + +// 删除数据源 +export const delDataSource_api = (id: string) => server.remove(`/datasource/config/${id}`); +// 获取左侧树 +export const rdbTree_api = (id: string) => server.get(`/datasource/rdb/${id}/tables?includeColumns=false`); +// 获取右侧表格 +export const rdbTables_api = (id: string,key:string) => server.get(`/datasource/rdb/${id}/table/${key}`); +// 保存表格 +export const saveTable_api = (id: string,data:object) => server.patch(`/datasource/rdb/${id}/table`,data); diff --git a/src/components/MonacoEditor/index.vue b/src/components/MonacoEditor/index.vue index 6762be92..7a22d6b7 100644 --- a/src/components/MonacoEditor/index.vue +++ b/src/components/MonacoEditor/index.vue @@ -59,6 +59,20 @@ onMounted(() => { emit('update:modelValue', value); }); }); + +/** + * 代码格式化 + */ +const editorFormat = () => { + if (!instance) return; + instance.getAction('editor.action.formatDocument')?.run(); +}; + +watchEffect(() => { + setTimeout(() => { + editorFormat(); + }, 300); +}); \ 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 index 2a185673..16897d23 100644 --- a/src/views/device/Instance/Detail/Diagnose/Message/index.vue +++ b/src/views/device/Instance/Detail/Diagnose/Message/index.vue @@ -24,7 +24,7 @@
-
+
@@ -61,6 +61,10 @@ const messageArr = computed(() => { return arr.map(i => { return {...message[i], key: i}}) }) +const subscribeLog = () => { + +} + diff --git a/src/views/device/Instance/Detail/Diagnose/Status/ManualInspection.tsx b/src/views/device/Instance/Detail/Diagnose/Status/ManualInspection.tsx index cd066848..5482befe 100644 --- a/src/views/device/Instance/Detail/Diagnose/Status/ManualInspection.tsx +++ b/src/views/device/Instance/Detail/Diagnose/Status/ManualInspection.tsx @@ -20,7 +20,7 @@ const ManualInspection = defineComponent({ <>
- + 请检查配置项是否填写正确,若您确定该项无需诊断可
-
+
{(data?.data?.properties || []).map((item: any) => ( {data?.data?.description ? (

诊断项说明

{data?.data?.description}

@@ -60,7 +60,7 @@ const ManualInspection = defineComponent({ <>
- + 请检查配置项是否填写正确,若您确定该项无需诊断可
-
+
{data.configuration?.provider === 'OneNet' ? ( <> @@ -105,7 +105,7 @@ const ManualInspection = defineComponent({
{data?.configuration?.configuration?.description ? (

诊断项说明

{data?.configuration?.configuration?.description}

@@ -120,7 +120,7 @@ const ManualInspection = defineComponent({ <>
- + 请检查配置项是否填写正确,若您确定该项无需诊断可
-
+
{data?.configuration?.configuration?.shareCluster ? ( <> @@ -180,9 +180,9 @@ const ManualInspection = defineComponent({
- {data?.configuration?.configuration.description ? ( + {data?.configuration?.description ? (

诊断项说明

{data?.configuration?.description}

diff --git a/src/views/device/Instance/Detail/Diagnose/Status/index.tsx b/src/views/device/Instance/Detail/Diagnose/Status/index.tsx index db57848b..f075aea9 100644 --- a/src/views/device/Instance/Detail/Diagnose/Status/index.tsx +++ b/src/views/device/Instance/Detail/Diagnose/Status/index.tsx @@ -10,6 +10,7 @@ import { _deploy as _deployProduct } from "@/api/device/product" import _ from "lodash" import DiagnosticAdvice from './DiagnosticAdvice' import ManualInspection from './ManualInspection' +import { deployDevice } from "@/api/initHome" type TypeProps = 'network' | 'child-device' | 'media' | 'cloud' | 'channel' @@ -29,9 +30,9 @@ const Status = defineComponent({ const status = ref<'loading' | 'finish'>('loading') const device = ref(instanceStore.current) - const gateway = ref>>() // 网关信息 - const parent = ref>>() // 父设备 - const product = ref>>() // 产品 + const gateway = ref>>({}) // 网关信息 + const parent = ref>>({}) // 父设备 + const product = ref>>({}) // 产品 const artificialVisible = ref(false) const artificialData = ref>>() @@ -1332,7 +1333,7 @@ const Status = defineComponent({ unref(device)?.accessProvider && gatewayList.includes(unref(device).accessProvider as string) ) { - const response = await queryProtocolDetail(unref(device).protocol, 'MQTT'); + const response: any = await queryProtocolDetail(unref(device).protocol, 'MQTT'); if (response.status === 200) { if ((response.result?.routes || []).length > 0) { item.push( @@ -1521,9 +1522,103 @@ const Status = defineComponent({ { - status.value === 'finish' && unref(device).state?.value !== 'online' && + status.value === 'finish' && unref(device).state?.value !== 'online' && } - +
diff --git a/src/views/device/Instance/Detail/Running/Property/PropertyCard.vue b/src/views/device/Instance/Detail/Running/Property/PropertyCard.vue index dd63a89d..343cb6ef 100644 --- a/src/views/device/Instance/Detail/Running/Property/PropertyCard.vue +++ b/src/views/device/Instance/Detail/Running/Property/PropertyCard.vue @@ -1,6 +1,6 @@ @@ -47,13 +47,14 @@ const _props = defineProps({ default: () => [] }, }); -const loading = ref(true); +// const loading = ref(true); -watchEffect(() => { - if (_props.data.name) { - loading.value = false; - } -}); +// watchEffect(() => { +// if (_props.data) { +// console.log(_props.data) +// loading.value = false; +// } +// }); \ No newline at end of file diff --git a/src/views/link/Type/Detail/index.vue b/src/views/link/Type/Detail/index.vue index 81191769..6150e5ae 100644 --- a/src/views/link/Type/Detail/index.vue +++ b/src/views/link/Type/Detail/index.vue @@ -1,1091 +1,996 @@ diff --git a/src/views/system/Api/components/ApiTest.vue b/src/views/system/Api/components/ApiTest.vue new file mode 100644 index 00000000..46c87dbe --- /dev/null +++ b/src/views/system/Api/components/ApiTest.vue @@ -0,0 +1,51 @@ + + + + + diff --git a/src/views/system/Api/components/ChooseApi.vue b/src/views/system/Api/components/ChooseApi.vue new file mode 100644 index 00000000..bb6e5548 --- /dev/null +++ b/src/views/system/Api/components/ChooseApi.vue @@ -0,0 +1,65 @@ + + + + + diff --git a/src/views/system/Api/components/InputCard.vue b/src/views/system/Api/components/InputCard.vue new file mode 100644 index 00000000..c1742737 --- /dev/null +++ b/src/views/system/Api/components/InputCard.vue @@ -0,0 +1,35 @@ + + + + + diff --git a/src/views/system/Api/components/LeftTree.vue b/src/views/system/Api/components/LeftTree.vue new file mode 100644 index 00000000..598887f3 --- /dev/null +++ b/src/views/system/Api/components/LeftTree.vue @@ -0,0 +1,96 @@ + + + + + diff --git a/src/views/system/Api/index.vue b/src/views/system/Api/index.vue new file mode 100644 index 00000000..1d4fce58 --- /dev/null +++ b/src/views/system/Api/index.vue @@ -0,0 +1,84 @@ + + + + + diff --git a/src/views/system/apiPage/index.d.ts b/src/views/system/Api/typing.d.ts similarity index 100% rename from src/views/system/apiPage/index.d.ts rename to src/views/system/Api/typing.d.ts diff --git a/src/views/system/Apply/Api/components/ApiDoes.vue b/src/views/system/Apply/Api/components/ApiDoes.vue new file mode 100644 index 00000000..df806b0c --- /dev/null +++ b/src/views/system/Apply/Api/components/ApiDoes.vue @@ -0,0 +1,316 @@ + + + + + diff --git a/src/views/system/Apply/Api/components/ApiTest.vue b/src/views/system/Apply/Api/components/ApiTest.vue new file mode 100644 index 00000000..46c87dbe --- /dev/null +++ b/src/views/system/Apply/Api/components/ApiTest.vue @@ -0,0 +1,51 @@ + + + + + diff --git a/src/views/system/Apply/Api/components/ChooseApi.vue b/src/views/system/Apply/Api/components/ChooseApi.vue new file mode 100644 index 00000000..bb6e5548 --- /dev/null +++ b/src/views/system/Apply/Api/components/ChooseApi.vue @@ -0,0 +1,65 @@ + + + + + diff --git a/src/views/system/Apply/Api/components/InputCard.vue b/src/views/system/Apply/Api/components/InputCard.vue new file mode 100644 index 00000000..c1742737 --- /dev/null +++ b/src/views/system/Apply/Api/components/InputCard.vue @@ -0,0 +1,35 @@ + + + + + diff --git a/src/views/system/Apply/Api/components/LeftTree.vue b/src/views/system/Apply/Api/components/LeftTree.vue new file mode 100644 index 00000000..598887f3 --- /dev/null +++ b/src/views/system/Apply/Api/components/LeftTree.vue @@ -0,0 +1,96 @@ + + + + + diff --git a/src/views/system/Apply/Api/index.vue b/src/views/system/Apply/Api/index.vue new file mode 100644 index 00000000..990c0d77 --- /dev/null +++ b/src/views/system/Apply/Api/index.vue @@ -0,0 +1,84 @@ + + + + + diff --git a/src/views/system/Apply/Api/typing.d.ts b/src/views/system/Apply/Api/typing.d.ts new file mode 100644 index 00000000..7937398b --- /dev/null +++ b/src/views/system/Apply/Api/typing.d.ts @@ -0,0 +1,25 @@ +export type treeNodeTpye = { + name: string; + key: string; + schemas?:object; + link?: string; + apiList?: object[]; + children?: treeNodeTpye[]; + +}; +export type methodType = { + [key: string]: object +} +export type apiObjType = { + url: string, + method: methodType +} + +export type apiDetailsType = { + url: string; + method: string; + summary: string; + parameters: any[]; + requestBody?: any; + responses:object; +} \ No newline at end of file diff --git a/src/views/system/DataSource/Management/index.vue b/src/views/system/DataSource/Management/index.vue new file mode 100644 index 00000000..c9d62113 --- /dev/null +++ b/src/views/system/DataSource/Management/index.vue @@ -0,0 +1,398 @@ + + + + + diff --git a/src/views/system/DataSource/components/EditDialog.vue b/src/views/system/DataSource/components/EditDialog.vue index de689045..606b7609 100644 --- a/src/views/system/DataSource/components/EditDialog.vue +++ b/src/views/system/DataSource/components/EditDialog.vue @@ -34,9 +34,9 @@ > @@ -83,7 +83,7 @@ - + - - diff --git a/src/views/system/DataSource/index.vue b/src/views/system/DataSource/index.vue index 0190f7e8..370fff33 100644 --- a/src/views/system/DataSource/index.vue +++ b/src/views/system/DataSource/index.vue @@ -66,6 +66,7 @@ `/system/DataSource/Management?id=${slotProps.id}`, ) " + :disabled="slotProps?.typeId === 'rabbitmq' || !table.getRowStatus(slotProps)" > @@ -131,10 +132,11 @@ import { getDataSourceList_api, getDataTypeDict_api, changeStatus_api, + delDataSource_api } from '@/api/system/dataSource'; import { message } from 'ant-design-vue'; -const permission = 'system/Relationship'; +const permission = 'system/DataSource'; const router = useRouter(); @@ -226,6 +228,7 @@ const table = { title: '说明', dataIndex: 'description', key: 'description', + ellipsis: true, }, { title: '状态', @@ -240,6 +243,7 @@ const table = { key: 'action', scopedSlots: true, width: '200px', + fixed:'right' }, ], @@ -265,16 +269,16 @@ const table = { }, // 打开编辑弹窗 openDialog: (row: sourceItemType | {}) => { - editDialogRef.value.openDialog({shareConfig:{},...row}); + editDialogRef.value.openDialog({ shareConfig: {}, ...row }); }, // 删除 clickDel: (row: sourceItemType) => { - // delRelation_api(row.id).then((resp: any) => { - // if (resp.status === 200) { - // tableRef.value?.reload(); - // message.success('操作成功!'); - // } - // }); + delDataSource_api(row.id as string).then((resp: any) => { + if (resp.status === 200) { + tableRef.value?.reload(); + message.success('操作成功!'); + } + }); }, clickChangeStatus: (row: sourceItemType) => { const status = row.state.value === 'enabled' ? '_disable' : '_enable'; diff --git a/src/views/system/DataSource/typing.d.ts b/src/views/system/DataSource/typing.d.ts index 1ece8c43..528249b8 100644 --- a/src/views/system/DataSource/typing.d.ts +++ b/src/views/system/DataSource/typing.d.ts @@ -1,6 +1,7 @@ export type dictItemType = { id: string, - name: string + name: string, + children?: dictItemType } export type optionItemType = { label: string, @@ -11,14 +12,26 @@ export type sourceItemType = { 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 + shareConfig: { + url: string, + adminUrl: string, + addresses: string, + username: string, + password: string, + virtualHost: string, + schema: string } description: string +} + +// 数据库字段 +export type dbColumnType = { + previousName?: string, + type: String, + length: number, + precision: number, + notnull: boolean, + comment: string, + name: string, + scale?:number } \ No newline at end of file diff --git a/src/views/system/apiPage/components/ApiDoes.vue b/src/views/system/apiPage/components/ApiDoes.vue index 85dfc5e0..df806b0c 100644 --- a/src/views/system/apiPage/components/ApiDoes.vue +++ b/src/views/system/apiPage/components/ApiDoes.vue @@ -73,7 +73,7 @@