浏览代码

[Mod 0000] 历史数据组件多设备查询不再对redis分站做支持

houzekong 1 月之前
父节点
当前提交
63b94c0bec

+ 1 - 1
src/views/vent/comment/history/history.api.ts

@@ -36,7 +36,7 @@ export const list = (deviceCode: string, deviceInfo: any, formData: any, paginat
         column: 'createTime',
         startTime: formData.ttime_begin,
         endTime: formData.ttime_end,
-        deviceId: formData.gdeviceid,
+        deviceId: formData.gdeviceids,
         strtype: deviceCode,
         interval: intervalMap.get(formData['skip']) || '1h',
         isEmployee: deviceCode.startsWith('vehicle') ? false : true,

+ 3 - 2
src/views/vent/comment/history/history.data.ts

@@ -46,11 +46,12 @@ export const getDefaultSchemas: (dictOptions: any[], deviceOptions: any[]) => Fo
     field: 'gdeviceids',
     component: 'Select',
     required: true,
-    defaultValue: [get(deviceOptions, '[0].value', '')],
+    defaultValue:
+      get(deviceOptions, '[0].stationtype', 'redis') === 'redis' ? get(deviceOptions, '[0].value', '') : [get(deviceOptions, '[0].value', '')],
     componentProps: {
       options: deviceOptions,
       // onChange: (e, option) => {
-      mode: 'multiple',
+      mode: get(deviceOptions, '[0].stationtype', 'redis') === 'redis' ? undefined : 'multiple',
       maxTagCount: 'responsive',
       //   nextTick(async () => {
       //     await getDataSource();

+ 15 - 5
src/views/vent/monitorManager/comment/HistoryTable.vue

@@ -257,6 +257,21 @@
     await getForm().setFieldsValue({
       gdeviceids: props.deviceId ? [props.deviceId] : deviceOptions.value[0] ? [deviceOptions.value[0]['value']] : [''],
     });
+    if (stationType.value !== 'redis') {
+      await getForm().updateSchema({
+        field: 'gdeviceids',
+        defaultValue: [props.deviceId ? props.deviceId : deviceOptions.value[0] ? deviceOptions.value[0]['value'] : ''],
+        componentProps: {
+          mode: 'multiple',
+          maxTagCount: 'responsive',
+        },
+      });
+    } else {
+      await getForm().updateSchema({
+        field: 'gdeviceids',
+        defaultValue: props.deviceId ? props.deviceId : deviceOptions.value[0] ? deviceOptions.value[0]['value'] : '',
+      });
+    }
   }
 
   function resetFormParam() {
@@ -380,15 +395,12 @@
                   label: computed(() => `${deviceKide.value.startsWith('location') ? '查询人员' : '查询设备'}`),
                   field: 'gdeviceids',
                   component: 'Select',
-                  defaultValue: props.deviceId ? [props.deviceId] : deviceOptions.value[0] ? [deviceOptions.value[0]['value']] : [''],
                   required: true,
                   componentProps: {
                     showSearch: true,
                     filterOption: (input: string, option: any) => {
                       return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
                     },
-                    mode: 'multiple',
-                    maxTagCount: 'responsive',
                     options: deviceOptions,
                     onChange: (e, option) => {
                       if (option && (option['strinstallpos'] || option['strtype'] || option['devicekind']))
@@ -508,8 +520,6 @@
   onMounted(async () => {
     await getDeviceList();
     if (deviceOptions.value[0]) {
-      stationType.value = deviceOptions.value[0]['stationtype'];
-      historyType.value = deviceOptions.value[0]['strtype'] || deviceOptions.value[0]['devicekind'];
       nextTick(async () => {
         await getDataSource();
       });