|
@@ -47,8 +47,53 @@
|
|
|
var id = window.location.search.split("id=")[1]
|
|
|
id = filterUrlData(id);
|
|
|
|
|
|
- var xx = 0;
|
|
|
- var yy = 0;
|
|
|
+ var xx = window.location.search.split("zjm=")[1];
|
|
|
+ xx = filterUrlData(xx) || 0;
|
|
|
+
|
|
|
+ var yy = window.location.search.split("jbdh=")[1] || 0;
|
|
|
+ yy = filterUrlData(yy);
|
|
|
+ // 初始化设备位置
|
|
|
+ $(function(){
|
|
|
+ $('#x').text(xx);
|
|
|
+ $('#y').text(yy);
|
|
|
+ alert($('.point').html());
|
|
|
+ alert(xx);
|
|
|
+ alert(yy);
|
|
|
+ $('.point').css('left',xx).css('top',yy).css('position', 'absolute');
|
|
|
+
|
|
|
+ $('#echart').click(function(e) {
|
|
|
+ xx = e.pageX || 0;
|
|
|
+ yy = e.pageY || 0;
|
|
|
+ console.log(xx+' '+yy);
|
|
|
+ $('#x').text(xx);
|
|
|
+ $('#y').text(yy);
|
|
|
+ $('.point').css('left',xx).css('top',yy);
|
|
|
+ })
|
|
|
+ $('.ahref').click(function(e) {
|
|
|
+ if(id == null){
|
|
|
+ alert('请设置设备')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if(xx==null || yy==null || xx == 0 || yy==0){
|
|
|
+ alert('请点击位置,该位置将作为设备的显示位置')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ var data = {id: id, zjm:xx, jbdh: yy}
|
|
|
+ $.ajax({
|
|
|
+ type: "PUT",
|
|
|
+ url: "/api/sb/infos/" + id,
|
|
|
+ headers: getHeader(),
|
|
|
+ data: JSON.stringify(data),
|
|
|
+ success: function(response) {
|
|
|
+ const data = response.data;
|
|
|
+ alert("保存成功。")
|
|
|
+ },
|
|
|
+ error: function(xhr, textStatus, errorThrown) {
|
|
|
+ error(xhr, textStatus, errorThrown);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ })
|
|
|
+ })
|
|
|
|
|
|
/**
|
|
|
* filterUrlData 过滤url数据
|
|
@@ -205,37 +250,7 @@ var option = {
|
|
|
// 使用刚指定的配置项和数据显示图表
|
|
|
myChart.setOption(option);
|
|
|
|
|
|
- $('#echart').click(function(e) {
|
|
|
- xx = e.pageX || 0;
|
|
|
- yy = e.pageY || 0;
|
|
|
- console.log(xx+' '+yy);
|
|
|
- $('#x').text(xx);
|
|
|
- $('#y').text(yy);
|
|
|
- $('.point').css('left',xx).css('top',yy);
|
|
|
- })
|
|
|
- $('.ahref').click(function(e) {
|
|
|
- if(id == null){
|
|
|
- alert('请设置设备')
|
|
|
- return
|
|
|
- }
|
|
|
- if(xx == 0|| yy==0){
|
|
|
- alert('请点击位置,该位置将作为设备的显示位置')
|
|
|
- return
|
|
|
- }
|
|
|
- var data = {id: id, zjm:xx, jbdh: yy}
|
|
|
- $.ajax({
|
|
|
- type: "PUT",
|
|
|
- url: "/api/sb/infos/" + id,
|
|
|
- headers: getHeader(),
|
|
|
- data: JSON.stringify(data),
|
|
|
- success: function(response) {
|
|
|
- const data = response.data;
|
|
|
- },
|
|
|
- error: function(xhr, textStatus, errorThrown) {
|
|
|
- error(xhr, textStatus, errorThrown);
|
|
|
- }
|
|
|
- });
|
|
|
- })
|
|
|
+
|
|
|
function getHeader(){
|
|
|
return {
|
|
|
Authorization: getToken(),
|
|
@@ -262,6 +277,8 @@ function getToken(){
|
|
|
position: absolute;
|
|
|
padding: 5px;
|
|
|
background: red;
|
|
|
+ left:0;
|
|
|
+ top:0;
|
|
|
z-index: 1000;
|
|
|
}
|
|
|
.ahref{
|