Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
source-trace-manage-go
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tracing
source-trace-manage-go
Commits
fa32a3a1
Commit
fa32a3a1
authored
Aug 25, 2021
by
wcmoon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 添加文本数组类型
parent
1e6738eb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
124 additions
and
17 deletions
+124
-17
JSONForm.vue
src/components/editTemplate/form/JSONForm.vue
+8
-0
TextArrayForm.vue
src/components/editTemplate/form/TextArrayForm.vue
+70
-8
Template.ts
src/plugins/Template.ts
+46
-9
No files found.
src/components/editTemplate/form/JSONForm.vue
View file @
fa32a3a1
...
@@ -49,6 +49,14 @@ export default class JsonForm extends Vue {
...
@@ -49,6 +49,14 @@ export default class JsonForm extends Vue {
key
:
''
,
key
:
''
,
value
:
''
value
:
''
}];
}];
@
Watch
(
'jsons'
)
jsonsChange
()
{
// this.property.value =
}
mounted
()
{
mounted
()
{
console
.
log
(
this
.
property
);
console
.
log
(
this
.
property
);
}
}
...
...
src/components/editTemplate/form/TextArrayForm.vue
View file @
fa32a3a1
<
template
>
<
template
>
<base-form
<div
class=
"array-form"
>
:label=
"property.label"
<div
class=
"label"
>
:watchValue=
"property.value"
<img
class=
"pre-tag"
src=
"../../../assets/images/template/pre-tag.png"
/>
:showInput=
"false"
<div
class=
"label-text"
:title=
"property.label"
>
{{
property
.
label
}}
</div>
class=
"array-form"
</div>
>
<div
class=
"lists"
>
<div
class=
"lists"
>
<div
<div
class=
"list"
class=
"list"
...
@@ -12,6 +11,7 @@
...
@@ -12,6 +11,7 @@
:key=
"index"
:key=
"index"
>
>
<input
<input
@
change=
"change"
class=
"input"
class=
"input"
type=
"text"
type=
"text"
v-model=
"item.value"
v-model=
"item.value"
...
@@ -26,11 +26,11 @@
...
@@ -26,11 +26,11 @@
<i
class=
"iconfont icontianjia"
></i>
<i
class=
"iconfont icontianjia"
></i>
</div>
</div>
</div>
</div>
</
base-form
>
</
div
>
</
template
>
</
template
>
<
script
lang=
"ts"
>
<
script
lang=
"ts"
>
import
{
Component
,
Prop
,
Vue
}
from
"vue-property-decorator"
;
import
{
Component
,
Prop
,
Vue
,
Watch
}
from
"vue-property-decorator"
;
import
BaseForm
from
"./BaseForm.vue"
;
import
BaseForm
from
"./BaseForm.vue"
;
import
{
Property
}
from
"@/plugins/types2"
;
import
{
Property
}
from
"@/plugins/types2"
;
@
Component
({
@
Component
({
...
@@ -40,10 +40,27 @@ import {Property} from "@/plugins/types2";
...
@@ -40,10 +40,27 @@ import {Property} from "@/plugins/types2";
})
})
export
default
class
TextArray
extends
Vue
{
export
default
class
TextArray
extends
Vue
{
@
Prop
()
property
!
:
Property
;
@
Prop
()
property
!
:
Property
;
public
array
=
[{
public
array
=
[{
value
:
''
value
:
''
}];
}];
@
Watch
(
'array'
)
public
arrayChange
()
{
this
.
property
.
value
=
this
.
array
.
map
(
item
=>
String
(
item
.
value
));
}
mounted
()
{
if
(
!
Array
.
isArray
(
this
.
property
.
value
))
return
;
this
.
array
=
this
.
property
.
value
.
map
((
value
:
string
)
=>
{
return
{
value
};
})
}
change
()
{
this
.
property
.
value
=
this
.
array
.
map
(
item
=>
String
(
item
.
value
));
}
public
add
()
{
public
add
()
{
this
.
array
.
push
({
this
.
array
.
push
({
value
:
''
value
:
''
...
@@ -58,8 +75,33 @@ export default class TextArray extends Vue {
...
@@ -58,8 +75,33 @@ export default class TextArray extends Vue {
</
script
>
</
script
>
<
style
scoped
lang=
"less"
>
<
style
scoped
lang=
"less"
>
.label {
display: inline-block;
width: 150px; /* 104 - 18 */
flex-shrink: 0;
height: 44px;
cursor: pointer;
line-height: 44px;
color: #797d84; /* todo ui图颜色不一致 */
font-size: 14px;
font-weight: 300;
position: relative;
}
.pre-tag {
position: absolute;
left: -30px;
top: 14px;
display: none;
}
.array-form {
.array-form {
flex-shrink: 0;
padding-left: 18px;
line-height: 65px;
height: auto;
height: auto;
font-size: 0;
display: flex;
justify-content: flex-start;
align-items: center;
}
}
.list {
.list {
display: flex;
display: flex;
...
@@ -73,6 +115,26 @@ export default class TextArray extends Vue {
...
@@ -73,6 +115,26 @@ export default class TextArray extends Vue {
flex-shrink: 0;
flex-shrink: 0;
height: 44px;
height: 44px;
width: 770px;
width: 770px;
box-sizing: border-box;
min-height: 44px;
border-radius: 4px;
border: 1px solid #DCDFE6; /* todo 边框、背景色ui图颜色不一致 */
outline: none;
padding-left: 24px;
font-size: 14px;
font-weight: 300;
&::-webkit-input-placeholder {
color: #bababa;
}
&::-moz-placeholder {
/* Mozilla Firefox 19+ */
color: #bababa;
}
&:-ms-input-placeholder {
/* Internet Explorer 10+ */
color: #bababa;
}
}
}
.del {
.del {
...
...
src/plugins/Template.ts
View file @
fa32a3a1
...
@@ -56,7 +56,7 @@ function formatProperty2Api(property: Property): TemplateProperty | TmplSelectPr
...
@@ -56,7 +56,7 @@ function formatProperty2Api(property: Property): TemplateProperty | TmplSelectPr
},
},
};
};
}
else
if
(
property
.
type
===
PropertyType
.
Image
)
{
}
else
if
(
property
.
type
===
PropertyType
.
Image
)
{
let
data
=
{}
let
data
=
[];
if
(
property
.
value
&&
property
.
value
!==
''
)
{
if
(
property
.
value
&&
property
.
value
!==
''
)
{
let
dd
=
Array
.
from
(
property
.
value
);
let
dd
=
Array
.
from
(
property
.
value
);
data
=
dd
.
map
((
value
:
any
)
=>
({
data
=
dd
.
map
((
value
:
any
)
=>
({
...
@@ -66,7 +66,11 @@ function formatProperty2Api(property: Property): TemplateProperty | TmplSelectPr
...
@@ -66,7 +66,11 @@ function formatProperty2Api(property: Property): TemplateProperty | TmplSelectPr
}))
}))
}
}
else
{
else
{
data
=
{}
data
.
push
({
format
:
"hash(hash)"
,
type
:
"image"
,
value
:
''
})
}
}
return
{
return
{
key
:
property
.
key
,
key
:
property
.
key
,
...
@@ -75,7 +79,7 @@ function formatProperty2Api(property: Property): TemplateProperty | TmplSelectPr
...
@@ -75,7 +79,7 @@ function formatProperty2Api(property: Property): TemplateProperty | TmplSelectPr
label
:
property
.
label
label
:
property
.
label
};
};
}
else
if
(
property
.
type
===
PropertyType
.
File
)
{
}
else
if
(
property
.
type
===
PropertyType
.
File
)
{
let
data
=
{}
let
data
=
[]
if
(
property
.
value
)
{
if
(
property
.
value
)
{
let
dd
=
Array
.
from
(
property
.
value
);
let
dd
=
Array
.
from
(
property
.
value
);
data
=
(
dd
as
any
).
map
((
value
:
any
)
=>
({
data
=
(
dd
as
any
).
map
((
value
:
any
)
=>
({
...
@@ -85,7 +89,11 @@ function formatProperty2Api(property: Property): TemplateProperty | TmplSelectPr
...
@@ -85,7 +89,11 @@ function formatProperty2Api(property: Property): TemplateProperty | TmplSelectPr
}))
}))
}
}
else
{
else
{
data
=
{}
data
.
push
({
format
:
"hash(hash)"
,
type
:
"file"
,
value
:
''
})
}
}
return
{
return
{
key
:
property
.
key
,
key
:
property
.
key
,
...
@@ -118,7 +126,7 @@ function formatProperty2Api(property: Property): TemplateProperty | TmplSelectPr
...
@@ -118,7 +126,7 @@ function formatProperty2Api(property: Property): TemplateProperty | TmplSelectPr
};
};
}
else
if
(
property
.
type
===
PropertyType
.
Video
)
{
}
else
if
(
property
.
type
===
PropertyType
.
Video
)
{
let
data
=
{}
let
data
=
[]
if
(
property
.
value
)
{
if
(
property
.
value
)
{
let
dd
=
Array
.
from
(
property
.
value
);
let
dd
=
Array
.
from
(
property
.
value
);
data
=
(
dd
as
any
).
map
((
value
:
any
)
=>
({
data
=
(
dd
as
any
).
map
((
value
:
any
)
=>
({
...
@@ -128,7 +136,11 @@ function formatProperty2Api(property: Property): TemplateProperty | TmplSelectPr
...
@@ -128,7 +136,11 @@ function formatProperty2Api(property: Property): TemplateProperty | TmplSelectPr
}))
}))
}
}
else
{
else
{
data
=
{}
data
.
push
({
format
:
"hash(hash)"
,
type
:
"media"
,
value
:
''
})
}
}
return
{
return
{
key
:
property
.
key
,
key
:
property
.
key
,
...
@@ -138,7 +150,7 @@ function formatProperty2Api(property: Property): TemplateProperty | TmplSelectPr
...
@@ -138,7 +150,7 @@ function formatProperty2Api(property: Property): TemplateProperty | TmplSelectPr
};
};
}
}
else
if
(
property
.
type
===
PropertyType
.
Audio
)
{
else
if
(
property
.
type
===
PropertyType
.
Audio
)
{
let
data
=
{}
let
data
=
[]
if
(
property
.
value
)
{
if
(
property
.
value
)
{
let
dd
=
Array
.
from
(
property
.
value
);
let
dd
=
Array
.
from
(
property
.
value
);
data
=
(
dd
as
any
).
map
((
value
:
any
)
=>
({
data
=
(
dd
as
any
).
map
((
value
:
any
)
=>
({
...
@@ -148,7 +160,11 @@ function formatProperty2Api(property: Property): TemplateProperty | TmplSelectPr
...
@@ -148,7 +160,11 @@ function formatProperty2Api(property: Property): TemplateProperty | TmplSelectPr
}))
}))
}
}
else
{
else
{
data
=
{}
data
.
push
({
format
:
"hash(hash)"
,
type
:
"media"
,
value
:
''
})
}
}
return
{
return
{
key
:
property
.
key
,
key
:
property
.
key
,
...
@@ -157,7 +173,26 @@ function formatProperty2Api(property: Property): TemplateProperty | TmplSelectPr
...
@@ -157,7 +173,26 @@ function formatProperty2Api(property: Property): TemplateProperty | TmplSelectPr
label
:
property
.
label
label
:
property
.
label
};
};
}
}
//Video
else
if
(
property
.
type
===
PropertyType
.
TextArray
)
{
let
data
=
(
property
.
value
as
[
string
])?.
map
((
item
:
string
)
=>
{
return
{
format
:
"string"
,
type
:
"text"
,
value
:
item
}
})
||
[{
format
:
"string"
,
type
:
"text"
,
value
:
''
}]
return
{
key
:
property
.
key
,
type
:
(
property
.
type
as
PropertyType
.
TextArray
),
data
:
data
,
label
:
property
.
label
};
}
//Video
else
{
else
{
return
{
return
{
data
:
{
data
:
{
...
@@ -197,6 +232,8 @@ function formatApiProperty2Local(property: any, parent: Unit): Property {
...
@@ -197,6 +232,8 @@ function formatApiProperty2Local(property: any, parent: Unit): Property {
local
.
value
=
property
.
data
local
.
value
=
property
.
data
}
else
if
(
property
.
type
===
PropertyType
.
Audio
)
{
}
else
if
(
property
.
type
===
PropertyType
.
Audio
)
{
local
.
value
=
property
.
data
local
.
value
=
property
.
data
}
else
if
(
property
.
type
===
PropertyType
.
TextArray
)
{
local
.
value
=
property
.
data
.
map
((
item
:
{
value
:
string
})
=>
item
.
value
);
}
}
return
local
;
return
local
;
}
}
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