flat:商圈优化,导出文件优化2

This commit is contained in:
Apcallover
2025-10-30 10:54:08 +08:00
parent de7cf14248
commit 203b7d4ef7
4 changed files with 140 additions and 91 deletions

View File

@@ -4,7 +4,13 @@ import { Button, FormInstance, message, Modal } from 'antd';
import { ActionType, ProColumns, ProTable } from '@ant-design/pro-components'; import { ActionType, ProColumns, ProTable } from '@ant-design/pro-components';
import { DeleteOutlined, FormOutlined, PlusOutlined } from '@ant-design/icons'; import { DeleteOutlined, FormOutlined, PlusOutlined } from '@ant-design/icons';
import UpStationEdit from '@/pages/Area/Business/UpLine/edit'; import UpStationEdit from '@/pages/Area/Business/UpLine/edit';
import { addCmsAreaListRow, deleteCmsAreaListRow, getCmsAreaList } from '@/services/area/business'; import {
addCmsAreaListRow,
deleteCmsAreaListRow,
getCmsAreaList,
updateCmsAreaListRow,
} from '@/services/area/business';
import { useLocation } from '@@/exports';
const handleRemoveOne = async (selectedRow: API.AreaSubWay.LinePoint) => { const handleRemoveOne = async (selectedRow: API.AreaSubWay.LinePoint) => {
const hide = message.loading('正在删除'); const hide = message.loading('正在删除');
@@ -30,16 +36,23 @@ function ManagementList() {
const formTableRef = useRef<FormInstance>(); const formTableRef = useRef<FormInstance>();
const actionRef = useRef<ActionType>(); const actionRef = useRef<ActionType>();
const location = useLocation();
const params = useParams();
const searchParams = new URLSearchParams(location.search);
const name = searchParams.get('name');
const id = params.id || '0';
const [regionalId, setRegionalId] = useState<string>(); const [regionalId, setRegionalId] = useState<string>();
const [regionalName, setRegionalName] = useState<string>();
const [currentRow, setCurrentRow] = useState<API.AreaPlatForm.LinePoint>(); const [currentRow, setCurrentRow] = useState<API.AreaPlatForm.LinePoint>();
const [modalVisible, setModalVisible] = useState<boolean>(false); const [modalVisible, setModalVisible] = useState<boolean>(false);
const [page, setPage] = useState<API.AreaPlatForm.LineParams>({}); const [page, setPage] = useState<API.AreaPlatForm.LineParams>({});
const params = useParams();
const id = params.id || '0';
useEffect(() => { useEffect(() => {
if (regionalId !== id) { if (regionalId !== id) {
setRegionalId(id); setRegionalId(id);
setRegionalName(name);
} }
}, [regionalId, params]); }, [regionalId, params]);
@@ -157,9 +170,8 @@ function ManagementList() {
setCurrentRow(undefined); setCurrentRow(undefined);
}} }}
onSubmit={async (values) => { onSubmit={async (values) => {
// values.regionalId = if (values.commercialAreaId) {
// values.lineName = const resData = await updateCmsAreaListRow(values);
const resData = await addCmsAreaListRow(values);
if (resData.code === 200) { if (resData.code === 200) {
setModalVisible(false); setModalVisible(false);
setCurrentRow(undefined); setCurrentRow(undefined);
@@ -168,6 +180,33 @@ function ManagementList() {
actionRef.current.reload(); actionRef.current.reload();
} }
} }
} else {
let params = {
regionalName,
regionalId,
...values,
};
const resData = await addCmsAreaListRow(params);
if (resData.code === 200) {
setModalVisible(false);
setCurrentRow(undefined);
message.success('添加成功');
if (actionRef.current) {
actionRef.current.reload();
}
}
}
// values.regionalId =
// values.lineName =
// const resData = await addCmsAreaListRow(values);
// if (resData.code === 200) {
// setModalVisible(false);
// setCurrentRow(undefined);
// message.success('添加成功');
// if (actionRef.current) {
// actionRef.current.reload();
// }
// }
}} }}
values={currentRow} values={currentRow}
></UpStationEdit> ></UpStationEdit>

View File

@@ -54,7 +54,11 @@ function ManagementList() {
render: (dom, record) => ( render: (dom, record) => (
<Button <Button
type="link" type="link"
onClick={() => history.push(`/area/updata-router/business/${record.regionalId}`)} onClick={() =>
history.push(
`/area/updata-router/business/${record.regionalId}?name=${record.regionalName}`,
)
}
block block
> >
{dom} {dom}

View File

@@ -10,7 +10,13 @@ import {
} from '@/services/Management/list'; } from '@/services/Management/list';
import { Button, FormInstance, message, Modal, Switch } from 'antd'; import { Button, FormInstance, message, Modal, Switch } from 'antd';
import { ActionType, ProColumns, ProTable } from '@ant-design/pro-components'; import { ActionType, ProColumns, ProTable } from '@ant-design/pro-components';
import { AlignLeftOutlined, BarChartOutlined, DeleteOutlined, FormOutlined, PlusOutlined } from '@ant-design/icons'; import {
AlignLeftOutlined,
BarChartOutlined,
DeleteOutlined,
FormOutlined,
PlusOutlined,
} from '@ant-design/icons';
import EditManageRow from './edit'; import EditManageRow from './edit';
import { getDictValueEnum } from '@/services/system/dict'; import { getDictValueEnum } from '@/services/system/dict';
import DictTag from '@/components/DictTag'; import DictTag from '@/components/DictTag';
@@ -100,16 +106,16 @@ function ManagementList() {
align: 'center', align: 'center',
}, },
{ {
title: '最大最小薪资', title: '最小薪资',
dataIndex: 'minSalary',
valueType: 'text',
align: 'center',
},
{
title: '最大薪资',
dataIndex: 'maxSalary', dataIndex: 'maxSalary',
valueType: 'text', valueType: 'text',
hideInSearch: true,
align: 'center', align: 'center',
render: (_, record) => (
<>
{record.minSalary}-{record.maxSalary}
</>
),
}, },
{ {
title: '单位名称', title: '单位名称',
@@ -244,7 +250,7 @@ function ManagementList() {
> >
</Button> </Button>
</div> </div>,
], ],
}, },
]; ];

View File

@@ -1,22 +1,22 @@
import { request } from '@umijs/max'; import { request } from '@umijs/max';
import { getDateTimeForFilename } from '@/utils/tools'; import { getDateTimeForFilename } from '@/utils/tools';
export async function getCmsAreaList(params?: API.BusinessParams.BusinessParams) { export async function getCmsAreaList(params?: API.AreaRegional.BusinessParams) {
return request<API.AreaRegional.Regional>(`/api/cms/area/list`, { return request<API.AreaRegional.Regional>(`/api/cms/area/list`, {
method: 'GET', method: 'GET',
params: params, params: params,
}); });
} }
export async function addCmsAreaListRow(params?: API.BusinessParams.BusinessParams) { export async function addCmsAreaListRow(params?: API.AreaRegional.BusinessParams) {
return request<API.BusinessParams.Business>(`/api/cms/area`, { return request<API.AreaRegional.Business>(`/api/cms/area`, {
method: 'post', method: 'post',
data: params, data: params,
}); });
} }
export async function updateCmsAreaListRow(params?: API.BusinessParams.BusinessParams) { export async function updateCmsAreaListRow(params?: API.AreaRegional.BusinessParams) {
return request<API.BusinessParams.Business>(`/api/cms/area`, { return request<API.AreaRegional.Business>(`/api/cms/area`, {
method: 'put', method: 'put',
data: params, data: params,
}); });
@@ -28,7 +28,7 @@ export async function deleteCmsAreaListRow(ids: number) {
}); });
} }
export async function exportCmsAreaListRow(params?: API.BusinessParams.BusinessParams) { export async function exportCmsAreaListRow(params?: API.AreaRegional.BusinessParams) {
return downLoadXlsx(`/api/cms/area/export`, { params }, `区域_${getDateTimeForFilename()}.xlsx`); return downLoadXlsx(`/api/cms/area/export`, { params }, `区域_${getDateTimeForFilename()}.xlsx`);
} }