From 0189595c9999310c8ae541dde3a9de98cafdc73e Mon Sep 17 00:00:00 2001 From: JiangQiming <291854119@qq.com> Date: Tue, 31 Jan 2023 10:40:28 +0800 Subject: [PATCH 01/12] =?UTF-8?q?fix:=20=E9=80=9A=E7=9F=A5=E9=85=8D?= =?UTF-8?q?=E7=BD=AE,=20=E5=8D=A1=E7=89=87=E6=8C=89=E9=92=AE=E6=8F=92?= =?UTF-8?q?=E6=A7=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/AIcon/index.tsx | 1 + src/components/Table/index.tsx | 1 + src/views/notice/Config/index.vue | 145 +++++++++++++++++++++--------- 3 files changed, 105 insertions(+), 42 deletions(-) diff --git a/src/components/AIcon/index.tsx b/src/components/AIcon/index.tsx index c580070d..1a21e6ff 100644 --- a/src/components/AIcon/index.tsx +++ b/src/components/AIcon/index.tsx @@ -44,6 +44,7 @@ const iconKeys = [ 'QuestionCircleOutlined', 'InfoCircleOutlined', 'SearchOutlined', + 'EllipsisOutlined', ] const Icon = (props: {type: string}) => { diff --git a/src/components/Table/index.tsx b/src/components/Table/index.tsx index 7c43d1f7..1a37be86 100644 --- a/src/components/Table/index.tsx +++ b/src/components/Table/index.tsx @@ -37,6 +37,7 @@ export interface ActionsType { tooltip?: TooltipProps; popConfirm?: PopconfirmProps; icon?: string; + children?: ActionsType[]; } export interface JColumnProps extends ColumnProps{ diff --git a/src/views/notice/Config/index.vue b/src/views/notice/Config/index.vue index 801f8b39..6a2af067 100644 --- a/src/views/notice/Config/index.vue +++ b/src/views/notice/Config/index.vue @@ -77,20 +77,35 @@ v-bind="item.tooltip" :title="item.disabled && item.tooltip.title" > + + + + {{ item.text }} + + + - - + @@ -351,29 +360,35 @@ const getActions = ( currentConfig.value = data; }, }, - { - key: 'debug', - text: '导出', - tooltip: { - title: '导出', - }, - icon: 'ArrowDownOutlined', - onClick: () => { - downloadObject(data, `通知配置`); - }, - }, - { - key: 'sync', - text: '同步用户', - tooltip: { - title: '同步用户', - }, - icon: 'TeamOutlined', - onClick: () => { - syncVis.value = true; - currentConfig.value = data; - }, - }, + // { + // key: 'others', + // text: '其他', + // children: [ + // { + // key: 'debug', + // text: '导出', + // tooltip: { + // title: '导出', + // }, + // icon: 'ArrowDownOutlined', + // onClick: () => { + // downloadObject(data, `通知配置`); + // }, + // }, + // { + // key: 'sync', + // text: '同步用户', + // tooltip: { + // title: '同步用户', + // }, + // icon: 'TeamOutlined', + // onClick: () => { + // syncVis.value = true; + // currentConfig.value = data; + // }, + // }, + // ], + // }, { key: 'delete', text: '删除', @@ -392,9 +407,55 @@ const getActions = ( icon: 'DeleteOutlined', }, ]; - if (data.provider === 'dingTalkMessage' || data.provider === 'corpMessage') + + const others: ActionsType = { + key: 'others', + text: '其他', + icon: 'EllipsisOutlined', + children: [ + { + key: 'debug', + text: '导出', + tooltip: { + title: '导出', + }, + icon: 'ArrowDownOutlined', + onClick: () => { + downloadObject(data, `通知配置`); + }, + }, + { + key: 'sync', + text: '同步用户', + tooltip: { + title: '同步用户', + }, + icon: 'TeamOutlined', + onClick: () => { + syncVis.value = true; + currentConfig.value = data; + }, + }, + ], + }; + + if (type === 'card') { + if ( + data.provider !== 'dingTalkMessage' && + data.provider !== 'corpMessage' + ) + others.children.splice(1, 1); + actions.splice(actions.length - 1, 0, others); return actions; - return actions.filter((i: ActionsType) => i.key !== 'sync'); + } else { + if ( + data.provider !== 'dingTalkMessage' && + data.provider !== 'corpMessage' + ) + others.children.splice(1, 1); + actions.splice(actions.length - 1, 0, ...others.children); + return actions; + } }; diff --git a/src/views/system/Menu/components/PermissChoose.vue b/src/views/system/Menu/components/PermissChoose.vue new file mode 100644 index 00000000..b4abf16f --- /dev/null +++ b/src/views/system/Menu/components/PermissChoose.vue @@ -0,0 +1,47 @@ + + + + + diff --git a/src/views/system/Menu/index.vue b/src/views/system/Menu/index.vue index 7ff407f3..648b29cc 100644 --- a/src/views/system/Menu/index.vue +++ b/src/views/system/Menu/index.vue @@ -208,7 +208,8 @@ const table = reactive({ }; const resp: any = await getMenuTree_api(params); const lastItem = resp.result[resp.result.length - 1]; - table.total == lastItem ? lastItem.sortIndex + 1 : 1; + table.total = lastItem ? lastItem.sortIndex + 1 : 1; + return { code: resp.message, result: { @@ -225,7 +226,7 @@ const table = reactive({ router.push( `/system/Menu/detail/${row.id || ':id'}?pid=${ row.pid || '' - }&basePath=${row.basePath || ''}&sortIndex=${table.total + 1}`, + }&basePath=${row.basePath || ''}&sortIndex=${table.total}`, ); }, // 删除 From 67a3780287c60d050290774e25e4a874b57e0cd7 Mon Sep 17 00:00:00 2001 From: easy <1358086367@qq.com> Date: Tue, 31 Jan 2023 11:52:26 +0800 Subject: [PATCH 04/12] =?UTF-8?q?update:=20=E9=A6=96=E9=A1=B5=E6=9D=83?= =?UTF-8?q?=E9=99=90=E8=B0=83=E6=95=B4=E5=8F=8A=E6=A0=B7=E5=BC=8F=E5=BE=AE?= =?UTF-8?q?=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/ComprehensiveHome/index.vue | 187 +++++++++++++++++- .../home/components/DevOpsHome/index.vue | 76 ++++++- .../home/components/DeviceHome/index.vue | 94 ++++++++- src/views/home/index.vue | 39 +--- src/views/home/modules/config.ts | 174 ---------------- 5 files changed, 355 insertions(+), 215 deletions(-) delete mode 100644 src/views/home/modules/config.ts diff --git a/src/views/home/components/ComprehensiveHome/index.vue b/src/views/home/components/ComprehensiveHome/index.vue index d01776b3..b26be459 100644 --- a/src/views/home/components/ComprehensiveHome/index.vue +++ b/src/views/home/components/ComprehensiveHome/index.vue @@ -41,24 +41,195 @@ import BasicCountCard from '../BasicCountCard.vue'; import PlatformPicCard from '../PlatformPicCard.vue'; import StepCard from '../StepCard.vue'; -import { - deviceBootConfig as _deviceBootConfig, - deviceStepDetails, - opsBootConfig as _opsBootConfig, - opsStepDetails, -} from '../../modules/config'; +import { useMenuStore } from '@/store/menu'; +import { usePermissionStore } from '@/store/permission'; +import { recommendList, bootConfig } from '../../index'; +// 按钮权限控制 +const hasPermission = usePermissionStore().hasPermission; +const productPermission = (action: string) => + hasPermission(`device/Product:${action}`); +const devicePermission = (action: string) => + hasPermission(`device/Instance:${action}`); +const rulePermission = (action: string) => + hasPermission(`rule-engine/Instance:${action}`); +// 页面权限控制 +const menuPermission = useMenuStore().hasPermission; + +// 物联网引导-数据 +const _deviceBootConfig: bootConfig[] = [ + { + english: 'STEP1', + label: '创建产品', + link: '/iot/device/Product', + auth: productPermission('add'), + params: { + save: true, + }, + }, + { + english: 'STEP2', + label: '创建设备', + link: '/iot/device/Instance', + auth: devicePermission('add'), + params: { + save: true, + }, + }, + { + english: 'STEP3', + label: '规则引擎', + link: '/iot/rule-engine/Instance', + auth: rulePermission('add'), + params: { + save: true, + }, + }, +]; const deviceImages = [ '/images/home/guide-home1.png', '/images/home/guide-home2.png', '/images/home/guide-home3.png', ]; +const deviceBootConfig = _deviceBootConfig.map((item, i) => ({ + ...item, + image: deviceImages[i], +})); + +// 设备接入推荐步骤-数据 +const deviceStepDetails: recommendList[] = [ + { + title: '创建产品', + details: + '产品是设备的集合,通常指一组具有相同功能的设备。物联设备必须通过产品进行接入方式配置。', + iconUrl: '/images/home/bottom-4.png', + linkUrl: '/iot/device/Product', + auth: productPermission('add'), + params: { + save: true, + }, + }, + { + title: '配置产品接入方式', + details: + '通过产品对同一类型的设备进行统一的接入方式配置。请参照设备铭牌说明选择匹配的接入方式。', + iconUrl: '/images/home/bottom-1.png', + linkUrl: '/iot/device/Product/detail', + auth: productPermission('update'), + dialogTag: 'accessMethod', + }, + { + title: '添加测试设备', + details: '添加单个设备,用于验证产品模型是否配置正确。', + iconUrl: '/images/home/bottom-5.png', + linkUrl: '/iot/device/Instance', + auth: devicePermission('add'), + params: { + save: true, + }, + }, + { + title: '功能调试', + details: + '对添加的测试设备进行功能调试,验证能否连接到平台,设备功能是否配置正确。', + iconUrl: '/images/home/bottom-2.png', + linkUrl: '/iot/device/Instance/detail', + // auth: devicePermission('update'), + auth: true, + dialogTag: 'funcTest', + }, + { + title: '批量添加设备', + details: '批量添加同一产品下的设备', + iconUrl: '/images/home/bottom-3.png', + linkUrl: '/iot/device/Instance', + auth: devicePermission('import'), + params: { + import: true, + }, + }, +]; + +// 运维管理引导-数据 +const _opsBootConfig: bootConfig[] = [ + { + english: 'STEP1', + label: '设备接入配置', + link: '/iot/link/accessConfig', + auth: menuPermission('link/accessConfig'), + }, + { + english: 'STEP2', + label: '日志排查', + link: '/iot/link/Log', + auth: menuPermission('link/Log'), + params: { + key: 'system', + }, + }, + { + english: 'STEP3', + label: '实时监控', + link: '/iot/link/dashboard', + auth: menuPermission('link/dashboard'), + params: { + save: true, + }, + }, +]; const opsImages = [ '/images/home/guide-home4.png', '/images/home/guide-home5.png', '/images/home/guide-home6.png', ]; +const opsBootConfig = _opsBootConfig.map((item, i) => ({ + ...item, + image: opsImages[i], +})); + +// 运维管理推荐步骤-数据 +const opsStepDetails: recommendList[] = [ + { + title: '协议管理', + details: + '根据业务需求自定义开发对应的产品(设备模型)接入协议,并上传到平台。', + iconUrl: '/images/home/bottom-1.png', + linkUrl: '/iot/link/protocol', + auth: menuPermission('link/Protocol'), + }, + { + title: '证书管理', + details: '统一维护平台内的证书,用于数据通信加密。', + iconUrl: '/images/home/bottom-6.png', + linkUrl: '/iot/link/Certificate', + auth: menuPermission('link/Certificate'), + }, + { + title: '网络组件', + details: '根据不同的传输类型配置平台底层网络组件相关参数。', + iconUrl: '/images/home/bottom-3.png', + linkUrl: '/iot/link/type', + auth: menuPermission('link/Type'), + }, + { + title: '设备接入网关', + details: '根据不同的传输类型,关联消息协议,配置设备接入网关相关参数。', + iconUrl: '/images/home/bottom-4.png', + linkUrl: '/iot/link/accessConfig', + auth: menuPermission('link/AccessConfig'), + }, + { + title: '日志管理', + details: '监控系统日志,及时处理系统异常。', + iconUrl: '/images/home/bottom-5.png', + linkUrl: '/iot/link/Log', + auth: menuPermission('Log'), + params: { + key: 'system', + }, + }, +]; + + -const deviceBootConfig = _deviceBootConfig.map((item,i) => ({...item, image: deviceImages[i]})); -const opsBootConfig = _opsBootConfig.map((item,i) => ({...item, image: opsImages[i]})); diff --git a/src/views/home/components/DevOpsHome/index.vue b/src/views/home/components/DevOpsHome/index.vue index e3326295..de99dbfc 100644 --- a/src/views/home/components/DevOpsHome/index.vue +++ b/src/views/home/components/DevOpsHome/index.vue @@ -26,8 +26,82 @@ import BootCard from '../BootCard.vue'; import BasicCountCard from '../BasicCountCard.vue'; import PlatformPicCard from '../PlatformPicCard.vue'; import StepCard from '../StepCard.vue'; +import { useMenuStore } from "@/store/menu"; + +import { bootConfig, recommendList } from '../../index'; +// 页面权限控制 +const menuPermission = useMenuStore().hasPermission; + +const opsBootConfig: bootConfig[] = [ + { + english: 'STEP1', + label: '设备接入配置', + link: '/iot/link/accessConfig', + auth: menuPermission('link/accessConfig'), + }, + { + english: 'STEP2', + label: '日志排查', + link: '/iot/link/Log', + auth: menuPermission('link/Log'), + params: { + key: 'system', + }, + }, + { + english: 'STEP3', + label: '实时监控', + link: '/iot/link/dashboard', + auth: menuPermission('link/dashboard'), + params: { + save: true, + }, + }, +]; +const opsStepDetails: recommendList[] = [ + { + title: '协议管理', + details: + '根据业务需求自定义开发对应的产品(设备模型)接入协议,并上传到平台。', + iconUrl: '/images/home/bottom-1.png', + linkUrl: '/iot/link/protocol', + auth: menuPermission('link/Protocol'), + + }, + { + title: '证书管理', + details: '统一维护平台内的证书,用于数据通信加密。', + iconUrl: '/images/home/bottom-6.png', + linkUrl: '/iot/link/Certificate', + auth: menuPermission('link/Certificate'), + + }, + { + title: '网络组件', + details: '根据不同的传输类型配置平台底层网络组件相关参数。', + iconUrl: '/images/home/bottom-3.png', + linkUrl: '/iot/link/type', + auth: menuPermission('link/Type'), + }, + { + title: '设备接入网关', + details: '根据不同的传输类型,关联消息协议,配置设备接入网关相关参数。', + iconUrl: '/images/home/bottom-4.png', + linkUrl: '/iot/link/accessConfig', + auth: menuPermission('link/AccessConfig'), + }, + { + title: '日志管理', + details: '监控系统日志,及时处理系统异常。', + iconUrl: '/images/home/bottom-5.png', + linkUrl: '/iot/link/Log', + auth: menuPermission('Log'), + params: { + key: 'system', + } + }, +]; -import { opsBootConfig, opsStepDetails } from '../../modules/config'; diff --git a/src/views/home/components/DeviceHome/index.vue b/src/views/home/components/DeviceHome/index.vue index b518f8ae..cc61c733 100644 --- a/src/views/home/components/DeviceHome/index.vue +++ b/src/views/home/components/DeviceHome/index.vue @@ -27,7 +27,99 @@ import DeviceCountCard from '../DeviceCountCard.vue'; import PlatformPicCard from '../PlatformPicCard.vue'; import StepCard from '../StepCard.vue'; -import { deviceBootConfig, deviceStepDetails } from '../../modules/config'; +import { usePermissionStore } from '@/store/permission'; +import { bootConfig, recommendList } from '../../index'; + +// 按钮权限控制 +const hasPermission = usePermissionStore().hasPermission; +const productPermission = (action: string) => + hasPermission(`device/Product:${action}`); +const devicePermission = (action: string) => + hasPermission(`device/Instance:${action}`); +const rulePermission = (action: string) => + hasPermission(`rule-engine/Instance:${action}`); + +const deviceBootConfig: bootConfig[] = [ + { + english: 'STEP1', + label: '创建产品', + link: '/iot/device/Product', + auth: productPermission('add'), + params: { + save: true, + }, + }, + { + english: 'STEP2', + label: '创建设备', + link: '/iot/device/Instance', + auth: devicePermission('add'), + params: { + save: true, + }, + }, + { + english: 'STEP3', + label: '规则引擎', + link: '/iot/rule-engine/Instance', + auth: rulePermission('add'), + params: { + save: true, + }, + }, +]; +const deviceStepDetails: recommendList[] = [ + { + title: '创建产品', + details: + '产品是设备的集合,通常指一组具有相同功能的设备。物联设备必须通过产品进行接入方式配置。', + iconUrl: '/images/home/bottom-4.png', + linkUrl: '/iot/device/Product', + auth: productPermission('add'), + params: { + save: true, + }, + }, + { + title: '配置产品接入方式', + details: + '通过产品对同一类型的设备进行统一的接入方式配置。请参照设备铭牌说明选择匹配的接入方式。', + iconUrl: '/images/home/bottom-1.png', + linkUrl: '/iot/device/Product/detail', + auth: productPermission('update'), + dialogTag: 'accessMethod', + }, + { + title: '添加测试设备', + details: '添加单个设备,用于验证产品模型是否配置正确。', + iconUrl: '/images/home/bottom-5.png', + linkUrl: '/iot/device/Instance', + auth: devicePermission('add'), + params: { + save: true, + }, + }, + { + title: '功能调试', + details: + '对添加的测试设备进行功能调试,验证能否连接到平台,设备功能是否配置正确。', + iconUrl: '/images/home/bottom-2.png', + linkUrl: '/iot/device/Instance/detail', + // auth: devicePermission('update'), + auth: true, + dialogTag: 'funcTest', + }, + { + title: '批量添加设备', + details: '批量添加同一产品下的设备', + iconUrl: '/images/home/bottom-3.png', + linkUrl: '/iot/device/Instance', + auth: devicePermission('import'), + params: { + import: true, + }, + }, +]; diff --git a/src/views/home/modules/config.ts b/src/views/home/modules/config.ts deleted file mode 100644 index 377db512..00000000 --- a/src/views/home/modules/config.ts +++ /dev/null @@ -1,174 +0,0 @@ -// import {getImage} from '@/utils/comm' -import { useMenuStore } from "@/store/menu"; -import { usePermissionStore } from "@/store/permission"; -import { recommendList, bootConfig } from "../index"; - - -// 按钮权限控制 -const hasPermission = usePermissionStore().hasPermission; -const productPermission = (action: string) => - hasPermission(`device/Product:${action}`); -const devicePermission = (action: string) => - hasPermission(`device/Instance:${action}`); -const rulePermission = (action: string) => - hasPermission(`rule-engine/Instance:${action}`); -// 页面权限控制 -const menuPermission = useMenuStore().hasPermission - - -// 物联网引导-数据 -export const deviceBootConfig: bootConfig[] = [ - { - english: 'STEP1', - label: '创建产品', - link: '/iot/device/Product', - auth: productPermission('add'), - params: { - save: true, - }, - }, - { - english: 'STEP2', - label: '创建设备', - link: '/iot/device/Instance', - auth: devicePermission('add'), - params: { - save: true, - }, - }, - { - english: 'STEP3', - label: '规则引擎', - link: '/iot/rule-engine/Instance', - auth: rulePermission('add'), - params: { - save: true, - }, - }, -]; -// 设备接入推荐步骤-数据 -export const deviceStepDetails: recommendList[] = [ - { - title: '创建产品', - details: - '产品是设备的集合,通常指一组具有相同功能的设备。物联设备必须通过产品进行接入方式配置。', - iconUrl: '/images/home/bottom-4.png', - linkUrl: '/iot/device/Product', - auth: productPermission('add'), - params: { - save: true, - }, - }, - { - title: '配置产品接入方式', - details: - '通过产品对同一类型的设备进行统一的接入方式配置。请参照设备铭牌说明选择匹配的接入方式。', - iconUrl: '/images/home/bottom-1.png', - linkUrl: '/iot/device/Product/detail', - auth: productPermission('update'), - dialogTag: 'accessMethod', - }, - { - title: '添加测试设备', - details: '添加单个设备,用于验证产品模型是否配置正确。', - iconUrl: '/images/home/bottom-5.png', - linkUrl: '/iot/device/Instance', - auth: devicePermission('add'), - params: { - save: true, - }, - }, - { - title: '功能调试', - details: - '对添加的测试设备进行功能调试,验证能否连接到平台,设备功能是否配置正确。', - iconUrl: '/images/home/bottom-2.png', - linkUrl: '/iot/device/Instance/detail', - // auth: devicePermission('update'), - auth: true, - dialogTag: 'funcTest', - }, - { - title: '批量添加设备', - details: '批量添加同一产品下的设备', - iconUrl: '/images/home/bottom-3.png', - linkUrl: '/iot/device/Instance', - auth: devicePermission('import'), - params: { - import: true, - }, - }, -]; - - -// 运维管理引导-数据 -export const opsBootConfig: bootConfig[] = [ - { - english: 'STEP1', - label: '设备接入配置', - link: '/iot/link/accessConfig', - auth: menuPermission('link/accessConfig'), - }, - { - english: 'STEP2', - label: '日志排查', - link: '/iot/link/Log', - auth: menuPermission('link/Log'), - params: { - key: 'system', - }, - }, - { - english: 'STEP3', - label: '实时监控', - link: '/iot/link/dashboard', - auth: menuPermission('link/dashboard'), - params: { - save: true, - }, - }, -]; -// 运维管理推荐步骤-数据 -export const opsStepDetails: recommendList[] = [ - { - title: '协议管理', - details: - '根据业务需求自定义开发对应的产品(设备模型)接入协议,并上传到平台。', - iconUrl: '/images/home/bottom-1.png', - linkUrl: '/iot/link/protocol', - auth: menuPermission('link/Protocol'), - - }, - { - title: '证书管理', - details: '统一维护平台内的证书,用于数据通信加密。', - iconUrl: '/images/home/bottom-6.png', - linkUrl: '/iot/link/Certificate', - auth: menuPermission('link/Certificate'), - - }, - { - title: '网络组件', - details: '根据不同的传输类型配置平台底层网络组件相关参数。', - iconUrl: '/images/home/bottom-3.png', - linkUrl: '/iot/link/type', - auth: menuPermission('link/Type'), - }, - { - title: '设备接入网关', - details: '根据不同的传输类型,关联消息协议,配置设备接入网关相关参数。', - iconUrl: '/images/home/bottom-4.png', - linkUrl: '/iot/link/accessConfig', - auth: menuPermission('link/AccessConfig'), - }, - { - title: '日志管理', - details: '监控系统日志,及时处理系统异常。', - iconUrl: '/images/home/bottom-5.png', - linkUrl: '/iot/link/Log', - auth: menuPermission('Log'), - params: { - key: 'system', - } - }, -]; \ No newline at end of file From bd6a101afed86f2c59600bd11fd0035e653eb18f Mon Sep 17 00:00:00 2001 From: blp <2962632571@qq.com> Date: Tue, 31 Jan 2023 14:14:21 +0800 Subject: [PATCH 05/12] =?UTF-8?q?feat:=20=E7=89=A9=E8=81=94=E5=8D=A1?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E6=96=B0=E5=A2=9E=E3=80=81=E7=BC=96=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/iot-card/cardManagement.ts | 20 +- src/views/iot-card/CardManagement/Save.vue | 246 ++++++++++++++++++++ src/views/iot-card/CardManagement/index.vue | 48 +++- src/views/iot-card/data.ts | 76 ++++++ 4 files changed, 385 insertions(+), 5 deletions(-) create mode 100644 src/views/iot-card/CardManagement/Save.vue create mode 100644 src/views/iot-card/data.ts diff --git a/src/api/iot-card/cardManagement.ts b/src/api/iot-card/cardManagement.ts index 51a77294..34aee292 100644 --- a/src/api/iot-card/cardManagement.ts +++ b/src/api/iot-card/cardManagement.ts @@ -97,4 +97,22 @@ export const _import = (configId: any, params: any) => server.get(`/network/card * @param format 类型 xlsx、csv * @param params */ -export const _export = (format: string, data: any) => server.post(`/network/card/download.${format}/_query`, data, 'blob'); \ No newline at end of file +export const _export = (format: string, data: any) => server.post(`/network/card/download.${format}/_query`, data, 'blob'); + +/** + * 验证iccid + * @param id + */ +export const validateId = (id: string) => server.get(`/network/card/id/_validate?id=${id}`); + +/** + * 新增物联卡 + * @param data + */ +export const add = (data: any) => server.patch(`/network/card`, data); + +/** + * 编辑物联卡 + * @param data + */ +export const edit = (data: any) => server.put(`/network/card/${data.id}`, data); \ No newline at end of file diff --git a/src/views/iot-card/CardManagement/Save.vue b/src/views/iot-card/CardManagement/Save.vue new file mode 100644 index 00000000..9e62a69f --- /dev/null +++ b/src/views/iot-card/CardManagement/Save.vue @@ -0,0 +1,246 @@ + + + diff --git a/src/views/iot-card/CardManagement/index.vue b/src/views/iot-card/CardManagement/index.vue index 3cf85c36..3b5a1809 100644 --- a/src/views/iot-card/CardManagement/index.vue +++ b/src/views/iot-card/CardManagement/index.vue @@ -151,11 +151,18 @@ {{ slotProps.totalFlow }} - M 使用流量 + + M 使用流量
-
{{ slotProps.totalFlow - slotProps.usedFlow }} %
+
+ {{ + slotProps.totalFlow - slotProps.usedFlow + }} + % +
总共 {{ slotProps.totalFlow }} M
@@ -163,7 +170,9 @@
@@ -307,6 +316,13 @@ :cardId="cardId" @change="bindDevice" /> + +
@@ -333,6 +349,7 @@ import { getImage } from '@/utils/comm'; import BindDevice from './BindDevice.vue'; import Import from './Import.vue'; import Export from './Export.vue'; +import Save from './Save.vue'; const cardManageRef = ref>({}); const params = ref>({}); @@ -344,6 +361,7 @@ const exportVisible = ref(false); const importVisible = ref(false); const cardId = ref(); const current = ref>({}); +const saveType = ref(''); const columns = [ { @@ -504,6 +522,11 @@ const getActions = ( title: '编辑', }, icon: 'EditOutlined', + onClick: () => { + visible.value = true; + current.value = data; + saveType.value = 'edit'; + }, }, { key: 'view', @@ -651,10 +674,27 @@ const handleView = (id: string) => { /** * 新增 */ -const handleAdd = () => {}; +const handleAdd = () => { + visible.value = true; + current.value = {}; + saveType.value = 'add'; +}; + +/** + * 新增、编辑关闭弹窗 + * @param val 加载表格 + */ +const saveChange = (val: any) => { + visible.value = false; + current.value = {}; + if (val) { + cardManageRef.value?.reload(); + } +}; /** * 绑定设备关闭窗口 + * @param val */ const bindDevice = (val: boolean) => { bindDeviceVisible.value = false; diff --git a/src/views/iot-card/data.ts b/src/views/iot-card/data.ts new file mode 100644 index 00000000..cf9a9fc3 --- /dev/null +++ b/src/views/iot-card/data.ts @@ -0,0 +1,76 @@ +import { getImage } from '@/utils/comm'; + +// 平台类型 +export const PlatformTypeList = [ + { + label: '移动OneLink', + value: 'OneLinkPB', + imgUrl: getImage('/iot-card/onelink.png'), + }, + { + label: '电信Ctwing', + value: 'CtwingCmp', + imgUrl: getImage('/iot-card/ctwingcmp.png'), + }, + { + label: '联通Unicom', + value: 'UnicomCmp', + imgUrl: getImage('/iot-card/unicom.png'), + }, +]; + +//运营商 +export const OperatorList = [ + { + label: '移动', + value: '移动', + }, + { + label: '电信', + value: '电信', + }, + { + label: '联通', + value: '联通', + }, +]; + +// 类型 +export const TypeList = [ + { + label: '年卡', + value: 'year', + }, + { + label: '季卡', + value: 'season', + }, + { + label: '月卡', + value: 'month', + }, + { + label: '其他', + value: 'other', + }, +]; + +// 支付方式 +export const PaymentMethod = [ + { + label: '支付宝手机网站支付', + value: 'ALIPAY_WAP', + }, + { + label: '支付宝网页及时到账支付', + value: 'ALIPAY_WEB', + }, + { + label: '微信公众号支付', + value: 'WEIXIN_JSAPI', + }, + { + label: '微信扫码支付', + value: 'WEIXIN_NATIVE', + }, +]; From 4ea899f874b30fd7e59c064cd61e98ec963f0369 Mon Sep 17 00:00:00 2001 From: JiangQiming <291854119@qq.com> Date: Tue, 31 Jan 2023 14:24:54 +0800 Subject: [PATCH 06/12] =?UTF-8?q?fix:=20=E9=80=9A=E7=9F=A5=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E6=96=B0=E5=A2=9E=E7=BC=96=E8=BE=91=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/notice/Config/Detail/index.vue | 47 +++++++++++++++--------- src/views/notice/Template/index.vue | 4 +- 2 files changed, 32 insertions(+), 19 deletions(-) diff --git a/src/views/notice/Config/Detail/index.vue b/src/views/notice/Config/Detail/index.vue index 700c6d89..abfc22a5 100644 --- a/src/views/notice/Config/Detail/index.vue +++ b/src/views/notice/Config/Detail/index.vue @@ -311,31 +311,42 @@ const msgType = ref([ // 表单数据 const formData = ref({ configuration: { - appKey: '', - appSecret: '', + host: '', + port: 25, + ssl: false, + sender: '', + username: '', + password: '', }, description: '', name: '', - provider: 'dingTalkMessage', - type: 'dingTalk', + provider: 'embedded', + type: 'email', }); // 根据通知方式展示对应的字段 watch( () => formData.value.type, (val) => { - // formData.value.configuration = Object.values(CONFIG_FIELD_MAP[val])[0]; msgType.value = MSG_TYPE[val]; formData.value.provider = msgType.value[0].value; + + formData.value.configuration = + CONFIG_FIELD_MAP[val][formData.value.provider]; + + clearValid(); }, ); -computed(() => - Object.assign( - formData.value.configuration, - CONFIG_FIELD_MAP[formData.value.type][formData.value.provider], - ), +watch( + () => formData.value.provider, + (val) => { + formData.value.configuration = + CONFIG_FIELD_MAP[formData.value.type][val]; + + clearValid(); + }, ); // 验证规则 @@ -405,15 +416,15 @@ const { resetFields, validate, validateInfos, clearValidate } = useForm( formData.value, formRules.value, ); -watch( - () => formData.value.type, - () => { + +const clearValid = () => { + setTimeout(() => { clearValidate(); - }, - { deep: true }, -); + }, 200); +}; const getDetail = async () => { + if (route.params.id === ':id') return; const res = await configApi.detail(route.params.id as string); // console.log('res: ', res); formData.value = res.result; @@ -441,10 +452,12 @@ const handleSubmit = () => { message.success('保存成功'); router.back(); } - btnLoading.value = false; }) .catch((err) => { console.log('err: ', err); + }) + .finally(() => { + btnLoading.value = false; }); }; diff --git a/src/views/notice/Template/index.vue b/src/views/notice/Template/index.vue index 7af08260..87c20444 100644 --- a/src/views/notice/Template/index.vue +++ b/src/views/notice/Template/index.vue @@ -256,7 +256,7 @@ const getMethodTxt = (type: string) => { * 新增 */ const handleAdd = () => { - router.push(`/notice/Config/detail/:id`); + router.push(`/notice/Template/detail/:id`); }; /** @@ -323,7 +323,7 @@ const getActions = ( onClick: () => { // visible.value = true; // current.value = data; - router.push(`/notice/Config/detail/${data.id}`); + router.push(`/notice/Template/detail/${data.id}`); }, }, { From f381453bceacff6fe59ef4017697ae76c007758a Mon Sep 17 00:00:00 2001 From: 100011797 <2642441182@qq.com> Date: Tue, 31 Jan 2023 15:38:04 +0800 Subject: [PATCH 07/12] =?UTF-8?q?feat:=20=E6=A0=87=E7=AD=BE=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E5=92=8C=E5=85=B3=E7=B3=BB=E7=BC=96=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../images/device/{ => instance}/button.png | Bin src/api/device/instance.ts | 47 +++++++ src/components/Table/index.tsx | 4 +- .../Detail/Info/components/Config/index.vue | 40 ++++-- .../Detail/Info/components/Relation/Save.vue | 125 ++++++++++++++++++ .../Detail/Info/components/Relation/index.vue | 10 ++ .../Detail/Info/components/Tags/Save.vue | 117 ++++++++++++++++ .../Detail/Info/components/Tags/index.vue | 35 ++++- src/views/device/Instance/Detail/index.vue | 77 ++++++++++- src/views/device/Instance/index.vue | 28 ++-- 10 files changed, 456 insertions(+), 27 deletions(-) rename public/images/device/{ => instance}/button.png (100%) create mode 100644 src/views/device/Instance/Detail/Info/components/Relation/Save.vue create mode 100644 src/views/device/Instance/Detail/Info/components/Tags/Save.vue diff --git a/public/images/device/button.png b/public/images/device/instance/button.png similarity index 100% rename from public/images/device/button.png rename to public/images/device/instance/button.png diff --git a/src/api/device/instance.ts b/src/api/device/instance.ts index b1d01908..ceb17116 100644 --- a/src/api/device/instance.ts +++ b/src/api/device/instance.ts @@ -120,3 +120,50 @@ export const update = (data: Partial) => data.id ? server.patch( * @returns */ export const getConfigMetadata = (id: string) => server.get(`/device-instance/${id}/config-metadata`) + +/** + * 断开连接 + * @param id 设备id + * @returns + */ +export const _disconnect = (id: string) => server.post(`/device-instance/${id}/disconnect`) + +/** + * 查询用户列表 + * @returns + */ +export const queryUserListNoPaging = () => server.post(`/user/_query/no-paging`, { + paging: false, + sorts: [{name: 'name', order: "asc"}] +}) + +/** + * 保存设备关系 + * @param id 设备id + * @param data + * @returns + */ +export const saveRelations = (id: string, data: Record) => server.patch(`/device/instance/${id}/relations`, data) + +/** + * 修改标签 + * @param id 设备id + * @param data + * @returns + */ +export const saveTags = (id: string, data: Record) => server.patch(`/device/instance/${id}/tag`, data) + +/** + * 删除标签 + * @param deviceId 设备id + * @param id 标签id + * @returns + */ +export const delTags = (deviceId: string, id: string) => server.remove(`/device/instance/${deviceId}/tag/${id}`) + +/** + * 恢复默认配置 + * @param deviceId 设备id + * @returns + */ +export const configurationReset = (deviceId: string) => server.put(`/device-instance/${deviceId}/configuration/_reset`) \ No newline at end of file diff --git a/src/components/Table/index.tsx b/src/components/Table/index.tsx index 1a37be86..fb778495 100644 --- a/src/components/Table/index.tsx +++ b/src/components/Table/index.tsx @@ -333,7 +333,7 @@ const JTable = defineComponent({ total={total.value} showQuickJumper={false} showSizeChanger={true} - current={pageIndex.value} + current={pageIndex.value + 1} pageSize={pageSize.value} pageSizeOptions={['12', '24', '48', '60', '100']} showTotal={(num) => { @@ -345,7 +345,7 @@ const JTable = defineComponent({ handleSearch({ ...props.params, pageSize: size, - pageIndex: pageSize.value === size ? page : 0 + pageIndex: pageSize.value === size ? (page ? page - 1 : 0) : 0 }) }} /> diff --git a/src/views/device/Instance/Detail/Info/components/Config/index.vue b/src/views/device/Instance/Detail/Info/components/Config/index.vue index f22eabaa..4d7b0d78 100644 --- a/src/views/device/Instance/Detail/Info/components/Config/index.vue +++ b/src/views/device/Instance/Detail/Info/components/Config/index.vue @@ -4,8 +4,12 @@
配置
编辑 - 应用配置 - 恢复默认 + + 应用配置 + + + 恢复默认 + @@ -28,7 +32,8 @@ \ No newline at end of file diff --git a/src/views/device/Instance/Detail/Info/components/Relation/Save.vue b/src/views/device/Instance/Detail/Info/components/Relation/Save.vue new file mode 100644 index 00000000..bf7db937 --- /dev/null +++ b/src/views/device/Instance/Detail/Info/components/Relation/Save.vue @@ -0,0 +1,125 @@ + + + \ No newline at end of file diff --git a/src/views/device/Instance/Detail/Info/components/Relation/index.vue b/src/views/device/Instance/Detail/Info/components/Relation/index.vue index 2fa91436..293fddd2 100644 --- a/src/views/device/Instance/Detail/Info/components/Relation/index.vue +++ b/src/views/device/Instance/Detail/Info/components/Relation/index.vue @@ -7,17 +7,27 @@ {{ item?.related ? (item?.related || []).map(i => i.name).join(',') : '' }} + diff --git a/src/views/device/Instance/Detail/Info/components/Tags/Save.vue b/src/views/device/Instance/Detail/Info/components/Tags/Save.vue new file mode 100644 index 00000000..dafe416a --- /dev/null +++ b/src/views/device/Instance/Detail/Info/components/Tags/Save.vue @@ -0,0 +1,117 @@ + + + \ No newline at end of file diff --git a/src/views/device/Instance/Detail/Info/components/Tags/index.vue b/src/views/device/Instance/Detail/Info/components/Tags/index.vue index b672f699..f197d60f 100644 --- a/src/views/device/Instance/Detail/Info/components/Tags/index.vue +++ b/src/views/device/Instance/Detail/Info/components/Tags/index.vue @@ -1,3 +1,34 @@ \ No newline at end of file +
+ + + {{ item?.value }} + + +
+ + + diff --git a/src/views/device/Instance/Detail/index.vue b/src/views/device/Instance/Detail/index.vue index b4c055b5..d9f2f0e5 100644 --- a/src/views/device/Instance/Detail/index.vue +++ b/src/views/device/Instance/Detail/index.vue @@ -1,7 +1,40 @@ @@ -9,9 +42,18 @@ import { useInstanceStore } from '@/store/instance'; import Info from './Info/index.vue'; import Metadata from '../../components/Metadata/index.vue'; +import { _deploy, _disconnect } from '@/api/device/instance' +import { message } from 'ant-design-vue'; +import { getImage } from '@/utils/comm'; + const route = useRoute(); const instanceStore = useInstanceStore() +const statusMap = new Map(); +statusMap.set('online', 'processing'); +statusMap.set('offline', 'error'); +statusMap.set('notActive', 'warning'); + const list = [ { key: 'Info', @@ -46,4 +88,35 @@ const onBack = () => { const onTabChange = (e: string) => { instanceStore.tabActiveKey = e } + +const handleAction = async () => { + if(instanceStore.current.id){ + const resp = await _deploy(instanceStore.current.id) + if(resp.status === 200){ + message.success('操作成功!') + instanceStore.refresh(instanceStore.current.id) + } + } +} + +const handleDisconnect = async () => { + if(instanceStore.current.id){ + const resp = await _disconnect(instanceStore.current.id) + if(resp.status === 200){ + message.success('操作成功!') + instanceStore.refresh(instanceStore.current.id) + } + } +} + +const handleRefresh = async () => { + if(instanceStore.current.id){ + await instanceStore.refresh(instanceStore.current.id) + message.success('操作成功') + } +} + +const jumpProduct = () => { + message.warn('暂未开发') +} \ No newline at end of file diff --git a/src/views/device/Instance/index.vue b/src/views/device/Instance/index.vue index fb842bec..52fd4ef4 100644 --- a/src/views/device/Instance/index.vue +++ b/src/views/device/Instance/index.vue @@ -101,8 +101,8 @@ :actions="getActions(slotProps, 'card')" v-bind="slotProps" :active="_selectedRowKeys.includes(slotProps.id)" - :status="slotProps.state.value" - :statusText="slotProps.state.text" + :status="slotProps.state?.value" + :statusText="slotProps.state?.text" :statusNames="{ online: 'success', offline: 'error', @@ -126,7 +126,7 @@
设备类型
-
{{ slotProps.deviceType.text }}
+
{{ slotProps.deviceType?.text }}
产品名称
@@ -151,7 +151,7 @@ /> @@ -166,7 +166,7 @@ /> @@ -176,8 +176,8 @@ + diff --git a/src/views/iot-card/CardManagement/index.vue b/src/views/iot-card/CardManagement/index.vue index 3b5a1809..1ac18f80 100644 --- a/src/views/iot-card/CardManagement/index.vue +++ b/src/views/iot-card/CardManagement/index.vue @@ -351,6 +351,8 @@ import Import from './Import.vue'; import Export from './Export.vue'; import Save from './Save.vue'; +const router = useRouter(); + const cardManageRef = ref>({}); const params = ref>({}); const _selectedRowKeys = ref([]); @@ -535,6 +537,14 @@ const getActions = ( title: '查看', }, icon: 'EyeOutlined', + onClick: () => { + router.push({ + path: '/iot-card/CardManagement/Detail', + query: { + id: data.id, + }, + }); + }, }, { key: 'bindDevice', From 88ecf733df1e241a37f0093f21e7d0083d6efb83 Mon Sep 17 00:00:00 2001 From: blp <2962632571@qq.com> Date: Tue, 31 Jan 2023 16:14:04 +0800 Subject: [PATCH 10/12] =?UTF-8?q?feat:=20=E5=85=85=E5=80=BC=E7=AE=A1?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/router/menu.ts | 4 ++++ src/views/iot-card/Recharge/index.vue | 8 ++++++++ 2 files changed, 12 insertions(+) create mode 100644 src/views/iot-card/Recharge/index.vue diff --git a/src/router/menu.ts b/src/router/menu.ts index f7cddb58..4f044c8a 100644 --- a/src/router/menu.ts +++ b/src/router/menu.ts @@ -149,6 +149,10 @@ export default [ path: '/iot-card/CardManagement/Detail', component: () => import('@/views/iot-card/CardManagement/Detail/index.vue') }, + { + path: '/iot-card/Recharge', + component: () => import('@/views/iot-card/Recharge/index.vue') + }, // 北向输出 { path: '/northbound/DuerOS', diff --git a/src/views/iot-card/Recharge/index.vue b/src/views/iot-card/Recharge/index.vue new file mode 100644 index 00000000..4f1bbbc0 --- /dev/null +++ b/src/views/iot-card/Recharge/index.vue @@ -0,0 +1,8 @@ + + + + + + From ea4552a2b8965b90e9af247d4de9fea8bd89d539 Mon Sep 17 00:00:00 2001 From: JiangQiming <291854119@qq.com> Date: Tue, 31 Jan 2023 16:48:01 +0800 Subject: [PATCH 11/12] =?UTF-8?q?fix:=20=E9=92=89=E9=92=89=E6=9C=BA?= =?UTF-8?q?=E5=99=A8=E4=BA=BA=E6=B6=88=E6=81=AF=E7=B1=BB=E5=9E=8B=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/notice/Template/Detail/index.vue | 80 ++++++++++++++-------- 1 file changed, 53 insertions(+), 27 deletions(-) diff --git a/src/views/notice/Template/Detail/index.vue b/src/views/notice/Template/Detail/index.vue index ed323dff..93415894 100644 --- a/src/views/notice/Template/Detail/index.vue +++ b/src/views/notice/Template/Detail/index.vue @@ -120,15 +120,15 @@ ] " > - + /> - + @@ -456,7 +475,7 @@ From c4ae0a6dddd4ea8c99baa1a3f729e493de347cdc Mon Sep 17 00:00:00 2001 From: JiangQiming <291854119@qq.com> Date: Tue, 31 Jan 2023 17:16:19 +0800 Subject: [PATCH 12/12] =?UTF-8?q?fix:=20=E4=BB=A3=E7=A0=81=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E5=99=A8=E7=B2=98=E8=B4=B4=E6=97=B6=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/MonacoEditor/index.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/MonacoEditor/index.vue b/src/components/MonacoEditor/index.vue index 4ec0f91d..9b8b725c 100644 --- a/src/components/MonacoEditor/index.vue +++ b/src/components/MonacoEditor/index.vue @@ -50,6 +50,7 @@ onMounted(() => { automaticLayout: true, scrollBeyondLastLine: false, theme: props.theme, // 主题色: vs(默认高亮), vs-dark(黑色), hc-black(高亮黑色) + formatOnPaste: true, }); instance.onDidChangeModelContent(() => {