|
@@ -345,244 +345,8 @@ onMounted(() => {
|
|
|
getMessageData();
|
|
|
getCertificateList();
|
|
|
});
|
|
|
-
|
|
|
-// export default defineComponent({
|
|
|
-// // name: 'serverCreate',
|
|
|
-// // components: { codeEditor },
|
|
|
-// // props: {
|
|
|
-// // type: {
|
|
|
-// // type: String,
|
|
|
-// // default: ''
|
|
|
-// // }
|
|
|
-// // },
|
|
|
-
|
|
|
-// setup(props) {
|
|
|
-// // const { proxy } = getCurrentInstance() as any;
|
|
|
-// // const route = useRoute();
|
|
|
-// // const router = useRouter();
|
|
|
-// // const { network_server_type, network_protocols } = proxy.useDict('network_server_type', 'network_protocols');
|
|
|
-
|
|
|
-// // const state = reactive<TableDataState>({
|
|
|
-// // // id: "",
|
|
|
-// // stickValue: "",
|
|
|
-// // stick: {
|
|
|
-// // "delimit,omitempty": "",
|
|
|
-// // "custom,omitempty": "",
|
|
|
-// // "fixedLen,omitempty": 0,
|
|
|
-// // "len,omitempty": {
|
|
|
-// // "len": 0,
|
|
|
-// // "offset": 0,
|
|
|
-// // "endian": ""
|
|
|
-// // }
|
|
|
-// // },
|
|
|
-// // stick_type: [
|
|
|
-// // {
|
|
|
-// // label: "分隔符",
|
|
|
-// // value: "分隔符"
|
|
|
-// // },
|
|
|
-// // {
|
|
|
-// // label: "自定义脚本",
|
|
|
-// // value: "自定义脚本"
|
|
|
-// // },
|
|
|
-// // {
|
|
|
-// // label: "固定长度",
|
|
|
-// // value: "固定长度"
|
|
|
-// // },
|
|
|
-// // {
|
|
|
-// // label: "长度字段",
|
|
|
-// // value: "长度字段"
|
|
|
-// // }
|
|
|
-// // ],
|
|
|
-// // resourceModalPro: {
|
|
|
-// // mode: '',
|
|
|
-// // content: ''
|
|
|
-// // },
|
|
|
-// // messageData: [],
|
|
|
-// // certificateList: [],
|
|
|
-// // detail: {},
|
|
|
-// // activeViewName: ['1', '2', '3'],
|
|
|
-// // form: {
|
|
|
-// // // 名称
|
|
|
-// // name: '',
|
|
|
-// // // AccessToken
|
|
|
-// // accessToken: "",
|
|
|
-// // // 认证密码
|
|
|
-// // authPasswd: "",
|
|
|
-// // // 认证用户
|
|
|
-// // authUser: "",
|
|
|
-// // // 认证方式(1=Basic,2=AccessToken,3=证书)
|
|
|
-// // authType: 3,
|
|
|
-// // // 是否开启TLS
|
|
|
-// // isTls: 0,
|
|
|
-// // // 证书id
|
|
|
-// // certificateId: "",
|
|
|
-// // // 类型
|
|
|
-// // types: 'tcp',
|
|
|
-// // // 禁用
|
|
|
-// // status: false,
|
|
|
-// // // 地址
|
|
|
-// // addr: '',
|
|
|
-// // register: {
|
|
|
-// // regex: "^\w+$"
|
|
|
-// // },
|
|
|
-// // // 协议适配
|
|
|
-// // protocol: {
|
|
|
-// // name: "SagooMqtt",
|
|
|
-// // options: {}
|
|
|
-// // },
|
|
|
-// // // 心跳包
|
|
|
-// // heartbeat: {
|
|
|
-// // enable: false,
|
|
|
-// // hex: "",
|
|
|
-// // regex: "^\\w+$",
|
|
|
-// // text: "",
|
|
|
-// // timeout: 30
|
|
|
-// // },
|
|
|
-// // // 设备
|
|
|
-// // devices: []
|
|
|
-// // }
|
|
|
-// // });
|
|
|
-
|
|
|
-// deviceApi.product.getTypesAll({ types: 'protocol' }).then((res: any) => {
|
|
|
-// state.messageData = res || [];
|
|
|
-// });
|
|
|
-
|
|
|
-// const mirrorRef = ref()
|
|
|
-// const activeName = ref('first')
|
|
|
-// const getDetail = () => {
|
|
|
-// const id = route.params && route.params.id;
|
|
|
-// if(!id) return;
|
|
|
-// api.server.getDetail({ "id": id }).then((res: any) => {
|
|
|
-// const { id, isTls, authType, certificateId, authUser, authPasswd, accessToken, name, types, status, addr, register, protocol, heartbeat, devices, stick } = res
|
|
|
-// state.form["id"] = id
|
|
|
-// state.form["name"] = name
|
|
|
-// state.form["types"] = types
|
|
|
-// state.form["status"] = status
|
|
|
-// state.form["isTls"] = isTls
|
|
|
-// state.form["addr"] = addr
|
|
|
-// state.form["authType"] = authType
|
|
|
-// state.form["authUser"] = authUser
|
|
|
-// state.form["authPasswd"] = authPasswd
|
|
|
-// state.form["accessToken"] = accessToken
|
|
|
-// state.form["certificateId"] = certificateId
|
|
|
-// state.form["register"] = JSON.parse(register)
|
|
|
-// state.form["protocol"] = JSON.parse(protocol)
|
|
|
-// state.form["heartbeat"] = JSON.parse(heartbeat)
|
|
|
-// state.form["devices"] = JSON.parse(devices)
|
|
|
-// let stickInfo = JSON.parse(stick)
|
|
|
-// if (stickInfo.len && stickInfo.len.endian) {
|
|
|
-// state.stick["len,omitempty"] = stickInfo.len
|
|
|
-// } else if (stickInfo.fixedLen) {
|
|
|
-// state.stick["fixedLen,omitempty"] = stickInfo.fixedLen
|
|
|
-// } else if (stickInfo.custom) {
|
|
|
-// state.stick["custom,omitempty"] = stickInfo.custom
|
|
|
-// } else if (stickInfo.delimit) {
|
|
|
-// state.stick["delimit,omitempty"] = stickInfo.delimit
|
|
|
-// }
|
|
|
-// if (types == 'tcp') {
|
|
|
-// if (state.stick['delimit,omitempty']) {
|
|
|
-// state.stickValue = '分隔符'
|
|
|
-// } else if (state.stick['custom,omitempty']) {
|
|
|
-// state.stickValue = '自定义脚本'
|
|
|
-// } else if (state.stick['fixedLen,omitempty']) {
|
|
|
-// state.stickValue = '固定长度'
|
|
|
-// } else if (state.stick['len,omitempty']) {
|
|
|
-// state.stickValue = '长度字段'
|
|
|
-// }
|
|
|
-// }
|
|
|
-
|
|
|
-// let jsonData = JSON.stringify(JSON.parse(protocol).options);
|
|
|
-// state.resourceModalPro.content = JSON.stringify(JSON.parse(jsonData), null, 4);
|
|
|
-// mirrorRef.value.setValue(state.resourceModalPro.content);
|
|
|
-// })
|
|
|
-// };
|
|
|
-// const submit = () => {
|
|
|
-// let params = {
|
|
|
-// ...state.form,
|
|
|
-// "stick": {
|
|
|
-// ...state.stick
|
|
|
-// }
|
|
|
-// }
|
|
|
-// if (mirrorRef.value.getValue()) {
|
|
|
-// params.protocol.options = eval("(" + mirrorRef.value.getValue() + ")")
|
|
|
-// }
|
|
|
-// // return
|
|
|
-// api.server.editItem(params).then((res: any) => {
|
|
|
-// ElMessage.success('修改成功')
|
|
|
-// goBack()
|
|
|
-// });
|
|
|
-// };
|
|
|
-// const goBack = () => {
|
|
|
-// router.go(-1);
|
|
|
-// }
|
|
|
-// const initData = () => {
|
|
|
-// state.stick = {
|
|
|
-// "delimit,omitempty": "",
|
|
|
-// "custom,omitempty": "",
|
|
|
-// "fixedLen,omitempty": 0,
|
|
|
-// "len,omitempty": {
|
|
|
-// "len": 0,
|
|
|
-// "offset": 0,
|
|
|
-// "endian": ""
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// const handleChangeType = () => {
|
|
|
-// if (state.form.types != 'mqtt_server' && state.form.isTls == 1) {
|
|
|
-// state.form.authType = 3
|
|
|
-// return;
|
|
|
-// }
|
|
|
-// if (state.form.isTls == 0) {
|
|
|
-// state.form.authType = ""
|
|
|
-// }
|
|
|
-// }
|
|
|
-// const getCertificateList = () => {
|
|
|
-// api2.certificate.getList().then((res: any) => {
|
|
|
-// state.certificateList = res.Info;
|
|
|
-// })
|
|
|
-// }
|
|
|
-// watch(
|
|
|
-// () => state.form.isTls,
|
|
|
-// (value) => {
|
|
|
-// if (value == 0) {
|
|
|
-// state.form.authType = ""
|
|
|
-// }
|
|
|
-// }
|
|
|
-// );
|
|
|
-// onMounted(() => {
|
|
|
-// getDetail();
|
|
|
-// getCertificateList();
|
|
|
-// });
|
|
|
-
|
|
|
-// return {
|
|
|
-// mirrorRef,
|
|
|
-// activeName,
|
|
|
-// getDetail,
|
|
|
-// network_server_type,
|
|
|
-// network_protocols,
|
|
|
-// submit,
|
|
|
-// initData,
|
|
|
-// handleChangeType,
|
|
|
-// getCertificateList,
|
|
|
-// ...toRefs(props),
|
|
|
-// ...toRefs(state),
|
|
|
-// };
|
|
|
-// },
|
|
|
-// });
|
|
|
-
|
|
|
</script>
|
|
|
<style lang="scss" scoped>
|
|
|
-// ::v-deep.el-collapse-item__header {
|
|
|
-// position: relative;
|
|
|
-// padding-left: 20px;
|
|
|
-// .el-collapse-item__arrow {
|
|
|
-// margin: 0 !important;
|
|
|
-// position: absolute;
|
|
|
-// left: 0;
|
|
|
-// right: 0;
|
|
|
-
|
|
|
-// }
|
|
|
-// }
|
|
|
:deep(.el-collapse-item__header) {
|
|
|
position: relative;
|
|
|
padding-left: 20px;
|