fix: bug#19071
This commit is contained in:
parent
f90ee686c1
commit
f319d4e0e2
|
@ -6,10 +6,9 @@ import { EventLevel } from "@/views/device/data";
|
||||||
import {MetadataType} from "@/views/device/Product/typings";
|
import {MetadataType} from "@/views/device/Product/typings";
|
||||||
import { getUnit } from '@/api/device/instance';
|
import { getUnit } from '@/api/device/instance';
|
||||||
import {Ref} from "vue";
|
import {Ref} from "vue";
|
||||||
import {omit, pick} from "lodash-es";
|
import {omit, pick, isObject, cloneDeep} from "lodash-es";
|
||||||
import { message } from 'jetlinks-ui-components'
|
import { message } from 'jetlinks-ui-components'
|
||||||
import { onlyMessage } from "@/utils/comm";
|
import { onlyMessage } from "@/utils/comm";
|
||||||
import {cloneDeep} from "lodash";
|
|
||||||
interface DataTableColumnProps extends ColumnProps {
|
interface DataTableColumnProps extends ColumnProps {
|
||||||
type?: string,
|
type?: string,
|
||||||
components?: {
|
components?: {
|
||||||
|
@ -37,9 +36,7 @@ const type = {
|
||||||
report: '上报',
|
report: '上报',
|
||||||
};
|
};
|
||||||
|
|
||||||
export const validatorConfig = (value: any, isObject: boolean = false) => {
|
export const validatorConfig = (value: any, _isObject: boolean = false) => {
|
||||||
|
|
||||||
console.log(value)
|
|
||||||
|
|
||||||
if (!value) {
|
if (!value) {
|
||||||
return Promise.resolve()
|
return Promise.resolve()
|
||||||
|
@ -52,11 +49,11 @@ export const validatorConfig = (value: any, isObject: boolean = false) => {
|
||||||
return Promise.reject('请选择元素类型')
|
return Promise.reject('请选择元素类型')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isObject && value.type === 'object' && !value.properties?.length) {
|
if (_isObject && value.type === 'object' && !value.properties?.length) {
|
||||||
return Promise.reject('请添加参数')
|
return Promise.reject('请添加参数')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value.type === 'file' && (!value.fileType || !Object.keys(value.fileType).length)) {
|
if (value.type === 'file' && (!value.fileType || (isObject(value.fileType) && !Object.keys(value.fileType).length))) {
|
||||||
return Promise.reject('请选择文件类型')
|
return Promise.reject('请选择文件类型')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -665,4 +662,4 @@ export const TypeStringMap = {
|
||||||
// MetadataMapping.set('tags', TagColumns);
|
// MetadataMapping.set('tags', TagColumns);
|
||||||
// MetadataMapping.set('functions', FunctionColumns);
|
// MetadataMapping.set('functions', FunctionColumns);
|
||||||
//
|
//
|
||||||
// export default MetadataMapping;
|
// export default MetadataMapping;
|
||||||
|
|
|
@ -55,15 +55,15 @@
|
||||||
import { getUnit } from '@/api/device/instance';
|
import { getUnit } from '@/api/device/instance';
|
||||||
import {
|
import {
|
||||||
DataTableTypeSelect,
|
DataTableTypeSelect,
|
||||||
DataTableArray,
|
DataTableArray,
|
||||||
DataTableString,
|
DataTableString,
|
||||||
DataTableInteger,
|
DataTableInteger,
|
||||||
DataTableDouble,
|
DataTableDouble,
|
||||||
DataTableBoolean,
|
DataTableBoolean,
|
||||||
DataTableEnum,
|
DataTableEnum,
|
||||||
DataTableFile,
|
DataTableFile,
|
||||||
DataTableDate,
|
DataTableDate,
|
||||||
DataTableObject,
|
DataTableObject, Form,
|
||||||
} from 'jetlinks-ui-components';
|
} from 'jetlinks-ui-components';
|
||||||
|
|
||||||
import ConfigModal from '@/views/device/components/Metadata/Base/components/ConfigModal.vue'
|
import ConfigModal from '@/views/device/components/Metadata/Base/components/ConfigModal.vue'
|
||||||
|
@ -83,7 +83,7 @@ const props = defineProps({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const formItemContext = Form.useInjectFormItemContext();
|
||||||
const options = ref<{ label: string; value: string }[]>([]);
|
const options = ref<{ label: string; value: string }[]>([]);
|
||||||
const emit = defineEmits(['update:value']);
|
const emit = defineEmits(['update:value']);
|
||||||
|
|
||||||
|
@ -235,6 +235,7 @@ const valueChange = () => {
|
||||||
...props.value,
|
...props.value,
|
||||||
output: {...data.value, type: type.value},
|
output: {...data.value, type: type.value},
|
||||||
});
|
});
|
||||||
|
formItemContext.onFieldChange()
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue