| | |
| | | <template> |
| | | <el-drawer |
| | | v-model="drawer" |
| | | size="50%" |
| | | size="60%" |
| | | title="Opcua Tag" |
| | | :direction="direction" |
| | | :before-close="handleClose" |
| | |
| | | <Icon icon="ep:download" />导出 |
| | | </el-button> |
| | | </el-form-item> |
| | | <el-form-item label="更新当前值" label-width="100px"> |
| | | <el-switch |
| | | v-model="queryParams.currentValue" |
| | | active-color="#13ce66" |
| | | inactive-color="#ff4949"/> |
| | | </el-form-item> |
| | | </el-form> |
| | | </ContentWrap> |
| | | <!-- 列表 --> |
| | |
| | | label="数据值" |
| | | header-align="center" |
| | | align="center" |
| | | min-width="100" |
| | | :formatter="(row) => {if (row.dataValue === -2.0) {return '--';}return row.dataValue;}" |
| | | /> |
| | | <el-table-column |
| | | prop="quality" |
| | | prop="dataTime" |
| | | label="数据时间" |
| | | header-align="center" |
| | | align="center" |
| | | min-width="150" |
| | | /> |
| | | <el-table-column |
| | | prop="dataQuality" |
| | | label="数据质量" |
| | | header-align="center" |
| | | align="center" |
| | | > |
| | | <template #default="scope"> |
| | | <el-tag v-if="scope.row.dataValue === Number(-2.0)" type="danger" size="small">bad</el-tag> |
| | | <el-tag v-else size="small">good</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | /> |
| | | <el-table-column label="操作" align="center" min-width="110" fixed="right"> |
| | | <template #default="scope"> |
| | | <el-button |
| | |
| | | import * as OpcUaTagApi from "@/api/data/channel/opcua/tag"; |
| | | import TagForm from './TagForm.vue' |
| | | import download from "@/utils/download"; |
| | | import {ref,reactive} from "vue"; |
| | | import {ref, reactive, onMounted, onBeforeUnmount} from "vue"; |
| | | import TagImportForm from '../../common/tag/TagImportForm.vue' |
| | | import * as OpcdaTagApi from "@/api/data/channel/opcda/tag"; |
| | | |
| | | defineOptions({name: 'OpcuaTag'}) |
| | | |
| | |
| | | device: undefined, |
| | | deviceId: undefined, |
| | | tagName: undefined, |
| | | currentValue:false, |
| | | address: undefined |
| | | }) |
| | | const queryFormRef = ref() // 搜索的表单 |
| | |
| | | exportLoading.value = false |
| | | } |
| | | } |
| | | |
| | | let intervalId; |
| | | |
| | | onMounted(async () => { |
| | | // 创建定时器 |
| | | intervalId = setInterval(async () => { |
| | | if(queryParams.currentValue){ |
| | | const page = await OpcUaTagApi.getOpcuaTagPage(queryParams) |
| | | list.value = page.list |
| | | total.value = page.total |
| | | } |
| | | }, 10000); |
| | | }); |
| | | |
| | | // 在组件卸载时清除定时器 |
| | | onBeforeUnmount(() => { |
| | | if (intervalId) { |
| | | clearInterval(intervalId); |
| | | } |
| | | }); |
| | | </script> |