提交 3efe0f10 作者: 龚洪江

修复:新增sku字段长度限制

上级 51b1d381
......@@ -185,7 +185,25 @@ export type listCompanyRemove = InterFunction<
NonNullable<unknown>
>;
//单位-详情
export type getCompanyInfoByIdType = InterFunction<{ id: number }, any>;
export type getCompanyInfoByIdType = InterFunction<
{ id: number },
{
address: string;
city: string;
companyName: string;
companyType: number;
companyUserName: string;
district: string;
fullName: string;
id: number;
phoneNum: string;
province: string;
remark: string;
}
>;
//单位-成员列表
export type listCompanyMembersType = InterItemFunction<{ companyInfoId: number }, any>;
//账号权限-列表
export type listRoleInfoPageType = InterItemFunction<
{ numberOrName?: string },
......
......@@ -6,6 +6,7 @@ import {
insertRoleInfoType,
listBAccountPageType,
listCompanyAdd,
listCompanyMembersType,
listCompanyPage,
listCompanyRemove,
listCompanyUpdate,
......@@ -66,6 +67,9 @@ export class SystemManageAPI {
// 单位-区域
static getSecondDistrictInfo: getSecondDistrictInfo = (params) =>
axios.get('/pms/webDevice/getSecondDistrictInfo', { params });
//单位-成员列表
static getListCompanyMembers: listCompanyMembersType = (params) =>
axios.post('/userapp/company/listCompanyMembers', { params });
//账号权限-列表
static getListRoleInfoPage: listRoleInfoPageType = (data) =>
......
......@@ -41,6 +41,9 @@ const SkuAddOrEditModal: FC<ModalProps & selfProps> = ({
const salePriceValidator = (_rules: any, value: number) => {
if (!isEmptyBol(value)) {
if (regPriceNumber(value.toString())) {
if (value > 99999999 || value < 0) {
return Promise.reject(new Error('价格最大为99999999且大于0'));
}
return Promise.resolve();
} else {
return Promise.reject(new Error('为整数且最多保留两位小数'));
......@@ -53,6 +56,9 @@ const SkuAddOrEditModal: FC<ModalProps & selfProps> = ({
const channelPriceValidator = (_rules: any, value: number) => {
if (!isEmptyBol(value)) {
if (regPriceNumber(value.toString())) {
if (value > 99999999 || value < 0) {
return Promise.reject(new Error('价格最大为99999999且大于0'));
}
return Promise.resolve();
} else {
return Promise.reject(new Error('为整数且最多保留两位小数'));
......@@ -65,6 +71,9 @@ const SkuAddOrEditModal: FC<ModalProps & selfProps> = ({
const stockPriceValidator = (_rules: any, value: number) => {
if (!isEmptyBol(value)) {
if (/^[+]{0,1}(\d+)$/.test(value.toString())) {
if (value > 99999999 || value < 0) {
return Promise.reject(new Error('库存最大为99999999且大于0'));
}
return Promise.resolve();
} else {
return Promise.reject(new Error('请输入正整数'));
......
......@@ -60,7 +60,8 @@ const SkuInfo: FC<selfProps> = ({
render: (text: goodsSpecType['goodsSpecValuesList']) =>
text.map((v) => (
<Tag key={v.id}>
{v.specValueName}({v.partNo})
{v.specValueName}
{v.partNo ? `(${v.partNo})` : ''}
</Tag>
)),
},
......
......@@ -60,7 +60,8 @@ const GoodsDetails = () => {
render: (text: detailType['goodsSpecList'][0]['goodsSpecValuesList']) =>
text.map((v) => (
<Tag key={v.id}>
{v.specValueName}({v.partNo})
{v.specValueName}
{v.partNo ? `(${v.partNo})` : ''}
</Tag>
)),
},
......
......@@ -71,7 +71,7 @@ const GoodsList = () => {
<Image src={text.find((v) => v.type === 0)?.url || ''} width={50} height={50} />
),
},
{ title: '商品名称', align: 'center', dataIndex: 'tradeName' },
{ title: '商品名称', align: 'center', dataIndex: 'tradeName', width: '20%', ellipsis: true },
{
title: '商品类别',
align: 'center',
......@@ -88,6 +88,7 @@ const GoodsList = () => {
title: '操作',
align: 'center',
dataIndex: 'id',
width: '20%',
render: (id: number, record: goodsType[0]) => (
<>
<Button type='link' onClick={() => toEditGoods(id)}>
......
.company-detail{
&-info{
margin-bottom: 20px;
}
&-people{
&-title{
line-height: 50px;
font-weight: bold;
font-size: 14px;
}
}
}
import { useSearchParams } from 'react-router-dom';
import { useEffect, useState } from 'react';
import { SystemManageAPI } from '~/api';
import { InterDataType } from '~/api/interface';
import { getCompanyInfoByIdType } from '~/api/interface/systemManageType';
import { Button, Descriptions, Table } from 'antd';
import './index.scss';
//单位详情-返回类型
type companyDetailType = InterDataType<getCompanyInfoByIdType>;
const CompanyDetail = () => {
const [searchParams] = useSearchParams();
const [companyId, setCompanyId] = useState<number>(-1);
const [companyDetail, setCompanyDetail] = useState<companyDetailType>();
//单位详情
const getCompanyDetailInfo = (id: number) => {
SystemManageAPI.getCompanyInfoById({ id }).then(({ result }) => {});
SystemManageAPI.getCompanyInfoById({ id }).then(({ result }) => {
setCompanyDetail(result);
});
};
useEffect(() => {
......@@ -17,7 +27,23 @@ const CompanyDetail = () => {
return (
<div className='company-detail'>
<div className='company-detail-info'></div>
<div className='company-detail-info'>
<Descriptions title='基本信息' bordered column={4}>
<Descriptions.Item label='单位名称'>{companyDetail?.companyName}</Descriptions.Item>
<Descriptions.Item label='详细地址'>{companyDetail?.address}</Descriptions.Item>
<Descriptions.Item label='联系人'>
{companyDetail?.companyUserName || ''}
</Descriptions.Item>
<Descriptions.Item label='联系电话'>{companyDetail?.phoneNum || ''}</Descriptions.Item>
</Descriptions>
</div>
<div className='company-detail-people'>
<div className='company-detail-people-title'>成员信息</div>
<Table bordered />
</div>
<div className='company-detail-operate'>
<Button type='primary'>返回</Button>
</div>
</div>
);
};
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论