This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<ElDialog v-model="visible" title="设置切卡模式" width="500px">
|
||||
<ElForm ref="formRef" :model="form" :rules="rules" label-width="120px">
|
||||
<ElForm ref="formRef" :model="form" :rules="rules" label-width="80px">
|
||||
<ElFormItem label="设备标识">
|
||||
<span style="font-weight: bold; color: #409eff">{{ deviceIdentifier }}</span>
|
||||
</ElFormItem>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<ElDialog v-model="visible" title="设置WiFi" width="500px" :append-to-body="true">
|
||||
<ElForm ref="formRef" :model="form" :rules="rules" label-width="120px">
|
||||
<ElDialog v-model="visible" title="设置WiFi" width="30%" :append-to-body="true">
|
||||
<ElForm ref="formRef" :model="form" :rules="rules" label-width="80px" autocomplete="off">
|
||||
<ElFormItem label="WiFi状态" prop="enabled">
|
||||
<ElRadioGroup v-model="form.enabled">
|
||||
<ElRadio :value="1">启用</ElRadio>
|
||||
@@ -15,6 +15,7 @@
|
||||
show-word-limit
|
||||
clearable
|
||||
autocomplete="off"
|
||||
name="wifi_ssid"
|
||||
/>
|
||||
</ElFormItem>
|
||||
<ElFormItem label="WiFi密码" prop="password">
|
||||
@@ -27,6 +28,7 @@
|
||||
show-password
|
||||
clearable
|
||||
autocomplete="off"
|
||||
name="wifi_password"
|
||||
/>
|
||||
</ElFormItem>
|
||||
</ElForm>
|
||||
@@ -53,14 +55,33 @@
|
||||
interface Props {
|
||||
modelValue: boolean
|
||||
cardNo?: string // 流量卡号(ICCID)
|
||||
deviceIdentifier?: string // 设备标识(IMEI)
|
||||
wifiEnabled?: number // WiFi启用状态
|
||||
wifiSsid?: string // WiFi名称
|
||||
wifiPassword?: string // WiFi密码
|
||||
}
|
||||
|
||||
interface Emits {
|
||||
(e: 'update:modelValue', value: boolean): void
|
||||
(e: 'confirm', data: { card_no: string; enabled: number; ssid: string; password: string }): void
|
||||
(
|
||||
e: 'confirm',
|
||||
data: {
|
||||
deviceIdentifier?: string
|
||||
card_no: string
|
||||
enabled: number
|
||||
ssid: string
|
||||
password: string
|
||||
}
|
||||
): void
|
||||
}
|
||||
|
||||
const props = defineProps<Props>()
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
cardNo: '',
|
||||
deviceIdentifier: '',
|
||||
wifiEnabled: 1,
|
||||
wifiSsid: '',
|
||||
wifiPassword: ''
|
||||
})
|
||||
const emit = defineEmits<Emits>()
|
||||
|
||||
const formRef = ref<FormInstance>()
|
||||
@@ -91,9 +112,9 @@
|
||||
// 监听对话框打开,重置表单
|
||||
watch(visible, (newVal) => {
|
||||
if (newVal) {
|
||||
form.enabled = 1
|
||||
form.ssid = ''
|
||||
form.password = ''
|
||||
form.enabled = props.wifiEnabled ?? 1
|
||||
form.ssid = props.wifiSsid ?? ''
|
||||
form.password = props.wifiPassword ?? ''
|
||||
}
|
||||
})
|
||||
|
||||
@@ -107,6 +128,7 @@
|
||||
try {
|
||||
await formRef.value.validate()
|
||||
emit('confirm', {
|
||||
deviceIdentifier: props.deviceIdentifier,
|
||||
card_no: props.cardNo || '',
|
||||
enabled: form.enabled,
|
||||
ssid: form.ssid,
|
||||
|
||||
Reference in New Issue
Block a user