Merge branch 'dev' of github.com:jetlinks/jetlinks-ui-vue into dev

This commit is contained in:
leiqiaochu 2023-07-13 14:44:34 +08:00
commit cecbc3a78b
22 changed files with 182 additions and 155 deletions

View File

@ -28,6 +28,7 @@ import { useUserInfo } from '@/store/userInfo';
import { useMenuStore } from '@/store/menu';
import { getAllNotice } from '@/api/account/center';
import { flatten } from 'lodash-es';
const updateCount = computed(() => useUserInfo().alarmUpdateCount);
const menuStory = useMenuStore();
@ -99,46 +100,6 @@ const read = (type: string, data: any) => {
});
};
//
const getList = () => {
if(tabs.value.length <= 0) return;
loading.value = true;
const params = {
sorts: [{
name: 'notifyTime',
order: 'desc'
}],
terms: [
{
terms: [
{
type: 'or',
value: 'unread',
termType: 'eq',
column: 'state',
},
],
},
],
};
getList_api(params)
.then((resp: any) => {
total.value = resp.result.total;
})
.finally(() => (loading.value = false));
};
const visibleChange = (bool: boolean) => {
bool && getList();
};
const handleRead = () => {
visible.value = false;
getList();
};
watch(updateCount, () => getList());
const tab = [
{
key: 'alarm',
@ -163,6 +124,56 @@ const tab = [
},
];
//
const getList = () => {
if(tabs.value.length <= 0) return;
loading.value = true;
const params = {
sorts: [{
name: 'notifyTime',
order: 'desc'
}],
terms: [
{
terms: [
{
type: 'and',
value: 'unread',
termType: 'eq',
column: 'state',
},
],
},
{
terms: [
{
type: 'and',
value: flatten(tabs.value.map((i: any) => i?.type)),
termType: 'in',
column: 'topicProvider',
},
],
},
],
};
getList_api(params)
.then((resp: any) => {
total.value = resp.result.total;
})
.finally(() => (loading.value = false));
};
const visibleChange = (bool: boolean) => {
bool && getList();
};
const handleRead = () => {
visible.value = false;
getList();
};
watch(updateCount, () => getList());
const tabs = ref<any>([]);
const queryTypeList = async () => {

View File

@ -16,7 +16,7 @@
</template>
<j-spin :spinning="loading">
<div class="content">
<j-scrollbar class="list" :max-height="450" v-if="total">
<j-scrollbar class="list" :max-height="450" v-if="list.length">
<template v-for="i in list" :key="i.id">
<NoticeItem
:data="i"
@ -66,20 +66,11 @@ const emits = defineEmits(['action']);
type DataType = 'alarm' | 'system-monitor' | 'system-business';
const refreshObj = ref({
alarm: true,
'alarm': true,
'system-monitor': true,
'system-business': true,
});
const loading = ref(false);
const total = ref(0);
const list = ref<any[]>([]);
const activeKey = ref<DataType>('alarm');
const menuStory = useMenuStore();
const route = useRoute();
const userInfo = useUserInfo();
const props = defineProps({
tabs: {
type: Array,
@ -87,6 +78,15 @@ const props = defineProps({
}
})
const loading = ref(false);
const total = ref(0);
const list = ref<any[]>([]);
const activeKey = ref<DataType>(props.tabs?.[0]?.key || 'alarm');
const menuStory = useMenuStore();
const route = useRoute();
const userInfo = useUserInfo();
const getData = (type: string[]) => {
loading.value = true;
const params = {
@ -124,7 +124,7 @@ const onChange = (_key: string) => {
};
onMounted(async () => {
onChange('alarm');
onChange(props.tabs?.[0]?.key || "alarm");
});
const onRefresh = (id: string) => {

View File

@ -4,7 +4,7 @@
:type='type'
:request='(data) => saveSearchHistory(data, target)'
:historyRequest='() => getSearchHistory(target)'
:deleteRequest='deleteSearchHistory'
:deleteRequest='(_target: string, id: string) => deleteSearchHistory(target, id)'
:columns='columns'
:class='props.class'
style='padding-top: 18px; padding-bottom: 18px;'

View File

@ -98,6 +98,10 @@ const props: JUploadProps = defineProps({
borderStyle: {
type: Object,
default: undefined
},
size: {
type: Number,
default: undefined,
}
});

View File

@ -337,7 +337,7 @@ import BatchUpdate from './components/BatchUpdate/index.vue';
import SaveModBus from './Save/SaveModBus.vue';
import SaveOPCUA from './Save/SaveOPCUA.vue';
import Scan from './Scan/index.vue';
import { colorMap } from '../data.ts';
import { colorMap } from '../data';
import { cloneDeep, isNumber, throttle } from 'lodash-es';
import { getWebSocket } from '@/utils/websocket';
import { map } from 'rxjs/operators';
@ -441,14 +441,6 @@ const columns = [
label: '运行中',
value: 'running',
},
{
label: '部分错误',
value: 'partialError',
},
{
label: '错误',
value: 'failed',
},
{
label: '已停止',
value: 'stopped',

View File

@ -177,7 +177,7 @@ const columns = [
rename: 'id',
options: () =>
new Promise((resolve) => {
queryNoPagingPost({}).then((resp: any) => {
queryNoPagingPost({paging: false}).then((resp: any) => {
resolve(
resp.result.map((item: any) => ({
label: item.name,

View File

@ -245,6 +245,7 @@ const onAllRead = async () => {
if (resp.status === 200) {
onlyMessage('操作成功!');
refresh();
user.updateAlarm();
}
};

View File

@ -1,5 +1,5 @@
<template>
<j-spin :spinning="loading" v-if="_metadata.length">
<j-spin :spinning="loading" v-if="_metadata?.length">
<j-card :bordered="false">
<template #title>
<TitleComponent data="点位映射"></TitleComponent>

View File

@ -146,7 +146,7 @@ const selectChange = (e: any) => {
visible.value = true;
}
const item = productList.value.filter((i: any) => i.id === e)[0];
const array = JSON.parse(item.metadata || [])?.properties?.map(
const array = JSON.parse(item.metadata || '{}')?.properties?.map(
(i: any) => ({
metadataType: 'property',
metadataName: `${i.name}(${i.id})`,

View File

@ -1,5 +1,5 @@
<template>
<j-spin :spinning="loading" v-if="metadata.properties.length">
<j-spin :spinning="loading" v-if="metadata.properties?.length">
<j-card :bordered="false" style="padding: 0">
<template #extra>
<j-space>
@ -263,7 +263,7 @@ const channelList = ref<any[]>([]);
const _properties = computed(() => {
const _cur = current.value >= 1 ? current.value : 1;
return metadata.properties.slice((_cur - 1) * 10, _cur * 10);
return metadata.properties?.slice((_cur - 1) * 10, _cur * 10) || [];
});
const modelRef = reactive<{

View File

@ -61,16 +61,16 @@
</slot>
</template>
<template #content>
<Ellipsis style="width: calc(100% - 100px)">
<div style="height: 110px">
<Ellipsis style="width: calc(100% - 100px)">
<h3 style="font-weight: 600">
{{ slotProps.name }}
</h3>
</Ellipsis>
<div style="height: 95px">
<j-row>
<j-row>
<j-col :span="12" v-if="slotProps.channelInfo">
<div class="card-item-content-text">
{{ slotProps.channelInfo?.name }}
<j-ellipsis>{{ slotProps.channelInfo?.name }}</j-ellipsis>
</div>
<Ellipsis style="width: calc(100% - 20px)">
<div>
@ -90,8 +90,7 @@
</j-row>
<j-row>
<j-col :span="24">
<Ellipsis style="width: calc(100% - 50px)"
>
<j-ellipsis style="width: calc(100% - 50px)">
<div class="context-access">
{{
getDescription(
@ -99,8 +98,7 @@
)
}}
</div>
</Ellipsis
>
</j-ellipsis>
</j-col>
</j-row>
</div>
@ -341,5 +339,4 @@ const add = () => {
</script>
<style scoped>
</style>

View File

@ -27,30 +27,30 @@ const filterProductMetadata = (data: any[], productMetaData: any[]) => {
): ProductItem | DeviceInstance => {
if (!data) return data;
const metadata = JSON.parse(data.metadata || '{}') as DeviceMetadata;
let productMetaData
// let productMetaData
if ((data as DeviceInstance).productMetadata) {
productMetaData = JSON.parse((data as DeviceInstance).productMetadata)
}
if (productMetaData) {
if (productMetaData.properties && productMetaData.properties.length) {
metadata.properties = filterProductMetadata(item, productMetaData.properties)
}
if (productMetaData.functions && productMetaData.functions.length) {
metadata.functions = filterProductMetadata(item, productMetaData.functions)
}
if (productMetaData.events && productMetaData.events.length) {
metadata.events = filterProductMetadata(item, productMetaData.events)
}
if (productMetaData.tags && productMetaData.tags.length) {
metadata.tags = filterProductMetadata(item, productMetaData.tags)
}
} else {
metadata[type] = item as any
}
console.log(metadata, type)
metadata[type] = metadata[type].sort((a, b) => b?.sortsIndex - a?.sortsIndex) as any[]
// if ((data as DeviceInstance).productMetadata) {
// productMetaData = JSON.parse((data as DeviceInstance).productMetadata)
// }
//
// if (productMetaData) {
// if (productMetaData.properties && productMetaData.properties.length) {
// metadata.properties = filterProductMetadata(item, productMetaData.properties)
// }
// if (productMetaData.functions && productMetaData.functions.length) {
// metadata.functions = filterProductMetadata(item, productMetaData.functions)
// }
// if (productMetaData.events && productMetaData.events.length) {
// metadata.events = filterProductMetadata(item, productMetaData.events)
// }
// if (productMetaData.tags && productMetaData.tags.length) {
// metadata.tags = filterProductMetadata(item, productMetaData.tags)
// }
// } else {
// metadata[type] = item as any
// }
// console.log(metadata, type)
metadata[type] = (item || []).sort((a, b) => b?.sortsIndex - a?.sortsIndex) as any[]
data.metadata = JSON.stringify(metadata);
onEvent?.(data.metadata)
return data;

View File

@ -13,7 +13,7 @@
<j-row type="flex">
<j-col flex="180px">
<j-form-item name="photoUrl">
<JProUpload accept="image/jpeg,image/png" v-model="modelRef.photoUrl" />
<JProUpload accept="image/jpeg,image/png" v-model="modelRef.photoUrl" :size="4"/>
</j-form-item>
</j-col>
<j-col flex="auto">
@ -184,7 +184,7 @@ const vailId = async (_: Record<string, any>, value: string) => {
if (!props?.data?.id && value) {
const resp = await isExists(value);
if (resp.status === 200 && resp.result) {
return Promise.reject('ID重复');
return Promise.reject('该ID已存在');
} else {
return Promise.resolve();
}

View File

@ -7,7 +7,7 @@
ref="listRef"
model="table"
:columns="columns"
:request="(e:any) => CascadeApi.queryBindChannel(route?.query.id as string, e)"
:request="(e) => CascadeApi.queryBindChannel(route?.query.id, e)"
:defaultParams="{
sorts: [{ name: 'name', order: 'desc' }],
}"
@ -44,7 +44,7 @@
</j-tooltip>
</template>
<template #channelId="slotProps">
<j-space>
<div style="display: flex; align-items: center;">
<Ellipsis style="width: 150px">
{{ slotProps.gbChannelId }}
</Ellipsis>
@ -92,7 +92,7 @@
<AIcon type="EditOutlined" />
</j-button>
</j-popover>
</j-space>
</div>
</template>
<template #status="slotProps">
<j-space>
@ -182,8 +182,8 @@ const columns = [
title: '国标ID',
dataIndex: 'channelId',
key: 'channelId',
ellipsis: true,
scopedSlots: true,
width: 200,
headerCell: 'gbChannelIdHeader', //
search: {
type: 'string',

View File

@ -179,6 +179,7 @@
"
placeholder="请输入端口"
style="width: 100%"
:precision="0"
/>
</j-col>
</j-row>
@ -284,6 +285,7 @@
"
placeholder="请输入端口"
style="width: 100%"
:precision="0"
/>
</j-col>
</j-row>
@ -670,8 +672,8 @@ onMounted(() => {
getDetail();
});
const regDomain =
/[j-zA-Z0-9][-j-zA-Z0-9]{0,62}(\.[j-zA-Z0-9][-j-zA-Z0-9]{0,62})+\.?/;
const regDomain = /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(?:\.|$)){4}$/
// /[j-zA-Z0-9][-j-zA-Z0-9]{0,62}(\.[j-zA-Z0-9][-j-zA-Z0-9]{0,62})+\.?/;
/**
* 上级SIP地址 字段验证
* @param _
@ -700,10 +702,10 @@ const checkHost = (host: string, port: string | number | undefined) => {
} else if (!host) {
return Promise.reject(new Error('请输入IP 地址'));
} else if (host && !regDomain.test(host)) {
return Promise.reject(new Error('请输入正确的IP地址'));
return Promise.reject(new Error('请输入0.0.0.0~255.255.255.255的IP地址'));
} else if (!port) {
return Promise.reject(new Error('请输入端口'));
} else if ((host && Number(host) < 1) || Number(host) > 65535) {
} else if ((port && Number(port) < 1) || Number(port) > 65535) {
return Promise.reject(new Error('端口请输入1~65535之间的正整数'));
}
return Promise.resolve();
@ -739,8 +741,8 @@ const handleSubmit = () => {
id,
cascadeName,
proxyStream,
publicHost,
publicPort,
// publicHost,
// publicPort,
...extraFormData
} = formData.value;
const params = {
@ -750,10 +752,10 @@ const handleSubmit = () => {
sipConfigs: [
{
...extraFormData,
remotePublic: {
host: publicHost,
port: publicPort,
},
// remotePublic: {
// host: publicHost,
// port: publicPort,
// },
},
],
};

View File

@ -21,13 +21,13 @@
</div>
<template #overlay>
<j-menu @click="recordStart">
<j-menu-item key='false' v-if='route.query.type !== "fixed-media"'>
<j-menu-item key='true' v-if='route.query.type !== "fixed-media"'>
<span style='padding-right: 12px;'>本地存储</span>
<j-tooltip title='存储在设备本地'>
<a-icon type='QuestionCircleOutlined' />
</j-tooltip>
</j-menu-item>
<j-menu-item key='true'>
<j-menu-item key='false'>
<span style='padding-right: 12px;'>云端存储</span>
<j-tooltip title='存储在服务器中'>
<a-icon type='QuestionCircleOutlined' />

View File

@ -98,7 +98,6 @@
height: 19px;
background-color: @primary-color;
border-radius: 2px;
visibility: hidden;
}
.time-line {
@ -112,7 +111,6 @@
background-color: #d9d9d9;
border-radius: 2px;
box-shadow: 0 0 12px rgba(#000, 0.15);
visibility: hidden;
}
}
}

View File

@ -37,7 +37,7 @@
}
"
:on-time-update="
(e: any) => {
(e) => {
playTime = e;
}
"

View File

@ -24,8 +24,8 @@
"
></div>
</div>
<div id="btn" class="time-line-btn"></div>
<div id="time" class="time-line">
<div id="btn" v-show="timePosition" class="time-line-btn" :style="{left: timePosition + 'px' }"></div>
<div id="time" v-show="timePosition" class="time-line" :style="{left: (timePosition - 15) + 'px' }">
{{ dayjs(playTime || 0).format('HH:mm:ss') }}
</div>
</div>
@ -76,7 +76,7 @@ const endT = ref<number>(
).getTime(),
);
const list = ref<any[]>([]);
const playTime = ref<number>(0);
const _playTime = ref<number>(0);
const LineContent = ref<HTMLDivElement>();
const LineContentSize = useElementSize(LineContent);
@ -107,7 +107,7 @@ const onChange = (
deviceId: string,
channelId: string,
) => {
playTime.value = startTime;
_playTime.value = startTime;
props.onChange({
startTime: dayjs(startTime),
endTime: dayjs(endTime),
@ -132,11 +132,11 @@ const playByStartTime = (time: any) => {
playByStartTime(0);
const onNextPlay = () => {
if (playTime.value) {
if (_playTime.value) {
//
const nowIndex = props.data.findIndex((item) => {
const startTime = item.startTime || item.mediaStartTime;
return startTime === playTime.value;
return startTime === _playTime.value;
});
//
if (nowIndex !== props.data.length - 1) {
@ -216,35 +216,44 @@ const getLineItemStyle = (
const start = startTime - startT.value > 0 ? startTime - startT.value : 0;
const _width = LineContentSize.width.value!;
const itemWidth = ((endTime - startTime) / (24 * 3600000)) * _width;
console.log()
return {
left: `${(start / (24 * 3600000)) * _width}px`,
width: `${itemWidth < 1 ? 1 : itemWidth}px`,
};
};
const playTimeChange = () => {
if (
props.playTime &&
props.playTime >= startT.value &&
props.playTime <= endT.value &&
props.data &&
props.data.length
) {
setTimeAndPosition((props.playTime - startT.value) / 3600000 / 24);
}
};
watch(
() => props.playTime,
() => {
playTimeChange();
},
);
watch(
() => startT.value,
() => {
playTimeChange();
},
);
const timePosition = computed(() => {
console.log(props.playTime, startT.value, LineContentSize.width.value)
console.log(((props.playTime - startT.value) / 3600000 / 24) * LineContentSize.width.value)
return ((props.playTime - startT.value) / 3600000 / 24) * LineContentSize.width.value
})
// const playTimeChange = () => {
// if (
// props.playTime &&
// props.playTime >= startT.value &&
// props.playTime <= endT.value &&
// props.data &&
// props.data.length
// ) {
// console.log(props.playTime, props.playTime - startT.value)
// setTimeAndPosition((props.playTime - startT.value) / 3600000 / 24);
// }
// };
// watch(
// () => props.playTime,
// () => {
// playTimeChange();
// },
// );
// watch(
// () => startT.value,
// () => {
// playTimeChange();
// },
// );
const handleProgress = (event: any, item: any) => {
const pos = LineContent.value?.getBoundingClientRect();

View File

@ -10,11 +10,13 @@
@select="onSelect"
v-model:expandedKeys="expandedKeys"
>
<template #icon="{ id, selected }">
<AIcon
type="VideoCameraOutlined"
<template #title="{id, name}">
<div class="name"><AIcon
type="VideoCameraOutlined" style="margin-right: 5px;"
v-if="!treeData.find((f: any) => f.id === id)"
/>
/><j-ellipsis>{{ name }}</j-ellipsis></div>
</template>
<template #icon>
</template>
</j-tree>
</div>
@ -196,4 +198,9 @@ const onLoadData = ({ key, children }: any): Promise<void> => {
<style lang="less" scoped>
@import './index.less';
.name {
display: flex;
align-items: center;
}
</style>

View File

@ -60,6 +60,12 @@ const getUserList = (oParams: any) => {
column: 'id$in-dimension$role$not',
value: props.roleId,
},
{
column: 'username',
value: 'admin',
termType: 'not',
type: 'and'
}
],
},
],

View File

@ -3837,8 +3837,8 @@ jetlinks-ui-components@^1.0.23:
jetlinks-ui-components@^1.0.24:
version "1.0.24"
resolved "http://registry.jetlinks.cn/jetlinks-ui-components/-/jetlinks-ui-components-1.0.24.tgz#bc536b4ebe5970804216be00fa2e636caf266b05"
integrity sha512-XsxAnU/0fmvhFm9CrYnLxwvpoXKOYnz9D1eA82e/qCqn2QGhiq6h84uuTAkS/hBWnbZurJkj2P5Pl+rnzXD4AA==
resolved "http://registry.jetlinks.cn/jetlinks-ui-components/-/jetlinks-ui-components-1.0.24.tgz#969a901be0214d3e631f02e537c56e0abc2e48ab"
integrity sha512-t0XkbxldcKjXW/xPYYbBU8YEfK+RK01LYqS/n+wfMq3pPRksegBOt7gnsvJD6kgEpSNf/uzlnV9MWFOgQJFphg==
dependencies:
"@vueuse/core" "^9.12.0"
"@vueuse/router" "^9.13.0"