节点:添加倍福协议

计算:修改请求
This commit is contained in:
高云鹏 2024-11-18 14:06:47 +08:00
parent c2131527ea
commit e90b7cfff5
5 changed files with 264 additions and 7 deletions

View File

@ -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<never, Promise<ReqReturnType<{
@ -16,12 +20,17 @@ export const getCalcListReq = () => {
}
export const registerCalcReq = (data: FormData) => {
const v = generateRandomNumber(16)
const token = encrypt_aes(adminInfo.token, v)
return createAxios<never, Promise<ReqReturnType<never>>>({
url: '/api/calc/module/register',
method: 'post',
data: data,
headers:{
'Content-Type': 'multipart/form-data'
'Content-Type': 'multipart/form-data',
v,
token
}
},
{ customEncrypt: true }

View File

@ -40,8 +40,8 @@
</template>
</el-popconfirm>
<el-button type="primary">查看</el-button>
<el-button v-if="moduleList[(row - 1) * colLen].disabled === 1" type="primary" plain @click="active">激活</el-button>
<el-button v-if="moduleList[(row - 1) * colLen].disabled === 0" type="danger" plain @click="deactive">禁用</el-button>
<el-button v-if="moduleList[(row - 1) * colLen].disabled === 1" type="primary" plain @click="active(moduleList[(row - 1) * colLen].name)">激活</el-button>
<el-button v-if="moduleList[(row - 1) * colLen].disabled === 0" type="danger" plain @click="deactive(moduleList[(row - 1) * colLen].name)">禁用</el-button>
</div>
</div>
<div class="moduleItem" v-if="moduleList[(row - 1) * colLen + 1]">
@ -52,7 +52,7 @@
<div class="versionTime">
<div class="version">{{ '版本:' + moduleList[(row - 1) * colLen + 1].version }}</div>
<div class="updateTime">{{ '更新于:----' }}</div>
<!--
<!--
<div class="updateTime">{{ '更新于:' + moduleList[(row - 1) * colLen + 1]?.updateTime ?? '--' }}</div>
-->
</div>
@ -72,8 +72,20 @@
</template>
</el-popconfirm>
<el-button type="primary">查看</el-button>
<el-button v-if="moduleList[(row - 1) * colLen + 1].disabled === 1" type="primary" plain @click="active">激活</el-button>
<el-button v-if="moduleList[(row - 1) * colLen + 1].disabled === 0" type="danger" plain @click="deactive">禁用</el-button>
<el-button
v-if="moduleList[(row - 1) * colLen + 1].disabled === 1"
type="primary"
plain
@click="active(moduleList[(row - 1) * colLen + 1].name)"
>激活</el-button
>
<el-button
v-if="moduleList[(row - 1) * colLen + 1].disabled === 0"
type="danger"
plain
@click="deactive(moduleList[(row - 1) * colLen + 1].name)"
>禁用</el-button
>
</div>
</div>
<div class="moduleItem" style="visibility: hidden" v-else></div>
@ -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('激活成功!')

View File

@ -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)

View File

@ -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)!

View File

@ -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 = {