diff --git a/src/api/link/type.ts b/src/api/link/type.ts new file mode 100644 index 00000000..887d395f --- /dev/null +++ b/src/api/link/type.ts @@ -0,0 +1,32 @@ +import server from '@/utils/request'; + +export const queryNetworkConfig = (params: object) => + server.post(`/network/config/_query`, params); + +export const remove = (id: string) => server.remove(`/network/config/${id}`); + +export const shutdown = (data: object) => + server.post(`/network/config/${data}/_shutdown`); + +export const start = (data: object) => + server.post(`/network/config/${data}/_start`); + +export const supports = () => server.get(`/network/config/supports`); + +export const query = (data: Object) => + server.post(`/network/config/_query`, data); + +export const providers = () => server.get(`/gateway/device/providers`); + +export const resourcesCurrent = () => + server.get(`/network/resources/alive/_current`); + +export const resourceClusters = () => server.get(`network/resources/clusters`); + +export const resourceClustersById = (id: string) => + server.get(`/network/resources/alive/${id}`); + +export const allResources = () => server.get(`/network/resources/alive/_all`); + +export const certificates = () => + server.get(`/network/certificate/_query/no-paging?paging=false`); diff --git a/src/api/northbound/alicloud.ts b/src/api/northbound/alicloud.ts index e69de29b..669899ef 100644 --- a/src/api/northbound/alicloud.ts +++ b/src/api/northbound/alicloud.ts @@ -0,0 +1,67 @@ +import server from '@/utils/request' + +/** + * 查询数据 + * @param data 分页搜索数据 + * @returns + */ +export const query = (data: Record) => server.post('/device/aliyun/bridge/_query', data) + +/** + * 查询产品列表 + * @param data + * @returns + */ +export const queryProductList = (data?: Record) => server.post('/device-product/_query/no-paging', data) + +/** + * 保存数据 + * @param data 阿里云 + * @returns + */ +export const savePatch = (data: Record) => server.patch(`/device/aliyun/bridge`, data) + +/** + * 根据阿里云ID获取阿里云详情 + * @param id 阿里云ID + * @returns 阿里云详情 + */ +export const detail = (id: string) => server.get(`/device/aliyun/bridge/${id}`) + +/** + * 删除阿里云 + * @param id 阿里云ID + * @returns + */ +export const _delete = (id: string) => server.remove(`/device/aliyun/bridge/${id}`) + +/** + * 启用阿里云 + * @param id 阿里云ID + * @param data + * @returns + */ +export const _deploy = (id: string) => server.post(`/device/aliyun/bridge/${id}/enable`) + +/** + * 禁用阿里云 + * @param id 阿里云ID + * @param data + * @returns + */ +export const _undeploy = (id: string) => server.post(`/device/aliyun/bridge/${id}/disable`) + +/** + * 获取服务地址的下拉列表 + * @param params + * @returns + */ +export const getRegionsList = (params?: Record) => server.get(`/device/aliyun/bridge/regions`, params) + +/** + * 产品映射中的阿里云产品下拉列表 + * @param data + * @returns + */ +export const getAliyunProductsList = (data?: Record) => server.post(`/device/aliyun/bridge/products/_query`, data) + diff --git a/src/api/northbound/dueros.ts b/src/api/northbound/dueros.ts index e3cb60cc..63562377 100644 --- a/src/api/northbound/dueros.ts +++ b/src/api/northbound/dueros.ts @@ -5,4 +5,67 @@ import server from '@/utils/request' * @param data 分页搜索数据 * @returns */ -export const query = (data: Record) => server.post('/dueros/product/_query', data) \ No newline at end of file +export const query = (data: Record) => server.post('/dueros/product/_query', data) + +/** + * 查询产品列表 + * @param id + * @returns + */ +export const queryProductList = (id?: string) => server.post('/device-product/_query/no-paging', { + paging: false, + terms: id ? [{ + column: 'id$dueros-product$not', + value: 1, + }, + { column: 'id', type: 'or', value: id } + ] : [{ + column: 'id$dueros-product$not', + value: 1, + }], + sorts: [{ name: 'createTime', order: 'desc' }], +}) + +/** + * 查询类型 + * @returns + */ +export const queryTypes = () => server.get('/dueros/product/types') + +/** + * 保存数据 + * @param data dueros + * @returns + */ +export const savePatch = (data: Record) => server.patch(`/dueros/product`, data) + +/** + * 根据duerosID获取dueros详情 + * @param id duerosID + * @returns dueros详情 + */ +export const detail = (id: string) => server.get(`/dueros/product/${id}`) + +/** + * 删除dueros + * @param id duerosID + * @returns + */ +export const _delete = (id: string) => server.remove(`/dueros/product/${id}`) + +/** + * 启用dueros + * @param id duerosID + * @param data + * @returns + */ +export const _deploy = (id: string) => server.post(`/dueros/product/${id}/_enable`) + +/** + * 禁用dueros + * @param id duerosID + * @param data + * @returns + */ +export const _undeploy = (id: string) => server.post(`/dueros/product/${id}/_disable`) + diff --git a/src/api/rule-engine/instance.ts b/src/api/rule-engine/instance.ts new file mode 100644 index 00000000..6c8c2e45 --- /dev/null +++ b/src/api/rule-engine/instance.ts @@ -0,0 +1,30 @@ +import server from '@/utils/request' +/** + * 查询规则编排分页列表 + */ +export const queryList = (data: any) => server.post('/rule-engine/instance/_query', data); + +/** + * 新增规则 + */ +export const saveRule = (data: any) => server.post('/rule-editor/flows/_create',data); + +/** + * 修改规则 + */ +export const modify = (id:any ,data:any) => server.put(`/rule-engine/instance/${id}`,data); + +/** + * 启动规则 + */ +export const startRule = (id:string) => server.post(`/rule-engine/instance/${id}/_start`); + +/** + * 禁用规则 + */ +export const stopRule = (id:string) => server.post(`/rule-engine/instance/${id}/_stop`); + +/** + * 删除规则 + */ +export const deleteRule = (id:string) => server.remove(`/rule-engine/instance/${id}`) \ No newline at end of file diff --git a/src/api/system/department.ts b/src/api/system/department.ts index e61b4de0..565db91f 100644 --- a/src/api/system/department.ts +++ b/src/api/system/department.ts @@ -10,12 +10,14 @@ export const updateDepartment_api = (data: object) => server.patch(`/organizatio export const delDepartment_api = (id: string) => server.remove(`/organization/${id}`); +// 获取所属产品列表 +export const getDeviceProduct_api = (data: object) => server.get(`/device/product/_query/no-paging`, data); // 获取产品列表 export const getDeviceOrProductList_api = (data: object) => server.post(`/device-product/_query`, data); // 获取设备列表 export const getDeviceList_api = (data: object) => server.post(`/device/instance/_query`, data); // 根据产品的id获取产品的权限 -export const getPermission_api = (type:'device' | 'product',ids: object, id: string) => server.post(`/assets/bindings/${type}/org/${id}/_query`, ids); +export const getPermission_api = (type: 'device' | 'product', ids: object, id: string) => server.post(`/assets/bindings/${type}/org/${id}/_query`, ids); // 获取产品的权限字典 export const getPermissionDict_api = () => server.get(`/assets/bindings/product/permissions`); @@ -24,4 +26,13 @@ export const bindDeviceOrProductList_api = (type: 'device' | 'product', data: ob // 批量解绑 export const unBindDeviceOrProduct_api = (type: 'device' | 'product', data: object) => server.post(`/assets/unbind/${type}`, data); // 批量更新权限 -export const updatePermission_api = (type: 'device' | 'product', parentId: string, data: object) => server.put(`/assets/permission/${type}/org/${parentId}/_batch`, data); \ No newline at end of file +export const updatePermission_api = (type: 'device' | 'product', parentId: string, data: object) => server.put(`/assets/permission/${type}/org/${parentId}/_batch`, data); + + +// 用户相关 +// 获取绑定用户列表 +export const getBindUserList_api = (data: object) => server.post(`/user/_query`, data); +// 绑定用户 +export const bindUser_api = (parentId:string,data: object) => server.post(`/organization/${parentId}/users/_bind`, data); +// 解绑用户 +export const unBindUser_api = (parentId:string,data: object) => server.post(`/organization/${parentId}/users/_unbind`, data); diff --git a/src/api/system/user.ts b/src/api/system/user.ts new file mode 100644 index 00000000..68c690ac --- /dev/null +++ b/src/api/system/user.ts @@ -0,0 +1,36 @@ +import server from '@/utils/request'; + +// 获取用户类型 +export const getUserType_api = () => server.get(`/user/detail/types`); + +// 获取用户列表 +export const getUserList_api = (data: object) => server.post(`/user/detail/_query`, data); + +// 校验字段合法性 +export const validateField_api = (type: 'username' | 'password', name: string) => server.post(`/user/${type}/_validate`, name, { + headers: { + 'Content-Type': 'text/plain' + } +}) + +// 获取角色列表 +export const getRoleList_api = () => server.get(`/role/_query/no-paging?paging=false`); +// 获取组织列表 +export const getDepartmentList_api = () => server.get(`/organization/_all/tree?paging=false`); + +// 获取用户信息 +export const getUser_api = (id: string) => server.get(`/user/detail/${id}`); +// 添加用户 +export const addUser_api = (data: object) => server.post(`/user/detail/_create`, data); +// 更新用户 +export const updateUser_api = (data: any) => server.put(`/user/detail/${data.id}/_update`, data); +// 更新密码 +export const updatePassword_api = (data: { id: string, password: string }) => server.post(`/user/${data.id}/password/_reset`, data.password, { + headers: { + 'Content-Type': 'text/plain' + } +}); +// 修改用户状态 +export const changeUserStatus_api = (data: object) => server.patch(`/user`,data); +// 删除用户 +export const deleteUser_api = (id: string) => server.remove(`/user/${id}`); \ No newline at end of file diff --git a/src/views/device/DashBoard/components/BarChart.vue b/src/views/device/DashBoard/components/BarChart.vue deleted file mode 100644 index f6d4db43..00000000 --- a/src/views/device/DashBoard/components/BarChart.vue +++ /dev/null @@ -1,79 +0,0 @@ - - - - - diff --git a/src/views/device/DashBoard/components/Charts.vue b/src/views/device/DashBoard/components/Charts.vue new file mode 100644 index 00000000..9c5a4031 --- /dev/null +++ b/src/views/device/DashBoard/components/Charts.vue @@ -0,0 +1,43 @@ + + + + + diff --git a/src/views/device/DashBoard/components/LineChart.vue b/src/views/device/DashBoard/components/LineChart.vue deleted file mode 100644 index cb06576c..00000000 --- a/src/views/device/DashBoard/components/LineChart.vue +++ /dev/null @@ -1,99 +0,0 @@ - - - - - diff --git a/src/views/device/DashBoard/components/MessageChart.vue b/src/views/device/DashBoard/components/MessageChart.vue deleted file mode 100644 index c088d53d..00000000 --- a/src/views/device/DashBoard/components/MessageChart.vue +++ /dev/null @@ -1,112 +0,0 @@ - - - - - diff --git a/src/views/device/DashBoard/components/TopCard.vue b/src/views/device/DashBoard/components/TopCard.vue index 0d3c89d4..13c5fcac 100644 --- a/src/views/device/DashBoard/components/TopCard.vue +++ b/src/views/device/DashBoard/components/TopCard.vue @@ -72,7 +72,7 @@ const props = defineProps({ } .content-right { width: 0; - height: 100%; + height: 123px; display: flex; flex-grow: .7; align-items: flex-end; diff --git a/src/views/device/DashBoard/index.vue b/src/views/device/DashBoard/index.vue index b916fef9..e1a8a051 100644 --- a/src/views/device/DashBoard/index.vue +++ b/src/views/device/DashBoard/index.vue @@ -24,10 +24,12 @@ :footer="onlineFooter" :value="onlineToday" > - --> + + - @@ -55,7 +54,7 @@
- +
@@ -74,11 +73,9 @@ + + diff --git a/src/views/link/Type/data.ts b/src/views/link/Type/data.ts new file mode 100644 index 00000000..d6814539 --- /dev/null +++ b/src/views/link/Type/data.ts @@ -0,0 +1,82 @@ +export const FormStates = { + name: '', + type: 'UDP', + shareCluster: true, + parserType: '', + configuration: { + port: '', + host: '0.0.0.0', + publicPort: '', + publicHost: '', + remoteHost: '', + remotePort: '', + secure: false, + username: '', + password: '', + topicPrefix: '', + maxMessageSize: '', + certId: '', + privateKeyAlias: '', + clientId: '', + parserConfiguration: { + delimited: '', + lang: '', + script: '', + size: '', + length: '', + offset: '', + little: '', + }, + }, + description: '', +}; + +const VisibleMost = [ + 'COAP_SERVER', + 'MQTT_SERVER', + 'WEB_SOCKET_SERVER', + 'TCP_SERVER', + 'UDP', + 'HTTP_SERVER', +]; + +export const VisibleData = { + parserType: ['TCP_SERVER'], + // configuration: { + port: VisibleMost, + host: VisibleMost, + publicPort: VisibleMost, + publicHost: VisibleMost, + remoteHost: ['MQTT_CLIENT'], + remotePort: ['MQTT_CLIENT'], + secure: ['TCP_SERVER', 'UDP', 'COAP_SERVER'], + username: ['MQTT_CLIENT'], + password: ['MQTT_CLIENT'], + topicPrefix: ['MQTT_CLIENT'], + maxMessageSize: ['MQTT_SERVER', 'MQTT_CLIENT'], + // certId: '', + // privateKeyAlias: '', + clientId: ['MQTT_CLIENT'], + // parserConfiguration: { + delimited: ['DELIMITED'], + lang: ['SCRIPT'], + script: ['SCRIPT'], + size: ['FIXED_LENGTH'], + length: ['LENGTH_FIELD'], + offset: ['LENGTH_FIELD'], + little: ['LENGTH_FIELD'], + // }, + + // }, +}; + +export const ParserTypeOptions = [ + { value: 'DIRECT', label: '不处理' }, + { value: 'DELIMITED', label: '分隔符' }, + { value: 'SCRIPT', label: '自定义脚本' }, + { value: 'FIXED_LENGTH', label: '固定长度' }, + { value: 'LENGTH_FIELD', label: '长度字段' }, +]; + +export const isVisible = (LastName: string, dependencies: string | boolean) => + VisibleData[LastName].includes(dependencies); diff --git a/src/views/link/Type/index.vue b/src/views/link/Type/index.vue new file mode 100644 index 00000000..bc37ec86 --- /dev/null +++ b/src/views/link/Type/index.vue @@ -0,0 +1,461 @@ + + + diff --git a/src/views/link/Type/type.d.ts b/src/views/link/Type/type.d.ts new file mode 100644 index 00000000..e69de29b diff --git a/src/views/media/Stream/Detail/index.vue b/src/views/media/Stream/Detail/index.vue index 0feec4dc..b7761594 100644 --- a/src/views/media/Stream/Detail/index.vue +++ b/src/views/media/Stream/Detail/index.vue @@ -265,7 +265,7 @@ - + + \ No newline at end of file diff --git a/src/views/northbound/AliCloud/Detail/index.vue b/src/views/northbound/AliCloud/Detail/index.vue new file mode 100644 index 00000000..10b99894 --- /dev/null +++ b/src/views/northbound/AliCloud/Detail/index.vue @@ -0,0 +1,333 @@ + + + \ No newline at end of file diff --git a/src/views/northbound/AliCloud/index.vue b/src/views/northbound/AliCloud/index.vue index 36c762ec..3d4e8ccc 100644 --- a/src/views/northbound/AliCloud/index.vue +++ b/src/views/northbound/AliCloud/index.vue @@ -1,7 +1,306 @@ - \ No newline at end of file +const router = useRouter(); +const instanceRef = ref>({}); +const params = ref>({}); +const current = ref>({}); + +const statusMap = new Map(); +statusMap.set('enabled', 'success'); +statusMap.set('disabled', 'error'); + +const columns = [ + { + title: '名称', + dataIndex: 'name', + key: 'name', + }, + { + title: '网桥产品', + dataIndex: 'bridgeProductName', + key: 'bridgeProductName', + }, + { + title: '说明', + dataIndex: 'describe', + key: 'describe', + }, + { + title: '状态', + dataIndex: 'state', + key: 'state', + scopedSlots: true, + }, + { + title: '操作', + key: 'action', + fixed: 'right', + width: 250, + scopedSlots: true, + }, +]; + +/** + * 新增 + */ +const handleAdd = () => { + router.push('/iot/northbound/AliCloud/detail/:id'); +}; + +/** + * 查看 + */ +const handleView = (id: string) => { + router.push({ + path: '/iot/northbound/AliCloud/detail/' + id, + query: { + type: 'view' + } + }); +}; + +const getActions = ( + data: Partial>, + type: 'card' | 'table', +): ActionsType[] => { + if (!data) return []; + const actions = [ + { + key: 'view', + text: '查看', + tooltip: { + title: '查看', + }, + icon: 'EyeOutlined', + onClick: () => { + handleView(data.id); + }, + }, + { + key: 'edit', + text: '编辑', + tooltip: { + title: '编辑', + }, + icon: 'EditOutlined', + onClick: () => { + router.push({ + path: '/iot/northbound/AliCloud/detail/' + data.id, + query: { + type: 'edit' + } + }); + }, + }, + { + key: 'action', + text: data.state?.value !== 'disabled' ? '禁用' : '启用', + tooltip: { + title: data.state?.value !== 'disabled' ? '禁用' : '启用', + }, + icon: + data.state.value !== 'notActive' + ? 'StopOutlined' + : 'CheckCircleOutlined', + popConfirm: { + title: `确认${ + data.state.value !== 'disabled' ? '禁用' : '启用' + }?`, + onConfirm: async () => { + let response = undefined; + if (data.state.value !== 'disabled') { + response = await _undeploy(data.id); + } else { + response = await _deploy(data.id); + } + if (response && response.status === 200) { + message.success('操作成功!'); + instanceRef.value?.reload(); + } else { + message.error('操作失败!'); + } + }, + }, + }, + { + key: 'delete', + text: '删除', + disabled: data.state?.value !== 'disabled', + tooltip: { + title: + data.state.value !== 'disabled' + ? '请先禁用该数据,再删除。' + : '删除', + }, + popConfirm: { + title: '确认删除?', + onConfirm: async () => { + const resp = await _delete(data.id); + if (resp.status === 200) { + message.success('操作成功!'); + instanceRef.value?.reload(); + } else { + message.error('操作失败!'); + } + }, + }, + icon: 'DeleteOutlined', + }, + ]; + if (type === 'card') + return actions.filter((i: ActionsType) => i.key !== 'view'); + return actions; +}; + diff --git a/src/views/northbound/DuerOS/Detail/command/EditTable.vue b/src/views/northbound/DuerOS/Detail/command/EditTable.vue new file mode 100644 index 00000000..975d91fd --- /dev/null +++ b/src/views/northbound/DuerOS/Detail/command/EditTable.vue @@ -0,0 +1,93 @@ + + + \ No newline at end of file diff --git a/src/views/northbound/DuerOS/Detail/command/index.vue b/src/views/northbound/DuerOS/Detail/command/index.vue new file mode 100644 index 00000000..8a42b9b9 --- /dev/null +++ b/src/views/northbound/DuerOS/Detail/command/index.vue @@ -0,0 +1,139 @@ + + + \ No newline at end of file diff --git a/src/views/northbound/DuerOS/Detail/doc.vue b/src/views/northbound/DuerOS/Detail/doc.vue new file mode 100644 index 00000000..35bfcc33 --- /dev/null +++ b/src/views/northbound/DuerOS/Detail/doc.vue @@ -0,0 +1,101 @@ + + + + + \ No newline at end of file diff --git a/src/views/northbound/DuerOS/Detail/index.vue b/src/views/northbound/DuerOS/Detail/index.vue new file mode 100644 index 00000000..12db64a3 --- /dev/null +++ b/src/views/northbound/DuerOS/Detail/index.vue @@ -0,0 +1,385 @@ + + + \ No newline at end of file diff --git a/src/views/northbound/DuerOS/Save/index.vue b/src/views/northbound/DuerOS/Save/index.vue deleted file mode 100644 index 9573a57f..00000000 --- a/src/views/northbound/DuerOS/Save/index.vue +++ /dev/null @@ -1,3 +0,0 @@ - \ No newline at end of file diff --git a/src/views/northbound/DuerOS/index.vue b/src/views/northbound/DuerOS/index.vue index dc06f008..c35da774 100644 --- a/src/views/northbound/DuerOS/index.vue +++ b/src/views/northbound/DuerOS/index.vue @@ -1,69 +1,141 @@