From 33c2ad524e7cf71b53607be2a935718d44689530 Mon Sep 17 00:00:00 2001
From: wuxw <928255095@qq.com>
Date: 星期六, 30 十一月 2019 14:17:13 +0800
Subject: [PATCH] 组件中加入命名空间

---
 WebService/src/main/resources/components/machinePackage/edit-machine/editMachine.js |   93 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 92 insertions(+), 1 deletions(-)

diff --git a/WebService/src/main/resources/components/machinePackage/edit-machine/editMachine.js b/WebService/src/main/resources/components/machinePackage/edit-machine/editMachine.js
index 74790e8..2e2d77f 100644
--- a/WebService/src/main/resources/components/machinePackage/edit-machine/editMachine.js
+++ b/WebService/src/main/resources/components/machinePackage/edit-machine/editMachine.js
@@ -11,6 +11,15 @@
                 authCode: '',
                 machineIp: '',
                 machineMac: '',
+                floorId: '',
+                floorNum: '',
+                floorName: '',
+                unitId: '',
+                unitNum: '',
+                roomId: '',
+                locationTypeCd: '',
+                locationObjId: '',
+                roomNum: ''
 
             }
         },
@@ -22,7 +31,53 @@
                 vc.component.refreshEditMachineInfo();
                 $('#editMachineModel').modal('show');
                 vc.copyObject(_params, vc.component.editMachineInfo);
+                //鏍规嵁浣嶇疆绫诲瀷 浼犺緭鏁版嵁
+                if (vc.component.editMachineInfo.locationTypeCd == '2000') {
+                    vc.emit('floorSelect2','setFloor',{
+                        floorId:vc.component.editMachineInfo.floorId,
+                        floorNum:vc.component.editMachineInfo.floorNum
+                    });
+                    vc.emit('unitSelect2','setUnit',{
+                        floorId:vc.component.editMachineInfo.floorId,
+                        floorNum:vc.component.editMachineInfo.floorNum,
+                        unitId:vc.component.editMachineInfo.unitId,
+                        unitNum:vc.component.editMachineInfo.unitNum,
+                    });
+                } else if (vc.component.editMachineInfo.locationTypeCd == '3000') {
+                    vc.emit('floorSelect2','setFloor',{
+                        floorId:vc.component.editMachineInfo.floorId,
+                        floorNum:vc.component.editMachineInfo.floorNum
+                    });
+                    vc.emit('unitSelect2','setUnit',{
+                        floorId:vc.component.editMachineInfo.floorId,
+                        floorNum:vc.component.editMachineInfo.floorNum,
+                        unitId:vc.component.editMachineInfo.unitId,
+                        floorNum:vc.component.editMachineInfo.unitNum,
+                    });
+                    vc.emit('roomSelect2','setRoom',{
+                        floorId:vc.component.editMachineInfo.floorId,
+                        floorNum:vc.component.editMachineInfo.floorNum,
+                        unitId:vc.component.editMachineInfo.unitId,
+                        unitNum:vc.component.editMachineInfo.unitNum,
+                        roomId:vc.component.editMachineInfo.roomId,
+                        roomNum:vc.component.editMachineInfo.roomNum,
+                    });
+                }
                 vc.component.editMachineInfo.communityId = vc.getCurrentCommunity().communityId;
+            });
+
+            vc.on("editMachine", "notify", function (_param) {
+                if (_param.hasOwnProperty("floorId")) {
+                    vc.component.editMachineInfo.floorId = _param.floorId;
+                }
+
+                if (_param.hasOwnProperty("unitId")) {
+                    vc.component.editMachineInfo.unitId = _param.unitId;
+                }
+
+                if(_param.hasOwnProperty("roomId")){
+                    vc.component.editMachineInfo.roomId = _param.roomId;
+                }
             });
         },
         methods: {
@@ -103,12 +158,39 @@
                                 limit: "required",
                                 param: "",
                                 errInfo: "璁惧ID涓嶈兘涓虹┖"
-                            }]
+                            }],
+                    'addMachineInfo.locationTypeCd':
+                        [
+                            {
+                                limit: "required",
+                                param: "",
+                                errInfo: "璇烽�夋嫨璁惧浣嶇疆"
+                            }
+                        ],
+                    'addMachineInfo.locationObjId':
+                        [
+                            {
+                                limit: "required",
+                                param: "",
+                                errInfo: "璇烽�夋嫨浣嶇疆"
+                            }
+                        ]
 
                 })
                     ;
             },
             editMachine: function () {
+                vc.component.editMachineInfo.communityId = vc.getCurrentCommunity().communityId;
+                if (vc.component.editMachineInfo.locationTypeCd != '2000' && vc.component.editMachineInfo.locationTypeCd != '3000') { //澶ч棬鏃剁洿鎺ュ啓 灏忓尯ID
+                    vc.component.editMachineInfo.locationObjId = vc.component.editMachineInfo.communityId;
+                } else if (vc.component.editMachineInfo.locationTypeCd == '2000') {
+                    vc.component.editMachineInfo.locationObjId = vc.component.editMachineInfo.unitId;
+                } else if (vc.component.editMachineInfo.locationTypeCd == '3000') {
+                    vc.component.editMachineInfo.locationObjId = vc.component.editMachineInfo.roomId;
+                } else {
+                    vc.toast("璁惧浣嶇疆鍊奸敊璇�");
+                    return;
+                }
                 if (!vc.component.editMachineValidate()) {
                     vc.message(vc.validate.errInfo);
                     return;
@@ -147,6 +229,15 @@
                     authCode: '',
                     machineIp: '',
                     machineMac: '',
+                    floorId: '',
+                    floorNum: '',
+                    floorName: '',
+                    unitId: '',
+                    unitNum: '',
+                    roomId: '',
+                    locationTypeCd: '',
+                    locationObjId: '',
+                    roomNum: ''
 
                 }
             }

--
Gitblit v1.8.0