feat[景区管理]:后台管理界面新增景区管理模块,以及部分代码优化等逻辑
This commit is contained in:
+2
-12
@@ -16,6 +16,7 @@ import com.central.order.service.IOrderFileService;
|
|||||||
import com.central.order.service.IOrderService;
|
import com.central.order.service.IOrderService;
|
||||||
import com.central.order.service.IQrCodeService;
|
import com.central.order.service.IQrCodeService;
|
||||||
import com.central.order.service.ITourismService;
|
import com.central.order.service.ITourismService;
|
||||||
|
import com.central.order.util.ContentTypeUtil;
|
||||||
import com.wechat.pay.java.core.exception.ServiceException;
|
import com.wechat.pay.java.core.exception.ServiceException;
|
||||||
import com.wechat.pay.java.service.payments.jsapi.JsapiServiceExtension;
|
import com.wechat.pay.java.service.payments.jsapi.JsapiServiceExtension;
|
||||||
import com.wechat.pay.java.service.payments.jsapi.model.*;
|
import com.wechat.pay.java.service.payments.jsapi.model.*;
|
||||||
@@ -141,18 +142,7 @@ public class OrderController {
|
|||||||
Map<String,String> imgMap = new HashMap<>();
|
Map<String,String> imgMap = new HashMap<>();
|
||||||
String url = fileCenterService.getViewUrlByName(orderFile.getFilePath());
|
String url = fileCenterService.getViewUrlByName(orderFile.getFilePath());
|
||||||
imgMap.put("url", url.replace(cdnOssUrl,cdnUrl));
|
imgMap.put("url", url.replace(cdnOssUrl,cdnUrl));
|
||||||
//@TODO 待优化file_type获取方式
|
imgMap.put("contentType", ContentTypeUtil.getContentTypeFromUrl(url));
|
||||||
if (url != null && !"".equals(url) ){
|
|
||||||
if (url.contains(".jpeg")){
|
|
||||||
imgMap.put("contentType", "image/jpeg");
|
|
||||||
}else if (url.contains(".png")){
|
|
||||||
imgMap.put("contentType", "image/png");
|
|
||||||
}else if (url.contains(".gif")){
|
|
||||||
imgMap.put("contentType", "image/gif");
|
|
||||||
}else if (url.contains(".mp4")){
|
|
||||||
imgMap.put("contentType", "video/mp4");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
resultList.add(imgMap);
|
resultList.add(imgMap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-10
@@ -45,16 +45,9 @@ public class TourismController {
|
|||||||
return tourismService.findList(params);
|
return tourismService.findList(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "创建Tourism")
|
@PostMapping()
|
||||||
@PostMapping
|
public Result saveOrUpdate(@RequestBody Tourism tourism) {
|
||||||
public Result<Tourism> createTourism(@RequestBody Tourism tourism) {
|
return tourismService.saveOrUpdateTourism(tourism);
|
||||||
|
|
||||||
boolean result = tourismService.createTourism(tourism);
|
|
||||||
if (result) {
|
|
||||||
return Result.succeed(tourism,"jq创建成功");
|
|
||||||
} else {
|
|
||||||
return Result.failed("jq创建失败");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "查询Tourism")
|
@Operation(summary = "查询Tourism")
|
||||||
@@ -67,4 +60,10 @@ public class TourismController {
|
|||||||
return Result.succeed(tourism,"获取成功");
|
return Result.succeed(tourism,"获取成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DeleteMapping()
|
||||||
|
// @AuditLog(operation = "'新增或更新用户:' + #sysUser.username")
|
||||||
|
public Result delete(@RequestBody Tourism tourism) {
|
||||||
|
boolean result = tourismService.removeById(tourism);
|
||||||
|
return result ? Result.succeed(tourism, "操作成功") : Result.failed("操作失败");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package com.central.order.enums;
|
||||||
|
|
||||||
|
public enum FileType {
|
||||||
|
JPEG("image/jpeg", ".jpeg", ".jpg"),
|
||||||
|
PNG("image/png", ".png"),
|
||||||
|
GIF("image/gif", ".gif"),
|
||||||
|
MP4("video/mp4", ".mp4");
|
||||||
|
|
||||||
|
private final String contentType;
|
||||||
|
private final String[] extensions;
|
||||||
|
|
||||||
|
FileType(String contentType, String... extensions) {
|
||||||
|
this.contentType = contentType;
|
||||||
|
this.extensions = extensions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getContentType() {
|
||||||
|
return contentType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getExtensions() {
|
||||||
|
return extensions;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据文件扩展名获取对应的 FileType
|
||||||
|
*
|
||||||
|
* @param extension 文件扩展名
|
||||||
|
* @return 对应的 FileType,如果不支持则返回 null
|
||||||
|
*/
|
||||||
|
public static FileType fromExtension(String extension) {
|
||||||
|
for (FileType type : values()) {
|
||||||
|
for (String ext : type.getExtensions()) {
|
||||||
|
if (ext.equalsIgnoreCase(extension)) {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
+2
-1
@@ -1,6 +1,7 @@
|
|||||||
package com.central.order.service;
|
package com.central.order.service;
|
||||||
|
|
||||||
import com.central.common.model.PageResult;
|
import com.central.common.model.PageResult;
|
||||||
|
import com.central.common.model.Result;
|
||||||
import com.central.common.service.ISuperService;
|
import com.central.common.service.ISuperService;
|
||||||
import com.central.order.model.Tourism;
|
import com.central.order.model.Tourism;
|
||||||
|
|
||||||
@@ -26,7 +27,7 @@ public interface ITourismService extends ISuperService<Tourism> {
|
|||||||
* @param tourism
|
* @param tourism
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
boolean createTourism(Tourism tourism) ;
|
Result saveOrUpdateTourism(Tourism tourism) ;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* id查询
|
* id查询
|
||||||
|
|||||||
+4
-6
@@ -2,6 +2,7 @@ package com.central.order.service.impl;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.central.common.model.PageResult;
|
import com.central.common.model.PageResult;
|
||||||
|
import com.central.common.model.Result;
|
||||||
import com.central.common.service.impl.SuperServiceImpl;
|
import com.central.common.service.impl.SuperServiceImpl;
|
||||||
import com.central.order.mapper.TourismMapper;
|
import com.central.order.mapper.TourismMapper;
|
||||||
import com.central.order.model.Tourism;
|
import com.central.order.model.Tourism;
|
||||||
@@ -36,12 +37,9 @@ public class TourismServiceImpl extends SuperServiceImpl<TourismMapper, Tourism>
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean createTourism(Tourism tourism) {
|
public Result saveOrUpdateTourism(Tourism tourism) {
|
||||||
int result = baseMapper.insert(tourism);
|
boolean result = saveOrUpdate(tourism);
|
||||||
if(result > 0){
|
return result ? Result.succeed(tourism, "操作成功") : Result.failed("操作失败");
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package com.central.order.util;
|
||||||
|
|
||||||
|
import com.central.order.enums.FileType;
|
||||||
|
|
||||||
|
public class ContentTypeUtil {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据 URL 的文件扩展名获取对应的 contentType
|
||||||
|
*
|
||||||
|
* @param url 文件的 URL
|
||||||
|
* @return 包含 contentType 的 Map,如果 URL 为空或不包含支持的扩展名,返回空的 Map
|
||||||
|
*/
|
||||||
|
public static String getContentTypeFromUrl(String url) {
|
||||||
|
|
||||||
|
if (url != null && !url.isEmpty()) {
|
||||||
|
// 获取文件扩展名
|
||||||
|
int lastDotIndex = url.lastIndexOf('.');
|
||||||
|
if (lastDotIndex != -1) {
|
||||||
|
String extension = url.substring(lastDotIndex);
|
||||||
|
FileType fileType = FileType.fromExtension(extension);
|
||||||
|
if (fileType != null) {
|
||||||
|
return fileType.getContentType();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return FileType.JPEG.getContentType();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -57,6 +57,10 @@
|
|||||||
{
|
{
|
||||||
path: '/orders/orderFiles.html',
|
path: '/orders/orderFiles.html',
|
||||||
component: './orders/OrderFile',
|
component: './orders/OrderFile',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/orders/tourism.html',
|
||||||
|
component: './orders/Tourism',
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import React, { useRef, useState } from 'react';
|
|||||||
|
|
||||||
const { Link } = Typography;
|
const { Link } = Typography;
|
||||||
|
|
||||||
const handleDelete = async (deletefile: ORDERS.orderFile) => {
|
const handleDelete = async (deletefile: ORDERS.OrderFile) => {
|
||||||
const hide = message.loading('正在删除');
|
const hide = message.loading('正在删除');
|
||||||
try {
|
try {
|
||||||
const result = await deleteFile(deletefile.id);
|
const result = await deleteFile(deletefile.id);
|
||||||
@@ -33,7 +33,7 @@ const handleDelete = async (deletefile: ORDERS.orderFile) => {
|
|||||||
const TableList: React.FC = () => {
|
const TableList: React.FC = () => {
|
||||||
const actionRef = useRef<ActionType>();
|
const actionRef = useRef<ActionType>();
|
||||||
const [params, setParams] = useState<Record<string, string | number>>({ });
|
const [params, setParams] = useState<Record<string, string | number>>({ });
|
||||||
const columns: ProColumns<ORDERS.orderFile>[] = [
|
const columns: ProColumns<ORDERS.OrderFile>[] = [
|
||||||
{
|
{
|
||||||
dataIndex: 'index',
|
dataIndex: 'index',
|
||||||
valueType: 'indexBorder',
|
valueType: 'indexBorder',
|
||||||
@@ -94,7 +94,7 @@ const TableList: React.FC = () => {
|
|||||||
>
|
>
|
||||||
<ProFormText name="name" label="搜索" placeholder="输入关键字" />
|
<ProFormText name="name" label="搜索" placeholder="输入关键字" />
|
||||||
</QueryFilter>
|
</QueryFilter>
|
||||||
<ProTable<ORDERS.orderFile>
|
<ProTable<ORDERS.OrderFile>
|
||||||
rowKey="id"
|
rowKey="id"
|
||||||
headerTitle="任务列表"
|
headerTitle="任务列表"
|
||||||
request={orderFiles}
|
request={orderFiles}
|
||||||
|
|||||||
+69
@@ -0,0 +1,69 @@
|
|||||||
|
import {
|
||||||
|
ModalForm,
|
||||||
|
ProForm,
|
||||||
|
ProFormText,
|
||||||
|
} from '@ant-design/pro-components';
|
||||||
|
import { Form } from 'antd';
|
||||||
|
|
||||||
|
export type FormValueType = Partial<ORDERS.Tourism>;
|
||||||
|
|
||||||
|
export type UpdateFormProps = {
|
||||||
|
onVisibleChange: (flag: boolean) => void;
|
||||||
|
onSubmit: (values: FormValueType) => Promise<void>;
|
||||||
|
updateModalVisible: boolean;
|
||||||
|
values?: ORDERS.Tourism;
|
||||||
|
};
|
||||||
|
|
||||||
|
const UpdateForm: React.FC<UpdateFormProps> = (props) => {
|
||||||
|
const [form] = Form.useForm();
|
||||||
|
return (
|
||||||
|
<ModalForm
|
||||||
|
title="修改景区"
|
||||||
|
form={form}
|
||||||
|
visible={props.updateModalVisible}
|
||||||
|
onFinish={props.onSubmit}
|
||||||
|
onVisibleChange={props.onVisibleChange}
|
||||||
|
>
|
||||||
|
<ProForm.Group>
|
||||||
|
<ProFormText
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '名称不为空',
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
width="md"
|
||||||
|
name="tourismName"
|
||||||
|
label="名称"
|
||||||
|
placeholder="输入名称"
|
||||||
|
/>
|
||||||
|
<ProFormText
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '地址不为空',
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
width="md"
|
||||||
|
name="tourismAddress"
|
||||||
|
label="地址"
|
||||||
|
placeholder="输入地址"
|
||||||
|
/>
|
||||||
|
<ProFormText
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '手机号不为空',
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
width="md"
|
||||||
|
name="tourismPhone"
|
||||||
|
label="手机号"
|
||||||
|
placeholder="输入手机号"
|
||||||
|
/>
|
||||||
|
</ProForm.Group>
|
||||||
|
</ModalForm>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default UpdateForm;
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
@import (reference) '~antd/es/style/themes/index';
|
||||||
@@ -0,0 +1,259 @@
|
|||||||
|
import UpdateForm from '@/pages/orders/Tourism/components/UpdateForm';
|
||||||
|
import { tourism, saveOrUpdateTourism, deleteTourism } from '@/services/orders/api';
|
||||||
|
import { PlusOutlined } from '@ant-design/icons';
|
||||||
|
import type { ActionType, ProColumns } from '@ant-design/pro-components';
|
||||||
|
import {
|
||||||
|
ModalForm,
|
||||||
|
PageContainer,
|
||||||
|
ProForm,
|
||||||
|
ProFormText,
|
||||||
|
ProTable,
|
||||||
|
QueryFilter,
|
||||||
|
} from '@ant-design/pro-components';
|
||||||
|
import { Typography, message, Popconfirm, Button, Space } from 'antd';
|
||||||
|
import React, { useRef, useState } from 'react';
|
||||||
|
|
||||||
|
const { Link } = Typography;
|
||||||
|
|
||||||
|
const handleAdd = async (fields: ORDERS.Tourism) => {
|
||||||
|
const hide = message.loading('正在添加');
|
||||||
|
try {
|
||||||
|
const result = await saveOrUpdateTourism({ ...fields });
|
||||||
|
hide();
|
||||||
|
if (result.resp_code === 0) {
|
||||||
|
message.success('添加用户成功');
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
message.error(result.resp_msg);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
hide();
|
||||||
|
message.error('添加用户失败');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleEdit = async (fields: ORDERS.Tourism) => {
|
||||||
|
const hide = message.loading('正在更新');
|
||||||
|
try {
|
||||||
|
const result = await saveOrUpdateTourism({ ...fields });
|
||||||
|
hide();
|
||||||
|
if (result.resp_code === 0) {
|
||||||
|
message.success('修改景区成功');
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
message.error(result.resp_msg);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
hide();
|
||||||
|
message.error('修改景区失败');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const handleDelete = async (tourism: ORDERS.Tourism) => {
|
||||||
|
const hide = message.loading('正在删除');
|
||||||
|
try {
|
||||||
|
const result = await deleteTourism(tourism.id);
|
||||||
|
hide();
|
||||||
|
if (result.resp_code === 0) {
|
||||||
|
message.success('删除景区成功');
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
message.error(result.resp_msg);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
hide();
|
||||||
|
message.error('删除景区失败');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const TableList: React.FC = () => {
|
||||||
|
const [params, setParams] = useState<Record<string, string | number>>({});
|
||||||
|
const actionRef = useRef<ActionType>();
|
||||||
|
const [createModalVisible, handleModalVisible] = useState<boolean>(false);
|
||||||
|
const [updateModalVisible, handleUpdateModalVisible] = useState<boolean>(false);
|
||||||
|
const [currentRow, setCurrentRow] = useState<ORDERS.Tourism>();
|
||||||
|
const columns: ProColumns<ORDERS.Tourism>[] = [
|
||||||
|
{
|
||||||
|
dataIndex: 'index',
|
||||||
|
valueType: 'indexBorder',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'ID',
|
||||||
|
dataIndex: 'id',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '编号',
|
||||||
|
dataIndex: 'tourismNo',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '名称',
|
||||||
|
dataIndex: 'tourismName',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '地址',
|
||||||
|
dataIndex: 'tourismAddress',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '联系电话',
|
||||||
|
dataIndex: 'tourismPhone',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '状态',
|
||||||
|
dataIndex: 'status',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '创建时间',
|
||||||
|
dataIndex: 'createTime',
|
||||||
|
valueType: 'dateTime',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
key: 'action',
|
||||||
|
render: (_, entity) =>
|
||||||
|
<Space>
|
||||||
|
<Link
|
||||||
|
onClick={() => {
|
||||||
|
setCurrentRow(entity);
|
||||||
|
handleUpdateModalVisible(true);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
修改
|
||||||
|
</Link>
|
||||||
|
<Popconfirm
|
||||||
|
title={`确认删除景区[${entity.tourismName}]?`}
|
||||||
|
onConfirm={async () => {
|
||||||
|
const success = await handleDelete(entity);
|
||||||
|
if (success) {
|
||||||
|
if (actionRef.current) {
|
||||||
|
actionRef.current.reload();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Link>删除</Link>
|
||||||
|
</Popconfirm>
|
||||||
|
</Space>
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
return (
|
||||||
|
<PageContainer header={{ subTitle: '管理景区' }}>
|
||||||
|
<QueryFilter
|
||||||
|
defaultCollapsed
|
||||||
|
split
|
||||||
|
span={6}
|
||||||
|
className="query-filter"
|
||||||
|
onFinish={async (values) => setParams(values)}
|
||||||
|
>
|
||||||
|
<ProFormText name="name" label="搜索" placeholder="输入关键字" />
|
||||||
|
</QueryFilter>
|
||||||
|
<ProTable<ORDERS.Tourism>
|
||||||
|
rowKey="id"
|
||||||
|
headerTitle="景区列表"
|
||||||
|
request={tourism}
|
||||||
|
actionRef={actionRef}
|
||||||
|
columns={columns}
|
||||||
|
search={false}
|
||||||
|
params={params}
|
||||||
|
pagination={{
|
||||||
|
showSizeChanger: true,
|
||||||
|
showQuickJumper: true,
|
||||||
|
}}
|
||||||
|
toolBarRender={() => [
|
||||||
|
<>
|
||||||
|
<Button
|
||||||
|
type="primary"
|
||||||
|
onClick={() => {
|
||||||
|
handleModalVisible(true);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<PlusOutlined /> 添加
|
||||||
|
</Button>
|
||||||
|
</>,
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
<ModalForm
|
||||||
|
title="添加景区"
|
||||||
|
// layout="horizontal"
|
||||||
|
visible={createModalVisible}
|
||||||
|
onVisibleChange={handleModalVisible}
|
||||||
|
modalProps={{ destroyOnClose: true }}
|
||||||
|
onFinish={async (values) => {
|
||||||
|
|
||||||
|
const success = await handleAdd(values);
|
||||||
|
if (success) {
|
||||||
|
handleModalVisible(false);
|
||||||
|
if (actionRef.current) {
|
||||||
|
actionRef.current.reload();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<ProForm.Group>
|
||||||
|
<ProFormText
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '名称不为空',
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
width="md"
|
||||||
|
name="tourismName"
|
||||||
|
label="名称"
|
||||||
|
placeholder="输入名称"
|
||||||
|
/>
|
||||||
|
<ProFormText
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '地址不为空',
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
width="md"
|
||||||
|
name="tourismAddress"
|
||||||
|
label="地址"
|
||||||
|
placeholder="输入地址"
|
||||||
|
/>
|
||||||
|
<ProFormText
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '手机号不为空',
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
width="md"
|
||||||
|
name="tourismPhone"
|
||||||
|
label="手机号"
|
||||||
|
placeholder="输入手机号"
|
||||||
|
/>
|
||||||
|
</ProForm.Group>
|
||||||
|
</ModalForm>
|
||||||
|
<UpdateForm
|
||||||
|
onSubmit={async (values) => {
|
||||||
|
if (currentRow) {
|
||||||
|
|
||||||
|
const success = await handleEdit({ ...currentRow, ...values });
|
||||||
|
if (success) {
|
||||||
|
handleUpdateModalVisible(false);
|
||||||
|
if (actionRef.current) {
|
||||||
|
actionRef.current.reload();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setCurrentRow(undefined);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
onVisibleChange={handleUpdateModalVisible}
|
||||||
|
updateModalVisible={updateModalVisible}
|
||||||
|
values={currentRow}
|
||||||
|
/>
|
||||||
|
|
||||||
|
</PageContainer>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default TableList;
|
||||||
@@ -21,9 +21,34 @@ export async function deleteFile(id: number) {
|
|||||||
|
|
||||||
export async function orderFiles(params?: { [key: string]: string | number }) {
|
export async function orderFiles(params?: { [key: string]: string | number }) {
|
||||||
const { current, pageSize, ...rest } = params ?? {};
|
const { current, pageSize, ...rest } = params ?? {};
|
||||||
const result = await request<SYSTEM.Page<ORDERS.orderFile>>('/api-order/files', {
|
const result = await request<SYSTEM.Page<ORDERS.OrderFile>>('/api-order/files', {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
params: { page: current, limit: pageSize, ...rest },
|
params: { page: current, limit: pageSize, ...rest },
|
||||||
});
|
});
|
||||||
return { data: result.data, total: result.count };
|
return { data: result.data, total: result.count };
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function tourism(params?: { [key: string]: string | number }) {
|
||||||
|
const { current, pageSize, ...rest } = params ?? {};
|
||||||
|
const result = await request<SYSTEM.Page<ORDERS.Tourism>>('/api-order/tourism', {
|
||||||
|
method: 'GET',
|
||||||
|
params: { page: current, limit: pageSize, ...rest },
|
||||||
|
});
|
||||||
|
return { data: result.data, total: result.count };
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function saveOrUpdateTourism(data: ORDERS.Tourism): Promise<API.Result<ORDERS.Tourism>> {
|
||||||
|
const result = await request<API.Result<ORDERS.Tourism>>('/api-order/tourism', {
|
||||||
|
method: 'POST',
|
||||||
|
data,
|
||||||
|
});
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function deleteTourism(id: number) {
|
||||||
|
const url = `/api-order/tourism/${id}`;
|
||||||
|
const result = await request<API.Result<void>>(url, {
|
||||||
|
method: 'DELETE',
|
||||||
|
});
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
@@ -12,15 +12,28 @@ declare namespace ORDERS {
|
|||||||
updateTime?: string;
|
updateTime?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
type orderFile = {
|
type OrderFile = {
|
||||||
id: number;
|
id: number;
|
||||||
userId: string;
|
userId: string;
|
||||||
fileId: string;
|
fileId: string;
|
||||||
filePath: string;
|
filePath: string;
|
||||||
orderNo: string;
|
orderNo: string;
|
||||||
file_type: string;
|
fileType: string;
|
||||||
createTime?: string;
|
createTime?: string;
|
||||||
tenantId?: string;
|
tenantId?: string;
|
||||||
updateTime?: string;
|
updateTime?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Tourism = {
|
||||||
|
id: number;
|
||||||
|
tourismName: string;
|
||||||
|
tourismDesc: string;
|
||||||
|
tourismNo: string;
|
||||||
|
tourismAddress: string;
|
||||||
|
tourismPhone: string;
|
||||||
|
createTime?: string;
|
||||||
|
status: number;
|
||||||
|
tenantId?: string;
|
||||||
|
updateTime?: string;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user