mirror of
https://gitee.com/yudaocode/yudao-ui-admin-vben.git
synced 2025-12-30 02:22:25 +00:00
review:【antd】【iot】代码实现
This commit is contained in:
@@ -15,13 +15,7 @@ import { DICT_TYPE } from '@vben/constants';
|
||||
import { IconifyIcon } from '@vben/icons';
|
||||
import { formatDateTime } from '@vben/utils';
|
||||
|
||||
import {
|
||||
Button,
|
||||
Select,
|
||||
Space,
|
||||
Switch,
|
||||
Tag,
|
||||
} from 'ant-design-vue';
|
||||
import { Button, Select, Space, Switch, Tag } from 'ant-design-vue';
|
||||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import { getDeviceMessagePage } from '#/api/iot/device/device';
|
||||
@@ -241,9 +235,7 @@ defineExpose({
|
||||
</template>
|
||||
<template #params="{ row }">
|
||||
<span v-if="row.reply">
|
||||
{{
|
||||
`{"code":${row.code},"msg":"${row.msg}","data":${row.data}\}`
|
||||
}}
|
||||
{{ `{"code":${row.code},"msg":"${row.msg}","data":${row.data}\}` }}
|
||||
</span>
|
||||
<span v-else>{{ row.params }}</span>
|
||||
</template>
|
||||
|
||||
@@ -593,8 +593,14 @@ async function handleServiceInvoke(row: ThingModelData) {
|
||||
size="small"
|
||||
@click="messageCollapsed = !messageCollapsed"
|
||||
>
|
||||
<IconifyIcon icon="lucide:chevron-down" v-if="!messageCollapsed" />
|
||||
<IconifyIcon icon="lucide:chevron-down" v-if="messageCollapsed" />
|
||||
<IconifyIcon
|
||||
icon="lucide:chevron-down"
|
||||
v-if="!messageCollapsed"
|
||||
/>
|
||||
<IconifyIcon
|
||||
icon="lucide:chevron-down"
|
||||
v-if="messageCollapsed"
|
||||
/>
|
||||
</Button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -9,13 +9,7 @@ import { Page } from '@vben/common-ui';
|
||||
import { IconifyIcon } from '@vben/icons';
|
||||
import { formatDateTime } from '@vben/utils';
|
||||
|
||||
import {
|
||||
Button,
|
||||
RangePicker,
|
||||
Select,
|
||||
Space,
|
||||
Tag,
|
||||
} from 'ant-design-vue';
|
||||
import { Button, RangePicker, Select, Space, Tag } from 'ant-design-vue';
|
||||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import { getDeviceMessagePairPage } from '#/api/iot/device/device';
|
||||
@@ -240,9 +234,7 @@ defineExpose({
|
||||
<Grid>
|
||||
<template #reportTime="{ row }">
|
||||
{{
|
||||
row.request?.reportTime
|
||||
? formatDateTime(row.request.reportTime)
|
||||
: '-'
|
||||
row.request?.reportTime ? formatDateTime(row.request.reportTime) : '-'
|
||||
}}
|
||||
</template>
|
||||
<template #identifier="{ row }">
|
||||
|
||||
@@ -3,7 +3,14 @@
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { IotDeviceApi } from '#/api/iot/device/device';
|
||||
|
||||
import { nextTick, onBeforeUnmount, onMounted, reactive, ref, watch } from 'vue';
|
||||
import {
|
||||
nextTick,
|
||||
onBeforeUnmount,
|
||||
onMounted,
|
||||
reactive,
|
||||
ref,
|
||||
watch,
|
||||
} from 'vue';
|
||||
|
||||
import { Page } from '@vben/common-ui';
|
||||
import { IconifyIcon } from '@vben/icons';
|
||||
@@ -27,6 +34,7 @@ import DeviceDetailsThingModelPropertyHistory from './thing-model-property-histo
|
||||
|
||||
const props = defineProps<{ deviceId: number }>();
|
||||
|
||||
// TODO @haohao:变量写在 // 列表的加载中 这种注释哈,变量后面;
|
||||
/** 列表的加载中 */
|
||||
const loading = ref(true);
|
||||
/** 显示的列表数据 */
|
||||
@@ -373,7 +381,9 @@ onBeforeUnmount(() => {
|
||||
<div class="mb-2.5 last:mb-0">
|
||||
<span class="mr-2.5 text-muted-foreground">更新时间</span>
|
||||
<span class="text-sm text-foreground">
|
||||
{{ item.updateTime ? formatDateTime(item.updateTime) : '-' }}
|
||||
{{
|
||||
item.updateTime ? formatDateTime(item.updateTime) : '-'
|
||||
}}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -394,9 +404,7 @@ onBeforeUnmount(() => {
|
||||
<template #actions="{ row }">
|
||||
<Button
|
||||
type="link"
|
||||
@click="
|
||||
openHistory(props.deviceId, row.identifier, row.dataType)
|
||||
"
|
||||
@click="openHistory(props.deviceId, row.identifier, row.dataType)"
|
||||
>
|
||||
查看数据
|
||||
</Button>
|
||||
|
||||
@@ -9,13 +9,7 @@ import { Page } from '@vben/common-ui';
|
||||
import { IconifyIcon } from '@vben/icons';
|
||||
import { formatDateTime } from '@vben/utils';
|
||||
|
||||
import {
|
||||
Button,
|
||||
RangePicker,
|
||||
Select,
|
||||
Space,
|
||||
Tag,
|
||||
} from 'ant-design-vue';
|
||||
import { Button, RangePicker, Select, Space, Tag } from 'ant-design-vue';
|
||||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import { getDeviceMessagePairPage } from '#/api/iot/device/device';
|
||||
@@ -254,15 +248,11 @@ defineExpose({
|
||||
<Grid>
|
||||
<template #requestTime="{ row }">
|
||||
{{
|
||||
row.request?.reportTime
|
||||
? formatDateTime(row.request.reportTime)
|
||||
: '-'
|
||||
row.request?.reportTime ? formatDateTime(row.request.reportTime) : '-'
|
||||
}}
|
||||
</template>
|
||||
<template #responseTime="{ row }">
|
||||
{{
|
||||
row.reply?.reportTime ? formatDateTime(row.reply.reportTime) : '-'
|
||||
}}
|
||||
{{ row.reply?.reportTime ? formatDateTime(row.reply.reportTime) : '-' }}
|
||||
</template>
|
||||
<template #identifier="{ row }">
|
||||
<Tag color="blue" size="small">
|
||||
|
||||
@@ -72,7 +72,6 @@ const queryParams = ref({
|
||||
groupId: undefined as number | undefined,
|
||||
}); // 搜索参数
|
||||
|
||||
|
||||
/** 搜索 */
|
||||
function handleSearch() {
|
||||
if (viewMode.value === 'list') {
|
||||
@@ -201,7 +200,6 @@ function handleRowCheckboxChange({
|
||||
checkedIds.value = records.map((item) => item.id!);
|
||||
}
|
||||
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
gridOptions: {
|
||||
checkboxConfig: {
|
||||
@@ -310,7 +308,10 @@ onMounted(async () => {
|
||||
style="width: 200px"
|
||||
>
|
||||
<Select.Option
|
||||
v-for="dict in getDictOptions(DICT_TYPE.IOT_PRODUCT_DEVICE_TYPE, 'number')"
|
||||
v-for="dict in getDictOptions(
|
||||
DICT_TYPE.IOT_PRODUCT_DEVICE_TYPE,
|
||||
'number',
|
||||
)"
|
||||
:key="dict.value"
|
||||
:value="dict.value"
|
||||
>
|
||||
|
||||
@@ -23,7 +23,9 @@ const messageChartRef = ref();
|
||||
const { renderEcharts } = useEcharts(messageChartRef);
|
||||
|
||||
const loading = ref(false);
|
||||
const messageData = ref<IotStatisticsApi.DeviceMessageSummaryByDateRespVO[]>([]);
|
||||
const messageData = ref<IotStatisticsApi.DeviceMessageSummaryByDateRespVO[]>(
|
||||
[],
|
||||
);
|
||||
|
||||
/** 时间范围(仅日期,不包含时分秒) */
|
||||
const dateRange = ref<[string, string]>([
|
||||
|
||||
@@ -405,4 +405,3 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -90,4 +90,3 @@ onMounted(async () => {
|
||||
</Tabs>
|
||||
</Page>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -17,6 +17,8 @@ import { $t } from '#/locales';
|
||||
|
||||
import { useAdvancedFormSchema, useBasicFormSchema } from '../data';
|
||||
|
||||
const emit = defineEmits(['success']);
|
||||
|
||||
/** 生成 ProductKey(包含大小写字母和数字) */
|
||||
function generateProductKey(): string {
|
||||
const chars =
|
||||
@@ -28,7 +30,6 @@ function generateProductKey(): string {
|
||||
return result;
|
||||
}
|
||||
|
||||
const emit = defineEmits(['success']);
|
||||
const formData = ref<IotProductApi.Product>();
|
||||
const activeKey = ref<string[]>([]);
|
||||
const getTitle = computed(() => {
|
||||
|
||||
Reference in New Issue
Block a user