mirror of
https://gitee.com/java110/MicroCommunityWeb.git
synced 2026-02-24 21:59:12 +08:00
优化数据权限
This commit is contained in:
parent
0f17abcbb4
commit
8a67d43920
@ -35,8 +35,8 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center">
|
||||
<input type="checkbox" class="i-checks " @click="checkAll($event)"
|
||||
id="quan">
|
||||
<input type="checkbox" class="i-checks " @click="checkStaffAll($event)"
|
||||
id="staffQuan">
|
||||
</th>
|
||||
<th class="text-center">
|
||||
<span><vc:i18n name="员工编号" namespace="addDataPrivilegeStaff"></vc:i18n></span></th>
|
||||
|
||||
@ -17,12 +17,12 @@
|
||||
}
|
||||
},
|
||||
watch: { // 监视双向绑定的数据数组
|
||||
checkData: {
|
||||
addDataPrivilegeStaffInfo: {
|
||||
handler() { // 数据数组有变化将触发此函数
|
||||
if (vc.component.addDataPrivilegeStaffInfo.selectStaffs.length == vc.component.addDataPrivilegeStaffInfo.staffs.length) {
|
||||
document.querySelector('#quan').checked = true;
|
||||
if ($that.addDataPrivilegeStaffInfo.selectStaffs.length == $that.addDataPrivilegeStaffInfo.staffs.length) {
|
||||
document.querySelector('#staffQuan').checked = true;
|
||||
} else {
|
||||
document.querySelector('#quan').checked = false;
|
||||
document.querySelector('#staffQuan').checked = false;
|
||||
}
|
||||
},
|
||||
deep: true // 深度监视
|
||||
@ -32,13 +32,13 @@
|
||||
},
|
||||
_initEvent: function () {
|
||||
vc.on('addDataPrivilegeStaff', 'openAddDataPrivilegeStaffModal', function (_param) {
|
||||
vc.component._refreshChooseOrgInfo();
|
||||
$that._refreshChooseOrgInfo();
|
||||
$('#addDataPrivilegeStaffModel').modal('show');
|
||||
vc.copyObject(_param, vc.component.addDataPrivilegeStaffInfo);
|
||||
vc.component._loadAllStaffInfo(1, 10, '');
|
||||
vc.copyObject(_param, $that.addDataPrivilegeStaffInfo);
|
||||
$that._loadAllStaffInfo(1, 10, '');
|
||||
});
|
||||
vc.on('addDataPrivilegeStaff', 'paginationPlus', 'page_event', function (_currentPage) {
|
||||
vc.component._loadAllStaffInfo(_currentPage, DEFAULT_ROWS);
|
||||
$that._loadAllStaffInfo(_currentPage, DEFAULT_ROWS);
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
@ -47,8 +47,8 @@
|
||||
params: {
|
||||
page: _page,
|
||||
row: _row,
|
||||
userName: _name,
|
||||
dpId: vc.component.addDataPrivilegeStaffInfo.dpId
|
||||
staffName: _name,
|
||||
dpId: $that.addDataPrivilegeStaffInfo.dpId
|
||||
}
|
||||
};
|
||||
//发送get请求
|
||||
@ -56,12 +56,12 @@
|
||||
param,
|
||||
function (json) {
|
||||
var _staffInfo = JSON.parse(json);
|
||||
vc.component.addDataPrivilegeStaffInfo.total = _staffInfo.total;
|
||||
vc.component.addDataPrivilegeStaffInfo.records = _staffInfo.records;
|
||||
vc.component.addDataPrivilegeStaffInfo.staffs = _staffInfo.data;
|
||||
$that.addDataPrivilegeStaffInfo.total = _staffInfo.total;
|
||||
$that.addDataPrivilegeStaffInfo.records = _staffInfo.records;
|
||||
$that.addDataPrivilegeStaffInfo.staffs = _staffInfo.data;
|
||||
vc.emit('addDataPrivilegeStaff', 'paginationPlus', 'init', {
|
||||
total: vc.component.addDataPrivilegeStaffInfo.records,
|
||||
dataCount: vc.component.addDataPrivilegeStaffInfo.total,
|
||||
total: $that.addDataPrivilegeStaffInfo.records,
|
||||
dataCount: $that.addDataPrivilegeStaffInfo.total,
|
||||
currentPage: _page
|
||||
});
|
||||
},
|
||||
@ -71,8 +71,8 @@
|
||||
);
|
||||
},
|
||||
addDataPrivilegeStaff: function (_org) {
|
||||
var _selectStaffs = vc.component.addDataPrivilegeStaffInfo.selectStaffs;
|
||||
var _tmpStaffs = vc.component.addDataPrivilegeStaffInfo.staffs;
|
||||
var _selectStaffs = $that.addDataPrivilegeStaffInfo.selectStaffs;
|
||||
var _tmpStaffs = $that.addDataPrivilegeStaffInfo.staffs;
|
||||
if (_selectStaffs.length < 1) {
|
||||
vc.toast("请选择员工");
|
||||
return;
|
||||
@ -89,7 +89,7 @@
|
||||
}
|
||||
}
|
||||
let _objData = {
|
||||
dpId: vc.component.addDataPrivilegeStaffInfo.dpId,
|
||||
dpId: $that.addDataPrivilegeStaffInfo.dpId,
|
||||
staffs: _staffs,
|
||||
communityId: vc.getCurrentCommunity().communityId
|
||||
}
|
||||
@ -115,10 +115,10 @@
|
||||
$('#addDataPrivilegeStaffModel').modal('hide');
|
||||
},
|
||||
queryStaffs: function () {
|
||||
vc.component._loadAllStaffInfo(1, 10, vc.component.addDataPrivilegeStaffInfo.staffName);
|
||||
$that._loadAllStaffInfo(1, 10, $that.addDataPrivilegeStaffInfo.staffName);
|
||||
},
|
||||
_refreshChooseOrgInfo: function () {
|
||||
vc.component.addDataPrivilegeStaffInfo = {
|
||||
$that.addDataPrivilegeStaffInfo = {
|
||||
staffs: [],
|
||||
staffName: '',
|
||||
dpId: '',
|
||||
@ -126,16 +126,16 @@
|
||||
selectStaffs: []
|
||||
};
|
||||
},
|
||||
checkAll: function (e) {
|
||||
var checkObj = document.querySelectorAll('.checkItem'); // 获取所有checkbox项
|
||||
checkStaffAll: function (e) {
|
||||
let checkObj = document.querySelectorAll('.checkItem'); // 获取所有checkbox项
|
||||
if (e.target.checked) { // 判定全选checkbox的勾选状态
|
||||
for (var i = 0; i < checkObj.length; i++) {
|
||||
if (!checkObj[i].checked) { // 将未勾选的checkbox选项push到绑定数组中
|
||||
vc.component.addDataPrivilegeStaffInfo.selectStaffs.push(checkObj[i].value);
|
||||
$that.addDataPrivilegeStaffInfo.selectStaffs.push(checkObj[i].value);
|
||||
}
|
||||
}
|
||||
} else { // 如果是去掉全选则清空checkbox选项绑定数组
|
||||
vc.component.addDataPrivilegeStaffInfo.selectStaffs = [];
|
||||
$that.addDataPrivilegeStaffInfo.selectStaffs = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h3 class="modal-title" id="addDataPrivilegeUnitModelLabel">
|
||||
<span><vc:i18n name="楼栋单元" namespace="addDataPrivilegeUnit"></vc:i18n></span>
|
||||
<vc:i18n name="楼栋单元" namespace="addDataPrivilegeUnit"></vc:i18n>
|
||||
</h3>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
@ -18,13 +18,16 @@
|
||||
<div class="col-sm-7 m-b-xs"></div>
|
||||
<div class="col-sm-5">
|
||||
<div class="input-group">
|
||||
<input :placeholder="vc.i18n('输入楼栋编号','addDataPrivilegeUnit')" type="text"
|
||||
v-model="addDataPrivilegeUnitInfo.floorNum"
|
||||
class="form-control form-control-sm">
|
||||
<input :placeholder="vc.i18n('输入单元编号','addDataPrivilegeUnit')" type="text"
|
||||
v-model="addDataPrivilegeUnitInfo.unitNum"
|
||||
class="form-control form-control-sm">
|
||||
<span class="input-group-append">
|
||||
<button type="button" class="btn btn-sm btn-primary"
|
||||
v-on:click="queryUnits()">
|
||||
<span><vc:i18n name="查询" namespace="addDataPrivilegeUnit"></vc:i18n></span>
|
||||
<vc:i18n name="查询" namespace="addDataPrivilegeUnit"></vc:i18n>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
@ -35,20 +38,20 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center">
|
||||
<input type="checkbox" class="i-checks " @click="checkAll($event)"
|
||||
id="quan">
|
||||
<input type="checkbox" class="i-checks " @click="checkUnitAll($event)"
|
||||
id="unitQuan">
|
||||
</th>
|
||||
<th class="text-center">
|
||||
<span><vc:i18n name="楼栋编号" namespace="addDataPrivilegeUnit"></vc:i18n></span></th>
|
||||
<vc:i18n name="楼栋编号" namespace="addDataPrivilegeUnit"></vc:i18n></th>
|
||||
<th class="text-center">
|
||||
<span><vc:i18n name="单元编号" namespace="addDataPrivilegeUnit"></vc:i18n></span>
|
||||
<vc:i18n name="单元编号" namespace="addDataPrivilegeUnit"></vc:i18n>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="unit in addDataPrivilegeUnitInfo.units">
|
||||
<td class="text-center">
|
||||
<input type="checkbox" class="i-checks checkItem"
|
||||
<input type="checkbox" class="i-checks checkUnitItem"
|
||||
v-bind:value="unit.unitId" v-model="addDataPrivilegeUnitInfo.selectUnits">
|
||||
</td>
|
||||
<td class="text-center">{{unit.floorNum}}</td>
|
||||
|
||||
@ -11,18 +11,19 @@
|
||||
records: 1,
|
||||
units: [],
|
||||
unitNum: '',
|
||||
floorNum:'',
|
||||
dpId: '',
|
||||
orgName: '',
|
||||
selectUnits: []
|
||||
}
|
||||
},
|
||||
watch: { // 监视双向绑定的数据数组
|
||||
checkData: {
|
||||
addDataPrivilegeUnitInfo: {
|
||||
handler() { // 数据数组有变化将触发此函数
|
||||
if (vc.component.addDataPrivilegeUnitInfo.selectUnits.length == vc.component.addDataPrivilegeUnitInfo.units.length) {
|
||||
document.querySelector('#quan').checked = true;
|
||||
if ($that.addDataPrivilegeUnitInfo.selectUnits.length == $that.addDataPrivilegeUnitInfo.units.length) {
|
||||
document.querySelector('#unitQuan').checked = true;
|
||||
} else {
|
||||
document.querySelector('#quan').checked = false;
|
||||
document.querySelector('#unitQuan').checked = false;
|
||||
}
|
||||
},
|
||||
deep: true // 深度监视
|
||||
@ -32,13 +33,13 @@
|
||||
_initEvent: function() {
|
||||
|
||||
vc.on('addDataPrivilegeUnit', 'openAddDataPrivilegeUnitModal', function(_param) {
|
||||
vc.component._refreshChooseUnitInfo();
|
||||
$that._refreshChooseUnitInfo();
|
||||
$('#addDataPrivilegeUnitModel').modal('show');
|
||||
vc.copyObject(_param, vc.component.addDataPrivilegeUnitInfo);
|
||||
vc.component._loadAllUnitsInfo(1, 10, '');
|
||||
vc.copyObject(_param, $that.addDataPrivilegeUnitInfo);
|
||||
$that._loadAllUnitsInfo(1, 10, '');
|
||||
});
|
||||
vc.on('addDataPrivilegeUnit', 'paginationPlus', 'page_event', function(_currentPage) {
|
||||
vc.component._loadAllUnitsInfo(_currentPage, DEFAULT_ROWS);
|
||||
$that._loadAllUnitsInfo(_currentPage, DEFAULT_ROWS);
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
@ -48,7 +49,8 @@
|
||||
page: _page,
|
||||
row: _row,
|
||||
unitNum: $that.addDataPrivilegeUnitInfo.unitNum,
|
||||
dpId: vc.component.addDataPrivilegeUnitInfo.dpId,
|
||||
floorNum: $that.addDataPrivilegeUnitInfo.floorNum,
|
||||
dpId: $that.addDataPrivilegeUnitInfo.dpId,
|
||||
communityId: vc.getCurrentCommunity().communityId
|
||||
}
|
||||
};
|
||||
@ -57,12 +59,12 @@
|
||||
param,
|
||||
function(json) {
|
||||
var _staffInfo = JSON.parse(json);
|
||||
vc.component.addDataPrivilegeUnitInfo.total = _staffInfo.total;
|
||||
vc.component.addDataPrivilegeUnitInfo.records = _staffInfo.records;
|
||||
vc.component.addDataPrivilegeUnitInfo.units = _staffInfo.data;
|
||||
$that.addDataPrivilegeUnitInfo.total = _staffInfo.total;
|
||||
$that.addDataPrivilegeUnitInfo.records = _staffInfo.records;
|
||||
$that.addDataPrivilegeUnitInfo.units = _staffInfo.data;
|
||||
vc.emit('addDataPrivilegeUnit', 'paginationPlus', 'init', {
|
||||
total: vc.component.addDataPrivilegeUnitInfo.records,
|
||||
dataCount: vc.component.addDataPrivilegeUnitInfo.total,
|
||||
total: $that.addDataPrivilegeUnitInfo.records,
|
||||
dataCount: $that.addDataPrivilegeUnitInfo.total,
|
||||
currentPage: _page
|
||||
});
|
||||
},
|
||||
@ -72,8 +74,8 @@
|
||||
);
|
||||
},
|
||||
addDataPrivilegeUnit: function(_org) {
|
||||
var _selectUnits = vc.component.addDataPrivilegeUnitInfo.selectUnits;
|
||||
var _tmpUnits = vc.component.addDataPrivilegeUnitInfo.units;
|
||||
var _selectUnits = $that.addDataPrivilegeUnitInfo.selectUnits;
|
||||
var _tmpUnits = $that.addDataPrivilegeUnitInfo.units;
|
||||
if (_selectUnits.length < 1) {
|
||||
vc.toast("请选择员工");
|
||||
return;
|
||||
@ -92,7 +94,7 @@
|
||||
}
|
||||
}
|
||||
let _objData = {
|
||||
dpId: vc.component.addDataPrivilegeUnitInfo.dpId,
|
||||
dpId: $that.addDataPrivilegeUnitInfo.dpId,
|
||||
units: _units,
|
||||
communityId: vc.getCurrentCommunity().communityId
|
||||
}
|
||||
@ -118,10 +120,10 @@
|
||||
$('#addDataPrivilegeUnitModel').modal('hide');
|
||||
},
|
||||
queryUnits: function() {
|
||||
vc.component._loadAllUnitsInfo(1, 10, vc.component.addDataPrivilegeUnitInfo.unitNum);
|
||||
$that._loadAllUnitsInfo(1, 10, $that.addDataPrivilegeUnitInfo.unitNum);
|
||||
},
|
||||
_refreshChooseUnitInfo: function() {
|
||||
vc.component.addDataPrivilegeUnitInfo = {
|
||||
$that.addDataPrivilegeUnitInfo = {
|
||||
units: [],
|
||||
staffName: '',
|
||||
dpId: '',
|
||||
@ -129,16 +131,16 @@
|
||||
selectUnits: []
|
||||
};
|
||||
},
|
||||
checkAll: function(e) {
|
||||
var checkObj = document.querySelectorAll('.checkItem'); // 获取所有checkbox项
|
||||
checkUnitAll: function(e) {
|
||||
let checkObj = document.querySelectorAll('.checkUnitItem'); // 获取所有checkbox项
|
||||
if (e.target.checked) { // 判定全选checkbox的勾选状态
|
||||
for (var i = 0; i < checkObj.length; i++) {
|
||||
if (!checkObj[i].checked) { // 将未勾选的checkbox选项push到绑定数组中
|
||||
vc.component.addDataPrivilegeUnitInfo.selectUnits.push(checkObj[i].value);
|
||||
$that.addDataPrivilegeUnitInfo.selectUnits.push(checkObj[i].value);
|
||||
}
|
||||
}
|
||||
} else { // 如果是去掉全选则清空checkbox选项绑定数组
|
||||
vc.component.addDataPrivilegeUnitInfo.selectUnits = [];
|
||||
$that.addDataPrivilegeUnitInfo.selectUnits = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user