diff --git a/src/common/GlobalData.ts b/src/common/GlobalData.ts index ca49bb2..59a2029 100644 --- a/src/common/GlobalData.ts +++ b/src/common/GlobalData.ts @@ -42,6 +42,13 @@ export default class GlobalData { ) { if (config) { this._application_config = config; + try { + this._application_config.ip_list = JSON.parse( + (this._application_config.ip_list ?? []).toString() + ); + } catch (e) { + console.log(e); + } } } diff --git a/src/components/AdvancedIpAddressDialog.vue b/src/components/AdvancedIpAddressDialog.vue index 21e314e..43647c7 100644 --- a/src/components/AdvancedIpAddressDialog.vue +++ b/src/components/AdvancedIpAddressDialog.vue @@ -31,7 +31,7 @@ @@ -87,7 +87,7 @@ /> - + {{ $t("dns server") }}1 @@ -104,7 +104,7 @@ /> - + {{ $t("dns server") }}2 @@ -153,10 +153,17 @@ import { useStore } from "src/store"; import { useQuasar, copyToClipboard, uid } from "quasar"; import { useI18n } from "vue-i18n"; import GlobalData from "src/common/GlobalData"; +import { AdvancedIpAddressEntity } from "src/entities/AdvancedIpAddressEntity"; export default defineComponent({ name: "ComponentSystenSettingAdvancedNetworkDialog", components: {}, + props: { + showDns: { + type: Boolean, + default: true, + }, + }, setup() { let $store = useStore(); let $q = useQuasar(); @@ -188,7 +195,7 @@ export default defineComponent({ }, async showDialogAsync( _status: string, - data: any, + data: AdvancedIpAddressEntity, _ip_filter_list: any[] ) { if (_resolove) { @@ -201,7 +208,7 @@ export default defineComponent({ if (data) { ip_address.value = data.ip_address || "192.168.1.1"; gateway.value = data.gateway || "192.168.1.1"; - netmask.value = data.netmask || "255.0.0.0"; + netmask.value = data.netmask || "255.255.255.0"; dns1.value = data.dns1 || ""; dns2.value = data.dns2 || ""; } @@ -222,7 +229,7 @@ export default defineComponent({ status.value = "add"; ip_address.value = "192.168.1.1"; gateway.value = "192.168.1.1"; - netmask.value = "192.168.1.1"; + netmask.value = "255.255.255.0"; dns1.value = ""; dns2.value = ""; }, @@ -231,13 +238,13 @@ export default defineComponent({ try { if (_resolove) { try { - _resolove({ - ip_address: ip_address.value, - gateway: gateway.value, - netmask: netmask.value, - dns1: dns1.value, - dns2: dns2.value, - }); + const data = new AdvancedIpAddressEntity(); + data.ip_address = ip_address.value; + data.gateway = gateway.value; + data.netmask = netmask.value; + data.dns1 = dns1.value; + data.dns2 = dns2.value; + _resolove(data); } catch { _resolove(null); } diff --git a/src/components/SystemSettingDialog.vue b/src/components/SystemSettingDialog.vue index 20802f1..26b45ee 100644 --- a/src/components/SystemSettingDialog.vue +++ b/src/components/SystemSettingDialog.vue @@ -91,7 +91,7 @@ - + {{ $t("auto ip") + ":" }} @@ -105,7 +105,7 @@ /> - + {{ $t("ip address") + ":" }} @@ -127,7 +127,7 @@ /> - + {{ $t("gateway") + ":" }} @@ -149,7 +149,7 @@ /> - + {{ $t("netmask") + ":" }} @@ -171,7 +171,7 @@ /> - + {{ $t("dns server") + "1:" }} @@ -191,7 +191,7 @@ /> - + {{ $t("dns server") + "2:" }} @@ -211,7 +211,7 @@ /> - + {{ $t("mac address") + ":" }} @@ -234,13 +234,11 @@ /> - + = ref(null); + const system_setting_advanced_network_dialog: Ref = ref(null); const function_mirroring_output = ref( ($store.state.device_attribute & @@ -1124,6 +1124,7 @@ export default defineComponent({ let dns1 = ref(); let dns2 = ref(); let mac_address = ref("11:22:33:44:55:66"); + let ip_address_list: AdvancedIpAddressEntity[] = []; let brightness = ref(0); let contrast = ref(0); @@ -1251,6 +1252,7 @@ export default defineComponent({ ip_address.value = $store.state.device_ip_address || "192.168.1.168"; dns1.value = config.dns1 || ""; dns2.value = config.dns2 || ""; + ip_address_list = config.ip_list || []; } }; @@ -1377,6 +1379,7 @@ export default defineComponent({ request.mac_address = mac_address.value; request.dns1 = dns1.value; request.dns2 = dns2.value; + request.ip_address_list = ip_address_list; let success = false; try { @@ -1612,6 +1615,7 @@ export default defineComponent({ show_dialog, e_week_Days: ref(EWeekDays), timing_task_dialog, + system_setting_advanced_network_dialog, timing_tasks, function_mirroring_output, function_output_board_attribute, @@ -1843,6 +1847,18 @@ export default defineComponent({ "1920x1080@60" ); }, + async onAdvanceNetwork() { + const _ip_address_list = + await system_setting_advanced_network_dialog.value.showDialogAsync( + GlobalData.getInstance()?.applicationConfig?.ip_list + ); + if (Array.isArray(_ip_address_list)) { + ip_address_list = _ip_address_list; + } else { + ip_address_list = + GlobalData.getInstance()?.applicationConfig?.ip_list || []; + } + }, }; }, }); diff --git a/src/components/SystenSettingAdvancedNetworkDialog.vue b/src/components/SystenSettingAdvancedNetworkDialog.vue index c3f7206..8911b1f 100644 --- a/src/components/SystenSettingAdvancedNetworkDialog.vue +++ b/src/components/SystenSettingAdvancedNetworkDialog.vue @@ -114,7 +114,10 @@ - +