2024-05-22 16:05:51 +08:00
|
|
|
|
<template>
|
2024-06-04 16:54:33 +08:00
|
|
|
|
<el-dialog draggable class="cn-operate-dialog" v-model="dialogVisible" :title="title" width="450px" top="30vh">
|
2024-05-29 19:01:34 +08:00
|
|
|
|
<el-scrollbar>
|
2024-06-04 16:54:33 +08:00
|
|
|
|
<el-form :inline="false" :model="form" label-width="120px" :rules="rules" ref="formRef">
|
|
|
|
|
|
<el-form-item label="问题详情:">
|
2024-05-29 19:01:34 +08:00
|
|
|
|
<el-input
|
2024-06-04 16:54:33 +08:00
|
|
|
|
v-model="form.issueDetail"
|
|
|
|
|
|
autocomplete="off"
|
|
|
|
|
|
type="textarea"
|
|
|
|
|
|
:autosize="{ minRows: 2, maxRows: 6 }"
|
2024-05-29 19:01:34 +08:00
|
|
|
|
readonly
|
|
|
|
|
|
/>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
2024-06-04 16:54:33 +08:00
|
|
|
|
<el-form-item label="问题附件:" v-if="showFile">
|
2024-06-14 10:26:35 +08:00
|
|
|
|
<el-icon class="elView" v-if="problemDetail?.problemName">
|
|
|
|
|
|
<View @click="openFile(problemDetail?.problemName)" />
|
2024-05-29 19:01:34 +08:00
|
|
|
|
</el-icon>
|
2024-06-04 16:54:33 +08:00
|
|
|
|
<a :href="problemDetail.problemPath" target="_blank">{{ problemDetail.problemName }}</a>
|
2024-05-29 19:01:34 +08:00
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
2024-06-04 16:54:33 +08:00
|
|
|
|
<el-form-item label="采取的措施:" prop="takeStep">
|
2024-05-29 19:01:34 +08:00
|
|
|
|
<el-input
|
2024-06-04 16:54:33 +08:00
|
|
|
|
v-model="form.takeStep"
|
|
|
|
|
|
autocomplete="off"
|
|
|
|
|
|
placeholder="请输入采取的措施"
|
|
|
|
|
|
type="textarea"
|
2024-05-29 19:01:34 +08:00
|
|
|
|
/>
|
|
|
|
|
|
</el-form-item>
|
2024-06-04 16:54:33 +08:00
|
|
|
|
<el-form-item label="反馈报告:" class="uploadFile" prop="reportPath">
|
2024-05-29 19:01:34 +08:00
|
|
|
|
<el-upload
|
2024-06-04 16:54:33 +08:00
|
|
|
|
v-model:file-list="form.reportPath"
|
|
|
|
|
|
ref="uploadRef"
|
|
|
|
|
|
action=""
|
|
|
|
|
|
:accept="acceptType"
|
|
|
|
|
|
:limit="1"
|
|
|
|
|
|
:on-exceed="handleExceed"
|
|
|
|
|
|
:on-change="choose"
|
|
|
|
|
|
:auto-upload="false"
|
2024-05-29 19:01:34 +08:00
|
|
|
|
:on-progress="uploadFileName('reportPath')"
|
2024-06-04 16:54:33 +08:00
|
|
|
|
:on-remove="removeFile"
|
2024-05-29 19:01:34 +08:00
|
|
|
|
>
|
|
|
|
|
|
<template #trigger>
|
2024-06-04 16:54:33 +08:00
|
|
|
|
<el-button type="primary">上传文件</el-button>
|
2024-05-29 19:01:34 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
</el-upload>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
</el-form>
|
|
|
|
|
|
</el-scrollbar>
|
|
|
|
|
|
|
|
|
|
|
|
<template #footer>
|
2024-06-04 16:54:33 +08:00
|
|
|
|
<span class="dialog-footer">
|
|
|
|
|
|
<el-button @click="close">取消</el-button>
|
|
|
|
|
|
<el-button type="primary" @click="submit">确认</el-button>
|
2024-05-22 16:05:51 +08:00
|
|
|
|
</span>
|
2024-05-29 19:01:34 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
</el-dialog>
|
2024-05-22 16:05:51 +08:00
|
|
|
|
</template>
|
2024-06-04 16:54:33 +08:00
|
|
|
|
<script lang="ts" setup>
|
2024-05-22 16:05:51 +08:00
|
|
|
|
import { ref, inject, reactive, nextTick } from 'vue'
|
|
|
|
|
|
import { ElMessage, genFileId, UploadProps, UploadRawFile } from 'element-plus'
|
|
|
|
|
|
import TableStore from '@/utils/tableStore' // 若不是列表页面弹框可删除
|
2024-05-29 19:01:34 +08:00
|
|
|
|
import { getFileNameAndFilePath, uploadFile } from '@/api/system-boot/file'
|
2024-06-04 16:54:33 +08:00
|
|
|
|
import { addFeedback, updateFeedback } from '@/api/supervision-boot/leaflet'
|
2024-06-14 10:26:35 +08:00
|
|
|
|
import { Link, View } from '@element-plus/icons-vue'
|
2024-06-06 22:14:20 +08:00
|
|
|
|
const openFile = (name: any) => {
|
|
|
|
|
|
window.open(window.location.origin + '/#/previewFile?' + name)
|
|
|
|
|
|
}
|
2024-06-04 16:54:33 +08:00
|
|
|
|
//.doc,.docx,.xlsx,.xls,.pdf
|
|
|
|
|
|
const acceptType = ref('')
|
2024-05-22 16:05:51 +08:00
|
|
|
|
//下拉数据源
|
|
|
|
|
|
const title = ref('')
|
|
|
|
|
|
const tableStore = inject('tableStore') as TableStore
|
|
|
|
|
|
const formRef = ref()
|
|
|
|
|
|
// 上传报告
|
|
|
|
|
|
const uploadRef = ref()
|
|
|
|
|
|
const dialogVisible = ref(false)
|
|
|
|
|
|
// 注意不要和表单ref的命名冲突
|
2024-06-04 16:54:33 +08:00
|
|
|
|
const form = ref({
|
2024-05-29 19:01:34 +08:00
|
|
|
|
id: '',
|
|
|
|
|
|
status: '',
|
|
|
|
|
|
issueDetail: '',
|
|
|
|
|
|
takeStep: '',
|
2024-06-04 16:54:33 +08:00
|
|
|
|
reportPath: []
|
2024-05-29 19:01:34 +08:00
|
|
|
|
})
|
|
|
|
|
|
//附件是否显示
|
|
|
|
|
|
const showFile = ref(false)
|
|
|
|
|
|
|
|
|
|
|
|
const problemDetail = reactive({
|
|
|
|
|
|
problemPath: '',
|
|
|
|
|
|
problemName: ''
|
2024-05-22 16:05:51 +08:00
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
//处理成效报告
|
2024-06-04 16:54:33 +08:00
|
|
|
|
const reportFilePath: any = ref('')
|
2024-05-22 16:05:51 +08:00
|
|
|
|
|
|
|
|
|
|
//form表单校验规则
|
|
|
|
|
|
const rules = {
|
2024-06-04 16:54:33 +08:00
|
|
|
|
takeStep: [{ required: true, message: '请输入采取的措施', trigger: 'blur' }],
|
|
|
|
|
|
reportPath: [{ required: true, message: '请上传处理成效报告', trigger: 'blur' }]
|
2024-05-22 16:05:51 +08:00
|
|
|
|
}
|
|
|
|
|
|
const resetForm = () => {
|
2024-05-29 19:01:34 +08:00
|
|
|
|
if (formRef.value) {
|
|
|
|
|
|
formRef.value.resetFields()
|
|
|
|
|
|
}
|
2024-05-22 16:05:51 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-06-04 16:54:33 +08:00
|
|
|
|
const open = async (
|
|
|
|
|
|
text: string,
|
|
|
|
|
|
id: string,
|
|
|
|
|
|
status: any,
|
|
|
|
|
|
issueDetail: string,
|
|
|
|
|
|
problemPath?: string,
|
|
|
|
|
|
takeStep?: string,
|
|
|
|
|
|
reportPath?: string
|
|
|
|
|
|
) => {
|
2024-05-29 19:01:34 +08:00
|
|
|
|
title.value = text
|
|
|
|
|
|
resetForm()
|
2024-06-14 10:26:35 +08:00
|
|
|
|
console.log(66666, reportPath)
|
2024-05-29 19:01:34 +08:00
|
|
|
|
if (takeStep) {
|
2024-06-04 16:54:33 +08:00
|
|
|
|
form.value.takeStep = takeStep
|
2024-05-29 19:01:34 +08:00
|
|
|
|
}
|
2024-06-04 16:54:33 +08:00
|
|
|
|
// uploadRef.value?.clearFiles()
|
2024-05-29 19:01:34 +08:00
|
|
|
|
if (reportPath) {
|
2024-06-04 16:54:33 +08:00
|
|
|
|
form.value.reportPath = JSON.parse(
|
|
|
|
|
|
JSON.stringify([
|
|
|
|
|
|
{
|
|
|
|
|
|
name: reportPath?.split('/')[2]
|
|
|
|
|
|
}
|
|
|
|
|
|
])
|
|
|
|
|
|
)
|
2024-05-29 19:01:34 +08:00
|
|
|
|
}
|
2024-06-04 16:54:33 +08:00
|
|
|
|
form.value.id = id
|
|
|
|
|
|
form.value.status = status
|
|
|
|
|
|
form.value.issueDetail = issueDetail
|
|
|
|
|
|
reportFilePath.value = reportPath
|
2024-05-29 19:01:34 +08:00
|
|
|
|
//判断附件是否存在,如果存在则回显出让用户可以点击下载
|
|
|
|
|
|
if (problemPath) {
|
|
|
|
|
|
let arrPath = problemPath.split(',')
|
|
|
|
|
|
await getFileNameAndFilePath({ filePath: arrPath[0] }).then(res => {
|
|
|
|
|
|
problemDetail.problemPath = res.data.url
|
|
|
|
|
|
problemDetail.problemName = res.data.fileName
|
|
|
|
|
|
})
|
|
|
|
|
|
showFile.value = true
|
2024-06-04 16:54:33 +08:00
|
|
|
|
} else {
|
2024-05-29 19:01:34 +08:00
|
|
|
|
showFile.value = false
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
dialogVisible.value = true
|
2024-05-22 16:05:51 +08:00
|
|
|
|
}
|
2024-06-04 16:54:33 +08:00
|
|
|
|
//移除文件上传
|
|
|
|
|
|
const removeFile = (file: any, uploadFiles: any) => {
|
|
|
|
|
|
console.log(file, uploadFiles)
|
|
|
|
|
|
}
|
|
|
|
|
|
const close = () => {
|
|
|
|
|
|
dialogVisible.value = false
|
|
|
|
|
|
form.value = {
|
|
|
|
|
|
id: '',
|
|
|
|
|
|
status: '',
|
|
|
|
|
|
issueDetail: '',
|
|
|
|
|
|
takeStep: '',
|
|
|
|
|
|
reportPath: []
|
|
|
|
|
|
}
|
|
|
|
|
|
resetForm()
|
|
|
|
|
|
}
|
2024-05-22 16:05:51 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 提交用户表单数据
|
|
|
|
|
|
*/
|
|
|
|
|
|
const submit = () => {
|
2024-05-29 19:01:34 +08:00
|
|
|
|
formRef.value.validate(async (valid: any) => {
|
|
|
|
|
|
if (valid) {
|
2024-06-04 16:54:33 +08:00
|
|
|
|
let subForm = JSON.parse(JSON.stringify(form.value))
|
|
|
|
|
|
subForm = {
|
|
|
|
|
|
...subForm,
|
|
|
|
|
|
reportPath: reportFilePath.value
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!reportFilePath.value) {
|
2024-05-29 19:01:34 +08:00
|
|
|
|
return ElMessage({
|
|
|
|
|
|
message: '请上传处理成效报告',
|
|
|
|
|
|
type: 'warning'
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
2024-06-04 16:54:33 +08:00
|
|
|
|
if (form.value.status == '3') {
|
|
|
|
|
|
await updateFeedback(subForm)
|
2024-05-29 19:01:34 +08:00
|
|
|
|
ElMessage.success('重新发起成功')
|
|
|
|
|
|
tableStore.index()
|
|
|
|
|
|
dialogVisible.value = false
|
|
|
|
|
|
} else {
|
|
|
|
|
|
//此时该告警单处于待反馈状态
|
2024-06-04 16:54:33 +08:00
|
|
|
|
await addFeedback(subForm)
|
2024-05-29 19:01:34 +08:00
|
|
|
|
//查询进线数据,避免一直处于loading状态
|
|
|
|
|
|
ElMessage.success('申请成功')
|
|
|
|
|
|
tableStore.index()
|
|
|
|
|
|
dialogVisible.value = false
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
2024-05-22 16:05:51 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
defineExpose({ open })
|
|
|
|
|
|
|
|
|
|
|
|
let uploadName = ref('')
|
|
|
|
|
|
const choose = (e: any) => {
|
2024-05-29 19:01:34 +08:00
|
|
|
|
uploadFile(e.raw, '/supervision/').then(res => {
|
2024-06-04 16:54:33 +08:00
|
|
|
|
reportFilePath.value = res.data.name
|
2024-06-04 17:24:45 +08:00
|
|
|
|
// form.value.reportPath = res.data.name
|
2024-05-29 19:01:34 +08:00
|
|
|
|
})
|
2024-05-22 16:05:51 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const handleExceed: UploadProps['onExceed'] = files => {
|
2024-05-29 19:01:34 +08:00
|
|
|
|
uploadRef.value!.clearFiles()
|
|
|
|
|
|
const file = files[0] as UploadRawFile
|
|
|
|
|
|
file.uid = genFileId()
|
|
|
|
|
|
uploadRef.value!.handleStart(file)
|
2024-05-22 16:05:51 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//上传报告改变
|
|
|
|
|
|
const uploadFileName = val => {
|
2024-05-29 19:01:34 +08:00
|
|
|
|
uploadName.value = val
|
2024-05-22 16:05:51 +08:00
|
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
2024-06-04 16:54:33 +08:00
|
|
|
|
<style scoped lang="scss">
|
2024-05-22 16:05:51 +08:00
|
|
|
|
.el-upload-list__item {
|
2024-05-29 19:01:34 +08:00
|
|
|
|
transition: none !important;
|
2024-05-22 16:05:51 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.el-select {
|
2024-05-29 19:01:34 +08:00
|
|
|
|
min-width: 180px;
|
2024-05-22 16:05:51 +08:00
|
|
|
|
}
|
2024-06-14 10:26:35 +08:00
|
|
|
|
.elView {
|
|
|
|
|
|
cursor: pointer;
|
2024-06-18 09:03:53 +08:00
|
|
|
|
margin-right: 10px;
|
2024-06-14 10:26:35 +08:00
|
|
|
|
}
|
2024-05-22 16:05:51 +08:00
|
|
|
|
</style>
|