fix: feat
This commit is contained in:
commit
899d88b3eb
|
@ -145,6 +145,9 @@ const extraRouteObj = {
|
|||
{ code: 'Save', name: '详情' },
|
||||
],
|
||||
},
|
||||
'edge/Device': {
|
||||
children: [{ code: 'Remote', name: '远程控制' }],
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -84,7 +84,8 @@ watch(
|
|||
column: 'accessProvider',
|
||||
value: props?.type
|
||||
}
|
||||
]
|
||||
],
|
||||
sorts: [{ name: 'createTime', order: 'desc' }]
|
||||
}).then((resp) => {
|
||||
if (resp.status === 200) {
|
||||
productList.value = resp.result as Record<string, any>[];
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
<template>
|
||||
<page-container>
|
||||
<div class="box">
|
||||
<iframe :src="url" class="box-iframe"></iframe>
|
||||
</div>
|
||||
</page-container>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { _control, _stopControl } from '@/api/edge/device';
|
||||
|
||||
const url = ref<string>('');
|
||||
const deviceId = ref<string>('');
|
||||
|
||||
watch(
|
||||
() => history.state?.params?.id,
|
||||
(newId) => {
|
||||
if (newId) {
|
||||
deviceId.value = newId as string;
|
||||
_control(newId).then((resp: any) => {
|
||||
if (resp.status === 200) {
|
||||
const item = `http://${resp.result?.url}/#/login?token=${resp.result.token}`;
|
||||
url.value = item;
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
onUnmounted(() => {
|
||||
if (deviceId.value) {
|
||||
_stopControl(unref(deviceId));
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.box {
|
||||
width: 100%;
|
||||
height: 85vh;
|
||||
background-color: #fff;
|
||||
}
|
||||
.box-iframe {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border: none;
|
||||
}
|
||||
</style>
|
|
@ -149,6 +149,7 @@
|
|||
:channel="'official-edge-gateway'"
|
||||
@close="onClose"
|
||||
:deviceType="'gateway'"
|
||||
@save="onSave"
|
||||
/>
|
||||
</template>
|
||||
|
||||
|
@ -235,6 +236,10 @@ const onClose = () => {
|
|||
visible.value = false;
|
||||
};
|
||||
|
||||
const onSave = (_data: any) => {
|
||||
productList.value.push(_data)
|
||||
}
|
||||
|
||||
const handleSave = () => {
|
||||
formRef.value
|
||||
.validate()
|
||||
|
|
|
@ -328,7 +328,7 @@ const getActions = (
|
|||
},
|
||||
icon: 'ControlOutlined',
|
||||
onClick: () => {
|
||||
message.error('暂未开发');
|
||||
menuStory.jumpPage('edge/Device/Remote', { id: data.id });
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
|
@ -20,33 +20,35 @@
|
|||
placeholder="请输入名称"
|
||||
/>
|
||||
</j-form-item>
|
||||
<template v-for="(item, index) in extendFormItem" :key="index">
|
||||
<j-form-item
|
||||
:name="item.name"
|
||||
:label="item.label"
|
||||
:rules="{
|
||||
required: item.required,
|
||||
message: item.message,
|
||||
trigger: 'change',
|
||||
}"
|
||||
>
|
||||
<j-select
|
||||
v-if="item.type === 'enum'"
|
||||
v-model:value="formData[item.name[0]][item.name[1]]"
|
||||
:options="item.options"
|
||||
:placeholder="item.message"
|
||||
/>
|
||||
<j-input-password
|
||||
v-else-if="item.type === 'password'"
|
||||
v-model:value="formData[item.name[0]][item.name[1]]"
|
||||
:placeholder="item.message"
|
||||
/>
|
||||
<j-input
|
||||
v-else
|
||||
v-model:value="formData[item.name[0]][item.name[1]]"
|
||||
:placeholder="item.message"
|
||||
/>
|
||||
</j-form-item>
|
||||
<template v-if="deviceType !== 'gateway'">
|
||||
<template v-for="(item, index) in extendFormItem" :key="index">
|
||||
<j-form-item
|
||||
:name="item.name"
|
||||
:label="item.label"
|
||||
:rules="{
|
||||
required: item.required,
|
||||
message: item.message,
|
||||
trigger: 'change',
|
||||
}"
|
||||
>
|
||||
<j-select
|
||||
v-if="item.type === 'enum'"
|
||||
v-model:value="formData[item.name[0]][item.name[1]]"
|
||||
:options="item.options"
|
||||
:placeholder="item.message"
|
||||
/>
|
||||
<j-input-password
|
||||
v-else-if="item.type === 'password'"
|
||||
v-model:value="formData[item.name[0]][item.name[1]]"
|
||||
:placeholder="item.message"
|
||||
/>
|
||||
<j-input
|
||||
v-else
|
||||
v-model:value="formData[item.name[0]][item.name[1]]"
|
||||
:placeholder="item.message"
|
||||
/>
|
||||
</j-form-item>
|
||||
</template>
|
||||
</template>
|
||||
<j-form-item
|
||||
label="接入网关"
|
||||
|
@ -147,7 +149,7 @@ type Emits = {
|
|||
(e: 'update:visible', data: boolean): void;
|
||||
(e: 'update:productId', data: string): void;
|
||||
(e: 'close'): void;
|
||||
(e: 'save', ): void;
|
||||
(e: 'save', data: Record<string, any>): void;
|
||||
};
|
||||
const emit = defineEmits<Emits>();
|
||||
|
||||
|
@ -155,7 +157,7 @@ const props = defineProps({
|
|||
visible: { type: Boolean, default: false },
|
||||
productId: { type: String, default: '' },
|
||||
channel: { type: String, default: '' },
|
||||
deviceType: { type: String, default: 'device' }
|
||||
deviceType: { type: String, default: 'device' },
|
||||
});
|
||||
|
||||
const _vis = computed({
|
||||
|
@ -258,6 +260,7 @@ const handleOk = () => {
|
|||
res.result.id,
|
||||
);
|
||||
if (deployResp.success) {
|
||||
emit('save', {...res.result})
|
||||
message.success('操作成功');
|
||||
handleCancel();
|
||||
}
|
||||
|
|
|
@ -147,6 +147,19 @@
|
|||
</template>
|
||||
</CardBox>
|
||||
</template>
|
||||
<template #type="slotProps">
|
||||
<span> {{ getMethodTxt(slotProps.type) }}</span>
|
||||
</template>
|
||||
<template #provider="slotProps">
|
||||
<span>
|
||||
{{ getProviderTxt(slotProps.type, slotProps.provider) }}
|
||||
</span>
|
||||
</template>
|
||||
<template #description="slotProps">
|
||||
<Ellipsis>
|
||||
{{ slotProps.description }}
|
||||
</Ellipsis>
|
||||
</template>
|
||||
<template #action="slotProps">
|
||||
<j-space :size="16">
|
||||
<template
|
||||
|
@ -205,6 +218,7 @@ const columns = [
|
|||
title: '配置名称',
|
||||
dataIndex: 'name',
|
||||
key: 'name',
|
||||
width: 100,
|
||||
search: {
|
||||
type: 'string',
|
||||
},
|
||||
|
@ -214,6 +228,7 @@ const columns = [
|
|||
dataIndex: 'type',
|
||||
key: 'type',
|
||||
scopedSlots: true,
|
||||
width: 100,
|
||||
search: {
|
||||
type: 'select',
|
||||
options: NOTICE_METHOD,
|
||||
|
@ -227,6 +242,7 @@ const columns = [
|
|||
dataIndex: 'provider',
|
||||
key: 'provider',
|
||||
scopedSlots: true,
|
||||
width: 200,
|
||||
search: {
|
||||
type: 'select',
|
||||
options: providerList,
|
||||
|
@ -239,6 +255,7 @@ const columns = [
|
|||
title: '说明',
|
||||
dataIndex: 'description',
|
||||
key: 'description',
|
||||
scopedSlots: true,
|
||||
search: {
|
||||
type: 'string',
|
||||
},
|
||||
|
@ -272,6 +289,14 @@ const getLogo = (type: string, provider: string) => {
|
|||
const getMethodTxt = (type: string) => {
|
||||
return NOTICE_METHOD.find((f) => f.value === type)?.label;
|
||||
};
|
||||
/**
|
||||
* 根据类型展示对应文案
|
||||
* @param type
|
||||
* @param provider
|
||||
*/
|
||||
const getProviderTxt = (type: string, provider: string) => {
|
||||
return MSG_TYPE[type].find((f: any) => f.value === provider)?.label;
|
||||
};
|
||||
|
||||
/**
|
||||
* 新增
|
||||
|
|
|
@ -110,14 +110,19 @@
|
|||
</template>
|
||||
</CardBox>
|
||||
</template>
|
||||
<template #bodyCell="{ column, text, record }">
|
||||
<span v-if="column.dataIndex === 'type'">
|
||||
{{ getMethodTxt(record.type) }}
|
||||
</span>
|
||||
<span v-if="column.dataIndex === 'provider'">
|
||||
{{ getProviderTxt(record.type, record.provider) }}
|
||||
<template #type="slotProps">
|
||||
<span> {{ getMethodTxt(slotProps.type) }}</span>
|
||||
</template>
|
||||
<template #provider="slotProps">
|
||||
<span>
|
||||
{{ getProviderTxt(slotProps.type, slotProps.provider) }}
|
||||
</span>
|
||||
</template>
|
||||
<template #description="slotProps">
|
||||
<Ellipsis>
|
||||
{{ slotProps.description }}
|
||||
</Ellipsis>
|
||||
</template>
|
||||
<template #action="slotProps">
|
||||
<j-space :size="16">
|
||||
<template
|
||||
|
@ -210,6 +215,7 @@ const columns = [
|
|||
title: '说明',
|
||||
dataIndex: 'description',
|
||||
key: 'description',
|
||||
scopedSlots: true,
|
||||
search: {
|
||||
type: 'string',
|
||||
},
|
||||
|
|
|
@ -82,7 +82,7 @@ export const MSG_TYPE = {
|
|||
],
|
||||
email: [
|
||||
{
|
||||
label: 'email',
|
||||
label: '邮件',
|
||||
value: 'embedded',
|
||||
logo: getImage('/notice/email.png'),
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue