Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wisdom-components
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ReactWeb5
wisdom-components
Commits
5307013c
Commit
5307013c
authored
Mar 17, 2023
by
李纪文
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 组态增加图片模型、功能跳转方法
parent
995618df
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
150 additions
and
26 deletions
+150
-26
EC_ConfigurationView.md
...mponents/EC_ConfigurationView/src/EC_ConfigurationView.md
+9
-8
HistoryModel.js
...xtend-components/EC_ConfigurationView/src/HistoryModel.js
+62
-9
RealModel.js
...s/extend-components/EC_ConfigurationView/src/RealModel.js
+62
-8
默认.png
...tend-components/EC_ConfigurationView/src/images/组态/默认.png
+0
-0
utils.js
...es/extend-components/EC_ConfigurationView/src/js/utils.js
+17
-1
No files found.
packages/extend-components/EC_ConfigurationView/src/EC_ConfigurationView.md
View file @
5307013c
...
@@ -27,14 +27,15 @@ group:
...
@@ -27,14 +27,15 @@ group:
## API
## API
| 参数 | 说明 | 类型 | 默认值 |
| 参数 | 说明 | 类型 | 默认值 |
| -------------- | -------------------------------- | ------- | ------ |
| -------------- | -------------------------------- | ---------------- | ------ |
| name
`必需`
| 画板名称 | string | '' |
| name
`必需`
| 画板名称 | string | '' |
| devices
`必需`
| 画板设备 | array |
[
] |
| devices
`必需`
| 画板设备 | array |
[
] |
| deviceName | 画板设备名称 | array |
[
] |
| deviceName | 画板设备名称 | array |
[
] |
| config | 全局 globalConfig,没有时需要传递 | object | {} |
| config | 全局 globalConfig,没有时需要传递 | object | {} |
| isZoom | 是否可缩放(手持上建议设置 true) | boolean | false |
| isZoom | 是否可缩放(手持上建议设置 true) | boolean | false |
| flowShow | 是否水流效果(无数据表现) | boolean | true |
| flowShow | 是否水流效果(无数据表现) | boolean | true |
| customBack | 自定义交互的回调,返回点击的模型 | function(node){} | - |
### 工艺回放
### 工艺回放
...
...
packages/extend-components/EC_ConfigurationView/src/HistoryModel.js
View file @
5307013c
...
@@ -13,7 +13,7 @@ import TopRotatingTool from './js/RotatingTool';
...
@@ -13,7 +13,7 @@ import TopRotatingTool from './js/RotatingTool';
import
BarLink
from
'./js/BarLink'
;
import
BarLink
from
'./js/BarLink'
;
import
WaterFlowControlView
from
'./js/WaterFlowControlView'
;
import
WaterFlowControlView
from
'./js/WaterFlowControlView'
;
import
{
getSketchPadList
,
getSketchPadContent
,
getPointAddress
,
getHistoryInfo
}
from
'./apis'
;
import
{
getSketchPadList
,
getSketchPadContent
,
getPointAddress
,
getHistoryInfo
}
from
'./apis'
;
import
{
deepCopy
,
hexToRgba
,
textStyle
}
from
'./js/utils'
;
import
{
deepCopy
,
hexToRgba
,
textStyle
,
querySkipUrl
}
from
'./js/utils'
;
import
'./index.less'
;
import
'./index.less'
;
const
goJS
=
go
.
GraphObject
.
make
;
const
goJS
=
go
.
GraphObject
.
make
;
...
@@ -789,6 +789,13 @@ const ConfigurationView = (props) => {
...
@@ -789,6 +789,13 @@ const ConfigurationView = (props) => {
props.callback && props.callback(speed, timeData.length, play, time);
props.callback && props.callback(speed, timeData.length, play, time);
};
};
/** **************************************跳转方法****************************************** */
const menuJumpMethod = (node) => {
const list = querySkipUrl(globalConfig?.widgets || [], node?.widget || '');
if (!list || !node?.widget) return false;
window.history.pushState({}, null, `/civbase/${list.product || '
civweb4
'}/${list.url}`);
};
/** **************************************历史模态渲染****************************************** */
/** **************************************历史模态渲染****************************************** */
const historyModalRender = (data, list) => {
const historyModalRender = (data, list) => {
historyInfoParams = [
historyInfoParams = [
...
@@ -907,6 +914,51 @@ const ConfigurationView = (props) => {
...
@@ -907,6 +914,51 @@ const ConfigurationView = (props) => {
),
),
);
);
// img节点定义
myDiagram.nodeTemplateMap.add(
'imgCase',
goJS(
go.Node,
'Spot',
{ locationSpot: go.Spot.Center, zOrder: 1 },
new go.Binding('zOrder', 'zOrder').makeTwoWay(),
new go.Binding('location', 'loc', go.Point.parse).makeTwoWay(go.Point.stringify),
new go.Binding('angle').makeTwoWay(),
// the main object is a Panel that surrounds a TextBlock with a Shape ~图形:Panel包围着TextBlock
goJS(
go.Panel,
'Auto',
{
name: 'PANEL',
},
new go.Binding('desiredSize', 'size', go.Size.parse).makeTwoWay(go.Size.stringify),
goJS(
go.Picture,
{
name: 'animateSvg',
width: 56,
height: 56,
column: 0,
scale: 1,
source: require('./images/组态/默认.png'),
},
new go.Binding('source', 'imgSrc', function (v) {
return !v
? require('./images/组态/默认.png')
: `
/
PandaCore
/
GCK
/
SketchPad
/
PreviewResource
?
name
=
$
{
v
}
&
_site
=
$
{
globalConfig
?.
userInfo
?.
LocalSite
||
''
}
`;
}).makeTwoWay(),
new go.Binding('scale', 'scale').makeTwoWay(),
new go.Binding('width', 'width').makeTwoWay(),
new go.Binding('height', 'height').makeTwoWay(),
),
),
),
);
// svg节点定义
// svg节点定义
myDiagram.nodeTemplateMap.add(
myDiagram.nodeTemplateMap.add(
'svgCase',
'svgCase',
...
@@ -937,14 +989,6 @@ const ConfigurationView = (props) => {
...
@@ -937,14 +989,6 @@ const ConfigurationView = (props) => {
new go.Binding('height', 'height').makeTwoWay(),
new go.Binding('height', 'height').makeTwoWay(),
),
),
),
),
makePort('T', go.Spot.Top, true, true),
makePort('L', go.Spot.Left, true, true),
makePort('R', go.Spot.Right, true, true),
makePort('B', go.Spot.Bottom, true, true),
makePort('RB', go.Spot.BottomRight, true, true),
makePort('LB', go.Spot.BottomLeft, true, true),
makePort('RT', go.Spot.TopRight, true, true),
makePort('LT', go.Spot.TopLeft, true, true),
{
{
click(e, node) {
click(e, node) {
const { data } = node;
const { data } = node;
...
@@ -952,6 +996,9 @@ const ConfigurationView = (props) => {
...
@@ -952,6 +996,9 @@ const ConfigurationView = (props) => {
switch (data.opType) {
switch (data.opType) {
case '画板跳转': // 图片模型
case '画板跳转': // 图片模型
break;
break;
case '功能跳转': // 功能模型
menuJumpMethod(data);
break;
case '自定义交互': // 自定义交互
case '自定义交互': // 自定义交互
customBack(data);
customBack(data);
break;
break;
...
@@ -1072,6 +1119,9 @@ const ConfigurationView = (props) => {
...
@@ -1072,6 +1119,9 @@ const ConfigurationView = (props) => {
switch (data.opType) {
switch (data.opType) {
case '画板跳转': // 图片模型
case '画板跳转': // 图片模型
break;
break;
case '功能跳转': // 功能模型
menuJumpMethod(data);
break;
case '自定义交互': // 自定义交互
case '自定义交互': // 自定义交互
customBack(data);
customBack(data);
break;
break;
...
@@ -1130,6 +1180,9 @@ const ConfigurationView = (props) => {
...
@@ -1130,6 +1180,9 @@ const ConfigurationView = (props) => {
switch (data.opType) {
switch (data.opType) {
case '画板跳转': // 图片模型
case '画板跳转': // 图片模型
break;
break;
case '功能跳转': // 功能模型
menuJumpMethod(data);
break;
case '自定义交互': // 自定义交互
case '自定义交互': // 自定义交互
customBack(data);
customBack(data);
break;
break;
...
...
packages/extend-components/EC_ConfigurationView/src/RealModel.js
View file @
5307013c
...
@@ -32,6 +32,7 @@ import {
...
@@ -32,6 +32,7 @@ import {
addNumMethod
,
addNumMethod
,
hexSwitch
,
hexSwitch
,
textStyle
,
textStyle
,
querySkipUrl
,
}
from
'./js/utils'
;
}
from
'./js/utils'
;
import
'./index.less'
;
import
'./index.less'
;
...
@@ -1164,6 +1165,13 @@ const ConfigurationView = (props) => {
...
@@ -1164,6 +1165,13 @@ const ConfigurationView = (props) => {
}
}
};
};
/** **************************************跳转方法****************************************** */
const menuJumpMethod = (node) => {
const list = querySkipUrl(globalConfig?.widgets || [], node?.widget || '');
if (!list || !node?.widget) return false;
window.history.pushState({}, null, `/civbase/${list.product || '
civweb4
'}/${list.url}`);
};
/** **************************************跳转方法****************************************** */
/** **************************************跳转方法****************************************** */
const drawBoardMethod = (data) => {
const drawBoardMethod = (data) => {
const opRule = JSON.parse(data.opRule);
const opRule = JSON.parse(data.opRule);
...
@@ -1316,6 +1324,51 @@ const ConfigurationView = (props) => {
...
@@ -1316,6 +1324,51 @@ const ConfigurationView = (props) => {
),
),
);
);
// img节点定义
myDiagram.nodeTemplateMap.add(
'imgCase',
goJS(
go.Node,
'Spot',
{ locationSpot: go.Spot.Center, zOrder: 1 },
new go.Binding('zOrder', 'zOrder').makeTwoWay(),
new go.Binding('location', 'loc', go.Point.parse).makeTwoWay(go.Point.stringify),
new go.Binding('angle').makeTwoWay(),
// the main object is a Panel that surrounds a TextBlock with a Shape ~图形:Panel包围着TextBlock
goJS(
go.Panel,
'Auto',
{
name: 'PANEL',
},
new go.Binding('desiredSize', 'size', go.Size.parse).makeTwoWay(go.Size.stringify),
goJS(
go.Picture,
{
name: 'animateSvg',
width: 56,
height: 56,
column: 0,
scale: 1,
source: require('./images/组态/默认.png'),
},
new go.Binding('source', 'imgSrc', function (v) {
return !v
? require('./images/组态/默认.png')
: `
/
PandaCore
/
GCK
/
SketchPad
/
PreviewResource
?
name
=
$
{
v
}
&
_site
=
$
{
globalConfig
?.
userInfo
?.
LocalSite
||
''
}
`;
}).makeTwoWay(),
new go.Binding('scale', 'scale').makeTwoWay(),
new go.Binding('width', 'width').makeTwoWay(),
new go.Binding('height', 'height').makeTwoWay(),
),
),
),
);
// svg节点定义
// svg节点定义
myDiagram.nodeTemplateMap.add(
myDiagram.nodeTemplateMap.add(
'svgCase',
'svgCase',
...
@@ -1346,14 +1399,6 @@ const ConfigurationView = (props) => {
...
@@ -1346,14 +1399,6 @@ const ConfigurationView = (props) => {
new go.Binding('height', 'height').makeTwoWay(),
new go.Binding('height', 'height').makeTwoWay(),
),
),
),
),
makePort('T', go.Spot.Top, true, true),
makePort('L', go.Spot.Left, true, true),
makePort('R', go.Spot.Right, true, true),
makePort('B', go.Spot.Bottom, true, true),
makePort('RB', go.Spot.BottomRight, true, true),
makePort('LB', go.Spot.BottomLeft, true, true),
makePort('RT', go.Spot.TopRight, true, true),
makePort('LT', go.Spot.TopLeft, true, true),
{
{
click(e, node) {
click(e, node) {
const { data } = node;
const { data } = node;
...
@@ -1372,6 +1417,9 @@ const ConfigurationView = (props) => {
...
@@ -1372,6 +1417,9 @@ const ConfigurationView = (props) => {
case '画板跳转': // 图片模型
case '画板跳转': // 图片模型
drawBoardMethod(data);
drawBoardMethod(data);
break;
break;
case '功能跳转': // 功能模型
menuJumpMethod(data);
break;
case '自定义交互': // 自定义交互
case '自定义交互': // 自定义交互
customBack(data);
customBack(data);
break;
break;
...
@@ -1494,6 +1542,9 @@ const ConfigurationView = (props) => {
...
@@ -1494,6 +1542,9 @@ const ConfigurationView = (props) => {
case '画板跳转': // 图片模型
case '画板跳转': // 图片模型
drawBoardMethod(data);
drawBoardMethod(data);
break;
break;
case '功能跳转': // 功能模型
menuJumpMethod(data);
break;
case '自定义交互': // 自定义交互
case '自定义交互': // 自定义交互
customBack(data);
customBack(data);
break;
break;
...
@@ -1563,6 +1614,9 @@ const ConfigurationView = (props) => {
...
@@ -1563,6 +1614,9 @@ const ConfigurationView = (props) => {
case '画板跳转': // 图片模型
case '画板跳转': // 图片模型
drawBoardMethod(data);
drawBoardMethod(data);
break;
break;
case '功能跳转': // 功能模型
menuJumpMethod(data);
break;
case '自定义交互': // 自定义交互
case '自定义交互': // 自定义交互
customBack(data);
customBack(data);
break;
break;
...
...
packages/extend-components/EC_ConfigurationView/src/images/组态/默认.png
0 → 100644
View file @
5307013c
5.32 KB
packages/extend-components/EC_ConfigurationView/src/js/utils.js
View file @
5307013c
// 判断是否是数字
// 判断是否是数字
export
const
isNumber
=
(
val
)
=>
{
export
const
isNumber
=
(
val
)
=>
{
const
regPos
=
/^
\d
+
(\.\d
+
)?
$/
;
// 非负浮点数
const
regPos
=
/^
\d
+
(\.\d
+
)?
$/
;
// 非负浮点数
const
regNeg
=
/^
(
-
(([
0-9
]
+
\.[
0-9
]
*
[
1-9
][
0-9
]
*
)
|
([
0-9
]
*
[
1-9
][
0-9
]
*
\.[
0-9
]
+
)
|
([
0-9
]
*
[
1-9
][
0-9
]
*
)))
$/
;
// 负浮点数
const
regNeg
=
/^
(
-
(([
0-9
]
+
\.[
0-9
]
*
[
1-9
][
0-9
]
*
)
|
([
0-9
]
*
[
1-9
][
0-9
]
*
\.[
0-9
]
+
)
|
([
0-9
]
*
[
1-9
][
0-9
]
*
)))
$/
;
// 负浮点数
return
regPos
.
test
(
val
)
||
regNeg
.
test
(
val
);
return
regPos
.
test
(
val
)
||
regNeg
.
test
(
val
);
};
};
...
@@ -82,3 +83,18 @@ export const textStyle = () => {
...
@@ -82,3 +83,18 @@ export const textStyle = () => {
stroke
:
'whitesmoke'
,
stroke
:
'whitesmoke'
,
};
};
};
};
// 菜单处理
export
const
querySkipUrl
=
(
data
,
id
)
=>
{
let
res
=
null
;
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
if
(
data
[
i
].
widgetId
===
id
)
{
res
=
data
[
i
];
return
data
[
i
];
}
else
if
(
data
[
i
].
widgets
&&
data
[
i
].
widgets
.
length
>
0
)
{
res
=
querySkipUrl
(
data
[
i
].
widgets
,
id
);
}
if
(
res
)
break
;
}
return
res
;
};
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