109 lines
4.5 KiB
JavaScript
109 lines
4.5 KiB
JavaScript
/**
|
|
入驻小区
|
|
**/
|
|
(function (vc) {
|
|
var DEFAULT_PAGE = 1;
|
|
var DEFAULT_ROWS = 1000;
|
|
vc.extends({
|
|
data: {
|
|
inspectionPointInfo: {
|
|
points: [],
|
|
point: {},
|
|
total: 0,
|
|
records: 1,
|
|
moreCondition: false,
|
|
inspectionName: '',
|
|
pointObjTypes: [],
|
|
_currentTab: 'pointTaskDetail',
|
|
conditions: {
|
|
inspectionId: '',
|
|
machineId: '',
|
|
inspectionName: '',
|
|
machineCode: '',
|
|
pointObjType: ''
|
|
}
|
|
}
|
|
},
|
|
_initMethod: function () {
|
|
//与字典表关联
|
|
vc.getDict('inspection_point', "point_obj_type", function (_data) {
|
|
$that.inspectionPointInfo.pointObjTypes = _data;
|
|
});
|
|
$that._listInspectionPoints(DEFAULT_PAGE, DEFAULT_ROWS);
|
|
},
|
|
_initEvent: function () {
|
|
vc.on('inspectionPoint', 'listInspectionPoint', function (_param) {
|
|
$that._listInspectionPoints(DEFAULT_PAGE, DEFAULT_ROWS);
|
|
});
|
|
vc.on('pagination', 'page_event', function (_currentPage) {
|
|
$that._listInspectionPoints(_currentPage, DEFAULT_ROWS);
|
|
});
|
|
},
|
|
methods: {
|
|
_listInspectionPoints: function (_page, _rows) {
|
|
$that.inspectionPointInfo.conditions.page = _page;
|
|
$that.inspectionPointInfo.conditions.row = _rows;
|
|
$that.inspectionPointInfo.conditions.communityId = vc.getCurrentCommunity().communityId;
|
|
let param = {
|
|
params: $that.inspectionPointInfo.conditions
|
|
};
|
|
param.params.inspectionName = param.params.inspectionName.trim();
|
|
//发送get请求
|
|
vc.http.apiGet('/inspectionPoint.listInspectionPoints',
|
|
param,
|
|
function (json, res) {
|
|
let _json = JSON.parse(json);
|
|
$that.inspectionPointInfo.total = _json.total;
|
|
$that.inspectionPointInfo.records = _json.records;
|
|
$that.inspectionPointInfo.points = _json.inspectionPoints;
|
|
if (_json.inspectionPoints && _json.inspectionPoints.length > 0) {
|
|
|
|
$that._switchInspectionPoint(_json.inspectionPoints[0]);
|
|
}
|
|
// vc.emit('pagination', 'init', {
|
|
// total: $that.inspectionPointInfo.records,
|
|
// dataCount: $that.inspectionPointInfo.total,
|
|
// currentPage: _page
|
|
// });
|
|
},
|
|
function (errInfo, error) {
|
|
console.log('请求失败处理');
|
|
}
|
|
);
|
|
},
|
|
_openAddInspectionPointModal: function () {
|
|
vc.emit('addInspectionPoint', 'openAddInspectionPointModal', {});
|
|
},
|
|
_openEditInspectionPointModel: function (_inspectionPoint) {
|
|
vc.emit('editInspectionPoint', 'openEditInspectionPointModal', _inspectionPoint);
|
|
},
|
|
_openDeleteInspectionPointModel: function (_inspectionPoint) {
|
|
vc.emit('deleteInspectionPoint', 'openDeleteInspectionPointModal', _inspectionPoint);
|
|
},
|
|
//查询
|
|
_queryInspectionPointMethod: function () {
|
|
$that._listInspectionPoints(DEFAULT_PAGE, DEFAULT_ROWS);
|
|
},
|
|
//重置
|
|
_switchInspectionPoint: function (_point) {
|
|
$that.inspectionPointInfo.point = _point;
|
|
$that.changeTab($that.inspectionPointInfo._currentTab);
|
|
},
|
|
changeTab: function (_tab) {
|
|
$that.inspectionPointInfo._currentTab = _tab;
|
|
vc.emit(_tab, 'switch', $that.inspectionPointInfo.point);
|
|
},
|
|
_moreCondition: function () {
|
|
if ($that.inspectionPointInfo.moreCondition) {
|
|
$that.inspectionPointInfo.moreCondition = false;
|
|
} else {
|
|
$that.inspectionPointInfo.moreCondition = true;
|
|
}
|
|
},
|
|
_pointQrCode: function (_inspectionPoint) {
|
|
vc.emit('inspectionPointQrCode', 'openInspectionPointQrCodeModal', _inspectionPoint);
|
|
|
|
}
|
|
}
|
|
});
|
|
})(window.vc); |