| | |
| | | }, |
| | | _initMethod: function () { |
| | | $that = vc.component; |
| | | // 从URL获取costDetailId |
| | | var costDetailId = vc.getParam('costDetailId'); |
| | | if (costDetailId) { |
| | | $that.costDetailInfo.costDetailId = costDetailId; |
| | |
| | | }, |
| | | methods: { |
| | | _loadCostDetail: function () { |
| | | // 查询所有数据,然后找到匹配的记录 |
| | | var params = { |
| | | communityName: vc.getCurrentCommunity().name, |
| | | page: 1, |
| | | row: 1000 // 查询足够多的数据以找到目标记录 |
| | | row: 1000 |
| | | }; |
| | | |
| | | var param = { |
| | |
| | | var records = Array.isArray(_json.data) ? _json.data : []; |
| | | console.log('查询到记录数:', records.length); |
| | | |
| | | // 查找匹配的记录 - 支持字符串和数字类型的ID比较 |
| | | var foundItem = null; |
| | | var targetId = String($that.costDetailInfo.costDetailId); |
| | | for (var i = 0; i < records.length; i++) { |
| | |
| | | _fillDetailData: function (item) { |
| | | console.log('开始填充详情数据,原始数据:', item); |
| | | |
| | | // 填充详情数据 |
| | | var dateStr = ''; |
| | | if (item.date) { |
| | | // 如果日期格式是 yyyy-mm-dd 或 yyyy-mm-dd HH:mm:ss,只取日期部分 |
| | | dateStr = item.date.substring(0, 10); |
| | | } else if (item.year && item.month) { |
| | | var monthStr = item.month < 10 ? '0' + item.month : String(item.month); |
| | | var dayStr = item.day ? (item.day < 10 ? '0' + item.day : String(item.day)) : '01'; |
| | | dateStr = item.year + '-' + monthStr + '-' + dayStr; |
| | | } else if (item.year && item.month) { |
| | | // 只有年月的情况 |
| | | var monthStr = item.month < 10 ? '0' + item.month : String(item.month); |
| | | dateStr = item.year + '-' + monthStr; |
| | | } |
| | | |
| | | // 使用Vue.set或者直接赋值来确保响应式更新 |
| | | vc.component.costDetailInfo.flowCode = item.flowNumber || ''; |
| | | vc.component.costDetailInfo.date = dateStr; |
| | | vc.component.costDetailInfo.communityName = item.projectName || ''; |
| | |
| | | vc.component.costDetailInfo.fundTypeLevel1 = item.fundTypeLevel1 || ''; |
| | | vc.component.costDetailInfo.fundTypeLevel2 = item.fundTypeLevel2 || ''; |
| | | |
| | | // 处理buildingType字段 |
| | | var buildingType = item.buildingOrAll || '1'; |
| | | if (buildingType === '全体' || buildingType === '2' || buildingType === 2) { |
| | | vc.component.costDetailInfo.buildingType = '全体'; |