Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
work-order-web
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
张圳龙
work-order-web
Commits
cbac4742
Commit
cbac4742
authored
Nov 03, 2020
by
Mr. Lan
Browse files
Options
Browse Files
Download
Plain Diff
fix: fix bug.
parents
d3891df8
792a119e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
46 deletions
+14
-46
GenerateFormItem.vue
src/components/VueFormMaking/components/GenerateFormItem.vue
+7
-40
file.vue
src/components/VueFormMaking/components/Upload/file.vue
+7
-6
No files found.
src/components/VueFormMaking/components/GenerateFormItem.vue
View file @
cbac4742
...
...
@@ -265,25 +265,7 @@
</
template
>
<
template
v-if=
"widget.type=='file'"
>
<el-upload
: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>
<FileUpload
:element=
"widget"
:data-model=
"dataModel"
@
fileList=
"fileList"
/>
</
template
>
<
template
v-if=
"widget.type === 'editor'"
>
...
...
@@ -343,17 +325,18 @@
<
script
>
import
FmUpload
from
'./Upload'
import
FileUpload
from
'./Upload/file'
export
default
{
name
:
'GenetateFormItem'
,
components
:
{
FmUpload
FmUpload
,
FileUpload
},
/* eslint-disable */
props
:
[
'widget'
,
'models'
,
'rules'
,
'remote'
,
'data'
,
'disabled'
,
'preview'
,
'isLabel'
,
'subformIndex'
,
'subformModel'
],
data
()
{
return
{
currentRemoveUid
:
''
,
widgetLabelWidth
:
''
,
dataModel
:
this
.
subformIndex
===
undefined
?
this
.
models
[
this
.
widget
.
model
]:
...
...
@@ -387,7 +370,7 @@ export default {
models
:
{
deep
:
true
,
handler
(
val
)
{
if
(
val
.
status
===
undefined
||
val
.
status
===
null
)
{
if
(
val
.
status
===
undefined
&&
val
.
status
===
null
)
{
if
(
this
.
subformIndex
===
undefined
)
{
this
.
dataModel
=
val
[
this
.
widget
.
model
]
}
else
{
...
...
@@ -431,24 +414,8 @@ export default {
}
},
methods
:
{
handleRemove
(
file
,
fileList
)
{
this
.
widget
.
options
.
defaultValue
=
fileList
},
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
// })
fileList
(
files
)
{
this
.
dataModel
=
files
}
}
}
...
...
src/components/VueFormMaking/components/Upload/file.vue
View file @
cbac4742
...
...
@@ -10,7 +10,7 @@
:limit=
"element.options.length"
:headers=
"element.options.headers"
:on-exceed=
"handleExceed"
:file-list=
"
element.options.defaultValue
"
:file-list=
"
dataModel
"
:disabled=
"element.options.disabled"
:style=
"
{'width': element.options.width}"
>
...
...
@@ -26,15 +26,15 @@
export
default
{
name
:
'FileUpload'
,
// eslint-disable-next-line vue/require-prop-types
props
:
[
'element'
,
'preview'
],
props
:
[
'element'
,
'preview'
,
'dataModel'
],
data
()
{
return
{
currentRemoveUid
:
''
fileListTmp
:
[]
}
},
methods
:
{
handleRemove
(
file
,
fileList
)
{
this
.
element
.
options
.
defaultValue
=
fileList
this
.
$emit
(
'fileList'
,
fileList
)
},
handlePreview
(
file
)
{
window
.
open
(
file
.
url
,
'_blank'
)
...
...
@@ -43,14 +43,15 @@ export default {
this
.
$message
.
warning
(
`最多允许上传
${
this
.
element
.
options
.
length
}
个文件。`
)
},
beforeRemove
(
file
,
fileList
)
{
this
.
currentRemoveUid
=
file
.
uid
return
this
.
$confirm
(
`确定要移除
${
file
.
name
}
?`
)
},
handleSuccess
(
response
,
file
,
fileList
)
{
this
.
element
.
options
.
defaultValue
.
push
({
this
.
fileListTmp
.
push
({
uid
:
file
.
uid
,
name
:
file
.
name
,
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