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
72e2aa5b
Commit
72e2aa5b
authored
Oct 04, 2020
by
zL
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
保留data数据格式
parent
175a7ce0
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
35 additions
and
14 deletions
+35
-14
NameEditor.vue
src/components/NameEditor.vue
+0
-1
Template.ts
src/plugins/Template.ts
+5
-6
element.js
src/plugins/element.js
+4
-1
types.ts
src/plugins/types.ts
+0
-1
types2.ts
src/plugins/types2.ts
+21
-5
editTemplate.vue
src/views/template/editTemplate.vue
+5
-0
No files found.
src/components/NameEditor.vue
View file @
72e2aa5b
...
...
@@ -8,7 +8,6 @@
:readonly=
"!operation"
:value=
"value"
@
input=
"emitChange"
maxlength=
"10"
@
keyup
.
enter=
"$event.target.blur()"
:class=
"
{ noMsg: value.trim().length === 0 }"
:style="getWidth"
...
...
src/plugins/Template.ts
View file @
72e2aa5b
...
...
@@ -42,6 +42,7 @@ function formatL2Local2Api(localL2: Property | Unit): TemplateProperty | TmplSel
function
formatProperty2Api
(
property
:
Property
):
TemplateProperty
|
TmplSelectProperty
|
any
{
if
(
property
.
type
===
PropertyType
.
Select
)
{
return
{
key
:
property
.
key
,
...
...
@@ -93,11 +94,12 @@ function formatProperty2Api(property: Property): TemplateProperty | TmplSelectPr
label
:
property
.
label
};
}
else
if
(
property
.
type
===
PropertyType
.
Input
)
{
// 针对扩展数据ext做保留key的处理
// 保留key,保留data
console
.
log
(
property
.
data
);
return
{
data
:
{
format
:
"string"
,
type
:
"text"
,
format
:
property
.
data
?
property
.
data
.
format
:
'string'
,
type
:
property
.
data
?
property
.
data
.
type
:
'text'
,
value
:
property
.
value
},
type
:
PropertyType
.
Input
,
...
...
@@ -153,10 +155,7 @@ function formatProperty2Api(property: Property): TemplateProperty | TmplSelectPr
// 接口json数据转换为本地
export
function
formatTemplateApi2Local
(
apiList
:
RootUnitType
[]):
Unit
[]
{
return
apiList
.
map
((
rootUnit
)
=>
{
console
.
log
(
rootUnit
);
const
unit
=
new
Unit
(
rootUnit
.
label
);
if
(
rootUnit
.
data
)
{
unit
.
children
=
rootUnit
.
data
.
map
((
l2
)
=>
{
...
...
src/plugins/element.js
View file @
72e2aa5b
...
...
@@ -9,7 +9,8 @@ import {
Breadcrumb
,
Form
,
Button
,
Loading
Loading
,
DatePicker
}
from
'element-ui'
;
Vue
.
use
(
Checkbox
);
...
...
@@ -20,5 +21,6 @@ Vue.use(Progress);
Vue
.
use
(
Breadcrumb
);
Vue
.
use
(
Button
);
Vue
.
use
(
Form
);
Vue
.
use
(
DatePicker
)
Vue
.
prototype
.
$loading
=
Loading
;
Vue
.
prototype
.
$message
=
Message
;
\ No newline at end of file
src/plugins/types.ts
View file @
72e2aa5b
...
...
@@ -50,6 +50,5 @@ export interface TmplSelectProperty extends Property {
*/
export
interface
UnitProperty
extends
Property
{
type
:
PropertyType
.
Unit
;
// label:any;
value
:
Array
<
TemplateProperty
|
TmplSelectProperty
>
;
// 包含的子字段数组
}
src/plugins/types2.ts
View file @
72e2aa5b
...
...
@@ -6,12 +6,14 @@ export class Unit {
public
children
:
Array
<
Property
|
Unit
>
;
public
parent
:
Unit
|
null
;
public
type
:
PropertyType
=
PropertyType
.
Unit
;
// public data: object = declaration
constructor
(
title
:
string
,
parent
?:
Unit
)
{
constructor
(
title
:
string
,
data
?:
object
,
parent
?:
Unit
)
{
this
.
id
=
getUuid
();
this
.
title
=
title
;
this
.
children
=
[];
this
.
parent
=
parent
||
null
;
// this.data = data || {}
}
/**
...
...
@@ -33,6 +35,16 @@ export class Unit {
}
export
class
declaration
{
public
value
:
string
;
public
format
:
string
;
public
type
:
string
;
constructor
(
value
:
string
,
format
:
string
,
type
:
string
)
{
this
.
value
=
value
;
this
.
format
=
format
;
this
.
type
=
type
;
}
}
/**
* 属性
*/
...
...
@@ -45,10 +57,14 @@ export class Property {
public
value
:
string
|
Array
<
string
>
;
public
parent
:
Unit
;
public
data
?:
{
value
:
string
value
:
string
,
format
:
string
,
type
:
string
};
// public data: any
constructor
(
label
:
string
,
key
:
string
,
parent
:
Unit
,
type
:
PropertyType
=
PropertyType
.
Input
,
value
:
string
|
Array
<
string
>
=
``
,
data
?:
{
value
:
string
})
{
constructor
(
label
:
string
,
key
:
string
,
parent
:
Unit
,
type
:
PropertyType
=
PropertyType
.
Input
,
value
:
string
|
Array
<
string
>
=
``
,
data
?:
{
value
:
string
,
format
:
string
,
type
:
string
})
{
this
.
id
=
getUuid
();
this
.
label
=
label
;
this
.
key
=
key
;
...
...
@@ -56,7 +72,7 @@ export class Property {
this
.
options
=
[];
this
.
parent
=
parent
;
this
.
value
=
``
;
this
.
data
=
data
if
(
Object
.
prototype
.
toString
.
call
(
value
)
===
`[object Array]`
)
{
if
(
!
(
value
.
length
!==
0
&&
Object
.
prototype
.
toString
.
call
(
value
[
0
])
===
`[object Object]`
))
{
...
...
src/views/template/editTemplate.vue
View file @
72e2aa5b
...
...
@@ -567,6 +567,9 @@ export default class editTemplate extends Vue {
await
this
.
fileHandler
();
var
newDetail
=
new
Array
();
newDetail
=
formatApiJson
(
this
.
rootUnitList
);
console
.
log
(
newDetail
);
return
;
// 更新ext数据
for
(
let
index
=
0
;
index
<
newDetail
.
length
;
index
++
)
{
const
element
=
newDetail
[
index
];
...
...
@@ -664,7 +667,9 @@ export default class editTemplate extends Vue {
};
var
newDetail
=
new
Array
();
newDetail
=
formatApiJson
(
this
.
rootUnitList
);
newDetail
.
push
(
newext
);
const
res
=
await
this
.
$ajax
({
type
:
"post"
,
url
:
GO_URLS
.
add
,
...
...
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