fix: 优化查询条件;合并dev部分代码

This commit is contained in:
XieYongHong 2023-10-10 10:25:30 +08:00
parent ac074990cb
commit 5f41a9a125
11 changed files with 62 additions and 62 deletions

View File

@ -29,7 +29,7 @@ const handleTermsToString = (queryTerms: any, terms: Array<TermsType>, parentKey
Object.keys(a).forEach((b) => { Object.keys(a).forEach((b) => {
const key = `${parentKey}[${aIndex}].${b}` const key = `${parentKey}[${aIndex}].${b}`
if (b === 'terms') { if (b === 'terms') {
handleTermsToString(queryTerms, a[b], `${key}.`) handleTermsToString(queryTerms, a[b], `${key}`)
} else { } else {
queryTerms[key] = a[b] queryTerms[key] = a[b]
} }
@ -48,7 +48,7 @@ export const paramsEncodeQuery = (params?: ParamsType) => {
const { sorts, terms } = params const { sorts, terms } = params
if (terms) { if (terms) {
handleTermsToString(queryParams, terms, 'terms.') handleTermsToString(queryParams, terms, 'terms')
} }
if (sorts) { if (sorts) {

View File

@ -15,8 +15,6 @@
checkable checkable
@check="onCheck" @check="onCheck"
:height="600" :height="600"
:showLine="{ showLeafIcon: false }"
:show-icon="true"
> >
<template #title="{ name, key }"> <template #title="{ name, key }">
<span <span

View File

@ -63,7 +63,7 @@ const Status = defineComponent({
} }
const jumpAccessConfig = () => { const jumpAccessConfig = () => {
menuStory.jumpPage('device/Product/Detail', { id: unref(device).productId, tab: 'access' }); menuStory.jumpPage('device/Product/Detail', { id: unref(device).productId, tab: 'Device' });
}; };
const jumpDeviceConfig = () => { const jumpDeviceConfig = () => {
@ -1806,4 +1806,4 @@ const Status = defineComponent({
}, },
}) })
export default Status export default Status

View File

@ -259,4 +259,6 @@ urlMap.set('mqtt-client-gateway', 'topic');
urlMap.set('http-server-gateway', 'url'); urlMap.set('http-server-gateway', 'url');
urlMap.set('websocket-server', 'url'); urlMap.set('websocket-server', 'url');
urlMap.set('coap-server-gateway', 'url'); urlMap.set('coap-server-gateway', 'url');
urlMap.set('udp-device-gateway', 'url');
urlMap.set('tcp-server-gateway', 'url');

View File

@ -19,8 +19,6 @@
:tree-data="dataSource" :tree-data="dataSource"
:checkedKeys="checkedKeys" :checkedKeys="checkedKeys"
@check="onCheck" @check="onCheck"
:showLine="{ showLeafIcon: false }"
:show-icon="true"
/> />
</j-card> </j-card>
<div style="width: 100px"> <div style="width: 100px">
@ -137,7 +135,7 @@ const _delete = (_key: string) => {
}; };
const handleClick = async () => { const handleClick = async () => {
if (!rightList.value.length) { if (!rightList.value.length) {
onlyMessage('请选择采集器', 'warning'); onlyMessage('请选择采集器', 'warning');
} else { } else {
@ -154,7 +152,7 @@ const handleClick = async () => {
})); }));
params.push(...array); params.push(...array);
}); });
const filterParms = params.filter((item) => !!item.metadataId); const filterParms = params.filter((item) => !!item.metadataId);
if (filterParms && filterParms.length !== 0) { if (filterParms && filterParms.length !== 0) {
const res = await saveMapping(_props.deviceId, _props.type, filterParms); const res = await saveMapping(_props.deviceId, _props.type, filterParms);
@ -194,4 +192,4 @@ watchEffect(() => {
} }
} }
} }
</style> </style>

View File

@ -267,17 +267,17 @@ loadData();
// } // }
// if(!item?.name){ // if(!item?.name){
// onlyMessage(`${index + 1}name`,'error'); // onlyMessage(`${index + 1}name`,'error');
// return // return
// } // }
// if(!item?.expands?.source){ // if(!item?.expands?.source){
// onlyMessage(`${index + 1}expands.source`,'error'); // onlyMessage(`${index + 1}expands.source`,'error');
// return // return
// } // }
// if((item?.expands?.source === 'device' || item?.expands?.source === 'rule') && !item?.expands?.type){ // if((item?.expands?.source === 'device' || item?.expands?.source === 'rule') && !item?.expands?.type){
// onlyMessage(`${index + 1}type`,'error'); // onlyMessage(`${index + 1}type`,'error');
// return // return
// } // }
// }) || false // }) || false
// } // }
const requiredCheck = (data:any) =>{ const requiredCheck = (data:any) =>{
@ -287,12 +287,12 @@ const requiredCheck = (data:any) =>{
if(!item?.id){ if(!item?.id){
onlyMessage(`属性定义第${index + 1}个数组中缺失id属性`,'error'); onlyMessage(`属性定义第${index + 1}个数组中缺失id属性`,'error');
check = true check = true
return return
} }
if(!item?.name){ if(!item?.name){
onlyMessage(`属性定义第${index + 1}个数组中缺失name属性`,'error'); onlyMessage(`属性定义第${index + 1}个数组中缺失name属性`,'error');
check = true check = true
return return
} }
if(!item?.valueType?.type){ if(!item?.valueType?.type){
onlyMessage(`标签定义第${index + 1}个数组中缺失valueType.type属性`,'error'); onlyMessage(`标签定义第${index + 1}个数组中缺失valueType.type属性`,'error');
@ -302,14 +302,14 @@ const requiredCheck = (data:any) =>{
if(!item?.expands?.source){ if(!item?.expands?.source){
onlyMessage(`属性定义第${index + 1}个数组中缺失expands.source属性`,'error'); onlyMessage(`属性定义第${index + 1}个数组中缺失expands.source属性`,'error');
check = true check = true
return return
} }
if((item?.expands?.source === 'device' || item?.expands?.source === 'rule') && !item?.expands?.type){ if((item?.expands?.source === 'device' || item?.expands?.source === 'rule') && !item?.expands?.type){
onlyMessage(`属性定义第${index + 1}个数组中缺失type属性`,'error'); onlyMessage(`属性定义第${index + 1}个数组中缺失type属性`,'error');
check = true check = true
return return
} }
}) })
} }
if(data?.functions && !check){ if(data?.functions && !check){
@ -323,7 +323,7 @@ const requiredCheck = (data:any) =>{
onlyMessage(`方法定义第${index + 1}个数组中缺失name属性`,'error'); onlyMessage(`方法定义第${index + 1}个数组中缺失name属性`,'error');
check = true check = true
return return
} }
if(!item?.async && item?.async !== false){ if(!item?.async && item?.async !== false){
onlyMessage(`方法定义第${index + 1}个数组中缺失async属性`,'error'); onlyMessage(`方法定义第${index + 1}个数组中缺失async属性`,'error');
check = true check = true
@ -375,13 +375,13 @@ const requiredCheck = (data:any) =>{
onlyMessage(`事件定义第${index + 1}个数组中缺失valueType.properties数组第${number+1}项的valueType.type属性`,'error'); onlyMessage(`事件定义第${index + 1}个数组中缺失valueType.properties数组第${number+1}项的valueType.type属性`,'error');
check = true check = true
return return
} }
}) })
}else{ }else{
onlyMessage(`事件定义第${index + 1}个数组中缺失valueType.properties数组`,'error'); onlyMessage(`事件定义第${index + 1}个数组中缺失valueType.properties数组`,'error');
check = true check = true
return return
} }
} }
}) })
} }
@ -396,7 +396,7 @@ const requiredCheck = (data:any) =>{
onlyMessage(`标签定义第${index + 1}个数组中缺失name属性`,'error'); onlyMessage(`标签定义第${index + 1}个数组中缺失name属性`,'error');
check = true check = true
return return
} }
if(!item?.valueType?.type){ if(!item?.valueType?.type){
onlyMessage(`标签定义第${index + 1}个数组中缺失valueType.type属性`,'error'); onlyMessage(`标签定义第${index + 1}个数组中缺失valueType.type属性`,'error');
check = true check = true
@ -419,18 +419,18 @@ const aliCheck = (data:any) => {
if(!item?.identifier){ if(!item?.identifier){
onlyMessage(`属性定义第${index + 1}个数组中缺失identifier属性`,'error'); onlyMessage(`属性定义第${index + 1}个数组中缺失identifier属性`,'error');
check = true check = true
return return
} }
if(!item?.name){ if(!item?.name){
onlyMessage(`属性定义第${index + 1}个数组中缺失name属性`,'error'); onlyMessage(`属性定义第${index + 1}个数组中缺失name属性`,'error');
check = true check = true
return return
} }
if(!item?.dataType?.type){ if(!item?.dataType?.type){
onlyMessage(`属性定义第${index + 1}个数组中缺失dataType.type属性`,'error'); onlyMessage(`属性定义第${index + 1}个数组中缺失dataType.type属性`,'error');
check = true check = true
return return
} }
}) })
} }
if(data?.functions && !check){ if(data?.functions && !check){
@ -444,7 +444,7 @@ const aliCheck = (data:any) => {
onlyMessage(`方法定义第${index + 1}个数组中缺失name属性`,'error'); onlyMessage(`方法定义第${index + 1}个数组中缺失name属性`,'error');
check = true check = true
return return
} }
if(!item?.callType){ if(!item?.callType){
onlyMessage(`方法定义第${index + 1}个数组中缺失callType属性`,'error'); onlyMessage(`方法定义第${index + 1}个数组中缺失callType属性`,'error');
check = true check = true
@ -486,23 +486,23 @@ const aliCheck = (data:any) => {
onlyMessage(`事件定义第${index + 1}个数组中缺失outputData数组第${number+1}项的dataType.type属性`,'error'); onlyMessage(`事件定义第${index + 1}个数组中缺失outputData数组第${number+1}项的dataType.type属性`,'error');
check = true check = true
return return
} }
if(!i?.dataType?.specs){ if(!i?.dataType?.specs){
onlyMessage(`事件定义第${index + 1}个数组中缺失outputData数组第${number+1}项的dataType.specs属性`,'error'); onlyMessage(`事件定义第${index + 1}个数组中缺失outputData数组第${number+1}项的dataType.specs属性`,'error');
check = true check = true
return return
} }
}) })
}else{ }else{
onlyMessage(`事件定义第${index + 1}个数组中缺失outputData数组`,'error'); onlyMessage(`事件定义第${index + 1}个数组中缺失outputData数组`,'error');
check = true check = true
return return
} }
} }
}) })
} }
return check return check
} }
const beforeUpload: UploadProps['beforeUpload'] = (file) => { const beforeUpload: UploadProps['beforeUpload'] = (file) => {
if(file.type === 'application/json') { if(file.type === 'application/json') {
const reader = new FileReader(); const reader = new FileReader();
@ -510,17 +510,10 @@ const beforeUpload: UploadProps['beforeUpload'] = (file) => {
reader.onload = (json) => { reader.onload = (json) => {
if(json.target?.result){ if(json.target?.result){
const data = JSON.parse(json.target?.result); const data = JSON.parse(json.target?.result);
Object.keys(data).forEach((i:any)=>{ let check = formModel.metadata === 'jetlinks' ? requiredCheck(data) : aliCheck(data)
const map = new Map()
data[i].forEach((item:any)=>(
map.set(item.id,item)
))
data[i] = [...map.values()]
})
let check = formModel.metadata === 'jetlinks' ? requiredCheck(data) : aliCheck(data)
if(!check){ if(!check){
onlyMessage('操作成功!') onlyMessage('操作成功!')
formModel.import = JSON.stringify(data); formModel.import = json.target?.result;
} }
} else { } else {
onlyMessage('文件内容不能为空', 'error') onlyMessage('文件内容不能为空', 'error')
@ -587,7 +580,13 @@ const handleImport = async () => {
if (data.metadata === 'alink') { if (data.metadata === 'alink') {
try { try {
const _import = JSON.parse(data.import); const _import = JSON.parse(data.import);
Object.keys(_import).forEach((i:any)=>{
const map = new Map()
_import[i].forEach((item:any)=>(
map.set(item.id,item)
))
_import[i] = [...map.values()]
})
loading.value = true; loading.value = true;
const res = await convertMetadata( const res = await convertMetadata(
'from', 'from',
@ -638,7 +637,15 @@ const handleImport = async () => {
data[data?.type === 'copy' ? 'copy' : 'import'] || data[data?.type === 'copy' ? 'copy' : 'import'] ||
'{}', '{}',
); );
if(data?.type === 'import'){
Object.keys(_object).forEach((i:any)=>{
const map = new Map()
_object[i].forEach((item:any)=>(
map.set(item.id,item)
))
_object[i] = [...map.values()]
})
}
if ( if (
!( !(
!!_object?.properties || !!_object?.properties ||
@ -717,4 +724,4 @@ const handleImport = async () => {
line-height: 30px; line-height: 30px;
margin: 0 -11px; margin: 0 -11px;
} }
</style> </style>

View File

@ -30,17 +30,15 @@
</div> </div>
</div> </div>
<div class="media-live"> <div class="media-live">
<div class="media-live-video"> <div class="media-live-video" @mouseenter="visibleChange" @mouseleave="mouseleave">
<div <div
:class="mediaToolClass" :class="mediaToolClass"
@mouseleave="mouseleave"
@mouseenter="showTool = true" @mouseenter="showTool = true"
> >
<div class="tool-item" v-if="type !== 'share'"> <div class="tool-item" v-if="type !== 'share'">
<template v-if="isRecord === 0"> <template v-if="isRecord === 0">
<j-dropdown <j-dropdown
trigger="click" trigger="click"
@visibleChange="visibleChange"
@click="showToolLock = true" @click="showToolLock = true"
> >
<div>开始录像</div> <div>开始录像</div>
@ -212,8 +210,8 @@ const mouseleave = () => {
} }
}; };
const visibleChange = (v: boolean) => { const visibleChange = () => {
showTool.value = v; showTool.value = true;
}; };
const getPopupContainer = (trigger: HTMLElement) => { const getPopupContainer = (trigger: HTMLElement) => {

View File

@ -7,6 +7,8 @@ import { LocalStore } from '@/utils/comm';
import { TOKEN_KEY } from '@/utils/variable'; import { TOKEN_KEY } from '@/utils/variable';
import ShareLive from '../Live/shareLive.vue'; import ShareLive from '../Live/shareLive.vue';
import { useSystem } from '@/store/system';
const system = useSystem();
const playData = ref({ const playData = ref({
deviceId: '', deviceId: '',
channelId: '', channelId: '',
@ -18,6 +20,7 @@ const playData = ref({
const route = useRoute(); const route = useRoute();
watchEffect(() => { watchEffect(() => {
system.getSystemConfig()
const obj: any = unref(route.query) || {}; const obj: any = unref(route.query) || {};
playData.value = { playData.value = {
deviceId: obj?.deviceId || '', deviceId: obj?.deviceId || '',
@ -29,4 +32,4 @@ watchEffect(() => {
LocalStore.set(TOKEN_KEY, obj?.[TOKEN_KEY]); LocalStore.set(TOKEN_KEY, obj?.[TOKEN_KEY]);
} }
}); });
</script> </script>

View File

@ -38,8 +38,6 @@
:height='450' :height='450'
:virtual='true' :virtual='true'
@select='treeSelect' @select='treeSelect'
:showLine="{ showLeafIcon: false }"
:show-icon="true"
> >
<template #title="{ name, description }"> <template #title="{ name, description }">
<j-space> <j-space>
@ -164,4 +162,4 @@ watchEffect(() => {
<style scoped lang='less'> <style scoped lang='less'>
@import './index.less'; @import './index.less';
</style> </style>

View File

@ -55,8 +55,6 @@
:height='450' :height='450'
:virtual='true' :virtual='true'
@select='treeSelect' @select='treeSelect'
:showLine="{ showLeafIcon: false }"
:show-icon="true"
> >
<template #title="{ name, description }"> <template #title="{ name, description }">
<j-space> <j-space>
@ -198,4 +196,4 @@ watchEffect(() => {
display: none; display: none;
} }
} }
</style> </style>

View File

@ -21,8 +21,6 @@
:selectedKeys="selectedKeys" :selectedKeys="selectedKeys"
@drop="onDrop" @drop="onDrop"
@dragend="onDragend" @dragend="onDragend"
:showLine="{ showLeafIcon: false }"
:show-icon="true"
> >
<template #title="row"> <template #title="row">
<div class="tree-content"> <div class="tree-content">
@ -121,7 +119,7 @@ const params = {
let filterProtocolList: any[] = []; let filterProtocolList: any[] = [];
const getProvidersFn = async () => { const getProvidersFn = async () => {
if(!isNoCommunity){ if(!isNoCommunity){
return return
}else{ }else{
const res: any = await getProviders(); const res: any = await getProviders();
filterProtocolList = protocolList.filter((item) => { filterProtocolList = protocolList.filter((item) => {