<template> <div class="debugging publicContainer"> <div> <el-button type="primary" @click="testOrder('3')">触发排水工单</el-button> <el-button type="primary" @click="testOrder('2')">触发燃气工单</el-button> </div> <div style="margin-top: 10px"> 自动转工单: <el-switch v-model="switchValOrder" :active-value="'1'" :inactive-value="'0'" inline-prompt active-text="是" inactive-text="否" @change="handleSwitchChange" /> </div> <div style="margin-top: 10px"> 离线生成报警: <el-switch v-model="switchValOutline" :active-value="'1'" :inactive-value="'0'" inline-prompt active-text="是" inactive-text="否" @change="handleSwitchChangeOutline" /> </div> </div> </template> <script setup name="debugging"> import { testWorkOrder, queryWorkOrderCallConfig, updateWorkOrderCallConfig, queryOfflineWarnConfig, updateOfflineWarnConfig, } from '@/api/order'; const { proxy } = getCurrentInstance(); const switchValOrder = ref('0'); const switchValOutline = ref('0'); const testOrder = type => { proxy.$modal .confirm('是否确认发送工单信息?') .then(async () => { try { const res = await testWorkOrder({ orderType: type, }); } catch (error) { console.log('error', error); } }) .catch(() => {}); }; // 工单 const handleSwitchChange = async val => { console.log('val', val, typeof val); try { await updateWorkOrderCallConfig({ autoOrderFlag: val }); proxy.$modal.msgSuccess('是否自动转工单切换成功'); } catch (error) { console.log(' handleSwitchChange error', error); } }; const handleSwitchChangeOutline = async val => { console.log('val', val, typeof val); try { await updateOfflineWarnConfig({ offlineWarnFlag: val }); proxy.$modal.msgSuccess('是否离线生成报警切换成功'); } catch (error) { console.log(' handleSwitchChange error', error); } }; // 获取状态 const getAutoOrderStatus = async () => { try { const res = await queryWorkOrderCallConfig(); const res1 = await queryOfflineWarnConfig(); switchValOrder.value = res.data; switchValOutline.value = res1.data; } catch (error) { console.log(' getAutoOrderStatus error', error); } }; onMounted(() => { getAutoOrderStatus(); }); </script> <style lang="scss" scoped> .debugging { } </style>