瀏覽代碼

[Mod 0000] 历史数据组件是否支持多选将由配置项决定

houzekong 4 天之前
父節點
當前提交
0b8baf20c4

+ 1 - 1
src/views/vent/comment/history/HistoryTable.vue

@@ -108,7 +108,7 @@
    * @param deviceOptions 设备下拉框对应的选项
    */
   function initTable(deviceCodes: string[], deviceOptions: any[], dictOptions: any[]) {
-    const defaultSchemas = getDefaultSchemas(dictOptions, deviceOptions);
+    const defaultSchemas = getDefaultSchemas(dictOptions, deviceOptions, () => search());
     for (const code of deviceCodes) {
       const cols = getTableHeaderColumns(code);
       if (cols.length) {

+ 8 - 8
src/views/vent/comment/history/history.data.ts

@@ -10,7 +10,11 @@ import { get } from 'lodash-es';
  * @param deviceOptions 用于初始化设备下拉框
  * @returns
  */
-export const getDefaultSchemas: (dictOptions: any[], deviceOptions: any[]) => FormSchema[] = (dictOptions: any[], deviceOptions: any[]) => {
+export const getDefaultSchemas: (dictOptions: any[], deviceOptions: any[], onDeviceChange?: Function) => FormSchema[] = (
+  dictOptions: any[],
+  deviceOptions: any[],
+  onDeviceChange?: Function
+) => {
   const device = get(deviceOptions, '[0].value', '');
   const dictcode = get(dictOptions, '[0].value', '');
   const isRedis = get(deviceOptions, '[0].stationtype', 'redis') === 'redis';
@@ -50,16 +54,12 @@ export const getDefaultSchemas: (dictOptions: any[], deviceOptions: any[]) => Fo
       field: 'gdeviceids',
       component: 'Select',
       required: true,
-      defaultValue: isRedis ? device : [device],
+      defaultValue: VENT_PARAM.historyIsMultiple ? [device] : device,
       componentProps: {
         options: deviceOptions,
-        // onChange: (e, option) => {
-        mode: isRedis ? undefined : 'multiple',
+        mode: VENT_PARAM.historyIsMultiple ? 'multiple' : undefined,
         maxTagCount: 'responsive',
-        //   nextTick(async () => {
-        //     await getDataSource();
-        //   });
-        // },
+        onChange: onDeviceChange,
       },
       colProps: {
         span: 6,

+ 1 - 1
src/views/vent/monitorManager/comment/HistoryTable.vue

@@ -254,7 +254,7 @@
       stationType.value = deviceOptions.value[0]['stationtype'];
       historyType.value = deviceOptions.value[0]['strtype'] || deviceOptions.value[0]['devicekind'];
     }
-    if (stationType.value !== 'redis') {
+    if (VENT_PARAM.historyIsMultiple) {
       await getForm().setFieldsValue({
         gdeviceids: [props.deviceId ? props.deviceId : deviceOptions.value[0] ? deviceOptions.value[0]['value'] : ''],
       });

+ 11 - 0
types/global.d.ts

@@ -1,6 +1,17 @@
 import type { ComponentRenderProxy, VNode, VNodeChild, ComponentPublicInstance, FunctionalComponent, PropType as VuePropType } from 'vue';
 
 declare global {
+  const VENT_PARAM: {
+    simulatedPassword: string;
+    showReport: boolean;
+    isoOpenSso: string;
+    modalText: string;
+    productionCrlPlatformUrl: string;
+    safetyCrlPlatformUrl: string;
+    gasControlMock: boolean;
+    historyIsMultiple: boolean;
+  };
+
   const __APP_INFO__: {
     pkg: {
       name: string;