Merge branch 'dev' into dev-dictionary
This commit is contained in:
commit
2d80c4ad4e
|
@ -210,6 +210,7 @@ import PatchMapping from './PatchMapping.vue';
|
||||||
import { onlyMessage } from '@/utils/comm';
|
import { onlyMessage } from '@/utils/comm';
|
||||||
import { cloneDeep } from 'lodash-es';
|
import { cloneDeep } from 'lodash-es';
|
||||||
import { usePermissionStore } from '@/store/permission';
|
import { usePermissionStore } from '@/store/permission';
|
||||||
|
import { dataTool } from 'echarts';
|
||||||
const columns = [
|
const columns = [
|
||||||
{
|
{
|
||||||
title: '名称',
|
title: '名称',
|
||||||
|
@ -250,6 +251,7 @@ const columns = [
|
||||||
|
|
||||||
const permissionStore = usePermissionStore();
|
const permissionStore = usePermissionStore();
|
||||||
|
|
||||||
|
const data:any = ref([])
|
||||||
const isPermission = permissionStore.hasPermission('device/Instance:update');
|
const isPermission = permissionStore.hasPermission('device/Instance:update');
|
||||||
|
|
||||||
const current = ref<number>(1);
|
const current = ref<number>(1);
|
||||||
|
@ -260,10 +262,11 @@ const metadata = JSON.parse(instanceStore.current?.metadata || '{}');
|
||||||
const loading = ref<boolean>(false);
|
const loading = ref<boolean>(false);
|
||||||
const channelList = ref<any[]>([]);
|
const channelList = ref<any[]>([]);
|
||||||
|
|
||||||
const _properties = computed(() => {
|
// const _properties = computed(() => {
|
||||||
const _cur = current.value >= 1 ? current.value : 1;
|
// const _cur = current.value >= 1 ? current.value : 1;
|
||||||
return metadata.properties?.slice((_cur - 1) * 10, _cur * 10) || [];
|
// const _pageSize = pageSize.value
|
||||||
});
|
// return metadata.properties?.slice((_cur - 1) * _pageSize, _cur * _pageSize) || [];
|
||||||
|
// });
|
||||||
|
|
||||||
const modelRef = reactive<{
|
const modelRef = reactive<{
|
||||||
dataSource: any[];
|
dataSource: any[];
|
||||||
|
@ -287,14 +290,21 @@ const getChannel = async () => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSearch = async (_array: any[]) => {
|
const handleSearch = async () => {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
const _metadata: any[] = _array.map((item: any) => ({
|
const _metadataMap = new Map ()
|
||||||
metadataId: item.id,
|
const _metadata: any[] = metadata.properties.map((item: any) => {
|
||||||
metadataName: `${item.name}(${item.id})`,
|
const value = {
|
||||||
metadataType: 'property',
|
metadataId: item.id,
|
||||||
name: item.name,
|
metadataName: `${item.name}(${item.id})`,
|
||||||
}));
|
metadataType: 'property',
|
||||||
|
name: item.name,
|
||||||
|
}
|
||||||
|
_metadataMap.set(item.id,value)
|
||||||
|
return value
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
if (_metadata && _metadata.length) {
|
if (_metadata && _metadata.length) {
|
||||||
const resp: any = await getEdgeMap(
|
const resp: any = await getEdgeMap(
|
||||||
instanceStore.current?.parentId || '',
|
instanceStore.current?.parentId || '',
|
||||||
|
@ -307,32 +317,25 @@ const handleSearch = async (_array: any[]) => {
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
});
|
});
|
||||||
if (resp.status === 200) {
|
if (resp.status === 200) {
|
||||||
const array = _metadata.map((item: any) => {
|
// const array = _metadata.map((item: any) => {
|
||||||
const metadataId = resp.result?.[0].find((x: any) => x.metadataId === item.metadataId);
|
// const metadataId = resp.result?.[0].find((x: any) => x.metadataId === item.metadataId);
|
||||||
Object.assign(item, metadataId);
|
// Object.assign(item, metadataId);
|
||||||
return item
|
// return item
|
||||||
})
|
// })
|
||||||
resp.result?.[0].forEach((item:any)=>{
|
// resp.result?.[0].forEach((item:any)=>{
|
||||||
const differ = array.every((i:any)=>{
|
// const differ = array.every((i:any)=>{
|
||||||
return item.metadataId !== i.metadataId
|
// return item.metadataId !== i.metadataId
|
||||||
})
|
// })
|
||||||
if(differ){
|
// if(differ){
|
||||||
array.push(item)
|
// array.push(item)
|
||||||
}
|
|
||||||
})
|
|
||||||
// const array = resp.result?.[0].reduce((x: any, y: any) => {
|
|
||||||
// const metadataId = _metadata.find(
|
|
||||||
// (item: any) => item.metadataId === y.metadataId,
|
|
||||||
// );
|
|
||||||
// if (metadataId) {
|
|
||||||
// Object.assign(metadataId, y);
|
|
||||||
// } else {
|
|
||||||
// x.push(y);
|
|
||||||
// }
|
// }
|
||||||
// return x;
|
// })
|
||||||
// }, _metadata);
|
|
||||||
console.log(array)
|
resp.result?.[0].forEach((item:any)=>{
|
||||||
modelRef.dataSource = array;
|
_metadataMap.has(item.metadataId) ? _metadataMap.set(item.metadataId,Object.assign(_metadataMap.get(item.metadataId),item)) : _metadataMap.set(item.metadataId,item)
|
||||||
|
})
|
||||||
|
data.value = [..._metadataMap.values()]
|
||||||
|
onPageChange()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
|
@ -350,7 +353,7 @@ const unbind = async (id: string) => {
|
||||||
);
|
);
|
||||||
if (resp.status === 200) {
|
if (resp.status === 200) {
|
||||||
onlyMessage('操作成功!', 'success');
|
onlyMessage('操作成功!', 'success');
|
||||||
handleSearch(_properties.value);
|
handleSearch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -371,11 +374,14 @@ const onChannelChange = (_index: number, type: 'collector' | 'channel') => {
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getChannel();
|
getChannel();
|
||||||
handleSearch(_properties.value);
|
handleSearch();
|
||||||
});
|
});
|
||||||
|
|
||||||
const onPageChange = () => {
|
const onPageChange = () => {
|
||||||
handleSearch(_properties.value);
|
const _cur = current.value >= 1 ? current.value : 1;
|
||||||
|
const _pageSize = pageSize.value
|
||||||
|
const array = data.value.slice((_cur - 1) * _pageSize, _cur * _pageSize) || [];
|
||||||
|
modelRef.dataSource = array;
|
||||||
};
|
};
|
||||||
|
|
||||||
const onSave = () => {
|
const onSave = () => {
|
||||||
|
|
|
@ -69,11 +69,11 @@
|
||||||
>
|
>
|
||||||
<span v-else-if="item.type.type === 'enum'">
|
<span v-else-if="item.type.type === 'enum'">
|
||||||
<Ellipsis>{{
|
<Ellipsis>{{
|
||||||
item.type.elements?.filter((i)=>
|
item.type.elements?.find((i)=>
|
||||||
i.value === instanceStore.current?.configuration?.[
|
i.value === instanceStore.current?.configuration?.[
|
||||||
item.property
|
item.property
|
||||||
]
|
]
|
||||||
)[0].text
|
)?.text || ''
|
||||||
}}</Ellipsis>
|
}}</Ellipsis>
|
||||||
<j-tooltip
|
<j-tooltip
|
||||||
v-if="isExit(item.property)"
|
v-if="isExit(item.property)"
|
||||||
|
@ -87,11 +87,8 @@
|
||||||
</span>
|
</span>
|
||||||
<span v-else>
|
<span v-else>
|
||||||
<Ellipsis>{{
|
<Ellipsis>{{
|
||||||
item.type.elements?.filter((i)=>
|
instanceStore.current?.configuration?.[item.property] ||
|
||||||
i.value === instanceStore.current?.configuration?.[
|
''
|
||||||
item.property
|
|
||||||
]
|
|
||||||
)[0].text
|
|
||||||
}}</Ellipsis>
|
}}</Ellipsis>
|
||||||
<j-tooltip
|
<j-tooltip
|
||||||
v-if="isExit(item.property)"
|
v-if="isExit(item.property)"
|
||||||
|
|
|
@ -399,11 +399,9 @@ const beforeUpload = (file: any) => {
|
||||||
onlyMessage('文件内容不能为空','error')
|
onlyMessage('文件内容不能为空','error')
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
const data = JSON.parse(text);
|
const data = JSON.parse(text);
|
||||||
// 设置导入的产品状态为未发布
|
// 设置导入的产品状态为未发布
|
||||||
data.state = 0;
|
data.state = 0;
|
||||||
|
|
||||||
if (Array.isArray(data)) {
|
if (Array.isArray(data)) {
|
||||||
onlyMessage('请上传正确格式文件', 'error');
|
onlyMessage('请上传正确格式文件', 'error');
|
||||||
return false;
|
return false;
|
||||||
|
@ -418,10 +416,6 @@ const beforeUpload = (file: any) => {
|
||||||
tableRef.value?.reload();
|
tableRef.value?.reload();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} catch(e) {
|
|
||||||
onlyMessage('请上传正确格式文件', 'error');
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
};
|
};
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="right-bj">
|
<div class="right-bj">
|
||||||
<img :src="`/images/home/home-${index + 1}.png`" alt="" />
|
<img :src="`/images/home/${index + 1}.png`" alt="" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -95,6 +95,7 @@
|
||||||
]"
|
]"
|
||||||
>
|
>
|
||||||
<j-input
|
<j-input
|
||||||
|
:disabled="record.old_id"
|
||||||
v-model:value="record.type"
|
v-model:value="record.type"
|
||||||
placeholder="请输入类型"
|
placeholder="请输入类型"
|
||||||
/>
|
/>
|
||||||
|
@ -510,7 +511,7 @@ const checkName = (_: any, value: any) =>
|
||||||
width:300px;
|
width:300px;
|
||||||
height:100%;
|
height:100%;
|
||||||
.tree{
|
.tree{
|
||||||
max-height: 680px;
|
height: 680px;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,8 +96,9 @@ export default defineConfig(({ mode}) => {
|
||||||
// target: 'http://192.168.32.244:8881',
|
// target: 'http://192.168.32.244:8881',
|
||||||
// target: 'http://192.168.32.163:8844', //张季本地
|
// target: 'http://192.168.32.163:8844', //张季本地
|
||||||
// target: 'http://120.77.179.54:8844', // 120测试
|
// target: 'http://120.77.179.54:8844', // 120测试
|
||||||
target: 'http://192.168.33.46:8844', // 本地开发环境
|
// target: 'http://192.168.33.46:8844', // 本地开发环境
|
||||||
// target: 'http://192.168.32.5:8848', // 刘本地
|
// target: 'http://192.168.32.5:8848', // 刘本地
|
||||||
|
target: 'http://192.168.32.187:8844', // 刘本地
|
||||||
ws: 'ws://192.168.33.46:8844',
|
ws: 'ws://192.168.33.46:8844',
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
rewrite: (path) => path.replace(/^\/api/, '')
|
rewrite: (path) => path.replace(/^\/api/, '')
|
||||||
|
|
Loading…
Reference in New Issue