Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Chatopera OpenSource
/
ferry_web
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
cbac4742
authored
Nov 03, 2020
by
Mr. Lan
Browse files
Options
Browse Files
Download
Plain Diff
fix: fix bug.
parents
d3891df8
792a119e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
46 deletions
src/components/VueFormMaking/components/GenerateFormItem.vue
src/components/VueFormMaking/components/Upload/file.vue
src/components/VueFormMaking/components/GenerateFormItem.vue
View file @
cbac4742
...
@@ -265,25 +265,7 @@
...
@@ -265,25 +265,7 @@
</
template
>
</
template
>
<
template
v-if=
"widget.type=='file'"
>
<
template
v-if=
"widget.type=='file'"
>
<el-upload
<FileUpload
:element=
"widget"
:data-model=
"dataModel"
@
fileList=
"fileList"
/>
:action=
"widget.options.action"
:on-success=
"handleSuccess"
:on-preview=
"handlePreview"
:on-remove=
"handleRemove"
:before-remove=
"beforeRemove"
multiple
:limit=
"widget.options.length"
:headers=
"widget.options.headers"
:on-exceed=
"handleExceed"
:file-list=
"widget.options.defaultValue"
:disabled=
"widget.options.disabled"
:style=
"
{'width': widget.options.width}"
>
<div
v-if=
"!preview"
>
<el-button
size=
"small"
type=
"primary"
>
点击上传
</el-button>
<div
slot=
"tip"
class=
"el-upload__tip"
>
{{
widget
.
options
.
tip
}}
</div>
</div>
</el-upload>
</
template
>
</
template
>
<
template
v-if=
"widget.type === 'editor'"
>
<
template
v-if=
"widget.type === 'editor'"
>
...
@@ -343,17 +325,18 @@
...
@@ -343,17 +325,18 @@
<
script
>
<
script
>
import
FmUpload
from
'./Upload'
import
FmUpload
from
'./Upload'
import
FileUpload
from
'./Upload/file'
export
default
{
export
default
{
name
:
'GenetateFormItem'
,
name
:
'GenetateFormItem'
,
components
:
{
components
:
{
FmUpload
FmUpload
,
FileUpload
},
},
/* eslint-disable */
/* eslint-disable */
props
:
[
'widget'
,
'models'
,
'rules'
,
'remote'
,
'data'
,
'disabled'
,
'preview'
,
'isLabel'
,
'subformIndex'
,
'subformModel'
],
props
:
[
'widget'
,
'models'
,
'rules'
,
'remote'
,
'data'
,
'disabled'
,
'preview'
,
'isLabel'
,
'subformIndex'
,
'subformModel'
],
data
()
{
data
()
{
return
{
return
{
currentRemoveUid
:
''
,
widgetLabelWidth
:
''
,
widgetLabelWidth
:
''
,
dataModel
:
this
.
subformIndex
===
undefined
?
dataModel
:
this
.
subformIndex
===
undefined
?
this
.
models
[
this
.
widget
.
model
]:
this
.
models
[
this
.
widget
.
model
]:
...
@@ -387,7 +370,7 @@ export default {
...
@@ -387,7 +370,7 @@ export default {
models
:
{
models
:
{
deep
:
true
,
deep
:
true
,
handler
(
val
)
{
handler
(
val
)
{
if
(
val
.
status
===
undefined
||
val
.
status
===
null
)
{
if
(
val
.
status
===
undefined
&&
val
.
status
===
null
)
{
if
(
this
.
subformIndex
===
undefined
)
{
if
(
this
.
subformIndex
===
undefined
)
{
this
.
dataModel
=
val
[
this
.
widget
.
model
]
this
.
dataModel
=
val
[
this
.
widget
.
model
]
}
else
{
}
else
{
...
@@ -431,24 +414,8 @@ export default {
...
@@ -431,24 +414,8 @@ export default {
}
}
},
},
methods
:
{
methods
:
{
handleRemove
(
file
,
fileList
)
{
fileList
(
files
)
{
this
.
widget
.
options
.
defaultValue
=
fileList
this
.
dataModel
=
files
},
handlePreview
(
file
)
{
window
.
open
(
file
.
url
,
'_blank'
)
},
handleExceed
(
files
,
fileList
)
{
this
.
$message
.
warning
(
`最多允许上传
${
this
.
widget
.
options
.
length
}
个文件。`
)
},
beforeRemove
(
file
,
fileList
)
{
this
.
currentRemoveUid
=
file
.
uid
return
this
.
$confirm
(
`确定要移除
${
file
.
name
}
?`
)
},
handleSuccess
(
response
,
file
,
fileList
)
{
// this.widget.options.defaultValue.push({
// name: file.name,
// url: response.data
// })
}
}
}
}
}
}
...
...
src/components/VueFormMaking/components/Upload/file.vue
View file @
cbac4742
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
:limit=
"element.options.length"
:limit=
"element.options.length"
:headers=
"element.options.headers"
:headers=
"element.options.headers"
:on-exceed=
"handleExceed"
:on-exceed=
"handleExceed"
:file-list=
"
element.options.defaultValue
"
:file-list=
"
dataModel
"
:disabled=
"element.options.disabled"
:disabled=
"element.options.disabled"
:style=
"
{'width': element.options.width}"
:style=
"
{'width': element.options.width}"
>
>
...
@@ -26,15 +26,15 @@
...
@@ -26,15 +26,15 @@
export
default
{
export
default
{
name
:
'FileUpload'
,
name
:
'FileUpload'
,
// eslint-disable-next-line vue/require-prop-types
// eslint-disable-next-line vue/require-prop-types
props
:
[
'element'
,
'preview'
],
props
:
[
'element'
,
'preview'
,
'dataModel'
],
data
()
{
data
()
{
return
{
return
{
currentRemoveUid
:
''
fileListTmp
:
[]
}
}
},
},
methods
:
{
methods
:
{
handleRemove
(
file
,
fileList
)
{
handleRemove
(
file
,
fileList
)
{
this
.
element
.
options
.
defaultValue
=
fileList
this
.
$emit
(
'fileList'
,
fileList
)
},
},
handlePreview
(
file
)
{
handlePreview
(
file
)
{
window
.
open
(
file
.
url
,
'_blank'
)
window
.
open
(
file
.
url
,
'_blank'
)
...
@@ -43,14 +43,15 @@ export default {
...
@@ -43,14 +43,15 @@ export default {
this
.
$message
.
warning
(
`最多允许上传
${
this
.
element
.
options
.
length
}
个文件。`
)
this
.
$message
.
warning
(
`最多允许上传
${
this
.
element
.
options
.
length
}
个文件。`
)
},
},
beforeRemove
(
file
,
fileList
)
{
beforeRemove
(
file
,
fileList
)
{
this
.
currentRemoveUid
=
file
.
uid
return
this
.
$confirm
(
`确定要移除
${
file
.
name
}
?`
)
return
this
.
$confirm
(
`确定要移除
${
file
.
name
}
?`
)
},
},
handleSuccess
(
response
,
file
,
fileList
)
{
handleSuccess
(
response
,
file
,
fileList
)
{
this
.
element
.
options
.
defaultValue
.
push
({
this
.
fileListTmp
.
push
({
uid
:
file
.
uid
,
name
:
file
.
name
,
name
:
file
.
name
,
url
:
response
.
data
url
:
response
.
data
})
})
this
.
$emit
(
'fileList'
,
this
.
fileListTmp
)
}
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment