|
|
|
@ -174,6 +174,24 @@ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<span v-else class="muted">暂无附件</span> |
|
|
|
<span v-else class="muted">暂无附件</span> |
|
|
|
</div> |
|
|
|
</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> |
|
|
|
</template> |
|
|
|
<el-empty v-else-if="!detailLoading" description="暂无详情数据" /> |
|
|
|
<el-empty v-else-if="!detailLoading" description="暂无详情数据" /> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
@ -232,24 +250,27 @@ |
|
|
|
/* global MyConfig */ |
|
|
|
/* global MyConfig */ |
|
|
|
import { getMyFactoryDepartment, listFactoryDepartments } from '@/api/system/dept' |
|
|
|
import { getMyFactoryDepartment, listFactoryDepartments } from '@/api/system/dept' |
|
|
|
import { listHazardLedger, getHazardLedgerDetail, listHazardLedgerAttachments, retryHazardSync, getHazardImportAction, downloadHazardImportTemplate } 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' |
|
|
|
import { getToken } from '@/utils/auth' |
|
|
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
export default { |
|
|
|
name: 'HazardLedger', |
|
|
|
name: 'HazardLedger', |
|
|
|
data() { return { loading: false, detailLoading: false, detailVisible: false, ledgerList: [], total: 0, unitOptions: [], currentFactory: null, attachments: [], detail: null, importUpload: { open: false, mode: 'excel', isUploading: false, headers: { Authorization: 'Bearer ' + getToken() }, action: getHazardImportAction('excel') }, 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' }] } }, |
|
|
|
data() { return { loading: false, detailLoading: false, detailVisible: false, ledgerList: [], total: 0, unitOptions: [], currentFactory: null, attachments: [], detail: null, flowNodes: [], flowLoading: false, importUpload: { open: false, mode: 'excel', isUploading: false, headers: { Authorization: 'Bearer ' + getToken() }, action: getHazardImportAction('excel') }, 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' }] } }, |
|
|
|
computed: { |
|
|
|
computed: { |
|
|
|
isSuperAdmin() { return (this.$store.getters.roles || []).indexOf('admin') !== -1 }, |
|
|
|
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 }) }, |
|
|
|
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)) }, |
|
|
|
imageAttachments() { return this.attachments.filter(item => this.isImageAttachment(item)) }, |
|
|
|
otherAttachments() { 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()) }, |
|
|
|
created() { this.getUnits().finally(() => this.getList()) }, |
|
|
|
methods: { |
|
|
|
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.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 }) }, |
|
|
|
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)) || '' }, |
|
|
|
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() }, |
|
|
|
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 }) }, |
|
|
|
openDetail(row) { this.detailVisible = true; this.detail = null; this.attachments = []; this.flowNodes = []; 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 }) }, |
|
|
|
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 || '同步重试失败') }) }, |
|
|
|
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 || '同步重试失败') }) }, |
|
|
|
handleImport() { this.importUpload.mode = 'excel'; this.importUpload.action = getHazardImportAction('excel'); this.importUpload.isUploading = false; this.importUpload.open = true }, |
|
|
|
handleImport() { this.importUpload.mode = 'excel'; this.importUpload.action = getHazardImportAction('excel'); this.importUpload.isUploading = false; this.importUpload.open = true }, |
|
|
|
@ -381,10 +402,28 @@ export default { |
|
|
|
|
|
|
|
|
|
|
|
.detail-section, |
|
|
|
.detail-section, |
|
|
|
.text-section, |
|
|
|
.text-section, |
|
|
|
.attachment-section { |
|
|
|
.attachment-section, |
|
|
|
|
|
|
|
.flow-section { |
|
|
|
margin-top: 16px; |
|
|
|
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 { |
|
|
|
.section-title { |
|
|
|
margin-bottom: 8px; |
|
|
|
margin-bottom: 8px; |
|
|
|
color: #5a5a72; |
|
|
|
color: #5a5a72; |
|
|
|
|