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

优化控件

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