Skip to content

Commit

Permalink
fix(dueros): 编辑数据
Browse files Browse the repository at this point in the history
  • Loading branch information
Lind-pro committed Nov 9, 2020
1 parent cd1c9b8 commit 1cc9698
Show file tree
Hide file tree
Showing 2 changed files with 229 additions and 212 deletions.
35 changes: 26 additions & 9 deletions src/pages/cloud/dueros/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { PageHeaderWrapper } from "@ant-design/pro-layout"
import { Button, Card, Divider } from "antd";
import { Button, Card, Divider, message, Popconfirm } from "antd";
import React, { Fragment, useEffect, useState } from "react";
import styles from '@/utils/table.less';
import SearchForm from "@/components/SearchForm";
Expand Down Expand Up @@ -27,7 +27,7 @@ const DuerOS: React.FC<Props> = props => {
const handleSearch = (params?: any) => {
setSearchParam(params);
setLoading(true);
service.query(params).subscribe(
service.query(encodeQueryParam(params)).subscribe(
(data) => setResult(data),
() => { },
() => setLoading(false))
Expand Down Expand Up @@ -61,13 +61,20 @@ const DuerOS: React.FC<Props> = props => {
render: (record: any) => (
<Fragment>
<a onClick={() => {

setCurrent(record);
setSaveVisible(true);
}}>编辑</a>
<Divider type="vertical" />
<a onClick={() => {
// setSolveAlarmLogId(record.id);
// setSolveVisible(true);
}}>删除</a>
<Popconfirm
title="确认删除吗?"
onConfirm={() => {
service.remove(record.id).subscribe(() => {
message.success('删除成功');
})
}}>
<a >删除</a>
</Popconfirm>

</Fragment>
)
},
Expand Down Expand Up @@ -129,9 +136,19 @@ const DuerOS: React.FC<Props> = props => {
{
saveVisible && (
<Save
data={{}}
data={current}
close={() => setSaveVisible(false)}
save={(item: any) => { console.log(item) }} />
save={(item: any) => {
service.saveOrUpdate(item).subscribe(data => {
message.success('添加成功');
},
() => { },
() => {
handleSearch();
setSaveVisible(false);
});
}}
/>
)
}
</PageHeaderWrapper>
Expand Down

0 comments on commit 1cc9698

Please sign in to comment.