Files
PropertyDeployment/resources/Web/MicroCommunityWeb/html/pages/staff/adminStaffDetail/adminStaffDetail.js
2025-12-09 20:22:03 +08:00

84 lines
3.2 KiB
JavaScript

/**
业主详情页面
**/
(function (vc) {
var _fileUrl = '/callComponent/download/getFile/fileByObjId';
vc.extends({
data: {
adminStaffDetailInfo: {
staffId: '',
userName: '',
idCard: '',
tel: '',
sex: '',
address: '',
photo: '/img/noPhoto.jpg',
url: '',
relCd: '',
_currentTab: 'aStaffDetailPrivilege',
needBack: false
}
},
_initMethod: function () {
$that.adminStaffDetailInfo.staffId = vc.getParam('staffId');
if (!vc.notNull($that.adminStaffDetailInfo.staffId)) {
return;
}
$that._loadStaffInfo();
$that.changeTab($that.adminStaffDetailInfo._currentTab);
},
_initEvent: function () {
vc.on('adminStaffDetail', 'listStaffData', function (_info) {
$that._loadStaffInfo();
$that.changeTab($that.adminStaffDetailInfo._currentTab);
});
},
methods: {
_loadStaffInfo: function () {
let param = {
params: {
page: 1,
row: 1,
staffId: $that.adminStaffDetailInfo.staffId
}
};
//发送get请求
vc.http.apiGet('/user.queryAdminPropertyStaff',
param,
function (json) {
let _staffInfo = JSON.parse(json);
// 员工列表 和 岗位列表匹配
vc.copyObject(_staffInfo.staffs[0], $that.adminStaffDetailInfo);
},
function () {
console.log('请求失败处理');
}
);
},
changeTab: function (_tab) {
$that.adminStaffDetailInfo._currentTab = _tab;
vc.emit(_tab, 'switch', {
staffId: $that.adminStaffDetailInfo.staffId,
staffName: $that.adminStaffDetailInfo.userName,
tel: $that.adminStaffDetailInfo.tel,
})
},
_loadStaffPhoto: function () {
$that.adminStaffDetailInfo.photo = $that.adminStaffDetailInfo.url;
},
errorLoadImg: function () {
$that.adminStaffDetailInfo.photo = "/img/noPhoto.jpg";
},
_openEditStaffModel: function () {
$that.adminStaffDetailInfo.name = $that.adminStaffDetailInfo.userName;
$that.adminStaffDetailInfo.userId = $that.adminStaffDetailInfo.staffId;
$that.$emit('edit_staff_event', $that.adminStaffDetailInfo);
},
_resetStaffPwd: function (_staff) {
$that.adminStaffDetailInfo.name = $that.adminStaffDetailInfo.userName;
$that.adminStaffDetailInfo.userId = $that.adminStaffDetailInfo.staffId;
vc.emit('resetStaffPwd', 'openResetStaffPwd', $that.adminStaffDetailInfo);
},
}
});
})(window.vc);