|
|
|
|
@ -46,9 +46,7 @@
@@ -46,9 +46,7 @@
|
|
|
|
|
</el-col> |
|
|
|
|
<el-col :span="12"> |
|
|
|
|
<el-form-item label="管理级别" prop="hazardLevel"> |
|
|
|
|
<el-select v-model="form.hazardLevel" placeholder="请选择管理级别" style="width:100%" @change="syncHazardLevelName"> |
|
|
|
|
<el-option v-for="item in levelOptions" :key="item.value" :label="item.label" :value="item.value" /> |
|
|
|
|
</el-select> |
|
|
|
|
<dict-select v-model="form.hazardLevel" :options="dict.type.hazard_management_level" placeholder="请选择管理级别" @change="syncDictName('hazardLevel', 'hazardLevelName', 'hazard_management_level')" /> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-col> |
|
|
|
|
<el-col :span="12"> |
|
|
|
|
@ -132,9 +130,35 @@
@@ -132,9 +130,35 @@
|
|
|
|
|
</el-upload> |
|
|
|
|
</div> |
|
|
|
|
<div v-if="uploadedAttachments.length" class="uploaded-list"> |
|
|
|
|
<el-tag v-for="item in uploadedAttachments" :key="item.id || item.filePath" closable size="mini" @close="removeUploaded(item)"> |
|
|
|
|
{{ item.fileName || '新附件' }} |
|
|
|
|
</el-tag> |
|
|
|
|
<div |
|
|
|
|
v-for="item in uploadedAttachments" |
|
|
|
|
:key="item.id || item.filePath || item.fileUrl || item.fileName" |
|
|
|
|
:class="['uploaded-file', { 'image-file': isUploadedImage(item) }]" |
|
|
|
|
> |
|
|
|
|
<el-image |
|
|
|
|
v-if="isUploadedImage(item)" |
|
|
|
|
:src="attachmentUrl(item)" |
|
|
|
|
:preview-src-list="uploadedPreviewUrls" |
|
|
|
|
:initial-index="uploadedImageIndex(item)" |
|
|
|
|
fit="cover" |
|
|
|
|
class="uploaded-image" |
|
|
|
|
> |
|
|
|
|
<div slot="error" class="uploaded-image-error"> |
|
|
|
|
<i class="el-icon-picture-outline" /> |
|
|
|
|
</div> |
|
|
|
|
</el-image> |
|
|
|
|
<a |
|
|
|
|
v-else |
|
|
|
|
:href="attachmentUrl(item) || undefined" |
|
|
|
|
:target="attachmentUrl(item) ? '_blank' : undefined" |
|
|
|
|
rel="noopener noreferrer" |
|
|
|
|
class="uploaded-doc" |
|
|
|
|
> |
|
|
|
|
<i class="el-icon-document" /> |
|
|
|
|
<span>{{ item.fileName || '新附件' }}</span> |
|
|
|
|
</a> |
|
|
|
|
<i class="el-icon-close uploaded-remove" title="移除附件" @click.stop="removeUploaded(item)" /> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<div class="security-tip">严禁处理或传输国家秘密、商业秘密及敏感信息;最多 8 个附件。</div> |
|
|
|
|
</el-form-item> |
|
|
|
|
@ -148,7 +172,7 @@
@@ -148,7 +172,7 @@
|
|
|
|
|
<el-button :disabled="!canApprove" :loading="submitting" @click="openReject">驳回</el-button> |
|
|
|
|
<el-button type="warning" :disabled="!canApprove" :loading="submitting" @click="openSwitch">重新评估等级</el-button> |
|
|
|
|
</div> |
|
|
|
|
<div v-if="!canApprove" class="disabled-tip">当前记录不可审批,请确认 `canApprove` 和待办任务状态。</div> |
|
|
|
|
<div v-if="!canApprove" class="disabled-tip">{{ disabledTip }}</div> |
|
|
|
|
|
|
|
|
|
<el-dialog title="通过审核" :visible.sync="passVisible" width="460px" append-to-body> |
|
|
|
|
<div class="confirm-content"> |
|
|
|
|
@ -202,6 +226,7 @@
@@ -202,6 +226,7 @@
|
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
|
/* global MyConfig */ |
|
|
|
|
import SelectTree from '@/components/SelectTree' |
|
|
|
|
|
|
|
|
|
const DictSelect = { |
|
|
|
|
@ -235,11 +260,11 @@ const DictSelect = {
@@ -235,11 +260,11 @@ const DictSelect = {
|
|
|
|
|
export default { |
|
|
|
|
name: 'AuditActionForm', |
|
|
|
|
components: { SelectTree, DictSelect }, |
|
|
|
|
dicts: ['tree_dept', 'tree_person', 'hazard_major', 'hazard_category', 'hazard_source', 'hazard_type', 'hazard_governance_type', 'hazard_funds_source'], |
|
|
|
|
dicts: ['tree_dept', 'tree_person', 'hazard_major', 'hazard_category', 'hazard_management_level', 'hazard_source', 'hazard_type', 'hazard_governance_type', 'hazard_funds_source'], |
|
|
|
|
props: { |
|
|
|
|
report: { type: Object, required: true }, |
|
|
|
|
attachments: { type: Array, default: () => [] }, |
|
|
|
|
taskId: { type: String, required: true }, |
|
|
|
|
taskId: { type: String, default: '' }, |
|
|
|
|
submitting: Boolean |
|
|
|
|
}, |
|
|
|
|
data() { |
|
|
|
|
@ -281,22 +306,32 @@ export default {
@@ -281,22 +306,32 @@ export default {
|
|
|
|
|
canApprove() { |
|
|
|
|
return (this.report.canApprove === true || String(this.report.canApprove) === 'true') && Boolean(this.taskId) |
|
|
|
|
}, |
|
|
|
|
disabledTip() { |
|
|
|
|
if (!this.taskId) return '未获取到当前待办任务 ID,无法执行审批。' |
|
|
|
|
return '当前记录不可审批,请确认 canApprove 和待办任务状态。' |
|
|
|
|
}, |
|
|
|
|
attachmentCount() { |
|
|
|
|
return this.attachments.length + this.uploadedAttachments.length |
|
|
|
|
}, |
|
|
|
|
uploadedImageAttachments() { |
|
|
|
|
return this.uploadedAttachments.filter(item => this.isUploadedImage(item)) |
|
|
|
|
}, |
|
|
|
|
uploadedPreviewUrls() { |
|
|
|
|
return this.uploadedImageAttachments.map(item => this.attachmentUrl(item)).filter(Boolean) |
|
|
|
|
}, |
|
|
|
|
pointsSuffix() { |
|
|
|
|
if (this.report.pointsAwarded === undefined || this.report.pointsAwarded === null || this.report.pointsAwarded === '') return '' |
|
|
|
|
const points = Number(this.report.pointsAwarded) |
|
|
|
|
return ` · ${points > 0 ? '+' : ''}${this.report.pointsAwarded} 积分` |
|
|
|
|
}, |
|
|
|
|
normalizedCurrentLevel() { |
|
|
|
|
const value = this.report.currentFlowLevel || this.report.hazardLevel || '' |
|
|
|
|
const value = this.report.currentFlowLevel || this.report.hazardCategory || '' |
|
|
|
|
const nameMap = { 一般: 'general', 一般隐患: 'general', 较大: 'major', 较大隐患: 'major', 重大: 'critical', 重大隐患: 'critical' } |
|
|
|
|
return nameMap[value] || value |
|
|
|
|
}, |
|
|
|
|
currentLevelName() { |
|
|
|
|
const item = this.levelOptions.find(option => option.value === this.normalizedCurrentLevel) |
|
|
|
|
return this.report.hazardLevelName || (item && item.label) || this.normalizedCurrentLevel || '—' |
|
|
|
|
return (item && item.label) || this.normalizedCurrentLevel || '—' |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
watch: { |
|
|
|
|
@ -305,7 +340,6 @@ export default {
@@ -305,7 +340,6 @@ export default {
|
|
|
|
|
deep: true, |
|
|
|
|
handler(value) { |
|
|
|
|
this.form = JSON.parse(JSON.stringify(value || {})) |
|
|
|
|
if (!this.form.hazardLevel && this.form.currentFlowLevel) this.form.hazardLevel = this.form.currentFlowLevel |
|
|
|
|
this.auditComment = this.form.auditRemark || '' |
|
|
|
|
this.uploadedAttachments = [] |
|
|
|
|
} |
|
|
|
|
@ -328,11 +362,6 @@ export default {
@@ -328,11 +362,6 @@ export default {
|
|
|
|
|
const item = (this.dict.type[dictType] || []).find(option => String(option.value) === String(this.form[valueField])) |
|
|
|
|
this.$set(this.form, nameField, item ? item.label : '') |
|
|
|
|
}, |
|
|
|
|
syncHazardLevelName(value) { |
|
|
|
|
const item = this.levelOptions.find(option => option.value === value) |
|
|
|
|
this.$set(this.form, 'hazardLevelName', item ? item.label : '') |
|
|
|
|
this.$set(this.form, 'currentFlowLevel', value) |
|
|
|
|
}, |
|
|
|
|
beforeUpload(file) { |
|
|
|
|
if (this.attachmentCount >= 8) { |
|
|
|
|
this.$modal.msgError('附件数量不能超过 8 个') |
|
|
|
|
@ -359,6 +388,17 @@ export default {
@@ -359,6 +388,17 @@ export default {
|
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
isUploadedImage(item) { |
|
|
|
|
return item.attachmentType === 'IMAGE' || /^image\//i.test(item.fileType || '') || /\.(png|jpe?g|gif|webp|bmp)$/i.test(item.fileName || item.filePath || item.fileUrl || '') |
|
|
|
|
}, |
|
|
|
|
attachmentUrl(item) { |
|
|
|
|
const path = item.fileUrl || item.url || item.downloadUrl || item.filePath || '' |
|
|
|
|
if (!path || /^https?:\/\//i.test(path) || /^data:image\//i.test(path)) return path |
|
|
|
|
return MyConfig.BASE_API.replace(/\/$/, '') + '/' + path.replace(/^\//, '') |
|
|
|
|
}, |
|
|
|
|
uploadedImageIndex(item) { |
|
|
|
|
return this.uploadedPreviewUrls.indexOf(this.attachmentUrl(item)) |
|
|
|
|
}, |
|
|
|
|
removeUploaded(item) { |
|
|
|
|
this.uploadedAttachments = this.uploadedAttachments.filter(current => current !== item) |
|
|
|
|
}, |
|
|
|
|
@ -431,6 +471,15 @@ export default {
@@ -431,6 +471,15 @@ export default {
|
|
|
|
|
.readonly-value { display: flex; align-items: center; min-height: 32px; } |
|
|
|
|
.attachment-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 32px; } |
|
|
|
|
.uploaded-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; } |
|
|
|
|
.uploaded-file { position: relative; display: flex; align-items: center; width: 132px; height: 34px; border: 1px solid #e4e7ed; border-radius: 6px; background: #f7f9fc; overflow: hidden; } |
|
|
|
|
.uploaded-file.image-file { width: 132px; height: 86px; } |
|
|
|
|
.uploaded-image { width: 100%; height: 100%; cursor: zoom-in; } |
|
|
|
|
.uploaded-image-error { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; color: #909399; background: #f7f9fc; } |
|
|
|
|
.uploaded-doc { display: flex; align-items: center; gap: 5px; width: 100%; height: 100%; padding: 0 24px 0 8px; color: #606266; font-size: 11px; text-decoration: none; overflow: hidden; } |
|
|
|
|
.uploaded-doc i { flex: none; color: #909399; } |
|
|
|
|
.uploaded-doc span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } |
|
|
|
|
.uploaded-remove { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); color: #c0c4cc; font-size: 13px; cursor: pointer; z-index: 1; } |
|
|
|
|
.uploaded-remove:hover { color: #f56c6c; } |
|
|
|
|
.security-tip, .disabled-tip { margin-top: 6px; color: #f56c6c; font-size: 11px; line-height: 1.6; } |
|
|
|
|
.action-buttons { display: grid; grid-template-columns: minmax(180px, 1fr) auto auto; gap: 8px; } |
|
|
|
|
.reject-options { display: flex; flex-direction: column; gap: 12px; } |
|
|
|
|
|