|
|
|
|
@ -90,6 +90,26 @@
|
|
|
|
|
确认修改
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="line config-line">
|
|
|
|
|
<div class="item full-width">
|
|
|
|
|
<div class="key">扫描数量</div>
|
|
|
|
|
<el-input-number v-model="scanLoopCount" :min="minScanLoopCount" :max="maxScanLoopCount" :step="1" controls-position="right" style="flex: 1;" />
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="line">
|
|
|
|
|
<div class="item full-width">
|
|
|
|
|
<div class="key">当前数量</div>
|
|
|
|
|
<div class="value">{{ currentScanLoopCount }}</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="buttonBox">
|
|
|
|
|
<div class="button save" @click="setScanConfig">
|
|
|
|
|
<el-icon>
|
|
|
|
|
<Check />
|
|
|
|
|
</el-icon>
|
|
|
|
|
保存扫描数量
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
@ -217,6 +237,10 @@ const setSystemTime = async () => {
|
|
|
|
|
// ─── 电表型号 ─────────────────────────────────────
|
|
|
|
|
const currentMeterFirm = ref('')
|
|
|
|
|
const selectedMeterFirm = ref('')
|
|
|
|
|
const minScanLoopCount = ref(1)
|
|
|
|
|
const maxScanLoopCount = ref(10)
|
|
|
|
|
const currentScanLoopCount = ref(10)
|
|
|
|
|
const scanLoopCount = ref(10)
|
|
|
|
|
|
|
|
|
|
const getMeterFirm = async () => {
|
|
|
|
|
try {
|
|
|
|
|
@ -260,6 +284,58 @@ const setMeterFirm = async () => {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const getScanConfig = async () => {
|
|
|
|
|
try {
|
|
|
|
|
const res = await RPC.post('/m9z/scan/getConfig', {})
|
|
|
|
|
const loopCount = Number(res?.loop_count || 10)
|
|
|
|
|
minScanLoopCount.value = Number(res?.min_loop_count || 1)
|
|
|
|
|
maxScanLoopCount.value = Number(res?.max_loop_count || 10)
|
|
|
|
|
currentScanLoopCount.value = loopCount
|
|
|
|
|
scanLoopCount.value = loopCount
|
|
|
|
|
} catch (e) {
|
|
|
|
|
// 错误由 rpc.js 处理
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const setScanConfig = async () => {
|
|
|
|
|
const nextLoopCount = Number(scanLoopCount.value)
|
|
|
|
|
if (!Number.isInteger(nextLoopCount)) {
|
|
|
|
|
ElMessage.warning('请输入整数扫描数量')
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if (nextLoopCount < minScanLoopCount.value || nextLoopCount > maxScanLoopCount.value) {
|
|
|
|
|
ElMessage.warning(`扫描数量范围为 ${minScanLoopCount.value}-${maxScanLoopCount.value}`)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if (nextLoopCount === currentScanLoopCount.value) {
|
|
|
|
|
ElMessage.info('扫描数量未变更')
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
await ElMessageBox.confirm(
|
|
|
|
|
`确认要将扫描数量修改为 ${nextLoopCount} 吗?`,
|
|
|
|
|
'提示',
|
|
|
|
|
{
|
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
|
cancelButtonText: '取消',
|
|
|
|
|
type: 'warning',
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
const res = await RPC.post('/m9z/scan/setConfig', {
|
|
|
|
|
loop_count: nextLoopCount,
|
|
|
|
|
})
|
|
|
|
|
if (res?.success) {
|
|
|
|
|
const loopCount = Number(res.loop_count || nextLoopCount)
|
|
|
|
|
currentScanLoopCount.value = loopCount
|
|
|
|
|
scanLoopCount.value = loopCount
|
|
|
|
|
ElMessage.success(`扫描数量已修改为 ${loopCount}`)
|
|
|
|
|
}
|
|
|
|
|
} catch (e) {
|
|
|
|
|
if (e === 'cancel' || e === 'close') return
|
|
|
|
|
// 其他错误由 rpc.js 处理
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ─── 修改密码 ─────────────────────────────────────
|
|
|
|
|
const pwdForm = ref({ oldPassword: '', newPassword: '', confirmPassword: '' })
|
|
|
|
|
|
|
|
|
|
@ -341,6 +417,7 @@ const handleSessionRestored = () => {
|
|
|
|
|
getSystemTime()
|
|
|
|
|
getPasswordStatus()
|
|
|
|
|
getMeterFirm()
|
|
|
|
|
getScanConfig()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
@ -349,6 +426,7 @@ onMounted(() => {
|
|
|
|
|
getSystemTime()
|
|
|
|
|
getPasswordStatus()
|
|
|
|
|
getMeterFirm()
|
|
|
|
|
getScanConfig()
|
|
|
|
|
|
|
|
|
|
// 监听 session 恢复事件
|
|
|
|
|
window.addEventListener('m9z:session-restored', handleSessionRestored)
|
|
|
|
|
@ -510,6 +588,12 @@ onUnmounted(() => {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.config-line {
|
|
|
|
|
margin-top: 28px;
|
|
|
|
|
padding-top: 18px;
|
|
|
|
|
border-top: 1px solid rgba(#0e9228, .35);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|