Files
admin-sjzx/src/views/pqs/supervise/technology/components/alarm.vue
2024-09-14 10:20:49 +08:00

493 lines
18 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<TableHeader area datePicker nextFlag theCurrentTime ref="TableHeaderRef">
<template #select>
<el-form-item label="流程状态">
<el-select v-model="tableStore.table.params.status" clearable placeholder="请选择流程状态">
<el-option
v-for="item in statusSelect"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
</template>
<template #operation>
<el-button icon="el-icon-Delete" type="primary" @click="deleteEven">删除</el-button>
</template>
</TableHeader>
<!--表格-->
<Table ref="tableRef" :checkbox-config="checkboxConfig" />
<!--弹框-->
<feedback-popup ref="feedbackPopup" />
<!-- 详情 -->
<el-dialog draggable v-model="dialogVisible" v-if="dialogVisible" title="详情" width="1000">
<detail :id="detailId" />
</el-dialog>
</template>
<script setup lang="ts">
import {ref, onMounted, provide, nextTick, watch} from 'vue'
import TableStore from '@/utils/tableStore'
import Table from '@/components/table/index.vue'
import TableHeader from '@/components/table/header/index.vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import FeedbackPopup from '@/views/pqs/supervise/technology/feedbackPopup.vue'
import { useRouter } from 'vue-router'
import {cancelFeedback, getById} from '@/api/supervision-boot/leaflet'
import { useAdminInfo } from '@/stores/adminInfo'
import { useDictData } from '@/stores/dictData'
import { getFileNameAndFilePath } from '@/api/system-boot/file'
import { deleteWarningLeaflet } from '@/api/supervision-boot/delete/index'
import detail from '@/views/pqs/supervise/harmonicSurvey/test/detail.vue'
const dictData = useDictData()
const statusSelect = dictData.statusSelect()
//获取登陆用户姓名和部门
const adminInfo = useAdminInfo()
const { push } = useRouter()
const feedbackPopup = ref()
const tableRef = ref()
const dialogVisible = ref(false)
const detailId = ref('')
const TableHeaderRef = ref()
const tableStore = new TableStore({
url: '/supervision-boot/warningLeaflet/alarmPageData',
publicHeight: 65,
method: 'POST',
column: [
{
width: '60',
type: 'checkbox'
},
{
title: '序号',
type: 'seq',
align: 'center',
width: 60,
formatter: (row: any) => {
return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1
}
},
{
field: 'problemType',
title: '告警单问题来源',
minWidth: '150',
render: 'tag',
custom: {
1: 'warning',
2: 'warning',
3: 'warning',
4: 'warning'
},
replaceValue: {
1: '技术监督计划',
2: '在线监测超标问题',
3: '用户投诉问题',
4: '试运行监测点问题'
}
},
{ field: 'dutyOrgName', title: '负责单位', minWidth: '150' },
{ field: 'leafletName', title: '单据名称', minWidth: '150' },
{ field: 'issueDetail', title: '告警内容', minWidth: '150' },
{ field: 'reformAdvice', title: '整改意见', minWidth: '150' },
{
field: 'status',
title: '流程状态',
minWidth: '150',
render: 'tag',
custom: {
0: 'warning',
1: 'primary',
2: 'success',
3: 'danger',
4: 'warning',
5: 'primary'
},
replaceValue: {
0: '待提交审批',
1: '审批中',
2: '审批通过',
3: '审批不通过',
4: '已取消',
5: '新增'
}
},
{ field: 'createTime', title: '创建时间', minWidth: '150' },
{
field: 'createBy',
title: '填报人',
minWidth: 80,
formatter: (row: any) => {
return dictData.state.userList.filter(item => item.id == row.cellValue)[0]?.name
}
},
// {
// title: '报告',
// minWidth: '150',
// align: 'center',
// render: 'buttons',
// fixed: 'right',
// buttons: [
// {
// name: 'productSetting',
// title: '查看报告',
// type: 'primary',
// icon: 'el-icon-EditPen',
// render: 'basicButton',
// disabled: row => {
// return !(row.problemType == 2 || row.problemType == 4)
// },
// click: row => {
// if (row.problemType == 2) {
// const match = row.filePath.match(/excelreport(\/[^?#]*)/)
// window.open(window.location.origin + '/#/previewFile?' + match[1])
// } else {
// if (row.problemPath == null) {
// ElMessage({
// message: '暂无报告!',
// type: 'warning'
// })
// } else {
// getFileNameAndFilePath({ filePath: '/' + row.problemPath }).then(res => {
// // window.open(res.data.url)
// })
// }
// }
// }
// },
// {
// name: 'productSetting',
// title: '报告下载',
// type: 'primary',
// icon: 'el-icon-EditPen',
// render: 'basicButton',
// disabled: row => {
// return !(row.problemType == 2 || row.problemType == 4)
// },
// click: row => {
// if (row.problemType == 2) {
// window.open(row.filePath)
// } else {
// if (row.problemPath == null) {
// ElMessage({
// message: '暂无报告!',
// type: 'warning'
// })
// } else {
// getFileNameAndFilePath({ filePath: '/' + row.problemPath }).then(res => {
// window.open(res.data.url)
// })
// }
// }
// }
// }
// ]
// },
{
title: '操作',
minWidth: '220',
align: 'center',
render: 'buttons',
fixed: 'right',
buttons: [
{
name: 'productSetting',
title: '查看报告',
type: 'primary',
icon: 'el-icon-EditPen',
render: 'basicButton',
disabled: row => {
return !(row.problemType == 2 || row.problemType == 4)
},
click: row => {
if (row.problemType == 2) {
const match = row.filePath.match(/excelreport(\/[^?#]*)/)
window.open(window.location.origin + '/#/previewFile?' + match[1])
} else {
if (row.problemPath == null) {
ElMessage({
message: '暂无报告!',
type: 'warning'
})
} else {
window.open(window.location.origin + '/#/previewFile?/' + row.problemPath)
// getFileNameAndFilePath({ filePath: '/' + row.problemPath }).then(res => {
// // window.open(res.data.url)
// })
}
}
}
},
{
name: 'productSetting',
title: '报告下载',
type: 'primary',
icon: 'el-icon-EditPen',
render: 'basicButton',
disabled: row => {
return !(row.problemType == 2 || row.problemType == 4)
},
click: row => {
if (row.problemType == 2) {
window.open(row.filePath)
} else {
if (row.problemPath == null) {
ElMessage({
message: '暂无报告!',
type: 'warning'
})
} else {
getFileNameAndFilePath({ filePath: '/' + row.problemPath }).then(res => {
window.open(res.data.url)
})
}
}
}
},
{
name: 'edit',
title: '查看信息',
type: 'primary',
icon: 'el-icon-Open',
render: 'basicButton',
disabled: row => {
return !row.problemId || row.problemType != 1
},
click: async row => {
dialogVisible.value = true
detailId.value = row.problemId
}
},
{
name: 'productSetting',
title: '发送督办单',
type: 'primary',
icon: 'el-icon-EditPen',
render: 'basicButton',
click: row => {
// handleAudit(row.processInstanceId)
ElMessage.warning('待打通生成管理系统接口!')
}
},
{
name: 'productSetting',
title: '问题反馈',
type: 'primary',
icon: 'el-icon-EditPen',
render: 'basicButton',
disabled: row => {
return row.dutyOrgId != adminInfo.$state.deptId || row.status !== 5
},
click: row => {
feedbackPopup.value.open(
'填报告警反馈单',
row.id,
row.status,
row.issueDetail,
row.problemPath,
row.supervisionReport,
row.reformAdvice
)
}
},
{
name: 'productSetting',
title: '流程详情',
type: 'primary',
icon: 'el-icon-EditPen',
render: 'basicButton',
disabled: row => {
return !row.processInstanceId
},
click: row => {
handleAudit(row.processInstanceId, row.historyInstanceId)
}
},
{
name: 'edit',
title: '编辑',
type: 'primary',
icon: 'el-icon-Open',
render: 'basicButton',
showDisabled: row => {
return row.dutyOrgId != adminInfo.$state.deptId || !(row.status == 0)
},
disabled: row => {
return !(row.status == 0)
},
click: row => {
feedbackPopup.value.open(
'编辑告警反馈单',
row.id,
row.status,
row.issueDetail,
row.problemPath,
row.supervisionReport,
row.reformAdvice,
row.takeStep,
row.reportPath
)
}
},
{
name: 'edit',
title: '重新发起',
type: 'warning',
icon: 'el-icon-Open',
render: 'basicButton',
disabled: row => {
return row.createBy != adminInfo.$state.id || !(row.status == 3 || row.status == 4)
},
click: row => {
// deviceQuitPopup.value.open('重新发起', row)
feedbackPopup.value.open(
'重新填报告警反馈单',
row.id,
row.status,
row.issueDetail,
row.problemPath,
row.supervisionReport,
row.reformAdvice,
row.takeStep,
row.reportPath,
row.reformAdvice
)
}
},
{
name: 'cancel',
title: '取消',
type: 'danger',
icon: 'el-icon-Open',
render: 'basicButton',
disabled: row => {
return row.createBy != adminInfo.$state.id || row.status != 1
},
click: row => {
cancelLeave(row)
}
}
]
}
],
beforeSearchFun: () => {
tableStore.table.params.orgNo = tableStore.table.params.deptIndex
tableStore.table.params.currentPage = tableStore.table.params.pageNum
}
})
// 禁止点击
const checkboxConfig = reactive({
checkMethod: ({ row }) => {
return adminInfo.roleCode.includes('delete_info')
? true
: row.createBy == adminInfo.$state.id && row.status == 0
}
})
const deleteEven = () => {
if (tableStore.table.selection.length == 0) {
ElMessage({
type: 'warning',
message: '请选择要删除的数据'
})
} else {
deleteWarningLeaflet(tableStore.table.selection.map(item => item.id)).then(res => {
ElMessage({
type: 'success',
message: '删除成功!'
})
tableStore.index()
})
}
}
/**取消流程操作*/
const cancelLeave = async (row: any) => {
// 二次确认
const { value } = await ElMessageBox.prompt('请输入取消原因', '取消流程', {
confirmButtonText: '确定',
cancelButtonText: '取消',
inputType: 'textarea',
inputPattern: /^[\s\S]*.*\S[\s\S]*$/, // 判断非空,且非空格
inputErrorMessage: '取消原因不能为空'
})
// 发起取消
let data = {
id: row.id,
processInstanceId: row.processInstanceId,
reason: value
}
await cancelFeedback(data)
ElMessage.success('取消成功')
// 加载数据
tableStore.index()
}
tableStore.table.params.status = ''
provide('tableStore', tableStore)
onMounted(() => {
tableStore.index()
})
/** 流程实例详情 */
const handleAudit = (instanceId: any, historyInstanceId: any) => {
push({
name: 'BpmProcessInstanceDetail',
state: {
id: instanceId,
historyInstanceId
}
})
}
const props = defineProps(['id','businessKey'])
watch(() => props.id, async (newValue, oldValue) => {
if (newValue === 'null') return // 直接返回,避免后续逻辑执行
const fullId = newValue.split('@')[0]
let nowTime = Date.now()
const routeTime = Number(newValue.split('@')[1])
if (isNaN(routeTime) || nowTime - routeTime > import.meta.env.VITE_ROUTE_TIME_OUT) return // 路由时间超过500ms则不执行
await getById(fullId).then(res => {
if (res && res.code == 'A0000') {
if (res && res.code == 'A0000') {
if(props.businessKey == '3'){
feedbackPopup.value.open(
'填报告警反馈单',
res.data.id,
res.data.status,
res.data.issueDetail,
res.data.problemPath,
res.data.supervisionReport,
res.data.reformAdvice
)
}else{
feedbackPopup.value.open(
'重新填报告警反馈单',
res.data.id,
res.data.status,
res.data.issueDetail,
res.data.problemPath,
res.data.supervisionReport,
res.data.reformAdvice,
res.data.takeStep,
res.data.reportPath,
res.data.reformAdvice
)
}
}
}
})
}, {immediate: true})
</script>
<style scoped lang="scss"></style>