Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation
This project
Loading...
Sign in
李君
/
carrefour
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 99527382
authored
2 years ago
by
tianlonglong
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
tll
1 parent
6b4a821b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
150 additions
and
104 deletions
src/views/Management/DeskManage/index.vue
src/views/queueManagement/channelManagement/Painter.vue
src/views/queueManagement/channelManagement/index.vue
src/views/Management/DeskManage/index.vue
View file @
9952738
...
...
@@ -273,6 +273,7 @@ export default {
this
.
tableData
=
[];
this
.
getDeskList
();
if
(
this
.
ptype
==
1
)
{
console
.
log
(
444
);
this
.
loadGateData
();
}
else
{
this
.
drawFloorMap
();
...
...
@@ -402,6 +403,7 @@ export default {
.
getBoundingClientRect
().
width
;
item
.
cheight
=
(
item
.
cwidth
*
item
.
height
)
/
item
.
width
;
that
.
canvasList
=
canvasList
;
console
.
log
(
that
.
canvasList
);
});
};
}
...
...
This diff is collapsed.
Click to expand it.
src/views/queueManagement/channelManagement/Painter.vue
View file @
9952738
...
...
@@ -2,98 +2,124 @@
<div
class=
"painter"
ref=
"painter"
></div>
</
template
>
<
script
>
import
_
from
'underscore'
;
import
zrender
from
'zrender'
;
import
_
from
"underscore"
;
import
zrender
from
"zrender"
;
export
default
{
props
:
{
isEdit
:
Boolean
,
isEdit
:
Boolean
,
cdata
:
{
type
:
Object
,
default
:
{}
default
:
{},
},
list
:
Array
,
desk
:
Object
list
:
Array
,
desk
:
Object
,
},
watch
:
{
cdata
:
{
immediate
:
true
,
handler
(
nval
)
{
if
(
JSON
.
stringify
(
nval
)
==
'{}'
)
{
return
false
if
(
JSON
.
stringify
(
nval
)
==
"{}"
)
{
return
false
;
}
setTimeout
(()
=>
{
if
(
!
_
.
isEmpty
(
nval
))
this
.
initZrender
();
},
500
);
setTimeout
(()
=>
{
if
(
!
_
.
isEmpty
(
nval
))
this
.
initZrender
();
console
.
log
(
this
.
cdata
);
},
500
);
},
deep
:
true
,
},
deep
:
true
}
},
data
()
{
return
{
pointList
:
[],
//当前绘制的图形点位列表
pointList
:
[],
//当前绘制的图形点位列表
groupList
:
[],
//图形数组
zr
:
{},
//绘图实例对象
baseColor
:
'#ff000075'
,
strokeColor
:
'#f00'
,
baseColor
:
"#ff000075"
,
strokeColor
:
"#f00"
,
/*********************************/
fillColor
:
'#f00'
,
fillColor
:
"#f00"
,
scaleVal
:
10
,
//缩放
rotateVal
:
0
,
//旋转角度
tempData
:
{},
/*********************************/
groupObj
:
{}
}
groupObj
:
{},
};
},
methods
:
{
initZrender
()
{
this
.
$nextTick
(()
=>
{
let
client
=
document
.
querySelector
(
'.painter'
).
getBoundingClientRect
();
let
client
=
document
.
querySelector
(
".painter"
).
getBoundingClientRect
();
this
.
zr
=
zrender
.
init
(
this
.
$refs
.
painter
,
{
renderer
:
'canvas'
,
renderer
:
"canvas"
,
devicePixelRatio
:
2
,
width
:
client
.
width
,
height
:
client
.
height
height
:
client
.
height
,
});
this
.
bindingEvt
();
this
.
initialGroup
();
})
});
},
initialGroup
(){
let
list
=
this
.
list
_
.
each
(
list
,
item
=>
{
initialGroup
()
{
// let list = _.filter(this.list, (item) => {
// return this.isFloor || item.deviceSerialNum == this.cdata.serialnum;
// });
// _.each(list, (item) => {
// let gdata = zrender.util.clone(item);
// if (gdata.coordinates) {
// gdata.points = _.map(JSON.parse(gdata.coordinates), (point) => {
// let x = (point.x * this.zr.getWidth()) / 1920;
// let y = (point.y * this.zr.getHeight()) / 1080;
// return [x, y];
// });
// gdata.desk = item;
// console.log(gdata);
// this.createGroup(gdata, true);
// }
// });
let
list
=
this
.
list
.
filter
(
(
item
)
=>
item
.
deviceSerialNum
==
this
.
cdata
.
serialnum
);
console
.
log
(
list
);
_
.
each
(
list
,
(
item
)
=>
{
let
gdata
=
zrender
.
util
.
clone
(
item
);
if
(
gdata
.
coordinate
)
{
gdata
.
points
=
_
.
map
(
JSON
.
parse
(
gdata
.
coordinate
),
point
=>
{
let
x
=
point
.
x
*
this
.
zr
.
getWidth
()
/
1920
;
let
y
=
point
.
y
*
this
.
zr
.
getHeight
()
/
1080
;
return
[
x
,
y
];
if
(
gdata
.
coordinate
)
{
gdata
.
points
=
_
.
map
(
JSON
.
parse
(
gdata
.
coordinate
),
(
point
)
=>
{
let
x
=
(
point
.
x
*
this
.
zr
.
getWidth
())
/
1920
;
let
y
=
(
point
.
y
*
this
.
zr
.
getHeight
())
/
1080
;
return
[
x
,
y
];
});
gdata
.
desk
=
item
;
this
.
createGroup
(
gdata
,
true
);
console
.
log
(
gdata
);
this
.
createGroup
(
gdata
,
true
);
}
})
});
},
bindingEvt
()
{
let
that
=
this
;
let
group
;
this
.
zr
.
on
(
'click'
,
evt
=>
{
if
(
!
this
.
desk
||
_
.
isEmpty
(
this
.
desk
))
{
this
.
zr
.
on
(
"click"
,
(
evt
)
=>
{
if
(
!
this
.
desk
||
_
.
isEmpty
(
this
.
desk
))
{
return
this
.
$message
({
showClose
:
true
,
type
:
"warning"
,
message
:
'请先点击选择通道'
})
message
:
"请先点击选择通道"
,
});
}
this
.
$emit
(
'start'
,
this
.
desk
);
this
.
$emit
(
"start"
,
this
.
desk
);
let
point
=
[
evt
.
event
.
zrX
,
evt
.
event
.
zrY
];
this
.
pointList
.
push
(
point
);
if
(
this
.
pointList
.
length
==
1
)
{
//第一次点击,创建Group
if
(
this
.
pointList
.
length
==
1
)
{
//第一次点击,创建Group
let
points
=
zrender
.
util
.
clone
(
this
.
pointList
);
group
=
this
.
createGroup
({
points
,
fill
:
that
.
baseColor
,
desk
:
this
.
desk
});
group
=
this
.
createGroup
({
points
,
fill
:
that
.
baseColor
,
desk
:
this
.
desk
,
});
}
this
.
drawPolyline
(
group
,
this
.
pointList
);
})
this
.
zr
.
on
(
'mousemove'
,
evt
=>
{
});
this
.
zr
.
on
(
"mousemove"
,
(
evt
)
=>
{
if
(
this
.
pointList
.
length
==
0
)
return
false
;
let
point
=
[
evt
.
event
.
zrX
,
evt
.
event
.
zrY
];
this
.
drawPolyline
(
group
,
this
.
pointList
.
concat
([
point
]));
...
...
@@ -101,11 +127,11 @@ export default {
},
drawPolyline
(
group
,
points
)
{
group
.
polyline
.
setShape
({
points
:
points
points
:
points
,
});
group
.
points
=
zrender
.
util
.
clone
(
points
);
},
createGroup
(
gdata
,
isFull
=
false
)
{
createGroup
(
gdata
,
isFull
=
false
)
{
let
that
=
this
;
let
points
=
gdata
.
points
;
...
...
@@ -114,9 +140,9 @@ export default {
/*******************************/
let
group
=
new
zrender
.
Group
({
complete
:
false
,
position
:
position
||
[
0
,
0
]
position
:
position
||
[
0
,
0
],
});
if
(
isFull
)
{
if
(
isFull
)
{
group
.
points
=
points
;
}
group
.
desk
=
gdata
.
desk
;
...
...
@@ -126,8 +152,8 @@ export default {
let
polyline
=
this
.
createPolyline
({
stroke
:
that
.
strokeColor
,
fill
:
fill
,
points
:
points
})
points
:
points
,
});
group
.
id
=
gdata
.
id
||
Date
.
now
().
toString
(
36
);
group
.
add
(
polyline
);
group
.
polyline
=
polyline
;
...
...
@@ -135,17 +161,17 @@ export default {
group
.
data
=
gdata
;
if
(
this
.
isEdit
&&
points
.
length
==
1
)
{
let
circle
=
that
.
createCircle
(
group
,
points
[
0
]);
group
.
add
(
circle
)
}
else
if
(
isFull
)
{
group
.
add
(
circle
);
}
else
if
(
isFull
)
{
this
.
drawText
(
group
,
false
);
}
group
.
on
(
'click'
,
function
(
evt
)
{
group
.
on
(
"click"
,
function
(
evt
)
{
if
(
!
that
.
isEdit
)
{
evt
.
cancelBubble
=
true
;
return
false
;
}
if
(
group
.
complete
)
{
that
.
$emit
(
'gclick'
,
group
);
if
(
group
.
complete
)
{
that
.
$emit
(
"gclick"
,
group
);
evt
.
cancelBubble
=
true
;
return
false
;
}
...
...
@@ -158,22 +184,22 @@ export default {
/*action.onmouseleave = ()=>{
action.style.display = 'none'
}*/
group
.
on
(
'contextmenu'
,
function
(
evt
)
{
group
.
on
(
"contextmenu"
,
function
(
evt
)
{
if
(
!
that
.
isEdit
)
{
evt
.
stop
();
return
false
return
false
;
}
if
(
that
.
pointList
.
length
>
0
)
{
evt
.
stop
();
return
false
;
}
action
.
style
.
display
=
'block'
;
action
.
style
.
left
=
(
evt
.
offsetX
-
5
)
+
'px'
action
.
style
.
top
=
(
evt
.
offsetY
-
5
)
+
'px'
action
.
style
.
display
=
"block"
;
action
.
style
.
left
=
evt
.
offsetX
-
5
+
"px"
;
action
.
style
.
top
=
evt
.
offsetY
-
5
+
"px"
;
evt
.
stop
();
that
.
setCurrentGroup
(
this
);
return
false
;
})
});
this
.
zr
.
add
(
group
);
this
.
groupList
.
push
(
group
);
return
group
;
...
...
@@ -182,25 +208,25 @@ export default {
let
that
=
this
;
let
circle
=
new
zrender
.
Circle
({
style
:
{
fill
:
'transparent'
,
stroke
:
'#f00'
,
lineWidth
:
2
fill
:
"transparent"
,
stroke
:
"#f00"
,
lineWidth
:
2
,
},
shape
:
{
cx
:
point
[
0
],
cy
:
point
[
1
],
r
:
10
}
r
:
10
,
},
});
circle
.
on
(
'click'
,
evt
=>
{
circle
.
on
(
"click"
,
(
evt
)
=>
{
evt
.
cancelBubble
=
true
;
that
.
pointList
.
push
(
that
.
pointList
[
0
]);
group
.
remove
(
circle
);
if
(
that
.
pointList
.
length
>
3
)
{
this
.
drawPolyline
(
group
,
that
.
pointList
);
this
.
drawText
(
group
,
true
);
this
.
drawText
(
group
,
true
);
}
else
{
this
.
zr
.
remove
(
group
)
this
.
zr
.
remove
(
group
);
}
that
.
pointList
=
[];
});
...
...
@@ -217,24 +243,28 @@ export default {
style
:
{
stroke
:
params
.
stroke
,
fill
:
params
.
fill
||
that
.
baseColor
,
lineWidth
:
3
lineWidth
:
3
,
},
shape
:
{
points
:
params
.
points
,
smooth
:
0.01
}
smooth
:
0.01
,
},
});
},
drawText
(
group
,
finish
)
{
let
that
=
this
,
xPoints
=
[],
yPoints
=
[];
_
.
each
(
group
.
points
,
item
=>
{
drawText
(
group
,
finish
)
{
let
that
=
this
,
xPoints
=
[],
yPoints
=
[];
_
.
each
(
group
.
points
,
(
item
)
=>
{
xPoints
.
push
(
item
[
0
]);
yPoints
.
push
(
item
[
1
]);
})
let
[
x
,
y
]
=
[
_
.
max
(
xPoints
)
-
_
.
min
(
xPoints
),
_
.
max
(
yPoints
)
-
_
.
min
(
yPoints
)];
});
let
[
x
,
y
]
=
[
_
.
max
(
xPoints
)
-
_
.
min
(
xPoints
),
_
.
max
(
yPoints
)
-
_
.
min
(
yPoints
),
];
let
client
=
group
.
getBoundingRect
();
let
content
=
`{name|
${
group
.
desk
.
name
||
''
}
}`
;
let
content
=
`{name|
${
group
.
desk
.
name
||
""
}
}`
;
let
text
=
new
zrender
.
Text
({
position
:
[
client
.
x
,
client
.
y
],
...
...
@@ -243,39 +273,39 @@ export default {
y
:
client
.
height
/
2
,
width
:
client
.
width
,
height
:
client
.
height
,
textAlign
:
'center'
,
textVerticalAlign
:
'middle'
,
textAlign
:
"center"
,
textVerticalAlign
:
"middle"
,
//textShadowBlur: 3,
textShadowColor
:
'#893e95'
,
textShadowColor
:
"#893e95"
,
//textShadowOffsetX: 3,
//textShadowOffsetY: 3,
text
:
content
,
fill
:
'#fff'
,
fill
:
"#fff"
,
fontSize
:
14
,
fontWeight
:
600
,
fontWeight
:
600
,
rich
:
{
name
:
{
textLineHeight
:
16
,
textFill
:
'#fff'
}
}
}
textFill
:
"#fff"
,
},
},
},
});
//text.setClipPath(curGroup.polyline)
//this.setDragaAble(text)
group
.
add
(
text
);
group
.
text
=
text
;
group
.
complete
=
true
;
//图像已经绘制完毕
group
.
complete
=
true
;
//图像已经绘制完毕
group
.
polyline
.
attr
({
origin
:
[
client
.
x
+
client
.
width
/
2
,
client
.
y
+
client
.
height
/
2
]
origin
:
[
client
.
x
+
client
.
width
/
2
,
client
.
y
+
client
.
height
/
2
],
});
if
(
that
.
isEdit
)
{
that
.
setDragaAble
(
group
);
}
this
.
$emit
(
'finish'
,
group
);
this
.
$emit
(
"finish"
,
group
);
},
setCurrentGroup
(
group
)
{
this
.
groupObj
=
_
.
find
(
this
.
groupList
,
item
=>
{
this
.
groupObj
=
_
.
find
(
this
.
groupList
,
(
item
)
=>
{
return
item
.
id
==
group
.
id
;
});
this
.
fillColor
=
this
.
groupObj
.
polyline
.
style
.
fill
;
...
...
@@ -284,31 +314,33 @@ export default {
let
isDown
=
false
,
downPoint
=
[],
initPoint
=
[];
el
.
on
(
'mousedown'
,
evt
=>
{
el
.
on
(
"mousedown"
,
(
evt
)
=>
{
isDown
=
true
;
evt
.
cancelBubble
=
true
;
downPoint
=
[
evt
.
event
.
zrX
,
evt
.
event
.
zrY
];
initPoint
=
zrender
.
util
.
clone
(
el
.
position
);
evt
.
cancelBubble
=
true
;
});
el
.
on
(
'mousemove'
,
evt
=>
{
el
.
on
(
"mousemove"
,
(
evt
)
=>
{
if
(
isDown
)
{
evt
.
cancelBubble
=
true
;
let
pos
=
[
evt
.
event
.
zrX
-
downPoint
[
0
],
evt
.
event
.
zrY
-
downPoint
[
1
]];
el
.
attr
(
'position'
,
[
initPoint
[
0
]
+
pos
[
0
],
initPoint
[
1
]
+
pos
[
1
]]);
let
pos
=
[
evt
.
event
.
zrX
-
downPoint
[
0
],
evt
.
event
.
zrY
-
downPoint
[
1
],
];
el
.
attr
(
"position"
,
[
initPoint
[
0
]
+
pos
[
0
],
initPoint
[
1
]
+
pos
[
1
]]);
}
});
el
.
on
(
'mouseup'
,
evt
=>
{
el
.
on
(
"mouseup"
,
(
evt
)
=>
{
evt
.
cancelBubble
=
true
;
isDown
=
false
;
});
this
.
zr
.
on
(
'mouseup'
,
function
()
{
this
.
zr
.
on
(
"mouseup"
,
function
()
{
isDown
=
false
;
})
});
},
}
}
},
};
</
script
>
<
style
scoped
lang=
"less"
>
.painter
{
...
...
This diff is collapsed.
Click to expand it.
src/views/queueManagement/channelManagement/index.vue
View file @
9952738
...
...
@@ -288,10 +288,17 @@ export default {
areaId
:
this
.
searchForm
.
areaId
,
})
.
then
((
res
)
=>
{
console
.
log
(
res
);
let
data
=
res
.
data
.
data
;
data
.
forEach
((
item
)
=>
{
item
.
name
=
this
.
areaObj
.
name
;
let
sd
=
this
.
tableData
.
filter
(
(
item1
)
=>
item1
.
deviceSerialNum
==
item
.
serialnum
);
if
(
sd
)
{
item
.
name
=
sd
.
map
((
item2
)
=>
item2
.
name
).
join
(
","
);
}
else
{
item
.
name
=
""
;
}
item
.
id
=
item
.
serialnum
;
item
.
picUrl
=
window
.
_vionConfig
.
picUrl
+
...
...
@@ -303,6 +310,7 @@ export default {
(
item
.
coordinate
=
JSON
.
parse
(
item
.
coordinate
));
});
this
.
gateList
=
data
;
console
.
log
(
this
.
gateList
);
this
.
drawJoinMap
();
});
// this.drawFloorMap();
...
...
@@ -461,7 +469,10 @@ export default {
},
delCoord
(
data
)
{
data
.
coordinate
=
""
;
this
.
$api
.
queueManagementApi
.
updateChannel
(
data
).
then
((
res
)
=>
{
console
.
log
(
data
,
"gggggggg"
);
this
.
$api
.
queueManagementApi
.
updateChannel
({
...
data
,
deviceSerialNum
:
""
})
.
then
((
res
)
=>
{
let
result
=
res
.
data
;
if
(
result
.
code
==
200
)
{
this
.
$message
({
...
...
@@ -487,7 +498,8 @@ export default {
};
});
desk
.
coordinate
=
JSON
.
stringify
(
coordinate
);
let
params
=
Object
.
assign
({},
desk
);
let
params
=
Object
.
assign
({},
desk
,
{
deviceSerialNum
:
cdata
.
id
});
console
.
log
(
group
,
desk
,
"gggggg"
);
return
this
.
$api
.
queueManagementApi
.
updateChannel
(
params
);
},
},
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
Attach a file
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 post a comment