费用明细表,查询,编辑,删除,添加接口对接,公益金表接口对接,页面样式优化
13个文件已修改
1213 ■■■■ 已修改文件
public/css/vc.css 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
public/pages/property/costDetail/add/add.html 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
public/pages/property/costDetail/add/add.js 110 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
public/pages/property/costDetail/costDetail.html 66 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
public/pages/property/costDetail/costDetail.js 256 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
public/pages/property/costDetail/detail/detail.html 57 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
public/pages/property/costDetail/detail/detail.js 165 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
public/pages/property/costDetail/edit/edit.html 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
public/pages/property/costDetail/edit/edit.js 243 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
public/pages/property/costDetail/more/more.html 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
public/pages/property/costDetail/more/more.js 133 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
public/vcCore/core.js 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
public/vcCore/vcFramework.js 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
public/css/vc.css
@@ -1380,7 +1380,7 @@
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #e8e8e8;
    font-size: 14px;
    font-size: 12px;
    background: #fff;
    margin-bottom: 0;
}
@@ -1416,7 +1416,7 @@
.cost-detail-container table td a {
    color: #1677ff;
    text-decoration: none;
    margin-right: 12px;
    margin-right: 10px;
    cursor: pointer;
    white-space: nowrap;
}
@@ -1607,6 +1607,45 @@
    cursor: pointer;
}
.form-container .form-row .form-label {
    padding: 12px 0 15px 0;
    margin: 0px;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    text-align: right;
    vertical-align: middle;
    line-height: 32px;
}
.form-label-detail{
    padding: 0px 0 15px 0;
    margin: 0px;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    text-align: right;
    vertical-align: middle;
    line-height: 32px;
}
.form-container .form-row p {
    margin-right: 15px;
}
#ownerScope{
    position: relative;
    top: 12px;
    width: 180px;
    height: 32px;
}
#buildingScope{
    position: relative;
    top: 12px;
    width: 180px;
    height: 32px;
}
#button-container,
#data-container {
    display: flex;
public/pages/property/costDetail/add/add.html
@@ -4,35 +4,35 @@
        <!-- 流转编码 + 日期 -->
        <div class="form-row">
            <label class="form-label" for="flowCode">流转编码</label>
            <input type="text" id="flowCode" class="form-input" placeholder="请输入">
            <input type="text" id="flowCode" class="form-input" placeholder="请输入" v-model="costDetailInfo.flowCode">
            <label class="form-label" for="date">日期</label>
            <input type="date" id="date" class="form-input" placeholder="yyyy/mm/日">
            <input type="date" id="date" class="form-input" placeholder="yyyy/mm/日" v-model="costDetailInfo.date">
        </div>
        <!-- 小区名称 + 小区编码(带备注) -->
        <div class="form-row">
            <label class="form-label" for="communityName">小区名称</label>
            <input type="text" id="communityName" class="form-input" placeholder="请输入">
            <input type="text" id="communityName" class="form-input" placeholder="请输入" v-model="costDetailInfo.communityName">
            <label class="form-label">小区编码</label>
            <input type="text" id="communityCode" class="form-input" placeholder="请输入">
            <input type="text" id="communityCode" class="form-input" placeholder="请输入" v-model="costDetailInfo.communityCode">
        </div>
        <!-- 工程内容 -->
        <div class="form-row">
            <label class="form-label" for="projectContent">工程内容</label>
            <input type="text" id="projectContent" class="form-input" placeholder="请输入" style="width: 555px;">
            <input type="text" id="projectContent" class="form-input" placeholder="请输入" style="width: 555px;" v-model="costDetailInfo.projectContent">
        </div>
        <!-- 管理处金额 + 是否盖章 -->
        <div class="form-row">
            <label class="form-label" for="mgmtAmount">管理处金额</label>
            <input type="text" id="mgmtAmount" class="form-input" placeholder="请输入">
            <input type="text" id="mgmtAmount" class="form-input" placeholder="请输入" v-model="costDetailInfo.managementAmount">
            <span>元</span>
            <label class="form-label">是否盖章</label>
            <div class="radio-group">
                <input type="radio" id="mgmtSealYes" name="mgmtSeal" checked>
                <input type="radio" id="mgmtSealYes" name="mgmtSeal" value="1" v-model="costDetailInfo.managementStamped">
                <label for="mgmtSealYes" style="margin-top: 8px;">是</label>
                <input type="radio" id="mgmtSealNo" name="mgmtSeal">
                <input type="radio" id="mgmtSealNo" name="mgmtSeal" value="0" v-model="costDetailInfo.managementStamped">
                <label for="mgmtSealNo" style="margin-top: 8px;">否</label>
            </div>
        </div>
@@ -40,49 +40,43 @@
        <!-- 业委会金额 + 审价金额 + 是否盖章 + 签报部门 -->
        <div class="form-row">
            <label class="form-label" for="committeeAmount">业委会金额</label>
            <input type="text" id="committeeAmount" class="form-input" placeholder="请输入">
            <input type="text" id="committeeAmount" class="form-input" placeholder="请输入" v-model="costDetailInfo.committeeAmount">
            <span>元</span>
            <label class="form-label" for="auditAmount">审价金额</label>
            <input type="text" id="auditAmount" class="form-input" placeholder="请输入">
            <input type="text" id="auditAmount" class="form-input" placeholder="请输入" v-model="costDetailInfo.appraisalAmount">
            <span>元</span>
            <label class="form-label">是否盖章</label>
            <div class="radio-group">
                <input type="radio" id="committeeSealYes" name="committeeSeal" checked>
                <input type="radio" id="committeeSealYes" name="committeeSeal" value="1" v-model="costDetailInfo.committeeStamped">
                <label for="committeeSealYes" style="margin-top: 8px;">是</label>
                <input type="radio" id="committeeSealNo" name="committeeSeal">
                <input type="radio" id="committeeSealNo" name="committeeSeal" value="0" v-model="costDetailInfo.committeeStamped">
                <label for="committeeSealNo" style="margin-top: 8px;">否</label>
            </div>
            <label class="form-label" for="approveDept">签报部门</label>
            <select id="approveDept" class="form-select">
                <option value="1">1</option>
            </select>
            <input type="text" id="approveDept" class="form-input" placeholder="请输入" v-model="costDetailInfo.approvalDepartment" style="width: 120px;">
        </div>
        <!-- 分摊范围 + 维修类型 -->
        <div class="form-row">
            <label class="form-label">分摊范围</label>
            <div class="radio-group">
                <input type="radio" id="shareBuilding" name="shareScope" checked>
                <input type="radio" id="shareBuilding" name="shareScope" value="1" v-model="costDetailInfo.buildingType">
                <label for="shareBuilding" style="margin-top: 8px;">幢</label>
                <input type="radio" id="shareAll" name="shareScope">
                <input type="radio" id="shareAll" name="shareScope" value="全体" v-model="costDetailInfo.buildingType">
                <label for="shareAll" style="margin-top: 8px;">全体</label>
            </div>
            <label class="form-label" for="repairType">维修类型</label>
            <select id="repairType" class="form-select">
                <option value="1">1</option>
                <option value="2">2</option>
                <option value="3">3</option>
            </select>
            <input type="text" id="repairType" class="form-input" placeholder="请输入" v-model="costDetailInfo.maintenanceType" style="width: 120px;">
        </div>
        <!-- 基金与设施 + 业主大会范围 + 门牌幢范围 -->
        <div class="form-row">
            <label class="form-label">基金与设施</label>
            <div class="radio-group">
                <input type="radio" id="fundRepair" name="fundType" value="repair" v-model="fundType">
                <input type="radio" id="fundRepair" name="fundType" value="repair" v-model="costDetailInfo.fundType">
                <label for="fundRepair" style="margin-top: 8px;">维修资金</label>
            </div>
            <div class="radio-group" style="margin-left: 100px;" v-if="fundType === 'repair'">
            <div class="radio-group" style="margin-left: 100px;" v-if="costDetailInfo.fundType === 'repair'">
                <label class="form-label" for="ownerScope">业主大会范围</label>
                <select id="ownerScope" class="form-select">
                    <option value="multi">多选</option>
@@ -96,21 +90,21 @@
        <div class="form-row">
            <div class="radio-group" style="margin-left: 100px;">
                <input type="radio" id="fundPublic" name="fundType" value="public" v-model="fundType">
                <input type="radio" id="fundPublic" name="fundType" value="public" v-model="costDetailInfo.fundType">
                <label for="fundPublic" style="margin-top: 8px;">公共收益</label>
            </div>
            <div class="radio-group" style="margin-left: 100px;" v-if="fundType === 'public'">
                <input type="radio" id="fundSystemOut" name="fundSystemType" value="out" v-model="fundSystemType">
            <div class="radio-group" style="margin-left: 100px;" v-if="costDetailInfo.fundType === 'public'">
                <input type="radio" id="fundSystemOut" name="fundSystemType" value="out" v-model="costDetailInfo.fundSystemType">
                <label for="fundSystemOut" style="margin-top: 8px;">系统外</label>
                <input type="radio" id="fundSystemIn" name="fundSystemType" value="in" v-model="fundSystemType">
                <input type="radio" id="fundSystemIn" name="fundSystemType" value="in" v-model="costDetailInfo.fundSystemType">
                <label for="fundSystemIn" style="margin-top: 8px;">系统内</label>
            </div>
        </div>
        <!-- 按钮组 -->
        <div class="btn-group">
            <button type="button" class="btn-cancel">取消</button>
            <button type="button" class="btn-save">保存</button>
            <button type="button" class="btn-cancel" v-on:click="_cancel()">取消</button>
            <button type="button" class="btn-save" v-on:click="_saveCostDetail()">保存</button>
        </div>
    </form>
</div>
public/pages/property/costDetail/add/add.js
@@ -1,9 +1,113 @@
/**
 添加费用明细
 **/
(function (vc) {
    var $that = {};
    vc.extends({
        data: {
            fundType: 'repair', // 默认选中维修资金
            fundSystemType: 'out' // 默认选中系统外
            costDetailInfo: {
                flowCode: '',
                date: '',
                communityName: '',
                communityCode: '',
                projectContent: '',
                managementAmount: '',
                managementStamped: '1',
                committeeAmount: '',
                appraisalAmount: '',
                committeeStamped: '1',
                approvalDepartment: '',
                fundTypeLevel1: '',
                fundTypeLevel2: '',
                buildingType: '1',
                maintenanceType: '',
                fundType: 'repair', // 默认选中维修资金
                fundSystemType: 'out' // 默认选中系统外
            }
        },
        _initMethod: function () {
            $that = vc.component;
        },
        methods: {
            _saveCostDetail: function () {
                // 验证必填字段
                if (!$that.costDetailInfo.flowCode) {
                    vc.toast('请输入流转编码');
                    return;
                }
                if (!$that.costDetailInfo.date) {
                    vc.toast('请选择日期');
                    return;
                }
                if (!$that.costDetailInfo.communityName) {
                    vc.toast('请输入小区名称');
                    return;
                }
                if (!$that.costDetailInfo.communityCode) {
                    vc.toast('请输入小区编码');
                    return;
                }
                // 构建保存数据
                var saveData = {
                    flowNumber: $that.costDetailInfo.flowCode,
                    date: $that.costDetailInfo.date,
                    projectName: $that.costDetailInfo.communityName,
                    projectCode: $that.costDetailInfo.communityCode,
                    projectContent: $that.costDetailInfo.projectContent,
                    managementOfficeAmount: parseFloat($that.costDetailInfo.managementAmount) || 0,
                    managementOfficeSeal: $that.costDetailInfo.managementStamped === '1' ? '是' : '否',
                    ownersCommitteeAmount: parseFloat($that.costDetailInfo.committeeAmount) || 0,
                    auditAmount: parseFloat($that.costDetailInfo.appraisalAmount) || 0,
                    ownersCommitteeSeal: $that.costDetailInfo.committeeStamped === '1' ? '是' : '否',
                    reportDepartment: $that.costDetailInfo.approvalDepartment || '',
                    fundTypeLevel1: $that.costDetailInfo.fundType === 'repair' ? '维修资金' : '公共收益',
                    fundTypeLevel2: $that.costDetailInfo.fundType === 'public' ? ($that.costDetailInfo.fundSystemType === 'out' ? '系统外' : '系统内') : '',
                    buildingOrAll: $that.costDetailInfo.buildingType === '全体' ? '全体' : ($that.costDetailInfo.buildingType || '1'),
                    maintenanceType: $that.costDetailInfo.maintenanceType || '',
                    communityId: vc.getCurrentCommunity().communityId
                };
                // 解析日期
                if (saveData.date) {
                    var dateParts = saveData.date.split('-');
                    if (dateParts.length >= 2) {
                        saveData.year = parseInt(dateParts[0]);
                        saveData.month = parseInt(dateParts[1]);
                        if (dateParts.length >= 3) {
                            saveData.day = parseInt(dateParts[2]);
                        }
                    }
                }
                vc.http.apiPost('/maintenancePayment/saveMaintenancePayment',
                    JSON.stringify(saveData), {
                        emulateJSON: true
                    },
                    function (json, res) {
                        try {
                            var _json = JSON.parse(json);
                            if (_json.code === 0 || _json.code === '0') {
                                vc.toast('保存成功');
                                setTimeout(function() {
                                    vc.goBack();
                                }, 1000);
                            } else {
                                vc.toast(_json.msg || '保存失败');
                            }
                        } catch (e) {
                            console.error('保存响应解析失败:', e);
                            vc.toast('保存失败');
                        }
                    },
                    function (errInfo, error) {
                        console.error('保存请求失败:', errInfo, error);
                        vc.toast('保存失败,请检查网络连接');
                    }
                );
            },
            _cancel: function () {
                vc.goBack();
            }
        }
    });
})(window.vc);
public/pages/property/costDetail/costDetail.html
@@ -4,14 +4,14 @@
    <!-- 搜索栏 -->
    <div class="search-bar">
        <div>
            <label>日期:</label>
            <input type="text" class="form-control queryDate" placeholder="请选择日期" v-model="costDetailInfo.conditions.date" />
            <label>年份:</label>
            <input type="date" class="form-control queryDate" placeholder="请输入年份" v-model="costDetailInfo.conditions.year" min="2000" max="2099" />
        </div>
        <div>
            <label>小区:</label>
            <select class="form-control" v-model="costDetailInfo.conditions.communityName">
                <option value="">请选择</option>
                <option value="鱼塘花园A区">鱼塘花园A区</option>
                <option v-for="community in costDetailInfo.communityList" :value="community.name">{{community.name}}</option>
            </select>
        </div>
        <div>
@@ -31,43 +31,43 @@
    <table>
        <thead>
            <tr id="costDetailTableHead">
                <th>序号</th>
                <th>流转编码</th>
                <th>小区编码</th>
                <th>小区名称</th>
                <th>日期</th>
                <th>工程内容</th>
                <th>管理处金额 (元)</th>
                <th>是否盖章</th>
                <th>业委会金额 (元)</th>
                <th>审价金额 (元)</th>
                <th>是否盖章</th>
                <th>签报部门</th>
                <th>基金类型-一级分类</th>
                <th>基金类型-二级分类</th>
                <th>幢/全体</th>
                <th>维修类型</th>
                <th>操作</th>
                <th style="width: 8px;">序号</th>
                <th style="width: 15px;">流转编码</th>
                <th style="width: 6px;">小区编码</th>
                <th style="width: 8px;">小区名称</th>
                <th style="width: 35px;">日期</th>
                <th style="width: 200px;">工程内容</th>
                <th style="width: 6px;">管理处金额 (元)</th>
                <th style="width: 6px;">是否盖章</th>
                <th style="width: 12px;">业委会金额 (元)</th>
                <th style="width: 20px;">审价金额 (元)</th>
                <th style="width: 6px;">是否盖章</th>
                <th style="width: 8px;">签报部门</th>
                <th style="width: 12px;">基金类型-一级分类</th>
                <th style="width: 12px;">基金类型-二级分类</th>
                <th style="width: 6px;">幢/全体</th>
                <th style="width: 8px;">维修类型</th>
                <th style="width: 220px;">操作</th>
            </tr>
        </thead>
        <tbody>
            <tr v-for="(item, index) in costDetailInfo.costDetails">
                <td>{{(costDetailInfo.paginationInfo.currentPage - 1) * costDetailInfo.paginationInfo.rows + index + 1}}</td>
                <td>{{item.flowCode || '-'}}</td>
                <td>{{item.communityCode || '-'}}</td>
                <td>{{item.communityName || '-'}}</td>
                <td>{{item.date || '-'}}</td>
                <td>{{item.projectContent || '-'}}</td>
                <td>{{item.managementAmount || '-'}}</td>
                <td>{{item.flowCode || '--'}}</td>
                <td>{{item.communityCode || '--'}}</td>
                <td>{{item.communityName || '--'}}</td>
                <td>{{item.date || '--'}}</td>
                <td>{{item.projectContent || '--'}}</td>
                <td>{{item.managementAmount || '--'}}</td>
                <td>{{item.managementStamped == '1' ? '是' : '否'}}</td>
                <td>{{item.committeeAmount || '-'}}</td>
                <td>{{item.appraisalAmount || '-'}}</td>
                <td>{{item.committeeAmount || '--'}}</td>
                <td>{{item.appraisalAmount || '--'}}</td>
                <td>{{item.committeeStamped == '1' ? '是' : '否'}}</td>
                <td>{{item.approvalDepartment || '-'}}</td>
                <td>{{item.fundTypeLevel1 || '-'}}</td>
                <td>{{item.fundTypeLevel2 || '-'}}</td>
                <td>{{item.buildingType || '-'}}</td>
                <td>{{item.maintenanceType || '-'}}</td>
                <td>{{item.approvalDepartment || '--'}}</td>
                <td>{{item.fundTypeLevel1 || '--'}}</td>
                <td>{{item.fundTypeLevel2 || '--'}}</td>
                <td>{{item.buildingType || '--'}}</td>
                <td>{{item.maintenanceType || '--'}}</td>
                <td>
                    <a href="javascript:void(0)" v-on:click="_viewCostDetail(item)">详情</a>
                    <a href="javascript:void(0)" v-on:click="_viewMore(item)">更多</a>
public/pages/property/costDetail/costDetail.js
@@ -9,6 +9,7 @@
        data: {
            costDetailInfo: {
                costDetails: [],
                communityList: [],
                paginationInfo: {
                    currentPage: 1,
                    rows: DEFAULT_ROWS,
@@ -20,14 +21,21 @@
                conditions: {
                    date: '',
                    communityName: '',
                    communityCode: ''
                    communityCode: '',
                    communityId: vc.getCurrentCommunity().communityId,
                    flowNumber: '',
                    projectCode: '',
                    year: '',
                    projectName: '',
                    _communityName: vc.getCurrentCommunity().name
                }
            }
        },
        _initMethod: function () {
            $that = vc.component;
            $that._injectStyles();
            $that._listCostDetails(DEFAULT_PAGE, DEFAULT_ROWS);
            $that.costDetailInfo.conditions.communityId = vc.getCurrentCommunity().communityId;
            $that.costDetailInfo.conditions._communityName = vc.getCurrentCommunity().name;
            $that._loadCommunityList();
            $that._initDate();
        },
        _initEvent: function () {
@@ -37,48 +45,118 @@
        },
        methods: {
            _initDate: function () {
                $(".queryDate").datetimepicker({
                    language: 'zh-CN',
                    fontAwesome: 'fa',
                    format: 'yyyy-mm-dd hh:ii:ss',
                    initTime: true,
                    initialDate: new Date(),
                    autoClose: 1,
                    todayBtn: true
                });
                $('.queryDate').datetimepicker()
                    .on('changeDate', function (ev) {
                        var value = $(".queryDate").val();
                        $that.costDetailInfo.conditions.date = value;
                    });
                //防止多次点击时间插件失去焦点
                var queryDateElements = document.getElementsByClassName('form-control queryDate');
                if (queryDateElements.length > 0) {
                    queryDateElements[0].addEventListener('click', function(e) {
                        e.currentTarget.blur();
                    });
                // 年份输入框不需要特殊初始化,使用 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) {
                $that.costDetailInfo.conditions.page = _page;
                $that.costDetailInfo.conditions.row = _rows;
                $that.costDetailInfo.conditions.communityId = vc.getCurrentCommunity().communityId;
                var param = {
                    params: $that.costDetailInfo.conditions
                // 使用选中的小区名称,如果没有选中则使用当前小区名称
                var selectedCommunityName = $that.costDetailInfo.conditions.communityName || vc.getCurrentCommunity().name;
                var params = {
                    communityName: selectedCommunityName,
                    page: _page,
                    row: _rows
                };
                //发送get请求
                vc.http.apiGet('/costDetail/queryCostDetail',
                // 添加可选查询参数
                if ($that.costDetailInfo.conditions.flowNumber) {
                    params.flowNumber = $that.costDetailInfo.conditions.flowNumber;
                }
                if ($that.costDetailInfo.conditions.projectCode) {
                    params.projectCode = $that.costDetailInfo.conditions.projectCode;
                }
                if ($that.costDetailInfo.conditions.year) {
                    params.year = parseInt($that.costDetailInfo.conditions.year);
                }
                if ($that.costDetailInfo.conditions.projectName) {
                    params.projectName = $that.costDetailInfo.conditions.projectName;
                }
                var param = {
                    params: params
                };
                vc.http.apiGet('/maintenancePayment/queryMaintenancePayment',
                    param,
                    function (json, res) {
                        var _json = JSON.parse(json);
                        $that.costDetailInfo.paginationInfo.dataCount = _json.total || 0;
                        $that.costDetailInfo.paginationInfo.total = _json.records || 1;
                        $that.costDetailInfo.costDetails = _json.data || [];
                        $that.costDetailInfo.paginationInfo.currentPage = _page;
                        $that._freshPageList();
                        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 dateStr = '';
                                    if (item.date) {
                                        dateStr = item.date.substring(0, 7);
                                    } else if (item.year && item.month) {
                                        var monthStr = item.month < 10 ? '0' + item.month : String(item.month);
                                        dateStr = item.year + '-' + monthStr;
                                    }
                                    return {
                                        flowCode: item.flowNumber || '--',
                                        communityCode: item.projectCode || '--',
                                        communityName: item.projectName || '--',
                                        date: dateStr,
                                        projectContent: item.projectContent || '--',
                                        managementAmount: item.managementOfficeAmount || '--',
                                        managementStamped: item.managementOfficeSeal === '是' ? '1' : '0',
                                        committeeAmount: item.ownersCommitteeAmount || '--',
                                        appraisalAmount: item.auditAmount || '--',
                                        committeeStamped: item.ownersCommitteeSeal === '是' ? '1' : '0',
                                        approvalDepartment: item.reportDepartment || '--',
                                        fundTypeLevel1: item.fundTypeLevel1 || '--',
                                        fundTypeLevel2: item.fundTypeLevel2 || '--',
                                        buildingType: item.buildingOrAll || '--',
                                        maintenanceType: item.maintenanceType || '--',
                                        costDetailId: item.id,
                                        _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;
                                $that.costDetailInfo.paginationInfo.currentPage = _page;
                                $that._freshPageList();
                            } else {
                                console.error('接口返回错误:', _json.msg || '未知错误', _json);
                                vc.toast(_json.msg || '查询失败');
                                $that.costDetailInfo.costDetails = [];
                                $that.costDetailInfo.paginationInfo.dataCount = 0;
                                $that.costDetailInfo.paginationInfo.total = 1;
                                $that._freshPageList();
                            }
                        } catch (e) {
                            vc.toast('数据解析失败');
                            $that.costDetailInfo.costDetails = [];
                            $that.costDetailInfo.paginationInfo.dataCount = 0;
                            $that.costDetailInfo.paginationInfo.total = 1;
                            $that._freshPageList();
                        }
                    },
                    function (errInfo, error) {
                        console.log('请求失败处理');
                        vc.toast('请求失败,请检查网络连接');
                        $that.costDetailInfo.costDetails = [];
                        $that.costDetailInfo.paginationInfo.dataCount = 0;
                        $that.costDetailInfo.paginationInfo.total = 1;
@@ -92,7 +170,6 @@
                var pageList = [];
                
                if (total <= 7) {
                    // 总页数小于等于7,显示所有页码
                    for (var i = 1; i <= total; i++) {
                        pageList.push({
                            page: i,
@@ -101,9 +178,7 @@
                        });
                    }
                } else {
                    // 总页数大于7,显示部分页码
                    if (currentPage <= 4) {
                        // 当前页在前4页
                        for (var i = 1; i <= 5; i++) {
                            pageList.push({
                                page: i,
@@ -122,7 +197,6 @@
                            currentPage: false
                        });
                    } else if (currentPage >= total - 3) {
                        // 当前页在后4页
                        pageList.push({
                            page: 1,
                            pageView: 1,
@@ -141,7 +215,6 @@
                            });
                        }
                    } else {
                        // 当前页在中间
                        pageList.push({
                            page: 1,
                            pageView: 1,
@@ -178,9 +251,17 @@
                $that._listCostDetails(DEFAULT_PAGE, $that.costDetailInfo.paginationInfo.rows);
            },
            _resetQuery: function () {
                $that.costDetailInfo.conditions.date = '';
                $that.costDetailInfo.conditions.communityName = '';
                // 重置时恢复为第一个小区
                if ($that.costDetailInfo.communityList && $that.costDetailInfo.communityList.length > 0) {
                    $that.costDetailInfo.conditions.communityName = $that.costDetailInfo.communityList[0].name;
                } else {
                    $that.costDetailInfo.conditions.communityName = '';
                }
                $that.costDetailInfo.conditions.communityCode = '';
                $that.costDetailInfo.conditions.flowNumber = '';
                $that.costDetailInfo.conditions.projectCode = '';
                $that.costDetailInfo.conditions.year = '';
                $that.costDetailInfo.conditions.projectName = '';
                $('.queryDate').val('');
                $that._listCostDetails(DEFAULT_PAGE, $that.costDetailInfo.paginationInfo.rows);
            },
@@ -228,23 +309,76 @@
                vc.jumpToPage('/#/pages/property/costDetail/edit?costDetailId=' + _item.costDetailId);
            },
            _deleteCostDetail: function (_item) {
                vc.confirm('确定要删除这条费用明细吗?', function () {
                    var param = {
                        params: {
                            costDetailId: _item.costDetailId
                        }
                    };
                    vc.http.apiPost('/costDetail/deleteCostDetail',
                        param,
                        function (json, res) {
                            vc.toast('删除成功');
                            $that._listCostDetails($that.costDetailInfo.paginationInfo.currentPage, $that.costDetailInfo.paginationInfo.rows);
                        },
                        function (errInfo, error) {
                            vc.message(errInfo);
                        }
                    );
                });
                if (!_item || !_item.costDetailId) {
                    vc.toast('删除失败:缺少必要的数据');
                    return;
                }
                if (typeof vc.confirm === 'function') {
                    vc.confirm('确定要删除这条费用明细吗?', function () {
                        var param = {
                            id: _item.costDetailId,
                            communityId: vc.getCurrentCommunity().communityId
                        };
                        vc.http.apiPost('/maintenancePayment/deleteMaintenancePayment',
                            JSON.stringify(param), {
                                headers: {
                                    'Content-Type': 'application/json'
                                }
                            },
                            function (json, res) {
                                try {
                                    var _json = JSON.parse(json);
                                    if (_json.code === 0 || _json.code === '0') {
                                        vc.toast(_json.msg || '删除成功');
                                        $that._listCostDetails($that.costDetailInfo.paginationInfo.currentPage, $that.costDetailInfo.paginationInfo.rows);
                                    } else {
                                        vc.toast(_json.msg || '删除失败');
                                    }
                                } catch (e) {
                                    console.error('删除响应解析失败:', e);
                                    vc.toast('删除失败,请重试');
                                }
                            },
                            function (errInfo, error) {
                                console.error('删除请求失败:', errInfo, error);
                                vc.toast(errInfo || '删除失败,请检查网络连接');
                            }
                        );
                    });
                } else {
                    // 如果 vc.confirm 不存在,使用 window.confirm 作为后备方案
                    if (window.confirm('确定要删除这条费用明细吗?')) {
                        var param = {
                            id: _item.costDetailId,
                            communityId: vc.getCurrentCommunity().communityId
                        };
                        vc.http.apiPost('/maintenancePayment/deleteMaintenancePayment',
                            JSON.stringify(param), {
                                headers: {
                                    'Content-Type': 'application/json'
                                }
                            },
                            function (json, res) {
                                try {
                                    var _json = JSON.parse(json);
                                    if (_json.code === 0 || _json.code === '0') {
                                        vc.toast(_json.msg || '删除成功');
                                        $that._listCostDetails($that.costDetailInfo.paginationInfo.currentPage, $that.costDetailInfo.paginationInfo.rows);
                                    } else {
                                        vc.toast(_json.msg || '删除失败');
                                    }
                                } catch (e) {
                                    console.error('删除响应解析失败:', e);
                                    vc.toast('删除失败,请重试');
                                }
                            },
                            function (errInfo, error) {
                                console.error('删除请求失败:', errInfo, error);
                                vc.toast(errInfo || '删除失败,请检查网络连接');
                            }
                        );
                    }
                }
            }
        }
    });
public/pages/property/costDetail/detail/detail.html
@@ -1,34 +1,33 @@
<div class="form-container">
    <h2 style="font-weight: 600;">添加</h2>
    <h2 style="font-weight: 600;">详情</h2>
    <form>
        <!-- 流转编码 + 日期 -->
        <div class="form-row">
            <label class="form-label" for="flowCode">流转编码</label>
            <label class="form-label-detail" for="flowCode">流转编码</label>
            <p>{{costDetailInfo.flowCode || '-'}}</p>
            <label class="form-label" for="date">日期</label>
            <label class="form-label-detail" for="date">日期</label>
            <p>{{costDetailInfo.date || '-'}}</p>
        </div>
        <!-- 小区名称 + 小区编码(带备注) -->
        <!-- 小区名称 + 小区编码 -->
        <div class="form-row">
            <label class="form-label" for="communityName">小区名称</label>
            <label class="form-label-detail" for="communityName">小区名称</label>
            <p>{{costDetailInfo.communityName || '-'}}</p>
            <label class="form-label">小区编码</label>
            <label class="form-label-detail">小区编码</label>
            <p>{{costDetailInfo.communityCode || '-'}}</p>
        </div>
        <!-- 工程内容 -->
        <div class="form-row">
            <label class="form-label" for="projectContent">工程内容</label>
            <label class="form-label-detail" for="projectContent">工程内容</label>
            <p>{{costDetailInfo.projectContent || '-'}}</p>
        </div>
        <!-- 管理处金额 + 是否盖章 -->
        <div class="form-row">
            <label class="form-label" for="mgmtAmount">管理处金额</label>
            <p>{{costDetailInfo.managementAmount || '-'}}</p>
            <span>元</span>
            <label class="form-label">是否盖章</label>
            <label class="form-label-detail" for="mgmtAmount">管理处金额</label>
            <p>{{costDetailInfo.managementAmount || '-'}} <span>元</span></p>
            <label class="form-label-detail">是否盖章</label>
            <div class="radio-group">
                <p>{{costDetailInfo.managementStamped == '1' ? '是' : '否'}}</p>
            </div>
@@ -36,53 +35,49 @@
        <!-- 业委会金额 + 审价金额 + 是否盖章 + 签报部门 -->
        <div class="form-row">
            <label class="form-label" for="committeeAmount">业委会金额</label>
            <p>{{costDetailInfo.committeeAmount || '-'}}</p>
            <span>元</span>
            <label class="form-label" for="auditAmount">审价金额</label>
            <p>{{costDetailInfo.appraisalAmount || '-'}}</p>
            <span>元</span>
            <label class="form-label">是否盖章</label>
            <label class="form-label-detail" for="committeeAmount">业委会金额</label>
            <p>{{costDetailInfo.committeeAmount || '-'}} <span>元</span></p>
            <label class="form-label-detail" for="auditAmount">审价金额</label>
            <p>{{costDetailInfo.appraisalAmount || '-'}} <span>元</span></p>
            <label class="form-label-detail">是否盖章</label>
            <div class="radio-group">
                <p>{{costDetailInfo.committeeStamped == '1' ? '是' : '否'}}</p>
            </div>
            <label class="form-label" for="approveDept">签报部门</label>
            <label class="form-label-detail" for="approveDept">签报部门</label>
            <p>{{costDetailInfo.approvalDepartment || '-'}}</p>
        </div>
        <!-- 分摊范围 + 维修类型 -->
        <div class="form-row">
            <label class="form-label">分摊范围</label>
            <label class="form-label-detail">分摊范围</label>
            <div class="radio-group">
                <p>{{costDetailInfo.buildingType == '1' ? '幢' : '全体'}}</p>
                <p>{{costDetailInfo.buildingType == '全体' || costDetailInfo.buildingType == '2' ? '全体' : '幢'}}</p>
            </div>
            <label class="form-label" for="repairType">维修类型</label>
            <label class="form-label-detail" for="repairType">维修类型</label>
            <p>{{costDetailInfo.maintenanceType || '-'}}</p>
        </div>
        <!-- 基金与设施 + 业主大会范围 + 门牌幢范围 -->
        <div class="form-row">
            <label class="form-label">基金与设施</label>
            <label class="form-label-detail">基金与设施</label>
            <div class="radio-group">
                <p>{{costDetailInfo.fundTypeLevel1 == '1' ? '维修资金' : '公共收益'}}</p>
                <label for="fundRepair" style="margin-top: 8px;">维修资金</label>
                <p>{{costDetailInfo.fundTypeLevel1 || '-'}}</p>
            </div>
            <label class="form-label" for="ownerScope">业主大会范围</label>
            <label class="form-label-detail" for="ownerScope">业主大会范围</label>
            <p>{{costDetailInfo.ownerScope || '-'}}</p>
            <label class="form-label" for="buildingScope">门牌幢范围</label>
            <label class="form-label-detail" for="buildingScope">门牌幢范围</label>
            <p>{{costDetailInfo.buildingScope || '-'}}</p>
        </div>
        <div class="form-row">
        <div class="form-row" v-if="costDetailInfo.fundTypeLevel2">
            <div class="radio-group" style="margin-left: 100px;">
                <p>{{costDetailInfo.fundTypeLevel2 == '1' ? '公共收益' : '维修资金'}}</p>
                <p>{{costDetailInfo.fundTypeLevel2}}</p>
            </div>
        </div>
        <!-- 按钮组 -->
        <div class="btn-group">
            <button type="button" class="btn-cancel">取消</button>
            <button type="button" class="btn-save">保存</button>
            <button type="button" class="btn-cancel" v-on:click="_goBack()">返回</button>
        </div>
    </form>
</div>
public/pages/property/costDetail/detail/detail.js
@@ -0,0 +1,165 @@
/**
 费用明细详情
 **/
(function (vc) {
    var $that = {};
    vc.extends({
        data: {
            costDetailInfo: {
                costDetailId: '',
                flowCode: '',
                date: '',
                communityName: '',
                communityCode: '',
                projectContent: '',
                managementAmount: '',
                managementStamped: '0',
                committeeAmount: '',
                appraisalAmount: '',
                committeeStamped: '0',
                approvalDepartment: '',
                fundTypeLevel1: '',
                fundTypeLevel2: '',
                buildingType: '1',
                maintenanceType: '',
                ownerScope: '',
                buildingScope: ''
            }
        },
        _initMethod: function () {
            $that = vc.component;
            // 从URL获取costDetailId
            var costDetailId = vc.getParam('costDetailId');
            if (costDetailId) {
                $that.costDetailInfo.costDetailId = costDetailId;
                $that._loadCostDetail();
            } else {
                vc.toast('缺少费用明细ID');
                setTimeout(function() {
                    vc.goBack();
                }, 1500);
            }
        },
        _initEvent: function () {
        },
        methods: {
            _loadCostDetail: function () {
                // 查询所有数据,然后找到匹配的记录
                var params = {
                    communityName: vc.getCurrentCommunity().name,
                    page: 1,
                    row: 1000  // 查询足够多的数据以找到目标记录
                };
                var param = {
                    params: params
                };
                console.log('开始加载费用明细详情,ID:', $that.costDetailInfo.costDetailId);
                vc.http.apiGet('/maintenancePayment/queryMaintenancePayment',
                    param,
                    function (json, res) {
                        try {
                            var _json = JSON.parse(json);
                            console.log('API返回数据:', _json);
                            if (_json.code === 0 && _json.data) {
                                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++) {
                                    var recordId = String(records[i].id);
                                    console.log('比较ID: 目标=' + targetId + ', 记录=' + recordId);
                                    if (recordId === targetId || records[i].id == $that.costDetailInfo.costDetailId) {
                                        foundItem = records[i];
                                        console.log('找到匹配记录:', foundItem);
                                        break;
                                    }
                                }
                                if (foundItem) {
                                    $that._fillDetailData(foundItem);
                                    console.log('详情数据已填充:', $that.costDetailInfo);
                                } else {
                                    console.error('未找到匹配的记录,目标ID:', $that.costDetailInfo.costDetailId);
                                    vc.toast('未找到该费用明细,ID: ' + $that.costDetailInfo.costDetailId);
                                    setTimeout(function() {
                                        vc.goBack();
                                    }, 1500);
                                }
                            } else {
                                console.error('API返回错误:', _json);
                                vc.toast(_json.msg || '未找到该费用明细');
                                setTimeout(function() {
                                    vc.goBack();
                                }, 1500);
                            }
                        } catch (e) {
                            console.error('数据解析失败:', e);
                            vc.toast('数据解析失败: ' + e.message);
                        }
                    },
                    function (errInfo, error) {
                        console.error('请求失败:', errInfo, error);
                        vc.toast('请求失败,请检查网络连接');
                    }
                );
            },
            _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.communityCode = item.projectCode || '';
                vc.component.costDetailInfo.projectContent = item.projectContent || '';
                vc.component.costDetailInfo.managementAmount = item.managementOfficeAmount || '';
                vc.component.costDetailInfo.managementStamped = (item.managementOfficeSeal === '是' || item.managementOfficeSeal === '1') ? '1' : '0';
                vc.component.costDetailInfo.committeeAmount = item.ownersCommitteeAmount || '';
                vc.component.costDetailInfo.appraisalAmount = item.auditAmount || '';
                vc.component.costDetailInfo.committeeStamped = (item.ownersCommitteeSeal === '是' || item.ownersCommitteeSeal === '1') ? '1' : '0';
                vc.component.costDetailInfo.approvalDepartment = item.reportDepartment || '';
                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 = '全体';
                } else {
                    vc.component.costDetailInfo.buildingType = '1';
                }
                vc.component.costDetailInfo.maintenanceType = item.maintenanceType || '';
                vc.component.costDetailInfo.ownerScope = item.ownerScope || '';
                vc.component.costDetailInfo.buildingScope = item.buildingScope || '';
                console.log('详情数据填充完成:', vc.component.costDetailInfo);
            },
            _goBack: function () {
                vc.goBack();
            }
        }
    });
})(window.vc);
public/pages/property/costDetail/edit/edit.html
@@ -4,35 +4,35 @@
        <!-- 流转编码 + 日期 -->
        <div class="form-row">
            <label class="form-label" for="flowCode">流转编码</label>
            <input type="text" id="flowCode" class="form-input" placeholder="请输入">
            <input type="text" id="flowCode" class="form-input" placeholder="请输入" v-model="costDetailInfo.flowCode">
            <label class="form-label" for="date">日期</label>
            <input type="date" id="date" class="form-input" placeholder="yyyy/mm/日">
            <input type="date" id="date" class="form-input" placeholder="yyyy/mm/日" v-model="costDetailInfo.date">
        </div>
        <!-- 小区名称 + 小区编码(带备注) -->
        <div class="form-row">
            <label class="form-label" for="communityName">小区名称</label>
            <input type="text" id="communityName" class="form-input" placeholder="请输入">
            <input type="text" id="communityName" class="form-input" placeholder="请输入" v-model="costDetailInfo.communityName">
            <label class="form-label">小区编码</label>
            <input type="text" id="communityCode" class="form-input" placeholder="请输入">
            <input type="text" id="communityCode" class="form-input" placeholder="请输入" v-model="costDetailInfo.communityCode">
        </div>
        <!-- 工程内容 -->
        <div class="form-row">
            <label class="form-label" for="projectContent">工程内容</label>
            <input type="text" id="projectContent" class="form-input" placeholder="请输入" style="width: 555px;">
            <input type="text" id="projectContent" class="form-input" placeholder="请输入" style="width: 555px;" v-model="costDetailInfo.projectContent">
        </div>
        <!-- 管理处金额 + 是否盖章 -->
        <div class="form-row">
            <label class="form-label" for="mgmtAmount">管理处金额</label>
            <input type="text" id="mgmtAmount" class="form-input" placeholder="请输入">
            <input type="text" id="mgmtAmount" class="form-input" placeholder="请输入" v-model="costDetailInfo.managementAmount">
            <span>元</span>
            <label class="form-label">是否盖章</label>
            <div class="radio-group">
                <input type="radio" id="mgmtSealYes" name="mgmtSeal" checked>
                <input type="radio" id="mgmtSealYes" name="mgmtSeal" value="1" v-model="costDetailInfo.managementStamped">
                <label for="mgmtSealYes" style="margin-top: 8px;">是</label>
                <input type="radio" id="mgmtSealNo" name="mgmtSeal">
                <input type="radio" id="mgmtSealNo" name="mgmtSeal" value="0" v-model="costDetailInfo.managementStamped">
                <label for="mgmtSealNo" style="margin-top: 8px;">否</label>
            </div>
        </div>
@@ -40,49 +40,43 @@
        <!-- 业委会金额 + 审价金额 + 是否盖章 + 签报部门 -->
        <div class="form-row">
            <label class="form-label" for="committeeAmount">业委会金额</label>
            <input type="text" id="committeeAmount" class="form-input" placeholder="请输入">
            <input type="text" id="committeeAmount" class="form-input" placeholder="请输入" v-model="costDetailInfo.committeeAmount">
            <span>元</span>
            <label class="form-label" for="auditAmount">审价金额</label>
            <input type="text" id="auditAmount" class="form-input" placeholder="请输入">
            <input type="text" id="auditAmount" class="form-input" placeholder="请输入" v-model="costDetailInfo.appraisalAmount">
            <span>元</span>
            <label class="form-label">是否盖章</label>
            <div class="radio-group">
                <input type="radio" id="committeeSealYes" name="committeeSeal" checked>
                <input type="radio" id="committeeSealYes" name="committeeSeal" value="1" v-model="costDetailInfo.committeeStamped">
                <label for="committeeSealYes" style="margin-top: 8px;">是</label>
                <input type="radio" id="committeeSealNo" name="committeeSeal">
                <input type="radio" id="committeeSealNo" name="committeeSeal" value="0" v-model="costDetailInfo.committeeStamped">
                <label for="committeeSealNo" style="margin-top: 8px;">否</label>
            </div>
            <label class="form-label" for="approveDept">签报部门</label>
            <select id="approveDept" class="form-select">
                <option value="1">1</option>
            </select>
            <input type="text" id="approveDept" class="form-input" placeholder="请输入" v-model="costDetailInfo.approvalDepartment" style="width: 120px;">
        </div>
        <!-- 分摊范围 + 维修类型 -->
        <div class="form-row">
            <label class="form-label">分摊范围</label>
            <div class="radio-group">
                <input type="radio" id="shareBuilding" name="shareScope" checked>
                <input type="radio" id="shareBuilding" name="shareScope" value="1" v-model="costDetailInfo.buildingType">
                <label for="shareBuilding" style="margin-top: 8px;">幢</label>
                <input type="radio" id="shareAll" name="shareScope">
                <input type="radio" id="shareAll" name="shareScope" value="全体" v-model="costDetailInfo.buildingType">
                <label for="shareAll" style="margin-top: 8px;">全体</label>
            </div>
            <label class="form-label" for="repairType">维修类型</label>
            <select id="repairType" class="form-select">
                <option value="1">1</option>
                <option value="2">2</option>
                <option value="3">3</option>
            </select>
            <input type="text" id="repairType" class="form-input" placeholder="请输入" v-model="costDetailInfo.maintenanceType" style="width: 120px;">
        </div>
        <!-- 基金与设施 + 业主大会范围 + 门牌幢范围 -->
        <div class="form-row">
            <label class="form-label">基金与设施</label>
            <div class="radio-group">
                <input type="radio" id="fundRepair" name="fundType" value="repair" v-model="fundType">
                <input type="radio" id="fundRepair" name="fundType" value="repair" v-model="costDetailInfo.fundType">
                <label for="fundRepair" style="margin-top: 8px;">维修资金</label>
            </div>
            <div class="radio-group" style="margin-left: 100px;" v-if="fundType === 'repair'">
            <div class="radio-group" style="margin-left: 100px;" v-if="costDetailInfo.fundType === 'repair'">
                <label class="form-label" for="ownerScope">业主大会范围</label>
                <select id="ownerScope" class="form-select">
                    <option value="multi">多选</option>
@@ -96,21 +90,21 @@
        <div class="form-row">
            <div class="radio-group" style="margin-left: 100px;">
                <input type="radio" id="fundPublic" name="fundType" value="public" v-model="fundType">
                <input type="radio" id="fundPublic" name="fundType" value="public" v-model="costDetailInfo.fundType">
                <label for="fundPublic" style="margin-top: 8px;">公共收益</label>
            </div>
            <div class="radio-group" style="margin-left: 100px;" v-if="fundType === 'public'">
                <input type="radio" id="fundSystemOut" name="fundSystemType" value="out" v-model="fundSystemType">
            <div class="radio-group" style="margin-left: 100px;" v-if="costDetailInfo.fundType === 'public'">
                <input type="radio" id="fundSystemOut" name="fundSystemType" value="out" v-model="costDetailInfo.fundSystemType">
                <label for="fundSystemOut" style="margin-top: 8px;">系统外</label>
                <input type="radio" id="fundSystemIn" name="fundSystemType" value="in" v-model="fundSystemType">
                <input type="radio" id="fundSystemIn" name="fundSystemType" value="in" v-model="costDetailInfo.fundSystemType">
                <label for="fundSystemIn" style="margin-top: 8px;">系统内</label>
            </div>
        </div>
        <!-- 按钮组 -->
        <div class="btn-group">
            <button type="button" class="btn-cancel">取消</button>
            <button type="button" class="btn-save">保存</button>
            <button type="button" class="btn-cancel" v-on:click="_cancel()">取消</button>
            <button type="button" class="btn-save" v-on:click="_saveCostDetail()">保存</button>
        </div>
    </form>
</div>
public/pages/property/costDetail/edit/edit.js
@@ -1,10 +1,245 @@
/**
 编辑费用明细
 **/
(function (vc) {
    var $that = {};
    vc.extends({
        data: {
            fundType: 'repair', // 默认选中维修资金
            fundSystemType: 'out' // 默认选中系统外
            costDetailInfo: {
                costDetailId: '',
                flowCode: '',
                date: '',
                communityName: '',
                communityCode: '',
                projectContent: '',
                managementAmount: '',
                managementStamped: '1',
                committeeAmount: '',
                appraisalAmount: '',
                committeeStamped: '1',
                approvalDepartment: '',
                fundTypeLevel1: '',
                fundTypeLevel2: '',
                buildingType: '1',
                maintenanceType: '',
                fundType: 'repair', // 默认选中维修资金
                fundSystemType: 'out' // 默认选中系统外
            }
        },
        _initMethod: function () {
            $that = vc.component;
            // 从URL获取costDetailId
            var costDetailId = vc.getParam('costDetailId');
            if (costDetailId) {
                $that.costDetailInfo.costDetailId = costDetailId;
                $that._loadCostDetail();
            } else {
                vc.toast('缺少费用明细ID');
                setTimeout(function() {
                    vc.goBack();
                }, 1500);
            }
        },
        methods: {
            _loadCostDetail: function () {
                // 查询所有数据,然后找到匹配的记录
                var params = {
                    communityName: vc.getCurrentCommunity().name,
                    page: 1,
                    row: 1000  // 查询足够多的数据以找到目标记录
                };
                var param = {
                    params: params
                };
                console.log('开始加载费用明细,ID:', $that.costDetailInfo.costDetailId);
                vc.http.apiGet('/maintenancePayment/queryMaintenancePayment',
                    param,
                    function (json, res) {
                        try {
                            var _json = JSON.parse(json);
                            console.log('API返回数据:', _json);
                            if (_json.code === 0 && _json.data) {
                                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++) {
                                    var recordId = String(records[i].id);
                                    console.log('比较ID: 目标=' + targetId + ', 记录=' + recordId);
                                    if (recordId === targetId || records[i].id == $that.costDetailInfo.costDetailId) {
                                        foundItem = records[i];
                                        console.log('找到匹配记录:', foundItem);
                                        break;
                                    }
                                }
                                if (foundItem) {
                                    $that._fillFormData(foundItem);
                                    console.log('表单数据已填充:', $that.costDetailInfo);
                                } else {
                                    console.error('未找到匹配的记录,目标ID:', $that.costDetailInfo.costDetailId);
                                    vc.toast('未找到该费用明细,ID: ' + $that.costDetailInfo.costDetailId);
                                    setTimeout(function() {
                                        vc.goBack();
                                    }, 1500);
                                }
                            } else {
                                console.error('API返回错误:', _json);
                                vc.toast('未找到该费用明细');
                                setTimeout(function() {
                                    vc.goBack();
                                }, 1500);
                            }
                        } catch (e) {
                            console.error('数据解析失败:', e);
                            vc.toast('数据解析失败: ' + e.message);
                        }
                    },
                    function (errInfo, error) {
                        console.error('请求失败:', errInfo, error);
                        vc.toast('请求失败,请检查网络连接');
                    }
                );
            },
            _fillFormData: function (item) {
                console.log('开始填充表单数据,原始数据:', item);
                // 填充表单数据
                var dateStr = '';
                if (item.date) {
                    dateStr = item.date.substring(0, 10); // 取日期部分 yyyy-mm-dd
                } 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;
                }
                // 使用Vue.set或者直接赋值来确保响应式更新
                vc.component.costDetailInfo.flowCode = item.flowNumber || '';
                vc.component.costDetailInfo.date = dateStr;
                vc.component.costDetailInfo.communityName = item.projectName || '';
                vc.component.costDetailInfo.communityCode = item.projectCode || '';
                vc.component.costDetailInfo.projectContent = item.projectContent || '';
                vc.component.costDetailInfo.managementAmount = item.managementOfficeAmount || '';
                vc.component.costDetailInfo.managementStamped = (item.managementOfficeSeal === '是' || item.managementOfficeSeal === '1') ? '1' : '0';
                vc.component.costDetailInfo.committeeAmount = item.ownersCommitteeAmount || '';
                vc.component.costDetailInfo.appraisalAmount = item.auditAmount || '';
                vc.component.costDetailInfo.committeeStamped = (item.ownersCommitteeSeal === '是' || item.ownersCommitteeSeal === '1') ? '1' : '0';
                vc.component.costDetailInfo.approvalDepartment = item.reportDepartment || '';
                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 = '全体';
                } else {
                    vc.component.costDetailInfo.buildingType = '1';
                }
                vc.component.costDetailInfo.maintenanceType = item.maintenanceType || '';
                // 设置基金类型
                if (item.fundTypeLevel1) {
                    vc.component.costDetailInfo.fundType = (item.fundTypeLevel1 === '维修资金' || item.fundTypeLevel1 === '1') ? 'repair' : 'public';
                } else {
                    vc.component.costDetailInfo.fundType = 'repair'; // 默认值
                }
                if (item.fundTypeLevel2) {
                    vc.component.costDetailInfo.fundSystemType = (item.fundTypeLevel2 === '系统外' || item.fundTypeLevel2 === 'out') ? 'out' : 'in';
                } else {
                    vc.component.costDetailInfo.fundSystemType = 'out'; // 默认值
                }
                console.log('表单数据填充完成:', vc.component.costDetailInfo);
            },
            _saveCostDetail: function () {
                // 验证必填字段
                if (!$that.costDetailInfo.flowCode) {
                    vc.toast('请输入流转编码');
                    return;
                }
                if (!$that.costDetailInfo.date) {
                    vc.toast('请选择日期');
                    return;
                }
                if (!$that.costDetailInfo.communityName) {
                    vc.toast('请输入小区名称');
                    return;
                }
                if (!$that.costDetailInfo.communityCode) {
                    vc.toast('请输入小区编码');
                    return;
                }
                // 构建保存数据
                var saveData = {
                    id: $that.costDetailInfo.costDetailId,
                    flowNumber: $that.costDetailInfo.flowCode,
                    date: $that.costDetailInfo.date,
                    projectName: $that.costDetailInfo.communityName,
                    projectCode: $that.costDetailInfo.communityCode,
                    projectContent: $that.costDetailInfo.projectContent,
                    managementOfficeAmount: parseFloat($that.costDetailInfo.managementAmount) || 0,
                    managementOfficeSeal: $that.costDetailInfo.managementStamped === '1' ? '是' : '否',
                    ownersCommitteeAmount: parseFloat($that.costDetailInfo.committeeAmount) || 0,
                    auditAmount: parseFloat($that.costDetailInfo.appraisalAmount) || 0,
                    ownersCommitteeSeal: $that.costDetailInfo.committeeStamped === '1' ? '是' : '否',
                    reportDepartment: $that.costDetailInfo.approvalDepartment || '',
                    fundTypeLevel1: $that.costDetailInfo.fundType === 'repair' ? '维修资金' : '公共收益',
                    fundTypeLevel2: $that.costDetailInfo.fundType === 'public' ? ($that.costDetailInfo.fundSystemType === 'out' ? '系统外' : '系统内') : '',
                    buildingOrAll: $that.costDetailInfo.buildingType === '全体' ? '全体' : ($that.costDetailInfo.buildingType || '1'),
                    maintenanceType: $that.costDetailInfo.maintenanceType || '',
                    communityId: vc.getCurrentCommunity().communityId
                };
                // 解析日期
                if (saveData.date) {
                    var dateParts = saveData.date.split('-');
                    if (dateParts.length >= 2) {
                        saveData.year = parseInt(dateParts[0]);
                        saveData.month = parseInt(dateParts[1]);
                        if (dateParts.length >= 3) {
                            saveData.day = parseInt(dateParts[2]);
                        }
                    }
                }
                // 调用更新API
                vc.http.apiPost('/maintenancePayment/updateMaintenancePayment',
                    JSON.stringify(saveData), {
                        emulateJSON: true
                    },
                    function (json, res) {
                        try {
                            var _json = JSON.parse(json);
                            if (_json.code === 0) {
                                vc.toast('保存成功');
                                setTimeout(function() {
                                    vc.goBack();
                                }, 1000);
                            } else {
                                vc.toast(_json.msg || '保存失败');
                            }
                        } catch (e) {
                            vc.toast('保存失败');
                        }
                    },
                    function (errInfo, error) {
                        vc.toast('保存失败,请检查网络连接');
                    }
                );
            },
            _cancel: function () {
                vc.goBack();
            }
        }
    });
})(window.vc);
public/pages/property/costDetail/more/more.html
@@ -3,12 +3,12 @@
    <div class="search-bar">
        <div>
            <label>统计时间:</label>
            <input type="date" class="form-control startDate" placeholder="请选择开始日期" v-model="moreInfo.conditions.startDate" />
            <p style="position: relative; top: 6px;">{{moreInfo.conditions.startDate || '--'}}</p>
            <span style="margin: 0 5px;">至</span>
            <input type="date" class="form-control endDate" placeholder="请选择结束日期" v-model="moreInfo.conditions.endDate" />
            <p style="position: relative; top: 6px;">{{moreInfo.conditions.endDate || '--'}}</p>
        </div>
        <div class="action-buttons">
            <button type="button" class="edit-btn" v-on:click="_editPublicIncome()" style="line-height: 0px;">编辑</button>
            <!-- <button type="button" class="edit-btn" v-on:click="_editPublicIncome()" style="line-height: 0px;">编辑</button> -->
            <button type="button" class="add-btn" v-on:click="_add()" style="line-height: 0px;">添加</button>
            <button type="button" class="import-btn" v-on:click="_export()" style="line-height: 0px; background-color: white; color: #333; border: 1px solid #e8e8e8;">导出</button>
        </div>
public/pages/property/costDetail/more/more.js
@@ -32,9 +32,13 @@
        },
        _initMethod: function () {
            $that = vc.component;
            $that._injectStyles();
            $that._initDate();
            $that._listData(DEFAULT_PAGE, DEFAULT_ROWS);
            // 进入页面时立即调用接口
            $that._loadPublicIncomeData(DEFAULT_PAGE, DEFAULT_ROWS);
            // 根据当前标签页加载数据
            if ($that.moreInfo.currentTab !== 'publicIncome') {
                $that._listData(DEFAULT_PAGE, DEFAULT_ROWS);
            }
        },
        _initEvent: function () {
        },
@@ -113,7 +117,112 @@
            changeTab: function (_tab) {
                $that.moreInfo.currentTab = _tab;
                // 根据标签页加载不同数据
                $that._listData(DEFAULT_PAGE, $that.moreInfo.paginationInfo.rows);
                if (_tab === 'publicIncome') {
                    // 公共收益金标签,调用特殊接口
                    $that._loadPublicIncomeData(DEFAULT_PAGE, $that.moreInfo.paginationInfo.rows);
                } else {
                    $that._listData(DEFAULT_PAGE, $that.moreInfo.paginationInfo.rows);
                }
            },
            _loadPublicIncomeData: function (_page, _rows) {
                // 获取URL参数中的costDetailId
                var costDetailId = vc.getParam('costDetailId');
                if (!costDetailId) {
                    // 尝试从hash中获取
                    var hash = location.hash;
                    if (hash && hash.indexOf('?') !== -1) {
                        var hashParams = hash.substring(hash.indexOf('?') + 1);
                        var params = hashParams.split('&');
                        for (var i = 0; i < params.length; i++) {
                            var param = params[i].split('=');
                            if (param[0] === 'costDetailId') {
                                costDetailId = decodeURIComponent(param[1] || '');
                                break;
                            }
                        }
                    }
                }
                if (!costDetailId) {
                    vc.toast('缺少costDetailId参数');
                    return;
                }
                var param = {
                    params: {
                        mpId: costDetailId,
                        page: _page,
                        row: _rows
                    }
                };
                // 调用公共收益金接口
                vc.http.apiGet('/announcementTimeRange/queryAnnouncementTimeRangeInfo',
                    param,
                    function (json, res) {
                        try {
                            var _json = JSON.parse(json);
                            if (_json.code === "0000") {
                                var total = _json.total || 0;
                                var rows = _rows || DEFAULT_ROWS;
                                // 计算总页数
                                var totalPages = Math.ceil(total / rows);
                                if (totalPages === 0) {
                                    totalPages = 1;
                                }
                                $that.moreInfo.paginationInfo.dataCount = total;
                                $that.moreInfo.paginationInfo.total = totalPages;
                                // 映射数据字段
                                var dataList = [];
                                if (_json.data && Array.isArray(_json.data)) {
                                    dataList = _json.data.map(function(item) {
                                        return {
                                            id: item.id,
                                            mpId: item.mpId,
                                            proposedStartDate: item.plannedAnnouncementStart || '-',
                                            proposedEndDate: item.plannedAnnouncementEnd || '-',
                                            publishedStartDate: item.publishedAnnouncementStart || '-',
                                            publishedEndDate: item.publishedAnnouncementEnd || '-',
                                            createTime: item.createTime || '',
                                            updateTime: item.updateTime || '',
                                            _originalData: item
                                        };
                                    });
                                }
                                $that.moreInfo.dataList = dataList;
                                $that.moreInfo.paginationInfo.currentPage = _page;
                                $that._freshPageList();
                            } else {
                                vc.toast(_json.msg || '查询失败');
                                $that.moreInfo.dataList = [];
                                $that.moreInfo.paginationInfo.dataCount = 0;
                                $that.moreInfo.paginationInfo.total = 1;
                                $that.moreInfo.paginationInfo.currentPage = _page;
                                $that._freshPageList();
                            }
                        } catch (e) {
                            console.error('数据解析失败:', e);
                            vc.toast('数据解析失败');
                            $that.moreInfo.dataList = [];
                            $that.moreInfo.paginationInfo.dataCount = 0;
                            $that.moreInfo.paginationInfo.total = 1;
                            $that.moreInfo.paginationInfo.currentPage = _page;
                            $that._freshPageList();
                        }
                    },
                    function (errInfo, error) {
                        console.error('请求失败:', errInfo, error);
                        vc.toast(errInfo || '请求失败,请检查网络连接');
                        $that.moreInfo.dataList = [];
                        $that.moreInfo.paginationInfo.dataCount = 0;
                        $that.moreInfo.paginationInfo.total = 1;
                        $that.moreInfo.paginationInfo.currentPage = _page;
                        $that._freshPageList();
                    }
                );
            },
            _listData: function (_page, _rows) {
                $that.moreInfo.conditions.page = _page;
@@ -240,13 +349,21 @@
                $that.moreInfo.paginationInfo.pageList = pageList;
            },
            _changePageSize: function () {
                $that._listData(DEFAULT_PAGE, $that.moreInfo.paginationInfo.rows);
                if ($that.moreInfo.currentTab === 'publicIncome') {
                    $that._loadPublicIncomeData(DEFAULT_PAGE, $that.moreInfo.paginationInfo.rows);
                } else {
                    $that._listData(DEFAULT_PAGE, $that.moreInfo.paginationInfo.rows);
                }
            },
            _goToPage: function (_page) {
                if (!_page || _page < 1 || _page > $that.moreInfo.paginationInfo.total) {
                    return;
                }
                $that._listData(_page, $that.moreInfo.paginationInfo.rows);
                if ($that.moreInfo.currentTab === 'publicIncome') {
                    $that._loadPublicIncomeData(_page, $that.moreInfo.paginationInfo.rows);
                } else {
                    $that._listData(_page, $that.moreInfo.paginationInfo.rows);
                }
            },
            _jumpToPage: function () {
                var page = parseInt($that.moreInfo.jumpPage);
@@ -256,7 +373,11 @@
                if (page > $that.moreInfo.paginationInfo.total) {
                    page = $that.moreInfo.paginationInfo.total;
                }
                $that._listData(page, $that.moreInfo.paginationInfo.rows);
                if ($that.moreInfo.currentTab === 'publicIncome') {
                    $that._loadPublicIncomeData(page, $that.moreInfo.paginationInfo.rows);
                } else {
                    $that._listData(page, $that.moreInfo.paginationInfo.rows);
                }
            },
            _add: function () {
                // 添加功能
public/vcCore/core.js
@@ -471,6 +471,19 @@
})(window.vc);
/**
 confirm
 **/
(function (vc) {
    vc.confirm = function Confirm(msg, callback) {
        if (window.confirm(msg)) {
            if (typeof callback === 'function') {
                callback();
            }
        }
    }
})(window.vc);
/**
 toast
 **/
(function (vc) {
public/vcCore/vcFramework.js
@@ -2228,6 +2228,19 @@
})(window.vcFramework);
/**
 confirm
 **/
(function (vcFramework) {
    vcFramework.confirm = function Confirm(msg, callback) {
        if (window.confirm(msg)) {
            if (typeof callback === 'function') {
                callback();
            }
        }
    }
})(window.vcFramework);
/**
 toast
 **/
(function (vcFramework) {