Commit 28411606 by zhaochengxiang

修改规则 模版问题

parent 91e55e5c
import React, { useState, useEffect, useRef } from 'react';
import React, { useState, useEffect } from 'react';
import { Alert, Select } from 'antd';
import ImportActionHeader from './ImportActionHeader';
......@@ -20,9 +20,6 @@ const ImportAction = (props) => {
const [ supportedDatatypes, setSupportedDatatypes ] = useState([]);
const [ validateReports, setValidateReports ] = useState([]);
const mountRef = useRef();
mountRef.current = true;
useEffect(() =>{
if (action==='add' && (hints||[]).length === 0) return;
......@@ -36,24 +33,20 @@ const ImportAction = (props) => {
});
}
if (action === 'detail') {
getCurrentDataModel();
} else {
dispatch({
type: 'datamodel.getAllConstraintsAndTemplates',
callback: data => {
setConstraints(data.constraints||[]);
setTemplates(data.templates||[]);
if (action === 'add') {
setConstraint((data.constraints||[]).length>0?data.constraints[0]:{});
setTemplate((data.templates||[]).length>0?data.templates[0]:{});
getDraft((data.constraints||[]).length>0?data.constraints[0]:{}, (data.templates||[]).length>0?data.templates[0]:{} ,hints);
} else if(action === 'edit') {
getCurrentDataModel();
}
dispatch({
type: 'datamodel.getAllConstraintsAndTemplates',
callback: data => {
setConstraints(data.constraints||[]);
setTemplates(data.templates||[]);
if (action === 'add') {
setConstraint((data.constraints||[]).length>0?data.constraints[0]:{});
setTemplate((data.templates||[]).length>0?data.templates[0]:{});
getDraft((data.constraints||[]).length>0?data.constraints[0]:{}, (data.templates||[]).length>0?data.templates[0]:{} ,hints);
} else if(action === 'edit' || action === 'detail') {
getCurrentDataModel();
}
})
}
}
})
//eslint-disable-next-line react-hooks/exhaustive-deps
}, [action, hints, modelerId ]);
......@@ -109,7 +102,7 @@ const ImportAction = (props) => {
let currentConstraint = null, _hints = [];
(constraints||[]).forEach((_constraint, index) => {
if (_constraint.id === value) {
if (_constraint.name === value) {
currentConstraint = _constraint;
}
});
......@@ -132,7 +125,7 @@ const ImportAction = (props) => {
let currentTemplate = null, _hints = [];
(templates||[]).forEach((_template, index) => {
if (_template.id === value) {
if (_template.name === value) {
currentTemplate = _template;
}
});
......@@ -188,8 +181,8 @@ const ImportAction = (props) => {
return (
<>
{
action!=='detail' && <div className='d-flex mb-3'>
<Select value={constraint.name?constraint.name:null} placeholder='请选择规则' style={{ marginLeft: 'auto', minWidth: 100 }} onChange={onConstraintChange}>
<div className='d-flex mb-3'>
<Select value={constraint.name?constraint.name:null} placeholder='请选择规则' style={{ marginLeft: 'auto', minWidth: 100 }} onChange={onConstraintChange} disabled={ action==='detail' } >
{
(constraints||[]).map((constraint, index) => {
return (
......@@ -198,7 +191,7 @@ const ImportAction = (props) => {
})
}
</Select>
<Select className='ml-3' value={template.name?template.name:null} placeholder='请选择模版' style={{ minWidth: 100 }} onChange={onTemplateChange}>
<Select className='ml-3' value={template.name?template.name:null} placeholder='请选择模版' style={{ minWidth: 100 }} onChange={onTemplateChange} disabled={action==='detail'}>
{
(templates||[]).map((template, index) => {
return (
......@@ -214,14 +207,14 @@ const ImportAction = (props) => {
editable={action!=='detail'}
modelerData={modelerData||{}}
/>
{
{/* {
action!=='detail' && <Alert
message="表格可以通过拖拽来排序"
type="info"
closable
className='mb-3'
/>
}
} */}
<ImportActionTable
modelerData={modelerData||{}}
constraint={constraint}
......
import React, { useState, useCallback, useRef, useEffect } from 'react';
import { Table, Input, Form, Typography, Radio, Divider, Button, Popconfirm, Select, Row, Col, Popover } from 'antd';
import { QuestionCircleOutlined } from '@ant-design/icons';
import { DndProvider, useDrag, useDrop } from 'react-dnd';
import { HTML5Backend } from 'react-dnd-html5-backend';
import update from 'immutability-helper';
......@@ -520,7 +521,17 @@ const ImportActionTable = (props) => {
return (
<div className='model-import-action-table'>
<Divider>数据表结构</Divider>
<Divider>
<>
<span>数据表结构</span>
{ editable && (
<Popover content='表格可以通过拖拽来排序'>
<QuestionCircleOutlined className='ml-1 pointer' />
</Popover>
)
}
</>
</Divider>
{
editable && <div className='d-flex mb-3'>
<Button type="primary" onClick={onAddClick} style={{ marginLeft: 'auto' }} disabled={ editingKey!=='' } >新增行</Button>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment