Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
W
WidgetUI
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
WuFeiyang
WidgetUI
Commits
ad0f09f2
Commit
ad0f09f2
authored
Sep 17, 2019
by
WuFeiyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
界面优化
parent
014b9681
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
97 additions
and
45 deletions
+97
-45
public/index.html
public/index.html
+3
-5
src/App.vue
src/App.vue
+56
-36
src/components/Status/Status.vue
src/components/Status/Status.vue
+30
-4
src/models/WidgetRef.ts
src/models/WidgetRef.ts
+6
-0
src/models/wiget.ts
src/models/wiget.ts
+2
-0
No files found.
public/index.html
View file @
ad0f09f2
...
@@ -6,11 +6,9 @@
...
@@ -6,11 +6,9 @@
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=edge"
>
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=edge"
>
<meta
name=
"viewport"
content=
"width=device-width,initial-scale=1.0"
>
<meta
name=
"viewport"
content=
"width=device-width,initial-scale=1.0"
>
<link
rel=
"stylesheet"
href=
"https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css"
>
<link
rel=
"stylesheet"
href=
"https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css"
>
<script
src=
"https://cdn.bootcss.com/jquery/2.1.1/jquery.min.js"
></script>
<script
src=
"https://cdn.bootcss.com/jquery/2.1.1/jquery.min.js"
></script>
<script
src=
"https://cdn.staticfile.org/vue/2.2.2/vue.min.js"
></script>
<script
src=
"https://cdn.staticfile.org/vue/2.2.2/vue.min.js"
></script>
<link
rel=
"icon"
href=
"<%= BASE_URL %>favicon.ico"
>
<link
rel=
"icon"
href=
"<%= BASE_URL %>favicon.ico"
>
<title>
vue
</title>
<title>
vue
</title>
</head>
</head>
...
...
src/App.vue
View file @
ad0f09f2
<
template
>
<
template
>
<div
id=
"app"
>
<div
id=
"app"
>
<div
class=
"btn-group"
>
<b-navbar
class=
"Widget"
>
<ul>
<b-dropdown
id=
"dropdown-1"
text=
"Add Widget"
class=
"m-md-2"
variant=
"primary"
>
<div
v-for=
"(availableWidget,index) in availableWidgets"
:key=
"index"
>
<b-dropdown-item
v-for=
"(availableWidget,index) in availableWidgets"
:key=
"index"
>
<li>
<div
v-on:click=
"addWidget(availableWidget)"
>
{{
availableWidget
}}
</div>
<a
href=
"#"
v-on:click=
"addWidget(availableWidget)"
>
{{
availableWidget
}}
</a>
</b-dropdown-item>
</li>
</b-dropdown>
</div>
<b-button
@
click=
"saveWidgetList"
style=
"margin-left:2%"
variant=
"primary"
>
Save
</b-button>
</ul>
<b-form-file
id=
"file"
type=
"file"
@
change=
"loadTextFromFile"
placeholder=
"Choose a widgetTemplate file to laod"
accept=
".json"
style=
"width:30%;margin-left:2%"
/>
</div>
</b-navbar>
<button
@
click=
"saveWidgetList"
>
Save
</button>
<input
id=
"file"
type=
"file"
@
change=
"loadTextFromFile"
/>
<!--
<button
@
click=
"toggleShowAddWidget"
>
Add
</button>
<grid-layout
<div
v-show=
"isShowAddWidget"
>
:layout.sync=
"widgetList"
<div
v-for=
"(availableWidget,index) in availableWidgets"
:key=
"index"
>
:col-num=
"12"
<button
v-on:click=
"addWidget(availableWidget)"
>
{{
availableWidget
}}
</button>
:row-height=
"30"
</div>
:is-draggable=
"true"
</div>
-->
:is-resizable=
"true"
<div
v-for=
"(widget,index) in widgetList"
:key=
"index"
>
:is-mirrored=
"false"
<component
:is=
"widget.widgetComponentName"
:ref=
"widget.ref"
></component>
:vertical-compact=
"true"
</div>
:margin=
"[10, 10]"
:use-css-transforms=
"true"
>
<grid-item
v-for=
"(widget) in widgetList"
:x=
"widget.x"
:y=
"widget.y"
:w=
"widget.w"
:h=
"widget.h"
:i=
"widget.i"
:key=
"widget.i"
>
<div
style=
"height:20px;background-color:rgb(0, 123, 255)"
>
</div>
<component
:is=
"widget.widgetComponentName"
:ref=
"widget.ref"
></component>
</grid-item>
</grid-layout>
</div>
</div>
</
template
>
</
template
>
...
@@ -29,6 +42,7 @@
...
@@ -29,6 +42,7 @@
<
script
lang=
"ts"
>
<
script
lang=
"ts"
>
import
{
Component
,
Vue
}
from
"
vue-property-decorator
"
;
import
{
Component
,
Vue
}
from
"
vue-property-decorator
"
;
import
axios
from
"
axios
"
;
import
axios
from
"
axios
"
;
import
{
GridItemData
,
GridLayout
,
GridItem
}
from
'
vue-grid-layout
'
;
import
{
WidgetRef
}
from
"
./models/WidgetRef
"
;
import
{
WidgetRef
}
from
"
./models/WidgetRef
"
;
import
{
WidgetConfig
,
AllWidgetConfig
}
from
"
./models/WidgetConfig
"
;
import
{
WidgetConfig
,
AllWidgetConfig
}
from
"
./models/WidgetConfig
"
;
...
@@ -48,7 +62,9 @@ import Config from "./components/Config/Config.vue";
...
@@ -48,7 +62,9 @@ import Config from "./components/Config/Config.vue";
Status
,
Status
,
WaveView
,
WaveView
,
Method
,
Method
,
Config
Config
,
GridLayout
,
GridItem
}
}
})
})
export
default
class
App
extends
Vue
{
export
default
class
App
extends
Vue
{
...
@@ -65,22 +81,21 @@ export default class App extends Vue {
...
@@ -65,22 +81,21 @@ export default class App extends Vue {
this
.
isShowAddWidget
=
!
this
.
isShowAddWidget
;
this
.
isShowAddWidget
=
!
this
.
isShowAddWidget
;
}
}
UIAutomaticGenerated
()
{
async
UIAutomaticGenerated
()
{
var
fragment
=
window
.
location
.
hash
;
var
fragment
=
window
.
location
.
hash
;
if
(
fragment
!=
"
#
"
)
{
if
(
fragment
!=
"
#
"
)
{
axios
fragment
=
fragment
.
substring
(
1
,
fragment
.
length
-
1
);
.
get
(
"
"
)
var
customViewURL
=
"
/customView
"
+
fragment
;
.
then
(
function
(
response
)
{
await
axios
.
get
(
customViewURL
).
then
(
response
=>
{
// handle success
var
widgets
=
Object
.
assign
(
console
.
log
(
response
);
new
AllWidgetConfig
(),
})
JSON
.
parse
(
response
.
data
.
ObjectVal
)
.
catch
(
function
(
error
)
{
);
// handle error
this
.
widgetList
=
widgets
.
widgetList
;
console
.
log
(
error
);
this
.
lastWidgetIndex
=
Number
(
widgets
.
currentRef
);
})
this
.
importActiveWidgetList
();
.
then
(
function
()
{
// always executed
});
});
}
}
}
}
...
@@ -147,6 +162,8 @@ export default class App extends Vue {
...
@@ -147,6 +162,8 @@ export default class App extends Vue {
var
newWidget
=
new
WidgetRef
();
var
newWidget
=
new
WidgetRef
();
newWidget
.
widgetComponentName
=
widgetName
;
newWidget
.
widgetComponentName
=
widgetName
;
newWidget
.
ref
=
this
.
lastWidgetIndex
.
toString
();
newWidget
.
ref
=
this
.
lastWidgetIndex
.
toString
();
newWidget
.
y
=
this
.
lastWidgetIndex
*
4
;
newWidget
.
i
=
Number
(
newWidget
.
ref
);
this
.
lastWidgetIndex
++
;
this
.
lastWidgetIndex
++
;
this
.
widgetList
=
[...
this
.
widgetList
,
newWidget
];
this
.
widgetList
=
[...
this
.
widgetList
,
newWidget
];
}
}
...
@@ -171,6 +188,9 @@ export default class App extends Vue {
...
@@ -171,6 +188,9 @@ export default class App extends Vue {
-moz-osx-font-smoothing
:
grayscale
;
-moz-osx-font-smoothing
:
grayscale
;
text-align
:
center
;
text-align
:
center
;
color
:
#2c3e50
;
color
:
#2c3e50
;
margin-top
:
60px
;
}
.Widget
{
width
:
100%
;
border-color
:
rgb
(
206
,
212
,
218
);
}
}
</
style
>
</
style
>
src/components/Status/Status.vue
View file @
ad0f09f2
<
template
>
<
template
>
<
div
class=
"Status"
>
<
!--
<b-card
class=
"Status"
>
<p>
{{
config
.
data
.
url
}}
</p>
<p>
{{
config
.
data
.
url
}}
</p>
<p>
{{
StatusValue
}}
</p>
<button
@
click=
"showPathConfig"
>
Setting
</button>
<button
@
click=
"showPathConfig"
>
Setting
</button>
<p>
{{
StatusValue
}}
</p>
<div
v-show=
"isShowPath"
>
<div
v-show=
"isShowPath"
>
<input
v-model=
"config.data.url"
/>
<input
v-model=
"config.data.url"
/>
<button
@
click=
"updateUI"
>
OK
</button>
<button
@
click=
"updateUI"
>
OK
</button>
</div>
</div>
<WidgetParams
ref=
"WidgetParams"
v-show=
"isShowParams"
action=
"get"
@
updataVariables=
"viewLoad"
></WidgetParams>
<WidgetParams
ref=
"WidgetParams"
v-show=
"isShowParams"
action=
"get"
@
updataVariables=
"viewLoad"
></WidgetParams>
</div>
</b-card>
-->
<b-container
class=
"bv-example-row"
>
<b-row
style=
"margin-top:10px"
>
<b-col>
<span
style=
"float:left;font-size:20px"
>
path:
{{
config
.
data
.
url
}}
</span>
</b-col>
<b-col>
<b-button
@
click=
"showPathConfig"
variant=
"primary"
style=
"float:right"
><span
class=
"glyphicon glyphicon-cog"
></span></b-button>
</b-col>
<hr
/>
</b-row>
<div
style=
"width:100%"
>
<span
style=
"float:left;font-size:20px"
>
{{
StatusValue
}}
</span>
<hr
/>
</div>
<div
v-show=
"isShowPath"
>
<input
v-model=
"config.data.url"
/>
<button
@
click=
"updateUI"
>
OK
</button>
</div>
<WidgetParams
ref=
"WidgetParams"
v-show=
"isShowParams"
action=
"get"
@
updataVariables=
"viewLoad"
></WidgetParams>
</b-container>
</
template
>
</
template
>
<
script
lang=
"ts"
>
<
script
lang=
"ts"
>
...
@@ -48,7 +68,6 @@ export default class Status extends Widget {
...
@@ -48,7 +68,6 @@ export default class Status extends Widget {
userInputData
:
""
userInputData
:
""
}
}
};
};
tempUrl
:
string
=
""
;
created
()
{
created
()
{
// this.config.data.userInputData = this.userInputData;
// this.config.data.userInputData = this.userInputData;
...
@@ -90,9 +109,15 @@ export default class Status extends Widget {
...
@@ -90,9 +109,15 @@ export default class Status extends Widget {
(
this
.
$refs
.
WidgetParams
as
WidgetParams
).
setVariableInput
(
this
.
userInputData
);
(
this
.
$refs
.
WidgetParams
as
WidgetParams
).
setVariableInput
(
this
.
userInputData
);
}
}
replaceStartPath
(
startPath
:
string
)
{
}
parentUpdate
(
payload
:
UpdatePayload
):
void
{
parentUpdate
(
payload
:
UpdatePayload
):
void
{
}
}
refresh
()
{
refresh
()
{
var
Args
:
UpdatePayload
=
{
var
Args
:
UpdatePayload
=
{
action
:
"
get
"
,
action
:
"
get
"
,
...
@@ -130,4 +155,5 @@ export default class Status extends Widget {
...
@@ -130,4 +155,5 @@ export default class Status extends Widget {
width
:
100%
;
width
:
100%
;
height
:
auto
;
height
:
auto
;
}
}
</
style
>
</
style
>
\ No newline at end of file
src/models/WidgetRef.ts
View file @
ad0f09f2
...
@@ -6,4 +6,10 @@ export class WidgetRef {
...
@@ -6,4 +6,10 @@ export class WidgetRef {
public
widgetComponentName
:
string
=
''
;
public
widgetComponentName
:
string
=
''
;
public
ref
:
string
=
''
;
public
ref
:
string
=
''
;
public
widgetConfig
?:
WidgetConfig
;
public
widgetConfig
?:
WidgetConfig
;
//below is for grid layout
public
x
:
number
=
0
;
public
y
:
number
=
0
;
public
w
:
number
=
4
;
public
h
:
number
=
4
;
public
i
:
number
=
0
;
}
}
src/models/wiget.ts
View file @
ad0f09f2
...
@@ -15,6 +15,8 @@ export abstract class Widget extends Vue {
...
@@ -15,6 +15,8 @@ export abstract class Widget extends Vue {
public
abstract
parentUpdate
(
paylosd
:
UpdatePayload
):
void
;
public
abstract
parentUpdate
(
paylosd
:
UpdatePayload
):
void
;
public
abstract
refresh
():
void
;
public
abstract
refresh
():
void
;
public
abstract
updateUI
():
void
;
public
abstract
updateUI
():
void
;
// public abstract replaceStartPath(startPath:string):void;
// public poke(sample: object): PokePath
// public poke(sample: object): PokePath
// {
// {
// let pokePath:PokePath;
// let pokePath:PokePath;
...
...
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