You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
637 lines
18 KiB
637 lines
18 KiB
<template>
|
|
<div class="legal-tech-container">
|
|
<!-- 搜索区域 -->
|
|
<div class="search-panel">
|
|
<el-form :model="searchForm" inline>
|
|
<el-form-item label="时间筛选:">
|
|
<el-date-picker
|
|
v-model="searchForm.timeRange"
|
|
type="datetimerange"
|
|
range-separator="至"
|
|
start-placeholder="开始时间"
|
|
end-placeholder="截止时间"
|
|
class="date-picker"
|
|
format="YYYY-MM-DD HH:mm"
|
|
value-format="YYYY-MM-DD HH:mm:ss"
|
|
/>
|
|
</el-form-item>
|
|
|
|
<el-form-item label="执法单位:">
|
|
<el-input v-model="searchForm.lawEnforcementAgency" placeholder="请输入关键字" class="search-input" clearable @keyup.enter="handleSearch" />
|
|
</el-form-item>
|
|
|
|
<el-form-item>
|
|
<el-button type="primary" @click="handleSearch" :loading="loading">搜索</el-button>
|
|
</el-form-item>
|
|
|
|
<el-form-item>
|
|
<el-button @click="handleReset">重置</el-button>
|
|
</el-form-item>
|
|
</el-form>
|
|
</div>
|
|
<div class="action-bar">
|
|
<div class="action-left">
|
|
<el-button type="primary" @click="handleAdd">信息登记</el-button>
|
|
</div>
|
|
</div>
|
|
<!-- 数据表格 -->
|
|
<div class="table-container">
|
|
<el-table v-loading="loading" :data="tableData" border :header-cell-style="{ backgroundColor: '#f5f7fa', fontWeight: 'bold' }">
|
|
<el-table-column prop="lawEnforcementAgency" label="执法单位" min-width="160" show-overflow-tooltip />
|
|
|
|
<el-table-column label="法制材料" min-width="200">
|
|
<template #default="{ row }">
|
|
<div v-if="row.legalMaterials" class="file-cell">
|
|
<el-icon class="file-icon">
|
|
<Paperclip />
|
|
</el-icon>
|
|
<span class="file-name" :title="extractFileName(row.legalMaterials)">{{ extractFileName(row.legalMaterials) }}</span>
|
|
<el-button size="small" @click="downloadFile(row.legalMaterials)">下载</el-button>
|
|
</div>
|
|
<span v-else>--</span>
|
|
</template>
|
|
</el-table-column>
|
|
|
|
<el-table-column label="技术材料" min-width="200">
|
|
<template #default="{ row }">
|
|
<div v-if="row.technicalMaterials" class="file-cell">
|
|
<el-icon class="file-icon">
|
|
<Paperclip />
|
|
</el-icon>
|
|
<span class="file-name" :title="extractFileName(row.technicalMaterials)">{{ extractFileName(row.technicalMaterials) }}</span>
|
|
<el-button size="small" @click="downloadFile(row.technicalMaterials)">下载</el-button>
|
|
</div>
|
|
<span v-else>--</span>
|
|
</template>
|
|
</el-table-column>
|
|
|
|
<el-table-column label="提交时间" width="180">
|
|
<template #default="{ row }">
|
|
{{ formatDateTime(row.createTime) }}
|
|
</template>
|
|
</el-table-column>
|
|
|
|
<el-table-column label="状态" width="110" align="center">
|
|
<template #default="{ row }">
|
|
<span class="review-status" :class="`is-${row.reviewStatus}`">
|
|
{{ getReviewStatusText(row.reviewStatus) }}
|
|
</span>
|
|
</template>
|
|
</el-table-column>
|
|
|
|
<el-table-column label="操作" width="210" fixed="right">
|
|
<template #default="{ row }">
|
|
<el-button size="small" type="primary" link @click="handleProgress(row)">处理进度</el-button>
|
|
<el-button v-if="row.reviewStatus === 'pending'" size="small" type="primary" @click="handleReview(row)"> 审查 </el-button>
|
|
<el-button size="small" type="primary" link @click="handleEdit(row)">编辑</el-button>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
</div>
|
|
|
|
<!-- 审查处理 -->
|
|
<el-dialog v-model="reviewVisible" title="审查处理" width="720px" :close-on-click-modal="false" @closed="resetReviewForm">
|
|
<el-form ref="reviewFormRef" :model="reviewForm" :rules="reviewRules" label-width="100px" class="review-form">
|
|
<el-form-item label="审查结果:" prop="result">
|
|
<el-radio-group v-model="reviewForm.result" @change="handleReviewResultChange">
|
|
<el-radio value="approved">通过</el-radio>
|
|
<el-radio value="rejected">不通过</el-radio>
|
|
</el-radio-group>
|
|
</el-form-item>
|
|
<el-form-item label="审查意见:" prop="comment">
|
|
<el-input v-model="reviewForm.comment" type="textarea" :rows="8" maxlength="100" show-word-limit placeholder="请输入审查意见" />
|
|
</el-form-item>
|
|
</el-form>
|
|
<template #footer>
|
|
<el-button type="primary" @click="submitReview">提交</el-button>
|
|
<el-button @click="reviewVisible = false">取消</el-button>
|
|
</template>
|
|
</el-dialog>
|
|
|
|
<!-- 处理进度 -->
|
|
<el-dialog v-model="progressVisible" title="处理进度" width="680px" class="progress-dialog">
|
|
<div v-if="progressRow" class="progress-timeline">
|
|
<div class="progress-step">
|
|
<div class="progress-marker">
|
|
<span class="progress-dot is-complete"></span>
|
|
<span class="progress-line"></span>
|
|
</div>
|
|
<div class="progress-content">
|
|
<div class="progress-row">
|
|
<span class="progress-label">企业提交</span>
|
|
<span class="progress-time">{{ formatDateTime(progressRow.createTime) }}</span>
|
|
<span class="progress-company">{{ SUBMIT_COMPANY }}</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="progress-step">
|
|
<div class="progress-marker">
|
|
<span class="progress-dot" :class="progressRow.reviewStatus === 'pending' ? 'is-pending' : 'is-complete'"></span>
|
|
</div>
|
|
<div class="progress-content">
|
|
<div class="progress-row">
|
|
<span class="progress-label" :class="{ 'is-warning': progressRow.reviewStatus === 'pending' }">
|
|
{{ progressRow.reviewStatus === 'pending' ? '等待审查' : '审查结果' }}
|
|
</span>
|
|
<template v-if="progressRow.reviewStatus === 'pending'">
|
|
<span class="progress-state">等待审查处理</span>
|
|
</template>
|
|
<template v-else>
|
|
<span class="progress-time">{{ formatDateTime(progressRow.reviewTime) }}</span>
|
|
<span class="progress-reviewer">
|
|
{{ progressRow.reviewerName || currentUserName }}——{{ progressRow.reviewUnit || progressRow.lawEnforcementAgency || '--' }}
|
|
</span>
|
|
</template>
|
|
</div>
|
|
<div v-if="progressRow.reviewStatus !== 'pending'" class="progress-result">
|
|
<div>审查结果:{{ progressRow.reviewStatus === 'approved' ? '通过' : '不通过' }}</div>
|
|
<div>审查意见:{{ progressRow.reviewComment || '无' }}</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</el-dialog>
|
|
|
|
<!-- 分页 -->
|
|
<div class="pagination-container">
|
|
<span class="total-text">共 {{ total }} 项数据</span>
|
|
<el-pagination
|
|
v-model:current-page="currentPage"
|
|
v-model:page-size="pageSize"
|
|
:total="total"
|
|
:page-sizes="[10, 20, 50, 100]"
|
|
layout="prev, pager, next, jumper, ->, total, sizes"
|
|
@size-change="handleSizeChange"
|
|
@current-change="handleCurrentChange"
|
|
/>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { ref, reactive, nextTick, onMounted, getCurrentInstance } from 'vue';
|
|
import { useRouter } from 'vue-router';
|
|
import { ElMessage } from 'element-plus';
|
|
import type { FormInstance, FormRules } from 'element-plus';
|
|
import { Paperclip } from '@element-plus/icons-vue';
|
|
import { getLegalTechRecordsPage } from '@/api/nos/index';
|
|
import type { NosLawEnforcementFilingPageVO, LegalTechRecordsPageResponse } from '@/api/nos/type';
|
|
import { parseTime } from '@/utils/ruoyi';
|
|
|
|
const router = useRouter();
|
|
const { proxy } = getCurrentInstance() as any;
|
|
|
|
type ReviewStatus = 'pending' | 'approved' | 'rejected';
|
|
type ReviewDecision = Exclude<ReviewStatus, 'pending'>;
|
|
|
|
interface LegalTechReviewRecord extends NosLawEnforcementFilingPageVO {
|
|
reviewStatus: ReviewStatus;
|
|
reviewComment?: string;
|
|
reviewerName?: string;
|
|
reviewUnit?: string;
|
|
reviewTime?: string;
|
|
}
|
|
|
|
const loading = ref(false);
|
|
const tableData = ref<LegalTechReviewRecord[]>([]);
|
|
const total = ref(0);
|
|
const currentPage = ref(1);
|
|
const pageSize = ref(10);
|
|
const reviewVisible = ref(false);
|
|
const progressVisible = ref(false);
|
|
const reviewFormRef = ref<FormInstance>();
|
|
const reviewingRow = ref<LegalTechReviewRecord>();
|
|
const progressRow = ref<LegalTechReviewRecord>();
|
|
|
|
const searchForm = reactive({
|
|
timeRange: [] as string[],
|
|
lawEnforcementAgency: ''
|
|
});
|
|
|
|
const reviewForm = reactive<{
|
|
result: ReviewDecision;
|
|
comment: string;
|
|
}>({
|
|
result: 'approved',
|
|
comment: ''
|
|
});
|
|
|
|
const currentUserName = localStorage.getItem('username') || '当前用户';
|
|
const SUBMIT_COMPANY = '深圳市新粤云科技有限公司';
|
|
const MOCK_REVIEW_STATUS: ReviewStatus[] = ['pending', 'pending', 'rejected', 'rejected'];
|
|
const MOCK_REVIEW_COMMENTS = ['', '', '视频文件不符合,请重新上传', '材料信息不完整,请补充后重新提交'];
|
|
|
|
const validateReviewComment = (_rule: unknown, value: string, callback: (error?: Error) => void) => {
|
|
if (reviewForm.result === 'rejected' && !value?.trim()) {
|
|
callback(new Error('审批不通过时必须填写审查意见'));
|
|
return;
|
|
}
|
|
callback();
|
|
};
|
|
|
|
const reviewRules: FormRules = {
|
|
comment: [{ validator: validateReviewComment, trigger: ['blur', 'change'] }]
|
|
};
|
|
|
|
const formatDateTime = (time?: string) => {
|
|
if (!time) return '--';
|
|
return parseTime(time, '{y}-{m}-{d} {h}:{i}') || '--';
|
|
};
|
|
|
|
const getReviewStatusText = (status: ReviewStatus) => {
|
|
if (status === 'pending') return '等待审查';
|
|
if (status === 'rejected') return '不通过';
|
|
return '已通过';
|
|
};
|
|
|
|
const getReviewResultTime = (createTime?: string) => {
|
|
if (!createTime) return '';
|
|
const normalizedTime = createTime.includes('T') ? createTime : createTime.replace(/-/g, '/');
|
|
const submitTime = new Date(normalizedTime).getTime();
|
|
if (Number.isNaN(submitTime)) return '';
|
|
return parseTime(submitTime + 49 * 60 * 60 * 1000, '{y}-{m}-{d} {h}:{i}:{s}') || '';
|
|
};
|
|
|
|
const addMockReviewData = (rows: NosLawEnforcementFilingPageVO[]): LegalTechReviewRecord[] => {
|
|
return rows.map((row, index) => {
|
|
const dataIndex = (currentPage.value - 1) * pageSize.value + index;
|
|
const reviewStatus = MOCK_REVIEW_STATUS[dataIndex] || 'approved';
|
|
return {
|
|
...row,
|
|
reviewStatus,
|
|
reviewComment: reviewStatus === 'approved' ? '无' : reviewStatus === 'rejected' ? MOCK_REVIEW_COMMENTS[dataIndex] : '',
|
|
reviewerName: currentUserName,
|
|
reviewUnit: row.lawEnforcementAgency || '',
|
|
reviewTime: reviewStatus === 'pending' ? '' : getReviewResultTime(row.createTime)
|
|
};
|
|
});
|
|
};
|
|
|
|
const BASE_API = import.meta.env.VITE_APP_BASE_API || '';
|
|
const FILE_SERVER_PREFIX = import.meta.env.VITE_APP_FILE_SERVER_PREFIX || '';
|
|
|
|
onMounted(() => {
|
|
getList();
|
|
});
|
|
const isOssId = (val: string) => /^[0-9]+$/.test(val.trim());
|
|
|
|
const toRelativeFilePath = (val: string) => {
|
|
const raw = val.trim();
|
|
if (!raw) return '';
|
|
const prefix = FILE_SERVER_PREFIX.replace(/\/+$/, '');
|
|
let path = raw.startsWith('/') ? raw : `/${raw}`;
|
|
const normalizedPrefix = prefix.startsWith('http') ? prefix : `/${prefix}`;
|
|
while (path === normalizedPrefix || path.startsWith(`${normalizedPrefix}/`)) {
|
|
path = path.slice(normalizedPrefix.length) || '/';
|
|
if (!path.startsWith('/')) path = `/${path}`;
|
|
}
|
|
return path;
|
|
};
|
|
|
|
const buildFileUrl = (val: string) => {
|
|
if (!val) return '';
|
|
const raw = val.trim();
|
|
if (raw.startsWith('http://') || raw.startsWith('https://') || raw.startsWith('blob:') || raw.startsWith('data:')) {
|
|
return raw;
|
|
}
|
|
if (isOssId(raw)) {
|
|
return `${BASE_API}/resource/oss/download/${raw}`;
|
|
}
|
|
const relative = toRelativeFilePath(raw);
|
|
return `${FILE_SERVER_PREFIX.replace(/\/+$/, '')}${relative}`;
|
|
};
|
|
|
|
const extractFileName = (val: string) => {
|
|
if (!val) return '';
|
|
const raw = val.trim();
|
|
if (isOssId(raw)) return raw;
|
|
try {
|
|
const withoutQuery = raw.split('?')[0].split('#')[0];
|
|
const parts = withoutQuery.split('/');
|
|
return parts[parts.length - 1] || raw;
|
|
} catch {
|
|
return raw;
|
|
}
|
|
};
|
|
|
|
const downloadFile = async (file: string, fileName?: string) => {
|
|
if (!file) return;
|
|
const raw = file.trim();
|
|
|
|
if (isOssId(raw) && proxy?.$download?.oss) {
|
|
proxy.$download.oss(raw);
|
|
return;
|
|
}
|
|
|
|
const url = buildFileUrl(raw);
|
|
if (!url) {
|
|
ElMessage.error('文件下载失败');
|
|
return;
|
|
}
|
|
|
|
const link = document.createElement('a');
|
|
link.href = url;
|
|
link.target = '_blank';
|
|
if (fileName) link.download = fileName;
|
|
link.rel = 'noopener noreferrer';
|
|
document.body.appendChild(link);
|
|
link.click();
|
|
document.body.removeChild(link);
|
|
};
|
|
|
|
const buildQueryParams = () => {
|
|
return {
|
|
startTime: searchForm.timeRange?.[0] || undefined,
|
|
endTime: searchForm.timeRange?.[1] || undefined,
|
|
lawEnforcementAgency: searchForm.lawEnforcementAgency || undefined,
|
|
pageNo: currentPage.value,
|
|
pageSize: pageSize.value
|
|
};
|
|
};
|
|
|
|
const getList = async () => {
|
|
loading.value = true;
|
|
try {
|
|
const res = (await getLegalTechRecordsPage(buildQueryParams())) as unknown as LegalTechRecordsPageResponse;
|
|
tableData.value = addMockReviewData(res.rows || []);
|
|
total.value = res.total || 0;
|
|
} catch (error) {
|
|
console.error('获取列表数据失败:', error);
|
|
ElMessage.error('获取数据失败,请检查网络连接');
|
|
} finally {
|
|
loading.value = false;
|
|
}
|
|
};
|
|
|
|
const handleSearch = () => {
|
|
currentPage.value = 1;
|
|
getList();
|
|
};
|
|
|
|
const handleReset = () => {
|
|
searchForm.timeRange = [];
|
|
searchForm.lawEnforcementAgency = '';
|
|
currentPage.value = 1;
|
|
getList();
|
|
};
|
|
|
|
const handleAdd = () => {
|
|
router.push({ name: 'LegalTechAdd' });
|
|
};
|
|
|
|
const handleEdit = (row: NosLawEnforcementFilingPageVO) => {
|
|
if (!row.id) {
|
|
ElMessage.warning('记录ID不存在');
|
|
return;
|
|
}
|
|
router.push({
|
|
name: 'LegalTechEdit',
|
|
params: { id: row.id }
|
|
});
|
|
};
|
|
|
|
const handleReview = (row: LegalTechReviewRecord) => {
|
|
reviewingRow.value = row;
|
|
reviewForm.result = 'approved';
|
|
reviewForm.comment = '';
|
|
reviewVisible.value = true;
|
|
nextTick(() => reviewFormRef.value?.clearValidate());
|
|
};
|
|
|
|
const handleReviewResultChange = () => {
|
|
if (reviewForm.result === 'approved') {
|
|
reviewFormRef.value?.clearValidate('comment');
|
|
}
|
|
};
|
|
|
|
const resetReviewForm = () => {
|
|
reviewingRow.value = undefined;
|
|
reviewForm.result = 'approved';
|
|
reviewForm.comment = '';
|
|
reviewFormRef.value?.clearValidate();
|
|
};
|
|
|
|
const submitReview = async () => {
|
|
const isValid = await reviewFormRef.value?.validate().catch(() => false);
|
|
if (!isValid || !reviewingRow.value) return;
|
|
|
|
reviewingRow.value.reviewStatus = reviewForm.result;
|
|
reviewingRow.value.reviewerName = currentUserName;
|
|
reviewingRow.value.reviewUnit = reviewingRow.value.lawEnforcementAgency || '';
|
|
reviewingRow.value.reviewTime = getReviewResultTime(reviewingRow.value.createTime);
|
|
reviewingRow.value.reviewComment = reviewForm.result === 'rejected' ? reviewForm.comment.trim() : reviewForm.comment.trim() || '无';
|
|
|
|
reviewVisible.value = false;
|
|
ElMessage.success(reviewForm.result === 'approved' ? '审查通过' : '已提交不通过意见');
|
|
};
|
|
|
|
const handleProgress = (row: LegalTechReviewRecord) => {
|
|
progressRow.value = row;
|
|
progressVisible.value = true;
|
|
};
|
|
|
|
const handleSizeChange = (val: number) => {
|
|
pageSize.value = val;
|
|
currentPage.value = 1;
|
|
getList();
|
|
};
|
|
|
|
const handleCurrentChange = (val: number) => {
|
|
currentPage.value = val;
|
|
getList();
|
|
};
|
|
</script>
|
|
|
|
<style scoped>
|
|
.legal-tech-container {
|
|
padding: 20px;
|
|
background: #f5f7fa;
|
|
min-height: calc(100vh - 100px);
|
|
}
|
|
|
|
.search-panel {
|
|
display: flex;
|
|
background: #fff;
|
|
padding: 16px 20px;
|
|
border-radius: 8px;
|
|
margin-bottom: 16px;
|
|
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
|
}
|
|
|
|
.action-panel {
|
|
margin-bottom: 16px;
|
|
}
|
|
|
|
:deep(.el-form-item__label) {
|
|
white-space: nowrap;
|
|
margin-right: 8px;
|
|
}
|
|
|
|
.search-input {
|
|
width: 200px;
|
|
}
|
|
|
|
.date-picker {
|
|
width: 360px;
|
|
}
|
|
.action-bar {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
background: #fff;
|
|
padding: 12px 20px;
|
|
border-radius: 8px;
|
|
margin-bottom: 16px;
|
|
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
|
}
|
|
|
|
.action-left {
|
|
display: flex;
|
|
gap: 8px;
|
|
}
|
|
|
|
.table-container {
|
|
background: #fff;
|
|
border-radius: 8px;
|
|
padding: 16px;
|
|
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
|
margin-bottom: 16px;
|
|
}
|
|
|
|
.file-cell {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
}
|
|
|
|
.file-icon {
|
|
color: #909399;
|
|
}
|
|
|
|
.file-name {
|
|
flex: 1;
|
|
color: #409eff;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.review-status {
|
|
font-size: 14px;
|
|
}
|
|
|
|
.review-status.is-pending,
|
|
.review-status.is-rejected {
|
|
color: #f56c6c;
|
|
}
|
|
|
|
.review-status.is-approved {
|
|
color: #303133;
|
|
}
|
|
|
|
.review-form {
|
|
padding: 8px 8px 0;
|
|
}
|
|
|
|
.review-form :deep(.el-textarea__inner) {
|
|
resize: vertical;
|
|
}
|
|
|
|
.progress-dialog :deep(.el-dialog__body) {
|
|
padding: 12px 28px 32px;
|
|
}
|
|
|
|
.progress-timeline {
|
|
padding: 16px 0 0 8px;
|
|
}
|
|
|
|
.progress-step {
|
|
display: flex;
|
|
min-height: 132px;
|
|
}
|
|
|
|
.progress-step:last-child {
|
|
min-height: auto;
|
|
}
|
|
|
|
.progress-marker {
|
|
position: relative;
|
|
display: flex;
|
|
flex: 0 0 32px;
|
|
justify-content: center;
|
|
}
|
|
|
|
.progress-dot {
|
|
z-index: 1;
|
|
width: 10px;
|
|
height: 10px;
|
|
margin-top: 5px;
|
|
border-radius: 50%;
|
|
background: #c0c4cc;
|
|
}
|
|
|
|
.progress-dot.is-complete,
|
|
.progress-dot.is-pending {
|
|
background: #409eff;
|
|
}
|
|
|
|
.progress-line {
|
|
position: absolute;
|
|
top: 15px;
|
|
bottom: 0;
|
|
width: 1px;
|
|
background: #c0c4cc;
|
|
}
|
|
|
|
.progress-content {
|
|
flex: 1;
|
|
min-width: 0;
|
|
padding-left: 8px;
|
|
}
|
|
|
|
.progress-row {
|
|
display: flex;
|
|
align-items: baseline;
|
|
gap: 24px;
|
|
line-height: 22px;
|
|
}
|
|
|
|
.progress-label {
|
|
flex: 0 0 72px;
|
|
color: #303133;
|
|
font-weight: 600;
|
|
}
|
|
|
|
.progress-label.is-warning,
|
|
.progress-state {
|
|
color: #f56c6c;
|
|
}
|
|
|
|
.progress-time,
|
|
.progress-company,
|
|
.progress-reviewer {
|
|
color: #909399;
|
|
}
|
|
|
|
.progress-result {
|
|
margin-top: 22px;
|
|
padding-left: 96px;
|
|
color: #303133;
|
|
line-height: 32px;
|
|
}
|
|
|
|
.pagination-container {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
background: #fff;
|
|
padding: 12px 20px;
|
|
border-radius: 8px;
|
|
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
|
}
|
|
|
|
.total-text {
|
|
color: #909399;
|
|
}
|
|
</style>
|
|
|