Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
T
TrainSys
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
苏州培训方案
TrainSys
提交
b46aeb16
提交
b46aeb16
编写于
9月 18, 2025
作者:
jlj05024111@163.com
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: 更新文件下载时对文件url做权限认证处理;更新文件上传支持白名单类型,更新文件上传支持自定义上传大小限制
上级
4dd4b77f
变更
7
显示空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
127 行增加
和
24 行删除
+127
-24
ibiz-file-upload-one.tsx
...s/editor/upload/ibiz-file-upload/ibiz-file-upload-one.tsx
+16
-7
ibiz-file-upload.tsx
...nents/editor/upload/ibiz-file-upload/ibiz-file-upload.tsx
+15
-6
ibiz-grid-file-upload-popover.tsx
...d/ibiz-grid-file-upload/ibiz-grid-file-upload-popover.tsx
+15
-1
ibiz-grid-file-upload.tsx
...or/upload/ibiz-grid-file-upload/ibiz-grid-file-upload.tsx
+2
-0
use-ibiz-upload.ts
app_Web/src/components/editor/upload/use/use-ibiz-upload.ts
+63
-8
use-iview-upload.ts
app_Web/src/components/editor/upload/use/use-iview-upload.ts
+15
-1
grid-field-edit-column.tsx
...control/grid-field-edit-column/grid-field-edit-column.tsx
+1
-1
未找到文件。
app_Web/src/components/editor/upload/ibiz-file-upload/ibiz-file-upload-one.tsx
浏览文件 @
b46aeb16
...
@@ -36,7 +36,7 @@ export const IBizFileUploadOne = defineComponent({
...
@@ -36,7 +36,7 @@ export const IBizFileUploadOne = defineComponent({
const
handleBeforeUpload
=
(
_files
:
IData
)
=>
{
const
handleBeforeUpload
=
(
_files
:
IData
)
=>
{
// 先清除之前的文件 todo
// 先清除之前的文件 todo
fileUpload
.
value
.
clearFiles
();
fileUpload
.
value
.
clearFiles
();
return
beforeUpload
();
return
beforeUpload
(
_files
);
};
};
return
{
return
{
...
@@ -101,12 +101,21 @@ export const IBizFileUploadOne = defineComponent({
...
@@ -101,12 +101,21 @@ export const IBizFileUploadOne = defineComponent({
)
}
)
}
</
div
>
</
div
>
)
:
(
)
:
(
[
<
i
-
button
<
i
-
button
icon=
'ios-cloud-upload-outline'
icon=
'ios-cloud-upload-outline'
class=
{
this
.
ns
.
b
(
'button'
)
}
class=
{
this
.
ns
.
b
(
'button'
)
}
>
>
上传文件
上传文件
</
i
-
button
>
</
i
-
button
>,
this
.
c
.
uploadDescription
&&
(
<
div
class=
{
this
.
ns
.
be
(
'button-upload'
,
'accept-description'
)
}
>
{
this
.
c
.
uploadDescription
}
</
div
>
),
]
),
),
],
],
)
}
)
}
...
...
app_Web/src/components/editor/upload/ibiz-file-upload/ibiz-file-upload.tsx
浏览文件 @
b46aeb16
...
@@ -92,12 +92,21 @@ export const IBizFileUpload = defineComponent({
...
@@ -92,12 +92,21 @@ export const IBizFileUpload = defineComponent({
)
}
)
}
</
div
>
</
div
>
)
:
(
)
:
(
[
<
i
-
button
<
i
-
button
icon=
'ios-cloud-upload-outline'
icon=
'ios-cloud-upload-outline'
class=
{
this
.
ns
.
b
(
'button'
)
}
class=
{
this
.
ns
.
b
(
'button'
)
}
>
>
上传文件
上传文件
</
i
-
button
>
</
i
-
button
>,
this
.
c
.
uploadDescription
&&
(
<
div
class=
{
this
.
ns
.
be
(
'button-upload'
,
'accept-description'
)
}
>
{
this
.
c
.
uploadDescription
}
</
div
>
),
]
),
),
],
],
)
}
)
}
...
...
app_Web/src/components/editor/upload/ibiz-grid-file-upload/ibiz-grid-file-upload-popover.tsx
浏览文件 @
b46aeb16
import
{
useClickOutside
,
useNamespace
}
from
'@ibiz-template/vue-util'
;
import
{
useClickOutside
,
useNamespace
}
from
'@ibiz-template/vue-util'
;
import
{
defineComponent
,
ref
,
toRefs
,
watch
}
from
'vue'
;
import
{
defineComponent
,
PropType
,
Ref
,
ref
,
toRefs
,
watch
}
from
'vue'
;
import
{
UploadEditorController
}
from
'@ibiz-template/controller'
;
import
{
import
{
FileInfo
,
FileInfo
,
openImagePreview
,
openImagePreview
,
...
@@ -30,6 +31,14 @@ export const IBizGridFileUploadPopover = defineComponent({
...
@@ -30,6 +31,14 @@ export const IBizGridFileUploadPopover = defineComponent({
type
:
Number
,
type
:
Number
,
default
:
300
,
default
:
300
,
},
},
controller
:
{
type
:
Object
as
PropType
<
Ref
<
UploadEditorController
>>
,
required
:
true
,
},
data
:
{
type
:
Object
as
PropType
<
Ref
<
IData
>>
,
required
:
true
,
},
},
},
emits
:
{
emits
:
{
close
:
(
_result
:
{
isModified
:
boolean
;
resultFiles
:
FileInfo
[]
})
=>
true
,
close
:
(
_result
:
{
isModified
:
boolean
;
resultFiles
:
FileInfo
[]
})
=>
true
,
...
@@ -43,6 +52,8 @@ export const IBizGridFileUploadPopover = defineComponent({
...
@@ -43,6 +52,8 @@ export const IBizGridFileUploadPopover = defineComponent({
downloadUrl
,
downloadUrl
,
value
,
value
,
uploadUrl
,
uploadUrl
,
controller
:
props
.
controller
,
data
:
props
.
data
,
});
});
const
componentRef
=
ref
();
const
componentRef
=
ref
();
...
@@ -138,6 +149,9 @@ export const IBizGridFileUploadPopover = defineComponent({
...
@@ -138,6 +149,9 @@ export const IBizGridFileUploadPopover = defineComponent({
<
i
-
icon
type=
'md-add'
/>
<
i
-
icon
type=
'md-add'
/>
添加文件
添加文件
</
div
>
</
div
>
<
div
class=
{
this
.
ns
.
e
(
'description'
)
}
>
{
this
.
controller
.
uploadDescription
}
</
div
>
</
div
>
</
div
>
);
);
},
},
...
...
app_Web/src/components/editor/upload/ibiz-grid-file-upload/ibiz-grid-file-upload.tsx
浏览文件 @
b46aeb16
...
@@ -58,6 +58,8 @@ export const IBizGridFileUpload = defineComponent({
...
@@ -58,6 +58,8 @@ export const IBizGridFileUpload = defineComponent({
uploadUrl
:
uploadUrl
.
value
,
uploadUrl
:
uploadUrl
.
value
,
downloadUrl
:
downloadUrl
.
value
,
downloadUrl
:
downloadUrl
.
value
,
width
,
width
,
controller
,
data
,
},
},
on
:
{
on
:
{
close
:
(
result
:
{
close
:
(
result
:
{
...
...
app_Web/src/components/editor/upload/use/use-ibiz-upload.ts
浏览文件 @
b46aeb16
/* eslint-disable array-callback-return */
/* eslint-disable no-param-reassign */
/* eslint-disable no-param-reassign */
import
{
UploadEditorController
}
from
'@ibiz-template/controller'
;
import
{
FormItemController
,
GridEditItemController
,
UploadEditorController
,
}
from
'@ibiz-template/controller'
;
import
{
import
{
HttpError
,
HttpError
,
HttpResponse
,
HttpResponse
,
...
@@ -37,8 +42,26 @@ export type FileInfo = {
...
@@ -37,8 +42,26 @@ export type FileInfo = {
* @date 2022-11-18 15:11:38
* @date 2022-11-18 15:11:38
* @param {FileInfo} file
* @param {FileInfo} file
*/
*/
export
function
formatFileInfo
(
file
:
FileInfo
,
downloadUrl
:
string
):
FileInfo
{
export
function
formatFileInfo
(
file
.
url
=
downloadUrl
.
replace
(
'%fileId%'
,
file
.
id
!
);
file
:
FileInfo
,
downloadUrl
:
string
,
c
:
IData
,
data
:
IData
,
):
FileInfo
{
const
url
=
downloadUrl
.
replace
(
'%fileId%'
,
file
.
id
);
const
ctrl
=
(
c
.
parent
as
FormItemController
)?.
form
||
(
c
.
parent
as
GridEditItemController
)?.
grid
;
if
(
ctrl
)
{
const
entityName
=
ctrl
.
model
.
appEntity
.
deName
;
const
base64
=
`
${
file
.
id
}
|
${
entityName
}
|
${
data
.
srfkey
}
|
${
c
.
context
.
srfpersonid
||
c
.
context
.
srfuserid
}
`
;
file
.
url
=
`
${
url
}
?key=
${
window
.
btoa
(
base64
)}${
Math
.
floor
(
1000
+
Math
.
random
()
*
9000
,
)}
`
;
}
if
(
!
file
.
status
)
{
if
(
!
file
.
status
)
{
// 不存在时为回填回来的数据默认给他finished
// 不存在时为回填回来的数据默认给他finished
file
.
status
=
'finished'
;
file
.
status
=
'finished'
;
...
@@ -99,7 +122,12 @@ export function useIBizUploadInit(props: {
...
@@ -99,7 +122,12 @@ export function useIBizUploadInit(props: {
valueList
.
value
=
!
newVal
?
[]
:
JSON
.
parse
(
newVal
);
valueList
.
value
=
!
newVal
?
[]
:
JSON
.
parse
(
newVal
);
if
(
valueList
.
value
.
length
&&
downloadUrl
.
value
)
{
if
(
valueList
.
value
.
length
&&
downloadUrl
.
value
)
{
valueList
.
value
.
forEach
((
file
:
FileInfo
)
=>
{
valueList
.
value
.
forEach
((
file
:
FileInfo
)
=>
{
formatFileInfo
(
file
,
downloadUrl
.
value
);
formatFileInfo
(
file
,
downloadUrl
.
value
,
props
.
controller
.
value
,
props
.
data
.
value
,
);
});
});
}
}
},
},
...
@@ -112,7 +140,12 @@ export function useIBizUploadInit(props: {
...
@@ -112,7 +140,12 @@ export function useIBizUploadInit(props: {
// 下载基础路径变更时全部url重算
// 下载基础路径变更时全部url重算
if
(
newVal
&&
valueList
.
value
.
length
)
{
if
(
newVal
&&
valueList
.
value
.
length
)
{
valueList
.
value
.
forEach
((
file
:
FileInfo
)
=>
{
valueList
.
value
.
forEach
((
file
:
FileInfo
)
=>
{
formatFileInfo
(
file
,
newVal
);
formatFileInfo
(
file
,
newVal
,
props
.
controller
.
value
,
props
.
data
.
value
,
);
});
});
}
}
},
},
...
@@ -155,12 +188,14 @@ export function useIBizUpload(opts: {
...
@@ -155,12 +188,14 @@ export function useIBizUpload(opts: {
url
?:
string
;
url
?:
string
;
}[]
}[]
>
;
>
;
controller
:
UploadEditorController
;
data
:
IData
;
multiple
?:
boolean
;
multiple
?:
boolean
;
accept
?:
string
;
accept
?:
string
;
})
{
})
{
const
uploadState
=
ref
<
'undo'
|
'loading'
|
'done'
>
(
'undo'
);
const
uploadState
=
ref
<
'undo'
|
'loading'
|
'done'
>
(
'undo'
);
const
fileList
=
ref
<
FileInfo
[]
>
([]);
const
fileList
=
ref
<
FileInfo
[]
>
([]);
const
{
downloadUrl
,
value
,
uploadUrl
}
=
opts
;
const
{
downloadUrl
,
value
,
uploadUrl
,
controller
,
data
}
=
opts
;
// 初始化fileList
// 初始化fileList
watch
(
watch
(
...
@@ -169,7 +204,9 @@ export function useIBizUpload(opts: {
...
@@ -169,7 +204,9 @@ export function useIBizUpload(opts: {
if
(
newVal
.
length
>
0
)
{
if
(
newVal
.
length
>
0
)
{
fileList
.
value
=
[];
fileList
.
value
=
[];
newVal
.
forEach
(
item
=>
{
newVal
.
forEach
(
item
=>
{
fileList
.
value
.
push
(
formatFileInfo
(
item
,
downloadUrl
.
value
));
fileList
.
value
.
push
(
formatFileInfo
(
item
,
downloadUrl
.
value
,
controller
,
data
),
);
});
});
}
}
},
},
...
@@ -181,6 +218,24 @@ export function useIBizUpload(opts: {
...
@@ -181,6 +218,24 @@ export function useIBizUpload(opts: {
// 开始上传后记录文件
// 开始上传后记录文件
const
beforeUpload
=
(
fileData
:
File
[],
files
:
IUploadFile
[])
=>
{
const
beforeUpload
=
(
fileData
:
File
[],
files
:
IUploadFile
[])
=>
{
const
tag
=
fileData
.
some
(
item
=>
{
if
(
item
.
size
>
controller
.
defaultSize
*
1024
*
1024
)
{
ibiz
.
message
.
error
(
`
${
item
.
name
}
超出限制,请选择小于
${
controller
.
defaultSize
}
MB的文件`
,
2.5
,
true
,
);
return
true
;
}
if
(
controller
.
whiteList
&&
!
controller
.
whiteList
.
includes
(
item
.
name
))
{
ibiz
.
message
.
error
(
`
${
item
.
name
}
文件格式不正确`
,
2.5
,
true
);
return
true
;
}
return
false
;
});
if
(
tag
)
{
return
false
;
}
files
.
forEach
(
file
=>
{
files
.
forEach
(
file
=>
{
fileList
.
value
.
push
({
fileList
.
value
.
push
({
name
:
file
.
name
,
name
:
file
.
name
,
...
@@ -221,7 +276,7 @@ export function useIBizUpload(opts: {
...
@@ -221,7 +276,7 @@ export function useIBizUpload(opts: {
item
.
status
=
file
.
status
;
item
.
status
=
file
.
status
;
item
.
id
=
res
.
data
.
fileid
;
item
.
id
=
res
.
data
.
fileid
;
item
.
name
=
res
.
data
.
filename
;
item
.
name
=
res
.
data
.
filename
;
formatFileInfo
(
item
,
downloadUrl
.
value
);
formatFileInfo
(
item
,
downloadUrl
.
value
,
controller
,
data
);
return
true
;
return
true
;
}
}
return
false
;
return
false
;
...
...
app_Web/src/components/editor/upload/use/use-iview-upload.ts
浏览文件 @
b46aeb16
...
@@ -123,7 +123,21 @@ export function useIViewUpload(
...
@@ -123,7 +123,21 @@ export function useIViewUpload(
};
};
// 上传前回调
// 上传前回调
const
beforeUpload
=
()
=>
{
const
beforeUpload
=
(
file
:
IData
)
=>
{
const
type
=
file
.
name
.
split
(
'.'
).
pop
()
||
''
;
if
(
c
.
whiteList
&&
!
c
.
whiteList
.
includes
(
type
))
{
ibiz
.
message
.
error
(
`
${
file
.
name
}
文件格式不正确`
,
2.5
,
true
);
return
false
;
}
if
(
file
.
size
>
c
.
defaultSize
*
1024
*
1024
)
{
// 超出限制,不上传
ibiz
.
message
.
error
(
`
${
file
.
name
}
超出限制,请选择小于
${
c
.
defaultSize
}
MB的文件`
,
2.5
,
true
,
);
return
false
;
}
uploadCache
.
count
+=
1
;
uploadCache
.
count
+=
1
;
};
};
...
...
app_Web/src/components/widgets/grid-control/grid-field-edit-column/grid-field-edit-column.tsx
浏览文件 @
b46aeb16
...
@@ -86,7 +86,7 @@ export const GridFieldEditColumn = defineComponent({
...
@@ -86,7 +86,7 @@ export const GridFieldEditColumn = defineComponent({
nativeondblclick=
{
this
.
onStopPropagation
}
nativeondblclick=
{
this
.
onStopPropagation
}
nativeonClick=
{
this
.
onStopPropagation
}
nativeonClick=
{
this
.
onStopPropagation
}
style=
{
this
.
alignStyle
}
style=
{
this
.
alignStyle
}
class=
{
[...
this
.
dynamicClass
,
this
.
ns
.
e
(
'item'
)]
}
class=
{
[...
(
this
.
dynamicClass
||
[])
,
this
.
ns
.
e
(
'item'
)]
}
>
>
{
this
.
editItemC
.
editorProvider
&&
{
this
.
editItemC
.
editorProvider
&&
h
(
this
.
editItemC
.
editorProvider
.
gridEditor
,
{
h
(
this
.
editItemC
.
editorProvider
.
gridEditor
,
{
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录