fix: 修改opc_ua写入

This commit is contained in:
100011797 2023-05-31 16:09:49 +08:00
parent 5e0ca4e2aa
commit 573e42724d
5 changed files with 81 additions and 8 deletions

View File

@ -55,3 +55,6 @@ export const scanOpcUAList = (data: any) =>
data?.nodeId || ''
}`,
);
export const queryTypeList = () => server.get(`/data-collect/opc/data-types`);

View File

@ -19,13 +19,15 @@
<j-select
style="width: 100%"
v-model:value="formData.configuration.type"
:options="[
{ value: 'Number', label: '数值类型' },
{ value: 'DateTime', label: '时间类型' },
{ value: 'Array', label: '数组类型' },
{ value: 'String', label: '文本类型' },
{ value: 'Boolean', label: '布尔' },
]"
:options="options
// [
// { value: 'Number', label: '' },
// { value: 'DateTime', label: '' },
// { value: 'Array', label: '' },
// { value: 'String', label: '' },
// { value: 'Boolean', label: '' },
// ]
"
placeholder="请选择数据类型"
allowClear
show-search
@ -98,6 +100,7 @@ import {
savePoint,
updatePoint,
_validateField,
queryTypeList
} from '@/api/data-collect/collector';
import { OPCUARules } from '../../data.ts';
import type { FormInstance } from 'ant-design-vue';
@ -118,6 +121,7 @@ const formRef = ref<FormInstance>();
const id = props.data.id;
const collectorId = props.data.collectorId;
const provider = props.data.provider;
const options = ref([]);
const formData = ref({
name: '',
@ -157,6 +161,19 @@ const filterOption = (input: string, option: any) => {
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
};
onMounted(() => {
queryTypeList().then((resp: any) => {
if(resp.status === 200){
options.value = (resp?.result || []).map((item: any) => {
return {
label: item,
value: item
}
})
}
})
})
watch(
() => props.data,
(value) => {

View File

@ -130,6 +130,7 @@ const onCheck = (checkedKeys: any, info: any) => {
value: last ? last?.accessModes?.value : one?.accessModes || [],
check: true,
},
type: one?.type,
configuration: {
...one?.configuration,
interval: {

View File

@ -65,6 +65,7 @@ const handleOk = async () => {
pointKey: item.id,
configuration: {
interval: item.configuration?.interval?.value,
type: item.type,
},
features: !item.features?.value ? [] : ['changedOnly'],
accessModes: item.accessModes?.value || [],

View File

@ -30,6 +30,57 @@
showCount
/>
</j-form-item>
<j-form-item
:label="data.name"
name="value"
:rules="[
{
required: true,
message: `请输入${data.name}`,
},
]"
v-else-if="data.provider === 'OPC_UA'"
>
<j-input-number
v-if="['Double', 'Float', 'LLong', 'Long', 'Integer', 'Short'].includes(valueType)"
style="width: 100%"
placeholder="请输入"
v-model:value="formData.value"
/>
<j-select
v-else-if="['Boolean'].includes(valueType)"
style="width: 100%"
v-model:value="formData.value"
:options="[
{
label: '是',
value: true,
},
{
label: '否',
value: false,
},
]"
placeholder="请选择"
allowClear
show-search
:filter-option="filterOption"
/>
<j-date-picker
v-else-if="['DateTime'].includes(valueType)"
style="width: 100%"
format="YYYY-MM-DD HH:mm:ss"
show-time
placeholder="请选择"
@change="onChange"
/>
<j-input
v-else
placeholder="请输入"
v-model:value="formData.value"
/>
</j-form-item>
<j-form-item
:label="data.name"
name="value"
@ -111,7 +162,7 @@ const props = defineProps({
const valueType: string = (
props.data?.provider === 'OPC_UA'
? props?.data?.configuration?.type || 'Number'
? props?.data?.configuration?.type || 'String'
: props.data?.configuration?.codec?.provider || 'int8'
).toLocaleLowerCase();