Files
admin-sjzx/src/views/pqs/supervise/technology/components/earlyWarn.vue

447 lines
16 KiB
Vue
Raw Normal View History

2024-05-16 14:00:49 +08:00
<template>
<TableHeader area datePicker nextFlag theCurrentTime showTimeAll ref="TableHeaderRef" showExport>
2025-12-19 10:56:30 +08:00
<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>
2024-05-16 14:00:49 +08:00
</TableHeader>
<Table ref="tableRef" :checkbox-config="checkboxConfig" />
2024-05-22 16:05:51 +08:00
<!--弹框-->
2024-06-19 11:28:18 +08:00
<feedback-popup ref="feedbackPopup" />
2024-05-16 14:00:49 +08:00
</template>
2024-06-19 11:28:18 +08:00
<script setup lang="ts">
import { ref, onMounted, provide, watch } from 'vue'
2024-05-16 14:00:49 +08:00
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'
2024-05-22 16:05:51 +08:00
import FeedbackPopup from '@/views/pqs/supervise/technology/feedbackPopup.vue'
import { useRouter } from 'vue-router'
import { cancelFeedback, getById } from '@/api/supervision-boot/leaflet'
2024-06-04 16:54:33 +08:00
import { useAdminInfo } from '@/stores/adminInfo'
2024-06-05 15:08:24 +08:00
import { useDictData } from '@/stores/dictData'
import { deleteWarningLeaflet } from '@/api/supervision-boot/delete/index'
2025-12-30 10:02:01 +08:00
import {download} from '@/utils/fileDownLoad'
import { getFileNameAndFilePath, downloadFile } from '@/api/system-boot/file'
2024-06-05 15:08:24 +08:00
const dictData = useDictData()
2024-06-04 16:54:33 +08:00
//获取登陆用户姓名和部门
const adminInfo = useAdminInfo()
2024-05-22 16:05:51 +08:00
const { push } = useRouter()
2024-05-16 14:00:49 +08:00
const tableRef = ref()
const TableHeaderRef = ref()
2024-05-22 16:05:51 +08:00
const feedbackPopup = ref()
2025-12-19 10:56:30 +08:00
const VITE_FLAG = import.meta.env.VITE_NAME == 'jibei'
const statusSelect = [
{ name: '待提交审批', id: 0 },
{ name: '审批中', id: 1 },
{ name: '审批通过', id: 2 },
{ name: '审批不通过', id: 3 },
{ name: '已取消', id: 4 },
{ name: '新增', id: 5 }
]
2024-05-16 14:00:49 +08:00
const tableStore = new TableStore({
2024-05-21 16:27:27 +08:00
url: '/supervision-boot/warningLeaflet/warningPageData',
2024-05-16 14:00:49 +08:00
publicHeight: 65,
method: 'POST',
filename:'预警单列表',
2024-05-16 14:00:49 +08:00
column: [
{
width: '60',
type: 'checkbox'
},
2024-05-16 14:00:49 +08:00
{
title: '序号',
align: 'center',
width: 80,
2024-05-16 14:00:49 +08:00
formatter: (row: any) => {
return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1
}
},
2024-06-19 11:28:18 +08:00
2024-05-24 09:49:40 +08:00
{
2024-06-19 11:28:18 +08:00
field: 'problemType',
title: '预警单问题来源',
minWidth: '150',
2024-05-21 16:27:27 +08:00
render: 'tag',
custom: {
1: 'warning',
2: 'warning',
3: 'warning',
4: 'warning'
},
replaceValue: {
1: '技术监督计划',
2: '在线监测超标问题',
3: '用户投诉问题',
4: '试运行监测点问题'
2024-05-21 16:27:27 +08:00
}
},
2024-06-14 16:59:21 +08:00
{ field: 'dutyOrgName', title: '负责单位', minWidth: '150' },
2024-06-20 16:54:19 +08:00
{ field: 'reformAdvice', title: '整改意见', minWidth: '150' },
2024-05-21 16:27:27 +08:00
{ field: 'leafletName', title: '单据名称', minWidth: '150' },
2024-05-24 09:49:40 +08:00
{
2024-06-19 11:28:18 +08:00
field: 'status',
title: '流程状态',
minWidth: '150',
2024-05-21 16:27:27 +08:00
render: 'tag',
custom: {
2024-06-20 16:54:19 +08:00
0: 'warning',
2024-05-21 16:27:27 +08:00
1: 'primary',
2: 'success',
3: 'danger',
4: 'warning',
2024-05-24 09:49:40 +08:00
5: 'primary'
2024-05-21 16:27:27 +08:00
},
replaceValue: {
2024-06-20 16:54:19 +08:00
0: '待提交审批',
2024-05-21 16:27:27 +08:00
1: '审批中',
2: '审批通过',
3: '审批不通过',
4: '已取消',
2024-06-13 13:32:50 +08:00
5: '新增'
2024-05-21 16:27:27 +08:00
}
},
2024-06-14 16:59:21 +08:00
2024-05-21 16:27:27 +08:00
{ field: 'createTime', title: '创建时间', minWidth: '150' },
2024-06-05 15:08:24 +08:00
{
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: [
// ]
// },
2024-08-07 11:13:46 +08:00
{
title: '操作',
minWidth: '220',
2024-08-07 11:13:46 +08:00
align: 'center',
render: 'buttons',
fixed: 'right',
buttons: [
{
2024-08-07 11:13:46 +08:00
name: 'productSetting',
title: '查看报告',
type: 'primary',
icon: 'el-icon-EditPen',
render: 'basicButton',
disabled: row => {
2025-12-30 10:16:56 +08:00
// if (VITE_FLAG) {
2025-12-19 10:56:30 +08:00
return row.problemType != 2;
2025-12-30 10:16:56 +08:00
// }
// return true;
2024-08-07 11:13:46 +08:00
},
2025-12-19 10:56:30 +08:00
2024-08-07 11:13:46 +08:00
click: row => {
2025-12-30 10:16:56 +08:00
// const match = row.filePath.match(/excelreport(\/[^?#]*)/)
2025-12-30 10:02:01 +08:00
2025-12-30 10:16:56 +08:00
// window.open(window.location.origin + '/#/previewFile?' + match[1])
window.open(window.location.origin + '/#/previewFile?/' + row.absFilePath)
2024-08-07 11:13:46 +08:00
}
},
{
name: 'productSetting',
title: '报告下载',
type: 'primary',
icon: 'el-icon-EditPen',
render: 'basicButton',
disabled: row => {
return row.problemType != 2
},
click: row => {
2025-12-30 10:02:01 +08:00
//window.open(row.filePath)
// const match = row.filePath.match(/excelreport(\/[^?#]*)/)
// const decodedPath = decodeURI(match[1]) // 解码URL中的中文字符
2026-01-04 08:39:17 +08:00
download('/' + row.absFilePath)
2025-12-30 10:02:01 +08:00
//download('/supervision/微服务系统测试页面功能-20251224合并版本.docx')
2026-01-04 08:39:17 +08:00
//download('/onlineReport/电能[预]2025年18号-张家口地市 电能质量技术监督预警单.docx')
2025-12-30 10:02:01 +08:00
2024-08-07 11:13:46 +08:00
}
},
2024-10-31 15:47:02 +08:00
// {
// name: 'productSetting',
// title: '发送督办单',
// type: 'primary',
// icon: 'el-icon-EditPen',
// render: 'basicButton',
// click: row => {
// // handleAudit(row.processInstanceId)
// ElMessage.warning('待打通生成管理系统接口!')
// }
// },
2024-05-24 09:49:40 +08:00
{
name: 'productSetting',
title: '问题反馈',
type: 'primary',
icon: 'el-icon-EditPen',
render: 'basicButton',
disabled: row => {
2024-07-15 20:34:21 +08:00
return row.dutyOrgId != adminInfo.$state.deptId || row.status !== 5
2024-05-24 09:49:40 +08:00
},
click: row => {
2024-06-20 16:54:19 +08:00
feedbackPopup.value.open(
2024-09-14 10:20:49 +08:00
'填报预警反馈单',
2024-06-20 16:54:19 +08:00
row.id,
row.status,
row.issueDetail,
row.problemPath,
row.reportPath,
2024-06-20 16:54:19 +08:00
row.reformAdvice
)
2024-05-24 09:49:40 +08:00
}
2024-05-22 16:05:51 +08:00
},
2024-05-24 09:49:40 +08:00
{
name: 'productSetting',
title: '流程详情',
type: 'primary',
icon: 'el-icon-EditPen',
render: 'basicButton',
disabled: row => {
2024-06-20 16:54:19 +08:00
return !row.processInstanceId
2024-05-24 09:49:40 +08:00
},
click: row => {
2024-06-19 11:28:18 +08:00
handleAudit(row.processInstanceId, row.historyInstanceId)
2024-05-24 09:49:40 +08:00
}
2024-05-22 16:05:51 +08:00
},
2024-06-20 16:54:19 +08:00
{
name: 'edit',
title: '编辑',
type: 'primary',
icon: 'el-icon-Open',
render: 'basicButton',
showDisabled: row => {
2024-07-15 20:34:21 +08:00
return row.dutyOrgId != adminInfo.$state.deptId || !(row.status == 0)
2024-06-20 16:54:19 +08:00
},
disabled: row => {
return !(row.status == 0)
},
2024-06-20 16:54:19 +08:00
click: row => {
feedbackPopup.value.open(
2024-09-14 10:20:49 +08:00
'编辑预警反馈单',
2024-06-20 16:54:19 +08:00
row.id,
row.status,
row.issueDetail,
row.problemPath,
row.reportPath,
2024-06-20 16:54:19 +08:00
row.reformAdvice,
row.takeStep,
row.reportPath
)
}
},
2024-05-24 09:49:40 +08:00
{
name: 'edit',
title: '重新发起',
type: 'warning',
icon: 'el-icon-Open',
render: 'basicButton',
disabled: row => {
2024-06-18 16:38:33 +08:00
return row.createBy != adminInfo.$state.id || !(row.status == 3 || row.status == 4)
2024-05-24 09:49:40 +08:00
},
click: row => {
// deviceQuitPopup.value.open('重新发起', row)
2024-06-19 11:28:18 +08:00
feedbackPopup.value.open(
2024-09-14 10:20:49 +08:00
'重新填报预警反馈单',
2024-06-19 11:28:18 +08:00
row.id,
row.status,
row.issueDetail,
row.problemPath,
row.reportPath,
2024-06-20 16:54:19 +08:00
row.reformAdvice,
2024-06-19 11:28:18 +08:00
row.takeStep,
row.reportPath
)
2024-05-24 09:49:40 +08:00
}
2024-05-22 16:05:51 +08:00
},
2024-08-07 11:13:46 +08:00
2024-05-24 09:49:40 +08:00
{
name: 'cancel',
title: '取消',
type: 'danger',
icon: 'el-icon-Open',
render: 'basicButton',
disabled: row => {
2024-06-04 16:54:33 +08:00
return row.createBy != adminInfo.$state.id || row.status != 1
2024-05-24 09:49:40 +08:00
},
click: row => {
2024-06-04 16:54:33 +08:00
cancelLeave(row)
2024-05-24 09:49:40 +08:00
}
2024-05-16 14:00:49 +08:00
}
]
}
],
beforeSearchFun: () => {
tableStore.table.params.currentPage = tableStore.table.params.pageNum
},
exportProcessingData: () => {
tableStore.table.allData = tableStore.table.allData.filter(item => {
item.problemType =
item.problemType == 1
? '技术监督计划'
: item.problemType == 2
? '在线监测超标问题'
: item.problemType == 3
? '用户投诉问题'
: '试运行监测点问题'
item.status =
item.status == 0
? '待提交审批'
: item.status == 1
? '审批中'
: item.status == 2
? '审批通过'
: item.status == 3
? '审批不通过'
: item.status == 4
? '已取消'
: item.status == 5
? '新增'
: '/'
return item
})
2024-05-16 14:00:49 +08:00
}
})
2025-12-30 10:02:01 +08:00
2025-12-19 10:56:30 +08:00
tableStore.table.params.status = ''
2024-05-16 14:00:49 +08:00
provide('tableStore', tableStore)
onMounted(() => {
tableStore.index()
})
// 禁止点击
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 {
2024-10-30 09:29:39 +08:00
ElMessageBox.confirm('此操作将永久删除, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
2024-10-30 09:29:39 +08:00
deleteWarningLeaflet(tableStore.table.selection.map(item => item.id)).then(res => {
ElMessage({
type: 'success',
message: '删除成功!'
})
tableStore.index()
})
})
}
}
2024-06-04 16:54:33 +08:00
/**取消流程操作*/
const cancelLeave = async (row: any) => {
// 二次确认
const { value } = await ElMessageBox.prompt('请输入取消原因', '取消流程', {
confirmButtonText: '确定',
cancelButtonText: '取消',
2024-06-19 11:28:18 +08:00
inputType: 'textarea',
2024-06-04 16:54:33 +08:00
inputPattern: /^[\s\S]*.*\S[\s\S]*$/, // 判断非空,且非空格
inputErrorMessage: '取消原因不能为空'
})
// 发起取消
let data = {
id: row.id,
processInstanceId: row.processInstanceId,
reason: value
}
await cancelFeedback(data)
ElMessage.success('取消成功')
// 加载数据
tableStore.index()
}
2024-05-22 16:05:51 +08:00
/** 流程实例详情 */
2024-06-19 11:28:18 +08:00
const handleAudit = (instanceId: any, historyInstanceId: any) => {
2024-05-24 09:49:40 +08:00
push({
name: 'BpmProcessInstanceDetail',
query: {
2024-06-04 16:54:33 +08:00
id: instanceId,
historyInstanceId
2024-05-24 09:49:40 +08:00
}
})
2024-05-22 16:05:51 +08:00
}
const props = defineProps(['id', 'businessKey'])
watch(
() => props.id,
async (newValue, oldValue) => {
if (newValue === 'null') return // 直接返回,避免后续逻辑执行
let 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 || fullId == 'null') return // 路由时间超过500ms则不执行
await getById(fullId).then(res => {
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.reportPath,
res.data.reformAdvice
)
} else {
feedbackPopup.value.open(
'重新填报预警反馈单',
res.data.id,
res.data.status,
res.data.issueDetail,
res.data.problemPath,
res.data.reportPath,
res.data.reformAdvice,
res.data.takeStep,
res.data.reportPath
)
}
}
})
},
{ immediate: true }
)
2024-05-16 14:00:49 +08:00
</script>
2024-06-19 11:28:18 +08:00
<style scoped lang="scss"></style>