|
@@ -125,3 +125,70 @@ function create_element(dName, deviceTypes, floorNum, ownercode) {
|
|
// 物体顶界面
|
|
// 物体顶界面
|
|
var ui = null;
|
|
var ui = null;
|
|
var uis = [];
|
|
var uis = [];
|
|
|
|
+function create_ui(deviceType, floorNum, deviceList) {
|
|
|
|
+ var deviceTypes = deviceType;
|
|
|
|
+ destroy_ui();
|
|
|
|
+ create_html();
|
|
|
|
+ deviceIcon = [];
|
|
|
|
+ for (var j = 0; j < deviceList.length; j++) {
|
|
|
|
+ if (deviceList[j].dwtype == deviceType) {
|
|
|
|
+ deviceIcon.push(deviceList[j]);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (deviceType == 'YTVA') {
|
|
|
|
+ deviceType = '摄像头';
|
|
|
|
+ } else if (deviceType == 'YTWP') {
|
|
|
|
+ deviceType = '水表';
|
|
|
|
+ } else if (deviceType == 'YTCI') {
|
|
|
|
+ deviceType = '环境监测';
|
|
|
|
+ } else if (deviceType == 'YTEF') {
|
|
|
|
+ deviceType = '电气火灾';
|
|
|
|
+ } else if (deviceType == 'YTFC') {
|
|
|
|
+ deviceType = '消防控制柜';
|
|
|
|
+ } else if (deviceType == 'YTSM') {
|
|
|
|
+ deviceType = '烟感';
|
|
|
|
+ } else if (deviceType == 'YTLL') {
|
|
|
|
+ deviceType = '液位';
|
|
|
|
+ }
|
|
|
|
+ else if (deviceType == 'YTWI') {
|
|
|
|
+ deviceType = '水浸';
|
|
|
|
+ }
|
|
|
|
+ let num;
|
|
|
|
+ if(floorNum == -1){
|
|
|
|
+ num = 'B1'
|
|
|
|
+ }else{
|
|
|
|
+ num = 'F' + floorNum;
|
|
|
|
+ }
|
|
|
|
+ var carList = app.query("#" + num)[0].query(deviceType)
|
|
|
|
+ var carList1 = app.query("#" + num)[0]
|
|
|
|
+ console.log(carList)
|
|
|
|
+ console.log(deviceIcon.length)
|
|
|
|
+ // app.query("#" + id)[0].query('.Thing').forEach(function (obj){
|
|
|
|
+ // var car = app.query("#"+obj.id)[0];
|
|
|
|
+ // panelArr.push(uiAnchor(car));
|
|
|
|
+ // })
|
|
|
|
+ for (var i = 0; i < deviceIcon.length; i++) {
|
|
|
|
+ dName = deviceIcon[i].device_name;
|
|
|
|
+ var ownercode = deviceIcon[i].owner_code
|
|
|
|
+ console.log(dName,ownercode,carList[i])
|
|
|
|
+ ui = app.create({
|
|
|
|
+ type: 'UIAnchor',
|
|
|
|
+ parent: carList[i],
|
|
|
|
+ element: create_element(dName, deviceTypes, floorNum, ownercode),
|
|
|
|
+ localPosition: [0, 2, 0],
|
|
|
|
+ pivot: [0.5, 1] // [0,0]即以界面左上角定位,[1,1]即以界面右下角进行定位
|
|
|
|
+ });
|
|
|
|
+ uis.push(ui);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+// 删除界面
|
|
|
|
+function destroy_ui() {
|
|
|
|
+ if (uis) {
|
|
|
|
+ for (var i = 0; i < uis.length; i++) {
|
|
|
|
+ uis[i].destroy();
|
|
|
|
+ }
|
|
|
|
+ uis = [];
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+}
|