|
|
@ -63,7 +63,7 @@ |
|
|
<a-range-picker style="width: 240px" v-model:value="queryForm.firmAuditTimeRange" :placeholder="['开始时间', '结束时间']" /> |
|
|
<a-range-picker style="width: 240px" v-model:value="queryForm.firmAuditTimeRange" :placeholder="['开始时间', '结束时间']" /> |
|
|
</a-form-item> |
|
|
</a-form-item> |
|
|
<a-form-item label="备案编号" class="smart-query-form-item"> |
|
|
<a-form-item label="备案编号" class="smart-query-form-item"> |
|
|
<a-input style="width: 160px" v-model:value="queryForm.filingNo" placeholder="请输入备案编号" /> |
|
|
<a-input style="width: 160px" v-model:value="queryForm.recordNo" placeholder="请输入备案编号" /> |
|
|
</a-form-item> |
|
|
</a-form-item> |
|
|
<a-form-item class="smart-query-form-item smart-margin-left10"> |
|
|
<a-form-item class="smart-query-form-item smart-margin-left10"> |
|
|
<a-button v-privilege="'serviceApplications:query'" type="primary" @click="onSearch"> |
|
|
<a-button v-privilege="'serviceApplications:query'" type="primary" @click="onSearch"> |
|
|
@ -172,11 +172,21 @@ |
|
|
:row-selection="{ selectedRowKeys: selectedRowKeyList, onChange: onSelectChange }" |
|
|
:row-selection="{ selectedRowKeys: selectedRowKeyList, onChange: onSelectChange }" |
|
|
> |
|
|
> |
|
|
<template #bodyCell="{ record, column }"> |
|
|
<template #bodyCell="{ record, column }"> |
|
|
|
|
|
<template v-if="column.dataIndex === 'userName'"> |
|
|
|
|
|
<span>{{ record.userName }}</span> |
|
|
|
|
|
<a-tag v-if="record.isBatch === 1 && record.parentApplicationId" color="orange" style="margin-left: 6px;"> |
|
|
|
|
|
由 {{ record.declarerName || '同行律师' }} 代报批 |
|
|
|
|
|
</a-tag> |
|
|
|
|
|
<a-tag v-else-if="record.isBatch === 1 && !record.parentApplicationId" color="blue" style="margin-left: 6px;"> |
|
|
|
|
|
同行统一代报批 (包含: {{ record.participantNames || '多人' }}) |
|
|
|
|
|
</a-tag> |
|
|
|
|
|
</template> |
|
|
<template v-if="column.dataIndex === 'action'"> |
|
|
<template v-if="column.dataIndex === 'action'"> |
|
|
<div class="smart-table-operate"> |
|
|
<div class="smart-table-operate"> |
|
|
<a-button @click="showDetail(record)" type="link">详情</a-button> |
|
|
<a-button @click="showDetail(record)" type="link">详情</a-button> |
|
|
<!-- 只有未提交状态才能编辑,且只能编辑自己的记录 --> |
|
|
<!-- 只有未提交状态才能编辑,且只能编辑自己的主记录 --> |
|
|
<a-button v-if="record.firmAuditStatus === 0 && record.userId === loginInfo?.userId" @click="showEdit(record)" type="link">编辑</a-button> |
|
|
<a-button v-if="record.firmAuditStatus === 0 && record.userId === loginInfo?.userId && (!record.declarerId || record.declarerId === loginInfo?.userId)" @click="showEdit(record)" type="link">编辑</a-button> |
|
|
|
|
|
<a-button v-if="record.firmAuditStatus === 0 && record.userId === loginInfo?.userId && (!record.declarerId || record.declarerId === loginInfo?.userId)" @click="onSubmit(record)" type="link">提交</a-button> |
|
|
<!-- 执业机构审核状态为拒绝时,只显示详情按钮 --> |
|
|
<!-- 执业机构审核状态为拒绝时,只显示详情按钮 --> |
|
|
<template v-if="record.firmAuditStatus !== 4"> |
|
|
<template v-if="record.firmAuditStatus !== 4"> |
|
|
<a-button v-if="canAuditRecord(record)" @click="showAuditModal(record)" type="link">审核</a-button> |
|
|
<a-button v-if="canAuditRecord(record)" @click="showAuditModal(record)" type="link">审核</a-button> |
|
|
@ -457,7 +467,7 @@ import dayjs from 'dayjs'; |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
title: '备案编号', |
|
|
title: '备案编号', |
|
|
dataIndex: 'filingNo', |
|
|
dataIndex: 'recordNo', |
|
|
ellipsis: true, |
|
|
ellipsis: true, |
|
|
width: 150, |
|
|
width: 150, |
|
|
}, |
|
|
}, |
|
|
@ -483,7 +493,7 @@ import dayjs from 'dayjs'; |
|
|
firmAuditStatus: undefined, // 执业机构审核状态 |
|
|
firmAuditStatus: undefined, // 执业机构审核状态 |
|
|
firmAuditTimeRange: undefined, // 执业机构审核时间范围 |
|
|
firmAuditTimeRange: undefined, // 执业机构审核时间范围 |
|
|
associationAuditStatus: undefined, // 协会审核状态 |
|
|
associationAuditStatus: undefined, // 协会审核状态 |
|
|
filingNo: undefined, // 备案编号 |
|
|
recordNo: undefined, // 用户填写的备案/案件编号 |
|
|
selfFirmFilter: undefined, // 本人本所筛选条件 |
|
|
selfFirmFilter: undefined, // 本人本所筛选条件 |
|
|
}; |
|
|
}; |
|
|
// 查询表单form |
|
|
// 查询表单form |
|
|
@ -679,31 +689,20 @@ import dayjs from 'dayjs'; |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 如果已签署律所承诺书,检查成本权限 |
|
|
// 成本权限按律所判断:本所任一有效人员具备权限即视为本所有权限 |
|
|
if (loginInfo.value && loginInfo.value.lawFirmAgreementSignFlag === true) { |
|
|
if (loginInfo.value && loginInfo.value.lawFirmAgreementSignFlag === true) { |
|
|
// 检查是否有成本查询权限 |
|
|
const permissionResult = await firmReportsApi.firmHasCostPermission(); |
|
|
if (loginInfo.value.costVisibleFlag === true) { |
|
|
if (permissionResult.data === true) { |
|
|
try { |
|
|
try { |
|
|
// 先检查是否有未审核的数据 |
|
|
|
|
|
const hasUnreviewedData = await checkUnreviewedData(); |
|
|
const hasUnreviewedData = await checkUnreviewedData(); |
|
|
if (hasUnreviewedData) { |
|
|
if (hasUnreviewedData) { |
|
|
message.warning('有律师提交的数据尚未审核,请先完成审核后再进行批量上报。'); |
|
|
message.warning('有律师提交的数据尚未审核,请先完成审核后再进行批量上报。'); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const costPermissionResult = await firmReportsApi.query(); |
|
|
|
|
|
if (costPermissionResult.data === false) { |
|
|
|
|
|
// 成本权限检查返回false,需要先填报成本报表 |
|
|
|
|
|
message.warning('您需要先填报和提交律所收入,才能进行服务上报。'); |
|
|
|
|
|
// 调用成本管理新增弹框 |
|
|
|
|
|
showCostReportForm(); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
} catch (error) { |
|
|
} catch (error) { |
|
|
console.error('检查成本权限失败:', error); |
|
|
console.error('检查成本权限失败:', error); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
// 如果没有成本查询权限,直接跳过成本检查 |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 检查选中的记录是否符合上报条件 |
|
|
// 检查选中的记录是否符合上报条件 |
|
|
@ -712,7 +711,14 @@ import dayjs from 'dayjs'; |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
if (canReportRecords.length === 0) { |
|
|
if (canReportRecords.length === 0) { |
|
|
message.warning('选中的记录不符合上报条件,只能上报上个季度的数据'); |
|
|
message.warning('选中的记录不符合上报条件,请选择已通过律所审核且尚未上报的记录'); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const missingPeriods = await queryMissingIncomePeriods(canReportRecords); |
|
|
|
|
|
if (missingPeriods.length > 0) { |
|
|
|
|
|
message.warning(`以下活动所属季度尚未提交营业收入:${missingPeriods.map(item => item.label).join('、')},请完成填报后再上报律协`); |
|
|
|
|
|
showCostReportForm(missingPeriods[0]); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -733,60 +739,41 @@ import dayjs from 'dayjs'; |
|
|
const isAuditPassed = record.firmAuditStatus === 3 && |
|
|
const isAuditPassed = record.firmAuditStatus === 3 && |
|
|
(record.associationAuditStatus === 0 || record.associationAuditStatus === 4); |
|
|
(record.associationAuditStatus === 0 || record.associationAuditStatus === 4); |
|
|
|
|
|
|
|
|
// 如果有成本查询权限,需要检查季度限制;否则不限制 |
|
|
// 活动季度及对应收入报表由后端按 serviceEnd 统一校验 |
|
|
const hasCostPermission = loginInfo.value && loginInfo.value.costVisibleFlag === true; |
|
|
return isAuditPassed; |
|
|
|
|
|
|
|
|
if (hasCostPermission) { |
|
|
|
|
|
// 有成本权限:只能上报上个季度的数据 |
|
|
|
|
|
// 律协要求:二季度上报一季度的数据,三季度上报二季度的数据 |
|
|
|
|
|
const isLastQuarterData = isLastQuarterRecord(record); |
|
|
|
|
|
return isAuditPassed && isLastQuarterData; |
|
|
|
|
|
} else { |
|
|
|
|
|
// 无成本权限:不限制季度,可以上报所有数据 |
|
|
|
|
|
return isAuditPassed; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 判断记录是否为上个季度的数据 |
|
|
async function queryMissingIncomePeriods(records) { |
|
|
function isLastQuarterRecord(record) { |
|
|
const periodMap = new Map(); |
|
|
if (!record.reportTime) return false; |
|
|
records.forEach(record => { |
|
|
|
|
|
if (!record.serviceEnd) return; |
|
|
const currentDate = new Date(); |
|
|
const activityDate = dayjs(record.serviceEnd); |
|
|
const currentYear = currentDate.getFullYear(); |
|
|
const year = activityDate.year(); |
|
|
const currentMonth = currentDate.getMonth() + 1; |
|
|
const quarter = Math.ceil((activityDate.month() + 1) / 3); |
|
|
const currentQuarter = Math.ceil(currentMonth / 3); |
|
|
periodMap.set(`${year}-${quarter}`, { year, quarter }); |
|
|
|
|
|
}); |
|
|
// 计算上个季度 |
|
|
|
|
|
let lastQuarter = currentQuarter - 1; |
|
|
|
|
|
let lastQuarterYear = currentYear; |
|
|
|
|
|
|
|
|
|
|
|
if (lastQuarter === 0) { |
|
|
const missing = []; |
|
|
lastQuarter = 4; |
|
|
for (const period of periodMap.values()) { |
|
|
lastQuarterYear = currentYear - 1; |
|
|
const result = await firmReportsApi.queryByQuarter(period.year, period.quarter); |
|
|
|
|
|
if (result.data !== true) { |
|
|
|
|
|
missing.push({ |
|
|
|
|
|
...period, |
|
|
|
|
|
label: `${period.year}年第${period.quarter}季度`, |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
return missing; |
|
|
// 解析记录的提交时间 |
|
|
|
|
|
const reportDate = new Date(record.reportTime); |
|
|
|
|
|
const reportYear = reportDate.getFullYear(); |
|
|
|
|
|
const reportMonth = reportDate.getMonth() + 1; |
|
|
|
|
|
const reportQuarter = Math.ceil(reportMonth / 3); |
|
|
|
|
|
|
|
|
|
|
|
// 检查是否为上个季度的数据 |
|
|
|
|
|
return reportYear === lastQuarterYear && reportQuarter === lastQuarter; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 检查是否有未审核的数据 |
|
|
// 检查当前律所是否有未审核的数据 |
|
|
async function checkUnreviewedData() { |
|
|
async function checkUnreviewedData() { |
|
|
try { |
|
|
try { |
|
|
// 调用后端提供的专门接口查询是否有未审核的数据 |
|
|
|
|
|
const result = await serviceApplicationsApi.queryNoReview(); |
|
|
const result = await serviceApplicationsApi.queryNoReview(); |
|
|
|
|
|
|
|
|
// 如果返回的数据大于0,说明有未审核的记录 |
|
|
|
|
|
return result.data && result.data > 0; |
|
|
return result.data && result.data > 0; |
|
|
|
|
|
|
|
|
} catch (error) { |
|
|
} catch (error) { |
|
|
console.error('检查未审核数据失败:', error); |
|
|
console.error('检查未审核数据失败:', error); |
|
|
return false; // 出错时默认返回false,避免阻塞用户操作 |
|
|
return false; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -1057,9 +1044,9 @@ import dayjs from 'dayjs'; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// ---------------------------- 成本报表 ---------------------------- |
|
|
// ---------------------------- 成本报表 ---------------------------- |
|
|
function showCostReportForm() { |
|
|
function showCostReportForm(period) { |
|
|
// 打开成本报表新增弹框 |
|
|
// 打开成本报表新增弹框 |
|
|
costReportFormRef.value.show(); |
|
|
costReportFormRef.value.show(period); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// ---------------------------- 详情 ---------------------------- |
|
|
// ---------------------------- 详情 ---------------------------- |
|
|
|