feat(doctor): 添加图片上传字段并修正最大图片数量限制

- 在表单数据中添加 image 字段
- 将图片上传数量上限从 20 张调整为5 张
- 更新图片上传提示信息
- 修正图片删除后 image 字段的默认值为空字符串
- 在表单中增加 image 隐藏输入项以支持数据提交
This commit is contained in:
2025-10-23 18:53:11 +08:00
parent f59ce587dd
commit 1d1693cfc1

View File

@@ -41,7 +41,8 @@ const AddClinicOrder = () => {
diagnosis: '',
treatmentPlan: '',
decoctionInstructions: '',
content: ''
content: '',
image: '' // 添加image字段
})
// 判断是编辑还是新增模式
@@ -79,9 +80,9 @@ const AddClinicOrder = () => {
// 选择并上传图片
const handleChooseImage = () => {
if (fileList.length >= 20) {
if (fileList.length >= 5) { // 修正最大图片数量为5
Taro.showToast({
title: '最多只能上传20张图片',
title: '最多只能上传5张图片',
icon: 'none'
})
return
@@ -119,7 +120,7 @@ const AddClinicOrder = () => {
if (newFileList.length === 0) {
setFormData(prev => ({
...prev,
image: undefined
image: ''
}))
} else {
const imageData: UploadedImageData[] = newFileList.map(f => ({
@@ -541,6 +542,9 @@ const AddClinicOrder = () => {
<Form.Item name="content" initialValue={formData.content} required>
<Input type="hidden"/>
</Form.Item>
<Form.Item name="image" initialValue={formData.image}>
<Input type="hidden"/>
</Form.Item>
</CellGroup>
</Form>
@@ -557,4 +561,4 @@ const AddClinicOrder = () => {
);
};
export default AddClinicOrder;
export default AddClinicOrder;