加入 业主属性数据

This commit is contained in:
java110 2020-08-16 17:25:14 +08:00
parent 8e5d87bc51
commit 43f2565fe6
2 changed files with 75 additions and 2 deletions

View File

@ -17,6 +17,7 @@
<th data-hide="phone">联系方式</th>
<th data-hide="phone">创建员工</th>
<th data-hide="phone">备注</th>
<th v-for="(item,index) in memberInfo.listColumns">{{item}}</th>
<th class="text-right">操作</th>
</tr>
@ -51,6 +52,9 @@
<td>
{{owner.remark}}
</td>
<td v-for="item in owner.listValues">
{{item}}
</td>
<td class="text-right">
<div class="btn-group">
<button class="btn-white btn btn-xs" v-on:click="_openEditOwnerModel(owner)">修改</button>

View File

@ -5,10 +5,12 @@
memberInfo:{
members:[],
_currentOwnerId:'',
listColumns:[]
}
},
_initMethod:function(){
$that._getColumns(function(){
});
},
_initEvent:function(){
@ -38,7 +40,7 @@
function(json){
var _memberInfo = JSON.parse(json);
vc.component.memberInfo.members = _memberInfo.owners;
$that.dealOwnerAttr(_memberInfo.owners);
},function(){
console.log('请求失败处理');
});
@ -50,6 +52,73 @@
_openEditOwnerModel:function(_member){
_member.ownerId = vc.component.memberInfo._currentOwnerId;
vc.emit('editOwner','openEditOwnerModal',_member);
},
dealOwnerAttr: function (owners) {
owners.forEach(item => {
$that._getColumnsValue(item);
});
},
_getColumnsValue: function (_owner) {
_owner.listValues = [];
if (!_owner.hasOwnProperty('ownerAttrDtos') || _owner.ownerAttrDtos.length < 1) {
$that.memberInfo.listColumns.forEach(_value => {
_owner.listValues.push('');
})
return;
}
let _ownerAttrDtos = _owner.ownerAttrDtos;
$that.memberInfo.listColumns.forEach(_value => {
let _tmpValue = '';
_ownerAttrDtos.forEach(_attrItem =>{
if(_value == _attrItem.specName){
_tmpValue = _attrItem.valueName;
}
})
_owner.listValues.push(_tmpValue);
})
},
_getColumns: function (_call) {
console.log('_getColumns');
$that.memberInfo.listColumns = [];
vc.getAttrSpec('building_owner_attr', function (data) {
$that.memberInfo.listColumns = [];
data.forEach(item => {
if(item.listShow == 'Y'){
$that.memberInfo.listColumns.push(item.specName);
}
});
_call();
});
// 循环所有房屋信息
// for (let _ownerIndex = 0; _ownerIndex < _owners.length; _ownerIndex++) {
// let _owner = _owners[_ownerIndex];
// if (!_owner.hasOwnProperty('ownerAttrDtos')) {
// break;
// }
// let _ownerAttrDtos = _owner.ownerAttrDto;
// if (_ownerAttrDtos.length < 1) {
// break;
// }
// //获取房屋信息中 任意属性作为 列
// for (let _ownerAttrIndex = 0; _ownerAttrIndex < _ownerAttrDtos.length; _ownerAttrIndex++) {
// let attrItem = _ownerAttrDtos[_ownerAttrIndex];
// if (attrItem.listShow == 'Y') {
// $that.ownerInfo.listColumns.push(attrItem.specName);
// }
// }
// if ($that.ownerInfo.listColumns.length > 0) {
// break;
// }
// }
}
}
});