|
@@ -5,7 +5,7 @@ import { message } from 'ant-design-vue';
|
|
import SvgIcon from '@/components/SvgIcon.vue';
|
|
import SvgIcon from '@/components/SvgIcon.vue';
|
|
import { useRequest } from '@/hooks/request';
|
|
import { useRequest } from '@/hooks/request';
|
|
import { t } from '@/i18n';
|
|
import { t } from '@/i18n';
|
|
-import { downloadProtocolTemplate, getDictTypeData } from '@/api';
|
|
|
|
|
|
+import { deleteProtocolBaseInfo, downloadProtocolTemplate, getDictTypeData } from '@/api';
|
|
import { downloadBlob } from '@/utils';
|
|
import { downloadBlob } from '@/utils';
|
|
import { DictCode, ProtocolType } from '@/constants';
|
|
import { DictCode, ProtocolType } from '@/constants';
|
|
|
|
|
|
@@ -16,7 +16,42 @@ const props = defineProps<UseGuideStepItemProps<SetupProtocolForm>>();
|
|
const { handleRequest } = useRequest();
|
|
const { handleRequest } = useRequest();
|
|
let fileName: string | undefined;
|
|
let fileName: string | undefined;
|
|
|
|
|
|
-onMounted(() => {
|
|
|
|
|
|
+onMounted(async () => {
|
|
|
|
+ const { id } = props.form.protocolInfo;
|
|
|
|
+
|
|
|
|
+ Object.assign(props.form.protocolInfo, {
|
|
|
|
+ id: undefined,
|
|
|
|
+ protocolName: '',
|
|
|
|
+ protocolType: undefined,
|
|
|
|
+ deviceType: undefined,
|
|
|
|
+ deviceTypeId: undefined,
|
|
|
|
+ dataBit: 5,
|
|
|
|
+ parityBit: 'N',
|
|
|
|
+ stopBit: '1',
|
|
|
|
+ baudRate: undefined,
|
|
|
|
+ dataSendInterval: undefined,
|
|
|
|
+ highFreqSendInterval: undefined,
|
|
|
|
+ readTimeout: undefined,
|
|
|
|
+ nextDataReadDelay: undefined,
|
|
|
|
+ nextRoundDataReadDelay: undefined,
|
|
|
|
+ readContinuousAddr: undefined,
|
|
|
|
+ readContinuousAddrCode: undefined,
|
|
|
|
+ readContinuousAddrLength: undefined,
|
|
|
|
+ byteOrder: undefined,
|
|
|
|
+ byteOrderCode: undefined,
|
|
|
|
+ addrOrder: undefined,
|
|
|
|
+ addrOrderCode: undefined,
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ // 协议 id 存在时删除草稿协议
|
|
|
|
+ try {
|
|
|
|
+ if (id) {
|
|
|
|
+ await deleteProtocolBaseInfo(id);
|
|
|
|
+ }
|
|
|
|
+ } catch (err) {
|
|
|
|
+ console.log(err);
|
|
|
|
+ }
|
|
|
|
+
|
|
handleRequest(async () => {
|
|
handleRequest(async () => {
|
|
const data = await getDictTypeData({
|
|
const data = await getDictTypeData({
|
|
dictCode: DictCode.ProtocolTemplateFileName,
|
|
dictCode: DictCode.ProtocolTemplateFileName,
|