From 25c529bfc7b860796b4e2923d70f5c4ca7e35171 Mon Sep 17 00:00:00 2001
From: wuxw <928255095@qq.com>
Date: 星期六, 21 十二月 2019 17:37:48 +0800
Subject: [PATCH] 将组织写死 不让选择
---
WebService/src/main/resources/components/applicationKeyPackage/edit-applicationKey/editApplicationKey.js | 137 ++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 127 insertions(+), 10 deletions(-)
diff --git a/WebService/src/main/resources/components/applicationKeyPackage/edit-applicationKey/editApplicationKey.js b/WebService/src/main/resources/components/applicationKeyPackage/edit-applicationKey/editApplicationKey.js
index b7c63b5..18148da 100644
--- a/WebService/src/main/resources/components/applicationKeyPackage/edit-applicationKey/editApplicationKey.js
+++ b/WebService/src/main/resources/components/applicationKeyPackage/edit-applicationKey/editApplicationKey.js
@@ -16,16 +16,20 @@
floorNum: '',
floorName: '',
unitId: '',
- unitName: '',
+ unitNum: '',
roomId: '',
locationTypeCd: '',
locationObjId: '',
- roomName: ''
+ roomName: '',
+ videoPlaying:false,
+ photo:''
}
},
_initMethod: function () {
vc.component._initEditApplicationKeyDateInfo();
+ vc.component._initEditApplicationKeyMedia();
+
},
_initEvent: function () {
@@ -33,6 +37,37 @@
vc.component.refreshEditApplicationKeyInfo();
// $('#editApplicationKeyModel').modal('show');
vc.copyObject(_params, vc.component.editApplicationKeyInfo);
+ if (vc.component.editApplicationKeyInfo.locationTypeCd == '2000') {
+ vc.emit('editApplicationKey','floorSelect2','setFloor',{
+ floorId:vc.component.editApplicationKeyInfo.floorId,
+ floorNum:vc.component.editApplicationKeyInfo.floorNum
+ });
+ vc.emit('editApplicationKey','unitSelect2','setUnit',{
+ floorId:vc.component.editApplicationKeyInfo.floorId,
+ floorNum:vc.component.editApplicationKeyInfo.floorNum,
+ unitId:vc.component.editApplicationKeyInfo.unitId,
+ unitNum:vc.component.editApplicationKeyInfo.unitNum,
+ });
+ } else if (vc.component.editApplicationKeyInfo.locationTypeCd == '3000') {
+ vc.emit('editApplicationKey','floorSelect2','setFloor',{
+ floorId:vc.component.editApplicationKeyInfo.floorId,
+ floorNum:vc.component.editApplicationKeyInfo.floorNum
+ });
+ vc.emit('editApplicationKey','unitSelect2','setUnit',{
+ floorId:vc.component.editApplicationKeyInfo.floorId,
+ floorNum:vc.component.editApplicationKeyInfo.floorNum,
+ unitId:vc.component.editApplicationKeyInfo.unitId,
+ unitNum:vc.component.editApplicationKeyInfo.unitNum,
+ });
+ vc.emit('editApplicationKey','roomSelect2','setRoom',{
+ floorId:vc.component.editApplicationKeyInfo.floorId,
+ floorNum:vc.component.editApplicationKeyInfo.floorNum,
+ unitId:vc.component.editApplicationKeyInfo.unitId,
+ unitNum:vc.component.editApplicationKeyInfo.unitNum,
+ roomId:vc.component.editApplicationKeyInfo.roomId,
+ roomNum:vc.component.editApplicationKeyInfo.roomNum,
+ });
+ }
vc.component.editApplicationKeyInfo.communityId = vc.getCurrentCommunity().communityId;
});
@@ -126,12 +161,7 @@
limit: "required",
param: "",
errInfo: "鎬у埆涓嶈兘涓虹┖"
- },
- {
- limit: "num",
- param: "",
- errInfo: "鎬у埆鏍煎紡閿欒"
- },
+ }
],
'editApplicationKeyInfo.age': [
{
@@ -205,6 +235,17 @@
});
},
editApplicationKey: function () {
+ vc.component.editApplicationKeyInfo.communityId = vc.getCurrentCommunity().communityId;
+ if (vc.component.editApplicationKeyInfo.locationTypeCd != '2000' && vc.component.editApplicationKeyInfo.locationTypeCd != '3000') { //澶ч棬鏃剁洿鎺ュ啓 灏忓尯ID
+ vc.component.editApplicationKeyInfo.locationObjId = vc.component.editApplicationKeyInfo.communityId;
+ } else if (vc.component.editApplicationKeyInfo.locationTypeCd == '2000') {
+ vc.component.editApplicationKeyInfo.locationObjId = vc.component.editApplicationKeyInfo.unitId;
+ } else if (vc.component.editApplicationKeyInfo.locationTypeCd == '3000') {
+ vc.component.editApplicationKeyInfo.locationObjId = vc.component.editApplicationKeyInfo.roomId;
+ } else {
+ vc.toast("璁惧浣嶇疆鍊奸敊璇�");
+ return;
+ }
if (!vc.component.editApplicationKeyValidate()) {
vc.message(vc.validate.errInfo);
return;
@@ -244,9 +285,85 @@
idCard: '',
startTime: '',
endTime: '',
-
+ floorId: '',
+ floorNum: '',
+ floorName: '',
+ unitId: '',
+ unitName: '',
+ roomId: '',
+ locationTypeCd: '',
+ locationObjId: '',
+ roomName: '',
+ videoPlaying:false,
+ photo:''
}
- }
+ },
+ _closeEditApplicationKeyView: function () {
+ vc.emit('applicationKeyManage', 'listApplicationKey', {});
+ },
+ _editUserMedia:function() {
+ return navigator.getUserMedia = navigator.getUserMedia ||
+ navigator.webkitGetUserMedia ||
+ navigator.mozGetUserMedia ||
+ navigator.msGetUserMedia || null;
+ },
+ _initEditApplicationKeyMedia:function () {
+ if(vc.component._editUserMedia()){
+ vc.component.editApplicationKeyInfo.videoPlaying = false;
+ var constraints = {
+ video: true,
+ audio: false
+ };
+ var video = document.getElementById('photo');
+ var media = navigator.getUserMedia(constraints, function (stream) {
+ var url = window.URL || window.webkitURL;
+ //video.src = url ? url.createObjectURL(stream) : stream;
+ try {
+ video.src = url ? url.createObjectURL(stream) : stream;
+ } catch (error) {
+ video.srcObject = stream;
+ }
+ video.play();
+ vc.component.editApplicationKeyInfo.videoPlaying = true;
+ }, function (error) {
+ console.log("ERROR");
+ console.log(error);
+ });
+ }else{
+ console.log("鍒濆鍖栬棰戝け璐�");
+ }
+ },
+ _takeEditPhoto:function () {
+ if (vc.component.editApplicationKeyInfo.videoPlaying) {
+ var canvas = document.getElementById('canvas');
+ var video = document.getElementById('photo');
+ canvas.width = video.videoWidth;
+ canvas.height = video.videoHeight;
+ canvas.getContext('2d').drawImage(video, 0, 0);
+ var data = canvas.toDataURL('image/webp');
+ vc.component.editApplicationKeyInfo.photo = data;
+ //document.getElementById('photo').setAttribute('src', data);
+ }
+ },
+ _uploadEditPhoto:function(event){
+ $("#uploadEditApplicationKeyPhoto").trigger("click")
+ },
+ _chooseEditPhoto:function(event){
+ var photoFiles = event.target.files;
+ if (photoFiles && photoFiles.length > 0) {
+ // 鑾峰彇鐩墠涓婁紶鐨勬枃浠�
+ var file = photoFiles[0];// 鏂囦欢澶у皬鏍¢獙鐨勫姩浣�
+ if(file.size > 1024 * 1024 * 1) {
+ vc.toast("鍥剧墖澶у皬涓嶈兘瓒呰繃 2MB!")
+ return false;
+ }
+ var reader = new FileReader(); //鏂板缓FileReader瀵硅薄
+ reader.readAsDataURL(file); //璇诲彇涓篵ase64
+ reader.onloadend = function(e) {
+ vc.component.editApplicationKeyInfo.photo = reader.result;
+ }
+ }
+ },
}
});
--
Gitblit v1.8.0