优化 业主 删除为cmd 模式

This commit is contained in:
java110 2022-03-31 09:22:13 +08:00
parent 2503924bae
commit 9f3c556792
4 changed files with 62 additions and 90 deletions

View File

@ -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
},

View File

@ -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);

View File

@ -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);

View File

@ -127,18 +127,6 @@
<span>|</span>
<a href="javascript:void(0)" v-on:click="_openDeleteOwnerRoom(owner)">房屋解绑</a>
</p>
<!-- <p style="margin:10px 0;">
<a href="javascript:void(0)"
v-on:click="_openPayPropertyFee(owner)">物业费用</a>
<span>|</span>
<a href="javascript:void(0)"
v-on:click="_openPayParkingSpaceFee(owner)">停车费用</a>
</p> -->
<!-- <p style="margin:10px 0;">
<a href="javascript:void(0)"
v-on:click="_openOwnerRepair(owner)">业主报修</a>
<span>|</span>
</p> -->
</div>
</div>
<div class="btn-group">