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
Commit
97236ca1
authored
Mar 05, 2021
by
QJQ
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增删除功能
parent
880f24ed
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
43 deletions
+37
-43
src/pages/table-list/index.tsx
+28
-35
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 {
...
@@ -11,6 +11,7 @@ import {
Row
,
Row
,
Select
,
Select
,
message
,
message
,
Popconfirm
}
from
'antd'
;
}
from
'antd'
;
import
React
,
{
Component
,
Fragment
}
from
'react'
;
import
React
,
{
Component
,
Fragment
}
from
'react'
;
...
@@ -176,14 +177,25 @@ class TableList extends Component<TableListProps, TableListState> {
...
@@ -176,14 +177,25 @@ class TableList extends Component<TableListProps, TableListState> {
title
:
'操作'
,
title
:
'操作'
,
render
:
(
text
,
record
:
any
)
=>
(
render
:
(
text
,
record
:
any
)
=>
(
<
Fragment
>
<
Fragment
>
<
a
href=
{
apiAddress
+
'/Coupon/ExportCode?partnerid='
+
record
.
PartnerID
+
"&id="
+
record
.
ID
}
>
{
record
.
ExportStatus
===
0
?
<
Button
disabled=
{
record
.
ExportStatus
!==
2
}
type=
"primary"
>
下载
</
Button
>
<
Popconfirm
</
a
>
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
type=
"primary"
>
下载
</
Button
>
</
a
>
:
<
Button
disabled=
{
true
}
type=
"primary"
>
下载
</
Button
>
)
}
</
Fragment
>
</
Fragment
>
),
),
},
},
];
];
componentDidMount
()
{
componentDidMount
()
{
const
{
dispatch
}
=
this
.
props
;
const
{
dispatch
}
=
this
.
props
;
dispatch
({
dispatch
({
...
@@ -221,6 +233,17 @@ class TableList extends Component<TableListProps, TableListState> {
...
@@ -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
=
()
=>
{
handleFormReset
=
()
=>
{
const
{
form
,
dispatch
}
=
this
.
props
;
const
{
form
,
dispatch
}
=
this
.
props
;
form
.
resetFields
();
form
.
resetFields
();
...
@@ -240,30 +263,6 @@ class TableList extends Component<TableListProps, TableListState> {
...
@@ -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
[])
=>
{
handleSelectRows
=
(
rows
:
TableListItem
[])
=>
{
this
.
setState
({
this
.
setState
({
selectedRows
:
rows
,
selectedRows
:
rows
,
...
@@ -334,7 +333,7 @@ class TableList extends Component<TableListProps, TableListState> {
...
@@ -334,7 +333,7 @@ class TableList extends Component<TableListProps, TableListState> {
type
:
'listAndtableList/fetch'
,
type
:
'listAndtableList/fetch'
,
});
});
message
.
success
(
'
添加
成功'
);
message
.
success
(
'
操作
成功'
);
this
.
handleModalVisible
();
this
.
handleModalVisible
();
}
else
{
}
else
{
message
.
error
(
response
.
data
);
message
.
error
(
response
.
data
);
...
@@ -394,12 +393,6 @@ class TableList extends Component<TableListProps, TableListState> {
...
@@ -394,12 +393,6 @@ class TableList extends Component<TableListProps, TableListState> {
}
=
this
.
props
;
}
=
this
.
props
;
const
{
selectedRows
,
modalVisible
,
updateModalVisible
,
stepFormValues
}
=
this
.
state
;
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
=
{
const
parentMethods
=
{
handleAdd
:
this
.
handleAdd
,
handleAdd
:
this
.
handleAdd
,
...
...
src/pages/table-list/model.ts
View file @
97236ca1
...
@@ -60,11 +60,11 @@ const Model: ModelType = {
...
@@ -60,11 +60,11 @@ const Model: ModelType = {
},
},
*
remove
({
payload
,
callback
},
{
call
,
put
})
{
*
remove
({
payload
,
callback
},
{
call
,
put
})
{
const
response
=
yield
call
(
removeRule
,
payload
);
const
response
=
yield
call
(
removeRule
,
payload
);
yield
put
({
//
yield put({
type
:
'save'
,
//
type: 'save',
payload
:
response
,
//
payload: response,
});
//
});
if
(
callback
)
callback
();
if
(
callback
)
callback
(
response
);
},
},
*
update
({
payload
,
callback
},
{
call
,
put
})
{
*
update
({
payload
,
callback
},
{
call
,
put
})
{
const
response
=
yield
call
(
updateRule
,
payload
);
const
response
=
yield
call
(
updateRule
,
payload
);
...
...
src/pages/table-list/service.ts
View file @
97236ca1
...
@@ -3,10 +3,11 @@ import { TableListParams } from './data.d';
...
@@ -3,10 +3,11 @@ import { TableListParams } from './data.d';
//export const apiAddress = "http://localhost:8001";
//export const apiAddress = "http://localhost:8001";
//export const apiAddress = "http://172.16.0.152:809";
//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
getExportRecord
=
apiAddress
+
"/Coupon/GetExportRecord"
;
const
addExportRecord
=
apiAddress
+
"/Coupon/AddExportRecord"
;
const
addExportRecord
=
apiAddress
+
"/Coupon/AddExportRecord"
;
const
deleteExportRecord
=
apiAddress
+
"/Coupon/DeleteExportRecord"
;
const
exportCode
=
apiAddress
+
"/Coupon/ExportCode"
;
const
exportCode
=
apiAddress
+
"/Coupon/ExportCode"
;
export
async
function
queryRule
(
params
:
TableListParams
)
{
export
async
function
queryRule
(
params
:
TableListParams
)
{
...
@@ -20,11 +21,11 @@ export async function queryRule(params: TableListParams) {
...
@@ -20,11 +21,11 @@ export async function queryRule(params: TableListParams) {
}
}
export
async
function
removeRule
(
params
:
TableListParams
)
{
export
async
function
removeRule
(
params
:
TableListParams
)
{
return
request
(
'/api/rule'
,
{
return
request
(
deleteExportRecord
,
{
method
:
'POST'
,
method
:
'POST'
,
data
:
{
data
:
{
...
params
,
...
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