fix: view collection source field (#2483)
This commit is contained in:
		
							parent
							
								
									b91a923fe0
								
							
						
					
					
						commit
						576ff8e52b
					
				@ -90,9 +90,11 @@ const PreviewCom = (props) => {
 | 
			
		||||
              }
 | 
			
		||||
            });
 | 
			
		||||
            field.value = fieldsData;
 | 
			
		||||
            setDataSource(fieldsData);
 | 
			
		||||
            form.setValuesIn('sources', data.data?.sources);
 | 
			
		||||
            setSourceCollections(data.data?.sources);
 | 
			
		||||
            setTimeout(() => {
 | 
			
		||||
              setDataSource(fieldsData);
 | 
			
		||||
              form.setValuesIn('sources', data.data?.sources);
 | 
			
		||||
              setSourceCollections(data.data?.sources);
 | 
			
		||||
            });
 | 
			
		||||
          }
 | 
			
		||||
        }).catch;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -71,35 +71,37 @@ export const PreviewTable = (props) => {
 | 
			
		||||
      });
 | 
			
		||||
  };
 | 
			
		||||
  return (
 | 
			
		||||
    <Spin spinning={loading}>
 | 
			
		||||
    <Spin spinning={loading} key="preview">
 | 
			
		||||
      <div
 | 
			
		||||
        style={{
 | 
			
		||||
          marginBottom: 22,
 | 
			
		||||
        }}
 | 
			
		||||
      >
 | 
			
		||||
        {previewColumns?.length > 0 && [
 | 
			
		||||
          <div
 | 
			
		||||
            className="ant-formily-item-label"
 | 
			
		||||
            style={{ marginTop: 24, display: 'flex', padding: '0 0 8px' }}
 | 
			
		||||
            key={viewName}
 | 
			
		||||
          >
 | 
			
		||||
            <div className="ant-formily-item-label-content">
 | 
			
		||||
              <span>
 | 
			
		||||
                <label>{t('Preview')}</label>
 | 
			
		||||
              </span>
 | 
			
		||||
            </div>
 | 
			
		||||
            <span className="ant-formily-item-colon">:</span>
 | 
			
		||||
          </div>,
 | 
			
		||||
          <Table
 | 
			
		||||
            size={'middle'}
 | 
			
		||||
            pagination={false}
 | 
			
		||||
            bordered
 | 
			
		||||
            columns={previewColumns}
 | 
			
		||||
            dataSource={previewData}
 | 
			
		||||
            scroll={{ x: 1000, y: 300 }}
 | 
			
		||||
            key={viewName}
 | 
			
		||||
          />,
 | 
			
		||||
        ]}
 | 
			
		||||
        <div
 | 
			
		||||
          className="ant-formily-item-label"
 | 
			
		||||
          style={{ marginTop: 24, display: 'flex', padding: '0 0 8px' }}
 | 
			
		||||
          key={viewName}
 | 
			
		||||
        >
 | 
			
		||||
          <div className="ant-formily-item-label-content">
 | 
			
		||||
            <span>
 | 
			
		||||
              <label>{t('Preview')}</label>
 | 
			
		||||
            </span>
 | 
			
		||||
          </div>
 | 
			
		||||
          <span className="ant-formily-item-colon">:</span>
 | 
			
		||||
        </div>
 | 
			
		||||
        {previewColumns?.length > 0 && (
 | 
			
		||||
          <>
 | 
			
		||||
            <Table
 | 
			
		||||
              size={'middle'}
 | 
			
		||||
              pagination={false}
 | 
			
		||||
              bordered
 | 
			
		||||
              columns={previewColumns}
 | 
			
		||||
              dataSource={previewData}
 | 
			
		||||
              scroll={{ x: 1000, y: 300 }}
 | 
			
		||||
              key={viewName}
 | 
			
		||||
            />
 | 
			
		||||
          </>
 | 
			
		||||
        )}
 | 
			
		||||
      </div>
 | 
			
		||||
    </Spin>
 | 
			
		||||
  );
 | 
			
		||||
 | 
			
		||||
@ -132,6 +132,9 @@ export const view: ICollectionTemplate = {
 | 
			
		||||
          schema: {
 | 
			
		||||
            'x-component-props': '{{$form.values}}', //任意层次属性都支持表达式
 | 
			
		||||
          },
 | 
			
		||||
          state: {
 | 
			
		||||
            visible: `{{$deps[1]?.length > 0}}`,
 | 
			
		||||
          },
 | 
			
		||||
        },
 | 
			
		||||
      },
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user