Commit ab1e447d authored by 杨子龙's avatar 杨子龙

优化控件

parent fe72f9e1
...@@ -18,7 +18,8 @@ const DataTable = props => { ...@@ -18,7 +18,8 @@ const DataTable = props => {
pagination , pagination ,
scrollX, scrollX,
scrollY, scrollY,
statusOption statusOption,
areaTaskShine,
} = schema; } = schema;
const [dataSource , setDataSource] = useState([]); const [dataSource , setDataSource] = useState([]);
...@@ -225,7 +226,7 @@ const DataTable = props => { ...@@ -225,7 +226,7 @@ const DataTable = props => {
return arr return arr
}; };
const getData = () => { const initRelationForm = () => {
window.relationForm = { window.relationForm = {
configs: [ configs: [
{ {
...@@ -241,15 +242,42 @@ const DataTable = props => { ...@@ -241,15 +242,42 @@ const DataTable = props => {
} }
} }
const columns = getColumns(); const setRelationData = () => {
const data = [];
dataSource.forEach(item => {
const obj = {
type: item.type || 'add',
accountTable: schema.accountName,
values: [
{
fieldName: "工单编号",
fieldValue: ""
}
]
}
useEffect(() => { Object.keys(item).forEach(key => {
getData(); const val = key.split("-")[1]
const isHas = areaTaskShine.find(s => s.fromField === val);
return () => { if(isHas){
eventEmitter.removeListener(addons?.dataPath) const valuesObj = {
} fieldName: isHas.fromField,
}, []); fieldValue: item[key]
}
obj.values.push(valuesObj);
}
})
data.push(obj);
})
window.relationForm.data = data;
}
const columns = getColumns();
useEffect(() => { useEffect(() => {
eventEmitter.on(addons?.dataPath , (res) => { eventEmitter.on(addons?.dataPath , (res) => {
...@@ -264,6 +292,12 @@ const DataTable = props => { ...@@ -264,6 +292,12 @@ const DataTable = props => {
}) })
}, []); }, []);
useEffect(() => {
initRelationForm();
setRelationData();
}, [value , dataSource]);
return ( return (
<Fragment> <Fragment>
......
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