From 9f3c5567926895300ec6d2d5dbccf7df41b7c151 Mon Sep 17 00:00:00 2001 From: java110 <928255095@qq.com> Date: Thu, 31 Mar 2022 09:22:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E4=B8=9A=E4=B8=BB=20?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E4=B8=BAcmd=20=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/property/addOwner/addOwner.js | 4 +- .../property/deleteOwner/deleteOwner.js | 24 ++-- .../property/editOwner/editOwner.js | 112 ++++++++---------- .../pages/property/listOwner/listOwner.html | 12 -- 4 files changed, 62 insertions(+), 90 deletions(-) diff --git a/public/components/property/addOwner/addOwner.js b/public/components/property/addOwner/addOwner.js index d6d22e329..62f6c7aba 100755 --- a/public/components/property/addOwner/addOwner.js +++ b/public/components/property/addOwner/addOwner.js @@ -102,9 +102,7 @@ vc.component.addOwnerInfo.ownerTypeCd = '1001'; } vc.component.addOwnerInfo.communityId = vc.getCurrentCommunity().communityId; - vc.http.post( - 'addOwner', - 'saveOwner', + vc.http.apiPost('/owner.saveOwner', JSON.stringify(vc.component.addOwnerInfo), { emulateJSON: true }, diff --git a/public/components/property/deleteOwner/deleteOwner.js b/public/components/property/deleteOwner/deleteOwner.js index 4ebce7861..14c4deced 100755 --- a/public/components/property/deleteOwner/deleteOwner.js +++ b/public/components/property/deleteOwner/deleteOwner.js @@ -1,4 +1,4 @@ -(function (vc) { +(function(vc) { vc.extends({ propTypes: { notifyLoadDataComponentName: vc.propTypes.string @@ -6,26 +6,24 @@ data: { deleteOwnerInfo: {} }, - _initEvent: function () { - vc.on('deleteOwner', 'openOwnerModel', function (_ownerInfo) { + _initEvent: function() { + vc.on('deleteOwner', 'openOwnerModel', function(_ownerInfo) { vc.component.deleteOwnerInfo = _ownerInfo; $('#deleteOwnerModel').modal('show'); }); }, methods: { - closeDeleteOwnerModel: function () { + closeDeleteOwnerModel: function() { $('#deleteOwnerModel').modal('hide'); }, - deleteOwner: function () { + deleteOwner: function() { vc.component.deleteOwnerInfo.communityId = vc.getCurrentCommunity().communityId; - vc.http.post( - 'deleteOwner', - 'delete', - JSON.stringify(vc.component.deleteOwnerInfo), - { + vc.http.apiPost( + '/owner.deleteOwner', + JSON.stringify(vc.component.deleteOwnerInfo), { emulateJSON: true }, - function (json, res) { + function(json, res) { //vm.menus = vm.refreshMenuActive(JSON.parse(json),0); if (res.status == 200) { //关闭model @@ -35,11 +33,11 @@ } vc.component.deleteOwnernfo.errorInfo = json; }, - function (errInfo, error) { + function(errInfo, error) { vc.toast(errInfo); // vc.component.deleteOwnernfo.errorInfo = errInfo; }); } } }); -})(window.vc); +})(window.vc); \ No newline at end of file diff --git a/public/components/property/editOwner/editOwner.js b/public/components/property/editOwner/editOwner.js index 91a2c7f78..335a192e7 100755 --- a/public/components/property/editOwner/editOwner.js +++ b/public/components/property/editOwner/editOwner.js @@ -1,4 +1,4 @@ -(function (vc) { +(function(vc) { //var _fileUrl = 'https://hc.demo.winqi.cn/callComponent/download/getFile/fileByObjId'; var _fileUrl = '/callComponent/download/getFile/fileByObjId'; vc.extends({ @@ -24,11 +24,11 @@ attrs: [] } }, - _initMethod: function () { + _initMethod: function() { $that._loadEditOwnerAttrSpec(); }, - _initEvent: function () { - vc.on('editOwner', 'openEditOwnerModal', function (_owner) { + _initEvent: function() { + vc.on('editOwner', 'openEditOwnerModal', function(_owner) { vc.copyObject(_owner, vc.component.editOwnerInfo); //根据memberId 查询 照片信息 vc.component.editOwnerInfo.ownerPhoto = _fileUrl + "?objId=" + @@ -49,12 +49,11 @@ }); }, methods: { - editOwnerValidate: function () { + editOwnerValidate: function() { return vc.validate.validate({ editOwnerInfo: vc.component.editOwnerInfo }, { - 'editOwnerInfo.name': [ - { + 'editOwnerInfo.name': [{ limit: "required", param: "", errInfo: "名称不能为空" @@ -65,8 +64,7 @@ errInfo: "名称长度必须在2位至64位" }, ], - 'editOwnerInfo.age': [ - { + 'editOwnerInfo.age': [{ limit: "required", param: "", errInfo: "年龄不能为空" @@ -77,37 +75,29 @@ errInfo: "年龄不是有效的数字" }, ], - 'editOwnerInfo.sex': [ - { - limit: "required", - param: "", - errInfo: "性别不能为空" - } - ], - 'editOwnerInfo.idCard': [ - { - limit: "maxLength", - param: "18", - errInfo: "身份证长度不能超过200位" - } - ], - 'editOwnerInfo.link': [ - { - limit: "required", - param: "", - errInfo: "手机号不能为空" - } - ], - 'editOwnerInfo.remark': [ - { - limit: "maxLength", - param: "200", - errInfo: "备注长度不能超过200位" - } - ] + 'editOwnerInfo.sex': [{ + limit: "required", + param: "", + errInfo: "性别不能为空" + }], + 'editOwnerInfo.idCard': [{ + limit: "maxLength", + param: "18", + errInfo: "身份证长度不能超过200位" + }], + 'editOwnerInfo.link': [{ + limit: "required", + param: "", + errInfo: "手机号不能为空" + }], + 'editOwnerInfo.remark': [{ + limit: "maxLength", + param: "200", + errInfo: "备注长度不能超过200位" + }] }); }, - editOwnerMethod: function () { + editOwnerMethod: function() { if (!vc.component.editOwnerValidate()) { vc.toast(vc.validate.errInfo); return; @@ -117,14 +107,12 @@ if (vc.component.editOwnerInfo.ownerPhoto.indexOf(_fileUrl) != -1) { vc.component.editOwnerInfo.ownerPhoto = ""; } - vc.http.post( - 'editOwner', - 'changeOwner', - JSON.stringify(vc.component.editOwnerInfo), - { + vc.http.apiPost( + '/owner.editOwner', + JSON.stringify(vc.component.editOwnerInfo), { emulateJSON: true }, - function (json, res) { + function(json, res) { //vm.menus = vm.refreshMenuActive(JSON.parse(json),0); let _json = JSON.parse(json); if (_json.code == 0) { @@ -136,12 +124,12 @@ } vc.toast(_json.msg); }, - function (errInfo, error) { + function(errInfo, error) { console.log('请求失败处理'); vc.toast(errInfo); }); }, - clearEditOwnerInfo: function () { + clearEditOwnerInfo: function() { let _componentTitle = $that.editOwnerInfo.componentTitle; let _attrs = $that.editOwnerInfo.attrs; vc.component.editOwnerInfo = { @@ -161,13 +149,13 @@ attrs: _attrs }; }, - _editUserMedia: function () { + _editUserMedia: function() { return navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia || null; }, - _initAddOwnerMediaForEdit: function () { + _initAddOwnerMediaForEdit: function() { if (vc.component._editUserMedia()) { vc.component.editOwnerInfo.videoPlaying = false; var constraints = { @@ -178,7 +166,7 @@ audio: false }; var video = document.getElementById('ownerPhotoForEdit'); - var media = navigator.getUserMedia(constraints, function (stream) { + var media = navigator.getUserMedia(constraints, function(stream) { var url = window.URL || window.webkitURL; //video.src = url ? url.createObjectURL(stream) : stream; $that.editOwnerInfo.mediaStreamTrack = typeof stream.stop === 'function' ? stream : stream.getTracks()[0]; @@ -189,7 +177,7 @@ } video.play(); vc.component.editOwnerInfo.videoPlaying = true; - }, function (error) { + }, function(error) { vc.component.editOwnerInfo.videoPlaying = false; }); } else { @@ -197,7 +185,7 @@ console.log("初始化视频失败"); } }, - _takePhotoForEdit: function () { + _takePhotoForEdit: function() { if (vc.component.editOwnerInfo.videoPlaying) { var canvas = document.getElementById('canvasForEdit'); var video = document.getElementById('ownerPhotoForEdit'); @@ -226,39 +214,39 @@ vc.toast('未检测到摄像头'); } }, - _uploadEditPhoto: function (event) { + _uploadEditPhoto: function(event) { $("#uploadEditOwnerPhoto").trigger("click") }, - _chooseEditPhoto: function (event) { + _chooseEditPhoto: function(event) { var photoFiles = event.target.files; if (photoFiles && photoFiles.length > 0) { // 获取目前上传的文件 - var file = photoFiles[0];// 文件大小校验的动作 + var file = photoFiles[0]; // 文件大小校验的动作 if (file.size > 1024 * 1024 * 1) { vc.toast("图片大小不能超过 2MB!") return false; } var reader = new FileReader(); //新建FileReader对象 reader.readAsDataURL(file); //读取为base64 - reader.onloadend = function (e) { - vc.translate(reader.result, function (_data) { + reader.onloadend = function(e) { + vc.translate(reader.result, function(_data) { vc.component.editOwnerInfo.ownerPhoto = _data; }) } } }, - _reOpenVedioForEdit: function () { + _reOpenVedioForEdit: function() { vc.component.editOwnerInfo.ownerPhoto = ""; vc.component._initAddOwnerMediaForEdit(); }, - _closeVedioForEdit: function () { + _closeVedioForEdit: function() { if (vc.component.editOwnerInfo.mediaStreamTrack != null) { vc.component.editOwnerInfo.mediaStreamTrack.stop(); } }, - _loadEditOwnerAttrSpec: function () { + _loadEditOwnerAttrSpec: function() { $that.editOwnerInfo.attrs = []; - vc.getAttrSpec('building_owner_attr', function (data) { + vc.getAttrSpec('building_owner_attr', function(data) { data.forEach(item => { item.value = ''; item.values = []; @@ -269,8 +257,8 @@ }); }); }, - _loadEditAttrValue: function (_specCd, _values) { - vc.getAttrValue(_specCd, function (data) { + _loadEditAttrValue: function(_specCd, _values) { + vc.getAttrValue(_specCd, function(data) { data.forEach(item => { if (item.valueShow == 'Y') { _values.push(item); diff --git a/public/pages/property/listOwner/listOwner.html b/public/pages/property/listOwner/listOwner.html index 7f787794e..7e06f99af 100755 --- a/public/pages/property/listOwner/listOwner.html +++ b/public/pages/property/listOwner/listOwner.html @@ -127,18 +127,6 @@ | 房屋解绑

- -