Merge branch 'dev' into dev-dictionary

This commit is contained in:
leiqiaochu 2023-09-04 19:15:51 +08:00
commit 22ee69d1db
14 changed files with 92 additions and 40 deletions

View File

@ -88,13 +88,12 @@ const subscribeNotice = () => {
const read = (type: string, data: any) => {
changeStatus_api('_read', [data.payload.id]).then((resp: any) => {
if (resp.status !== 200) return;
notification.close(data.payload.id);
getList();
if (type !== '_read') {
menuStory.routerPush('account/center', {
tabKey: 'StationMessage',
row: data.payload.detail,
row: data.payload,
});
}
});

View File

@ -86,6 +86,7 @@ const activeKey = ref<DataType>(props.tabs?.[0]?.key || 'alarm');
const menuStory = useMenuStore();
const route = useRoute();
const type = ref();
const userInfo = useUserInfo();
const getData = (type: string[]) => {
@ -107,6 +108,12 @@ const getData = (type: string[]) => {
termType: 'in',
column: 'topicProvider',
},
{
type: 'and',
value: 'unread',
termType: 'eq',
column: 'state',
},
],
},
],
@ -114,16 +121,14 @@ const getData = (type: string[]) => {
getList_api(params)
.then((resp: any) => {
total.value = resp.result.total;
list.value = resp.result?.data?.filter((item:any)=>{
return item?.state?.value === "unread"
}) || [];
list.value = resp.result?.data || [];
})
.finally(() => (loading.value = false));
};
const onChange = (_key: string) => {
const type = props.tabs.find((item: any) => item.key === _key)?.type || [];
getData(type);
type.value = props.tabs.find((item: any) => item.key === _key)?.type || [];
getData(type.value);
};
onMounted(async () => {
@ -136,7 +141,7 @@ const onRefresh = (id: string,index:number) => {
...refreshObj.value,
[id]: !flag,
};
list.value.splice(index,1);
getData(type.value)
};
const onMore = (key: string) => {

View File

@ -16,3 +16,9 @@ export const CronRegEx = new RegExp(
);
export const isCron = (value: string) => CronRegEx.test(value)
//ipv6
export const regIPv6 = new RegExp(/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\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25[0-5])$/);

View File

@ -1,3 +1,4 @@
import { regIPv6,regIpv4 } from './regular'
/**
* +
* @param value
@ -25,3 +26,9 @@ export const testIP = (value: string) => {
/^([0-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.([0-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.([0-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.([0-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])$/;
return ip.test(value);
};
/**
* Ipv4和Ipv6的地址
*/
export const testIpv4_6 = (value:string) => {
return regIpv4.test(value) || regIPv6.test(value)
}

View File

@ -272,6 +272,10 @@ export const useColumns = (type?: MetadataType, target?: 'device' | 'product', n
title: '说明',
dataIndex: 'description',
type: 'text',
form: {
rules: [
{ max: 20, message: '最多可输入20个字符' },
]},
doubleClick(record) {
if (isExtendsProduct(record.id, productNoEdit?.value, 'description')) {
return false
@ -370,6 +374,10 @@ export const useColumns = (type?: MetadataType, target?: 'device' | 'product', n
title: '说明',
dataIndex: 'description',
type: 'text',
form: {
rules: [
{ max: 20, message: '最多可输入20个字符' },
]},
doubleClick(record) {
if (isExtendsProduct(record.id, productNoEdit?.value, 'description')) {
return false
@ -573,6 +581,10 @@ export const useColumns = (type?: MetadataType, target?: 'device' | 'product', n
title: '说明',
dataIndex: 'description',
type: 'text',
form: {
rules: [
{ max: 20, message: '最多可输入20个字符' },
]},
doubleClick(record) {
if (isExtendsProduct(record.id, productNoEdit?.value, 'description')) {
return false

View File

@ -107,6 +107,7 @@
v-model:value="modalForm.publicPort"
placeholder="请输入公网端口"
style="width: 100%"
:precision="0"
/>
</j-form-item>
</j-col>
@ -131,6 +132,7 @@ import {
} from '@/api/initHome';
import { modalState } from '../data/interface';
import type { Rule } from 'ant-design-vue/es/form';
import { testIpv4_6 } from '@/utils/validate';
const formRef = ref();
/**
* 初始化数据状态
@ -143,6 +145,7 @@ const visible = ref<boolean>(false);
const modalForm = reactive<modalState>({
host: '0.0.0.0',
});
/**
* 校验官网地址
*/
@ -150,10 +153,7 @@ const validateUrl = async (_rule: Rule, value: string) => {
if (!value) {
return Promise.reject('请输入公网地址');
} else {
var reg = new RegExp(
/^(25[0-5]|2[0-4]\d|[0-1]?\d?\d)(\.(25[0-5]|2[0-4]\d|[0-1]?\d?\d)){3}$/,
);
if (!reg.test(value)) {
if (!testIpv4_6(value)) {
return Promise.reject('请输入正确的公网地址');
}
return Promise.resolve();

View File

@ -16,7 +16,9 @@ import BaseMenu, { USER_CENTER_MENU_DATA } from '../data/baseMenu'
import { getSystemPermission, updateMenus } from '@/api/initHome';
import { protocolList } from '@/utils/consts';
import { getProviders } from '@/api/data-collect/channel';
import { isNoCommunity } from '@/utils/utils';
import {
systemVersion,
} from '@/api/login'
/**
* 获取菜单数据
@ -30,7 +32,12 @@ const menuDatas = reactive({
* 查询支持的协议
*/
const getProvidersFn = async () => {
if (!isNoCommunity) {
let version = ''
const req:any =await systemVersion()
if(req.success && req.result){
version = req.result.edition
}
if (version ==='community') {
return undefined
} else {
const res: any = await getProviders();

View File

@ -147,9 +147,8 @@
message: '请输入IP地址',
},
{
pattern:
/^([0-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.([0-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.([0-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.([0-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])$/,
message: '请输入正确的IP地址',
validator:validateUrl,
trigger: 'change',
},
]"
@ -341,10 +340,8 @@
'请输入公网 Host',
},
{
pattern:
/^([0-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.([0-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.([0-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.([0-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])$/,
message:
'请输入正确的IP地址',
validator:validateUrl,
trigger: 'change',
},
]"
>
@ -514,7 +511,8 @@ import { getResourcesCurrent, getClusters } from '@/api/link/accessConfig';
import { update, save } from '@/api/link/accessConfig';
import { onlyMessage } from '@/utils/comm';
import { isNumber } from 'lodash-es';
import type { Rule } from 'ant-design-vue/es/form';
import { testIpv4_6 } from '@/utils/validate';
interface Form2 {
clusterNodeId: string | undefined;
port: string | undefined;
@ -598,6 +596,16 @@ const rules = {
]
}
const validateUrl=async (_rule: Rule, value: string) => {
if (!value) {
return Promise.reject('请输入IP地址');
} else {
if (!testIpv4_6(value)) {
return Promise.reject('请输入正确的IP地址');
}
return Promise.resolve();
}
}
const removeCluster = (item: Form2) => {
let index = dynamicValidateForm.cluster.indexOf(item);
if (index !== -1) {

View File

@ -108,7 +108,7 @@ export const Validator = {
regIpv4: new RegExp(
/^((([01]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))\.){3}(([01]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))$/,
),
regIPv6: new RegExp(/^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$/),
regIPv6: new RegExp(/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/),
regDomain: new RegExp(
// /^https?:\/\/(([a-zA-Z0-9_-])+(\.)?)*(:\d+)?(\/((\.)?(\?)?=?&?[a-zA-Z0-9_-](\?)?)*)*$/i,
/^[a-zA-Z0-9]+([\-\.]{1}[a-zA-Z0-9]+)*\.[a-zA-Z]{2,}$/

View File

@ -570,7 +570,7 @@
<script setup lang="ts">
import { getImage, onlyMessage } from '@/utils/comm';
import CascadeApi from '@/api/media/cascade';
import { regIPv6 } from '@/utils/regular'
const router = useRouter();
const route = useRoute();
@ -674,6 +674,8 @@ onMounted(() => {
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})+\.?/;
const ipv6 = new RegExp(/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/)
/**
* 上级SIP地址 字段验证
* @param _
@ -701,8 +703,8 @@ const checkHost = (host: string, port: string | number | undefined) => {
return Promise.resolve();
} else if (!host) {
return Promise.reject(new Error('请输入IP 地址'));
} else if (host && !regDomain.test(host)) {
return Promise.reject(new Error('请输入0.0.0.0~255.255.255.255的IP地址'));
} else if (host && !regDomain.test(host) && !regIPv6.test(host)) {
return Promise.reject(new Error('请输入正确的IP地址'));
} else if (!port) {
return Promise.reject(new Error('请输入端口'));
} else if ((port && Number(port) < 1) || Number(port) > 65535) {

View File

@ -288,7 +288,7 @@ import { queryProviders, queryDetail, save, update } from '@/api/media/stream';
import type { FormInstance } from 'ant-design-vue';
import { FormDataType } from '../type';
import { testIpv4_6 } from '@/utils/validate';
const router = useRouter();
const route = useRoute();
const view = route.query.view as string;
@ -301,10 +301,6 @@ const options = ref([]);
const checked = ref(false);
const Validator = {
regIpv4: new RegExp(
/^((([01]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))\.){3}(([01]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))$/,
),
regIPv6: new RegExp(/^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$/),
regDomain: new RegExp(
/^https?:\/\/(([a-zA-Z0-9_-])+(\.)?)*(:\d+)?(\/((\.)?(\?)?=?&?[a-zA-Z0-9_-](\?)?)*)*$/i,
),
@ -314,8 +310,7 @@ const Validator = {
const validateAddress = (_rule: any, value: string): Promise<any> =>
new Promise(async (resolve, reject) => {
if (
Validator.regIpv4.test(value) ||
Validator.regIPv6.test(value) ||
testIpv4_6(value) ||
Validator.regDomain.test(value)
) {
return resolve('');

View File

@ -86,7 +86,8 @@ import { getImage, onlyMessage } from '@/utils/comm';
import { queryLevel, saveLevel } from '@/api/rule-engine/config';
import { LevelItem } from './typing';
import Io from './Io/index.vue';
const list = ref([
import { isNoCommunity } from '@/utils/utils';
const list = isNoCommunity ?[
{
key: 'config',
tab: '告警级别',
@ -95,7 +96,12 @@ const list = ref([
key: 'io',
tab: '数据流转',
},
]);
] : [
{
key: 'config',
tab: '告警级别',
}
]
let levels = ref<LevelItem[]>([]);
let tab = ref<'io' | 'config' | string>('config');
const getAlarmLevel = () => {

View File

@ -83,7 +83,7 @@ import {
} from '@/utils/consts';
import { protocolList } from '@/utils/consts';
import { getProviders } from '@/api/data-collect/channel';
import { isNoCommunity } from '@/utils/utils';
const selectedKeys: any = ref([]);
const treeData = ref<any>([]);
const systemMenu: any = ref([]);
@ -118,10 +118,14 @@ const params = {
*/
let filterProtocolList: any[] = [];
const getProvidersFn = async () => {
if(!isNoCommunity){
return
}else{
const res: any = await getProviders();
filterProtocolList = protocolList.filter((item) => {
return res.result?.find((val: any) => item.alias == val.id);
})
}
}
getProvidersFn();
function filterTree(nodes: Array<any>, selectedKeys: Array<any>) {

View File

@ -97,6 +97,7 @@ export default defineConfig(({ mode}) => {
// target: 'http://192.168.32.163:8844', //张季本地
// target: 'http://120.77.179.54:8844', // 120测试
target: 'http://192.168.33.46:8844', // 本地开发环境
// target: 'http://192.168.32.5:8848', // 刘本地
ws: 'ws://192.168.33.46:8844',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, '')