flat: 暂存
This commit is contained in:
@@ -1,11 +1,16 @@
|
||||
import React, {Fragment, useRef, useState} from "react";
|
||||
import { useIntl, FormattedMessage, useAccess, history } from '@umijs/max';
|
||||
import { Dropdown, FormInstance, Space, Button, message, Modal } from 'antd';
|
||||
import { ActionType, FooterToolbar, PageContainer, ProColumns, ProTable } from '@ant-design/pro-components';
|
||||
import { PlusOutlined, DeleteOutlined, FormOutlined, DownOutlined, AlignLeftOutlined } from '@ant-design/icons';
|
||||
import {getCmsAreaList, addCmsAreaListRow, updateCmsAreaListRow, deleteCmsAreaListRow} from "@/services/area/business";
|
||||
import SubWayEdit from "@/pages/Area/Business/edit";
|
||||
import {deleteCmsLineSubWay} from "@/services/area/subway";
|
||||
import { FormattedMessage, useAccess } from '@umijs/max';
|
||||
import { FormInstance, Button, message, Modal } from 'antd';
|
||||
import { ActionType, ProColumns, ProTable } from '@ant-design/pro-components';
|
||||
import { PlusOutlined, DeleteOutlined, FormOutlined, AlignLeftOutlined } from '@ant-design/icons';
|
||||
import {
|
||||
getCmsAreaList,
|
||||
addCmsAreaListRow,
|
||||
updateCmsAreaListRow,
|
||||
deleteCmsAreaListRow,
|
||||
exportCmsAreaListRow
|
||||
} from "@/services/area/business";
|
||||
import BusinessEdit from "@/pages/Area/Business/edit";
|
||||
|
||||
|
||||
const handleRemoveOne = async (selectedRow: API.AreaBusiness.Circle) => {
|
||||
@@ -26,6 +31,20 @@ const handleRemoveOne = async (selectedRow: API.AreaBusiness.Circle) => {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
const handleExport = async (values: API.AreaBusiness.CircleEditParams) => {
|
||||
const hide = message.loading('正在导出');
|
||||
try {
|
||||
await exportCmsAreaListRow(values);
|
||||
hide();
|
||||
message.success('导出成功');
|
||||
return true;
|
||||
} catch (error) {
|
||||
hide();
|
||||
message.error('导出失败,请重试');
|
||||
return false;
|
||||
}
|
||||
};
|
||||
function ManagementList() {
|
||||
const access = useAccess();
|
||||
|
||||
@@ -46,14 +65,15 @@ function ManagementList() {
|
||||
{
|
||||
title: '操作',
|
||||
align: 'center',
|
||||
width: 300,
|
||||
hideInSearch: true,
|
||||
render: (_, record) => [
|
||||
<Button
|
||||
type="link"
|
||||
size="small"
|
||||
key="detail"
|
||||
icon = <AlignLeftOutlined />
|
||||
hidden={!access.hasPerms('area:business:list.detail')}
|
||||
icon={<AlignLeftOutlined />}
|
||||
hidden={!access.hasPerms('area:business:List.detail')}
|
||||
onClick={() => {
|
||||
setModalVisible(true);
|
||||
setCurrentRow(record);
|
||||
@@ -65,8 +85,8 @@ function ManagementList() {
|
||||
type="link"
|
||||
size="small"
|
||||
key="edit"
|
||||
icon = <FormOutlined />
|
||||
hidden={!access.hasPerms('area:business:list.update')}
|
||||
icon = {<FormOutlined />}
|
||||
hidden={!access.hasPerms('area:business:List.update')}
|
||||
onClick={() => {
|
||||
setModalVisible(true);
|
||||
setCurrentRow(record);
|
||||
@@ -79,8 +99,8 @@ function ManagementList() {
|
||||
size="small"
|
||||
danger
|
||||
key="batchRemove"
|
||||
icon = <DeleteOutlined/>
|
||||
hidden={!access.hasPerms('area:business:list')}
|
||||
icon ={<DeleteOutlined/>}
|
||||
hidden={!access.hasPerms('area:business:List')}
|
||||
onClick={async () => {
|
||||
Modal.confirm({
|
||||
title: '删除',
|
||||
@@ -112,21 +132,22 @@ function ManagementList() {
|
||||
actionRef={actionRef}
|
||||
formRef={formTableRef}
|
||||
columns={columns}
|
||||
rowKey={"commercialAreaName"}
|
||||
key={"index"}
|
||||
request={(params) =>
|
||||
getCmsAreaList({ ...params } as API.AreaBusiness.CircleParams).then((res) => {
|
||||
const result = {
|
||||
return {
|
||||
data: res.rows,
|
||||
total: res.total,
|
||||
success: true,
|
||||
};
|
||||
return result;
|
||||
}
|
||||
})
|
||||
}
|
||||
toolBarRender={() => [
|
||||
<Button
|
||||
type="primary"
|
||||
key="add"
|
||||
hidden={!access.hasPerms('manage:list:add')}
|
||||
hidden={!access.hasPerms('manage:List:add')}
|
||||
onClick={async () => {
|
||||
setCurrentRow(undefined);
|
||||
setModalVisible(true);
|
||||
@@ -134,10 +155,22 @@ function ManagementList() {
|
||||
>
|
||||
<PlusOutlined /> 新建
|
||||
</Button>,
|
||||
<Button
|
||||
type="primary"
|
||||
key="export"
|
||||
hidden={!access.hasPerms('system:user:export')}
|
||||
onClick={async () => {
|
||||
const searchVal = formTableRef.current && formTableRef.current.getFieldsValue();
|
||||
handleExport(searchVal);
|
||||
}}
|
||||
>
|
||||
<PlusOutlined />
|
||||
<FormattedMessage id="pages.searchTable.export" defaultMessage="导出" />
|
||||
</Button>,
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
<SubWayEdit
|
||||
<BusinessEdit
|
||||
open={modalVisible}
|
||||
onSubmit={async (values) => {
|
||||
let resData
|
||||
@@ -164,7 +197,7 @@ function ManagementList() {
|
||||
setModalVisible(false);
|
||||
setCurrentRow(undefined)
|
||||
}}
|
||||
></SubWayEdit>
|
||||
></BusinessEdit>
|
||||
</Fragment>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user