|
@@ -1,5 +1,5 @@
|
1
|
1
|
import React, { useState, useEffect } from 'react';
|
2
|
|
-import { Button, Table, Pagination, Alert, Icon, Tag } from 'antd'
|
|
2
|
+import { Button, Table, Pagination, Alert, Icon, Tag, notification } from 'antd'
|
3
|
3
|
import router from 'umi/router';
|
4
|
4
|
import moment from 'moment';
|
5
|
5
|
import Styles from './style.less'
|
|
@@ -67,6 +67,14 @@ function body() {
|
67
|
67
|
})
|
68
|
68
|
}
|
69
|
69
|
|
|
70
|
+ const openNotificationWithIcon = (type, message) => {
|
|
71
|
+ notification[type]({
|
|
72
|
+ message,
|
|
73
|
+ description:
|
|
74
|
+ '',
|
|
75
|
+ });
|
|
76
|
+ }
|
|
77
|
+
|
70
|
78
|
// 分页
|
71
|
79
|
function onChange(pageNumber) {
|
72
|
80
|
// eslint-disable-next-line no-console
|
|
@@ -76,12 +84,13 @@ function body() {
|
76
|
84
|
|
77
|
85
|
// 删除
|
78
|
86
|
function deleteType(row) {
|
79
|
|
- const { url, method } = apis.buildingType.update
|
80
|
|
- const tempUrl = url.substring(0, url.lastIndexOf('id')).concat(row.buildingTypeId)
|
81
|
|
-
|
82
|
87
|
row.status = -1
|
83
|
|
- request({ url: tempUrl, method, data: { ...row } }).then(() => {
|
|
88
|
+ request({ ...apis.buildingType.update, urlData: { id: row.buildingTypeId }, data: { ...row } }).then(() => {
|
84
|
89
|
getList({ pageNum: data.current, pageSize: 10 })
|
|
90
|
+ }).then(() => {
|
|
91
|
+ openNotificationWithIcon('success', '操作成功')
|
|
92
|
+ }).catch(err => {
|
|
93
|
+ openNotificationWithIcon('error', err)
|
85
|
94
|
})
|
86
|
95
|
}
|
87
|
96
|
|