parent
884e8918e8
commit
7b727d5587
|
@ -177,7 +177,7 @@ const emit = defineEmits(['change']);
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const formRef = ref<FormInstance>();
|
const formRef = ref<FormInstance>();
|
||||||
const formRef2 = ref<FormInstance>();
|
const formRef2 = ref<FormInstance>();
|
||||||
const deviceType = ref<string>('S200');
|
const deviceType = ref<string>(props.data.deviceType);
|
||||||
const dataTypesList = ref<any[]>([]);
|
const dataTypesList = ref<any[]>([]);
|
||||||
const daveAreaList = ref<any>([]);
|
const daveAreaList = ref<any>([]);
|
||||||
|
|
||||||
|
@ -326,12 +326,38 @@ const Area = (_: any, value: any): Promise<any> =>
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
form.value.features = props.data.features?.map((item:any)=>item.value)
|
form.value.features = props.data.features?.map((item:any)=>item.value)
|
||||||
|
form.value.configuration.bytes = props.data.configuration?.bytes
|
||||||
if(props.data.accessModes?.length!==0){
|
if(props.data.accessModes?.length!==0){
|
||||||
form.value.accessModes = props.data.accessModes?.map((item:any)=>item.value)
|
form.value.accessModes = props.data.accessModes?.map((item:any)=>item.value)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => dataTypesList.value,
|
||||||
|
(val: any[]) => {
|
||||||
|
if (val) {
|
||||||
|
const result: any = dataTypesList.value.find(
|
||||||
|
(item: any) => item.id == form.value.configuration.type,
|
||||||
|
);
|
||||||
|
if(result) {
|
||||||
|
// console.log('result',result)
|
||||||
|
disabled.value = (result && result.length !== 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => form.value.configuration.type,
|
||||||
|
(val) => {
|
||||||
|
if (val !== 'Bool') {
|
||||||
|
form.value.configuration.bits = 0;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ deep: true },
|
||||||
|
);
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
|
|
|
@ -81,6 +81,48 @@
|
||||||
v-model:value="formData.value"
|
v-model:value="formData.value"
|
||||||
/>
|
/>
|
||||||
</j-form-item>
|
</j-form-item>
|
||||||
|
<j-form-item
|
||||||
|
:label="data.name"
|
||||||
|
name="value"
|
||||||
|
:rules="[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: `请输入${data.name}`,
|
||||||
|
},
|
||||||
|
]"
|
||||||
|
v-else-if="data.provider === 'snap7'"
|
||||||
|
>
|
||||||
|
<j-input-number
|
||||||
|
v-if="s7Type.includes(data.configuration?.type)"
|
||||||
|
style="width: 100%"
|
||||||
|
placeholder="请输入"
|
||||||
|
v-model:value="formData.value"
|
||||||
|
/>
|
||||||
|
<j-select
|
||||||
|
v-else-if="['Bool'].includes(data.configuration?.type)"
|
||||||
|
style="width: 100%"
|
||||||
|
v-model:value="formData.value"
|
||||||
|
:options="[
|
||||||
|
{
|
||||||
|
label: '是',
|
||||||
|
value: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '否',
|
||||||
|
value: false,
|
||||||
|
},
|
||||||
|
]"
|
||||||
|
placeholder="请选择"
|
||||||
|
allowClear
|
||||||
|
show-search
|
||||||
|
:filter-option="filterOption"
|
||||||
|
/>
|
||||||
|
<j-input
|
||||||
|
v-else
|
||||||
|
placeholder="请输入"
|
||||||
|
v-model:value="formData.value"
|
||||||
|
/>
|
||||||
|
</j-form-item>
|
||||||
<j-form-item
|
<j-form-item
|
||||||
:label="data.name"
|
:label="data.name"
|
||||||
name="value"
|
name="value"
|
||||||
|
@ -176,6 +218,19 @@ const valueTypeArray = [
|
||||||
'number',
|
'number',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const s7Type =[
|
||||||
|
'Byte',
|
||||||
|
'Word',
|
||||||
|
'DWord',
|
||||||
|
'USInt',
|
||||||
|
'SInt',
|
||||||
|
'Int',
|
||||||
|
'UDInt',
|
||||||
|
'DInt',
|
||||||
|
'Real',
|
||||||
|
'LReal'
|
||||||
|
]
|
||||||
|
|
||||||
const emit = defineEmits(['change']);
|
const emit = defineEmits(['change']);
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const formRef = ref<FormInstance>();
|
const formRef = ref<FormInstance>();
|
||||||
|
|
|
@ -335,7 +335,7 @@ import SaveModBus from './Save/SaveModBus.vue';
|
||||||
import SaveOPCUA from './Save/SaveOPCUA.vue';
|
import SaveOPCUA from './Save/SaveOPCUA.vue';
|
||||||
import Scan from './Scan/index.vue';
|
import Scan from './Scan/index.vue';
|
||||||
import { colorMap } from '../data';
|
import { colorMap } from '../data';
|
||||||
import { cloneDeep, isNumber, throttle } from 'lodash-es';
|
import { cloneDeep, isBoolean, isNumber, throttle } from 'lodash-es';
|
||||||
import { getWebSocket } from '@/utils/websocket';
|
import { getWebSocket } from '@/utils/websocket';
|
||||||
import { map } from 'rxjs/operators';
|
import { map } from 'rxjs/operators';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
|
@ -485,7 +485,8 @@ const handlAdd = () => {
|
||||||
visible.saveS7 = true
|
visible.saveS7 = true
|
||||||
current.value = {
|
current.value = {
|
||||||
collectorId: props.data?.id,
|
collectorId: props.data?.id,
|
||||||
provider: props.data?.provider
|
provider: props.data?.provider,
|
||||||
|
deviceType:props.data?.configuration.type,
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
visible.saveModBus = true;
|
visible.saveModBus = true;
|
||||||
|
@ -544,11 +545,13 @@ const clickEdit = async (data: object) => {
|
||||||
|
|
||||||
// ReadIdMap
|
// ReadIdMap
|
||||||
const clickRead = async (data: any) => {
|
const clickRead = async (data: any) => {
|
||||||
|
console.log('------')
|
||||||
const res: any = await readPoint(data?.collectorId, [data?.id]);
|
const res: any = await readPoint(data?.collectorId, [data?.id]);
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
const readData: any = res.result[0];
|
const readData: any = res.result[0];
|
||||||
const _data = ReadIdMap.get(data?.id);
|
const _data = ReadIdMap.get(data?.id);
|
||||||
ReadIdMap.set(data?.id, { ..._data, ...readData });
|
ReadIdMap.set(data?.id, { ..._data, ...readData });
|
||||||
|
console.log('====',ReadIdMap.get(data.id))
|
||||||
cancelSelect();
|
cancelSelect();
|
||||||
tableRef.value?.reload();
|
tableRef.value?.reload();
|
||||||
onlyMessage('操作成功', 'success');
|
onlyMessage('操作成功', 'success');
|
||||||
|
@ -592,8 +595,13 @@ const getReadParseData = (item: any) => {
|
||||||
let _data = '--';
|
let _data = '--';
|
||||||
if (ReadIdMap.has(item.id)) {
|
if (ReadIdMap.has(item.id)) {
|
||||||
const { parseData, dataType } = ReadIdMap.get(item.id);
|
const { parseData, dataType } = ReadIdMap.get(item.id);
|
||||||
|
if(isBoolean(parseData)){
|
||||||
|
_data = `${parseData}(${dataType || '-'}) `;
|
||||||
|
}else{
|
||||||
_data = !!parseData ? `${parseData}(${dataType || '-'}) ` : '--';
|
_data = !!parseData ? `${parseData}(${dataType || '-'}) ` : '--';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
return _data;
|
return _data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue