123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <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' || record['strtype'] == 'ftp' || record['strtype'] == 'database'"
- 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>
|