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/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 @@ + + \ 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 @@