From e90b7cfff5f5f723d633611371535dc3f679c2a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AB=98=E4=BA=91=E9=B9=8F?= Date: Mon, 18 Nov 2024 14:06:47 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8A=82=E7=82=B9=EF=BC=9A=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=80=8D=E7=A6=8F=E5=8D=8F=E8=AE=AE=20=E8=AE=A1=E7=AE=97?= =?UTF-8?q?=EF=BC=9A=E4=BF=AE=E6=94=B9=E8=AF=B7=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/dasadmin/src/api/backend/calc/request.ts | 11 +- .../src/views/backend/calculate/index.vue | 26 +- ui/dasadmin/src/views/backend/node/index.vue | 3 + .../src/views/backend/node/protocol.vue | 224 ++++++++++++++++++ ui/dasadmin/src/views/backend/node/type.ts | 7 +- 5 files changed, 264 insertions(+), 7 deletions(-) diff --git a/ui/dasadmin/src/api/backend/calc/request.ts b/ui/dasadmin/src/api/backend/calc/request.ts index 8e087233..0a3f80cd 100644 --- a/ui/dasadmin/src/api/backend/calc/request.ts +++ b/ui/dasadmin/src/api/backend/calc/request.ts @@ -1,5 +1,9 @@ import createAxios from '/@/utils/axios' import { ReqReturnType } from '/@/views/backend/calculate/type' +import { useAdminInfo } from '/@/stores/adminInfo' +import { encrypt_aes,generateRandomNumber } from '/@/utils/crypto' + +const adminInfo = useAdminInfo() export const getCalcListReq = () => { return createAxios { } export const registerCalcReq = (data: FormData) => { + const v = generateRandomNumber(16) + const token = encrypt_aes(adminInfo.token, v) + return createAxios>>({ url: '/api/calc/module/register', method: 'post', data: data, headers:{ - 'Content-Type': 'multipart/form-data' + 'Content-Type': 'multipart/form-data', + v, + token } }, { customEncrypt: true } diff --git a/ui/dasadmin/src/views/backend/calculate/index.vue b/ui/dasadmin/src/views/backend/calculate/index.vue index e12ceaa5..19726b08 100644 --- a/ui/dasadmin/src/views/backend/calculate/index.vue +++ b/ui/dasadmin/src/views/backend/calculate/index.vue @@ -40,8 +40,8 @@ 查看 - 激活 - 禁用 + 激活 + 禁用
@@ -52,7 +52,7 @@
{{ '版本:' + moduleList[(row - 1) * colLen + 1].version }}
{{ '更新于:----' }}
-
@@ -72,8 +72,20 @@ 查看 - 激活 - 禁用 + 激活 + 禁用
@@ -123,6 +135,8 @@ const register = (options: any) => { const formData = new FormData() formData.append('file', options.file) registerCalcReq(formData).then((res) => { + console.log(res) + if (res.success) { ElMessage.success('注册/更新成功!') getList() @@ -139,6 +153,8 @@ const remove = (name: string) => { }) } const active = (name: string) => { + console.log(name); + activeCalcReq({ moduleName: name }).then((res) => { if (res.success) { ElMessage.success('激活成功!') diff --git a/ui/dasadmin/src/views/backend/node/index.vue b/ui/dasadmin/src/views/backend/node/index.vue index d2228627..85218871 100644 --- a/ui/dasadmin/src/views/backend/node/index.vue +++ b/ui/dasadmin/src/views/backend/node/index.vue @@ -529,6 +529,9 @@ const protocolList = [ { label: 'IEC104从 *', value: 9 }, { label: 'MODBUSRTU主 *', value: 12 }, { label: 'MODBUSTCP主 *', value: 16 }, + { label: '倍福MODBUS', value: 11111 }, + { label: '倍福ADS', value: 11112 }, + ] const protocolPartVisible = ref(false) diff --git a/ui/dasadmin/src/views/backend/node/protocol.vue b/ui/dasadmin/src/views/backend/node/protocol.vue index ca3ee1ee..3d0e6521 100644 --- a/ui/dasadmin/src/views/backend/node/protocol.vue +++ b/ui/dasadmin/src/views/backend/node/protocol.vue @@ -828,6 +828,230 @@ const formColumnList: formColumnType[] = [ otherOption: [], }, }, + { + protocol: 11111, + label: '倍福MODBUS', + cardTitle: ['网络设置', '超时设置'], + params: { + netWorkOption: [ + { + key: 'bindAddr', + data: { + label: '绑定地址', + type: 'input', + value: '1.1.1.1', + }, + }, + { + key: 'bindPort', + data: { + label: '绑定端口', + type: 'input', + value: '', + }, + }, + { + key: 'targetAddr', + data: { + label: '目标地址', + type: 'input', + value: '1.1.1.1', + }, + }, + { + key: 'targetPort', + data: { + label: '目标端口', + type: 'input', + value: '', + }, + }, + { + key: 'socketType', + data: { + label: '网络类型', + type: 'select', + value: '0', + list: [ + { + label: 'TCP', + value: '0', + }, + { + label: 'UDP', + value: '1', + }, + ], + }, + }, + { + key: 'ignoredSource', + data: { + label: '忽略地址来源', + type: 'check', + cardTitle: ['网络设置', '超时设置'], + value: true, + }, + }, + { + key: 'ftpMode', + data: { + label: 'FTP模式', + type: 'select', + value: '1', + list: [ + { + label: '启用', + value: '1', + }, + { + label: '禁用', + value: '0', + }, + ], + }, + }, + { + key: 'ftpUser', + data: { + label: 'FTP账号', + type: 'input', + value: '', + }, + }, + { + key: 'ftpPassword', + data: { + label: 'FTP密码', + type: 'input', + value: '', + }, + }, + ], + timeOutOption: [], + otherOption: [], + }, + }, + { + protocol: 11112, + label: '倍福ADS', + cardTitle: ['网络设置', '超时设置'], + params: { + netWorkOption: [ + { + key: 'bindAddr', + data: { + label: '绑定地址', + type: 'input', + value: '1.1.1.1', + }, + }, + { + key: 'bindPort', + data: { + label: '绑定端口', + type: 'input', + value: '', + }, + }, + { + key: 'targetAddr', + data: { + label: '目标地址', + type: 'input', + value: '1.1.1.1', + }, + }, + { + key: 'targetPort', + data: { + label: '目标端口', + type: 'input', + value: '', + }, + }, + { + key: 'socketType', + data: { + label: '网络类型', + type: 'select', + value: '0', + list: [ + { + label: 'TCP', + value: '0', + }, + { + label: 'UDP', + value: '1', + }, + ], + }, + }, + { + key: 'ignoredSource', + data: { + label: '忽略地址来源', + type: 'check', + cardTitle: ['网络设置', '超时设置'], + value: true, + }, + }, + { + key: 'ftpMode', + data: { + label: 'FTP模式', + type: 'select', + value: '1', + list: [ + { + label: '启用', + value: '1', + }, + { + label: '禁用', + value: '0', + }, + ], + }, + }, + { + key: 'ftpUser', + data: { + label: 'FTP账号', + type: 'input', + value: '', + }, + }, + { + key: 'ftpPassword', + data: { + label: 'FTP密码', + type: 'input', + value: '', + }, + }, + { + key: 'adsUser', + data: { + label: 'ADS账号', + type: 'input', + value: '', + }, + }, + { + key: 'adsPassword', + data: { + label: 'ADS密码', + type: 'input', + value: '', + }, + }, + ], + timeOutOption: [], + otherOption: [], + }, + }, ] const currentFormColumn = computed(() => { const data = formColumnList.find((item) => item.protocol === props.protocol)! diff --git a/ui/dasadmin/src/views/backend/node/type.ts b/ui/dasadmin/src/views/backend/node/type.ts index 4d079e92..e8f34299 100644 --- a/ui/dasadmin/src/views/backend/node/type.ts +++ b/ui/dasadmin/src/views/backend/node/type.ts @@ -50,7 +50,7 @@ export type linkType = { id?: string linkName: string protocol?: number - protocolName?:string + protocolName?: string params: string nodeName: string nodeId: string @@ -75,6 +75,11 @@ export type netWorkOptionType = { targetPort?: string socketType?: '0' | '1' ignoredSource?: boolean + ftpMode?: '0' | '1' + ftpUser?: string + ftpPassword?: string + adsUser?: string + adsPassword?: string } export type timeOutOptionType = {