|
@@ -11,7 +11,7 @@ import {
|
|
|
gatewayLinkProtocolReset,
|
|
|
gatewayLinkUpdate,
|
|
|
getDictTypeData,
|
|
|
- postProtocolList,
|
|
|
+ postProtocolCandidatesList,
|
|
|
} from '@/api';
|
|
|
import { DictCode } from '@/constants';
|
|
|
|
|
@@ -85,51 +85,51 @@ let data: ProtocolsItem[] = [];
|
|
|
|
|
|
const columns = [
|
|
|
{
|
|
|
- title: '协议类型',
|
|
|
+ title: t('setupProtocol.protocolType'),
|
|
|
dataIndex: 'protocolType',
|
|
|
key: 'protocolType',
|
|
|
width: 170,
|
|
|
},
|
|
|
{
|
|
|
- title: '从站号',
|
|
|
+ title: t('registerGateway.stationNumber'),
|
|
|
dataIndex: 'station',
|
|
|
key: 'station',
|
|
|
},
|
|
|
{
|
|
|
- title: '电表',
|
|
|
+ title: t('registerGateway.electricMeter'),
|
|
|
dataIndex: 'name',
|
|
|
key: 'name',
|
|
|
},
|
|
|
{
|
|
|
- title: '通讯协议',
|
|
|
+ title: t('registerGateway.communicationProtocol'),
|
|
|
key: 'protocolName',
|
|
|
dataIndex: 'protocolName',
|
|
|
width: 220,
|
|
|
},
|
|
|
{
|
|
|
- title: '关联设备',
|
|
|
+ title: t('registerGateway.associatedEquipment'),
|
|
|
key: 'dev',
|
|
|
dataIndex: 'dev',
|
|
|
},
|
|
|
{
|
|
|
- title: '操作',
|
|
|
+ title: t('common.operation'),
|
|
|
key: 'action',
|
|
|
},
|
|
|
];
|
|
|
|
|
|
const protocolColumns = [
|
|
|
{
|
|
|
- title: '协议类型',
|
|
|
+ title: t('setupProtocol.protocolType'),
|
|
|
dataIndex: 'protocolName',
|
|
|
key: 'protocolName',
|
|
|
},
|
|
|
{
|
|
|
- title: '协议号',
|
|
|
+ title: t('registerGateway.agreementNumber'),
|
|
|
dataIndex: 'protocolNumber',
|
|
|
key: 'protocolNumber',
|
|
|
},
|
|
|
{
|
|
|
- title: '协议名称',
|
|
|
+ title: t('setupProtocol.protocolName'),
|
|
|
dataIndex: 'deviceType',
|
|
|
key: 'deviceType',
|
|
|
},
|
|
@@ -138,11 +138,11 @@ const protocolColumns = [
|
|
|
const options2 = ref([
|
|
|
{
|
|
|
value: '1',
|
|
|
- payload: '平台协议',
|
|
|
+ payload: t('registerGateway.platformAgreement'),
|
|
|
},
|
|
|
{
|
|
|
value: '2',
|
|
|
- payload: '自有协议',
|
|
|
+ payload: t('registerGateway.proprietaryProtocol'),
|
|
|
},
|
|
|
]);
|
|
|
|
|
@@ -219,7 +219,7 @@ const bindingAgreement = () => {
|
|
|
|
|
|
postGetList();
|
|
|
} else {
|
|
|
- message.warning('请添加从站列表数据');
|
|
|
+ message.warning(t('registerGateway.prompt'));
|
|
|
}
|
|
|
});
|
|
|
})
|
|
@@ -243,27 +243,30 @@ const replaceAgreement = (value: number) => {
|
|
|
open1.value = true;
|
|
|
|
|
|
handleRequest(async () => {
|
|
|
- const { records } = await postProtocolList({
|
|
|
- pageIndex: 1,
|
|
|
- pageSize: 10,
|
|
|
- });
|
|
|
+ const { records } = await postProtocolCandidatesList(
|
|
|
+ {
|
|
|
+ pageIndex: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ },
|
|
|
+ props.form.id,
|
|
|
+ );
|
|
|
protocolList.value = records;
|
|
|
});
|
|
|
};
|
|
|
|
|
|
const rules1: Record<string, Rule[]> = {
|
|
|
- dataSendInterval: [{ required: true, message: '不能为空', trigger: 'change' }],
|
|
|
- highFreqSendInterval: [{ required: true, message: '不能为空', trigger: 'change' }],
|
|
|
+ dataSendInterval: [{ required: true, message: t('common.cannotEmpty'), trigger: 'change' }],
|
|
|
+ highFreqSendInterval: [{ required: true, message: t('common.cannotEmpty'), trigger: 'change' }],
|
|
|
};
|
|
|
|
|
|
const rules: Record<string, Rule[]> = {
|
|
|
- baudRate: [{ required: true, message: '不能为空', trigger: 'change' }],
|
|
|
- dataBit: [{ required: true, message: '不能为空', trigger: 'change' }],
|
|
|
- parityBit: [{ required: true, message: '不能为空', trigger: 'change' }],
|
|
|
- stopBit: [{ required: true, message: '不能为空', trigger: 'change' }],
|
|
|
- readTimeout: [{ required: true, message: '不能为空', trigger: 'change' }],
|
|
|
- nextDataReadDelay: [{ required: true, message: '不能为空', trigger: 'change' }],
|
|
|
- nextRoundDataReadDelay: [{ required: true, message: '不能为空', trigger: 'change' }],
|
|
|
+ baudRate: [{ required: true, message: t('common.cannotEmpty'), trigger: 'change' }],
|
|
|
+ dataBit: [{ required: true, message: t('common.cannotEmpty'), trigger: 'change' }],
|
|
|
+ parityBit: [{ required: true, message: t('common.cannotEmpty'), trigger: 'change' }],
|
|
|
+ stopBit: [{ required: true, message: t('common.cannotEmpty'), trigger: 'change' }],
|
|
|
+ readTimeout: [{ required: true, message: t('common.cannotEmpty'), trigger: 'change' }],
|
|
|
+ nextDataReadDelay: [{ required: true, message: t('common.cannotEmpty'), trigger: 'change' }],
|
|
|
+ nextRoundDataReadDelay: [{ required: true, message: t('common.cannotEmpty'), trigger: 'change' }],
|
|
|
};
|
|
|
|
|
|
const rowSelectedChange = (selectedRowKeys: Key[], selectedRows: ProtocolItem[]) => {
|
|
@@ -406,7 +409,7 @@ onMounted(() => {
|
|
|
>
|
|
|
<ARow style="margin-top: 40px">
|
|
|
<ACol :span="6">
|
|
|
- <AFormItem label="波特率" name="baudRate">
|
|
|
+ <AFormItem :label="$t('setupProtocol.baudRate')" name="baudRate">
|
|
|
<ASelect
|
|
|
v-model:value="agreementForm.baudRate"
|
|
|
class="protocol-select"
|
|
@@ -419,7 +422,7 @@ onMounted(() => {
|
|
|
</AFormItem>
|
|
|
</ACol>
|
|
|
<ACol :span="6">
|
|
|
- <AFormItem label="数据位" name="dataBit">
|
|
|
+ <AFormItem :label="$t('setupProtocol.dataBit')" name="dataBit">
|
|
|
<ARadioGroup v-model:value="agreementForm.dataBit">
|
|
|
<ARadio :value="5">5</ARadio>
|
|
|
<ARadio :value="6">6</ARadio>
|
|
@@ -429,7 +432,7 @@ onMounted(() => {
|
|
|
</AFormItem>
|
|
|
</ACol>
|
|
|
<ACol :span="6">
|
|
|
- <AFormItem label="停止位" name="stopBit">
|
|
|
+ <AFormItem :label="$t('setupProtocol.stopBit')" name="stopBit">
|
|
|
<ARadioGroup v-model:value="agreementForm.stopBit">
|
|
|
<ARadio value="1">1</ARadio>
|
|
|
<ARadio value="1.5">1.5</ARadio>
|
|
@@ -438,7 +441,7 @@ onMounted(() => {
|
|
|
</AFormItem>
|
|
|
</ACol>
|
|
|
<ACol :span="6">
|
|
|
- <AFormItem label="校验位" name="parityBit">
|
|
|
+ <AFormItem :label="$t('setupProtocol.parityBit')" name="parityBit">
|
|
|
<ARadioGroup v-model:value="agreementForm.parityBit">
|
|
|
<ARadio value="N">N</ARadio>
|
|
|
<ARadio value="O">O</ARadio>
|
|
@@ -449,21 +452,21 @@ onMounted(() => {
|
|
|
</ARow>
|
|
|
<ARow>
|
|
|
<ACol :span="6">
|
|
|
- <AFormItem label="读取超时时间" name="readTimeout">
|
|
|
+ <AFormItem :label="$t('setupProtocol.readTimeout')" name="readTimeout">
|
|
|
<AInputNumber v-model:value="agreementForm.readTimeout">
|
|
|
<template #addonAfter>ms</template>
|
|
|
</AInputNumber>
|
|
|
</AFormItem>
|
|
|
</ACol>
|
|
|
<ACol :span="6">
|
|
|
- <AFormItem label="下一条数据读取延时" name="nextDataReadDelay">
|
|
|
+ <AFormItem :label="$t('registerGateway.nextDelayExtraction')" name="nextDataReadDelay">
|
|
|
<AInputNumber v-model:value="agreementForm.nextDataReadDelay">
|
|
|
<template #addonAfter>ms</template>
|
|
|
</AInputNumber>
|
|
|
</AFormItem>
|
|
|
</ACol>
|
|
|
<ACol :span="6">
|
|
|
- <AFormItem label="下一轮数据读取延时" name="nextRoundDataReadDelay">
|
|
|
+ <AFormItem :label="$t('registerGateway.nextRoundDelayExtraction')" name="nextRoundDataReadDelay">
|
|
|
<AInputNumber v-model:value="agreementForm.nextRoundDataReadDelay">
|
|
|
<template #addonAfter>ms</template>
|
|
|
</AInputNumber>
|
|
@@ -485,35 +488,35 @@ onMounted(() => {
|
|
|
<template v-else-if="column.key === 'protocolName'">
|
|
|
<AInputSearch disabled v-model:value="record.protocolName">
|
|
|
<template #enterButton>
|
|
|
- <AButton style="color: #32bac0" @click="replaceAgreement(index)">更换协议</AButton>
|
|
|
+ <AButton style="color: #32bac0" @click="replaceAgreement(index)">{{
|
|
|
+ $t('registerGateway.renegotiationAgreement')
|
|
|
+ }}</AButton>
|
|
|
</template>
|
|
|
</AInputSearch>
|
|
|
</template>
|
|
|
<template v-else-if="column.key === 'action'">
|
|
|
- <AButton @click="advancedSettings(record as AgreementData, index)">设置</AButton>
|
|
|
- <AButton @click="deleteAgreement(index)">删除</AButton>
|
|
|
+ <AButton @click="advancedSettings(record as AgreementData, index)">{{ $t('common.settings') }}</AButton>
|
|
|
+ <AButton @click="deleteAgreement(index)">{{ $t('common.delete') }}</AButton>
|
|
|
</template>
|
|
|
</template>
|
|
|
</ATable>
|
|
|
|
|
|
<AFlex justify="space-between">
|
|
|
<div class="but-text" @click="addSlave">
|
|
|
- <span>添加从站</span>
|
|
|
+ <span>{{ $t('registerGateway.addStation') }}</span>
|
|
|
</div>
|
|
|
<div style="margin-top: 24px">
|
|
|
- <AButton style="margin-right: 16px; color: #32bac0; border-color: #32bac0" @click="open = false"
|
|
|
- >关闭</AButton
|
|
|
- >
|
|
|
- <AButton type="primary" @click="bindingAgreement">保存</AButton>
|
|
|
+ <AButton class="off-but" @click="open = false">{{ $t('common.turnOff') }}</AButton>
|
|
|
+ <AButton type="primary" @click="bindingAgreement">{{ $t('common.save') }}</AButton>
|
|
|
</div>
|
|
|
</AFlex>
|
|
|
</AModal>
|
|
|
|
|
|
<AModal
|
|
|
v-model:open="open1"
|
|
|
- title="更换协议"
|
|
|
- ok-text="确认"
|
|
|
- cancel-text="取消"
|
|
|
+ :title="$t('registerGateway.renegotiationAgreement')"
|
|
|
+ :ok-text="$t('common.confirm')"
|
|
|
+ :cancel-text="$t('common.cancel')"
|
|
|
width="1100px"
|
|
|
@ok="handleOk1"
|
|
|
:mask-closable="false"
|
|
@@ -531,7 +534,7 @@ onMounted(() => {
|
|
|
</ACol>
|
|
|
<ACol :span="12">
|
|
|
<AFlex justify="flex-end">
|
|
|
- <AInput style="width: 50%" placeholder="请输入协议名称" />
|
|
|
+ <AInput style="width: 50%" :placeholder="$t('registerGateway.pleaseProtocolName')" />
|
|
|
</AFlex>
|
|
|
</ACol>
|
|
|
</ARow>
|
|
@@ -548,9 +551,9 @@ onMounted(() => {
|
|
|
|
|
|
<AModal
|
|
|
v-model:open="open2"
|
|
|
- title="协议高级设置"
|
|
|
- ok-text="确认"
|
|
|
- cancel-text="取消"
|
|
|
+ :title="$t('registerGateway.advancedSettingsAgreement')"
|
|
|
+ :ok-text="$t('common.confirm')"
|
|
|
+ :cancel-text="$t('common.cancel')"
|
|
|
width="500px"
|
|
|
@ok="handleOk"
|
|
|
:mask-closable="false"
|
|
@@ -559,11 +562,11 @@ onMounted(() => {
|
|
|
<AForm :model="protocolsItem" label-align="left" layout="vertical" :rules="rules1" :wrapper-col="{ span: 20 }">
|
|
|
<ARow style="margin-top: 40px">
|
|
|
<ACol :span="12">
|
|
|
- <AFormItem label="普通数据上报频率" name="dataSendInterval">
|
|
|
+ <AFormItem :label="$t('registerGateway.dataReportingFrequency')" name="dataSendInterval">
|
|
|
<AInput v-model:value="protocolsItem.dataSendInterval" placeholder="Basic usage" /> </AFormItem
|
|
|
></ACol>
|
|
|
<ACol :span="12"
|
|
|
- ><AFormItem label="高频数据上报频率" name="highFreqSendInterval">
|
|
|
+ ><AFormItem :label="$t('registerGateway.highDataFrequencyReportingFrequency')" name="highFreqSendInterval">
|
|
|
<AInput v-model:value="protocolsItem.highFreqSendInterval" placeholder="Basic usage" /> </AFormItem
|
|
|
></ACol>
|
|
|
</ARow>
|
|
@@ -645,4 +648,10 @@ onMounted(() => {
|
|
|
text-align: left;
|
|
|
cursor: pointer;
|
|
|
}
|
|
|
+
|
|
|
+.off-but {
|
|
|
+ margin-right: 16px;
|
|
|
+ color: #32bac0;
|
|
|
+ border-color: #32bac0;
|
|
|
+}
|
|
|
</style>
|