optimize data privilege

This commit is contained in:
java110 2023-01-06 14:44:48 +08:00
parent 310cdf4224
commit a9e115d4c3

View File

@ -1,4 +1,4 @@
(function (vc) {
(function(vc) {
var DEFAULT_ROWS = 10;
vc.extends({
propTypes: {
@ -10,7 +10,7 @@
total: 0,
records: 1,
units: [],
staffName: '',
unitNum: '',
dpId: '',
orgName: '',
selectUnits: []
@ -28,35 +28,34 @@
deep: true // 深度监视
}
},
_initMethod: function () {
},
_initEvent: function () {
vc.on('addDataPrivilegeUnit', 'openAddDataPrivilegeUnitModal', function (_param) {
_initMethod: function() {},
_initEvent: function() {
vc.on('addDataPrivilegeUnit', 'openAddDataPrivilegeUnitModal', function(_param) {
vc.component._refreshChooseUnitInfo();
$('#addDataPrivilegeUnitModel').modal('show');
vc.copyObject(_param, vc.component.addDataPrivilegeUnitInfo);
vc.component._loadAllUnitsInfo(1, 10, '');
});
vc.on('addDataPrivilegeUnit', 'paginationPlus', 'page_event', function (_currentPage) {
vc.on('addDataPrivilegeUnit', 'paginationPlus', 'page_event', function(_currentPage) {
vc.component._loadAllUnitsInfo(_currentPage, DEFAULT_ROWS);
});
},
methods: {
_loadAllUnitsInfo: function (_page, _row, _name) {
_loadAllUnitsInfo: function(_page, _row, _name) {
let param = {
params: {
page: _page,
row: _row,
unitNum: _name,
unitNum: $that.addDataPrivilegeUnitInfo.unitNum,
dpId: vc.component.addDataPrivilegeUnitInfo.dpId,
communityId:vc.getCurrentCommunity().communityId
communityId: vc.getCurrentCommunity().communityId
}
};
//发送get请求
vc.http.apiGet('/dataPrivilegeUnit.listUnitsNotInDataPrivilege',
param,
function (json) {
function(json) {
var _staffInfo = JSON.parse(json);
vc.component.addDataPrivilegeUnitInfo.total = _staffInfo.total;
vc.component.addDataPrivilegeUnitInfo.records = _staffInfo.records;
@ -67,12 +66,12 @@
currentPage: _page
});
},
function () {
function() {
console.log('请求失败处理');
}
);
},
addDataPrivilegeUnit: function (_org) {
addDataPrivilegeUnit: function(_org) {
var _selectUnits = vc.component.addDataPrivilegeUnitInfo.selectUnits;
var _tmpUnits = vc.component.addDataPrivilegeUnitInfo.units;
if (_selectUnits.length < 1) {
@ -101,7 +100,7 @@
JSON.stringify(_objData), {
emulateJSON: true
},
function (json, res) {
function(json, res) {
$('#addDataPrivilegeUnitModel').modal('hide');
let _json = JSON.parse(json)
if (_json.code == 0) {
@ -112,16 +111,16 @@
vc.toast(_json.msg);
}
},
function () {
function() {
console.log('请求失败处理');
}
);
$('#addDataPrivilegeUnitModel').modal('hide');
},
queryUnits: function () {
vc.component._loadAllStaffInfo(1, 10, vc.component.addDataPrivilegeUnitInfo.staffName);
queryUnits: function() {
vc.component._loadAllUnitsInfo(1, 10, vc.component.addDataPrivilegeUnitInfo.unitNum);
},
_refreshChooseUnitInfo: function () {
_refreshChooseUnitInfo: function() {
vc.component.addDataPrivilegeUnitInfo = {
units: [],
staffName: '',
@ -130,7 +129,7 @@
selectUnits: []
};
},
checkAll: function (e) {
checkAll: function(e) {
var checkObj = document.querySelectorAll('.checkItem'); // 获取所有checkbox项
if (e.target.checked) { // 判定全选checkbox的勾选状态
for (var i = 0; i < checkObj.length; i++) {