diff --git a/src/views/link/AccessConfig/Detail/index.vue b/src/views/link/AccessConfig/Detail/index.vue
index 97c13e2e..5c9b4546 100644
--- a/src/views/link/AccessConfig/Detail/index.vue
+++ b/src/views/link/AccessConfig/Detail/index.vue
@@ -9,7 +9,8 @@
@@ -17,10 +18,11 @@
\ No newline at end of file
+
diff --git a/src/views/link/AccessConfig/components/Media/index.vue b/src/views/link/AccessConfig/components/Media/index.vue
new file mode 100644
index 00000000..75957aea
--- /dev/null
+++ b/src/views/link/AccessConfig/components/Media/index.vue
@@ -0,0 +1,30 @@
+
+
+111
+
+
+
+
+
+
diff --git a/src/views/link/AccessConfig/components/Network.vue b/src/views/link/AccessConfig/components/Network.vue
index 8bb9b232..163d4813 100644
--- a/src/views/link/AccessConfig/components/Network.vue
+++ b/src/views/link/AccessConfig/components/Network.vue
@@ -35,18 +35,34 @@
: descriptionList[provider.id],
}"
>
-
-
-
+
+
+
+
@@ -56,34 +72,19 @@
? 'red'
: 'green'
"
- />{{ i.address }}
+ :text="i.address"
+ />
+ ...
-
-
-
-
+
+
+
@@ -130,37 +131,31 @@
-
-
+
+
-
+
@@ -259,7 +254,7 @@
:scroll="{ y: 300 }"
>
下一步
-
+
保存
@@ -317,8 +312,61 @@ import {
ProtocolMapping,
} from '../Detail/data';
import AccessCard from './AccessCard/index.vue';
-import TitleComponent from '@/components/TitleComponent/index.vue';
import { message, Form } from 'ant-design-vue';
+import type { FormInstance } from 'ant-design-vue';
+
+//测试数据1
+const resultList1 = [
+ {
+ id: '1610466717670780928',
+ name: '官方协议',
+ },
+ {
+ id: '1610205217785524224',
+ name: 'demo协议',
+ },
+ {
+ id: '1610204985806958592',
+ name: '水压协议',
+ },
+ {
+ id: '1605459961693745152',
+ name: '测试设备诊断日志显示',
+ },
+ {
+ id: '1582302200020783104',
+ name: 'demo',
+ },
+ {
+ id: '1581839391887794176',
+ name: '海康闸机协议',
+ },
+ {
+ id: '1567062365030637568',
+ name: '协议20220906160914',
+ },
+ {
+ id: '1561650927208628224',
+ name: 'local',
+ },
+];
+
+//测试数据2
+// const result2 = {
+// id: 'UDP',
+// name: 'UDP',
+// features: [],
+// routes: [],
+// metadata: '',
+// };
+const result2 = {
+"id": "MQTT",
+"name": "MQTT",
+"features": [],
+"routes": [],
+"document": "# MQTT认证说明\r\nCONNECT报文:\r\n```text\r\nclientId: 设备ID\r\nusername: secureId+\"|\"+timestamp\r\npassword: md5(secureId+\"|\"+timestamp+\"|\"+secureKey)\r\n ```\r\n\r\n说明: secureId以及secureKey在创建设备产品或设备实例时进行配置. \r\ntimestamp为当前系统时间戳(毫秒),与系统时间不能相差5分钟.\r\nmd5为32位,不区分大小写.",
+"metadata": "{\"functions\":[],\"name\":\"test\",\"description\":\"测试用\",\"id\":\"test\",\"properties\":[{\"valueType\":{\"round\":\"HALF_UP\",\"type\":\"double\"},\"name\":\"温度\",\"id\":\"t\"},{\"valueType\":{\"round\":\"HALF_UP\",\"type\":\"int\"},\"name\":\"状态\",\"id\":\"state\"}],\"events\":[],\"tags\":[]}"
+}
function generateUUID() {
var d = new Date().getTime();
@@ -349,7 +397,8 @@ const props = defineProps({
},
});
-
+const formRef = ref();
+const useForm = Form.useForm;
const current = ref(0);
const stepCurrent = ref(0);
@@ -362,13 +411,21 @@ const procotolCurrent = ref('');
let config = ref({});
let columnsMQTT = ref([]);
const form = reactive({
- name: 'access',
+ name: '',
description: '',
});
+const { resetFields, validate, validateInfos } = useForm(
+ form,
+ reactive({
+ name: [
+ { required: true, message: '请输入证书名称', trigger: 'blur' },
+ { max: 64, message: '最多可输入64个字符' },
+ ],
+ }),
+);
+
const queryNetworkList = async (id: string, params: object, data = {}) => {
- console.log('queryNetworkList',NetworkTypeMapping.get(id), data, params);
-
const resp = await getNetworkList(NetworkTypeMapping.get(id), data, params);
if (resp.status === 200) {
networkList.value = resp.result;
@@ -377,15 +434,19 @@ const queryNetworkList = async (id: string, params: object, data = {}) => {
// const queryProcotolList=async(id:string, params:object) =>{
const queryProcotolList = async (id: string, params = {}) => {
- const resp = await getProtocolList(ProtocolMapping.get(id), {
- ...params,
- 'sorts[0].name': 'createTime',
- 'sorts[0].order': 'desc',
- });
- if (resp.status === 200) {
- procotolList.value = resp.result;
- allProcotolList.value = resp.result;
- }
+ // const resp = await getProtocolList(ProtocolMapping.get(id), {
+ // ...params,
+ // 'sorts[0].name': 'createTime',
+ // 'sorts[0].order': 'desc',
+ // });
+ // if (resp.status === 200) {
+ // procotolList.value = resp.result;
+ // allProcotolList.value = resp.result;
+ // }
+
+ //使用测试数据1
+ procotolList.value = resultList1;
+ allProcotolList.value = resultList1;
};
const addNetwork = () => {
@@ -424,21 +485,6 @@ const checkedChange = (id: string) => {
};
const networkSearch = (value: string) => {
- console.log('networkSearch',
- props.provider.id,
- {
- include: networkCurrent.value || '',
- },
- {
- terms: [
- {
- column: 'name$LIKE',
- value: `%${value}%`,
- },
- ],
- },
- );
-
queryNetworkList(
props.provider.id,
{
@@ -475,31 +521,28 @@ const procotolSearch = (value: string) => {
};
const saveData = () => {
- form.validateFields(async (err, values) => {
- if (!err) {
+ validate()
+ .then(async (values) => {
let resp = undefined;
+ let params = {
+ ...props.data,
+ ...values,
+ protocol: procotolCurrent.value,
+ channel: 'network', // 网络组件
+ channelId: networkCurrent.value,
+ };
if (props.data && props.data.id) {
- resp = await update({
- ...props.data,
- name: values.name,
- description: values.description,
- protocol: procotolCurrent.value,
- channel: 'network', // 网络组件
- channelId: networkCurrent.value,
- });
+ resp = await update(params);
} else {
- resp = await save({
- name: values.name,
- description: values.description,
+ params = {
+ ...params,
provider: props.provider.id,
- protocol: procotolCurrent.value,
transport:
props.provider?.id === 'child-device'
? 'Gateway'
: ProtocolMapping.get(props.provider.id),
- channel: 'network', // 网络组件
- channelId: networkCurrent.value,
- });
+ };
+ resp = await save(params);
}
if (resp.status === 200) {
message.success('操作成功!');
@@ -511,88 +554,139 @@ const saveData = () => {
// this.$store.dispatch('jumpPathByKey', { key: MenuKeys['Link/AccessConfig'] })
}
}
- }
- });
+ })
+ .catch((err) => {});
};
+
const next = async () => {
if (current.value === 0) {
if (!networkCurrent.value) {
message.error('请选择网络组件!');
} else {
queryProcotolList(props.provider.id);
- current.value -= current.value;
+ current.value = current.value + 1;
}
} else if (current.value === 1) {
if (!procotolCurrent.value) {
message.error('请选择消息协议!');
} else {
- const resp =
- props.provider.channel !== 'child-device'
- ? await getConfigView(
- procotolCurrent.value,
- ProtocolMapping.get(props.provider.id),
- )
- : await getChildConfigView(procotolCurrent.value);
- if (resp.status === 200) {
- config.value = resp.result;
- current.value += current.value;
- columnsMQTT = [
- {
- title: '分组',
- dataIndex: 'group',
- key: 'group',
- ellipsis: true,
- align: 'center',
- width: 100,
- customRender: (value, row, index) => {
- const obj = {
- children: value,
- attrs: {},
- };
- const list = (config && config.routes) || [];
- const arr = list.filter((res) => {
- return res.group == row.group;
- });
- if (
- index == 0 ||
- list[index - 1].group !== row.group
- ) {
- obj.attrs.rowSpan = arr.length;
- } else {
- obj.attrs.rowSpan = 0;
- }
- return obj;
- },
+ //使用测试数据2
+ config.value = result2;
+ current.value = current.value + 1;
+ columnsMQTT = [
+ {
+ title: '分组',
+ dataIndex: 'group',
+ key: 'group',
+ ellipsis: true,
+ align: 'center',
+ width: 100,
+ customRender: (value, row, index) => {
+ const obj = {
+ children: value,
+ attrs: {},
+ };
+ const list = (config && config.routes) || [];
+ const arr = list.filter((res) => {
+ return res.group == row.group;
+ });
+ if (index == 0 || list[index - 1].group !== row.group) {
+ obj.attrs.rowSpan = arr.length;
+ } else {
+ obj.attrs.rowSpan = 0;
+ }
+ return obj;
},
- {
- title: 'topic',
- dataIndex: 'topic',
- key: 'topic',
- ellipsis: true,
- },
- {
- title: '上下行',
- dataIndex: 'stream',
- key: 'stream',
- ellipsis: true,
- align: 'center',
- width: 100,
- scopedSlots: { customRender: 'stream' },
- },
- {
- title: '说明',
- dataIndex: 'description',
- key: 'description',
- ellipsis: true,
- },
- ];
- }
+ },
+ {
+ title: 'topic',
+ dataIndex: 'topic',
+ key: 'topic',
+ ellipsis: true,
+ },
+ {
+ title: '上下行',
+ dataIndex: 'stream',
+ key: 'stream',
+ ellipsis: true,
+ align: 'center',
+ width: 100,
+ scopedSlots: { customRender: 'stream' },
+ },
+ {
+ title: '说明',
+ dataIndex: 'description',
+ key: 'description',
+ ellipsis: true,
+ },
+ ];
+
+ // const resp =
+ // props.provider.channel !== 'child-device'
+ // ? await getConfigView(
+ // procotolCurrent.value,
+ // ProtocolMapping.get(props.provider.id),
+ // )
+ // : await getChildConfigView(procotolCurrent.value);
+ // if (resp.status === 200) {
+ // config.value = resp.result;
+ // current.value = current.value + 1;
+ // columnsMQTT = [
+ // {
+ // title: '分组',
+ // dataIndex: 'group',
+ // key: 'group',
+ // ellipsis: true,
+ // align: 'center',
+ // width: 100,
+ // customRender: (value, row, index) => {
+ // const obj = {
+ // children: value,
+ // attrs: {},
+ // };
+ // const list = (config && config.routes) || [];
+ // const arr = list.filter((res) => {
+ // return res.group == row.group;
+ // });
+ // if (
+ // index == 0 ||
+ // list[index - 1].group !== row.group
+ // ) {
+ // obj.attrs.rowSpan = arr.length;
+ // } else {
+ // obj.attrs.rowSpan = 0;
+ // }
+ // return obj;
+ // },
+ // },
+ // {
+ // title: 'topic',
+ // dataIndex: 'topic',
+ // key: 'topic',
+ // ellipsis: true,
+ // },
+ // {
+ // title: '上下行',
+ // dataIndex: 'stream',
+ // key: 'stream',
+ // ellipsis: true,
+ // align: 'center',
+ // width: 100,
+ // scopedSlots: { customRender: 'stream' },
+ // },
+ // {
+ // title: '说明',
+ // dataIndex: 'description',
+ // key: 'description',
+ // ellipsis: true,
+ // },
+ // ];
+ // }
}
}
};
const prev = () => {
- const currentValue = current.value;
- current.value -= currentValue;
+ current.value = current.value - 1;
};
onMounted(() => {
@@ -601,10 +695,6 @@ onMounted(() => {
procotolCurrent.value = props.data.protocol;
current.value = 0;
networkCurrent.value = props.data.channelId;
- console.log(11111111,props.provider.id, {
- include: networkCurrent.value,
- });
-
queryNetworkList(props.provider.id, {
include: networkCurrent.value,
});
@@ -618,18 +708,12 @@ onMounted(() => {
} else {
if (props.provider?.id) {
if (props.provider.channel !== 'child-device') {
- console.log(3333333, props.provider.id, {
- include: '',
- });
-
queryNetworkList(props.provider.id, {
include: '',
});
steps.value = ['网络组件', '消息协议', '完成'];
current.value = 0;
} else {
- console.log(444444,props.provider.id);
-
steps.value = ['消息协议', '完成'];
current.value = 1;
queryProcotolList(props.provider.id);
@@ -638,25 +722,20 @@ onMounted(() => {
}
});
-// watch(
-// () => props.modelValue,
-// (v) => {
-// keystoreBase64.value = v;
-// },
-// {
-// deep: true,
-// immediate: true,
-// },
-// );
-// watch: {
-// current(val) {
-// if (this.provider.channel !== 'child-device') {
-// this.stepCurrent = val
-// } else {
-// this.stepCurrent = val - 1
-// }
-// },
-// },
+watch(
+ current,
+ (v) => {
+ if (props.provider.channel !== 'child-device') {
+ stepCurrent.value = v;
+ } else {
+ stepCurrent.value = v - 1;
+ }
+ },
+ {
+ deep: true,
+ immediate: true,
+ },
+);