|
|
@ -3,9 +3,9 @@ import { onMounted, reactive, ref } from 'vue'; |
|
|
import { ElMessage } from 'element-plus'; |
|
|
import { ElMessage } from 'element-plus'; |
|
|
import { getDicts } from '@/api/system/dict/data'; |
|
|
import { getDicts } from '@/api/system/dict/data'; |
|
|
import { |
|
|
import { |
|
|
listLawEnforcer, |
|
|
listLawEnforcerDomain, |
|
|
listLawEnforcerDetails, |
|
|
listLawEnforcerDomainDetails, |
|
|
exportLawEnforcer, |
|
|
exportLawEnforcerDomain, |
|
|
type EnforcerRow, |
|
|
type EnforcerRow, |
|
|
type LawEnforcerDetailRow |
|
|
type LawEnforcerDetailRow |
|
|
} from '@/api/efcode/report/law-enforcer'; |
|
|
} from '@/api/efcode/report/law-enforcer'; |
|
|
@ -15,18 +15,18 @@ import { getDomainInfo, type DashboardDomainVo } from '@/api/efcode/dashboard/ar |
|
|
const queryParams = reactive({ |
|
|
const queryParams = reactive({ |
|
|
pageNum: 1, |
|
|
pageNum: 1, |
|
|
pageSize: 20, |
|
|
pageSize: 20, |
|
|
lawEnforcer: '' as string, // 执法人员关键字(接口参数名) |
|
|
lawEnforcer: '' as string, // 执法人员关键字 |
|
|
area: undefined as string | undefined, |
|
|
domainName: undefined as string | undefined, // 所属领域名称(直接作为接口参数) |
|
|
field: undefined as string | undefined, // 所属领域名称 |
|
|
orderByColumn: 'enforce_count' as string, // 默认执法次数降序 |
|
|
orderByColumn: '' as string, |
|
|
isAsc: 'desc' as string |
|
|
isAsc: '' as string |
|
|
|
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
// 时段模式:year | quarter | month |
|
|
// 时段模式:year | quarter | month | custom |
|
|
const timeMode = ref('month'); |
|
|
const timeMode = ref('month'); |
|
|
const selectedYear = ref<string>(String(new Date().getFullYear())); |
|
|
const selectedYear = ref<string>(String(new Date().getFullYear())); |
|
|
const selectedQuarter = ref<number>(Math.ceil((new Date().getMonth() + 1) / 3)); |
|
|
const selectedQuarter = ref<number>(Math.ceil((new Date().getMonth() + 1) / 3)); |
|
|
const selectedMonth = ref<string>(''); |
|
|
const selectedMonth = ref<string>(''); |
|
|
|
|
|
const customRange = ref<string[]>([]); // 自定义时段 [beginTime, endTime] |
|
|
|
|
|
|
|
|
// 季度选项 |
|
|
// 季度选项 |
|
|
const quarterOptions = [ |
|
|
const quarterOptions = [ |
|
|
@ -36,10 +36,15 @@ const quarterOptions = [ |
|
|
{ label: '第四季度', value: 4 } |
|
|
{ label: '第四季度', value: 4 } |
|
|
]; |
|
|
]; |
|
|
|
|
|
|
|
|
/** 年份选项(近 5 年) */ |
|
|
/** 年份选项(从 2024 年开始,因为 2024 年才开始有数据) */ |
|
|
const yearOptions = (() => { |
|
|
const yearOptions = (() => { |
|
|
const curr = new Date().getFullYear(); |
|
|
const curr = new Date().getFullYear(); |
|
|
return Array.from({ length: 5 }, (_, i) => String(curr - i)); |
|
|
const startYear = 2024; |
|
|
|
|
|
const years: string[] = []; |
|
|
|
|
|
for (let y = curr; y >= startYear; y--) { |
|
|
|
|
|
years.push(String(y)); |
|
|
|
|
|
} |
|
|
|
|
|
return years.length > 0 ? years : [String(curr)]; |
|
|
})(); |
|
|
})(); |
|
|
|
|
|
|
|
|
/** 时段 → beginTime/endTime(后端 enforcementTime 为 Date,年/季度无法直接表达,改用日期区间) */ |
|
|
/** 时段 → beginTime/endTime(后端 enforcementTime 为 Date,年/季度无法直接表达,改用日期区间) */ |
|
|
@ -58,6 +63,15 @@ const buildTimeParams = () => { |
|
|
endTime: `${year}-${String(endMonth).padStart(2, '0')}-${String(endDay).padStart(2, '0')}` |
|
|
endTime: `${year}-${String(endMonth).padStart(2, '0')}-${String(endDay).padStart(2, '0')}` |
|
|
}; |
|
|
}; |
|
|
} |
|
|
} |
|
|
|
|
|
if (timeMode.value === 'custom') { |
|
|
|
|
|
if (!customRange.value || customRange.value.length !== 2) { |
|
|
|
|
|
return { beginTime: undefined, endTime: undefined }; |
|
|
|
|
|
} |
|
|
|
|
|
return { |
|
|
|
|
|
beginTime: customRange.value[0], |
|
|
|
|
|
endTime: customRange.value[1] |
|
|
|
|
|
}; |
|
|
|
|
|
} |
|
|
// 月度:未选月份则不按时间过滤 |
|
|
// 月度:未选月份则不按时间过滤 |
|
|
if (!selectedMonth.value) { |
|
|
if (!selectedMonth.value) { |
|
|
return { beginTime: undefined, endTime: undefined }; |
|
|
return { beginTime: undefined, endTime: undefined }; |
|
|
@ -101,20 +115,18 @@ const selectedRows = ref<EnforcerRow[]>([]); |
|
|
const getList = async () => { |
|
|
const getList = async () => { |
|
|
loading.value = true; |
|
|
loading.value = true; |
|
|
try { |
|
|
try { |
|
|
// 接口字段:区 → districtName(下拉绑定的是 dictLabel),领域/单位 → bureauDeptName |
|
|
const { domainName, ...rest } = queryParams; |
|
|
const { area, field, ...rest } = queryParams; |
|
|
const res = await listLawEnforcerDomain({ |
|
|
const res = await listLawEnforcer({ |
|
|
|
|
|
...rest, |
|
|
...rest, |
|
|
...buildTimeParams(), |
|
|
...buildTimeParams(), |
|
|
orderByColumn: rest.orderByColumn || undefined, |
|
|
orderByColumn: rest.orderByColumn || undefined, |
|
|
isAsc: rest.isAsc || undefined, |
|
|
isAsc: rest.isAsc || undefined, |
|
|
districtName: area, |
|
|
domainName: domainName || undefined |
|
|
bureauDeptName: field || undefined |
|
|
|
|
|
}); |
|
|
}); |
|
|
tableData.value = (res as any)?.rows || []; |
|
|
tableData.value = (res as any)?.rows || []; |
|
|
total.value = (res as any)?.total || 0; |
|
|
total.value = (res as any)?.total || 0; |
|
|
} catch (e) { |
|
|
} catch (e) { |
|
|
console.warn('[scan-enforcer] 列表接口调用失败', e); |
|
|
console.warn('[scan-domain] 列表接口调用失败', e); |
|
|
} finally { |
|
|
} finally { |
|
|
loading.value = false; |
|
|
loading.value = false; |
|
|
} |
|
|
} |
|
|
@ -128,25 +140,24 @@ const handleSearch = () => { |
|
|
const handleReset = () => { |
|
|
const handleReset = () => { |
|
|
const n = new Date(); |
|
|
const n = new Date(); |
|
|
queryParams.lawEnforcer = ''; |
|
|
queryParams.lawEnforcer = ''; |
|
|
queryParams.area = undefined; |
|
|
queryParams.domainName = undefined; |
|
|
queryParams.field = undefined; |
|
|
queryParams.orderByColumn = 'enforce_count'; |
|
|
queryParams.orderByColumn = ''; |
|
|
queryParams.isAsc = 'desc'; |
|
|
queryParams.isAsc = ''; |
|
|
|
|
|
queryParams.pageNum = 1; |
|
|
queryParams.pageNum = 1; |
|
|
queryParams.pageSize = 20; |
|
|
queryParams.pageSize = 20; |
|
|
timeMode.value = 'month'; |
|
|
timeMode.value = 'month'; |
|
|
selectedYear.value = String(n.getFullYear()); |
|
|
selectedYear.value = String(n.getFullYear()); |
|
|
selectedQuarter.value = Math.ceil((n.getMonth() + 1) / 3); |
|
|
selectedQuarter.value = Math.ceil((n.getMonth() + 1) / 3); |
|
|
selectedMonth.value = ''; |
|
|
selectedMonth.value = ''; |
|
|
|
|
|
customRange.value = []; |
|
|
getList(); |
|
|
getList(); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
const handleExport = async () => { |
|
|
const handleExport = async () => { |
|
|
try { |
|
|
try { |
|
|
const res = await exportLawEnforcer({ |
|
|
const res = await exportLawEnforcerDomain({ |
|
|
lawEnforcer: queryParams.lawEnforcer || undefined, |
|
|
lawEnforcer: queryParams.lawEnforcer || undefined, |
|
|
districtName: queryParams.area || undefined, |
|
|
domainName: queryParams.domainName || undefined, |
|
|
bureauDeptName: queryParams.field || undefined, |
|
|
|
|
|
...buildTimeParams() |
|
|
...buildTimeParams() |
|
|
}); |
|
|
}); |
|
|
const blob = new Blob([res as any], { |
|
|
const blob = new Blob([res as any], { |
|
|
@ -155,7 +166,7 @@ const handleExport = async () => { |
|
|
const url = window.URL.createObjectURL(blob); |
|
|
const url = window.URL.createObjectURL(blob); |
|
|
const link = document.createElement('a'); |
|
|
const link = document.createElement('a'); |
|
|
link.href = url; |
|
|
link.href = url; |
|
|
link.download = '执法人员列表.xlsx'; |
|
|
link.download = '执法人员-领域报表.xlsx'; |
|
|
link.click(); |
|
|
link.click(); |
|
|
window.URL.revokeObjectURL(url); |
|
|
window.URL.revokeObjectURL(url); |
|
|
} catch (e) { |
|
|
} catch (e) { |
|
|
@ -173,8 +184,9 @@ const handleSortChange = (sortObj: { prop: string; order: 'ascending' | 'descend |
|
|
queryParams.orderByColumn = 'enforce_count'; |
|
|
queryParams.orderByColumn = 'enforce_count'; |
|
|
queryParams.isAsc = sortObj.order === 'ascending' ? 'asc' : 'desc'; |
|
|
queryParams.isAsc = sortObj.order === 'ascending' ? 'asc' : 'desc'; |
|
|
} else { |
|
|
} else { |
|
|
queryParams.orderByColumn = ''; |
|
|
// 非执法次数列排序(或取消排序),回退到默认执法次数降序 |
|
|
queryParams.isAsc = ''; |
|
|
queryParams.orderByColumn = 'enforce_count'; |
|
|
|
|
|
queryParams.isAsc = 'desc'; |
|
|
} |
|
|
} |
|
|
queryParams.pageNum = 1; |
|
|
queryParams.pageNum = 1; |
|
|
getList(); |
|
|
getList(); |
|
|
@ -183,6 +195,7 @@ const handleSortChange = (sortObj: { prop: string; order: 'ascending' | 'descend |
|
|
// ======================== 详情弹窗 ======================== |
|
|
// ======================== 详情弹窗 ======================== |
|
|
const detailDialogVisible = ref(false); |
|
|
const detailDialogVisible = ref(false); |
|
|
const detailEnforcer = ref<EnforcerRow | null>(null); |
|
|
const detailEnforcer = ref<EnforcerRow | null>(null); |
|
|
|
|
|
const detailDomainName = ref<string | undefined>(undefined); |
|
|
const detailLoading = ref(false); |
|
|
const detailLoading = ref(false); |
|
|
const detailTableData = ref<LawEnforcerDetailRow[]>([]); |
|
|
const detailTableData = ref<LawEnforcerDetailRow[]>([]); |
|
|
const detailTotal = ref(0); |
|
|
const detailTotal = ref(0); |
|
|
@ -193,8 +206,9 @@ const getDetailList = async () => { |
|
|
detailLoading.value = true; |
|
|
detailLoading.value = true; |
|
|
try { |
|
|
try { |
|
|
if (!detailEnforcer.value?.lawEnforcerId) return; |
|
|
if (!detailEnforcer.value?.lawEnforcerId) return; |
|
|
const res = await listLawEnforcerDetails({ |
|
|
const res = await listLawEnforcerDomainDetails({ |
|
|
lawEnforcerId: detailEnforcer.value.lawEnforcerId, |
|
|
lawEnforcerId: detailEnforcer.value.lawEnforcerId, |
|
|
|
|
|
domainName: detailDomainName.value, |
|
|
...buildTimeParams(), |
|
|
...buildTimeParams(), |
|
|
pageNum: detailPage.value, |
|
|
pageNum: detailPage.value, |
|
|
pageSize: detailPageSize.value |
|
|
pageSize: detailPageSize.value |
|
|
@ -202,7 +216,7 @@ const getDetailList = async () => { |
|
|
detailTableData.value = (res as any)?.rows || []; |
|
|
detailTableData.value = (res as any)?.rows || []; |
|
|
detailTotal.value = (res as any)?.total || 0; |
|
|
detailTotal.value = (res as any)?.total || 0; |
|
|
} catch (e) { |
|
|
} catch (e) { |
|
|
console.warn('[scan-enforcer] 详情接口调用失败', e); |
|
|
console.warn('[scan-domain] 详情接口调用失败', e); |
|
|
} finally { |
|
|
} finally { |
|
|
detailLoading.value = false; |
|
|
detailLoading.value = false; |
|
|
} |
|
|
} |
|
|
@ -210,6 +224,7 @@ const getDetailList = async () => { |
|
|
|
|
|
|
|
|
const handleDetail = (row: EnforcerRow) => { |
|
|
const handleDetail = (row: EnforcerRow) => { |
|
|
detailEnforcer.value = row; |
|
|
detailEnforcer.value = row; |
|
|
|
|
|
detailDomainName.value = queryParams.domainName; |
|
|
detailPage.value = 1; |
|
|
detailPage.value = 1; |
|
|
detailDialogVisible.value = true; |
|
|
detailDialogVisible.value = true; |
|
|
getDetailList(); |
|
|
getDetailList(); |
|
|
@ -244,7 +259,7 @@ onMounted(() => { |
|
|
<el-input v-model="queryParams.lawEnforcer" placeholder="请输入关键字" class="search-input" clearable @keyup.enter="handleSearch" /> |
|
|
<el-input v-model="queryParams.lawEnforcer" placeholder="请输入关键字" class="search-input" clearable @keyup.enter="handleSearch" /> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
<el-form-item label="所属领域"> |
|
|
<el-form-item label="所属领域"> |
|
|
<el-select v-model="queryParams.field" placeholder="请选择" class="search-select" clearable> |
|
|
<el-select v-model="queryParams.domainName" placeholder="请选择" class="search-select" clearable> |
|
|
<el-option v-for="item in fieldOptions" :key="item.domainId" :label="item.domainName" :value="item.domainName" /> |
|
|
<el-option v-for="item in fieldOptions" :key="item.domainId" :label="item.domainName" :value="item.domainName" /> |
|
|
</el-select> |
|
|
</el-select> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
@ -253,6 +268,7 @@ onMounted(() => { |
|
|
<el-option label="年度" value="year" /> |
|
|
<el-option label="年度" value="year" /> |
|
|
<el-option label="季度" value="quarter" /> |
|
|
<el-option label="季度" value="quarter" /> |
|
|
<el-option label="月度" value="month" /> |
|
|
<el-option label="月度" value="month" /> |
|
|
|
|
|
<el-option label="自定义" value="custom" /> |
|
|
</el-select> |
|
|
</el-select> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
<el-form-item v-if="timeMode === 'year'"> |
|
|
<el-form-item v-if="timeMode === 'year'"> |
|
|
@ -271,6 +287,17 @@ onMounted(() => { |
|
|
<el-form-item v-if="timeMode === 'month'"> |
|
|
<el-form-item v-if="timeMode === 'month'"> |
|
|
<el-date-picker v-model="selectedMonth" type="month" placeholder="选择月份" value-format="YYYY-MM" style="width: 150px" /> |
|
|
<el-date-picker v-model="selectedMonth" type="month" placeholder="选择月份" value-format="YYYY-MM" style="width: 150px" /> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
|
|
|
<el-form-item v-if="timeMode === 'custom'"> |
|
|
|
|
|
<el-date-picker |
|
|
|
|
|
v-model="customRange" |
|
|
|
|
|
type="daterange" |
|
|
|
|
|
range-separator="至" |
|
|
|
|
|
start-placeholder="开始日期" |
|
|
|
|
|
end-placeholder="结束日期" |
|
|
|
|
|
value-format="YYYY-MM-DD" |
|
|
|
|
|
style="width: 260px" |
|
|
|
|
|
/> |
|
|
|
|
|
</el-form-item> |
|
|
<el-form-item> |
|
|
<el-form-item> |
|
|
<el-button type="primary" @click="handleSearch">搜索</el-button> |
|
|
<el-button type="primary" @click="handleSearch">搜索</el-button> |
|
|
<el-button type="primary" @click="handleReset">重置</el-button> |
|
|
<el-button type="primary" @click="handleReset">重置</el-button> |
|
|
@ -295,7 +322,7 @@ onMounted(() => { |
|
|
<el-table-column type="selection" width="55" align="center" /> |
|
|
<el-table-column type="selection" width="55" align="center" /> |
|
|
<el-table-column label="序号" width="90" align="center" type="index" /> |
|
|
<el-table-column label="序号" width="90" align="center" type="index" /> |
|
|
<el-table-column prop="lawEnforcer" label="执法人员" min-width="160" align="center" /> |
|
|
<el-table-column prop="lawEnforcer" label="执法人员" min-width="160" align="center" /> |
|
|
<el-table-column prop="zfcs" label="执法次数" width="140" align="center" sortable="custom" /> |
|
|
<el-table-column prop="zfcs" label="执法次数" width="140" align="center" sortable="custom" :default-sort="{ prop: 'zfcs', order: 'descending' }" /> |
|
|
<el-table-column prop="bureauDeptName" label="所属领域" min-width="260" align="center" show-overflow-tooltip /> |
|
|
<el-table-column prop="bureauDeptName" label="所属领域" min-width="260" align="center" show-overflow-tooltip /> |
|
|
<el-table-column label="操作" width="90" align="center" fixed="right"> |
|
|
<el-table-column label="操作" width="90" align="center" fixed="right"> |
|
|
<template #default="{ row }"> |
|
|
<template #default="{ row }"> |
|
|
|