fix:场景联动
This commit is contained in:
parent
2aaa3ae945
commit
0a93cd2926
|
@ -1,5 +1,11 @@
|
|||
<template>
|
||||
<pro-search class="device-search" type="simple" :columns="columns" target="device-instance-running-events" @search="handleSearch" />
|
||||
<pro-search
|
||||
class="device-search"
|
||||
type="simple"
|
||||
:columns="columns"
|
||||
target="device-instance-running-events"
|
||||
@search="handleSearch"
|
||||
/>
|
||||
<JProTable
|
||||
ref="eventsRef"
|
||||
:columns="columns"
|
||||
|
@ -17,13 +23,18 @@
|
|||
</j-button>
|
||||
</template>
|
||||
</JProTable>
|
||||
<j-modal :width="600" v-model:visible="visible" title="详情" class="device-running-event-modal">
|
||||
<JsonViewer :value="info" />
|
||||
<template #footer>
|
||||
<j-button type="primary" @click="visible = false">关闭</j-button>
|
||||
</template>
|
||||
</j-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import dayjs from 'dayjs';
|
||||
import { getEventList } from '@/api/device/instance';
|
||||
import { useInstanceStore } from '@/store/instance';
|
||||
import { Modal } from 'jetlinks-ui-components';
|
||||
import JsonViewer from 'vue-json-viewer';
|
||||
|
||||
const events = defineProps({
|
||||
|
@ -52,13 +63,11 @@ const columns = ref<Record<string, any>>([
|
|||
},
|
||||
]);
|
||||
const params = ref<Record<string, any>>({});
|
||||
const visible = ref<boolean>(false);
|
||||
const info = ref<Record<string, any>>({});
|
||||
|
||||
const _getEventList = (_params: any) =>
|
||||
getEventList(
|
||||
instanceStore.current.id || '',
|
||||
events.data.id || '',
|
||||
_params
|
||||
);
|
||||
getEventList(instanceStore.current.id || '', events.data.id || '', _params);
|
||||
|
||||
watchEffect(() => {
|
||||
if (events.data?.valueType?.type === 'object') {
|
||||
|
@ -69,7 +78,7 @@ watchEffect(() => {
|
|||
dataIndex: `${i.id}_format`,
|
||||
search: {
|
||||
type: i?.valueType?.type || 'string',
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
} else {
|
||||
|
@ -85,20 +94,28 @@ const handleSearch = (_params: any) => {
|
|||
};
|
||||
|
||||
const detail = (_info: any) => {
|
||||
Modal.info({
|
||||
title: () => '详情',
|
||||
width: 850,
|
||||
content: () => h('JsonViewer', {
|
||||
'expand-depth': 5,
|
||||
value: _info
|
||||
}),
|
||||
okText: '关闭',
|
||||
});
|
||||
info.value = _info
|
||||
visible.value = true
|
||||
// Modal.info({
|
||||
// title: () => '详情',
|
||||
// width: 850,
|
||||
// content: () => h('JsonViewer', {
|
||||
// 'expand-depth': 5,
|
||||
// value: _info
|
||||
// }),
|
||||
// okText: '关闭',
|
||||
// });
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
.device-search {
|
||||
margin: 0 0 24px 0 ;
|
||||
margin: 0 0 24px 0;
|
||||
}
|
||||
|
||||
.device-running-event-modal {
|
||||
.ant-modal-body {
|
||||
padding: 0 20px;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -13,7 +13,7 @@
|
|||
<j-row type="flex">
|
||||
<j-col flex="180px">
|
||||
<j-form-item name="photoUrl">
|
||||
<JProUpload v-model="modelRef.photoUrl" />
|
||||
<JProUpload accept="image/*" v-model="modelRef.photoUrl" />
|
||||
</j-form-item>
|
||||
</j-col>
|
||||
<j-col flex="auto">
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<j-row type="flex">
|
||||
<j-col flex="180px">
|
||||
<j-form-item name="photoUrl">
|
||||
<JProUpload v-model="modelRef.photoUrl" />
|
||||
<JProUpload accept="image/*" v-model="modelRef.photoUrl" />
|
||||
</j-form-item>
|
||||
</j-col>
|
||||
<j-col flex="auto">
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
v-model:value="_value"
|
||||
:precision="3"
|
||||
:min="0"
|
||||
:max="6535"
|
||||
:max="65535"
|
||||
>
|
||||
<template #addonAfter>
|
||||
<j-select
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
v-model:value="_value"
|
||||
v-model:source="_source"
|
||||
@select="onChange"
|
||||
valueName="id"
|
||||
>
|
||||
<template v-slot="{ label }">
|
||||
<j-input :value="label" readonly />
|
||||
|
@ -15,6 +16,7 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { cloneDeep } from 'lodash-es';
|
||||
import ParamsDropdown from '../../../components/ParamsDropdown';
|
||||
import { handleParamsData } from './index';
|
||||
|
||||
|
@ -101,7 +103,7 @@ const filterParamsData = (type?: string, data?: any[]): any[] => {
|
|||
};
|
||||
|
||||
const upperOptions = computed(() => {
|
||||
return filterParamsData(props.data.valueType?.type, props?.builtInList);
|
||||
return filterParamsData(props.data.valueType?.type, cloneDeep(props?.builtInList));
|
||||
});
|
||||
|
||||
const onChange = () => {
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
v-model:value="propertyModelRef.propertiesValue"
|
||||
v-model:source="propertyModelRef.source"
|
||||
@select="onValueChange"
|
||||
valueName="id"
|
||||
>
|
||||
<template v-slot="{ label }">
|
||||
<j-input readonly :value="label" placeholder="请选择" />
|
||||
|
@ -51,6 +52,7 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { cloneDeep } from 'lodash-es';
|
||||
import ParamsDropdown from '../../../components/ParamsDropdown';
|
||||
import { handleParamsData } from './index';
|
||||
const props = defineProps({
|
||||
|
@ -122,7 +124,8 @@ const filterParamsData = (type?: string, data?: any[]): any[] => {
|
|||
};
|
||||
|
||||
const upperOptions = computed(() => {
|
||||
return filterParamsData(getType.value?.valueType?.type, props?.builtInList);
|
||||
const _data = filterParamsData(getType.value?.valueType?.type, cloneDeep(props?.builtInList))
|
||||
return _data
|
||||
});
|
||||
|
||||
const handleOptions = computed(() => {
|
||||
|
@ -162,7 +165,7 @@ const onChange = () => {
|
|||
});
|
||||
};
|
||||
|
||||
const onValueChange = () => {
|
||||
const onValueChange = (val: any) => {
|
||||
const obj = {
|
||||
[`${propertyModelRef.properties}`]: {
|
||||
value: propertyModelRef?.propertiesValue,
|
||||
|
@ -170,7 +173,7 @@ const onValueChange = () => {
|
|||
},
|
||||
};
|
||||
emit('update:value', obj);
|
||||
emit('change', propertyModelRef?.propertiesValue)
|
||||
emit('change', val?.name || val)
|
||||
};
|
||||
|
||||
watch(
|
||||
|
|
|
@ -183,7 +183,7 @@ watch(
|
|||
|
||||
<style lang="less">
|
||||
.action-search {
|
||||
padding: 0 0 24px 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.logo {
|
||||
|
|
|
@ -183,7 +183,7 @@ watch(
|
|||
|
||||
<style lang="less">
|
||||
.action-search {
|
||||
padding: 0 0 24px 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.logo {
|
||||
|
|
|
@ -79,6 +79,7 @@ const formRef = ref();
|
|||
const modelRef = reactive({});
|
||||
|
||||
watchEffect(() => {
|
||||
console.log(props?.value)
|
||||
Object.assign(modelRef, props?.value);
|
||||
});
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ const source = computed(() => {
|
|||
});
|
||||
|
||||
const builtInList = ref<any[]>([]);
|
||||
const upperKey = ref();
|
||||
const upperKey = ref(props.value?.upperKey);
|
||||
|
||||
const sourceChange = (val: any) => {
|
||||
emit('update:value', {
|
||||
|
@ -160,6 +160,14 @@ watch(
|
|||
},
|
||||
{ deep: true, immediate: true },
|
||||
);
|
||||
|
||||
watch(
|
||||
() => props.value.upperKey,
|
||||
(newVal) => {
|
||||
upperKey.value = newVal
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
|
|
@ -176,10 +176,10 @@
|
|||
name="name"
|
||||
:required="true"
|
||||
:rules="[
|
||||
// {
|
||||
// required: true,
|
||||
// message: '请输入名称',
|
||||
// },
|
||||
{
|
||||
required: true,
|
||||
message: '请输入名称',
|
||||
},
|
||||
{
|
||||
max: 64,
|
||||
message: '最多可输入64个字符',
|
||||
|
@ -467,7 +467,7 @@ const checkName = (_: any, value: any) =>
|
|||
resolve('');
|
||||
}
|
||||
} else {
|
||||
reject('请输入名称');
|
||||
resolve('');
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue