flat:123
This commit is contained in:
@@ -46,6 +46,17 @@ export default [
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'area',
|
||||||
|
path: '/area',
|
||||||
|
routes: [
|
||||||
|
{
|
||||||
|
name: '字典数据',
|
||||||
|
path: '/area/updata-router/index/:id',
|
||||||
|
component: './Area/Subway/UpLine',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'system',
|
name: 'system',
|
||||||
path: '/system',
|
path: '/system',
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import { getRemoteMenu, getRoutersInfo, getUserInfo, patchRouteWithRemoteMenus,
|
|||||||
import { PageEnum } from './enums/pagesEnums';
|
import { PageEnum } from './enums/pagesEnums';
|
||||||
import {logout} from "@/services/system/auth";
|
import {logout} from "@/services/system/auth";
|
||||||
import { stringify } from 'querystring';
|
import { stringify } from 'querystring';
|
||||||
|
import { message } from 'antd'
|
||||||
|
|
||||||
const isDev = process.env.NODE_ENV === 'development';
|
const isDev = process.env.NODE_ENV === 'development';
|
||||||
|
|
||||||
@@ -247,7 +248,10 @@ export const request = {
|
|||||||
case 401:
|
case 401:
|
||||||
loginOut()
|
loginOut()
|
||||||
}
|
}
|
||||||
// console.log('data: ', data)
|
if(data.code !== 200 && data.msg) {
|
||||||
|
message.info(data.msg)
|
||||||
|
}
|
||||||
|
console.log('data: ', data)
|
||||||
// console.log('config: ', config)
|
// console.log('config: ', config)
|
||||||
return response
|
return response
|
||||||
},
|
},
|
||||||
|
|||||||
0
src/pages/Area/Business/detail.tsx
Normal file
0
src/pages/Area/Business/detail.tsx
Normal file
125
src/pages/Area/Business/edit.tsx
Normal file
125
src/pages/Area/Business/edit.tsx
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
import { PlusOutlined } from '@ant-design/icons';
|
||||||
|
import {
|
||||||
|
ModalForm,
|
||||||
|
ProForm,
|
||||||
|
ProFormDateRangePicker,
|
||||||
|
ProFormSelect,
|
||||||
|
ProFormText,
|
||||||
|
ProFormDigit,
|
||||||
|
} from '@ant-design/pro-components';
|
||||||
|
import React, {useEffect} from "react";
|
||||||
|
import { Button, Form, message, InputNumber } from 'antd';
|
||||||
|
import {DictOptionType, DictValueEnumObj} from "@/components/DictTag";
|
||||||
|
|
||||||
|
export type ListFormProps = {
|
||||||
|
onCancel: (flag?: boolean, formVals?: unknown) => void;
|
||||||
|
onSubmit: (values: API.AreaBusiness.CircleEditParams) => Promise<void>;
|
||||||
|
open: boolean;
|
||||||
|
values?: Partial< API.AreaBusiness.CircleEditParams>;
|
||||||
|
jobGroupOptions?: DictOptionType[];
|
||||||
|
statusOptions?: DictValueEnumObj;
|
||||||
|
};
|
||||||
|
|
||||||
|
const waitTime = (time: number = 100) => {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
setTimeout(() => {
|
||||||
|
resolve(true);
|
||||||
|
}, time);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const SubWayEdit: React.FC<ListFormProps> = (props) => {
|
||||||
|
const [form] = Form.useForm();
|
||||||
|
useEffect(() => {
|
||||||
|
form.resetFields();
|
||||||
|
if(props.values) {
|
||||||
|
form.setFieldsValue({
|
||||||
|
commercialAreaId: props.values.commercialAreaId,
|
||||||
|
commercialAreaName: props.values.commercialAreaName,
|
||||||
|
latitude: props.values.latitude,
|
||||||
|
longitude: props.values.longitude,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, [form, props]);
|
||||||
|
const handleCancel = () => {
|
||||||
|
props.onCancel();
|
||||||
|
form.resetFields();
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleFinish = async (values: Record<string, any>) => {
|
||||||
|
console.log(values)
|
||||||
|
props.onSubmit(values as API.AreaBusiness.CircleEditParams);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<ModalForm<API.AreaBusiness.CircleParams>
|
||||||
|
title="新增线路"
|
||||||
|
form={form}
|
||||||
|
// layout="inline"
|
||||||
|
autoFocusFirstInput
|
||||||
|
open={props.open}
|
||||||
|
modalProps={{
|
||||||
|
destroyOnClose: true,
|
||||||
|
onCancel: () => handleCancel(),
|
||||||
|
}}
|
||||||
|
submitTimeout={2000}
|
||||||
|
onFinish={handleFinish}
|
||||||
|
>
|
||||||
|
<ProFormDigit
|
||||||
|
name="commercialAreaId"
|
||||||
|
label={'字典主键'}
|
||||||
|
placeholder="请输入字典主键"
|
||||||
|
disabled
|
||||||
|
hidden={true}
|
||||||
|
/>
|
||||||
|
<ProForm.Group>
|
||||||
|
<ProFormText
|
||||||
|
width="md"
|
||||||
|
name="commercialAreaName"
|
||||||
|
label="商圈名称"
|
||||||
|
placeholder="请输入名称"
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: "请输入商圈名称!" ,
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
</ProForm.Group>
|
||||||
|
<ProForm.Group>
|
||||||
|
<ProFormDigit
|
||||||
|
label="纬度"
|
||||||
|
placeholder="请输入纬度"
|
||||||
|
name="latitude"
|
||||||
|
width="md"
|
||||||
|
min={-90}
|
||||||
|
max={90}
|
||||||
|
fieldProps={{ controls: false }}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: "请输入纬度!" ,
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
<ProFormDigit
|
||||||
|
label="经度"
|
||||||
|
placeholder="请输入经度"
|
||||||
|
name="longitude"
|
||||||
|
width="md"
|
||||||
|
min={-180}
|
||||||
|
max={180}
|
||||||
|
fieldProps={{ controls: false }}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: "请输入经度!" ,
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
</ProForm.Group>
|
||||||
|
</ModalForm>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default SubWayEdit
|
||||||
@@ -2,8 +2,30 @@ import React, {Fragment, useRef, useState} from "react";
|
|||||||
import { useIntl, FormattedMessage, useAccess, history } from '@umijs/max';
|
import { useIntl, FormattedMessage, useAccess, history } from '@umijs/max';
|
||||||
import { Dropdown, FormInstance, Space, Button, message, Modal } from 'antd';
|
import { Dropdown, FormInstance, Space, Button, message, Modal } from 'antd';
|
||||||
import { ActionType, FooterToolbar, PageContainer, ProColumns, ProTable } from '@ant-design/pro-components';
|
import { ActionType, FooterToolbar, PageContainer, ProColumns, ProTable } from '@ant-design/pro-components';
|
||||||
import { PlusOutlined, DeleteOutlined, ExclamationCircleOutlined, DownOutlined, EditOutlined } from '@ant-design/icons';
|
import { PlusOutlined, DeleteOutlined, FormOutlined, DownOutlined, AlignLeftOutlined } from '@ant-design/icons';
|
||||||
import {getCmsAreaList} from "@/services/area/business";
|
import {getCmsAreaList, addCmsAreaListRow, updateCmsAreaListRow, deleteCmsAreaListRow} from "@/services/area/business";
|
||||||
|
import SubWayEdit from "@/pages/Area/Business/edit";
|
||||||
|
import {deleteCmsLineSubWay} from "@/services/area/subway";
|
||||||
|
|
||||||
|
|
||||||
|
const handleRemoveOne = async (selectedRow: API.AreaBusiness.Circle) => {
|
||||||
|
const hide = message.loading('正在删除');
|
||||||
|
if (!selectedRow) return true;
|
||||||
|
try {
|
||||||
|
const resp = await deleteCmsAreaListRow(selectedRow.commercialAreaId);
|
||||||
|
hide();
|
||||||
|
if (resp.code === 200) {
|
||||||
|
message.success('删除成功,即将刷新');
|
||||||
|
} else {
|
||||||
|
message.error(resp.msg);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} catch (error) {
|
||||||
|
hide();
|
||||||
|
message.error('删除失败,请重试');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
function ManagementList() {
|
function ManagementList() {
|
||||||
const access = useAccess();
|
const access = useAccess();
|
||||||
|
|
||||||
@@ -18,8 +40,68 @@ function ManagementList() {
|
|||||||
title: '商圈名称',
|
title: '商圈名称',
|
||||||
dataIndex: 'commercialAreaName',
|
dataIndex: 'commercialAreaName',
|
||||||
valueType: 'text',
|
valueType: 'text',
|
||||||
|
align: 'center',
|
||||||
hideInSearch: true,
|
hideInSearch: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
align: 'center',
|
||||||
|
hideInSearch: true,
|
||||||
|
render: (_, record) => [
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
size="small"
|
||||||
|
key="detail"
|
||||||
|
icon = <AlignLeftOutlined />
|
||||||
|
hidden={!access.hasPerms('area:business:list.detail')}
|
||||||
|
onClick={() => {
|
||||||
|
setModalVisible(true);
|
||||||
|
setCurrentRow(record);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
详细
|
||||||
|
</Button>,
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
size="small"
|
||||||
|
key="edit"
|
||||||
|
icon = <FormOutlined />
|
||||||
|
hidden={!access.hasPerms('area:business:list.update')}
|
||||||
|
onClick={() => {
|
||||||
|
setModalVisible(true);
|
||||||
|
setCurrentRow(record);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
编辑
|
||||||
|
</Button>,
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
size="small"
|
||||||
|
danger
|
||||||
|
key="batchRemove"
|
||||||
|
icon = <DeleteOutlined/>
|
||||||
|
hidden={!access.hasPerms('area:business:list')}
|
||||||
|
onClick={async () => {
|
||||||
|
Modal.confirm({
|
||||||
|
title: '删除',
|
||||||
|
content: '确定删除该项吗?',
|
||||||
|
okText: '确认',
|
||||||
|
cancelText: '取消',
|
||||||
|
onOk: async () => {
|
||||||
|
const success = await handleRemoveOne(record);
|
||||||
|
if (success) {
|
||||||
|
if (actionRef.current) {
|
||||||
|
actionRef.current.reload();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</Button>
|
||||||
|
]
|
||||||
|
}
|
||||||
]
|
]
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
@@ -55,6 +137,34 @@ function ManagementList() {
|
|||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<SubWayEdit
|
||||||
|
open={modalVisible}
|
||||||
|
onSubmit={async (values) => {
|
||||||
|
let resData
|
||||||
|
if(values.commercialAreaId) {
|
||||||
|
resData = await updateCmsAreaListRow(values)
|
||||||
|
} else {
|
||||||
|
resData = await addCmsAreaListRow(values)
|
||||||
|
}
|
||||||
|
if (resData.code === 200) {
|
||||||
|
setModalVisible(false);
|
||||||
|
setCurrentRow(undefined);
|
||||||
|
if(values.commercialAreaId) {
|
||||||
|
message.success('修改成功')
|
||||||
|
} else {
|
||||||
|
message.success('新增成功')
|
||||||
|
}
|
||||||
|
if (actionRef.current) {
|
||||||
|
actionRef.current.reload();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
values={currentRow}
|
||||||
|
onCancel={() => {
|
||||||
|
setModalVisible(false);
|
||||||
|
setCurrentRow(undefined)
|
||||||
|
}}
|
||||||
|
></SubWayEdit>
|
||||||
</Fragment>
|
</Fragment>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
70
src/pages/Area/Subway/UpLine/edit.tsx
Normal file
70
src/pages/Area/Subway/UpLine/edit.tsx
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
import { PlusOutlined } from '@ant-design/icons';
|
||||||
|
import {
|
||||||
|
ModalForm,
|
||||||
|
ProForm,
|
||||||
|
ProFormDateRangePicker,
|
||||||
|
ProFormSelect,
|
||||||
|
ProFormText,
|
||||||
|
} from '@ant-design/pro-components';
|
||||||
|
import { Button, Form, message } from 'antd';
|
||||||
|
import {DictOptionType, DictValueEnumObj} from "@/components/DictTag";
|
||||||
|
|
||||||
|
export type ListFormProps = {
|
||||||
|
onCancel: (flag?: boolean, formVals?: unknown) => void;
|
||||||
|
onSubmit: (values: API.AreaSubWay.Line) => Promise<void>;
|
||||||
|
open: boolean;
|
||||||
|
values?: Partial<API.AreaSubWay.Line>;
|
||||||
|
jobGroupOptions?: DictOptionType[];
|
||||||
|
statusOptions?: DictValueEnumObj;
|
||||||
|
};
|
||||||
|
|
||||||
|
const waitTime = (time: number = 100) => {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
setTimeout(() => {
|
||||||
|
resolve(true);
|
||||||
|
}, time);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const SubWayEdit: React.FC<ListFormProps> = (props) => {
|
||||||
|
const [form] = Form.useForm<{ name: string; company: string }>();
|
||||||
|
|
||||||
|
const handleCancel = () => {
|
||||||
|
props.onCancel();
|
||||||
|
form.resetFields();
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleFinish = async (values: Record<string, any>) => {
|
||||||
|
props.onSubmit(values as API.AreaSubWay.Line);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<ModalForm<{
|
||||||
|
name: string;
|
||||||
|
company: string;
|
||||||
|
}>
|
||||||
|
title="新增线路"
|
||||||
|
form={form}
|
||||||
|
// layout="inline"
|
||||||
|
autoFocusFirstInput
|
||||||
|
open={props.open}
|
||||||
|
modalProps={{
|
||||||
|
destroyOnClose: true,
|
||||||
|
onCancel: () => handleCancel(),
|
||||||
|
}}
|
||||||
|
submitTimeout={2000}
|
||||||
|
onFinish={handleFinish}
|
||||||
|
>
|
||||||
|
<ProForm.Group>
|
||||||
|
<ProFormText
|
||||||
|
width="xl"
|
||||||
|
name="lineName"
|
||||||
|
label="线路名称:"
|
||||||
|
placeholder="请输入名称"
|
||||||
|
/>
|
||||||
|
</ProForm.Group>
|
||||||
|
</ModalForm>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default SubWayEdit
|
||||||
139
src/pages/Area/Subway/UpLine/index.tsx
Normal file
139
src/pages/Area/Subway/UpLine/index.tsx
Normal file
@@ -0,0 +1,139 @@
|
|||||||
|
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, ExclamationCircleOutlined, DownOutlined, EditOutlined } from '@ant-design/icons';
|
||||||
|
import {getCmsLineListPlatForm, addCmsLinePlatForm, deleteCmsLinePlatForm} from "@/services/area/upline";
|
||||||
|
import SubWayEdit from "@/pages/Area/Subway/UpLine/edit";
|
||||||
|
const handleRemoveOne = async (selectedRow: API.AreaSubWay.Line) => {
|
||||||
|
const hide = message.loading('正在删除');
|
||||||
|
if (!selectedRow) return true;
|
||||||
|
try {
|
||||||
|
const resp = await deleteCmsLinePlatForm(selectedRow.lineId);
|
||||||
|
hide();
|
||||||
|
if (resp.code === 200) {
|
||||||
|
message.success('删除成功,即将刷新');
|
||||||
|
} else {
|
||||||
|
message.error(resp.msg);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} catch (error) {
|
||||||
|
hide();
|
||||||
|
message.error('删除失败,请重试');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
function ManagementList() {
|
||||||
|
const access = useAccess();
|
||||||
|
|
||||||
|
const formTableRef = useRef<FormInstance>();
|
||||||
|
const actionRef = useRef<ActionType>();
|
||||||
|
|
||||||
|
const [currentRow, setCurrentRow] = useState<API.AreaPlatForm.Line>()
|
||||||
|
const [modalVisible, setModalVisible] = useState<boolean>(false)
|
||||||
|
|
||||||
|
const columns: ProColumns<API.AreaSubWay.Line>[] = [
|
||||||
|
{
|
||||||
|
title: '线路名称',
|
||||||
|
dataIndex: 'lineName',
|
||||||
|
align: 'center',
|
||||||
|
valueType: 'text',
|
||||||
|
render: (dom, record) => <Button type="link" onClick={() => history.push(`/area/updata-router/index/${record.lineId}`)} block>
|
||||||
|
{dom}
|
||||||
|
</Button>
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
hideInSearch: true,
|
||||||
|
align: 'center',
|
||||||
|
render: (_, record) => [
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
size="small"
|
||||||
|
danger
|
||||||
|
key="batchRemove"
|
||||||
|
icon = <DeleteOutlined/>
|
||||||
|
hidden={!access.hasPerms('area:subway:list')}
|
||||||
|
onClick={async () => {
|
||||||
|
Modal.confirm({
|
||||||
|
title: '删除',
|
||||||
|
content: '确定删除该项吗?',
|
||||||
|
okText: '确认',
|
||||||
|
cancelText: '取消',
|
||||||
|
onOk: async () => {
|
||||||
|
const success = await handleRemoveOne(record);
|
||||||
|
if (success) {
|
||||||
|
if (actionRef.current) {
|
||||||
|
actionRef.current.reload();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</Button>
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
return (
|
||||||
|
<Fragment>
|
||||||
|
<div style={{ width: '100%', float: 'right' }}>
|
||||||
|
<ProTable<API.AreaPlatForm.Line>
|
||||||
|
// params 是需要自带的参数
|
||||||
|
// 这个参数优先级更高,会覆盖查询表单的参数
|
||||||
|
actionRef={actionRef}
|
||||||
|
formRef={formTableRef}
|
||||||
|
columns={columns}
|
||||||
|
headerTitle='信息'
|
||||||
|
rowKey="lineId"
|
||||||
|
key="lineIdList"
|
||||||
|
request={(params) => {
|
||||||
|
return getCmsLineListPlatForm(params as API.AreaPlatForm.LineParams).then((res) => {
|
||||||
|
console.log(params)
|
||||||
|
const result = {
|
||||||
|
data: res.rows,
|
||||||
|
total: res.total,
|
||||||
|
success: true,
|
||||||
|
};
|
||||||
|
return result;
|
||||||
|
})
|
||||||
|
}}
|
||||||
|
toolBarRender={() => [
|
||||||
|
<Button
|
||||||
|
type="primary"
|
||||||
|
key="add"
|
||||||
|
hidden={!access.hasPerms('manage:list:add')}
|
||||||
|
onClick={async () => {
|
||||||
|
setCurrentRow(undefined);
|
||||||
|
setModalVisible(true);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<PlusOutlined /> 新建
|
||||||
|
</Button>,
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<SubWayEdit
|
||||||
|
open={modalVisible}
|
||||||
|
onSubmit={async (values) => {
|
||||||
|
const resData = await addCmsLinePlatForm(values)
|
||||||
|
if (resData.code === 200) {
|
||||||
|
setModalVisible(false);
|
||||||
|
setCurrentRow(undefined);
|
||||||
|
message.success('添加成功')
|
||||||
|
if (actionRef.current) {
|
||||||
|
actionRef.current.reload();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
onCancel={() => {
|
||||||
|
setModalVisible(false);
|
||||||
|
setCurrentRow(undefined)
|
||||||
|
}}
|
||||||
|
></SubWayEdit>
|
||||||
|
</Fragment>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export default ManagementList
|
||||||
70
src/pages/Area/Subway/edit.tsx
Normal file
70
src/pages/Area/Subway/edit.tsx
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
import { PlusOutlined } from '@ant-design/icons';
|
||||||
|
import {
|
||||||
|
ModalForm,
|
||||||
|
ProForm,
|
||||||
|
ProFormDateRangePicker,
|
||||||
|
ProFormSelect,
|
||||||
|
ProFormText,
|
||||||
|
} from '@ant-design/pro-components';
|
||||||
|
import { Button, Form, message } from 'antd';
|
||||||
|
import {DictOptionType, DictValueEnumObj} from "@/components/DictTag";
|
||||||
|
|
||||||
|
export type ListFormProps = {
|
||||||
|
onCancel: (flag?: boolean, formVals?: unknown) => void;
|
||||||
|
onSubmit: (values: API.AreaSubWay.Line) => Promise<void>;
|
||||||
|
open: boolean;
|
||||||
|
values?: Partial<API.AreaSubWay.Line>;
|
||||||
|
jobGroupOptions?: DictOptionType[];
|
||||||
|
statusOptions?: DictValueEnumObj;
|
||||||
|
};
|
||||||
|
|
||||||
|
const waitTime = (time: number = 100) => {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
setTimeout(() => {
|
||||||
|
resolve(true);
|
||||||
|
}, time);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const SubWayEdit: React.FC<ListFormProps> = (props) => {
|
||||||
|
const [form] = Form.useForm<{ name: string; company: string }>();
|
||||||
|
|
||||||
|
const handleCancel = () => {
|
||||||
|
props.onCancel();
|
||||||
|
form.resetFields();
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleFinish = async (values: Record<string, any>) => {
|
||||||
|
props.onSubmit(values as API.AreaSubWay.Line);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<ModalForm<{
|
||||||
|
name: string;
|
||||||
|
company: string;
|
||||||
|
}>
|
||||||
|
title="新增线路"
|
||||||
|
form={form}
|
||||||
|
// layout="inline"
|
||||||
|
autoFocusFirstInput
|
||||||
|
open={props.open}
|
||||||
|
modalProps={{
|
||||||
|
destroyOnClose: true,
|
||||||
|
onCancel: () => handleCancel(),
|
||||||
|
}}
|
||||||
|
submitTimeout={2000}
|
||||||
|
onFinish={handleFinish}
|
||||||
|
>
|
||||||
|
<ProForm.Group>
|
||||||
|
<ProFormText
|
||||||
|
width="xl"
|
||||||
|
name="lineName"
|
||||||
|
label="线路名称:"
|
||||||
|
placeholder="请输入名称"
|
||||||
|
/>
|
||||||
|
</ProForm.Group>
|
||||||
|
</ModalForm>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default SubWayEdit
|
||||||
@@ -3,7 +3,27 @@ import { useIntl, FormattedMessage, useAccess, history } from '@umijs/max';
|
|||||||
import { Dropdown, FormInstance, Space, Button, message, Modal } from 'antd';
|
import { Dropdown, FormInstance, Space, Button, message, Modal } from 'antd';
|
||||||
import { ActionType, FooterToolbar, PageContainer, ProColumns, ProTable } from '@ant-design/pro-components';
|
import { ActionType, FooterToolbar, PageContainer, ProColumns, ProTable } from '@ant-design/pro-components';
|
||||||
import { PlusOutlined, DeleteOutlined, ExclamationCircleOutlined, DownOutlined, EditOutlined } from '@ant-design/icons';
|
import { PlusOutlined, DeleteOutlined, ExclamationCircleOutlined, DownOutlined, EditOutlined } from '@ant-design/icons';
|
||||||
import {getCmsLineList} from "@/services/area/subway";
|
import {getCmsLineList, addCmsLineSubWay, deleteCmsLineSubWay} from "@/services/area/subway";
|
||||||
|
import SubWayEdit from "@/pages/Area/Subway/edit";
|
||||||
|
const handleRemoveOne = async (selectedRow: API.AreaSubWay.Line) => {
|
||||||
|
const hide = message.loading('正在删除');
|
||||||
|
if (!selectedRow) return true;
|
||||||
|
try {
|
||||||
|
const resp = await deleteCmsLineSubWay(selectedRow.lineId);
|
||||||
|
hide();
|
||||||
|
if (resp.code === 200) {
|
||||||
|
message.success('删除成功,即将刷新');
|
||||||
|
} else {
|
||||||
|
message.error(resp.msg);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} catch (error) {
|
||||||
|
hide();
|
||||||
|
message.error('删除失败,请重试');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
function ManagementList() {
|
function ManagementList() {
|
||||||
const access = useAccess();
|
const access = useAccess();
|
||||||
|
|
||||||
@@ -17,9 +37,45 @@ function ManagementList() {
|
|||||||
{
|
{
|
||||||
title: '线路名称',
|
title: '线路名称',
|
||||||
dataIndex: 'lineName',
|
dataIndex: 'lineName',
|
||||||
|
align: 'center',
|
||||||
valueType: 'text',
|
valueType: 'text',
|
||||||
hideInSearch: true,
|
render: (dom, record) => <Button type="link" onClick={() => history.push(`/area/updata-router/index/${record.lineId}`)} block>
|
||||||
|
{dom}
|
||||||
|
</Button>
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
hideInSearch: true,
|
||||||
|
align: 'center',
|
||||||
|
render: (_, record) => [
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
size="small"
|
||||||
|
danger
|
||||||
|
key="batchRemove"
|
||||||
|
icon = <DeleteOutlined/>
|
||||||
|
hidden={!access.hasPerms('area:subway:list')}
|
||||||
|
onClick={async () => {
|
||||||
|
Modal.confirm({
|
||||||
|
title: '删除',
|
||||||
|
content: '确定删除该项吗?',
|
||||||
|
okText: '确认',
|
||||||
|
cancelText: '取消',
|
||||||
|
onOk: async () => {
|
||||||
|
const success = await handleRemoveOne(record);
|
||||||
|
if (success) {
|
||||||
|
if (actionRef.current) {
|
||||||
|
actionRef.current.reload();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</Button>
|
||||||
|
]
|
||||||
|
}
|
||||||
]
|
]
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
@@ -30,8 +86,12 @@ function ManagementList() {
|
|||||||
actionRef={actionRef}
|
actionRef={actionRef}
|
||||||
formRef={formTableRef}
|
formRef={formTableRef}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
request={(params) =>
|
headerTitle='信息'
|
||||||
getCmsLineList({ ...params } as API.AreaSubWay.LineParams).then((res) => {
|
rowKey="lineId"
|
||||||
|
key="lineIdList"
|
||||||
|
request={(params) => {
|
||||||
|
return getCmsLineList(params as API.AreaSubWay.LineParams).then((res) => {
|
||||||
|
console.log(params)
|
||||||
const result = {
|
const result = {
|
||||||
data: res.rows,
|
data: res.rows,
|
||||||
total: res.total,
|
total: res.total,
|
||||||
@@ -39,7 +99,7 @@ function ManagementList() {
|
|||||||
};
|
};
|
||||||
return result;
|
return result;
|
||||||
})
|
})
|
||||||
}
|
}}
|
||||||
toolBarRender={() => [
|
toolBarRender={() => [
|
||||||
<Button
|
<Button
|
||||||
type="primary"
|
type="primary"
|
||||||
@@ -55,6 +115,25 @@ function ManagementList() {
|
|||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<SubWayEdit
|
||||||
|
open={modalVisible}
|
||||||
|
onSubmit={async (values) => {
|
||||||
|
const resData = await addCmsLineSubWay(values)
|
||||||
|
if (resData.code === 200) {
|
||||||
|
setModalVisible(false);
|
||||||
|
setCurrentRow(undefined);
|
||||||
|
message.success('添加成功')
|
||||||
|
if (actionRef.current) {
|
||||||
|
actionRef.current.reload();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
onCancel={() => {
|
||||||
|
setModalVisible(false);
|
||||||
|
setCurrentRow(undefined)
|
||||||
|
}}
|
||||||
|
values={currentRow}
|
||||||
|
></SubWayEdit>
|
||||||
</Fragment>
|
</Fragment>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,9 +13,9 @@ export type ListFormProps = {
|
|||||||
onCancel: (flag?: boolean, formVals?: unknown) => void;
|
onCancel: (flag?: boolean, formVals?: unknown) => void;
|
||||||
onSubmit: (values: API.Management.Manage) => Promise<void>;
|
onSubmit: (values: API.Management.Manage) => Promise<void>;
|
||||||
open: boolean;
|
open: boolean;
|
||||||
values: Partial<API.Management.Manage>;
|
// values: Partial<API.Management.Manage>;
|
||||||
jobGroupOptions: DictOptionType[];
|
// jobGroupOptions: DictOptionType[];
|
||||||
statusOptions: DictValueEnumObj;
|
// statusOptions: DictValueEnumObj;
|
||||||
};
|
};
|
||||||
|
|
||||||
const waitTime = (time: number = 100) => {
|
const waitTime = (time: number = 100) => {
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ function ManagementList() {
|
|||||||
open={modalVisible}
|
open={modalVisible}
|
||||||
onSubmit={(values) => {
|
onSubmit={(values) => {
|
||||||
console.log(values)
|
console.log(values)
|
||||||
|
return Promise.resolve()
|
||||||
}}
|
}}
|
||||||
onCancel={() => {
|
onCancel={() => {
|
||||||
setModalVisible(false);
|
setModalVisible(false);
|
||||||
|
|||||||
@@ -1,11 +1,29 @@
|
|||||||
|
|
||||||
import { request } from '@umijs/max';
|
import { request } from '@umijs/max';
|
||||||
|
|
||||||
|
|
||||||
export async function getCmsAreaList(params?: API.AreaBusiness.CircleParams) {
|
export async function getCmsAreaList(params?: API.AreaBusiness.CircleParams) {
|
||||||
return request<API.AreaBusiness.CirclePageResult>(`/api/cms/area/list`, {
|
return request<API.AreaBusiness.CirclePageResult>(`/api/cms/area/list`, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function addCmsAreaListRow(params?: API.AreaBusiness.CircleEditParams) {
|
||||||
|
return request<API.AreaBusiness.CirclePageResult>(`/api/cms/area`, {
|
||||||
|
method: 'post',
|
||||||
|
data: params
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function updateCmsAreaListRow(params?: API.AreaBusiness.CircleEditParams) {
|
||||||
|
return request<API.AreaBusiness.CirclePageResult>(`/api/cms/area`, {
|
||||||
|
method: 'put',
|
||||||
|
data: params
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function deleteCmsAreaListRow(ids: number) {
|
||||||
|
return request<API.AreaPlatForm.LinePageResult>(`/api/cms/area/${ids}`, {
|
||||||
|
method: 'delete',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,6 +4,21 @@ import { request } from '@umijs/max';
|
|||||||
export async function getCmsLineList(params?: API.AreaSubWay.LineParams) {
|
export async function getCmsLineList(params?: API.AreaSubWay.LineParams) {
|
||||||
return request<API.AreaSubWay.LinePageResult>(`/api/cms/line/list`, {
|
return request<API.AreaSubWay.LinePageResult>(`/api/cms/line/list`, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
|
params: params
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增
|
||||||
|
export async function addCmsLineSubWay(params?: API.AreaSubWay.AddLineParams) {
|
||||||
|
return request<API.AreaSubWay.LinePageResult>(`/api/cms/line`, {
|
||||||
|
method: 'post',
|
||||||
|
data: params,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function deleteCmsLineSubWay(ids: number) {
|
||||||
|
return request<API.AreaSubWay.LinePageResult>(`/api/cms/line/${ids}`, {
|
||||||
|
method: 'delete',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
26
src/services/area/upline.ts
Normal file
26
src/services/area/upline.ts
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
|
||||||
|
import { request } from '@umijs/max';
|
||||||
|
|
||||||
|
export async function getCmsLineListPlatForm(params?: API.AreaPlatForm.LineParams) {
|
||||||
|
return request<API.AreaPlatForm.LinePageResult>(`/api/cms/station/list`, {
|
||||||
|
method: 'GET',
|
||||||
|
params: params
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增
|
||||||
|
export async function addCmsLinePlatForm(params?: API.AreaPlatForm.AddLineParams) {
|
||||||
|
return request<API.AreaPlatForm.LinePageResult>(`/api/cms/station`, {
|
||||||
|
method: 'post',
|
||||||
|
data: params,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function deleteCmsLinePlatForm(ids: number) {
|
||||||
|
return request<API.AreaPlatForm.LinePageResult>(`/api/cms/station/${ids}`, {
|
||||||
|
method: 'delete',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
8
src/types/area/business.d.ts
vendored
8
src/types/area/business.d.ts
vendored
@@ -4,6 +4,7 @@ declare namespace API.AreaBusiness {
|
|||||||
commercialAreaName: string;
|
commercialAreaName: string;
|
||||||
latitude: number;
|
latitude: number;
|
||||||
longitude: number;
|
longitude: number;
|
||||||
|
createTime: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface LinePoint {
|
export interface LinePoint {
|
||||||
@@ -21,6 +22,13 @@ declare namespace API.AreaBusiness {
|
|||||||
current?: string;
|
current?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface CircleEditParams {
|
||||||
|
commercialAreaName: string;
|
||||||
|
latitude: number;
|
||||||
|
longitude: number;
|
||||||
|
commercialAreaId?: number;
|
||||||
|
}
|
||||||
|
|
||||||
export interface CirclePageResult {
|
export interface CirclePageResult {
|
||||||
code: number;
|
code: number;
|
||||||
msg: string;
|
msg: string;
|
||||||
|
|||||||
15
src/types/area/subway.d.ts
vendored
15
src/types/area/subway.d.ts
vendored
@@ -8,18 +8,33 @@ declare namespace API.AreaSubWay {
|
|||||||
export interface LinePoint {
|
export interface LinePoint {
|
||||||
latitude: number;
|
latitude: number;
|
||||||
longitude: numberl;
|
longitude: numberl;
|
||||||
|
lineId: number;
|
||||||
lineName: string;
|
lineName: string;
|
||||||
stationId: number;
|
stationId: number;
|
||||||
stationName: string;
|
stationName: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface LineParams {
|
export interface LineParams {
|
||||||
|
lineId: number;
|
||||||
createTime?: string;
|
createTime?: string;
|
||||||
updateTime?: string;
|
updateTime?: string;
|
||||||
pageSize?: string;
|
pageSize?: string;
|
||||||
current?: string;
|
current?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface AddLineParams {
|
||||||
|
lineName: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface linePointParams {
|
||||||
|
latitude?: number;
|
||||||
|
lineId?: number;
|
||||||
|
lineName?: string;
|
||||||
|
longitude?: number;
|
||||||
|
stationId?: number;
|
||||||
|
stationName?: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface LinePageResult {
|
export interface LinePageResult {
|
||||||
code: number;
|
code: number;
|
||||||
msg: string;
|
msg: string;
|
||||||
|
|||||||
44
src/types/area/upline.d.ts
vendored
Normal file
44
src/types/area/upline.d.ts
vendored
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
declare namespace API.AreaPlatForm {
|
||||||
|
export interface Line {
|
||||||
|
lineId: number;
|
||||||
|
lineName: string;
|
||||||
|
subwayStationList: Array<LinePoint>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface LinePoint {
|
||||||
|
latitude: number;
|
||||||
|
longitude: numberl;
|
||||||
|
lineId: number;
|
||||||
|
lineName: string;
|
||||||
|
stationId: number;
|
||||||
|
stationName: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface LineParams {
|
||||||
|
lineId: number;
|
||||||
|
createTime?: string;
|
||||||
|
updateTime?: string;
|
||||||
|
pageSize?: string;
|
||||||
|
current?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AddLineParams {
|
||||||
|
lineName: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface linePointParams {
|
||||||
|
latitude?: number;
|
||||||
|
lineId?: number;
|
||||||
|
lineName?: string;
|
||||||
|
longitude?: number;
|
||||||
|
stationId?: number;
|
||||||
|
stationName?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface LinePageResult {
|
||||||
|
code: number;
|
||||||
|
msg: string;
|
||||||
|
total: number;
|
||||||
|
rows: Array<Line>;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user