|
|
|
|
@ -19,6 +19,29 @@
@@ -19,6 +19,29 @@
|
|
|
|
|
/> |
|
|
|
|
</el-select> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="隐患分类" prop="hazardCategory"> |
|
|
|
|
<el-select v-model="queryParams.hazardCategory" clearable placeholder="全部分类"> |
|
|
|
|
<el-option |
|
|
|
|
v-for="dict in dict.type.hazard_category" |
|
|
|
|
:key="dict.value" |
|
|
|
|
:label="dict.label" |
|
|
|
|
:value="dict.value" |
|
|
|
|
/> |
|
|
|
|
</el-select> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="上报时间"> |
|
|
|
|
<el-date-picker |
|
|
|
|
v-model="dateRange" |
|
|
|
|
type="daterange" |
|
|
|
|
size="small" |
|
|
|
|
value-format="yyyy-MM-dd" |
|
|
|
|
range-separator="至" |
|
|
|
|
start-placeholder="开始日期" |
|
|
|
|
end-placeholder="结束日期" |
|
|
|
|
unlink-panels |
|
|
|
|
class="ledger-date-range" |
|
|
|
|
/> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item v-if="isSuperAdmin" label="单位" prop="unitId"> |
|
|
|
|
<el-select v-model="queryParams.unitId" clearable filterable placeholder="全部单位"> |
|
|
|
|
<el-option |
|
|
|
|
@ -33,6 +56,13 @@
@@ -33,6 +56,13 @@
|
|
|
|
|
<el-form-item> |
|
|
|
|
<el-button type="primary" icon="el-icon-search" size="small" @click="handleQuery">查询</el-button> |
|
|
|
|
<el-button icon="el-icon-refresh" size="small" @click="resetQuery">重置</el-button> |
|
|
|
|
<el-button |
|
|
|
|
v-if="isSuperAdmin" |
|
|
|
|
type="primary" |
|
|
|
|
icon="el-icon-upload2" |
|
|
|
|
size="small" |
|
|
|
|
@click="handleImport" |
|
|
|
|
>一键导入</el-button> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-form> |
|
|
|
|
</template> |
|
|
|
|
@ -57,9 +87,9 @@
@@ -57,9 +87,9 @@
|
|
|
|
|
> |
|
|
|
|
<el-table-column prop="reportNo" label="隐患编号" min-width="150" show-overflow-tooltip /> |
|
|
|
|
<el-table-column prop="hazardName" label="隐患名称" min-width="190" show-overflow-tooltip /> |
|
|
|
|
<el-table-column label="分级" width="100" align="center"> |
|
|
|
|
<el-table-column label="隐患分类" width="100" align="center"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<el-tag :type="levelTagType(scope.row)" size="small">{{ levelLabel(scope.row) }}</el-tag> |
|
|
|
|
<el-tag :type="categoryTagType(scope.row)" size="small">{{ categoryLabel(scope.row) }}</el-tag> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column label="状态" width="110" align="center"> |
|
|
|
|
@ -91,7 +121,7 @@
@@ -91,7 +121,7 @@
|
|
|
|
|
> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<el-button size="mini" @click="openDetail(scope.row)">详情</el-button> |
|
|
|
|
<el-button v-if="isReviewing(scope.row)" type="primary" size="mini" @click="goAudit(scope.row)">去审核</el-button> |
|
|
|
|
<el-button v-if="canAudit(scope.row)" type="primary" size="mini" @click="goAudit(scope.row)">去审核</el-button> |
|
|
|
|
<el-button v-if="isSyncFailed(scope.row)" type="warning" size="mini" @click="handleRetrySync(scope.row)">重试同步</el-button> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
@ -167,41 +197,141 @@
@@ -167,41 +197,141 @@
|
|
|
|
|
</div> |
|
|
|
|
<span v-else class="muted">暂无附件</span> |
|
|
|
|
</div> |
|
|
|
|
<div class="flow-section"> |
|
|
|
|
<div class="section-title">审核流程</div> |
|
|
|
|
<div v-loading="flowLoading" class="flow-steps"> |
|
|
|
|
<el-steps v-if="flowNodes.length" :active="flowActiveIndex" align-center finish-status="success"> |
|
|
|
|
<el-step v-for="(node, index) in flowNodes" :key="index"> |
|
|
|
|
<template slot="title">{{ node.taskName || '—' }}</template> |
|
|
|
|
<template slot="description"> |
|
|
|
|
<div class="step-desc"> |
|
|
|
|
<span v-if="node.assigneeName">办理人:{{ node.assigneeName }}</span> |
|
|
|
|
<span v-else-if="node.candidate">待办理</span> |
|
|
|
|
<span>{{ formatTime(node.createTime) }}</span> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
</el-step> |
|
|
|
|
</el-steps> |
|
|
|
|
<span v-else class="muted">暂无流程信息</span> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
<el-empty v-else-if="!detailLoading" description="暂无详情数据" /> |
|
|
|
|
</div> |
|
|
|
|
<span slot="footer"> |
|
|
|
|
<el-button @click="detailVisible = false">关闭</el-button> |
|
|
|
|
<el-button v-if="detail && isReviewing(detail)" type="primary" @click="goAudit(detail)">去审核</el-button> |
|
|
|
|
<el-button v-if="detail && isReviewing(detail) && detailCanApprove" type="primary" @click="goAudit(detail)">去审核</el-button> |
|
|
|
|
</span> |
|
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
|
|
<el-dialog |
|
|
|
|
title="历史隐患数据导入" |
|
|
|
|
:visible.sync="importUpload.open" |
|
|
|
|
width="460px" |
|
|
|
|
append-to-body |
|
|
|
|
@closed="resetImportUpload" |
|
|
|
|
> |
|
|
|
|
<div class="import-mode"> |
|
|
|
|
<el-radio-group v-model="importUpload.mode" size="small" @change="handleImportModeChange"> |
|
|
|
|
<el-radio-button label="excel">导入Excel</el-radio-button> |
|
|
|
|
<el-radio-button label="image">导入图片</el-radio-button> |
|
|
|
|
</el-radio-group> |
|
|
|
|
</div> |
|
|
|
|
<div class="upload-container"> |
|
|
|
|
<el-upload |
|
|
|
|
ref="hazardImportUpload" |
|
|
|
|
:limit="1" |
|
|
|
|
:accept="importUpload.mode === 'image' ? '.zip' : '.xlsx,.xls'" |
|
|
|
|
:headers="importUpload.headers" |
|
|
|
|
:action="importUpload.action" |
|
|
|
|
:disabled="importUpload.isUploading" |
|
|
|
|
:before-upload="beforeImportUpload" |
|
|
|
|
:on-progress="handleImportProgress" |
|
|
|
|
:on-success="handleImportSuccess" |
|
|
|
|
:on-error="handleImportError" |
|
|
|
|
:auto-upload="false" |
|
|
|
|
drag |
|
|
|
|
> |
|
|
|
|
<i class="el-icon-upload" /> |
|
|
|
|
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div> |
|
|
|
|
<div slot="tip" class="el-upload__tip"> |
|
|
|
|
<span v-if="importUpload.mode === 'image'">仅支持 .zip 压缩包(含一个 Excel 数据文件与按隐患编号命名的图片附件),单包不超过 500MB;包较大时导入可能需要几分钟,请勿关闭页面。</span> |
|
|
|
|
<span v-else>仅支持 .xlsx、.xls 格式文件。</span> |
|
|
|
|
<el-link type="primary" :underline="false" class="import-template-link" @click="importTemplate">下载模板</el-link> |
|
|
|
|
</div> |
|
|
|
|
</el-upload> |
|
|
|
|
</div> |
|
|
|
|
<div slot="footer" class="dialog-footer"> |
|
|
|
|
<el-button type="primary" :loading="importUpload.isUploading" @click="submitImportForm">确 定</el-button> |
|
|
|
|
<el-button :disabled="importUpload.isUploading" @click="importUpload.open = false">取 消</el-button> |
|
|
|
|
</div> |
|
|
|
|
</el-dialog> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
|
/* global MyConfig */ |
|
|
|
|
import { getMyFactoryDepartment, listFactoryDepartments } from '@/api/system/dept' |
|
|
|
|
import { listHazardLedger, getHazardLedgerDetail, listHazardLedgerAttachments, retryHazardSync } from '@/api/hazard/ledger' |
|
|
|
|
import { listHazardLedger, getHazardLedgerDetail, listHazardLedgerAttachments, retryHazardSync, getHazardImportAction, downloadHazardImportTemplate } from '@/api/hazard/ledger' |
|
|
|
|
import { flowRecord } from '@/api/flowable/finished' |
|
|
|
|
import { getToken } from '@/utils/auth' |
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
|
name: 'HazardLedger', |
|
|
|
|
data() { return { loading: false, detailLoading: false, detailVisible: false, ledgerList: [], total: 0, unitOptions: [], currentFactory: null, attachments: [], detail: null, queryParams: { pageNum: 1, pageSize: 10, status: undefined, unitId: undefined, hazardName: undefined }, statusOptions: [{ label: '待提交', value: 'draft' }, { label: '审核中', value: 'reviewing' }, { label: '整改中', value: 'rectifying' }, { label: '已通过', value: 'approved' }, { label: '已驳回', value: 'rejected' }], basicFields: [{ label: '单位', key: 'unitName' }, { label: '所属部门', key: 'departmentName', fallback: 'factoryDeptName' }, { label: '上报人', key: 'reporterName' }, { label: '隐患分类', key: 'hazardCategoryName', fallback: 'hazardCategory' }, { label: '隐患类型', key: 'hazardTypeName', fallback: 'hazardType' }, { label: '隐患来源', key: 'sourceTypeName', fallback: 'sourceType' }, { label: '专业', key: 'majorName', fallback: 'major' }, { label: '风险分析单元', key: 'riskUnit' }, { label: '风险分析对象', key: 'riskTarget' }, { label: '发现时间', key: 'discoverTime', time: true }, { label: '创建时间', key: 'createTime', time: true }, { label: '更新人', key: 'updateBy' }], flowFields: [{ label: '治理类型', key: 'governanceTypeName', fallback: 'governanceType' }, { label: '整改负责人', key: 'chargePersonName' }, { label: '限定完成时间', key: 'limitedCompleteTime', time: true }, { label: '实际完成时间', key: 'actualCompleteTime', time: true }, { label: '奖励积分', key: 'pointsAwarded', suffix: ' 分' }, { label: '积分状态', key: 'pointsStatusName', fallback: 'pointsStatus' }, { label: '平台同步', key: 'pushStatusName', fallback: 'pushStatus' }, { label: '同步时间', key: 'pushTime', time: true }, { label: '第三方记录', key: 'thirdPartyId' }, { label: '流程状态', key: 'flowStatus' }, { label: '审核人', key: 'auditUserNameName', fallback: 'auditUserName' }, { label: '审核时间', key: 'auditTime', time: true }], textFields: [{ label: '隐患描述', key: 'description' }, { label: '原因分析', key: 'causeAnalysis' }, { label: '整改方案', key: 'rectificationPlan' }, { label: '防范措施', key: 'preventiveMeasures' }, { label: '审核意见', key: 'auditRemark' }, { label: '备注', key: 'remark' }] } }, |
|
|
|
|
dicts: ['hazard_category'], |
|
|
|
|
data() { return { loading: false, detailLoading: false, detailVisible: false, ledgerList: [], total: 0, unitOptions: [], currentFactory: null, attachments: [], detail: null, detailCanApprove: false, flowNodes: [], flowLoading: false, dateRange: [], importUpload: { open: false, mode: 'excel', isUploading: false, headers: { Authorization: 'Bearer ' + getToken() }, action: getHazardImportAction('excel') }, queryParams: { pageNum: 1, pageSize: 10, status: undefined, hazardCategory: undefined, beginTime: undefined, endTime: undefined, unitId: undefined, hazardName: undefined }, statusOptions: [{ label: '待提交', value: 'draft' }, { label: '审核中', value: 'reviewing' }, { label: '整改中', value: 'rectifying' }, { label: '已通过', value: 'approved' }, { label: '已驳回', value: 'rejected' }], basicFields: [{ label: '单位', key: 'unitName' }, { label: '所属部门', key: 'departmentName', fallback: 'factoryDeptName' }, { label: '上报人', key: 'reporterName' }, { label: '隐患分类', key: 'hazardCategoryName', fallback: 'hazardCategory' }, { label: '隐患类型', key: 'hazardTypeName', fallback: 'hazardType' }, { label: '隐患来源', key: 'sourceTypeName', fallback: 'sourceType' }, { label: '专业', key: 'majorName', fallback: 'major' }, { label: '风险分析单元', key: 'riskUnit' }, { label: '风险分析对象', key: 'riskTarget' }, { label: '发现时间', key: 'discoverTime', time: true }, { label: '创建时间', key: 'createTime', time: true }, { label: '更新人', key: 'updateBy' }], flowFields: [{ label: '治理类型', key: 'governanceTypeName', fallback: 'governanceType' }, { label: '整改负责人', key: 'chargePersonName' }, { label: '限定完成时间', key: 'limitedCompleteTime', time: true }, { label: '实际完成时间', key: 'actualCompleteTime', time: true }, { label: '奖励积分', key: 'pointsAwarded', suffix: ' 分' }, { label: '积分状态', key: 'pointsStatusName', fallback: 'pointsStatus' }, { label: '平台同步', key: 'pushStatusName', fallback: 'pushStatus' }, { label: '同步时间', key: 'pushTime', time: true }, { label: '第三方记录', key: 'thirdPartyId' }, { label: '流程状态', key: 'flowStatus' }, { label: '审核人', key: 'auditUserNameName', fallback: 'auditUserName' }, { label: '审核时间', key: 'auditTime', time: true }], textFields: [{ label: '隐患描述', key: 'description' }, { label: '原因分析', key: 'causeAnalysis' }, { label: '整改方案', key: 'rectificationPlan' }, { label: '防范措施', key: 'preventiveMeasures' }, { label: '审核意见', key: 'auditRemark' }, { label: '备注', key: 'remark' }] } }, |
|
|
|
|
computed: { |
|
|
|
|
isSuperAdmin() { return (this.$store.getters.roles || []).indexOf('admin') !== -1 }, |
|
|
|
|
summary() { return this.ledgerList.reduce((result, row) => { const status = this.statusKey(row); if (status === 'draft') result.draft++; else if (status === 'reviewing') result.reviewing++; else if (status === 'rectifying') result.rectifying++; else if (status === 'approved') result.approved++; else if (status === 'rejected') result.rejected++; return result }, { draft: 0, reviewing: 0, rectifying: 0, approved: 0, rejected: 0 }) }, |
|
|
|
|
imageAttachments() { return this.attachments.filter(item => this.isImageAttachment(item)) }, |
|
|
|
|
otherAttachments() { return this.attachments.filter(item => !this.isImageAttachment(item)) }, |
|
|
|
|
previewUrls() { return this.imageAttachments.map(item => this.attachmentUrl(item)).filter(Boolean) } |
|
|
|
|
previewUrls() { return this.imageAttachments.map(item => this.attachmentUrl(item)).filter(Boolean) }, |
|
|
|
|
flowActiveIndex() { return this.flowNodes.filter(node => node.finishTime).length } |
|
|
|
|
}, |
|
|
|
|
created() { this.getUnits().finally(() => this.getList()) }, |
|
|
|
|
methods: { |
|
|
|
|
getList() { this.loading = true; listHazardLedger(this.queryParams).then(response => { const page = response.data || response; this.ledgerList = page.list || page.rows || []; this.total = Number(page.total || page.totalCount || this.ledgerList.length) }).catch(() => { this.ledgerList = []; this.total = 0; this.$modal.msgError('隐患台账加载失败,请检查后端服务和登录状态') }).finally(() => { this.loading = false }) }, |
|
|
|
|
getList() { this.syncDateRange(); this.loading = true; listHazardLedger(this.queryParams).then(response => { const page = response.data || response; this.ledgerList = page.list || page.rows || []; this.total = Number(page.total || page.totalCount || this.ledgerList.length) }).catch(() => { this.ledgerList = []; this.total = 0; this.$modal.msgError('隐患台账加载失败,请检查后端服务和登录状态') }).finally(() => { this.loading = false }) }, |
|
|
|
|
// 上报时间日期范围 → 后端平铺查询参数 beginTime/endTime |
|
|
|
|
syncDateRange() { const range = Array.isArray(this.dateRange) ? this.dateRange : []; this.queryParams.beginTime = range[0] || undefined; this.queryParams.endTime = range[1] || undefined }, |
|
|
|
|
getUnits() { const request = this.isSuperAdmin ? listFactoryDepartments() : getMyFactoryDepartment(); return request.then(response => { const data = response.data || response; if (this.isSuperAdmin) { this.unitOptions = Array.isArray(data) ? data : (data && (data.list || data.rows)) || []; return } this.currentFactory = data || null; if (this.currentFactory) { this.queryParams.unitId = this.factoryId(this.currentFactory) } }).catch(() => { this.unitOptions = []; this.currentFactory = null }) }, factoryId(item) { const value = item && (item.deptId !== undefined ? item.deptId : item.id); return value === undefined || value === null ? '' : String(value) }, factoryName(item) { return (item && (item.deptName || item.label || item.name)) || '' }, |
|
|
|
|
handleQuery() { this.queryParams.pageNum = 1; this.getList() }, resetQuery() { this.$refs.queryForm.resetFields(); this.queryParams.pageNum = 1; this.getList() }, |
|
|
|
|
openDetail(row) { this.detailVisible = true; this.detail = null; this.attachments = []; this.detailLoading = true; Promise.all([getHazardLedgerDetail(row.id), listHazardLedgerAttachments(row.id)]).then(results => { this.detail = results[0].data || results[0]; const data = results[1].data || results[1]; this.attachments = Array.isArray(data) ? data : [] }).catch(() => { this.$modal.msgError('隐患详情加载失败') }).finally(() => { this.detailLoading = false }) }, |
|
|
|
|
handleQuery() { this.queryParams.pageNum = 1; this.getList() }, resetQuery() { this.$refs.queryForm.resetFields(); this.dateRange = []; this.queryParams.pageNum = 1; this.getList() }, |
|
|
|
|
openDetail(row) { this.detailVisible = true; this.detail = null; this.attachments = []; this.flowNodes = []; this.detailCanApprove = row.canApprove === true || String(row.canApprove) === 'true'; this.detailLoading = true; this.loadFlowNodes(row.flowInstanceId); Promise.all([getHazardLedgerDetail(row.id), listHazardLedgerAttachments(row.id)]).then(results => { this.detail = results[0].data || results[0]; const data = results[1].data || results[1]; this.attachments = Array.isArray(data) ? data : [] }).catch(() => { this.$modal.msgError('隐患详情加载失败') }).finally(() => { this.detailLoading = false }) }, |
|
|
|
|
loadFlowNodes(procInsId) { if (!procInsId) { this.flowNodes = []; return } this.flowLoading = true; flowRecord({ procInsId: String(procInsId) }).then(response => { const data = response.data || {}; this.flowNodes = Array.isArray(data.flowList) ? data.flowList : [] }).catch(() => { this.flowNodes = [] }).finally(() => { this.flowLoading = false }) }, |
|
|
|
|
goAudit(row) { const query = { id: String(row.id) }; if (row.canApprove === true || String(row.canApprove) === 'true') query.canApprove = '1'; if (row.flowInstanceId) query.flowInstanceId = String(row.flowInstanceId); this.detailVisible = false; this.$router.push({ path: '/hazard/audit/detail', query }) }, |
|
|
|
|
handleRetrySync(row) { this.$confirm('确认重试将该隐患同步到生产运营平台吗?', '重试同步', { type: 'warning' }).then(() => retryHazardSync(row.id)).then(() => { this.$modal.msgSuccess('同步重试成功'); this.getList() }).catch(error => { if (error !== 'cancel') this.$modal.msgError(error.message || '同步重试失败') }) }, |
|
|
|
|
statusKey(row) { const value = String(row.status || '').toLowerCase(); const name = row.statusName || ''; if (/待提交|未提交/.test(name) || value === 'draft' || value === '0') return 'draft'; if (/审核中|待审核/.test(name) || value === 'reviewing' || value === '1') return 'reviewing'; if (/整改中/.test(name) || value === 'rectifying' || value === '2') return 'rectifying'; if (/已通过|已闭环/.test(name) || value === 'approved' || value === '3') return 'approved'; if (/已驳回|驳回/.test(name) || value === 'rejected' || value === '4') return 'rejected'; return value }, isReviewing(row) { return this.statusKey(row) === 'reviewing' }, isSyncFailed(row) { return /失败|异常/.test(row.pushStatusName || row.pushStatus || '') }, levelLabel(row) { return row.hazardLevelName || ({ general: '一般', major: '较大', critical: '重大' }[row.hazardLevel] || row.hazardLevel || '—') }, statusLabel(row) { const key = this.statusKey(row); return ({ draft: '待提交', reviewing: '审核中', rectifying: '整改中', approved: '已通过', rejected: '已驳回' }[key] || row.statusName || row.status || '—') }, pointsLabel(row) { if (row.pointsStatusName) return row.pointsAwarded === undefined || row.pointsAwarded === null ? row.pointsStatusName : `${row.pointsAwarded > 0 ? '+' : ''}${row.pointsAwarded} ${row.pointsStatusName}`; return row.pointsAwarded === undefined || row.pointsAwarded === null ? '—' : `${row.pointsAwarded > 0 ? '+' : ''}${row.pointsAwarded} 分` }, pushLabel(row) { return row.pushStatusName || ({ SUCCESS: '已同步', FAIL: '同步失败', FAILED: '同步失败', WAIT: '待同步' }[String(row.pushStatus).toUpperCase()] || row.pushStatus || '—') }, statusTagType(row) { const value = this.statusKey(row); return value === 'approved' ? 'success' : value === 'rejected' ? 'danger' : value === 'rectifying' ? 'warning' : value === 'reviewing' ? 'primary' : 'info' }, levelTagType(row) { return String(row.hazardLevel || '').toLowerCase() === 'critical' ? 'danger' : String(row.hazardLevel || '').toLowerCase() === 'major' ? 'warning' : 'info' }, pointsTagType(row) { return row.pointsStatusName && /待|未/.test(row.pointsStatusName) ? 'info' : row.pointsAwarded === undefined || row.pointsAwarded === null ? 'info' : 'success' }, pushTagType(row) { return this.isSyncFailed(row) ? 'danger' : /待/.test(this.pushLabel(row)) ? 'info' : 'success' }, |
|
|
|
|
handleImport() { this.importUpload.mode = 'excel'; this.importUpload.action = getHazardImportAction('excel'); this.importUpload.isUploading = false; this.importUpload.open = true }, |
|
|
|
|
handleImportModeChange(mode) { if (this.$refs.hazardImportUpload) this.$refs.hazardImportUpload.clearFiles(); this.importUpload.action = getHazardImportAction(mode) }, |
|
|
|
|
beforeImportUpload(file) { |
|
|
|
|
if (this.importUpload.mode === 'image') { |
|
|
|
|
const isZip = /\.zip$/i.test(file.name) |
|
|
|
|
const okSize = file.size <= 500 * 1024 * 1024 |
|
|
|
|
const softWarn = file.size > 50 * 1024 * 1024 |
|
|
|
|
if (!isZip) { this.$modal.msgError('只能上传 .zip 压缩包'); return false } |
|
|
|
|
if (!okSize) { this.$modal.msgError('单包不能超过 500MB,请分批打包'); return false } |
|
|
|
|
if (softWarn) this.$modal.msgWarning('包较大,导入可能需要几分钟,请勿关闭页面') |
|
|
|
|
return true |
|
|
|
|
} |
|
|
|
|
if (!/\.(xlsx|xls)$/i.test(file.name)) { this.$modal.msgError('只能上传 .xlsx 或 .xls 文件'); return false } |
|
|
|
|
return true |
|
|
|
|
}, |
|
|
|
|
handleImportProgress() { this.importUpload.isUploading = true }, |
|
|
|
|
handleImportSuccess(response) { |
|
|
|
|
this.importUpload.open = false |
|
|
|
|
const msg = (response && response.msg) || '导入完成' |
|
|
|
|
this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + String(msg).replace(/\n/g, '<br/>') + '</div>', '导入结果', { dangerouslyUseHTMLString: true }) |
|
|
|
|
this.getList() |
|
|
|
|
}, |
|
|
|
|
handleImportError(error) { |
|
|
|
|
this.importUpload.isUploading = false |
|
|
|
|
let msg = '导入失败,请检查文件内容后重试' |
|
|
|
|
try { const body = JSON.parse(error && error.message); if (body && body.msg) msg = body.msg } catch (e) { /* 非 JSON 响应体,忽略解析失败 */ } |
|
|
|
|
this.$modal.msgError(msg) |
|
|
|
|
}, |
|
|
|
|
submitImportForm() { this.$refs.hazardImportUpload.submit() }, |
|
|
|
|
importTemplate() { downloadHazardImportTemplate() }, |
|
|
|
|
resetImportUpload() { if (this.$refs.hazardImportUpload) this.$refs.hazardImportUpload.clearFiles(); this.importUpload.isUploading = false }, |
|
|
|
|
statusKey(row) { const value = String(row.status || '').toLowerCase(); const name = row.statusName || ''; if (/待提交|未提交/.test(name) || value === 'draft' || value === '0') return 'draft'; if (/审核中|待审核/.test(name) || value === 'reviewing' || value === '1') return 'reviewing'; if (/整改中/.test(name) || value === 'rectifying' || value === '2') return 'rectifying'; if (/已通过|已闭环/.test(name) || value === 'approved' || value === '3') return 'approved'; if (/已驳回|驳回/.test(name) || value === 'rejected' || value === '4') return 'rejected'; return value }, isReviewing(row) { return this.statusKey(row) === 'reviewing' }, canAudit(row) { return Boolean(row) && this.isReviewing(row) && (row.canApprove === true || String(row.canApprove) === 'true') }, isSyncFailed(row) { return /失败|异常/.test(row.pushStatusName || row.pushStatus || '') }, levelLabel(row) { return row.hazardLevelName || ({ general: '一般', major: '较大', critical: '重大' }[row.hazardLevel] || row.hazardLevel || '—') }, statusLabel(row) { const key = this.statusKey(row); return ({ draft: '待提交', reviewing: '审核中', rectifying: '整改中', approved: '已通过', rejected: '已驳回' }[key] || row.statusName || row.status || '—') }, pointsLabel(row) { if (row.pointsStatusName) return row.pointsAwarded === undefined || row.pointsAwarded === null ? row.pointsStatusName : `${row.pointsAwarded > 0 ? '+' : ''}${row.pointsAwarded} ${row.pointsStatusName}`; return row.pointsAwarded === undefined || row.pointsAwarded === null ? '—' : `${row.pointsAwarded > 0 ? '+' : ''}${row.pointsAwarded} 分` }, pushLabel(row) { return row.pushStatusName || ({ SUCCESS: '已同步', FAIL: '同步失败', FAILED: '同步失败', WAIT: '待同步' }[String(row.pushStatus).toUpperCase()] || row.pushStatus || '—') }, statusTagType(row) { const value = this.statusKey(row); return value === 'approved' ? 'success' : value === 'rejected' ? 'danger' : value === 'rectifying' ? 'warning' : value === 'reviewing' ? 'primary' : 'info' }, levelTagType(row) { return String(row.hazardLevel || '').toLowerCase() === 'critical' ? 'danger' : String(row.hazardLevel || '').toLowerCase() === 'major' ? 'warning' : 'info' }, |
|
|
|
|
categoryLabel(row) { return row.hazardCategoryName || ({ general: '一般', major: '较大', critical: '重大' }[row.hazardCategory] || row.hazardCategory || '—') }, categoryTagType(row) { const value = String(row.hazardCategory || '').toLowerCase(); return value === 'critical' ? 'danger' : value === 'major' ? 'warning' : 'info' }, pointsTagType(row) { return row.pointsStatusName && /待|未/.test(row.pointsStatusName) ? 'info' : row.pointsAwarded === undefined || row.pointsAwarded === null ? 'info' : 'success' }, pushTagType(row) { return this.isSyncFailed(row) ? 'danger' : /待/.test(this.pushLabel(row)) ? 'info' : 'success' }, |
|
|
|
|
isImageAttachment(item) { return String(item.attachmentType || '').toUpperCase() === 'IMAGE' || /^image\//i.test(item.fileType || '') || /\.(png|jpe?g|gif|webp|bmp|svg)(?:\?.*)?$/i.test(item.fileName || item.filePath || item.fileUrl || '') }, |
|
|
|
|
attachmentUrl(item) { const path = item.fileUrl || item.filePath || ''; if (!path || /^https?:\/\//i.test(path) || /^data:image\//i.test(path)) return path; return MyConfig.BASE_API.replace(/\/$/, '') + '/' + path.replace(/^\//, '') }, |
|
|
|
|
previewIndex(item) { return this.previewUrls.indexOf(this.attachmentUrl(item)) }, |
|
|
|
|
@ -217,6 +347,21 @@ export default {
@@ -217,6 +347,21 @@ export default {
|
|
|
|
|
background: #f0f2f5; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.ledger-date-range { |
|
|
|
|
width: 260px; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.import-mode { |
|
|
|
|
margin-bottom: 14px; |
|
|
|
|
text-align: center; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.import-template-link { |
|
|
|
|
margin-left: 6px; |
|
|
|
|
font-size: 12px; |
|
|
|
|
vertical-align: baseline; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.summary-inline { |
|
|
|
|
display: flex; |
|
|
|
|
align-items: center; |
|
|
|
|
@ -288,10 +433,28 @@ export default {
@@ -288,10 +433,28 @@ export default {
|
|
|
|
|
|
|
|
|
|
.detail-section, |
|
|
|
|
.text-section, |
|
|
|
|
.attachment-section { |
|
|
|
|
.attachment-section, |
|
|
|
|
.flow-section { |
|
|
|
|
margin-top: 16px; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.flow-steps { |
|
|
|
|
min-height: 44px; |
|
|
|
|
padding: 6px 4px; |
|
|
|
|
border: 1px solid #ebeef5; |
|
|
|
|
border-radius: 6px; |
|
|
|
|
background: #fbfbfd; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.flow-steps .step-desc { |
|
|
|
|
display: flex; |
|
|
|
|
flex-direction: column; |
|
|
|
|
gap: 2px; |
|
|
|
|
font-size: 12px; |
|
|
|
|
color: #909399; |
|
|
|
|
line-height: 1.5; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.section-title { |
|
|
|
|
margin-bottom: 8px; |
|
|
|
|
color: #5a5a72; |
|
|
|
|
|