Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
freemud-coupon-export-app
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
秦嘉祺
freemud-coupon-export-app
Commits
97236ca1
You need to sign in or sign up before continuing.
Commit
97236ca1
authored
Mar 05, 2021
by
QJQ
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增删除功能
parent
880f24ed
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
41 deletions
+35
-41
src/pages/table-list/index.tsx
+26
-33
src/pages/table-list/model.ts
+5
-5
src/pages/table-list/service.ts
+4
-3
No files found.
src/pages/table-list/index.tsx
View file @
97236ca1
...
...
@@ -11,6 +11,7 @@ import {
Row
,
Select
,
message
,
Popconfirm
}
from
'antd'
;
import
React
,
{
Component
,
Fragment
}
from
'react'
;
...
...
@@ -176,9 +177,20 @@ class TableList extends Component<TableListProps, TableListState> {
title
:
'操作'
,
render
:
(
text
,
record
:
any
)
=>
(
<
Fragment
>
{
record
.
ExportStatus
===
0
?
<
Popconfirm
title=
"确定删除该条数据?"
onConfirm=
{
()
=>
this
.
confirm
(
record
.
ID
)
}
okText=
"确认"
cancelText=
"取消"
>
<
Button
type=
"danger"
>
删除
</
Button
>
</
Popconfirm
>
:
(
record
.
ExportStatus
===
2
?
<
a
href=
{
apiAddress
+
'/Coupon/ExportCode?partnerid='
+
record
.
PartnerID
+
"&id="
+
record
.
ID
}
>
<
Button
disabled=
{
record
.
ExportStatus
!==
2
}
type=
"primary"
>
下载
</
Button
>
</
a
>
<
Button
type=
"primary"
>
下载
</
Button
>
</
a
>
:
<
Button
disabled=
{
true
}
type=
"primary"
>
下载
</
Button
>
)
}
</
Fragment
>
),
},
...
...
@@ -221,6 +233,17 @@ class TableList extends Component<TableListProps, TableListState> {
});
};
confirm
=
(
id
:
number
)
=>
{
const
{
dispatch
}
=
this
.
props
;
dispatch
({
type
:
'listAndtableList/remove'
,
payload
:
{
id
:
id
},
callback
:
this
.
onSuccess
})
}
handleFormReset
=
()
=>
{
const
{
form
,
dispatch
}
=
this
.
props
;
form
.
resetFields
();
...
...
@@ -240,30 +263,6 @@ class TableList extends Component<TableListProps, TableListState> {
});
};
handleMenuClick
=
(
e
:
{
key
:
string
})
=>
{
const
{
dispatch
}
=
this
.
props
;
const
{
selectedRows
}
=
this
.
state
;
if
(
!
selectedRows
)
return
;
switch
(
e
.
key
)
{
case
'remove'
:
dispatch
({
type
:
'listAndtableList/remove'
,
payload
:
{
key
:
selectedRows
.
map
(
row
=>
row
.
key
),
},
callback
:
()
=>
{
this
.
setState
({
selectedRows
:
[],
});
},
});
break
;
default
:
break
;
}
};
handleSelectRows
=
(
rows
:
TableListItem
[])
=>
{
this
.
setState
({
selectedRows
:
rows
,
...
...
@@ -334,7 +333,7 @@ class TableList extends Component<TableListProps, TableListState> {
type
:
'listAndtableList/fetch'
,
});
message
.
success
(
'
添加
成功'
);
message
.
success
(
'
操作
成功'
);
this
.
handleModalVisible
();
}
else
{
message
.
error
(
response
.
data
);
...
...
@@ -394,12 +393,6 @@ class TableList extends Component<TableListProps, TableListState> {
}
=
this
.
props
;
const
{
selectedRows
,
modalVisible
,
updateModalVisible
,
stepFormValues
}
=
this
.
state
;
const
menu
=
(
<
Menu
onClick=
{
this
.
handleMenuClick
}
selectedKeys=
{
[]
}
>
<
Menu
.
Item
key=
"remove"
>
删除
</
Menu
.
Item
>
<
Menu
.
Item
key=
"approval"
>
批量审批
</
Menu
.
Item
>
</
Menu
>
);
const
parentMethods
=
{
handleAdd
:
this
.
handleAdd
,
...
...
src/pages/table-list/model.ts
View file @
97236ca1
...
...
@@ -60,11 +60,11 @@ const Model: ModelType = {
},
*
remove
({
payload
,
callback
},
{
call
,
put
})
{
const
response
=
yield
call
(
removeRule
,
payload
);
yield
put
({
type
:
'save'
,
payload
:
response
,
});
if
(
callback
)
callback
();
//
yield put({
//
type: 'save',
//
payload: response,
//
});
if
(
callback
)
callback
(
response
);
},
*
update
({
payload
,
callback
},
{
call
,
put
})
{
const
response
=
yield
call
(
updateRule
,
payload
);
...
...
src/pages/table-list/service.ts
View file @
97236ca1
...
...
@@ -3,10 +3,11 @@ import { TableListParams } from './data.d';
//export const apiAddress = "http://localhost:8001";
//export const apiAddress = "http://172.16.0.152:809";
export
const
apiAddress
=
"http://115.159.226.87:8090"
;
export
const
apiAddress
=
"http://115.159.226.87:8090"
;
const
getExportRecord
=
apiAddress
+
"/Coupon/GetExportRecord"
;
const
addExportRecord
=
apiAddress
+
"/Coupon/AddExportRecord"
;
const
deleteExportRecord
=
apiAddress
+
"/Coupon/DeleteExportRecord"
;
const
exportCode
=
apiAddress
+
"/Coupon/ExportCode"
;
export
async
function
queryRule
(
params
:
TableListParams
)
{
...
...
@@ -20,11 +21,11 @@ export async function queryRule(params: TableListParams) {
}
export
async
function
removeRule
(
params
:
TableListParams
)
{
return
request
(
'/api/rule'
,
{
return
request
(
deleteExportRecord
,
{
method
:
'POST'
,
data
:
{
...
params
,
method
:
'
delete
'
,
method
:
'
post
'
,
},
});
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment