fix: 优化物模型-功能定义(输入、输出)

This commit is contained in:
XieYongHong 2023-07-06 16:49:48 +08:00
parent 5912ebd703
commit 09d1d388b8
3 changed files with 15 additions and 16 deletions

View File

@ -3,7 +3,7 @@
<div class="input-params-text"> <div class="input-params-text">
{{ value?.map((item) => item.name).join(',') }} {{ value?.map((item) => item.name).join(',') }}
</div> </div>
<DataTableObject v-model:value="value" :columns="columns" :addItem="addItem" :width="700"> <DataTableObject v-model:value="value" :columns="columns" :addItem="addItem" width="700px" @confirm="confirm">
<template #valueType="{ data }"> <template #valueType="{ data }">
<span>{{ data.record.valueType?.type }}</span> <span>{{ data.record.valueType?.type }}</span>
</template> </template>
@ -74,7 +74,7 @@ const columns = [
{ {
title: '操作', title: '操作',
dataIndex: 'action', dataIndex: 'action',
width: 80 width: 60
}, },
]; ];
@ -114,13 +114,13 @@ watch(
{ immediate: true }, { immediate: true },
); );
watch(() => value.value, () => { const confirm = (v: any) => {
console.log(value.value); console.log(v)
emit('update:value', { emit('update:value', {
...props.value, ...props.value,
inputs: value.value inputs: value.value
}) })
}) }
</script> </script>
<style scoped lang="less"> <style scoped lang="less">

View File

@ -78,6 +78,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";
const props = defineProps({ const props = defineProps({
value: { value: {
@ -92,7 +93,8 @@ const emit = defineEmits(['update:value']);
const type = ref(props.value?.output?.type); const type = ref(props.value?.output?.type);
const data = ref(cloneDeep(props.value?.output)); const data = ref(cloneDeep(props.value?.output));
const typeChange = () => { const typeChange = (e: string) => {
data.value = typeSelectChange(e)
emit('update:value', { emit('update:value', {
...props.value, ...props.value,
output: { ...data.value, type: type.value } output: { ...data.value, type: type.value }
@ -119,10 +121,7 @@ watch(
); );
const valueChange = () => { const valueChange = () => {
console.log({
...props.value,
output: {...data.value, type: type.value},
})
emit('update:value', { emit('update:value', {
...props.value, ...props.value,
output: {...data.value, type: type.value}, output: {...data.value, type: type.value},

View File

@ -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#95afb70c227efcda4d387f4c48da21140f532ecd" resolved "http://registry.jetlinks.cn/jetlinks-ui-components/-/jetlinks-ui-components-1.0.24.tgz#201ac2119b4707a4d793b819a79ac37fe9bd1ae6"
integrity sha512-4VmgsQwOuDNxasLy9yFIm17kEQNkExfBGFo5gyJvtoo27XTrsKnM6J7gbsNOFxbyIHDsD5B8Un+D3S2dGRpLhA== integrity sha512-382mUqzC+/rWrqTJyarlODdwCchxgB0ZzcGOGmrqOn37eAF+grfPnpY6UsT4or0njes4eu//RlniLc92dVNcUA==
dependencies: dependencies:
"@vueuse/core" "^9.12.0" "@vueuse/core" "^9.12.0"
"@vueuse/router" "^9.13.0" "@vueuse/router" "^9.13.0"