Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
09d77f4b07
|
@ -29,7 +29,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="editor">
|
<div class="editor">
|
||||||
<j-monaco-editor v-if="loading" v-model:model-value="_value" theme="vs" ref="editor" language="javascript" :registrationTypescript="typescriptTip"
|
<j-monaco-editor v-if="loading" v-model:model-value="_value" theme="vs" ref="editor" language="javascript" :registrationTypescript="typescriptTip" :registrationTips="registrationTips"
|
||||||
:init="editorInit"/>
|
:init="editorInit"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -41,11 +41,13 @@ import {
|
||||||
} from '@/api/device/instance';
|
} from '@/api/device/instance';
|
||||||
import { useInstanceStore } from '@/store/instance';
|
import { useInstanceStore } from '@/store/instance';
|
||||||
import { useProductStore } from '@/store/product';
|
import { useProductStore } from '@/store/product';
|
||||||
|
import { cloneDeep } from 'lodash-es';
|
||||||
import { inject } from 'vue'
|
import { inject } from 'vue'
|
||||||
interface Props {
|
interface Props {
|
||||||
mode?: 'advance' | 'simple';
|
mode?: 'advance' | 'simple';
|
||||||
id?: string;
|
id?: string;
|
||||||
value?: string;
|
value?: string;
|
||||||
|
tips?: Array<any>
|
||||||
}
|
}
|
||||||
const props = defineProps<Props>()
|
const props = defineProps<Props>()
|
||||||
const target = inject('target')
|
const target = inject('target')
|
||||||
|
@ -71,28 +73,9 @@ type SymbolType = {
|
||||||
const typescriptTip = reactive({
|
const typescriptTip = reactive({
|
||||||
typescript: ''
|
typescript: ''
|
||||||
})
|
})
|
||||||
|
const registrationTips = ref<any>({
|
||||||
const queryCode = () => {
|
name: 'javascript'
|
||||||
let id = ''
|
})
|
||||||
if(target==='device'){
|
|
||||||
id = instanceStore.current.id
|
|
||||||
queryTypescript(id).then(res => {
|
|
||||||
if (res.status===200) {
|
|
||||||
typescriptTip.typescript = res.result
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}else if(target ==='product'){
|
|
||||||
id = productStore.current.id
|
|
||||||
queryProductTs(id).then(res => {
|
|
||||||
if (res.status===200) {
|
|
||||||
typescriptTip.typescript = res.result
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
queryCode()
|
|
||||||
|
|
||||||
const editorInit = (editor: any, monaco: any) => {
|
const editorInit = (editor: any, monaco: any) => {
|
||||||
monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
|
monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
|
||||||
noSemanticValidation: true,
|
noSemanticValidation: true,
|
||||||
|
@ -200,11 +183,27 @@ const _value = computed({
|
||||||
})
|
})
|
||||||
|
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
onMounted(() => {
|
const queryCode = () => {
|
||||||
setTimeout(() => {
|
registrationTips.value.suggestions = cloneDeep(props.tips)
|
||||||
loading.value = true;
|
let id = ''
|
||||||
}, 100);
|
if(target==='device'){
|
||||||
})
|
id = instanceStore.current.id
|
||||||
|
queryTypescript(id).then(res => {
|
||||||
|
if (res.status===200) {
|
||||||
|
typescriptTip.typescript = res.result
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}else if(target ==='product'){
|
||||||
|
id = productStore.current.id
|
||||||
|
queryProductTs(id).then(res => {
|
||||||
|
if (res.status===200) {
|
||||||
|
typescriptTip.typescript = res.result
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const addOperatorValue = (val: string) => {
|
const addOperatorValue = (val: string) => {
|
||||||
editor.value?.insert(val)
|
editor.value?.insert(val)
|
||||||
|
@ -220,6 +219,13 @@ defineExpose({
|
||||||
addOperatorValue
|
addOperatorValue
|
||||||
})
|
})
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
setTimeout(() => {
|
||||||
|
loading.value = true;
|
||||||
|
}, 100);
|
||||||
|
})
|
||||||
|
|
||||||
|
queryCode()
|
||||||
</script>
|
</script>
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
.editor-box {
|
.editor-box {
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
mode="advance"
|
mode="advance"
|
||||||
key="advance"
|
key="advance"
|
||||||
v-model:value="_value"
|
v-model:value="_value"
|
||||||
|
:tips="tips"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -59,7 +60,8 @@ import Editor from './Editor/index.vue';
|
||||||
import Debug from './Debug/index.vue';
|
import Debug from './Debug/index.vue';
|
||||||
import Operator from './Operator/index.vue';
|
import Operator from './Operator/index.vue';
|
||||||
import { FULL_CODE } from 'jetlinks-ui-components/es/DataTable'
|
import { FULL_CODE } from 'jetlinks-ui-components/es/DataTable'
|
||||||
|
import { cloneDeep } from 'lodash-es';
|
||||||
|
import { PropertyMetadata } from '@/views/device/Product/typings';
|
||||||
interface Emits {
|
interface Emits {
|
||||||
(e: 'save', data: string | undefined): void;
|
(e: 'save', data: string | undefined): void;
|
||||||
(e: 'close'): void;
|
(e: 'close'): void;
|
||||||
|
@ -77,7 +79,7 @@ const props = defineProps({
|
||||||
const _value = ref<string | undefined>(props.value);
|
const _value = ref<string | undefined>(props.value);
|
||||||
const _disabled = ref<boolean>(true);
|
const _disabled = ref<boolean>(true);
|
||||||
const fullRef = inject(FULL_CODE);
|
const fullRef = inject(FULL_CODE);
|
||||||
|
const tips = ref<any[]>([])
|
||||||
const handleCancel = () => {
|
const handleCancel = () => {
|
||||||
emit('close');
|
emit('close');
|
||||||
};
|
};
|
||||||
|
@ -98,6 +100,29 @@ const addOperatorValue = (val: string) => {
|
||||||
editor.value.addOperatorValue(val);
|
editor.value.addOperatorValue(val);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getAllCrud = () => {
|
||||||
|
const list = cloneDeep(props.propertiesOptions)?.filter((i:any)=>
|
||||||
|
props?.id !== i.id
|
||||||
|
)
|
||||||
|
console.log(list,'list')
|
||||||
|
// 转化为语法提示
|
||||||
|
list.forEach(item => {
|
||||||
|
console.log(item)
|
||||||
|
const config = item
|
||||||
|
tips.value.push({
|
||||||
|
label: `${config.name}$recent实时值`,
|
||||||
|
insertText:`$recent ("${config.id}")`,
|
||||||
|
kind: 18,
|
||||||
|
})
|
||||||
|
tips.value.push({
|
||||||
|
label: `${config.name}上一值`,
|
||||||
|
insertText: `$lastState("${config.id}"))`,
|
||||||
|
kind: 18
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
watch(() => _value.value, () => {
|
watch(() => _value.value, () => {
|
||||||
_disabled.value = true
|
_disabled.value = true
|
||||||
})
|
})
|
||||||
|
@ -105,6 +130,7 @@ watch(() => _value.value, () => {
|
||||||
const onSuccess = (bool: boolean) => {
|
const onSuccess = (bool: boolean) => {
|
||||||
_disabled.value = bool;
|
_disabled.value = bool;
|
||||||
}
|
}
|
||||||
|
getAllCrud()
|
||||||
</script>
|
</script>
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
.header {
|
.header {
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
></j-col>
|
></j-col>
|
||||||
<j-col :span="6"
|
<j-col :span="6"
|
||||||
><TopCard
|
><TopCard
|
||||||
title="今日设备信息量"
|
title="今日设备消息量"
|
||||||
:footer="messageFooter"
|
:footer="messageFooter"
|
||||||
:value="dayMessage"
|
:value="dayMessage"
|
||||||
>
|
>
|
||||||
|
|
|
@ -1,106 +1,60 @@
|
||||||
<template>
|
<template>
|
||||||
<SaveChild
|
<SaveChild v-if="childVisible" @close-child-save="closeChildSave" :childData="_current" />
|
||||||
v-if="childVisible"
|
|
||||||
@close-child-save="closeChildSave"
|
|
||||||
:childData="_current"
|
|
||||||
/>
|
|
||||||
<div v-else>
|
<div v-else>
|
||||||
<pro-search
|
<pro-search :columns="columns" target="child-device" @search="handleSearch" class="device-child-device-search" />
|
||||||
:columns="columns"
|
|
||||||
target="child-device"
|
|
||||||
@search="handleSearch"
|
|
||||||
class="device-child-device-search"
|
|
||||||
/>
|
|
||||||
<!-- <j-divider /> -->
|
<!-- <j-divider /> -->
|
||||||
<JProTable
|
<JProTable ref="childDeviceRef" :columns="columns" :request="query" :bodyStyle="{
|
||||||
ref="childDeviceRef"
|
padding: 0
|
||||||
:columns="columns"
|
}" :defaultParams="{
|
||||||
:request="query"
|
terms: [
|
||||||
:bodyStyle="{
|
{
|
||||||
padding: 0
|
column: 'parentId',
|
||||||
}"
|
value: detail?.id || '',
|
||||||
:defaultParams="{
|
termType: 'eq',
|
||||||
terms: [
|
},
|
||||||
{
|
],
|
||||||
column: 'parentId',
|
}" :rowSelection="{
|
||||||
value: detail?.id || '',
|
selectedRowKeys: _selectedRowKeys,
|
||||||
termType: 'eq',
|
onChange: onSelectChange,
|
||||||
},
|
}" :params="params" :model="'TABLE'">
|
||||||
],
|
|
||||||
}"
|
|
||||||
:rowSelection="{
|
|
||||||
selectedRowKeys: _selectedRowKeys,
|
|
||||||
onChange: onSelectChange,
|
|
||||||
}"
|
|
||||||
:params="params"
|
|
||||||
:model="'TABLE'"
|
|
||||||
>
|
|
||||||
<template #rightExtraRender>
|
<template #rightExtraRender>
|
||||||
<j-space>
|
<j-space>
|
||||||
<PermissionButton
|
<PermissionButton type="primary" v-if="detail?.accessProvider === 'official-edge-gateway'
|
||||||
type="primary"
|
" hasPermission="device/Instance:update" @click="
|
||||||
v-if="
|
_current = {};
|
||||||
detail?.accessProvider === 'official-edge-gateway'
|
childVisible = true;
|
||||||
"
|
">新增并绑定</PermissionButton>
|
||||||
hasPermission="device/Instance:update"
|
<PermissionButton type="primary" @click="visible = true" hasPermission="device/Instance:update">
|
||||||
@click="
|
绑定</PermissionButton>
|
||||||
_current = {};
|
<PermissionButton type="primary" hasPermission="device/Instance:update" :popConfirm="{
|
||||||
childVisible = true;
|
title: '确定解绑吗?',
|
||||||
"
|
onConfirm: handleUnBind,
|
||||||
>新增并绑定</PermissionButton
|
}">批量解除</PermissionButton>
|
||||||
>
|
|
||||||
<PermissionButton
|
|
||||||
type="primary"
|
|
||||||
@click="visible = true"
|
|
||||||
hasPermission="device/Instance:update"
|
|
||||||
>
|
|
||||||
绑定</PermissionButton
|
|
||||||
>
|
|
||||||
<PermissionButton
|
|
||||||
type="primary"
|
|
||||||
hasPermission="device/Instance:update"
|
|
||||||
:popConfirm="{
|
|
||||||
title: '确定解绑吗?',
|
|
||||||
onConfirm: handleUnBind,
|
|
||||||
}"
|
|
||||||
>批量解除</PermissionButton
|
|
||||||
>
|
|
||||||
</j-space>
|
</j-space>
|
||||||
</template>
|
</template>
|
||||||
<template #registryTime="slotProps">
|
<template #registryTime="slotProps">
|
||||||
{{
|
{{
|
||||||
slotProps.registryTime
|
slotProps.registryTime
|
||||||
? moment(slotProps.registryTime).format(
|
? moment(slotProps.registryTime).format(
|
||||||
'YYYY-MM-DD HH:mm:ss',
|
'YYYY-MM-DD HH:mm:ss',
|
||||||
)
|
)
|
||||||
: ''
|
: ''
|
||||||
}}
|
}}
|
||||||
</template>
|
</template>
|
||||||
<template #state="slotProps">
|
<template #state="slotProps">
|
||||||
<j-badge
|
<j-badge :text="slotProps.state.text" :status="statusMap.get(slotProps.state.value)" />
|
||||||
:text="slotProps.state.text"
|
|
||||||
:status="statusMap.get(slotProps.state.value)"
|
|
||||||
/>
|
|
||||||
</template>
|
</template>
|
||||||
<template #action="slotProps">
|
<template #action="slotProps">
|
||||||
<j-space :size="16">
|
<j-space :size="16">
|
||||||
<template
|
<template v-for="i in getActions(slotProps, 'table')" :key="i.key">
|
||||||
v-for="i in getActions(slotProps, 'table')"
|
<PermissionButton v-if="i.key !== 'update' || detail.accessProvider === 'official-edge-gateway'"
|
||||||
:key="i.key"
|
:disabled="i.disabled" :popConfirm="i.popConfirm" :tooltip="{
|
||||||
>
|
|
||||||
<PermissionButton
|
|
||||||
v-if="i.key !== 'update' || detail.accessProvider === 'official-edge-gateway'"
|
|
||||||
:disabled="i.disabled"
|
|
||||||
:popConfirm="i.popConfirm"
|
|
||||||
:tooltip="{
|
|
||||||
...i.tooltip,
|
...i.tooltip,
|
||||||
}"
|
}" @click="i.onClick" type="link" style="padding: 0px"
|
||||||
@click="i.onClick"
|
:hasPermission="'device/Instance:' + i.key">
|
||||||
type="link"
|
<template #icon>
|
||||||
style="padding: 0px"
|
<AIcon :type="i.icon" />
|
||||||
:hasPermission="'device/Instance:' + i.key"
|
</template>
|
||||||
>
|
|
||||||
<template #icon><AIcon :type="i.icon" /></template>
|
|
||||||
</PermissionButton>
|
</PermissionButton>
|
||||||
</template>
|
</template>
|
||||||
</j-space>
|
</j-space>
|
||||||
|
@ -113,7 +67,7 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import type { ActionsType } from '@/components/Table';
|
import type { ActionsType } from '@/components/Table';
|
||||||
import {query, unbindDevice, unbindBatchDevice, queryByParent , deleteDeviceMapping} from '@/api/device/instance';
|
import { query, unbindDevice, unbindBatchDevice, queryByParent, deleteDeviceMapping } from '@/api/device/instance';
|
||||||
import { useInstanceStore } from '@/store/instance';
|
import { useInstanceStore } from '@/store/instance';
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
import BindChildDevice from './BindChildDevice/index.vue';
|
import BindChildDevice from './BindChildDevice/index.vue';
|
||||||
|
@ -241,10 +195,12 @@ const getActions = (data: Partial<Record<string, any>>): ActionsType[] => {
|
||||||
data.id,
|
data.id,
|
||||||
{},
|
{},
|
||||||
);
|
);
|
||||||
const res = await deleteDeviceMapping(
|
if (instanceStore.current.accessProvider === 'official-edge-gateway') {
|
||||||
detail.value.id,
|
const res = await deleteDeviceMapping(
|
||||||
{ids:[data.id]}
|
detail.value.id,
|
||||||
)
|
{ ids: [data.id] }
|
||||||
|
)
|
||||||
|
}
|
||||||
if (resp.status === 200) {
|
if (resp.status === 200) {
|
||||||
childDeviceRef.value?.reload();
|
childDeviceRef.value?.reload();
|
||||||
onlyMessage('操作成功!');
|
onlyMessage('操作成功!');
|
||||||
|
@ -285,11 +241,13 @@ const handleUnBind = async () => {
|
||||||
detail.value.id,
|
detail.value.id,
|
||||||
_selectedRowKeys.value,
|
_selectedRowKeys.value,
|
||||||
);
|
);
|
||||||
if (resp.status === 200) {
|
if (instanceStore.current.accessProvider === 'official-edge-gateway') {
|
||||||
const res = await deleteDeviceMapping(
|
const res = await deleteDeviceMapping(
|
||||||
detail.value.id,
|
detail.value.id,
|
||||||
{ids:[_selectedRowKeys.value]}
|
{ ids: [_selectedRowKeys.value] }
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
if (resp.status === 200) {
|
||||||
onlyMessage('操作成功!');
|
onlyMessage('操作成功!');
|
||||||
cancelSelect();
|
cancelSelect();
|
||||||
childDeviceRef.value?.reload();
|
childDeviceRef.value?.reload();
|
||||||
|
@ -316,7 +274,7 @@ const closeBindDevice = (val: boolean) => {
|
||||||
const closeChildSave = () => {
|
const closeChildSave = () => {
|
||||||
childVisible.value = false;
|
childVisible.value = false;
|
||||||
};
|
};
|
||||||
onMounted(()=>{
|
onMounted(() => {
|
||||||
console.log(detail.value.accessProvider)
|
console.log(detail.value.accessProvider)
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -313,8 +313,9 @@ const submitData = () => {
|
||||||
if (form.id === '') {
|
if (form.id === '') {
|
||||||
form.id = undefined;
|
form.id = undefined;
|
||||||
}
|
}
|
||||||
const res = await addProduct(form);
|
const res = await addProduct(form).finally(()=>{
|
||||||
loading.value = false
|
loading.value = false
|
||||||
|
});
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
onlyMessage('保存成功!');
|
onlyMessage('保存成功!');
|
||||||
visible.value = false;
|
visible.value = false;
|
||||||
|
|
|
@ -5,12 +5,12 @@ const Webhook = () => {
|
||||||
<div class={'doc'}>
|
<div class={'doc'}>
|
||||||
<h1>1. 概述</h1>
|
<h1>1. 概述</h1>
|
||||||
<div>
|
<div>
|
||||||
webhook是一个接收HTTP请求的URL(本平台默认只支持HTTP
|
WebHook是一个接收HTTP请求的URL(本平台默认只支持HTTP
|
||||||
POST请求),实现了Webhook的第三方系统可以基于该URL订阅本平台系统信息,本平台按配置把特定的事件结果推送到指定的地址,便于系统做后续处理。
|
POST请求),实现了WebHook的第三方系统可以基于该URL订阅本平台系统信息,本平台按配置把特定的事件结果推送到指定的地址,便于系统做后续处理。
|
||||||
</div>
|
</div>
|
||||||
<h1>2.通知配置说明</h1>
|
<h1>2.通知配置说明</h1>
|
||||||
<h2>1、Webhook</h2>
|
<h2>1、WebHook</h2>
|
||||||
<div>Webhook地址。</div>
|
<div>WebHook地址。</div>
|
||||||
|
|
||||||
<h2>2、请求头</h2>
|
<h2>2、请求头</h2>
|
||||||
<div>
|
<div>
|
||||||
|
|
|
@ -278,12 +278,12 @@
|
||||||
<!-- webhook -->
|
<!-- webhook -->
|
||||||
<template v-if="formData.type === 'webhook'">
|
<template v-if="formData.type === 'webhook'">
|
||||||
<j-form-item
|
<j-form-item
|
||||||
label="Webhook"
|
label="WebHook"
|
||||||
v-bind="validateInfos['configuration.url']"
|
v-bind="validateInfos['configuration.url']"
|
||||||
>
|
>
|
||||||
<j-input
|
<j-input
|
||||||
v-model:value="formData.configuration.url"
|
v-model:value="formData.configuration.url"
|
||||||
placeholder="请输入Webhook"
|
placeholder="请输入WebHook"
|
||||||
/>
|
/>
|
||||||
</j-form-item>
|
</j-form-item>
|
||||||
<j-form-item label="请求头">
|
<j-form-item label="请求头">
|
||||||
|
|
|
@ -28,7 +28,7 @@ export const NOTICE_METHOD: INoticeMethod[] = [
|
||||||
value: 'sms',
|
value: 'sms',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'webhook',
|
label: 'WebHook',
|
||||||
value: 'webhook',
|
value: 'webhook',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
@ -75,7 +75,7 @@ export const MSG_TYPE = {
|
||||||
],
|
],
|
||||||
webhook: [
|
webhook: [
|
||||||
{
|
{
|
||||||
label: 'webhook',
|
label: 'WebHook',
|
||||||
value: 'http',
|
value: 'http',
|
||||||
logo: getImage('/notice/webhook.png'),
|
logo: getImage('/notice/webhook.png'),
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue