Commit 4d028376 by 秦嘉祺

Merge branch 'feature/20210305_新增删除功能' into 'master'

新增删除功能

See merge request !1
parents 880f24ed 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,
......
......@@ -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);
......
......@@ -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',
},
});
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment