Skip to content

Commit c71ec2b

Browse files
committed
优化代码
1 parent 56cc7ef commit c71ec2b

File tree

16 files changed

+1146
-21
lines changed

16 files changed

+1146
-21
lines changed

public/components/common/chooseEnterCommunity/chooseEnterCommunity.html

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ <h3 class="modal-title" id="addPrivilegeModalLabel">
2424
class="form-control form-control-sm">
2525
<span class="input-group-append">
2626
<button type="button" class="btn btn-sm btn-primary"
27-
v-on:click="_queryEnterCommunity()"><span>
27+
v-on:click="_queryEnterCommunity()">
2828
<vc:i18n name="查询" namespace="chooseEnterCommunity"></vc:i18n>
29-
</span></button>
29+
</button>
3030
</span>
3131
</div>
3232
</div>
@@ -41,9 +41,6 @@ <h3 class="modal-title" id="addPrivilegeModalLabel">
4141
<th data-hide="phone" class="text-center">
4242
<vc:i18n name="名称" namespace="chooseEnterCommunity"></vc:i18n>
4343
</th>
44-
<th data-hide="phone" class="text-center">
45-
<vc:i18n name="地址" namespace="chooseEnterCommunity"></vc:i18n>
46-
</th>
4744
<th class="text-center">
4845
<vc:i18n name="操作" namespace="chooseEnterCommunity"></vc:i18n>
4946
</th>
@@ -57,9 +54,6 @@ <h3 class="modal-title" id="addPrivilegeModalLabel">
5754
<td class="text-center">
5855
{{community.name}}
5956
</td>
60-
<td class="text-center">
61-
{{community.address}}
62-
</td>
6357
<td class="text-center">
6458
<div class="btn-group">
6559
<button class="btn-white btn btn-xs"

public/components/community/selectAdminCommunity/selectAdminCommunity.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,19 @@
2929
communityId: ''
3030
}];
3131
$that.selectAdminCommunityInfo.communitys = _communistys;
32-
vc.http.apiGet('/community.listCommunitys',
32+
vc.http.apiGet('/community.listAdminCommunitys',
3333
param,
3434
function (json, res) {
35-
if (res.status == 200) {
36-
let _data = JSON.parse(json);
37-
_data.communitys.forEach(c => {
38-
_communistys.push(c);
39-
});
40-
$that.selectAdminCommunityInfo.communitys = _communistys;
41-
$that._swatchAdminCommunity(_communistys[0]);
35+
36+
let _json = JSON.parse(json);
37+
if (_json.code != 0) {
38+
return;
4239
}
40+
_json.data.forEach(c => {
41+
_communistys.push(c);
42+
});
43+
$that.selectAdminCommunityInfo.communitys = _communistys;
44+
$that._swatchAdminCommunity(_communistys[0]);
4345
}, function () {
4446
console.log('请求失败处理');
4547
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<div class="">
2+
<div class="row">
3+
<div class="col-sm-4"></div>
4+
<div class="col-lg-8 text-right">
5+
<button type="button" class="btn btn-primary btn-sm" @click="_openAddStaffCommunityModal()">
6+
<vc:i18n name="关联小区"></vc:i18n>
7+
</button>
8+
</div>
9+
</div>
10+
<div class="margin-top">
11+
<table class="footable table table-stripped toggle-arrow-tiny margin-top" data-page-size="15">
12+
<thead>
13+
<tr>
14+
<th class="text-center">
15+
<vc:i18n name="员工名称" namespace="aStaffDetailCommunitys"></vc:i18n>
16+
</th>
17+
<th class="text-center">
18+
<vc:i18n name="员工编号" namespace="aStaffDetailCommunitys"></vc:i18n>
19+
</th>
20+
<th class="text-center">
21+
<vc:i18n name="小区编号" namespace="aStaffDetailCommunitys"></vc:i18n>
22+
</th>
23+
<th class="text-center">
24+
<vc:i18n name="小区名称" namespace="aStaffDetailCommunitys"></vc:i18n>
25+
</th>
26+
<th class="text-center">
27+
<vc:i18n name="操作" namespace="aStaffDetailCommunitys"></vc:i18n>
28+
</th>
29+
</tr>
30+
</thead>
31+
<tbody>
32+
<tr v-for="community in aStaffDetailCommunitysInfo.communitys">
33+
<td class="text-center">{{community.staffName}}</td>
34+
<td class="text-center">{{community.staffId}}</td>
35+
<td class="text-center">{{community.communityId}}</td>
36+
<td class="text-center">{{community.communityName}}</td>
37+
<td class="text-center">
38+
<div class="btn-group">
39+
<button class="btn-white btn btn-xs"
40+
v-on:click="_openDeleteRoleCommunityModel(community)">
41+
<vc:i18n name="删除"></vc:i18n>
42+
</button>
43+
</div>
44+
</td>
45+
</tr>
46+
</tbody>
47+
</table>
48+
<!-- 分页 -->
49+
<div class="row">
50+
<div class="col-sm-4">
51+
52+
</div>
53+
<div class="col-sm-8">
54+
<vc:create namespace="aStaffDetailCommunitys" path="frame/paginationPlus"></vc:create>
55+
</div>
56+
</div>
57+
</div>
58+
</div>
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/**
2+
入驻小区
3+
**/
4+
(function (vc) {
5+
var DEFAULT_PAGE = 1;
6+
var DEFAULT_ROWS = 10;
7+
vc.extends({
8+
data: {
9+
aStaffDetailCommunitysInfo: {
10+
communitys: [],
11+
staffId: '',
12+
}
13+
},
14+
_initMethod: function () {
15+
},
16+
_initEvent: function () {
17+
vc.on('aStaffDetailCommunitys', 'switch', function (_data) {
18+
$that.aStaffDetailCommunitysInfo.staffId = _data.staffId;
19+
$that._loadAStaffDetailCommunitysData(DEFAULT_PAGE, DEFAULT_ROWS)
20+
});
21+
vc.on('aStaffDetailCommunitys', 'paginationPlus', 'page_event',
22+
function (_currentPage) {
23+
vc.component._loadAStaffDetailCommunitysData(_currentPage, DEFAULT_ROWS);
24+
});
25+
vc.on('aStaffDetailCommunitys', 'notify', function (_data) {
26+
$that._loadAStaffDetailCommunitysData(DEFAULT_PAGE, DEFAULT_ROWS);
27+
})
28+
},
29+
methods: {
30+
_loadAStaffDetailCommunitysData: function (_page, _row) {
31+
let param = {
32+
params: {
33+
staffId: $that.aStaffDetailCommunitysInfo.staffId,
34+
page: _page,
35+
row: _row
36+
}
37+
};
38+
//发送get请求
39+
vc.http.apiGet('/role.listAStaffCommunity',
40+
param,
41+
function (json) {
42+
let _json = JSON.parse(json);
43+
$that.aStaffDetailCommunitysInfo.communitys = _json.data;
44+
vc.emit('aStaffDetailCommunitys', 'paginationPlus', 'init', {
45+
total: _json.records,
46+
dataCount: _json.total,
47+
currentPage: _page
48+
});
49+
},
50+
function () {
51+
console.log('请求失败处理');
52+
}
53+
);
54+
},
55+
//查询
56+
_qureyAStaffDetailCommunitys: function () {
57+
$that._loadAStaffDetailCommunitysData(DEFAULT_PAGE, DEFAULT_ROWS);
58+
},
59+
_openAddStaffCommunityModal:function(){
60+
vc.emit('addAStaffCommunity', 'openAddAStaffCommunityModal',{
61+
staffId:$that.aStaffDetailCommunitysInfo.staffId,
62+
})
63+
},
64+
_openDeleteRoleCommunityModel:function(staffCommunity){
65+
vc.emit( 'deleteAStaffCommunity','openDeleteAStaffCommunityModal',staffCommunity)
66+
},
67+
68+
}
69+
});
70+
})(window.vc);
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<div id="addAStaffCommunityModel" class="modal fade" role="dialog" aria-labelledby="addAStaffCommunityModelLabel"
2+
aria-hidden="true">
3+
<div class="modal-dialog modal-lg">
4+
<div class="modal-content">
5+
<div class="modal-header">
6+
<h3 class="modal-title" id="addAStaffCommunityModelLabel">
7+
<vc:i18n name="小区" namespace="addAStaffCommunity"></vc:i18n>
8+
</h3>
9+
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
10+
<span aria-hidden="true">&times;</span>
11+
</button>
12+
</div>
13+
<div class="modal-body">
14+
15+
<div class="ibox ">
16+
<div class="row">
17+
<div class="col-sm-4 m-b-xs">
18+
<div class="input-group">
19+
<input :placeholder="vc.i18n('输入小区名称','addAStaffCommunity')" type="text"
20+
v-model.trim="addAStaffCommunityInfo.communityName"
21+
class="form-control form-control-sm">
22+
</div>
23+
</div>
24+
<div class="col-sm-5">
25+
<button type="button" class="btn btn-sm btn-primary" v-on:click="queryCommunitys()">
26+
<vc:i18n name="查询" namespace="addAStaffCommunity"></vc:i18n>
27+
</button>
28+
</div>
29+
</div>
30+
<div class="table-responsive" style="margin-top:15px">
31+
<table class="table table-striped">
32+
<thead>
33+
<tr>
34+
<th class="text-center">
35+
<input type="checkbox" class="i-checks " @click="checkAllCommunity($event)"
36+
id="quan">
37+
</th>
38+
<th class="text-center">
39+
<vc:i18n name="小区ID" namespace="addAStaffCommunity"></vc:i18n>
40+
</th>
41+
<th class="text-center">
42+
<vc:i18n name="小区名称" namespace="addAStaffCommunity"></vc:i18n>
43+
</th>
44+
<th class="text-center">
45+
<vc:i18n name="小区地址" namespace="addAStaffCommunity"></vc:i18n>
46+
</th>
47+
</tr>
48+
</thead>
49+
<tbody>
50+
<tr v-for="community in addAStaffCommunityInfo.communitys">
51+
<td class="text-center">
52+
<input type="checkbox" class="i-checks checkItem"
53+
v-bind:value="community.communityId" @click="isCheckAll($event)"
54+
v-model="addAStaffCommunityInfo.selectCommunitys">
55+
</td>
56+
<td class="text-center">{{community.communityId}}</td>
57+
<td class="text-center">{{community.name}}</td>
58+
<td class="text-center">{{community.address}}</td>
59+
</tr>
60+
</tbody>
61+
</table>
62+
<!-- 分页 -->
63+
<vc:create namespace="addAStaffCommunity" path="frame/paginationPlus"></vc:create>
64+
<div class="ibox-content" v-if="addAStaffCommunityInfo.communitys.length > 0">
65+
<button class="btn btn-primary float-right" type="button" v-on:click="addAStaffCommunity()">
66+
<i class="fa fa-check"></i>&nbsp;提交
67+
</button>
68+
<button type="button" class="btn btn-warning float-right" style="margin-right:20px;"
69+
data-dismiss="modal">
70+
<vc:i18n name="取消" namespace="addAStaffCommunity"></vc:i18n>
71+
</button>
72+
</div>
73+
</div>
74+
</div>
75+
</div>
76+
</div>
77+
</div>
78+
</div>

0 commit comments

Comments
 (0)