feat:是否在线组件

This commit is contained in:
dzc committed 2025-07-08 17:06:29 +08:00
1 parent a1f98f94de
commit 942aada5dd
4 files changed
+37 -21

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
<template>
<div class="flex flex-wrap items-center gap-2 max-w-full">
<div class="w-2 h-2 rounded-full" :class="{ 'bg-success': props.isOnline, 'bg-error': !props.isOnline }" />
<el-tag size="small" :type="props.isOnline ? 'success' : 'danger'">{{ props.isOnline ? '在线' : '离线' }}</el-tag>
</div>
</template>
<script lang="ts" setup>
import { defineProps } from 'vue';
export type Props = {
isOnline?: boolean
}
const props = withDefaults(defineProps<Props>(), {
isOnline: false,
})
</script>
+6 -19
View File
@@ -1,24 +1,11 @@
<template>
<div class="flex flex-wrap items-center gap-2 max-w-full">
<el-tag
v-for="tag in tags"
:key="tag"
:type="tagType"
closable
:disable-transitions="false"
@close="handleClose(tag)"
>
<el-tag v-for="tag in tags" :key="tag" :type="tagType" closable :disable-transitions="false"
@close="handleClose(tag)">
{{ tag }}
</el-tag>
<el-input
v-if="inputVisible"
ref="InputRef"
v-model="inputValue"
class="w-20"
size="small"
@keyup.enter="handleInputConfirm"
@blur="handleInputConfirm"
/>
<el-input v-if="inputVisible" ref="InputRef" v-model="inputValue" class="w-20" size="small"
@keyup.enter="handleInputConfirm" @blur="handleInputConfirm" />
<el-button v-else class="button-new-tag" size="small" @click="showInput">
{{ buttonText }}
</el-button>
@@ -26,8 +13,8 @@
</template>
<script lang="ts" setup>
import {ref, nextTick, defineProps, defineEmits} from 'vue';
import {ElInput} from 'element-plus';
import { ref, nextTick, defineProps, defineEmits } from 'vue';
import { ElInput } from 'element-plus';
const props = defineProps({
modelValue: {
+4
View File
@@ -14,6 +14,8 @@ import Sign from '/@/components/Sign/index.vue';
import ChinaArea from '/@/components/ChinaArea/index.vue';
import OrgSelector from '/@/components/OrgSelector/index.vue';
import TagOnline from "/@/components/Tag/TagOnline.vue"
// 第三方组件
import ElementPlus from 'element-plus';
import * as ElementPlusIconsVue from '@element-plus/icons-vue';
@@ -51,6 +53,8 @@ export default {
app.component('OrgSelector', OrgSelector);
app.component('Sign', Sign);
app.component('TagOnline', TagOnline);
// 导入全部的elmenet-plus的图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
app.component(key, component);
+10 -2
View File
@@ -30,8 +30,16 @@
<el-table-column prop="deviceManufacturer" align="left" min-width="100" label="厂商类型" />
<el-table-column prop="deviceModel" align="left" min-width="100" label="设备型号" />
<el-table-column prop="ownerCode" align="left" min-width="150" label="设备所属组织" />
<el-table-column prop="isOnline" align="left" min-width="100" label="状态" />
<el-table-column prop="isSync" align="left" min-width="100" label="同步状态" />
<el-table-column prop="isOnline" align="left" min-width="100" label="状态">
<template #default="{ row }">
<tag-online :isOnline="row.isOnline == 1" />
</template>
</el-table-column>
<el-table-column prop="isSync" align="left" min-width="100" label="同步状态">
<template #default="scope">
<el-tag :type="scope.row.isSync ? 'success' : 'danger'">{{ scope.row.isSync ? '已同步' : '未同步' }}</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" width="150">
<template #default="scope">
<el-button icon="edit-pen" text type="primary" v-auth="'admin_deviceManage_edit'"