Skip to content

Commit

Permalink
fix(设备管理): 产品-物模型
Browse files Browse the repository at this point in the history
物模型导入后没有重新从服务器获取数据,导致顶层组件未存储物模型数据
  • Loading branch information
Lind-pro committed Dec 7, 2020
1 parent 46dd5df commit b0bc29d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/pages/device/product/save/Detail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,12 @@ const Detail: React.FC<Props> = props => {
const [units, setUnits] = useState(initState.units);
const [updateVisible, setUpdateVisible] = useState(false);

const handleSearch = (id: string) => {
const handleSearch = (id?: string) => {
const list = pathname.split('/');
const temp = id || list[list.length - 1];
dispatch({
type: 'deviceProduct/queryById',
payload: id,
payload: temp,
callback: (r: any) => {
if (r.status === 200) {
const data = r.result;
Expand Down Expand Up @@ -391,6 +393,7 @@ const Detail: React.FC<Props> = props => {
setTags(data);
updateData('tags', data);
}}
update={() => handleSearch()}
/>
</Tabs.TabPane>
<Tabs.TabPane tab="告警设置" key="metadata1">
Expand Down
3 changes: 2 additions & 1 deletion src/pages/device/product/save/definition/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ interface Props extends FormComponentProps {
functionsData: any;
eventsData: any;
tagsData: any;
update: Function;
}

export const TenantContext = React.createContext({});
Expand Down Expand Up @@ -67,7 +68,7 @@ const Definition: React.FC<Props> = props => {
setSpinning(false);
})
.catch(() => {
});
}).finally(() => props.update());
};

const operations = (
Expand Down

0 comments on commit b0bc29d

Please sign in to comment.