12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- <template>
- <div class="device-manager-box">
- <NormalTable
- ref="normalTabel"
- :columns="columns"
- :searchFormSchema="searchFormSchema"
- :list="list"
- :formSchema="formSchema"
- :deleteById="deleteById"
- :batchDelete="batchDeleteById"
- :saveOrUpdate="saveOrUpdate"
- designScope="substation-tabel"
- title="分站列表"
- :showTab="false"
- >
- <template #filterCell="{ column, record }">
- <a-tag v-if="column.dataIndex === 'linkstatus'" :color="record.linkstatus == 0 ? '#999' : '#87d068'">{{
- record.linkstatus == 1 ? '链接' : '断开'
- }}</a-tag>
-
- </template>
- <template #action="{ record }">
- <a v-if="record['strtype'] == 'http'|| record['strtype'] == 'kafka'" class="table-action-link" @click="addDevices(record)">同步设备</a>
- </template>
- </NormalTable>
- </div>
- </template>
- <script lang="ts" name="system-user" setup>
- //ts语法
- import { ref, onMounted, onUnmounted } from 'vue';
- import NormalTable from '../comment/NormalTable.vue';
- import { columns, searchFormSchema, formSchema } from './substation.data';
- import { list, getImportUrl, getExportUrl, deleteById, batchDeleteById, saveOrUpdate, addDevice } from './substation.api';
- import { message } from 'ant-design-vue';
- const normalTabel = ref();
- let timer = undefined ;
- function reload() {
- timer = setInterval(() => {
- if(normalTabel.value)normalTabel.value.reload()
- }, 30000)
- }
- function addDevices(record) {
- addDevice({ id: record.id }).then((result) => {
- // message.success('同步生成')
- }).catch(() => {
- message.success('同步失败')
- })
- }
- onMounted(() => {
- reload()
- })
- onUnmounted(() => {
- clearInterval(timer)
- })
-
- </script>
- <style scoped></style>
|