mirror of
https://gitee.com/java110/MicroCommunityWeb.git
synced 2026-02-26 08:16:47 +08:00
优化代码
This commit is contained in:
parent
a6391e15b3
commit
7063792292
87
public/pages/frame/userLogin/userLogin.html
Normal file
87
public/pages/frame/userLogin/userLogin.html
Normal file
@ -0,0 +1,87 @@
|
||||
<div>
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="ibox ">
|
||||
<div class="ibox-title">
|
||||
<h5>查询条件</h5>
|
||||
<div class="ibox-tools" style="top:10px;">
|
||||
<button type="button" class="btn btn-link btn-sm" style="margin-right:10px;"
|
||||
v-on:click="_moreCondition()">{{userLoginInfo.moreCondition == true?'隐藏':'更多'}}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
<div class="row">
|
||||
|
||||
<div class="col-sm-3">
|
||||
<div class="form-group">
|
||||
<input type="text" placeholder="请输入员工名称" v-model="userLoginInfo.conditions.name"
|
||||
class=" form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-4" >
|
||||
<div class="form-group">
|
||||
<input type="number" placeholder="请输入手机号" v-model="userLoginInfo.conditions.tel"
|
||||
class=" form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-4" >
|
||||
<div class="form-group">
|
||||
<input type="number" placeholder="请输入员工ID"
|
||||
v-model="userLoginInfo.conditions.userLoginId" class=" form-control">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-1">
|
||||
<button type="button" class="btn btn-primary btn-sm" v-on:click="_queryUserLoginMethod()">
|
||||
<i class="fa fa-search"></i> 查询
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="ibox ">
|
||||
<div class="ibox-title">
|
||||
<h5>登录日志</h5>
|
||||
<div class="ibox-tools" style="top:10px;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
<table class="footable table table-stripped toggle-arrow-tiny" data-page-size="15">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>登录ID</th>
|
||||
<th>公司</th>
|
||||
<th>部门</th>
|
||||
<th>名称</th>
|
||||
<th>登录时间</th>
|
||||
<th>员工ID</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="gradeX" v-for="userLogin in userLoginData">
|
||||
<td>{{userLogin.loginId}}</td>
|
||||
<td>{{userLogin.parentOrgName}}</td>
|
||||
<td>{{userLogin.orgName}}</td>
|
||||
<td>{{userLogin.userName}}</td>
|
||||
<td>{{userLogin.loginTime}}</td>
|
||||
<td>{{userLogin.userId}}</td>
|
||||
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<!-- 分页 -->
|
||||
<vc:create path="frame/pagination"></vc:create>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
146
public/pages/frame/userLogin/userLogin.js
Normal file
146
public/pages/frame/userLogin/userLogin.js
Normal file
@ -0,0 +1,146 @@
|
||||
(function (vc) {
|
||||
var DEFAULT_PAGE = 1;
|
||||
var DEFAULT_ROWS = 10;
|
||||
vc.extends({
|
||||
data: {
|
||||
userLoginInfo: {
|
||||
moreCondition: false,
|
||||
branchOrgs: [],
|
||||
departmentOrgs: [],
|
||||
conditions: {
|
||||
branchOrgId: '',
|
||||
departmentOrgId: '',
|
||||
orgId: '',
|
||||
orgName: '',
|
||||
orgLevel: '',
|
||||
parentOrgId: '',
|
||||
name: '',
|
||||
tel: '',
|
||||
userLoginId: ''
|
||||
}
|
||||
},
|
||||
userLoginData: [],
|
||||
|
||||
},
|
||||
watch: {
|
||||
"userLoginInfo.conditions.branchOrgId": {//深度监听,可监听到对象、数组的变化
|
||||
handler(val, oldVal) {
|
||||
vc.component._getOrgsByOrgLeveluserLogin(DEFAULT_PAGE, DEFAULT_ROWS, 3, val);
|
||||
|
||||
vc.component.userLoginInfo.conditions.branchOrgId = val;
|
||||
vc.component.userLoginInfo.conditions.parentOrgId = val;
|
||||
|
||||
|
||||
vc.component.userLoginInfo.conditions.departmentOrgId = '';
|
||||
|
||||
vc.component.loadData(DEFAULT_PAGE, DEFAULT_ROWS);
|
||||
|
||||
},
|
||||
deep: true
|
||||
},
|
||||
"userLoginInfo.conditions.departmentOrgId": {//深度监听,可监听到对象、数组的变化
|
||||
handler(val, oldVal) {
|
||||
vc.component.userLoginInfo.conditions.orgId = val;
|
||||
vc.component.loadData(DEFAULT_PAGE, DEFAULT_ROWS);
|
||||
},
|
||||
deep: true
|
||||
}
|
||||
},
|
||||
_initMethod: function () {
|
||||
vc.component.loadData(1, 10);
|
||||
vc.component._getOrgsByOrgLeveluserLogin(DEFAULT_PAGE, DEFAULT_ROWS, 2, '');
|
||||
|
||||
},
|
||||
_initEvent: function () {
|
||||
vc.component.$on('pagination_page_event', function (_currentPage) {
|
||||
vc.component.currentPage(_currentPage);
|
||||
});
|
||||
vc.component.$on('adduserLogin_reload_event', function () {
|
||||
vc.component.loadData(1, 10);
|
||||
});
|
||||
vc.component.$on('edituserLogin_reload_event', function () {
|
||||
vc.component.loadData(1, 10);
|
||||
});
|
||||
vc.component.$on('deleteuserLogin_reload_event', function () {
|
||||
vc.component.loadData(1, 10);
|
||||
});
|
||||
|
||||
|
||||
},
|
||||
methods: {
|
||||
loadData: function (_page, _rows) {
|
||||
vc.component.userLoginInfo.conditions.page = _page;
|
||||
vc.component.userLoginInfo.conditions.rows = _rows;
|
||||
vc.component.userLoginInfo.conditions.row = _rows;
|
||||
var param = {
|
||||
params: vc.component.userLoginInfo.conditions
|
||||
};
|
||||
|
||||
//发送get请求
|
||||
vc.http.apiGet('/userLogin/queryUserLogin',
|
||||
param,
|
||||
function (json) {
|
||||
var _userLoginInfo = JSON.parse(json);
|
||||
vc.component.userLoginData = _userLoginInfo.data;
|
||||
vc.component.$emit('pagination_info_event', {
|
||||
total: _userLoginInfo.records,
|
||||
currentPage: _userLoginInfo.page
|
||||
});
|
||||
|
||||
}, function () {
|
||||
console.log('请求失败处理');
|
||||
}
|
||||
);
|
||||
|
||||
},
|
||||
currentPage: function (_currentPage) {
|
||||
vc.component.loadData(_currentPage, 10);
|
||||
},
|
||||
|
||||
_moreCondition: function () {
|
||||
if (vc.component.userLoginInfo.moreCondition) {
|
||||
vc.component.userLoginInfo.moreCondition = false;
|
||||
} else {
|
||||
vc.component.userLoginInfo.moreCondition = true;
|
||||
}
|
||||
},
|
||||
_getOrgsByOrgLeveluserLogin: function (_page, _rows, _orgLevel, _parentOrgId) {
|
||||
|
||||
var param = {
|
||||
params: {
|
||||
page: _page,
|
||||
row: _rows,
|
||||
orgLevel: _orgLevel,
|
||||
parentOrgId: _parentOrgId
|
||||
}
|
||||
};
|
||||
|
||||
//发送get请求
|
||||
vc.http.get('userLogin',
|
||||
'list',
|
||||
param,
|
||||
function (json, res) {
|
||||
var _orgInfo = JSON.parse(json);
|
||||
if (_orgLevel == 2) {
|
||||
vc.component.userLoginInfo.branchOrgs = _orgInfo.orgs;
|
||||
} else {
|
||||
vc.component.userLoginInfo.departmentOrgs = _orgInfo.orgs;
|
||||
}
|
||||
}, function (errInfo, error) {
|
||||
console.log('请求失败处理');
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
_queryuserLoginMethod: function () {
|
||||
vc.component.loadData(DEFAULT_PAGE, DEFAULT_ROWS)
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
})(window.vc);
|
||||
Loading…
Reference in New Issue
Block a user