Browse Source

feat: merge

xieyonghong 4 years ago
parent
commit
b80640a210

+ 6 - 2
src/components/FRuleEditor/Editor/index.tsx

@@ -94,8 +94,9 @@ const Editor = (props: Props) => {
   };
 
   const handleInsertCode = (value: string) => {
+    console.log(value, 'values');
     const editor = editorRef.current;
-    if (!editor) return;
+    if (!editor || !value) return;
     const position = editor.getPosition()!;
     editor?.executeEdits(State.code, [
       {
@@ -113,8 +114,11 @@ const Editor = (props: Props) => {
   useEffect(() => {
     const subscription = Store.subscribe('add-operator-value', handleInsertCode);
     return () => subscription.unsubscribe();
-  }, []);
+  }, [props.mode]);
 
+  useEffect(() => {
+    Store.set('add-operator-value', undefined);
+  }, []);
   return (
     <div className={styles.box}>
       <div className={styles.top}>

+ 4 - 0
src/components/SearchComponent/index.tsx

@@ -153,6 +153,10 @@ const SearchComponent = <T extends Record<string, any>>(props: Props<T>) => {
               f.setFieldState(typeFiled.query('.termType'), async (state) => {
                 state.value = 'gt';
               });
+            } else {
+              f.setFieldState(typeFiled.query('.value'), async (state) => {
+                state.componentType = 'Input';
+              });
             }
           });
         },

+ 1 - 1
src/locales/zh-CN/pages.ts

@@ -253,7 +253,7 @@ export default {
   'pages.device.instance.status.onLine': '在线',
   'pages.device.instance.deleteTip': '已启用的设备无法删除',
   'pages.device.instanceDetail.deviceType': '设备类型',
-  'pages.device.instanceDetail.transportProtocol': '接协议',
+  'pages.device.instanceDetail.transportProtocol': '接协议',
   'pages.device.instanceDetail.protocolName': '消息协议',
   'pages.device.instanceDetail.createTime': '创建时间',
   'pages.device.instanceDetail.registerTime': '注册时间',

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

@@ -54,7 +54,7 @@ const Info = observer(() => {
           <Descriptions.Item
             label={intl.formatMessage({
               id: 'pages.device.instanceDetail.transportProtocol',
-              defaultMessage: '接协议',
+              defaultMessage: '接协议',
             })}
           >
             {InstanceModel.detail?.protocolName}

+ 4 - 1
src/pages/device/Product/Detail/BaseInfo/index.tsx

@@ -68,7 +68,10 @@ const BaseInfo = () => {
   const getDetailInfo = () => {
     service.getProductDetail(id || '').subscribe((data) => {
       if (data) {
-        productModel.current = data;
+        productModel.current = {
+          ...productModel.current,
+          ...data,
+        };
       }
     });
   };

+ 36 - 24
src/pages/link/Protocol/index.tsx

@@ -106,33 +106,45 @@ const Protocol = () => {
             </Popconfirm>
           </a>
         ),
-        <Button key="delete" type="link" disabled={record.state !== 1}>
-          <Popconfirm
-            title={intl.formatMessage({
-              id: 'pages.data.option.remove.tips',
-              defaultMessage: '确认删除?',
-            })}
-            onConfirm={async () => {
-              await service.remove(record.id);
-              message.success(
-                intl.formatMessage({
-                  id: 'pages.data.option.success',
-                  defaultMessage: '操作成功!',
-                }),
-              );
-              actionRef.current?.reload();
-            }}
-          >
-            <Tooltip
+        <Tooltip
+          key="delete"
+          title={
+            record.state !== 1
+              ? intl.formatMessage({
+                  id: 'pages.data.option.remove',
+                  defaultMessage: '删除',
+                })
+              : '请先禁用该组件,再删除。'
+          }
+        >
+          <Button style={{ padding: 0 }} key="delete" type="link" disabled={record.state !== 1}>
+            <Popconfirm
               title={intl.formatMessage({
-                id: 'pages.data.option.remove',
-                defaultMessage: '删除',
+                id: 'pages.data.option.remove.tips',
+                defaultMessage: '确认删除?',
               })}
+              onConfirm={async () => {
+                await service.remove(record.id);
+                message.success(
+                  intl.formatMessage({
+                    id: 'pages.data.option.success',
+                    defaultMessage: '操作成功!',
+                  }),
+                );
+                actionRef.current?.reload();
+              }}
             >
-              <DeleteOutlined />
-            </Tooltip>
-          </Popconfirm>
-        </Button>,
+              <Tooltip
+                title={intl.formatMessage({
+                  id: 'pages.data.option.remove',
+                  defaultMessage: '删除',
+                })}
+              >
+                <DeleteOutlined />
+              </Tooltip>
+            </Popconfirm>
+          </Button>
+        </Tooltip>,
       ],
     },
   ];

+ 5 - 6
src/pages/system/Department/index.tsx

@@ -1,24 +1,23 @@
 // 部门管理
 import { PageContainer } from '@ant-design/pro-layout';
-import ProTable from '@jetlinks/pro-table';
 import type { ActionType, ProColumns } from '@jetlinks/pro-table';
+import ProTable from '@jetlinks/pro-table';
 import { useEffect, useRef, useState } from 'react';
-import { useIntl } from 'umi';
+import { Link, useIntl, useLocation } from 'umi';
 import { Button, message, Popconfirm, Tooltip } from 'antd';
 import {
+  DeleteOutlined,
   EditOutlined,
-  PlusOutlined,
+  MedicineBoxOutlined,
   PlusCircleOutlined,
+  PlusOutlined,
   TeamOutlined,
-  MedicineBoxOutlined,
-  DeleteOutlined,
 } from '@ant-design/icons';
 import Service from '@/pages/system/Department/service';
 import type { ISchema } from '@formily/json-schema';
 import type { DepartmentItem } from '@/pages/system/Department/typings';
 import { observer } from '@formily/react';
 import { model } from '@formily/reactive';
-import { Link, useLocation } from 'umi';
 import Save from './save';
 import SearchComponent from '@/components/SearchComponent';