Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
A
admin
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
iuav
admin
Commits
490dc22a
提交
490dc22a
authored
8月 17, 2023
作者:
龚洪江
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
功能:租赁联调完成
上级
3efeb16b
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
93 行增加
和
26 行删除
+93
-26
index.tsx
src/components/EditableCell/index.tsx
+14
-2
index.tsx
src/components/goods/commonSkuInfo/index.tsx
+1
-0
index.tsx
...entGoods/rentAddOrEdit/components/accessoryList/index.tsx
+53
-12
index.tsx
...age/rentGoods/rentAddOrEdit/components/rentAttr/index.tsx
+24
-12
index.tsx
...nage/rentGoods/rentAddOrEdit/components/skuInfo/index.tsx
+1
-0
没有找到文件。
src/components/EditableCell/index.tsx
浏览文件 @
490dc22a
...
...
@@ -41,7 +41,13 @@ const EditableCell: React.FC<
const
inputNode
=
()
=>
{
switch
(
inputType
)
{
case
'number'
:
return
<
InputNumber
placeholder=
{
`请输入${placeholder || title}`
}
maxLength=
{
maxLength
}
/>;
return
(
<
InputNumber
placeholder=
{
`请输入${placeholder || title}`
}
style=
{
{
width
:
'100%'
}
}
maxLength=
{
maxLength
}
/>
);
case
'select'
:
return
(
<
Select
placeholder=
{
`请选择${placeholder || title}`
}
style=
{
{
textAlign
:
'start'
}
}
>
...
...
@@ -85,7 +91,13 @@ const EditableCell: React.FC<
case
'switch'
:
return
<
Switch
/>;
default
:
return
<
Input
placeholder=
{
`请输入${placeholder || title}`
}
maxLength=
{
maxLength
}
/>;
return
(
<
Input
placeholder=
{
`请输入${placeholder || title}`
}
maxLength=
{
maxLength
}
style=
{
{
width
:
'100%'
}
}
/>
);
}
};
return
(
...
...
src/components/goods/commonSkuInfo/index.tsx
浏览文件 @
490dc22a
...
...
@@ -282,6 +282,7 @@ const CommonSkuInfo = forwardRef<any, selfProps>(
uploadSuccess
:
col
.
inputType
===
'uploader'
?
uploadSuccess
:
undefined
,
rules
:
col
.
rules
,
placeholder
:
col
.
placeholder
,
maxLength
:
col
.
maxLength
,
}),
};
});
...
...
src/pages/rentManage/rentGoods/rentAddOrEdit/components/accessoryList/index.tsx
浏览文件 @
490dc22a
import
'./index.scss'
;
import
{
Button
,
Col
,
Form
,
Row
,
Table
}
from
'antd'
;
import
{
Button
,
Col
,
Form
,
Row
,
Table
,
Tooltip
}
from
'antd'
;
import
{
forwardRef
,
useEffect
,
useImperativeHandle
,
useState
}
from
'react'
;
import
{
InterDataType
,
InterReqType
}
from
'~/api/interface'
;
import
{
addRentGoodsType
,
leaseGoodsDetailsType
}
from
'~/api/interface/rentManageType'
;
import
EditableCell
from
'~/components/EditableCell'
;
import
{
MinusOutlined
,
PlusOutlined
}
from
'@ant-design/icons'
;
import
{
isEmptyBol
,
regPriceNumber
}
from
'~/utils/validateUtils'
;
//租赁商品详情返回类型
type
rentGoodsDetailType
=
InterDataType
<
leaseGoodsDetailsType
>
;
...
...
@@ -25,6 +26,36 @@ interface selfProps {
const
AccessoryList
=
forwardRef
<
any
,
selfProps
>
(({
rentGoodsDetails
},
ref
)
=>
{
const
[
accessoryTableForm
]
=
Form
.
useForm
<
{
[
x
:
string
]:
string
|
number
}
>
();
//库存正则校验
const
stockValidator
=
(
_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
(
'请输入正整数'
));
}
}
else
{
return
Promise
.
resolve
();
}
};
//价格正则校验
const
priceValidator
=
(
_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
(
'为整数且最多保留两位小数'
));
}
}
else
{
return
Promise
.
resolve
();
}
};
const
accessoryTableDefaultColumns
:
(
ColumnTypes
[
number
]
&
{
editable
?:
boolean
;
dataIndex
?:
string
;
...
...
@@ -42,6 +73,8 @@ const AccessoryList = forwardRef<any, selfProps>(({ rentGoodsDetails }, ref) =>
editable
:
true
,
dataIndex
:
'name'
,
align
:
'center'
,
width
:
'30%'
,
maxLength
:
30
,
},
{
title
:
'数量'
,
...
...
@@ -49,6 +82,8 @@ const AccessoryList = forwardRef<any, selfProps>(({ rentGoodsDetails }, ref) =>
dataIndex
:
'number'
,
align
:
'center'
,
inputType
:
'number'
,
width
:
'15%'
,
rules
:
[{
required
:
false
,
validator
:
stockValidator
}],
},
{
title
:
'参考价格'
,
...
...
@@ -56,6 +91,7 @@ const AccessoryList = forwardRef<any, selfProps>(({ rentGoodsDetails }, ref) =>
dataIndex
:
'price'
,
align
:
'center'
,
inputType
:
'number'
,
rules
:
[{
required
:
false
,
validator
:
priceValidator
}],
},
{
title
:
'操作'
,
...
...
@@ -63,21 +99,25 @@ const AccessoryList = forwardRef<any, selfProps>(({ rentGoodsDetails }, ref) =>
render
:
(
_
:
any
,
_record
:
any
,
index
:
number
)
=>
(
<>
{
index
===
accessoryTableData
.
length
-
1
?
(
<
Button
type=
'primary'
icon=
{
<
PlusOutlined
/>
}
style=
{
{
marginRight
:
'5px'
}
}
onClick=
{
addAccessoryTableClick
}
></
Button
>
<
Tooltip
placement=
'top'
title=
'添加一行'
>
<
Button
type=
'primary'
icon=
{
<
PlusOutlined
/>
}
style=
{
{
marginRight
:
'5px'
}
}
onClick=
{
addAccessoryTableClick
}
></
Button
>
</
Tooltip
>
)
:
(
''
)
}
{
index
?
(
<
Button
type=
'primary'
icon=
{
<
MinusOutlined
/>
}
onClick=
{
()
=>
deleteAccessoryTableClick
(
index
)
}
></
Button
>
<
Tooltip
placement=
'top'
title=
'删除一行'
>
<
Button
type=
'primary'
icon=
{
<
MinusOutlined
/>
}
onClick=
{
()
=>
deleteAccessoryTableClick
(
index
)
}
></
Button
>
</
Tooltip
>
)
:
(
''
)
}
...
...
@@ -98,6 +138,7 @@ const AccessoryList = forwardRef<any, selfProps>(({ rentGoodsDetails }, ref) =>
editing
:
col
.
editable
,
inputType
:
col
.
inputType
,
rules
:
col
.
rules
,
maxLength
:
col
.
maxLength
,
}),
};
});
...
...
src/pages/rentManage/rentGoods/rentAddOrEdit/components/rentAttr/index.tsx
浏览文件 @
490dc22a
import
'./index.scss'
;
import
{
Button
,
Form
,
Select
,
Table
}
from
'antd'
;
import
{
Button
,
Form
,
Select
,
Table
,
Tooltip
}
from
'antd'
;
import
EditableCell
from
'~/components/EditableCell'
;
import
React
,
{
forwardRef
,
useEffect
,
useImperativeHandle
,
useState
}
from
'react'
;
import
{
MinusOutlined
,
PlusOutlined
,
UploadOutlined
}
from
'@ant-design/icons'
;
...
...
@@ -49,16 +49,23 @@ const RentAttr = forwardRef<any, selfProps>(({ rentGoodsDetails }, ref) => {
maxLength
?:
number
;
})[]
=
[
{
title
:
'序号'
,
align
:
'center'
,
render
:
(
_
:
any
,
_record
,
index
:
number
)
=>
index
+
1
,
},
{
title
:
'参数名称'
,
dataIndex
:
'productParamName'
,
editable
:
true
,
align
:
'center'
,
maxLength
:
30
,
},
{
title
:
'参数值'
,
dataIndex
:
'productParamValue'
,
editable
:
true
,
align
:
'center'
,
maxLength
:
30
,
},
{
title
:
'操作'
,
...
...
@@ -66,21 +73,25 @@ const RentAttr = forwardRef<any, selfProps>(({ rentGoodsDetails }, ref) => {
render
:
(
_text
:
string
,
_record
:
any
,
index
:
number
)
=>
(
<>
{
index
===
parameterTableData
.
length
-
1
?
(
<
Button
icon=
{
<
PlusOutlined
/>
}
type=
'primary'
onClick=
{
addParameterDataEvent
}
style=
{
{
marginRight
:
'10px'
}
}
></
Button
>
<
Tooltip
placement=
'top'
title=
'添加一行'
>
<
Button
icon=
{
<
PlusOutlined
/>
}
type=
'primary'
onClick=
{
addParameterDataEvent
}
style=
{
{
marginRight
:
'10px'
}
}
></
Button
>
</
Tooltip
>
)
:
(
''
)
}
{
index
?
(
<
Button
type=
'primary'
icon=
{
<
MinusOutlined
/>
}
onClick=
{
()
=>
deleteParameterDataEvent
(
index
)
}
></
Button
>
<
Tooltip
placement=
'top'
title=
'删除该行'
>
<
Button
type=
'primary'
icon=
{
<
MinusOutlined
/>
}
onClick=
{
()
=>
deleteParameterDataEvent
(
index
)
}
></
Button
>
</
Tooltip
>
)
:
(
''
)
}
...
...
@@ -101,6 +112,7 @@ const RentAttr = forwardRef<any, selfProps>(({ rentGoodsDetails }, ref) => {
editing
:
col
.
editable
,
inputType
:
col
.
inputType
,
rules
:
col
.
rules
,
maxLength
:
col
.
maxLength
,
}),
};
});
...
...
src/pages/rentManage/rentGoods/rentAddOrEdit/components/skuInfo/index.tsx
浏览文件 @
490dc22a
...
...
@@ -80,6 +80,7 @@ const SkuInfo = forwardRef<any, selfProps>(({ rentGoodsDetails }, ref) => {
title
:
'商品规格'
,
align
:
'center'
,
children
:
[],
maxLength
:
30
,
},
{
title
:
'缺货'
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论