Merge branch 'dev' into dev-dictionary
This commit is contained in:
commit
784034c5cb
|
@ -177,7 +177,7 @@ const emit = defineEmits(['change']);
|
|||
const loading = ref(false);
|
||||
const formRef = ref<FormInstance>();
|
||||
const formRef2 = ref<FormInstance>();
|
||||
const deviceType = ref<string>('S200');
|
||||
const deviceType = ref<string>(props.data.deviceType);
|
||||
const dataTypesList = ref<any[]>([]);
|
||||
const daveAreaList = ref<any>([]);
|
||||
|
||||
|
@ -326,12 +326,38 @@ const Area = (_: any, value: any): Promise<any> =>
|
|||
|
||||
onMounted(() => {
|
||||
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){
|
||||
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>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
|
|
@ -81,6 +81,48 @@
|
|||
v-model:value="formData.value"
|
||||
/>
|
||||
</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
|
||||
:label="data.name"
|
||||
name="value"
|
||||
|
@ -176,6 +218,19 @@ const valueTypeArray = [
|
|||
'number',
|
||||
];
|
||||
|
||||
const s7Type =[
|
||||
'Byte',
|
||||
'Word',
|
||||
'DWord',
|
||||
'USInt',
|
||||
'SInt',
|
||||
'Int',
|
||||
'UDInt',
|
||||
'DInt',
|
||||
'Real',
|
||||
'LReal'
|
||||
]
|
||||
|
||||
const emit = defineEmits(['change']);
|
||||
const loading = ref(false);
|
||||
const formRef = ref<FormInstance>();
|
||||
|
|
|
@ -335,7 +335,7 @@ import SaveModBus from './Save/SaveModBus.vue';
|
|||
import SaveOPCUA from './Save/SaveOPCUA.vue';
|
||||
import Scan from './Scan/index.vue';
|
||||
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 { map } from 'rxjs/operators';
|
||||
import dayjs from 'dayjs';
|
||||
|
@ -485,7 +485,8 @@ const handlAdd = () => {
|
|||
visible.saveS7 = true
|
||||
current.value = {
|
||||
collectorId: props.data?.id,
|
||||
provider: props.data?.provider
|
||||
provider: props.data?.provider,
|
||||
deviceType:props.data?.configuration.type,
|
||||
}
|
||||
}else{
|
||||
visible.saveModBus = true;
|
||||
|
@ -544,11 +545,13 @@ const clickEdit = async (data: object) => {
|
|||
|
||||
// ReadIdMap
|
||||
const clickRead = async (data: any) => {
|
||||
console.log('------')
|
||||
const res: any = await readPoint(data?.collectorId, [data?.id]);
|
||||
if (res.status === 200) {
|
||||
const readData: any = res.result[0];
|
||||
const _data = ReadIdMap.get(data?.id);
|
||||
ReadIdMap.set(data?.id, { ..._data, ...readData });
|
||||
console.log('====',ReadIdMap.get(data.id))
|
||||
cancelSelect();
|
||||
tableRef.value?.reload();
|
||||
onlyMessage('操作成功', 'success');
|
||||
|
@ -592,7 +595,12 @@ const getReadParseData = (item: any) => {
|
|||
let _data = '--';
|
||||
if (ReadIdMap.has(item.id)) {
|
||||
const { parseData, dataType } = ReadIdMap.get(item.id);
|
||||
_data = !!parseData ? `${parseData}(${dataType || '-'}) ` : '--';
|
||||
if(isBoolean(parseData)){
|
||||
_data = `${parseData}(${dataType || '-'}) `;
|
||||
}else{
|
||||
_data = !!parseData ? `${parseData}(${dataType || '-'}) ` : '--';
|
||||
}
|
||||
|
||||
}
|
||||
return _data;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue