提交 2fafcea4 作者: 龚洪江

Merge branch 'master' into develop

# Conflicts:
#	env/.env.development
#	src/pages/mallManage/produceManage/produceList/index.tsx
#	vite.config.ts
#请求接口地址
#VITE_REQUEST_BASE_URL='https://www.iuav.shop'
#VITE_REQUEST_BASE_URL='https://test.iuav.shop' // 测试服
#测试服
VITE_REQUEST_BASE_URL='https://test.iuav.shop'
#VITE_REQUEST_BASE_URL='https://iuav.mmcuav.cn'
VITE_REQUEST_BASE_URL='/api'
#VITE_REQUEST_BASE_URL='/api'
#旧版接口地址
#VITE_REQUEST_BASE_URL='https://iuav.mmcuav.cn'
#VITE_REQUEST_BASE_URL='https://test.iuav.mmcuav.cn'
......
......@@ -14,4 +14,4 @@ patches:
images:
- name: REGISTRY/NAMESPACE/IMAGE:TAG
newName: mmc-registry.cn-shenzhen.cr.aliyuncs.com/sharefly/admin
newTag: ca374754c9670ff0b21edc01eddc0192a2d3b665
newTag: 87957d9f539966e874d29ef4af89cbe5eb93b07f
......@@ -10,7 +10,7 @@ const { VITE_REQUEST_BASE_URL } = import.meta.env;
export const uploadImgURL = `${VITE_REQUEST_BASE_URL}/pms/upload/imgOsses`;
export const uploadVideoURL = `${VITE_REQUEST_BASE_URL}/ossservlet/upload/videoOss`;
export const uploadFileURL = `${VITE_REQUEST_BASE_URL}/ossservlet/upload/oss`;
console.log('数据-->', VITE_REQUEST_BASE_URL);
// 创建服务
const service = axios.create({
baseURL: VITE_REQUEST_BASE_URL,
......
......@@ -127,6 +127,7 @@ const Index: React.FC<propsType> = (props) => {
style={{ width: item.width ? `${item.width}px` : '180px' }}
placeholder={item.placeholder}
allowClear
onSelect={item.onSelect}
>
{item.options.map((option: any) => {
return (
......
.from-table-wrap {
position: relative;
.header-view {
position: relative;
width: 100%;
min-height: 60px;
height: auto;
background: #fff;
border-radius: 8px;
display: flex;
justify-content: flex-start;
align-content: center;
flex-wrap: wrap;
padding: 15px 20px 5px 20px;
margin: 0 0 10px 0;
.ant-select-selector {
min-width: 200px;
}
.ant-row {
margin-bottom: 10px;
}
.add-button {
margin-right: 15px;
}
}
}
.detail-wrap {
position: relative;
......
import React, { useEffect, useState } from 'react';
import React, { useEffect, useRef, useState } from 'react';
import './index.scss';
import { Button, Form, Input, message, Modal, Select, Table } from 'antd';
import { useNavigate } from 'react-router-dom';
import { Button, message, Modal, Table } from 'antd';
import { useNavigate, useSearchParams } from 'react-router-dom';
import { ColumnsType } from 'antd/es/table';
import { MakeManageAPI, ProduceManageAPI } from '~/api';
import AddOrEditProduce from './components/addOrEditProduceModal';
......@@ -10,11 +10,15 @@ import { addProductType, productListType } from '~/api/interface/produceManageTy
import { categoryListType } from '~/api/interface/categoryManage';
import { MakeListType } from '~/api/interface/makeManage';
import { PlusOutlined } from '@ant-design/icons';
import qs from 'query-string';
import SearchBox, { searchColumns } from '~/components/search-box';
//产品列表返回类型
type produceListType = InterDataType<productListType>['list'];
//产品列表参数类型
type produceParametersType = Omit<InterReqType<productListType>, 'pageSize' | 'pageNo'>;
//目录返回类型
type directoryType = InterDataType<directoryListType>;
//分类返回类型
type categoryType = InterDataType<categoryListType>['list'];
//品牌返回类型
......@@ -22,20 +26,19 @@ type makeListType = InterDataType<MakeListType>['list'];
//新增编辑表单类型
type addMakeParameterType = InterReqType<addProductType>;
const { Option } = Select;
const { confirm } = Modal;
function ProduceManage() {
const searchRef = useRef<any>();
// 路由操作
const navigate = useNavigate();
const [searchParams, setSearchParams] = useSearchParams();
// 表格数据
const [tableData, setTableData] = useState<produceListType>([]);
//筛选表单
const [query, setQuery] = useState<produceParametersType>();
// 加载中
const [loading, setLoading] = useState<boolean>(false);
// 产品类型下拉列表
const [productTypeSelectList, setProductTypeSelectList] = useState<categoryType>([]);
// 新增弹窗是否显示
const [visibleAddEdit, setVisibleAddEdit] = useState(false);
// 新增弹窗内容
......@@ -88,6 +91,30 @@ function ProduceManage() {
pageNo: 1,
totalCount: 0,
});
//筛选参数
const [searchColumnsData, setSearchColumnsData] = useState<searchColumns[]>([
{
label: '产品名称',
placeholder: '请输入产品名称',
type: 'input',
name: 'productName',
},
{
label: '产品目录',
placeholder: '请输入产品名称',
type: 'select',
name: 'directoryId',
options: [],
onSelect: (value) => decSelectChange(value),
},
{
label: '产品类型',
placeholder: '请输入产品名称',
type: 'select',
name: 'categoryId',
options: [],
},
]);
// 跳转详情
const handleDetail = (record: produceListType[0]) => {
......@@ -162,10 +189,13 @@ function ProduceManage() {
const paginationChange = (pageNo: number, pageSize: number) => {
pagination.pageNo = pageNo;
pagination.pageSize = pageSize;
setSearchParams(qs.stringify({ ...query, pageNo, pageSize }));
getProduceList(query);
};
// 表单提交
const onFinish = (val: produceListType) => {
const onFinish = (val: any) => {
pagination.pageNo = 1;
pagination.pageSize = 10;
// 在这里对提交的数据做处理,如range转为开始和结束时间
const data = Object.fromEntries(
// 过滤为空项
......@@ -176,6 +206,9 @@ function ProduceManage() {
),
);
setQuery(data);
setSearchParams(
qs.stringify({ ...data, pageNo: pagination.pageNo, pageSize: pagination.pageSize }),
);
getProduceList(data);
};
//品牌列表
......@@ -186,36 +219,55 @@ function ProduceManage() {
};
// componentDidMount
useEffect(() => {
pagination.pageNo = Number(searchParams.get('pageNo') || 1);
pagination.pageSize = Number(searchParams.get('pageSize') || 10);
(searchRef.current as any).getForm().setFieldsValue({
productName: searchParams.get('productName') || undefined,
directoryId: searchParams.get('directoryId')
? Number(searchParams.get('directoryId'))
: undefined,
categoryId: searchParams.get('categoryId')
? Number(searchParams.get('categoryId'))
: undefined,
});
setQuery({
productName: searchParams.get('productName') || undefined,
directoryId: searchParams.get('directoryId')
? Number(searchParams.get('directoryId'))
: undefined,
categoryId: searchParams.get('categoryId')
? Number(searchParams.get('categoryId'))
: undefined,
});
getProduceList({
productName: searchParams.get('productName') || undefined,
directoryId: searchParams.get('directoryId')
? Number(searchParams.get('directoryId'))
: undefined,
categoryId: searchParams.get('categoryId')
? Number(searchParams.get('categoryId'))
: undefined,
});
getDirectoryList();
if (searchParams.get('directoryId')) {
getCategoryListByDirectory(Number(searchParams.get('directoryId')));
}
getProduceList(query);
}, []);
return (
<div className='from-table-wrap'>
<div className='header-view'>
<Form name='basic' layout='inline' onFinish={onFinish}>
<Form.Item>
<Button type='primary' onClick={handleAdd} icon={<PlusOutlined />}>
<SearchBox
search={searchColumnsData}
searchData={onFinish}
child={
<Button type='primary' onClick={handleAdd} icon={<PlusOutlined/>}>
新增产品
</Button>
</Form.Item>
<Form.Item name='productName' label='产品名称'>
<Input placeholder='请输入产品名称' allowClear />
</Form.Item>
<Form.Item name='goodsTypeId' label='产品类型'>
<Select placeholder='请选择产品类型' allowClear>
{productTypeSelectList.map((i, j) => (
<Option value={i.id} key={j}>
{i.classifyName}
</Option>
))}
</Select>
</Form.Item>
<Form.Item>
<Button type='primary' htmlType='submit'>
搜索
</Button>
</Form.Item>
</Form>
}
baseRef={searchRef}
/>
</div>
<Table
size='small'
......
......@@ -95,7 +95,7 @@ const AddOrEditNewsModal: FC<ModalProps & selfProps> = ({
onCancel={addOrEditModalCancel}
onOk={addOrEditModalOk}
title={currentIndustryNews ? '编辑' : '新建'}
width={800}
width={1000}
>
<Form labelCol={{ span: 4 }} wrapperCol={{ span: 16 }} form={form}>
<Form.Item
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论