Commit c2a43dab authored by 张子雨's avatar 张子雨

feat: 去掉搜索空格

parent c9f2e392
...@@ -30,6 +30,7 @@ import DepartmentModal from './components/departmentModal'; ...@@ -30,6 +30,7 @@ import DepartmentModal from './components/departmentModal';
import ViewDepartmentModal from './components/viewDepartmentModal'; import ViewDepartmentModal from './components/viewDepartmentModal';
import BlacklistModal from './components/blacklistModal'; import BlacklistModal from './components/blacklistModal';
import RechargeDetailsModal from './components/RechargeDetailsModal'; import RechargeDetailsModal from './components/RechargeDetailsModal';
import { stringOrObjectTrim } from '@/utils/utils';
const layout = { const layout = {
labelCol: { span: 6 }, labelCol: { span: 6 },
...@@ -63,8 +64,10 @@ const StoreManagement = () => { ...@@ -63,8 +64,10 @@ const StoreManagement = () => {
const [repastId, setRepastId] = useState(null); const [repastId, setRepastId] = useState(null);
const shopList = async params => { const shopList = async params => {
// 去掉前后空格
const data = stringOrObjectTrim(params);
setLoading(true); setLoading(true);
const res = await apiStaffList(params); const res = await apiStaffList(data);
if (res?.businessCode === '0000') { if (res?.businessCode === '0000') {
const list = res.data?.records; const list = res.data?.records;
setTotal(res.data.total); setTotal(res.data.total);
......
...@@ -7,12 +7,13 @@ import { columns, repastTypeList } from './data'; ...@@ -7,12 +7,13 @@ import { columns, repastTypeList } from './data';
import EditRepastModal from './editRepastModal'; import EditRepastModal from './editRepastModal';
import AddModal from './addModal'; import AddModal from './addModal';
import styles from './index.less'; import styles from './index.less';
import { stringOrObjectTrim } from '@/utils/utils';
import { import {
setShopList, setShopList,
setShopDelete, setShopDelete,
mealTypeList, mealTypeList,
apiEnterpriseList, apiEnterpriseList,
busineesTypeCheck, businessTypeCheck,
} from './service.js'; } from './service.js';
const { confirm } = Modal; const { confirm } = Modal;
...@@ -37,8 +38,10 @@ const StoreManagement = () => { ...@@ -37,8 +38,10 @@ const StoreManagement = () => {
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [selectMealType, setSelectMealType] = useState([]); const [selectMealType, setSelectMealType] = useState([]);
const shopList = async params => { const shopList = async params => {
// 去掉前后空格
const data = stringOrObjectTrim(params);
setLoading(true); setLoading(true);
const res = await setShopList(params); const res = await setShopList(data);
if (res?.businessCode === '0000') { if (res?.businessCode === '0000') {
setLoading(false); setLoading(false);
setDataList(res.data?.records); setDataList(res.data?.records);
...@@ -151,7 +154,7 @@ const StoreManagement = () => { ...@@ -151,7 +154,7 @@ const StoreManagement = () => {
}; };
// 添加商户 // 添加商户
const addShop = async () => { const addShop = async () => {
const res = await busineesTypeCheck({ enterpriseId: searchForm.enterpriseId }); const res = await businessTypeCheck({ enterpriseId: searchForm.enterpriseId });
if (res.businessCode === '0000') { if (res.businessCode === '0000') {
setName(enterprise.label); setName(enterprise.label);
setAddVisible(true); setAddVisible(true);
......
...@@ -84,7 +84,7 @@ export const apiSelectList = async params => { ...@@ -84,7 +84,7 @@ export const apiSelectList = async params => {
// [企业店铺]-添加企业店铺校验是否是到店类型 // [企业店铺]-添加企业店铺校验是否是到店类型
// http://yapi.quantgroups.com/project/389/interface/api/65304 // http://yapi.quantgroups.com/project/389/interface/api/65304
export const busineesTypeCheck = async params => { export const businessTypeCheck = async params => {
const data = await request.post(`${apiPrefix}/enterprise/shop/busineesType/check`, { const data = await request.post(`${apiPrefix}/enterprise/shop/busineesType/check`, {
prefix: roleApi, prefix: roleApi,
data: params, data: params,
......
...@@ -452,3 +452,15 @@ export const getDefaultRule = data => { ...@@ -452,3 +452,15 @@ export const getDefaultRule = data => {
data, data,
); );
}; };
// 输入空格校验
export const validateSpaces = (rule, value, callback) => {
// 输入不能包括空格
if (value && value.includes(' ')) {
// eslint-disable-next-line prefer-promise-reject-errors
return Promise.reject('输入不能为空格');
}
// 去掉空格后进行进一步校验
// ...
return Promise.resolve();
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment