diff --git a/src/components/ValueItem/index.vue b/src/components/ValueItem/index.vue index 09d33c26..769951c6 100644 --- a/src/components/ValueItem/index.vue +++ b/src/components/ValueItem/index.vue @@ -176,8 +176,8 @@ const objectValue = ref(''); const handleItemModalSubmit = () => { myValue.value = objectValue.value.replace(/[\r\n]\s*/g, ''); modalVis.value = false; + emit('update:modelValue', objectValue.value); emit('change', objectValue.value) - emit('update:modelValue', myValue.value); }; // 文件上传 @@ -192,23 +192,23 @@ const handleFileChange = (info: UploadChangeParam>) => { }; const selectChange = (e: string, option: any) => { - emit('change', e, option) emit('update:modelValue', myValue.value); + emit('change', e, option) } const timeChange = (e: any) => { - emit('change', e) emit('update:modelValue', myValue.value); + emit('change', e) } const inputChange = (e: any) => { - emit('change', e && e.target ? e.target.value : e) emit('update:modelValue', myValue.value); + emit('change', e && e.target ? e.target.value : e) } const dateChange = (e: any) => { - emit('change', e) emit('update:modelValue', myValue.value); + emit('change', e) } myValue.value = props.modelValue diff --git a/src/views/DataCollect/Collector/Point/Save/SaveModBus.vue b/src/views/DataCollect/Collector/Point/Save/SaveModBus.vue index e4f552e8..6ed17666 100644 --- a/src/views/DataCollect/Collector/Point/Save/SaveModBus.vue +++ b/src/views/DataCollect/Collector/Point/Save/SaveModBus.vue @@ -30,6 +30,7 @@ v-model:value="formData.configuration.function" :options="[ { label: '01线圈寄存器', value: 'Coils' }, + { label: '02离散输入寄存器', value: 'DiscreteInputs' }, { label: '03保存寄存器', value: 'HoldingRegisters' }, { label: '04输入寄存器', value: 'InputRegisters' }, ]" @@ -122,6 +123,21 @@ " /> + + + - {{ - getParseData( - slotProps.id, - )[0] - }}({{ - getParseData( - slotProps.id, - )[1] - }}) + {{ getParseData(slotProps) }} + + +
+ + {{ + getReadParseData(slotProps) + }}
- -- @@ -333,6 +336,7 @@ const accessModesOption = ref(); const _selectedRowKeys = ref([]); const checkAll = ref(false); const spinning = ref(false); +const ReadIdMap = new Map(); const defaultParams = ref({ sorts: [{ name: 'id', order: 'desc' }], @@ -495,9 +499,14 @@ const clickEdit = async (data: object) => { visible.writePoint = true; current.value = cloneDeep(data); }; -const clickRedo = async (data: any) => { - const res = await readPoint(data?.collectorId, [data?.id]); + +// ReadIdMap +const clickRead = async (data: any) => { + 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 }); cancelSelect(); tableRef.value?.reload(); onlyMessage('操作成功', 'success'); @@ -526,14 +535,24 @@ const getInterval = (item: Partial>) => { const { interval } = item.configuration || ''; return !!interval ? '采集频率' + interval + 'ms' : ''; }; + const getAccessModes = (item: Partial>) => { return item?.accessModes?.map((i: any) => i?.value); }; -const getParseData = (id: string) => { - const { parseData, dataType } = propertyValue.value.get(id); +const getParseData = (item: any) => { + const { parseData, dataType } = propertyValue.value.get(item.id); const data = isNumber(parseData) ? parseData || 0 : parseData; - return [data, dataType]; + const _data = `${data}(${dataType}) `; + return _data; +}; +const getReadParseData = (item: any) => { + let _data = '--'; + if (ReadIdMap.has(item.id)) { + const { parseData, dataType } = ReadIdMap.get(item.id); + _data = !!parseData ? `${parseData}(${dataType || '-'}) ` : '--'; + } + return _data; }; const saveChange = (value: object) => { @@ -618,6 +637,13 @@ watch( (value) => { if (value.length !== 0) { subscribeProperty(value); + value.forEach((item: any) => { + item?.accessModes?.forEach((i: any) => { + if (i?.value === 'read') { + ReadIdMap.set(item.id, item); + } + }); + }); } cancelSelect(); checkAll.value = false; diff --git a/src/views/DataCollect/Collector/Tree/Save/index.vue b/src/views/DataCollect/Collector/Tree/Save/index.vue index 8143fd96..01ec25b3 100644 --- a/src/views/DataCollect/Collector/Tree/Save/index.vue +++ b/src/views/DataCollect/Collector/Tree/Save/index.vue @@ -73,21 +73,11 @@ {{ getTypeTooltip(formData.circuitBreaker.type) }}

- + + + +
+

+ 当前内存布局:{{ + endianMap.get(formData.configuration.endian) + }}{{ endianMap.get(formData.configuration.endianIn) }} +

+

+ 只有4字节数据类型(int32、ieee754 float) + 具有4种内存布局,其它只有ABCD、DCBA两种内存布局(以双字配置为准) +

+
+ (); +const endianMap = new Map([ + ['BIG', 'AB'], + ['LITTLE', 'BA'], +]); + const formData = ref({ channelId: undefined, name: '', @@ -157,6 +187,7 @@ const formData = ref({ unitId: '', type: 'LowerFrequency', endian: 'BIG', + endianIn: 'BIG', }, circuitBreaker: { type: 'LowerFrequency', @@ -203,6 +234,9 @@ const changeCardSelectType = (value: Array) => { const changeCardSelectEndian = (value: Array) => { formData.value.configuration.endian = value[0]; }; +const changeCardSelectEndianIn = (value: Array) => { + formData.value.configuration.endianIn = value[0]; +}; const getChannelNoPaging = async () => { channelListAll.value = Store.get('channelListAll'); channelList.value = channelListAll.value.map((item) => ({ diff --git a/src/views/DataCollect/Collector/data.ts b/src/views/DataCollect/Collector/data.ts index 738c5eb4..3599f0d3 100644 --- a/src/views/DataCollect/Collector/data.ts +++ b/src/views/DataCollect/Collector/data.ts @@ -162,7 +162,12 @@ export const LeftTreeRules = { }, ], type: [{ required: true, message: '请选择处理方式', trigger: 'blur' }], - endian: [{ required: true, message: '请选择高低位切换', trigger: 'blur' }], + endian: [ + { required: true, message: '请选择双字高低位切换', trigger: 'blur' }, + ], + endianIn: [ + { required: true, message: '请选择单字高低位切换', trigger: 'blur' }, + ], }; export const FormTableColumns = [ diff --git a/src/views/init-home/index.vue b/src/views/init-home/index.vue index 5a921a99..c54aa561 100644 --- a/src/views/init-home/index.vue +++ b/src/views/init-home/index.vue @@ -66,11 +66,12 @@ import Role from './Role/index.vue'; import Menu from './Menu/index.vue'; import InitData from './InitData/index.vue'; import { modalState, formState, logoState } from './data/interface'; -import { saveInit } from '@/api/initHome'; +import { getInit, saveInit } from '@/api/initHome'; import { BASE_API_PATH, TOKEN_KEY } from '@/utils/variable'; import { FILE_UPLOAD } from '@/api/comm'; import { LocalStore } from '@/utils/comm'; import { message } from 'jetlinks-ui-components'; +import { useUserInfo } from '@/store/userInfo'; const basicRef = ref(); const roleRef = ref(); const initDataRef = ref(); @@ -81,6 +82,7 @@ const loading = ref(false); */ const activeKey = ref('1'); const spinning = ref(false); +const userInfo = useUserInfo(); // const action = ref(`${BASE_API_PATH}/file/static`); // const headers = ref({ [TOKEN_KEY]: LocalStore.get(TOKEN_KEY) }); /** @@ -128,6 +130,22 @@ const submitData = async () => { } } }; +/** + * 判断是否已有配置 + */ +const judgeInitSet = async () => { + if (userInfo.$state.userInfos.username === 'admin') { + const resp: any = await getInit(); + if (resp.status === 200 && resp.result.length) { + window.location.href = '/'; + } + } else { + window.location.href = '/'; + } +}; +onMounted(() => { + judgeInitSet(); +}); diff --git a/src/views/system/Department/index.vue b/src/views/system/Department/index.vue index 3ebef3e7..7f40433e 100644 --- a/src/views/system/Department/index.vue +++ b/src/views/system/Department/index.vue @@ -1,28 +1,30 @@ @@ -45,19 +47,25 @@ const openDeviceBind = () => { diff --git a/src/views/system/Department/user/index.vue b/src/views/system/Department/user/index.vue index a6e459c1..cb79dd88 100644 --- a/src/views/system/Department/user/index.vue +++ b/src/views/system/Department/user/index.vue @@ -155,6 +155,7 @@ const handleParams = (params: any) => { // 表格 const tableRef = ref>({}); // 表格实例 + const table = reactive({ _selectedRowKeys: [] as string[], diff --git a/src/views/system/Menu/Detail/BasicInfo.vue b/src/views/system/Menu/Detail/BasicInfo.vue index 4d965770..025a1d92 100644 --- a/src/views/system/Menu/Detail/BasicInfo.vue +++ b/src/views/system/Menu/Detail/BasicInfo.vue @@ -101,6 +101,7 @@ message: '请输入页面地址', }, { max: 128, message: '最多可输入128字符' }, + { pattern: /^\// ,message:'请正确填写地址,以/开头'}, ]" > { [env.VITE_APP_BASE_API]: { // target: 'http://192.168.33.22:8800', // target: 'http://192.168.32.244:8881', - target: 'http://120.77.179.54:8844', // 120测试 - // target: 'http://192.168.33.46:8844', // 本地开发环境 + // target: 'http://120.77.179.54:8844', // 120测试 + target: 'http://192.168.33.46:8844', // 本地开发环境 ws: 'ws://192.168.33.46:8844', changeOrigin: true, rewrite: (path) => path.replace(/^\/api/, '')