| | |
| | | }, |
| | | methods: { |
| | | _initDate: function () { |
| | | // 年份输入框不需要特殊初始化,使用 v-model 双向绑定即可 |
| | | }, |
| | | _loadCommunityList: function () { |
| | | // 获取所有小区列表 |
| | | var communityInfos = vc.getCommunitys(); |
| | | if (communityInfos && Array.isArray(communityInfos) && communityInfos.length > 0) { |
| | | $that.costDetailInfo.communityList = communityInfos; |
| | | // 默认选择第一个小区 |
| | | $that.costDetailInfo.conditions.communityName = communityInfos[0].name; |
| | | } else { |
| | | // 如果获取不到列表,使用当前小区 |
| | | var currentCommunity = vc.getCurrentCommunity(); |
| | | if (currentCommunity && currentCommunity.name) { |
| | | $that.costDetailInfo.communityList = [currentCommunity]; |
| | | $that.costDetailInfo.conditions.communityName = currentCommunity.name; |
| | | } |
| | | } |
| | | // 加载数据 |
| | | $that._listCostDetails(DEFAULT_PAGE, DEFAULT_ROWS); |
| | | }, |
| | | _listCostDetails: function (_page, _rows) { |
| | | // 使用选中的小区名称,如果没有选中则使用当前小区名称 |
| | | var selectedCommunityName = $that.costDetailInfo.conditions.communityName || vc.getCurrentCommunity().name; |
| | | var params = { |
| | | communityName: selectedCommunityName, |
| | | page: _page, |
| | | row: _rows |
| | | }; |
| | | |
| | | // 添加可选查询参数 |
| | | |
| | | if ($that.costDetailInfo.conditions.flowNumber) { |
| | | params.flowNumber = $that.costDetailInfo.conditions.flowNumber; |
| | | } |
| | |
| | | if ($that.costDetailInfo.conditions.projectName) { |
| | | params.projectName = $that.costDetailInfo.conditions.projectName; |
| | | } |
| | | |
| | | |
| | | var param = { |
| | | params: params |
| | | }; |
| | | |
| | | |
| | | vc.http.apiGet('/maintenancePayment/queryMaintenancePayment', |
| | | param, |
| | | function (json, res) { |
| | | try { |
| | | var _json = JSON.parse(json); |
| | | |
| | | |
| | | if (_json.code === 0 && _json.data) { |
| | | var records = Array.isArray(_json.data) ? _json.data : []; |
| | | |
| | | var mappedRecords = records.map(function(item) { |
| | | |
| | | var mappedRecords = records.map(function (item) { |
| | | var dateStr = ''; |
| | | if (item.date) { |
| | | dateStr = item.date.substring(0, 7); |
| | |
| | | var monthStr = item.month < 10 ? '0' + item.month : String(item.month); |
| | | dateStr = item.year + '-' + monthStr; |
| | | } |
| | | |
| | | |
| | | return { |
| | | flowCode: item.flowNumber || '--', |
| | | communityCode: item.projectCode || '--', |
| | |
| | | _originalData: item |
| | | }; |
| | | }); |
| | | |
| | | |
| | | var total = _json.total || 0; |
| | | var totalPages = _json.records || 1; |
| | | |
| | | |
| | | $that.costDetailInfo.paginationInfo.dataCount = total; |
| | | $that.costDetailInfo.paginationInfo.total = totalPages; |
| | | $that.costDetailInfo.costDetails = mappedRecords; |
| | |
| | | var currentPage = $that.costDetailInfo.paginationInfo.currentPage; |
| | | var total = $that.costDetailInfo.paginationInfo.total; |
| | | var pageList = []; |
| | | |
| | | |
| | | if (total <= 7) { |
| | | for (var i = 1; i <= total; i++) { |
| | | pageList.push({ |
| | |
| | | }); |
| | | } |
| | | } |
| | | |
| | | |
| | | $that.costDetailInfo.paginationInfo.pageList = pageList; |
| | | }, |
| | | _queryCostDetails: function () { |
| | | $that._listCostDetails(DEFAULT_PAGE, $that.costDetailInfo.paginationInfo.rows); |
| | | }, |
| | | _resetQuery: function () { |
| | | // 重置时恢复为第一个小区 |
| | | if ($that.costDetailInfo.communityList && $that.costDetailInfo.communityList.length > 0) { |
| | | $that.costDetailInfo.conditions.communityName = $that.costDetailInfo.communityList[0].name; |
| | | } else { |
| | |
| | | $that._listCostDetails(page, $that.costDetailInfo.paginationInfo.rows); |
| | | }, |
| | | _downloadTemplate: function () { |
| | | // 下载模板 |
| | | vc.toast('模板下载功能'); |
| | | }, |
| | | _importCostDetail: function () { |
| | | // 打开本地文件 |
| | | vc.toast('费用导入功能'); |
| | | }, |
| | | _addCostDetail: function () { |
| | | // 跳转到添加页面 |
| | | vc.jumpToPage('/#/pages/property/costDetail/add'); |
| | | }, |
| | | _viewCostDetail: function (_item) { |
| | | // 查看详情 |
| | | vc.jumpToPage('/#/pages/property/costDetail/detail?costDetailId=' + _item.costDetailId); |
| | | }, |
| | | _viewMore: function (_item) { |
| | | // 查看更多 |
| | | vc.jumpToPage('/#/pages/property/costDetail/more?costDetailId=' + _item.costDetailId); |
| | | }, |
| | | _editCostDetail: function (_item) { |
| | | // 编辑 |
| | | vc.jumpToPage('/#/pages/property/costDetail/edit?costDetailId=' + _item.costDetailId); |
| | | }, |
| | | _deleteCostDetail: function (_item) { |
| | |
| | | }; |
| | | vc.http.apiPost('/maintenancePayment/deleteMaintenancePayment', |
| | | JSON.stringify(param), { |
| | | headers: { |
| | | 'Content-Type': 'application/json' |
| | | } |
| | | }, |
| | | headers: { |
| | | 'Content-Type': 'application/json' |
| | | } |
| | | }, |
| | | function (json, res) { |
| | | try { |
| | | var _json = JSON.parse(json); |
| | |
| | | ); |
| | | }); |
| | | } else { |
| | | // 如果 vc.confirm 不存在,使用 window.confirm 作为后备方案 |
| | | if (window.confirm('确定要删除这条费用明细吗?')) { |
| | | var param = { |
| | | id: _item.costDetailId, |
| | |
| | | }; |
| | | vc.http.apiPost('/maintenancePayment/deleteMaintenancePayment', |
| | | JSON.stringify(param), { |
| | | headers: { |
| | | 'Content-Type': 'application/json' |
| | | } |
| | | }, |
| | | headers: { |
| | | 'Content-Type': 'application/json' |
| | | } |
| | | }, |
| | | function (json, res) { |
| | | try { |
| | | var _json = JSON.parse(json); |