Ver código fonte

fix: bug#8294

xieyonghong 3 anos atrás
pai
commit
470fa879b5

+ 11 - 0
src/pages/device/components/Metadata/Base/columns.tsx

@@ -2,6 +2,12 @@ import type { ProColumns } from '@jetlinks/pro-table';
 import type { MetadataItem } from '@/pages/device/Product/typings';
 import { Tag } from 'antd';
 
+const SourceMap = {
+  device: '设备',
+  manual: '手动',
+  rule: '规则',
+};
+
 const BaseColumns: ProColumns<MetadataItem>[] = [
   // {
   //   dataIndex: 'index',
@@ -66,6 +72,11 @@ const PropertyColumns: ProColumns<MetadataItem>[] = BaseColumns.concat([
     render: (text: any) => text?.type,
   },
   {
+    title: '数据类型',
+    dataIndex: 'expands',
+    render: (text: any) => SourceMap[text?.source],
+  },
+  {
     title: '读写类型',
     dataIndex: 'expands',
     render: (text: any) =>

+ 2 - 1
src/pages/device/components/Metadata/Base/index.tsx

@@ -121,6 +121,7 @@ const BaseMetadata = observer((props: Props) => {
 
   const initData = useCallback(async () => {
     const result = await DB.getDB().table(`${type}`).toArray();
+    console.log(result);
     setData(result.sort((a, b) => b?.sortsIndex - a?.sortsIndex));
   }, [param.id, type]);
 
@@ -178,7 +179,7 @@ const BaseMetadata = observer((props: Props) => {
           },
         }}
         toolBarRender={() => [
-          props.type === 'properties' && (
+          props.type === 'properties' && target === 'device' && (
             <PermissionButton
               isPermission={props.permission.update}
               onClick={() => {