feat: 新增设备切卡模式
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 3m57s
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 3m57s
This commit is contained in:
@@ -554,6 +554,44 @@
|
||||
</ElButton>
|
||||
</template>
|
||||
</ElDialog>
|
||||
|
||||
<!-- 设置切卡模式对话框 -->
|
||||
<ElDialog v-model="switchModeDialogVisible" title="设置切卡模式" width="500px">
|
||||
<ElForm
|
||||
ref="switchModeFormRef"
|
||||
:model="switchModeForm"
|
||||
:rules="switchModeRules"
|
||||
label-width="120px"
|
||||
>
|
||||
<ElFormItem label="设备标识">
|
||||
<span style="font-weight: bold; color: #409eff">{{ currentOperatingDeviceIdentifier }}</span>
|
||||
</ElFormItem>
|
||||
<ElFormItem label="当前模式">
|
||||
<ElTag :type="currentDeviceSwitchMode === 0 ? 'success' : 'warning'">
|
||||
{{ currentDeviceSwitchMode === 0 ? '自动切卡' : '手动切卡' }}
|
||||
</ElTag>
|
||||
</ElFormItem>
|
||||
<ElFormItem label="切卡模式" prop="switch_mode">
|
||||
<ElRadioGroup v-model="switchModeForm.switch_mode">
|
||||
<ElRadio :value="0">自动切卡</ElRadio>
|
||||
<ElRadio :value="1">手动切卡</ElRadio>
|
||||
</ElRadioGroup>
|
||||
</ElFormItem>
|
||||
<ElFormItem>
|
||||
<div style="font-size: 12px; color: #909399; line-height: 1.6">
|
||||
<p>说明:</p>
|
||||
<p>• <strong>自动切卡</strong>:设备根据信号强度自动切换到最优的SIM卡</p>
|
||||
<p>• <strong>手动切卡</strong>:需要手动触发切换SIM卡操作</p>
|
||||
</div>
|
||||
</ElFormItem>
|
||||
</ElForm>
|
||||
<template #footer>
|
||||
<ElButton @click="switchModeDialogVisible = false">取消</ElButton>
|
||||
<ElButton type="primary" @click="handleConfirmSwitchMode" :loading="switchModeLoading">
|
||||
确认设置
|
||||
</ElButton>
|
||||
</template>
|
||||
</ElDialog>
|
||||
</ElCard>
|
||||
</div>
|
||||
</ArtTableFullScreen>
|
||||
@@ -704,6 +742,19 @@
|
||||
]
|
||||
})
|
||||
|
||||
// 切换模式相关
|
||||
const switchModeDialogVisible = ref(false)
|
||||
const switchModeLoading = ref(false)
|
||||
const switchModeFormRef = ref<FormInstance>()
|
||||
const currentOperatingDeviceIdentifier = ref<string>('')
|
||||
const currentDeviceSwitchMode = ref<number>(0)
|
||||
const switchModeForm = reactive({
|
||||
switch_mode: 0
|
||||
})
|
||||
const switchModeRules = reactive<FormRules>({
|
||||
switch_mode: [{ required: true, message: '请选择切卡模式', trigger: 'change' }]
|
||||
})
|
||||
|
||||
// 搜索表单初始值
|
||||
const initialSearchState = {
|
||||
virtual_no: '',
|
||||
@@ -1547,6 +1598,9 @@
|
||||
case 'clear-series':
|
||||
await handleClearDeviceSeries(deviceNo)
|
||||
break
|
||||
case 'switch-mode':
|
||||
showSwitchModeDialog(deviceNo, device?.switch_mode)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1758,6 +1812,42 @@
|
||||
})
|
||||
}
|
||||
|
||||
// 显示切换模式对话框
|
||||
const showSwitchModeDialog = (deviceIdentifier: string, currentMode?: number) => {
|
||||
currentOperatingDeviceIdentifier.value = deviceIdentifier
|
||||
currentDeviceSwitchMode.value = currentMode ?? 0
|
||||
switchModeForm.switch_mode = currentMode ?? 0
|
||||
switchModeDialogVisible.value = true
|
||||
}
|
||||
|
||||
// 确认切换模式
|
||||
const handleConfirmSwitchMode = async () => {
|
||||
if (!switchModeFormRef.value) return
|
||||
|
||||
await switchModeFormRef.value.validate(async (valid) => {
|
||||
if (valid) {
|
||||
switchModeLoading.value = true
|
||||
try {
|
||||
const res = await DeviceService.setSwitchMode(
|
||||
currentOperatingDeviceIdentifier.value,
|
||||
switchModeForm.switch_mode
|
||||
)
|
||||
if (res.code === 0) {
|
||||
ElMessage.success('设置切卡模式成功')
|
||||
switchModeDialogVisible.value = false
|
||||
await getTableData()
|
||||
} else {
|
||||
ElMessage.error(res.msg || '设置切卡模式失败')
|
||||
}
|
||||
} catch (error: any) {
|
||||
console.error('设置切卡模式失败:', error)
|
||||
} finally {
|
||||
switchModeLoading.value = false
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 设备操作菜单项配置
|
||||
// 表格操作列配置
|
||||
const getActions = (row: Device) => {
|
||||
@@ -1783,6 +1873,14 @@
|
||||
})
|
||||
}
|
||||
|
||||
if (hasAuth('device:switch_mode')) {
|
||||
moreActions.push({
|
||||
label: '设置切卡模式',
|
||||
handler: () => handleDeviceOperation('switch-mode', row.virtual_no, row),
|
||||
type: 'primary'
|
||||
})
|
||||
}
|
||||
|
||||
if (hasAuth('device:reboot')) {
|
||||
moreActions.push({
|
||||
label: '重启设备',
|
||||
|
||||
Reference in New Issue
Block a user