fix: 优化物模型-功能定义-输入
This commit is contained in:
parent
c56dbff80b
commit
a869162799
|
@ -87,6 +87,7 @@
|
||||||
{{ sourceMap?.[data.record?.expands?.source] || '' }}
|
{{ sourceMap?.[data.record?.expands?.source] || '' }}
|
||||||
</template>
|
</template>
|
||||||
<template #inputs="{ data }">
|
<template #inputs="{ data }">
|
||||||
|
<InputParams v-model:value="dataSource[data.index]" />
|
||||||
{{ data.record.inputs?.map(item => item.name).join(',') }}
|
{{ data.record.inputs?.map(item => item.name).join(',') }}
|
||||||
</template>
|
</template>
|
||||||
<template #output="{ data }">
|
<template #output="{ data }">
|
||||||
|
@ -202,7 +203,7 @@ import { useMetadata, useOperateLimits } from './hooks';
|
||||||
import { useColumns } from './columns';
|
import { useColumns } from './columns';
|
||||||
import { levelMap, sourceMap, expandsType, limitsMap } from './utils';
|
import { levelMap, sourceMap, expandsType, limitsMap } from './utils';
|
||||||
import Rule from '@/components/Metadata/Rule';
|
import Rule from '@/components/Metadata/Rule';
|
||||||
import { Source, OtherSetting } from './components';
|
import { Source, OtherSetting, InputParams } from './components';
|
||||||
import { saveProductVirtualProperty } from '@/api/device/product';
|
import { saveProductVirtualProperty } from '@/api/device/product';
|
||||||
import { saveDeviceVirtualProperty } from '@/api/device/instance';
|
import { saveDeviceVirtualProperty } from '@/api/device/instance';
|
||||||
import { useInstanceStore } from '@/store/instance';
|
import { useInstanceStore } from '@/store/instance';
|
||||||
|
|
|
@ -172,10 +172,7 @@ export const useColumns = (type?: MetadataType, target?: 'device' | 'product', d
|
||||||
{
|
{
|
||||||
title: '输入参数',
|
title: '输入参数',
|
||||||
dataIndex: 'inputs',
|
dataIndex: 'inputs',
|
||||||
type: 'components',
|
width: 120
|
||||||
components: {
|
|
||||||
name: InputParams,
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '输出参数',
|
title: '输出参数',
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<div class="values-test">
|
<div class="values-test">
|
||||||
{{ text }}
|
{{ text }}
|
||||||
</div>
|
</div>
|
||||||
<!-- <OtherConfigInfo :value="formData"></OtherConfigInfo> -->
|
<OtherConfigInfo :value="formData"></OtherConfigInfo>
|
||||||
<DataTableEnum v-if="formData.type === 'enum'" v-model:value="formData" />
|
<DataTableEnum v-if="formData.type === 'enum'" v-model:value="formData" />
|
||||||
<DataTableBoolean v-else-if="formData.type === 'boolean'" v-model:value="formData" />
|
<DataTableBoolean v-else-if="formData.type === 'boolean'" v-model:value="formData" />
|
||||||
<DataTableDouble
|
<DataTableDouble
|
||||||
|
|
|
@ -1,22 +1,19 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="input-params">
|
<DataTableObject v-model:value="dataSource" :columns="columns" :onAdd="addItem" width="700px" @confirm="confirm">
|
||||||
<div class="input-params-text">
|
<template #valueType="{ data }">
|
||||||
{{ dataSource?.map((item) => item.name).join(',') }}
|
<span>{{ data.record.valueType?.type }}</span>
|
||||||
</div>
|
</template>
|
||||||
<DataTableObject v-model:value="dataSource" :columns="columns" :onAdd="addItem" width="700px" @confirm="confirm">
|
<template #required="{ data }">
|
||||||
<template #valueType="{ data }">
|
<span>{{ data.record.expands?.required ? "是": '否' }}</span>
|
||||||
<span>{{ data.record.valueType?.type }}</span>
|
</template>
|
||||||
</template>
|
<template #config="{ data }">
|
||||||
<template #required="{ data }">
|
<OtherConfigInfo :value="data.record.valueType"></OtherConfigInfo>
|
||||||
<span>{{ data.record.expands?.required ? "是": '否' }}</span>
|
</template>
|
||||||
</template>
|
<j-button>
|
||||||
<template #config="{ data }">
|
<AIcon type="SettingOutlined" />
|
||||||
<OtherConfigInfo :value="data.record.valueType"></OtherConfigInfo>
|
配置
|
||||||
</template>
|
</j-button>
|
||||||
</DataTableObject>
|
</DataTableObject>
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts" name="InputParams">
|
<script setup lang="ts" name="InputParams">
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
type: 'components',
|
type: 'components',
|
||||||
dataIndex: 'valueTypes',
|
dataIndex: 'valueTypes',
|
||||||
components: {
|
components: {
|
||||||
name: DataTableTypeSelect,
|
name: Type,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -32,7 +32,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '操作'
|
title: '操作',
|
||||||
|
dataIndex: 'action',
|
||||||
|
width: 60
|
||||||
}
|
}
|
||||||
]"
|
]"
|
||||||
@confirm="valueChange"
|
@confirm="valueChange"
|
||||||
|
@ -65,7 +67,7 @@
|
||||||
<script setup lang="ts" name="OutPutParams">
|
<script setup lang="ts" name="OutPutParams">
|
||||||
import { getUnit } from '@/api/device/instance';
|
import { getUnit } from '@/api/device/instance';
|
||||||
import {
|
import {
|
||||||
DataTableTypeSelect,
|
DataTableTypeSelect,
|
||||||
DataTableArray,
|
DataTableArray,
|
||||||
DataTableString,
|
DataTableString,
|
||||||
DataTableInteger,
|
DataTableInteger,
|
||||||
|
@ -80,6 +82,7 @@ import {
|
||||||
import DataTypeObjectChild from '../DataTypeObjectChild.vue';
|
import DataTypeObjectChild from '../DataTypeObjectChild.vue';
|
||||||
import { cloneDeep } from 'lodash-es';
|
import { cloneDeep } from 'lodash-es';
|
||||||
import {typeSelectChange} from "@/views/device/components/Metadata/Base/columns";
|
import {typeSelectChange} from "@/views/device/components/Metadata/Base/columns";
|
||||||
|
import Type from './Type.vue'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
value: {
|
value: {
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
<template>
|
||||||
|
<DataTableTypeSelect
|
||||||
|
v-model="myValue"
|
||||||
|
:filter="['object']"
|
||||||
|
@change="change"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts" name="DataTypeSelect">
|
||||||
|
import {
|
||||||
|
DataTableTypeSelect,
|
||||||
|
} from 'jetlinks-ui-components';
|
||||||
|
import {typeSelectChange} from "@/views/device/components/Metadata/Base/columns";
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
value: {
|
||||||
|
type: Object,
|
||||||
|
default: undefined
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const emit = defineEmits(['update:value'])
|
||||||
|
|
||||||
|
const myValue = ref()
|
||||||
|
|
||||||
|
const change = (e: string) => {
|
||||||
|
const obj = typeSelectChange(e)
|
||||||
|
const _data = {...props.value}
|
||||||
|
_data.valueType = obj
|
||||||
|
emit('update:value', _data)
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(() => props.value, () => {
|
||||||
|
myValue.value = props.value?.valueType?.type
|
||||||
|
}, { immediate: true, deep: true})
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
|
@ -3825,8 +3825,8 @@ jetlinks-store@^0.0.3:
|
||||||
|
|
||||||
jetlinks-ui-components@^1.0.23, jetlinks-ui-components@^1.0.24:
|
jetlinks-ui-components@^1.0.23, jetlinks-ui-components@^1.0.24:
|
||||||
version "1.0.24"
|
version "1.0.24"
|
||||||
resolved "http://registry.jetlinks.cn/jetlinks-ui-components/-/jetlinks-ui-components-1.0.24.tgz#1b7ad3ecf9eb4cc8f42692f935d6f2c5cf70e597"
|
resolved "http://registry.jetlinks.cn/jetlinks-ui-components/-/jetlinks-ui-components-1.0.24.tgz#6633322daa90f3acd9a48aeab61c5eaf23c06e10"
|
||||||
integrity sha512-+tS6vzKJlphNUCR59Lc8vJpRfHIzSyMVuhHPfTH3dAa4Ow3OXaUxRdqJhQbDxIwptP3u2Rc7nxdZ5GZFMbJgjw==
|
integrity sha512-5KxeoLb9tnA4TGoX5Q1e43jNobPmGfHk+lxZsxEs50LTaOYVj0E6DSqCfaHbLHrXMdCcL45eKRCauRusVIXQTA==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@vueuse/core" "^9.12.0"
|
"@vueuse/core" "^9.12.0"
|
||||||
"@vueuse/router" "^9.13.0"
|
"@vueuse/router" "^9.13.0"
|
||||||
|
|
Loading…
Reference in New Issue