diff --git a/public/images/access/collector-gateway.png b/public/images/access/collector-gateway.png new file mode 100644 index 00000000..1dd93186 Binary files /dev/null and b/public/images/access/collector-gateway.png differ diff --git a/src/api/data-collect/collector.ts b/src/api/data-collect/collector.ts index 53304ef6..ce1c8e5f 100644 --- a/src/api/data-collect/collector.ts +++ b/src/api/data-collect/collector.ts @@ -61,3 +61,4 @@ export const scanOpcUAList = (data: any) => export const queryTypeList = () => server.get(`/data-collect/opc/data-types`); +export const getProviders = () => server.get('/data-collect/channel/gateway/codec/providers') \ No newline at end of file diff --git a/src/utils/consts.ts b/src/utils/consts.ts index 0ea4e3de..555c55ef 100644 --- a/src/utils/consts.ts +++ b/src/utils/consts.ts @@ -55,4 +55,5 @@ export const USER_CENTER_MENU_BUTTON_CODE = 'user-center-passwd-update' export const protocolList = [ { label: 'OPC-UA', value: 'OPC_UA', alias: 'opc-ua' }, { label: 'Modbus/TCP', value: 'MODBUS_TCP', alias: 'modbus-tcp' }, + { label: 'GATEWAY', value: 'COLLECTOR_GATEWAY', alias: 'collector-gateway' }, ] diff --git a/src/utils/menu.ts b/src/utils/menu.ts index 273d5755..6dfde7a4 100644 --- a/src/utils/menu.ts +++ b/src/utils/menu.ts @@ -417,6 +417,21 @@ const findDetailRouteItem = (item: any, components: any) => { return [] } +const findSaveRouteItem = (item: any, components: any) => { + const { code, url } = item + const Component = components[`${item.code}/Save`] + if (Component) { + return [{ + url: `${url}/detail/:id`, + code: `${code}/Save`, + component: Component, + name: '详情信息', + isShow: false + }] + } + return [] +} + export const handleMenus = (menuData: any[], components: any, level: number = 1) => { if (menuData && menuData.length) { return menuData.map(item => { @@ -434,8 +449,8 @@ export const handleMenus = (menuData: any[], components: any, level: number = 1) const extraRoute = hasExtraChildren(item, extraRouteObj) const detail_components = findDetailRouteItem(item, components) - if (extraRoute && !isApp) { // 包含额外的子路由 + console.log(extraRoute) route.children = route.children ? [...route.children, ...extraRoute] : extraRoute } diff --git a/src/views/DataCollect/Channel/Save/GateWayDeviceModal.vue b/src/views/DataCollect/Channel/Save/GateWayDeviceModal.vue new file mode 100644 index 00000000..68b956c9 --- /dev/null +++ b/src/views/DataCollect/Channel/Save/GateWayDeviceModal.vue @@ -0,0 +1,190 @@ + + + + + \ No newline at end of file diff --git a/src/views/DataCollect/Channel/Save/GateWayFormItem.vue b/src/views/DataCollect/Channel/Save/GateWayFormItem.vue new file mode 100644 index 00000000..5427a373 --- /dev/null +++ b/src/views/DataCollect/Channel/Save/GateWayFormItem.vue @@ -0,0 +1,71 @@ + + + + + \ No newline at end of file diff --git a/src/views/DataCollect/Channel/Save/index.vue b/src/views/DataCollect/Channel/Save/index.vue index c416f5f3..037873eb 100644 --- a/src/views/DataCollect/Channel/Save/index.vue +++ b/src/views/DataCollect/Channel/Save/index.vue @@ -92,6 +92,17 @@ :filter-option="filterOption" /> + + + (cloneDeep(FormState)); const handleOk = async () => { - const params = await formRef.value?.validate(); + const params: any = await formRef.value?.validate(); + if (params?.provider === 'COLLECTOR_GATEWAY') { + params.configuration.deviceName = formData.value.configuration.deviceName + } + + params.circuitBreaker = { + type: 'Ignore' + } + loading.value = true; const response = !id ? await save(params).catch(() => {}) @@ -284,7 +304,7 @@ const getProvidersList = async () => { if (resp.status === 200) { const arr = resp.result .filter( - (item: any) => item.id === 'modbus-tcp' || item.id === 'opc-ua', + (item: any) => ['collector-gateway', 'modbus-tcp', 'opc-ua'].includes(item.id), ) .map((it: any) => it.id); const providers: any = protocolList.filter((item: any) => @@ -302,7 +322,9 @@ getCertificateList(); watch( () => props.data, (value) => { - if (value.id) formData.value = value as FormDataType; + if (value.id) { + formData.value = value as FormDataType; + } }, { immediate: true, deep: true }, ); diff --git a/src/views/DataCollect/Channel/data.ts b/src/views/DataCollect/Channel/data.ts index c95583fa..68a8fe0c 100644 --- a/src/views/DataCollect/Channel/data.ts +++ b/src/views/DataCollect/Channel/data.ts @@ -15,6 +15,8 @@ export const FormState: FormDataType = { authType: 'anonymous', username: '', password: '', + deviceId: undefined, + deviceName: undefined, }, description: '', }; diff --git a/src/views/DataCollect/Channel/type.d.ts b/src/views/DataCollect/Channel/type.d.ts index 9a2c7b34..7d683f08 100644 --- a/src/views/DataCollect/Channel/type.d.ts +++ b/src/views/DataCollect/Channel/type.d.ts @@ -1,6 +1,6 @@ export interface ConfigurationType { port: string | undefined; - host: string | undefined;; + host: string | undefined; username: string; password: string; endpoint: string, @@ -8,7 +8,8 @@ export interface ConfigurationType { securityMode: string | undefined, certId: string | undefined, authType: string | undefined, - + deviceId: string | undefined, + deviceName: string | undefined, } export interface FormDataType { diff --git a/src/views/DataCollect/Collector/Point/Save/SaveModBus.vue b/src/views/DataCollect/Collector/Point/Save/SaveModBus.vue index 5ddbdfd5..20beddc7 100644 --- a/src/views/DataCollect/Collector/Point/Save/SaveModBus.vue +++ b/src/views/DataCollect/Collector/Point/Save/SaveModBus.vue @@ -271,7 +271,7 @@ import { import { ModBusRules, checkProviderData } from '../../data.ts'; import type { FormInstance } from 'ant-design-vue'; import type { Rule } from 'ant-design-vue/lib/form'; -import { cloneDeep } from 'lodash-es'; +import {cloneDeep, omit} from 'lodash-es'; const props = defineProps({ data: { @@ -343,10 +343,18 @@ const handleOk = async () => { // address是多余字段,但是react版本上使用到了这个字段 params.configuration.parameter = { - ...params.configuration.parameter, - address: data?.pointKey, + ...params.configuration.parameter, + address: data?.pointKey, }; + if (props.data.provider === 'COLLECTOR_GATEWAY') { + const configuration = cloneDeep(params.configuration) + params.configuration = { + configuration: configuration, + interval: params.interval + } + } + loading.value = true; const response = !id ? await savePointBatch(params).catch(() => {}) @@ -439,22 +447,31 @@ watch( watch( () => props.data, (value) => { - if (value.id && value.provider === 'MODBUS_TCP') { + if (value.id && ['MODBUS_TCP', 'COLLECTOR_GATEWAY'].includes(value.provider)) { const _value: any = cloneDeep(value); const { writeByteCount, byteCount } = - _value.configuration.parameter; + props.data.provider === 'COLLECTOR_GATEWAY' ? _value.configuration.configuration.parameter: _value.configuration.parameter; + + if (props.data.provider === 'COLLECTOR_GATEWAY') { + formData.value = { + ...omit(_value, ['configuration']), + ..._value.configuration, + } + } else { formData.value = _value; - if (!!_value.accessModes[0]?.value) { - formData.value.accessModes = value.accessModes.map( - (i: any) => i.value, - ); - } - if (!!_value.features[0]?.value) { - formData.value.features = value.features.map( - (i: any) => i.value, - ); - } - formData.value.nspwc = !!writeByteCount || !!byteCount; + } + + if (!!_value.accessModes[0]?.value) { + formData.value.accessModes = value.accessModes.map( + (i: any) => i.value, + ); + } + if (!!_value.features[0]?.value) { + formData.value.features = value.features.map( + (i: any) => i.value, + ); + } + formData.value.nspwc = !!writeByteCount || !!byteCount; } }, { immediate: true, deep: true }, diff --git a/src/views/DataCollect/Collector/Point/index.vue b/src/views/DataCollect/Collector/Point/index.vue index d207af99..28a3b1c6 100644 --- a/src/views/DataCollect/Collector/Point/index.vue +++ b/src/views/DataCollect/Collector/Point/index.vue @@ -20,7 +20,7 @@ - diff --git a/src/views/link/AccessConfig/components/Media/GB28181.vue b/src/views/link/AccessConfig/components/Media/GB28181.vue index bbf277c2..f7c2730b 100644 --- a/src/views/link/AccessConfig/components/Media/GB28181.vue +++ b/src/views/link/AccessConfig/components/Media/GB28181.vue @@ -151,17 +151,11 @@ /^([0-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.([0-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.([0-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.([0-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])$/, message: '请输入正确的IP地址', }, - { - max: 65535, - message: '请输入1~65535之间的正整数' - }, - { - min: 1, - message: '请输入1~65535之间的正整数' - }, + ]" + :validateFirst="true" > -
@@ -598,6 +588,15 @@ const dynamicValidateForm = reactive<{ cluster: Form2[] }>({ cluster: [], }); +const rules = { + publicPort: [ + { + required: true, + message: '输入端口', + } + ] +} + const removeCluster = (item: Form2) => { let index = dynamicValidateForm.cluster.indexOf(item); if (index !== -1) { diff --git a/src/views/link/AccessConfig/data.ts b/src/views/link/AccessConfig/data.ts index 9753405e..891b18dc 100644 --- a/src/views/link/AccessConfig/data.ts +++ b/src/views/link/AccessConfig/data.ts @@ -14,6 +14,7 @@ ProtocolMapping.set('Ctwing', 'HTTP'); ProtocolMapping.set('modbus-tcp', 'MODBUS_TCP'); ProtocolMapping.set('opc-ua', 'OPC_UA'); ProtocolMapping.set('edge-child-device', 'EdgeGateway'); +ProtocolMapping.set('collector-gateway', 'collector-gateway'); ProtocolMapping.set('official-edge-gateway', 'MQTT'); const NetworkTypeMapping = new Map(); @@ -44,6 +45,7 @@ BackMap.set('gb28181-2016', getImage('/access/gb28181.png')); BackMap.set('mqtt-client-gateway', getImage('/access/mqtt-broke.png')); BackMap.set('edge-child-device', getImage('/access/child-device.png')); BackMap.set('official-edge-gateway', getImage('/access/edge.png')); +BackMap.set('collector-gateway', getImage('/access/collector-gateway.png')); const descriptionList = { 'udp-device-gateway': diff --git a/vite.config.ts b/vite.config.ts index f5403f0c..ffa11a2c 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -94,9 +94,9 @@ export default defineConfig(({ mode}) => { [env.VITE_APP_BASE_API]: { // target: 'http://192.168.32.226:8844', // target: 'http://192.168.32.244:8881', - // target: 'http://192.168.32.163:8844', //张季本地 + target: 'http://192.168.32.163:8844', //张季本地 // target: 'http://120.77.179.54:8844', // 120测试 - target: 'http://192.168.33.46:8844', // 本地开发环境 + // target: 'http://192.168.33.46:8844', // 本地开发环境 ws: 'ws://192.168.33.46:8844', changeOrigin: true, rewrite: (path) => path.replace(/^\/api/, '')