Browse Source

fix: 合并冲突

sun-chaochao 3 năm trước cách đây
mục cha
commit
8ec3b3876f

+ 3 - 1
src/components/ProTableCard/CardItems/protocol.tsx

@@ -32,7 +32,9 @@ export default (props: ProcotolCardProps) => {
         </div>
         <div className={'card-item-body'}>
           <div className={'card-item-header'}>
-            <span className={'card-item-header-name ellipsis'}>{props.name}</span>
+            <Tooltip title={props.name}>
+              <span className={'card-item-header-name ellipsis'}>{props.name}</span>
+            </Tooltip>
           </div>
           <Row gutter={24}>
             <Col span={12}>

+ 1 - 1
src/pages/device/Instance/Detail/Config/index.tsx

@@ -143,7 +143,7 @@ const Config = () => {
           )}
         </Space>
       </div>
-      <div style={{ paddingLeft: 10 }}>
+      <div>
         {(metadata || []).map((i) => (
           <Descriptions size="small" column={3} key={i.name} bordered title={<h4>{i.name}</h4>}>
             {(i?.properties || []).map((item: any) => (

+ 15 - 10
src/pages/device/Instance/Detail/Diagnose/Status/DiagnosticAdvice.tsx

@@ -23,8 +23,7 @@ const DiagnosticAdvice = (props: Props) => {
     const tab: any = window.open(`${origin}/#${url}?key=access`);
     tab!.onTabSaveSuccess = (value: any) => {
       if (value) {
-        // diagnoseConfig();
-        // 没有权限怎么展示
+        props.close();
       }
     };
   };
@@ -35,6 +34,9 @@ const DiagnosticAdvice = (props: Props) => {
       onCancel={() => {
         props.close();
       }}
+      onOk={() => {
+        props.close();
+      }}
       width={700}
       visible
     >
@@ -49,7 +51,7 @@ const DiagnosticAdvice = (props: Props) => {
               status="default"
               text={
                 <span>
-                  产品-${item.name}规则可能有加密处理,请认真查看
+                  产品-{item.name}规则可能有加密处理,请认真查看
                   <a
                     onClick={() => {
                       jumpUrl();
@@ -69,7 +71,7 @@ const DiagnosticAdvice = (props: Props) => {
               status="default"
               text={
                 <span>
-                  设备-${item.name}规则可能有加密处理,请认真查看
+                  设备-{item.name}规则可能有加密处理,请认真查看
                   <a
                     onClick={() => {
                       jumpUrl();
@@ -83,7 +85,7 @@ const DiagnosticAdvice = (props: Props) => {
             />
           </div>
         ))}
-        {!!data.provider && (
+        {!!data?.provider && (
           <div>
             {data.routes.length > 0 ? (
               <div className={styles.infoItem}>
@@ -99,9 +101,9 @@ const DiagnosticAdvice = (props: Props) => {
                       >
                         设备接入配置
                       </a>
-                      中${nameMap.get(data.provider)}
-                      信息,任意上报一条数据(无设备接入配置查看权限时:请联系管理员根据设备接入配置中$
-                      {URL}信息,任意上报一条数据)。 变量说明:${nameMap.get(data.provider)}
+                      中{nameMap.get(data.provider)}
+                      信息,任意上报一条数据(无设备接入配置查看权限时:请联系管理员根据设备接入配置中
+                      {URL}信息,任意上报一条数据)。 变量说明:{nameMap.get(data.provider)}
                       变量根据网关详情中provider类型判断。
                     </span>
                   }
@@ -113,8 +115,8 @@ const DiagnosticAdvice = (props: Props) => {
                   status="default"
                   text={
                     <span>
-                      请联系管理员提供${nameMap.get(data.provider)}
-                      信息,并根据URL信息任意上报一条数据 变量说明:${nameMap.get(data.provider)}
+                      请联系管理员提供{nameMap.get(data.provider)}
+                      信息,并根据URL信息任意上报一条数据 变量说明:{nameMap.get(data.provider)}
                       变量根据网关详情中provider类型判断。
                     </span>
                   }
@@ -123,6 +125,9 @@ const DiagnosticAdvice = (props: Props) => {
             )}
           </div>
         )}
+        <div className={styles.infoItem}>
+          <Badge status="default" text={'请检查设备是否已开机'} />
+        </div>
       </div>
     </Modal>
   );

+ 1 - 2
src/pages/device/Instance/Detail/Diagnose/Status/ManualInspection.tsx

@@ -86,8 +86,7 @@ const ManualInspection = (props: Props) => {
     <div style={{ backgroundColor: '#f6f6f6', padding: 10 }}>
       {(data?.data?.properties || []).map((item: any) => (
         <div key={item.property}>
-          <span>{item.name}</span>:{' '}
-          <span>{item.type.type !== 'password' ? data?.check[item.property] : '******'}</span>
+          <span>{item.name}</span>: <span>{data?.check[item.property]}</span>
         </div>
       ))}
     </div>

+ 25 - 19
src/pages/device/Instance/Detail/Diagnose/Status/index.tsx

@@ -80,8 +80,10 @@ const Status = observer((props: Props) => {
   const [diagnoseData, setDiagnoseData] = useState<any>({});
   const [artificiaData, setArtificiaData] = useState<any>({});
 
-  const [productTemp, setProductTemp] = useState<any>({});
+  const [productTemp, setProductTemp] = useState<any[]>([]);
+  const [deviceTemp, setDeviceTemp] = useState<any[]>([]);
   const [gatewayTemp, setGatewayTemp] = useState<any>({});
+  const [productItem, setProductItem] = useState<any>({});
 
   const getDetail = (id: string) => {
     service.detail(id).then((response) => {
@@ -159,6 +161,7 @@ const Status = observer((props: Props) => {
       } else {
         service.queryProductState(InstanceModel.detail?.productId || '').then((resp) => {
           if (resp.status === 200) {
+            setProductItem(resp.result);
             if (resp.result.accessId) {
               service.queryGatewayState(resp.result.accessId).then((response: any) => {
                 if (response.status === 200) {
@@ -422,6 +425,7 @@ const Status = observer((props: Props) => {
       } else {
         service.queryProductConfig(proItem.id).then((resp) => {
           if (resp.status === 200) {
+            setProductTemp(resp?.result);
             if (resp.result.length > 0) {
               resp.result.map((item: any, index: number) => {
                 let data: any = {};
@@ -483,6 +487,7 @@ const Status = observer((props: Props) => {
       } else {
         service.queryDeviceConfig(InstanceModel.detail?.id || '').then((resp) => {
           if (resp.status === 200) {
+            setDeviceTemp(resp.result);
             if (resp.result.length > 0) {
               resp.result.map((item: any, index: number) => {
                 let data: any = {};
@@ -620,7 +625,6 @@ const Status = observer((props: Props) => {
       .then(() => diagnoseNetwork())
       .then((resp: any) => {
         product = resp?.product;
-        setProductTemp(resp?.product);
         gateway = resp?.gatewayDetail;
         setGatewayTemp(resp?.gatewayDetail);
         diagnoseProduct(product)
@@ -629,20 +633,14 @@ const Status = observer((props: Props) => {
           .then(() => {
             diagnoseDeviceAuthConfig().then(() => {
               diagnoseDeviceAccess(gateway).then(() => {
-                if (InstanceModel.detail.state?.value === 'online') {
-                  const a = Object.keys(DiagnoseStatusModel.status).find((item: any) => {
-                    return item.status !== 'success';
-                  });
-                  if (!!a) {
-                    Store.set('diagnose-status', {
-                      list: DiagnoseStatusModel.list,
-                      status: DiagnoseStatusModel.status,
-                    });
-                    props.onChange('success');
-                  } else {
-                    props.onChange('error');
-                  }
+                if (InstanceModel.detail.state?.value !== 'online') {
+                  props.onChange('error');
                 } else {
+                  Store.set('diagnose-status', {
+                    list: DiagnoseStatusModel.list,
+                    status: DiagnoseStatusModel.status,
+                  });
+                  props.onChange('success');
                 }
               });
             });
@@ -668,23 +666,31 @@ const Status = observer((props: Props) => {
     const flag = Object.keys(data).every((item: any) => {
       return data[item]?.status === 'success';
     });
-    if (flag) {
+    if (flag && InstanceModel.detail.state?.value !== 'online') {
       // 展示诊断建议
       if (
-        InstanceModel.detail.state?.value !== 'online' &&
         gatewayTemp.provider !== 'mqtt-server-gateway' &&
         gatewayList.includes(gatewayTemp.provider)
       ) {
         service.queryProcotolDetail(gatewayTemp.provider, gatewayTemp.transport).then((resp1) => {
           setDiagnoseData({
             product: productTemp,
-            device: InstanceModel.detail,
-            id: productTemp.id,
+            device: deviceTemp,
+            id: productItem.id,
             provider: gatewayTemp.provider,
             routes: resp1.result?.routes || [],
           });
           setDiagnoseVisible(true);
         });
+      } else {
+        setDiagnoseData({
+          product: productTemp,
+          device: deviceTemp,
+          id: productItem.i,
+          provider: gatewayTemp?.provider,
+          routes: [],
+        });
+        setDiagnoseVisible(true);
       }
     }
   }, [DiagnoseStatusModel.status]);

+ 7 - 4
src/pages/device/Instance/Detail/Diagnose/index.tsx

@@ -1,4 +1,4 @@
-import { Badge, Card, Col, Row } from 'antd';
+import { Badge, Card, Col, Row, Tooltip } from 'antd';
 import type { ReactNode } from 'react';
 import { useEffect, useState } from 'react';
 import Message from './Message';
@@ -87,9 +87,12 @@ const Diagnose = () => {
             style={{ fontWeight: 400 }}
           >
             {message === 'disabled' ? (
-              <span style={{ color: statusColor.get(message) }}>
-                <Badge color={statusColor.get(message)} /> 连接中
-              </span>
+              <Tooltip title={'设备未上线时消息通信功不能使用'}>
+                <span style={{ color: statusColor.get(message) }}>
+                  <Badge color={statusColor.get(message)} />
+                  {status === 's-error' || status === 'waiting' ? '等待设备连接' : '连接中'}
+                </span>
+              </Tooltip>
             ) : (
               <>
                 <div>

+ 1 - 1
src/pages/device/Instance/Detail/Reation/Edit.tsx

@@ -63,7 +63,7 @@ const Edit = (props: Props) => {
         'x-decorator': 'FormItem',
         'x-component': 'Select',
         'x-component-props': {
-          placeholder: '请选择关联方',
+          placeholder: `请选择${item.relationName}`,
           showSearch: true,
           showArrow: true,
           mode: 'multiple',

+ 53 - 26
src/pages/device/Instance/Detail/Running/Property/Indicators.tsx

@@ -10,13 +10,11 @@ import {
   NumberPicker,
   Select,
 } from '@formily/antd';
-import { createForm } from '@formily/core';
+import { createForm, onFieldReact } from '@formily/core';
 import { createSchemaField } from '@formily/react';
-
 import type { PropertyMetadata } from '@/pages/device/Product/typings';
 import { useEffect, useState } from 'react';
 import { InstanceModel, service } from '@/pages/device/Instance';
-
 interface Props {
   data: Partial<PropertyMetadata>;
   onCancel: () => void;
@@ -42,6 +40,31 @@ const Indicators = (props: Props) => {
     initialValues: {
       metrics: metrics,
     },
+    effects: () => {
+      onFieldReact('metrics.*.*', (field, form1) => {
+        const type = data.valueType?.type;
+        form1.setFieldState('metrics.*.space.value.*', (state) => {
+          state.componentType = componentMap[type || ''] || 'Input';
+          if (type === 'date') {
+            state.componentProps = {
+              showTime: true,
+            };
+          } else if (type === 'boolean') {
+            state.componentType = 'Select';
+            state.dataSource = [
+              {
+                label: data.valueType?.trueText,
+                value: String(data.valueType?.trueValue),
+              },
+              {
+                label: data.valueType?.falseText,
+                value: String(data.valueType?.falseValue),
+              },
+            ];
+          }
+        });
+      });
+    },
   });
 
   const SchemaField = createSchemaField({
@@ -106,19 +129,6 @@ const Indicators = (props: Props) => {
                       dependencies: ['..range', data.valueType?.type],
                       fulfill: {
                         state: {
-                          dataSource:
-                            data.valueType?.type === 'boolean'
-                              ? [
-                                  {
-                                    label: data.valueType?.trueText,
-                                    value: data.valueType?.trueValue,
-                                  },
-                                  {
-                                    label: data.valueType?.falseText,
-                                    value: data.valueType?.falseValue,
-                                  },
-                                ]
-                              : [],
                           decoratorProps: {
                             gridSpan: '{{!!$deps[0]?5:$deps[1]==="boolean"?12:10}}',
                           },
@@ -163,17 +173,32 @@ const Indicators = (props: Props) => {
     },
   };
 
-  console.log(data);
-  console.log(InstanceModel.detail);
-
   useEffect(() => {
     if (InstanceModel.detail.id && data.id) {
       service.queryMetric(InstanceModel.detail.id || '', data.id || '').then((resp) => {
         if (resp.status === 200) {
           if ((resp?.result || []).length > 0) {
-            setMetrics(resp.result);
+            const list = resp.result.map((item: any) => {
+              return {
+                ...item,
+                value: item.value.split(','),
+              };
+            });
+            setMetrics(list);
           } else {
-            setMetrics(data.expands?.metrics || []);
+            const type = data.valueType?.type;
+            if (type === 'boolean') {
+              const list = data.expands?.metrics.map((item: any) => {
+                const value = (item?.value || {}).map((i: any) => String(i)) || {};
+                return {
+                  ...item,
+                  value,
+                };
+              });
+              setMetrics(list || []);
+            } else {
+              setMetrics(data.expands?.metrics || []);
+            }
           }
         }
       });
@@ -188,11 +213,13 @@ const Indicators = (props: Props) => {
       width={600}
       onOk={async () => {
         const params = (await form.submit()) as any;
-        const resp = await service.saveMetric(
-          InstanceModel.detail.id || '',
-          data.id || '',
-          params.metrics,
-        );
+        const list = (params?.metrics || []).map((item: any) => {
+          return {
+            ...item,
+            value: item.value.join(','),
+          };
+        });
+        const resp = await service.saveMetric(InstanceModel.detail.id || '', data.id || '', list);
         if (resp.status === 200) {
           message.success('操作成功!');
           props.onCancel();

+ 54 - 30
src/pages/device/Instance/Detail/index.tsx

@@ -263,36 +263,60 @@ const InstanceDetail = observer(() => {
           <Divider type="vertical" />
           <Space>
             {deviceStatus.get(InstanceModel.detail?.state?.value)}
-            <PermissionButton
-              type={'link'}
-              key={'state'}
-              popConfirm={{
-                title:
-                  InstanceModel.detail?.state?.value !== 'notActive'
-                    ? '确认断开连接'
-                    : '确认启用设备',
-                onConfirm: async () => {
-                  if (InstanceModel.detail?.state?.value !== 'notActive') {
-                    await service.undeployDevice(params.id);
-                  } else {
-                    await service.deployDevice(params.id);
-                  }
-                  message.success(
-                    intl.formatMessage({
-                      id: 'pages.data.option.success',
-                      defaultMessage: '操作成功!',
-                    }),
-                  );
-                  getDetail(params.id);
-                },
-              }}
-              isPermission={permission.action}
-              tooltip={{
-                title: InstanceModel.detail?.state?.value !== 'notActive' ? '断开连接' : '启用设备',
-              }}
-            >
-              {InstanceModel.detail?.state?.value !== 'notActive' ? '断开连接' : '启用设备'}
-            </PermissionButton>
+            {InstanceModel.detail?.state?.value === 'notActive' && (
+              <PermissionButton
+                type={'link'}
+                key={'state'}
+                popConfirm={{
+                  title: '确认启用设备',
+                  onConfirm: async () => {
+                    const resp = await service.deployDevice(params.id);
+                    if (resp.status === 200) {
+                      message.success(
+                        intl.formatMessage({
+                          id: 'pages.data.option.success',
+                          defaultMessage: '操作成功!',
+                        }),
+                      );
+                      getDetail(params.id);
+                    }
+                  },
+                }}
+                isPermission={permission.action}
+                tooltip={{
+                  title: '启用设备',
+                }}
+              >
+                启用设备
+              </PermissionButton>
+            )}
+            {InstanceModel.detail?.state?.value === 'online' && (
+              <PermissionButton
+                type={'link'}
+                key={'state'}
+                popConfirm={{
+                  title: '确认断开连接',
+                  onConfirm: async () => {
+                    const resp = await service.disconnectDevice(params.id);
+                    if (resp.status === 200) {
+                      message.success(
+                        intl.formatMessage({
+                          id: 'pages.data.option.success',
+                          defaultMessage: '操作成功!',
+                        }),
+                      );
+                      getDetail(params.id);
+                    }
+                  },
+                }}
+                isPermission={permission.action}
+                tooltip={{
+                  title: '断开连接',
+                }}
+              >
+                断开连接
+              </PermissionButton>
+            )}
           </Space>
         </>
       }

+ 2 - 1
src/pages/device/Instance/Import/index.tsx

@@ -12,6 +12,7 @@ import SystemConst from '@/utils/const';
 import Token from '@/utils/token';
 import { EventSourcePolyfill } from 'event-source-polyfill';
 import { downloadFile } from '@/utils/util';
+import encodeQuery from '@/utils/encodeQuery';
 
 interface Props {
   visible: boolean;
@@ -176,7 +177,7 @@ const Import = (props: Props) => {
   });
 
   useEffect(() => {
-    service.getProductList({ paging: false }).then((resp) => {
+    service.getProductList(encodeQuery({ paging: false, terms: { state: 1 } })).then((resp) => {
       if (resp.status === 200) {
         const list = resp.result.map((item: { name: any; id: any }) => ({
           label: item.name,

+ 19 - 9
src/pages/device/Instance/Save/index.tsx

@@ -5,6 +5,7 @@ import { useEffect, useState } from 'react';
 import { useIntl } from '@@/plugin-locale/localeExports';
 import { UploadImage } from '@/components';
 import { debounce } from 'lodash';
+import encodeQuery from '@/utils/encodeQuery';
 
 interface Props {
   visible: boolean;
@@ -31,15 +32,24 @@ const Save = (props: Props) => {
   const intl = useIntl();
 
   useEffect(() => {
-    service.getProductList({ paging: false }).then((resp: any) => {
-      if (resp.status === 200) {
-        const list = resp.result.map((item: { name: any; id: any }) => ({
-          label: item.name,
-          value: item.id,
-        }));
-        setProductList(list);
-      }
-    });
+    service
+      .getProductList(
+        encodeQuery({
+          paging: false,
+          terms: {
+            state: 1,
+          },
+        }),
+      )
+      .then((resp: any) => {
+        if (resp.status === 200) {
+          const list = resp.result.map((item: { name: any; id: any }) => ({
+            label: item.name,
+            value: item.id,
+          }));
+          setProductList(list);
+        }
+      });
   }, []);
 
   const intlFormat = (

+ 7 - 0
src/pages/device/Instance/service.ts

@@ -33,6 +33,13 @@ class Service extends BaseService<DeviceInstance> {
       data: params,
     });
 
+  // 断开连接
+  public disconnectDevice = (deviceId: string, params?: any) =>
+    request(`/${SystemConst.API_BASE}/device-instance/${deviceId}/disconnect`, {
+      method: 'POST',
+      data: params,
+    });
+
   // 批量激活设备
   public batchDeployDevice = (params: any) =>
     request(`/${SystemConst.API_BASE}/device-instance/batch/_deploy`, {

+ 19 - 12
src/pages/device/Product/Detail/Access/index.tsx

@@ -338,7 +338,6 @@ const Access = () => {
                   请先
                   <Button
                     type="link"
-                    // disabled={!!(productModel.current?.count && productModel.current?.count > 0)}
                     onClick={() => {
                       setConfigVisible(true);
                     }}
@@ -362,20 +361,28 @@ const Access = () => {
                   data={
                     <span>
                       接入方式
-                      <Button
-                        size="small"
-                        type="primary"
-                        ghost
-                        style={{ marginLeft: 20 }}
-                        disabled={
+                      <Tooltip
+                        title={
                           !!(productModel.current?.count && productModel.current?.count > 0)
+                            ? '产品下有设备实例时不能更换接入方式'
+                            : ''
                         }
-                        onClick={() => {
-                          setConfigVisible(true);
-                        }}
                       >
-                        更换
-                      </Button>
+                        <Button
+                          size="small"
+                          type="primary"
+                          ghost
+                          style={{ marginLeft: 20 }}
+                          disabled={
+                            !!(productModel.current?.count && productModel.current?.count > 0)
+                          }
+                          onClick={() => {
+                            setConfigVisible(true);
+                          }}
+                        >
+                          更换
+                        </Button>
+                      </Tooltip>
                     </span>
                   }
                 />

+ 3 - 1
src/pages/link/AccessConfig/Detail/Provider/index.less

@@ -1,9 +1,11 @@
 .images {
+  display: flex;
+  align-items: center;
+  justify-content: center;
   width: 64px;
   height: 64px;
   color: white;
   font-size: 12px;
-  line-height: 64px;
   text-align: center;
   background: linear-gradient(
     128.453709216706deg,

+ 2 - 2
src/pages/link/AccessConfig/Detail/Provider/index.tsx

@@ -50,7 +50,7 @@ const Provider = (props: Props) => {
                     <div className={styles.images}>{item.name}</div>
                     <div style={{ margin: '10px', width: 'calc(100% - 84px)' }}>
                       <div style={{ fontWeight: 600 }}>{item.name}</div>
-                      <div className={styles.desc}>{item.description || '--'}</div>
+                      <div className={styles.desc}>{item?.description || '--'}</div>
                     </div>
                   </div>
                   <div style={{ width: '70px' }}>
@@ -92,7 +92,7 @@ const Provider = (props: Props) => {
                     <div className={styles.images}>{item.name}</div>
                     <div style={{ margin: '10px', width: 'calc(100% - 84px)' }}>
                       <div style={{ fontWeight: 600 }}>{item.name}</div>
-                      <div className={styles.desc}>{item.description}</div>
+                      <div className={styles.desc}>{item.description || '--'}</div>
                     </div>
                   </div>
                   <div style={{ width: '70px' }}>

+ 11 - 2
src/pages/link/Protocol/index.tsx

@@ -2,7 +2,7 @@ import { PageContainer } from '@ant-design/pro-layout';
 import type { ActionType, ProColumns } from '@jetlinks/pro-table';
 import type { ProtocolItem } from '@/pages/link/Protocol/typings';
 import { Badge, message } from 'antd';
-import { useRef, useState } from 'react';
+import { useEffect, useRef, useState } from 'react';
 import {
   DeleteOutlined,
   EditOutlined,
@@ -11,7 +11,7 @@ import {
   StopOutlined,
 } from '@ant-design/icons';
 import Service from '@/pages/link/Protocol/service';
-import { useIntl } from 'umi';
+import { useIntl, useLocation } from 'umi';
 import SearchComponent from '@/components/SearchComponent';
 import { PermissionButton, ProTableCard } from '@/components';
 import ProcotolCard from '@/components/ProTableCard/CardItems/protocol';
@@ -161,6 +161,15 @@ const Protocol = () => {
     },
   ];
 
+  const location = useLocation();
+
+  useEffect(() => {
+    if ((location as any).query?.save === 'true') {
+      setCurrent(undefined);
+      setVisible(true);
+    }
+  }, []);
+
   return (
     <PageContainer>
       <SearchComponent<ProtocolItem>

+ 20 - 2
src/pages/notice/Template/Detail/index.tsx

@@ -72,6 +72,9 @@ const Detail = observer(() => {
   // 正则提取${}里面的值
   const pattern = /(?<=\$\{).*?(?=\})/g;
 
+  // 提取微信服务号里面的值 {{}}
+  const weixinPattern = /(?<=\{\{).*?(?=\.DATA}})/g;
+
   const getConfig = (provider1: string) =>
     configService
       .queryNoPagingPost({
@@ -118,6 +121,15 @@ const Detail = observer(() => {
                 height: '100px',
               });
             }
+            const _provider = field.query('provider').value();
+            if (_provider === 'corpMessage') {
+              field.componentProps = {
+                disabled: true,
+                rows: 5,
+                placeholder:
+                  '变量格式:${name};\n 示例:尊敬的${name},${time}有设备触发告警,请注意处理',
+              };
+            }
           });
           onFieldValueChange('provider', (field, form1) => {
             const value = field.value;
@@ -259,9 +271,15 @@ const Detail = observer(() => {
             }
           });
           onFieldValueChange('template.message', (field, form1) => {
+            const _provider = field.query('provider').value();
+
             const value = (field as Field).value;
             const idList =
-              (typeof value === 'string' && value?.match(pattern)?.filter((i: string) => i)) || [];
+              (typeof value === 'string' &&
+                value
+                  ?.match(_provider === 'officialMessage' ? weixinPattern : pattern)
+                  ?.filter((i: string) => i)) ||
+              [];
 
             if (id === 'email') {
               const subject = field.query('template.subject');
@@ -272,7 +290,6 @@ const Detail = observer(() => {
                 idList.unshift(...titleList);
               }
             }
-            const _provider = field.query('provider').value();
             if (_provider === 'dingTalkRobotWebHook') {
               const title = field.query('template.markdown.title').value();
               const titleList = title?.match(pattern)?.filter((i: string) => i);
@@ -715,6 +732,7 @@ const Detail = observer(() => {
                     'x-decorator-props': {
                       tooltip: '服务号消息模版标题',
                     },
+                    'x-disabled': true,
                   },
                 },
                 'x-reactions': {

+ 6 - 1
src/pages/rule-engine/Scene/TriggerTerm/index.tsx

@@ -14,7 +14,7 @@ import {
   TreeSelect,
 } from '@formily/antd';
 import { ISchema } from '@formily/json-schema';
-import { createForm, onFieldValueChange } from '@formily/core';
+import { createForm, onFieldValueChange, onFormValuesChange } from '@formily/core';
 import { forwardRef, useImperativeHandle, useMemo } from 'react';
 import FTermArrayCards from '@/components/FTermArrayCards';
 import FTermTypeSelect from '@/components/FTermTypeSelect';
@@ -40,6 +40,11 @@ const TriggerTerm = (props: Props, ref: any) => {
         validateFirst: true,
         initialValues: props.value,
         effects() {
+          onFormValuesChange(async (f) => {
+            if (props.onChange) {
+              props.onChange(await f.submit());
+            }
+          });
           onFieldValueChange('trigger.*.terms.*.column', (field, form1) => {
             const operator = field.query('.termType');
             // 找到选中的