fix: bug#10726 10718

This commit is contained in:
leiqiaochu 2023-03-22 14:43:41 +08:00
parent 0aac4de410
commit 47c3d7533e
3 changed files with 64 additions and 14 deletions

View File

@ -399,6 +399,7 @@ import { marked } from 'marked';
import type { TableColumnType } from 'ant-design-vue';
import { useMenuStore } from '@/store/menu';
import _ from 'lodash';
const tableRef = ref();
const formRef = ref();
const menuStore = useMenuStore();
const permissionStore = usePermissionStore();
@ -959,7 +960,11 @@ const getData = async (accessId?: string) => {
if (metadata.value?.properties) {
metadata.value?.properties.forEach((item) => {
if (
item.name === '流传输模式' && (!productStore.current?.configuration || !productStore.current?.configuration.hasOwnProperty(item.name))
item.name === '流传输模式' &&
(!productStore.current?.configuration ||
!productStore.current?.configuration.hasOwnProperty(
item.name,
))
) {
formData.data[item.name] =
item.type.expands?.defaultValue;
@ -1046,7 +1051,14 @@ const getDetailInfo = () => {};
const add = () => {
const url = menuStore.hasMenu('link/AccessConfig/Detail');
if (url) {
window.open(`${origin}/#${url}`);
const tab: any = window.open(`${origin}/#${url}?view=false`);
tab.onTabSaveSuccess = (value: any) => {
console.log(value);
if (value.status === 200) {
tableRef.value.reload();
handleClick(value.result)
}
};
}
};
/**

View File

@ -50,9 +50,7 @@
</div>
<div style="padding-top: 10px">
<j-descriptions size="small" :column="4">
<j-descriptions-item
label="设备数量"
style="cursor: pointer"
<j-descriptions-item label="设备数量"
><span @click="jumpDevice">{{
productStore.current?.count
? productStore.current?.count
@ -116,8 +114,8 @@ import { message } from 'jetlinks-ui-components';
import { getImage } from '@/utils/comm';
import encodeQuery from '@/utils/encodeQuery';
import { useMenuStore } from '@/store/menu';
const menuStory = useMenuStore();
const menuStory = useMenuStore();
const route = useRoute();
const checked = ref<boolean>(true);
const productStore = useProductStore();
@ -141,7 +139,7 @@ const list = ref([
{
key: 'Metadata',
tab: '物模型',
class:'objectModel'
class: 'objectModel',
},
{
key: 'Device',
@ -163,12 +161,16 @@ watch(
productStore.reSet();
productStore.tabActiveKey = 'Info';
productStore.refresh(newId as string);
console.log(productStore);
}
},
{ immediate: true, deep: true },
);
watch(
() => productStore.current,
() => {
getProtocol();
},
);
const onBack = () => {};
const onTabChange = (e: string) => {
@ -228,10 +230,40 @@ const getProtocol = async () => {
(item: any) => item.id === 'transparentCodec',
);
if (paring) {
list.value.push({
key: 'DataAnalysis',
tab: '数据解析',
});
list.value = [
{
key: 'Info',
tab: '配置信息',
},
{
key: 'Metadata',
tab: '物模型',
class: 'objectModel',
},
{
key: 'Device',
tab: '设备接入',
},
{
key: 'DataAnalysis',
tab: '数据解析',
},
];
}else{
list.value = [
{
key: 'Info',
tab: '配置信息',
},
{
key: 'Metadata',
tab: '物模型',
class: 'objectModel',
},
{
key: 'Device',
tab: '设备接入',
},]
}
}
}
@ -256,7 +288,6 @@ const jumpDevice = () => {
);
};
onMounted(() => {
getProtocol();
if (history.state?.params?.tab) {
productStore.tabActiveKey = history.state?.params?.tab;
}

View File

@ -500,6 +500,13 @@ const saveData = () => {
if (resp.status === 200) {
onlyMessage('操作成功', 'success');
history.back();
if ((window as any).onTabSaveSuccess) {
console.log(123);
if (resp.result?.id) {
(window as any).onTabSaveSuccess(resp);
setTimeout(() => window.close(), 300);
}
}
}
})
.catch((err) => {});