xieyonghong 3 سال پیش
والد
کامیت
a61fef014d
2فایلهای تغییر یافته به همراه17 افزوده شده و 2 حذف شده
  1. 1 1
      src/components/BaseCrud/save/index.tsx
  2. 16 1
      src/components/Metadata/JsonParam/index.tsx

+ 1 - 1
src/components/BaseCrud/save/index.tsx

@@ -135,7 +135,7 @@ const Save = <T extends Record<string, any>>(props: Props<T>) => {
       if (!callback) return;
       await save();
       if (typeof callback === 'function') {
-        callback(form);
+        callback(form.values);
       }
     });
     return () => {

+ 16 - 1
src/components/Metadata/JsonParam/index.tsx

@@ -9,7 +9,7 @@ import {
 } from '@formily/antd';
 import { createSchemaField } from '@formily/react';
 import type { ISchema } from '@formily/json-schema';
-import { DataTypeList } from '@/pages/device/data';
+import { DataTypeList, DateTypeList } from '@/pages/device/data';
 import { Store } from 'jetlinks-store';
 
 // 不算是自定义组件。只是抽离了JSONSchema
@@ -111,6 +111,21 @@ const JsonParam = (props: Props) => {
                         },
                       },
                     },
+                    format: {
+                      title: '时间格式',
+                      'x-decorator': 'FormItem',
+                      'x-component': 'Select',
+                      enum: DateTypeList,
+                      'x-visible': false,
+                      'x-reactions': {
+                        dependencies: ['..valueType.type'],
+                        fulfill: {
+                          state: {
+                            visible: "{{['date'].includes($deps[0])}}",
+                          },
+                        },
+                      },
+                    },
                     expands: {
                       type: 'object',
                       properties: {