MicroCommunityWeb/public/pages/owner/adminAccount/adminAccount.js
2025-03-02 16:54:01 +08:00

108 lines
4.2 KiB
JavaScript

/**
入驻小区
**/
(function (vc) {
var DEFAULT_PAGE = 1;
var DEFAULT_ROWS = 10;
vc.extends({
data: {
adminAccountInfo: {
accounts: [],
total: 0,
records: 1,
moreCondition: false,
scId: '',
acctTypes: [],
conditions: {
acctType: '',
ownerName: '',
idCard: '',
link: '',
communityId: ''
}
}
},
_initMethod: function () {
//与字典表单位关联
vc.getDict('account', "acct_type", function (_data) {
let _acctTypes = [{
name:'全部',
statusCd:''
}];
_data.forEach(_d=>{
_acctTypes.push(_d);
})
$that.adminAccountInfo.acctTypes = _acctTypes;
});
$that._listAdminAccounts(DEFAULT_PAGE, DEFAULT_ROWS);
},
_initEvent: function () {
vc.on('selectAdminCommunity','changeCommunity',function(_community){
$that.adminAccountInfo.conditions.communityId = _community.communityId;
$that._listAdminAccounts(DEFAULT_PAGE, DEFAULT_ROWS);
})
vc.on('adminAccount', 'listAccount', function (_param) {
$that._listAdminAccounts(DEFAULT_PAGE, DEFAULT_ROWS);
});
vc.on('pagination', 'page_event', function (_currentPage) {
$that._listAdminAccounts(_currentPage, DEFAULT_ROWS);
});
},
methods: {
_listAdminAccounts: function (_page, _rows) {
$that.adminAccountInfo.conditions.page = _page;
$that.adminAccountInfo.conditions.row = _rows;
let param = {
params: $that.adminAccountInfo.conditions
};
//发送get请求
vc.http.apiGet('/account.queryAdminOwnerAccount',
param,
function (json, res) {
let _json = JSON.parse(json);
$that.adminAccountInfo.total = _json.total;
$that.adminAccountInfo.records = _json.records;
$that.adminAccountInfo.accounts = _json.data;
vc.emit('pagination', 'init', {
total: $that.adminAccountInfo.records,
dataCount: $that.adminAccountInfo.total,
currentPage: _page
});
},
function (errInfo, error) {
console.log('请求失败处理');
}
);
},
//查询
_queryAccountMethod: function () {
$that._listAdminAccounts(DEFAULT_PAGE, DEFAULT_ROWS);
},
//重置
_resetAccountMethod: function () {
$that.adminAccountInfo.conditions.ownerName = "";
$that.adminAccountInfo.conditions.idCard = "";
$that.adminAccountInfo.conditions.link = "";
$that.adminAccountInfo.conditions.acctType = "";
$that._listAdminAccounts(DEFAULT_PAGE, DEFAULT_ROWS);
},
_moreCondition: function () {
if ($that.adminAccountInfo.moreCondition) {
$that.adminAccountInfo.moreCondition = false;
} else {
$that.adminAccountInfo.moreCondition = true;
}
},
_accountDetail: function (_account) {
vc.jumpToPage('/#/pages/owner/adminAccountDetail?acctId=' + _account.acctId);
},
_swatchAcctType: function (_item) {
$that.adminAccountInfo.conditions.acctType = _item.statusCd;
$that._listAdminAccounts(DEFAULT_PAGE, DEFAULT_ROWS);
},
_doDeleteAccount:function(_account){
vc.emit('deleteAccount', 'openDeleteAccountModal',_account);
}
}
});
})(window.vc);