优化代码

This commit is contained in:
java110 2022-10-19 16:29:52 +08:00
parent 7627d8f200
commit ff05af3f6f

View File

@ -1,7 +1,7 @@
/** /**
入驻小区 入驻小区
**/ **/
(function (vc) { (function(vc) {
var DEFAULT_PAGE = 1; var DEFAULT_PAGE = 1;
var DEFAULT_ROWS = 10; var DEFAULT_ROWS = 10;
var ALL_ROWS = 100; var ALL_ROWS = 100;
@ -15,34 +15,33 @@
dpId: '' dpId: ''
} }
}, },
_initMethod: function () { _initMethod: function() {},
}, _initEvent: function() {
_initEvent: function () { vc.on('dataPrivilegeUnitInfo', 'openDataPrivilegeUnit', function(_param) {
vc.on('dataPrivilegeUnitInfo', 'openDataPrivilegeUnit', function (_param) {
vc.copyObject(_param, vc.component.dataPrivilegeUnitInfo); vc.copyObject(_param, vc.component.dataPrivilegeUnitInfo);
vc.component._listDataPrivilegeUnits(DEFAULT_PAGE, DEFAULT_ROWS); vc.component._listDataPrivilegeUnits(DEFAULT_PAGE, DEFAULT_ROWS);
}); });
vc.on('dataPrivilegeUnitInfo', 'listDataPrivilegeUnit', function (_param) { vc.on('dataPrivilegeUnitInfo', 'listDataPrivilegeUnit', function(_param) {
//vc.copyObject(_param, vc.component.dataPrivilegeUnitInfo.conditions); //vc.copyObject(_param, vc.component.dataPrivilegeUnitInfo.conditions);
vc.component._listDataPrivilegeUnits(DEFAULT_PAGE, DEFAULT_ROWS); vc.component._listDataPrivilegeUnits(DEFAULT_PAGE, DEFAULT_ROWS);
}); });
vc.on('dataPrivilegeUnitInfo', 'paginationPlus', 'page_event', function (_currentPage) { vc.on('dataPrivilegeUnitInfo', 'paginationPlus', 'page_event', function(_currentPage) {
vc.component._listDataPrivilegeUnits(_currentPage, DEFAULT_ROWS); vc.component._listDataPrivilegeUnits(_currentPage, DEFAULT_ROWS);
}); });
}, },
methods: { methods: {
_listDataPrivilegeUnits: function (_page, _rows) { _listDataPrivilegeUnits: function(_page, _rows) {
var param = { var param = {
params: { params: {
page: _page, page: _page,
row: _rows, row: _rows,
roleId: vc.component.dataPrivilegeUnitInfo.pgId dpId: vc.component.dataPrivilegeUnitInfo.dpId
} }
}; };
//发送get请求 //发送get请求
vc.http.apiGet('/dataPrivilegeUnit.listDataPrivilegeUnit', vc.http.apiGet('/dataPrivilegeUnit.listDataPrivilegeUnit',
param, param,
function (json, res) { function(json, res) {
var _dataPrivilegeUnitInfo = JSON.parse(json); var _dataPrivilegeUnitInfo = JSON.parse(json);
vc.component.dataPrivilegeUnitInfo.total = _dataPrivilegeUnitInfo.total; vc.component.dataPrivilegeUnitInfo.total = _dataPrivilegeUnitInfo.total;
vc.component.dataPrivilegeUnitInfo.records = _dataPrivilegeUnitInfo.records; vc.component.dataPrivilegeUnitInfo.records = _dataPrivilegeUnitInfo.records;
@ -52,34 +51,34 @@
dataCount: vc.component.dataPrivilegeUnitInfo.total, dataCount: vc.component.dataPrivilegeUnitInfo.total,
currentPage: _page currentPage: _page
}); });
}, function (errInfo, error) { },
function(errInfo, error) {
console.log('请求失败处理'); console.log('请求失败处理');
} }
); );
}, },
_openAddDataPrivilegeUnitModal: function () { _openAddDataPrivilegeUnitModal: function() {
vc.emit('addDataPrivilegeUnit', 'openAddDataPrivilegeUnitModal', { vc.emit('addDataPrivilegeUnit', 'openAddDataPrivilegeUnitModal', {
dpId: vc.component.dataPrivilegeUnitInfo.dpId, dpId: vc.component.dataPrivilegeUnitInfo.dpId,
}); });
}, },
_openDeleteDataPrivilegeUnitModel: function (_dataPrivilegeUnit) { _openDeleteDataPrivilegeUnitModel: function(_dataPrivilegeUnit) {
vc.emit('deleteDataPrivilegeUnit', 'openDeleteDataPrivilegeUnitModal', _dataPrivilegeUnit); vc.emit('deleteDataPrivilegeUnit', 'openDeleteDataPrivilegeUnitModal', _dataPrivilegeUnit);
}, },
_openBeyondDataPrivilegeUnit: function (_dataPrivilegeUnit) { _openBeyondDataPrivilegeUnit: function(_dataPrivilegeUnit) {},
}, _queryDataPrivilegeUnitMethod: function() {
_queryDataPrivilegeUnitMethod: function () {
vc.component._listDataPrivilegeUnits(DEFAULT_PAGE, DEFAULT_ROWS); vc.component._listDataPrivilegeUnits(DEFAULT_PAGE, DEFAULT_ROWS);
}, },
_moreCondition: function () { _moreCondition: function() {
if (vc.component.dataPrivilegeUnitInfo.moreCondition) { if (vc.component.dataPrivilegeUnitInfo.moreCondition) {
vc.component.dataPrivilegeUnitInfo.moreCondition = false; vc.component.dataPrivilegeUnitInfo.moreCondition = false;
} else { } else {
vc.component.dataPrivilegeUnitInfo.moreCondition = true; vc.component.dataPrivilegeUnitInfo.moreCondition = true;
} }
}, },
_goBack: function () { _goBack: function() {
vc.emit('orgManage', 'onBack', {}); vc.emit('orgManage', 'onBack', {});
} }
} }
}); });
})(window.vc); })(window.vc);