预告警单工作流基础版本

This commit is contained in:
2024-05-22 16:05:51 +08:00
parent 346aeb1179
commit 54f6fb6e02
8 changed files with 401 additions and 73 deletions

View File

@@ -0,0 +1,28 @@
import createAxios from '@/utils/request'
import { SUPERVISION_BOOT } from '@/utils/constantRequest'
const MAPPING_PATH = SUPERVISION_BOOT + '/warningLeaflet'
/**
* 针对有问题的现场测试发起告警单
*/
export const addFeedback = (data: any) => {
return createAxios({
url: MAPPING_PATH + '/addFeedback',
method: 'POST',
data: data
})
}
/**
* 根据id获取预告警单的详细数据
*/
export const getById = (id: string) => {
return createAxios({
url: MAPPING_PATH + '/getById?id=' + id,
method: 'GET'
})
}

View File

@@ -47,15 +47,6 @@ const tableStore = new TableStore({
render: 'buttons',
fixed: 'right',
buttons: [
// {
// name: 'edit',
// title: '附件预览',
// type: 'primary',
// icon: 'el-icon-Open',
// render: 'confirmButton',
//
// click: row => {}
// },
{
name: 'edit',
title: '发起告警单',
@@ -80,7 +71,7 @@ const tableStore = new TableStore({
title: '查看告警单',
type: 'primary',
icon: 'el-icon-Open',
render: 'confirmButton',
render: 'basicButton',
disabled: row => {
return row.initiateWarningFlag == 0
},

View File

@@ -35,11 +35,11 @@
</template>
<script setup lang='ts'>
import { onMounted, ref } from 'vue'
defineOptions({ name: 'QuitRunningDeviceDetail' })
import { useRoute } from 'vue-router'
import { propTypes } from '@/utils/propTypes'
import { getRunningDeviceById } from '@/api/supervision-boot/device/quitRunningDev'
defineOptions({ name: 'QuitRunningDeviceDetail' })
const { query } = useRoute() // 查询参数
const props = defineProps({
@@ -90,7 +90,7 @@ const getDeviceStatusType = (status: number) => {
const getInfo = async () => {
detailLoading.value = true
try {
// detailData.value = await LeaveApi.getLeave()
await getRunningDeviceById(props.id || queryId).then(res => {
detailData.value = res.data
})

View File

@@ -165,7 +165,7 @@ const add = () => {
deviceQuitPopup.value.open('新增退运')
}
/** 处理审批按钮 */
/** 流程实例详情 */
const handleAudit = (instanceId: any) => {
push({
name: 'BpmProcessInstanceDetail',

View File

@@ -1,35 +1,34 @@
<template>
<TableHeader datePicker ref="TableHeaderRef">
<TableHeader datePicker ref='TableHeaderRef'>
<template #operation>
<!-- <el-button icon="el-icon-Plus" type="primary" @click="add">新增</el-button>-->
<!-- <el-button icon="el-icon-Delete" type="primary">删除</el-button>-->
<!-- <el-button icon="el-icon-Download" type="primary">导出</el-button>-->
<!-- <el-button icon="el-icon-Plus" type="primary" @click="add">新增</el-button>-->
<!-- <el-button icon="el-icon-Delete" type="primary">删除</el-button>-->
<!-- <el-button icon="el-icon-Download" type="primary">导出</el-button>-->
</template>
</TableHeader ref="tableRef">
<Table ref="tableRef" />
<!-- 新增 -->
<listForm ref="listFormRef"/>
</TableHeader>
<!--表格-->
<Table ref='tableRef' />
<!--弹框-->
<feedback-popup ref='feedbackPopup' />
</template>
<script setup lang="ts">
<script setup lang='ts'>
import { ref, onMounted, provide, nextTick } 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 { useDictData } from '@/stores/dictData'
import listForm from "./listForm.vue"
const dictData = useDictData()
import FeedbackPopup from '@/views/pqs/supervise/technology/feedbackPopup.vue'
import { useRouter } from 'vue-router'
const { push } = useRouter()
const feedbackPopup = ref()
const tableRef = ref()
const planAddRef = ref()
const TableHeaderRef = ref()
const listFormRef = ref()
const tableStore = new TableStore({
url: '/supervision-boot/warningLeaflet/alarmPageData',
publicHeight: 65,
@@ -44,7 +43,8 @@ const tableStore = new TableStore({
return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1
}
},
{ field: 'problemType', title: '告警单问题来源', minWidth: '150',
{
field: 'problemType', title: '告警单问题来源', minWidth: '150',
render: 'tag',
custom: {
1: 'warning',
@@ -60,14 +60,15 @@ const tableStore = new TableStore({
}
},
{ field: 'leafletName', title: '单据名称', minWidth: '150' },
{ field: 'status', title: '告警单状态', minWidth: '150',
{
field: 'status', title: '告警单状态', minWidth: '150',
render: 'tag',
custom: {
1: 'primary',
2: 'success',
3: 'danger',
4: 'warning',
5: 'primary',
5: 'primary'
},
replaceValue: {
1: '审批中',
@@ -87,7 +88,7 @@ const tableStore = new TableStore({
buttons: [
{
name: 'productSetting',
title: '反馈数据',
title: '问题反馈',
type: 'primary',
icon: 'el-icon-EditPen',
render: 'basicButton',
@@ -95,7 +96,7 @@ const tableStore = new TableStore({
return row.status !== 5
},
click: row => {
// planAddRef.value.open('查看计划', row)
feedbackPopup.value.open('填报反馈单',row.id,row.status)
}
},
{
@@ -108,7 +109,7 @@ const tableStore = new TableStore({
return row.status == 5
},
click: row => {
// handleAudit(row.processInstanceId)
handleAudit(row.processInstanceId)
}
},
{
@@ -121,7 +122,7 @@ const tableStore = new TableStore({
return row.status == 1 || row.status == 2 || row.status == 4 || row.status == 5
},
click: row => {
// deviceQuitPopup.value.open('重新发起退运', row)
// deviceQuitPopup.value.open('重新发起', row)
}
},
{
@@ -150,16 +151,21 @@ const tableStore = new TableStore({
tableStore.table.params.status = ''
provide('tableStore', tableStore)
// 新增计划
const add = () => {
// title.value = '普测计划新增'
listFormRef.value.open('新增告警单')
}
onMounted(() => {
tableStore.index()
})
/** 流程实例详情 */
const handleAudit = (instanceId: any) => {
push({
name: 'BpmProcessInstanceDetail',
query: {
id: instanceId
}
})
}
</script>
<style scoped lang="scss"></style>
<style scoped lang='scss'></style>

View File

@@ -6,9 +6,8 @@
<!-- </template>-->
</TableHeader>
<Table ref="tableRef" />
<!-- 新增 -->
<listForm ref="listFormRef" />
<!--弹框-->
<feedback-popup ref='feedbackPopup' />
</template>
<script setup lang="ts">
import { ref, onMounted, provide, nextTick } from 'vue'
@@ -16,14 +15,12 @@ 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 { useDictData } from '@/stores/dictData'
import listForm from './listForm.vue'
const dictData = useDictData()
import FeedbackPopup from '@/views/pqs/supervise/technology/feedbackPopup.vue'
import { useRouter } from 'vue-router'
const { push } = useRouter()
const tableRef = ref()
const planAddRef = ref()
const listFormRef = ref()
const TableHeaderRef = ref()
const feedbackPopup = ref()
const tableStore = new TableStore({
url: '/supervision-boot/warningLeaflet/warningPageData',
publicHeight: 65,
@@ -81,26 +78,56 @@ const tableStore = new TableStore({
buttons: [
{
name: 'productSetting',
title: '反馈数据',
title: '问题反馈',
type: 'primary',
icon: 'el-icon-EditPen',
render: 'basicButton',
click: row => {
// planAddRef.value.open('查看计划', row)
}
disabled: row => {
return row.status !== 5
},
click: row => {
feedbackPopup.value.open('填报反馈单',row.id,row.status)
}
},
{
name: 'edit',
title: '修改',
type: 'warning',
icon: 'el-icon-Open',
render: 'basicButton',
click: row => {
// deviceQuitPopup.value.open('重新发起退运', row)
planAddRef.value.open('重新发起计划', row)
}
{
name: 'productSetting',
title: '流程详情',
type: 'primary',
icon: 'el-icon-EditPen',
render: 'basicButton',
disabled: row => {
return row.status == 5
},
click: row => {
handleAudit(row.processInstanceId)
}
},
{
name: 'edit',
title: '重新发起',
type: 'warning',
icon: 'el-icon-Open',
render: 'basicButton',
disabled: row => {
return row.status == 1 || row.status == 2 || row.status == 4 || row.status == 5
},
click: row => {
// deviceQuitPopup.value.open('重新发起', row)
}
},
{
name: 'cancel',
title: '取消',
type: 'danger',
icon: 'el-icon-Open',
render: 'basicButton',
disabled: row => {
return row.status == 3 || row.status == 2 || row.status == 4 || row.status == 5
},
click: row => {
// cancelLeave(row)
}
}
]
}
],
@@ -111,15 +138,20 @@ const tableStore = new TableStore({
})
provide('tableStore', tableStore)
// 新增计划
const add = () => {
// title.value = '普测计划新增'
listFormRef.value.open('新增预警单')
}
onMounted(() => {
tableStore.index()
})
/** 流程实例详情 */
const handleAudit = (instanceId: any) => {
push({
name: 'BpmProcessInstanceDetail',
query: {
id: instanceId
}
})
}
</script>
<style scoped lang="scss"></style>

View File

@@ -0,0 +1,108 @@
<template>
<!--工作流view的路径/pqs/supervise/technology/detail-->
<div class='default-main'>
<!-- <h1>详细信息回显</h1>-->
<el-descriptions :column='2' border>
<el-descriptions-item :label='detailData.leafletType==1?"预警单名称":"告警单名称"'>
{{ detailData.leafletName }}
</el-descriptions-item>
<el-descriptions-item label='告警单问题来源'>
{{ getProblemType(detailData.problemType) }}
</el-descriptions-item>
<el-descriptions-item :span='2' label='告警单问题描述'>
{{ detailData.issueDetail }}
</el-descriptions-item>
<template v-if='detailData.problemType == 4'>
<el-descriptions-item :span='2' label='问题附件'>
<el-icon>
<Link />
</el-icon>
<a :href='detailData.problemPath' target='_blank'>{{ detailData.problemName }}</a>
</el-descriptions-item>
</template>
<el-descriptions-item :span='2' label='采取措施'>
{{ detailData.takeStep }}
</el-descriptions-item>
<el-descriptions-item :span='2' label='处理成效报告'>
<el-icon>
<Link />
</el-icon>
<a :href='detailData.reportPath' target='_blank'>{{ detailData.reportName }}</a>
</el-descriptions-item>
</el-descriptions>
</div>
</template>
<script lang='ts' setup>
import { onMounted, ref } from 'vue'
import { useRoute } from 'vue-router'
import { propTypes } from '@/utils/propTypes'
import { getById } from '@/api/supervision-boot/leaflet'
import { getFileNameAndFilePath } from '@/api/system-boot/file'
import { Link } from '@element-plus/icons-vue'
defineOptions({ name: 'technology/detail' })
const { query } = useRoute() // 查询参数
const props = defineProps({
id: propTypes.string.def(undefined)
})
const detailLoading = ref(false) // 表单的加载中
const detailData = ref({}) // 详情数据
const queryId = query.id// 从 URL 传递过来的 id 编号
const getProblemType = (type: number) => {
if (type === 1) {
return '技术监督计划'
}
if (type === 2) {
return '在线监测超标问题'
}
if (type === 3) {
return '用户投诉问题'
}
if (type === 4) {
return '现场测试超标问题'
}
return '现场测试超标问题'
}
/** 获得数据 */
const getInfo = async () => {
detailLoading.value = true
try {
await getById(props.id || queryId).then(res => {
detailData.value = res.data
getFileData()
})
} finally {
detailLoading.value = false
}
}
const getFileData = async () => {
//如果有问题附件
if (detailData.value.problemPath) {
await getFileNameAndFilePath({ filePath: detailData.value.problemPath }).then(res => {
detailData.value.problemPath = res.data.url
detailData.value.problemName = res.data.fileName
})
}
await getFileNameAndFilePath({ filePath: detailData.value.reportPath }).then(res => {
detailData.value.reportPath = res.data.url
detailData.value.reportName = res.data.fileName
})
}
defineExpose({ open: getInfo }) // 提供 open 方法,用于打开弹窗
/** 初始化 **/
onMounted(() => {
getInfo()
})
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,163 @@
<template>
<el-dialog
draggable
class='cn-operate-dialog'
v-model='dialogVisible'
:title='title'
style='max-width: 450px; height: 320px'
top='30vh'
>
<el-scrollbar>
<el-form :inline='false' :model='formData' label-width='120px' :rules='rules' ref='formRef'>
<el-form-item label='采取的措施:' prop='takeStep'>
<el-input
v-model='formData.takeStep'
autocomplete='off'
placeholder='请输入采取的措施'
/>
</el-form-item>
<el-form-item label='处理成效报告:' prop='reportPath'>
<el-upload
ref='uploadRef'
action=''
accept='.doc,.docx,.xlsx,.xls,.pdf'
:limit='1'
:on-exceed='handleExceed'
:on-change='choose'
:auto-upload='false'
:on-progress="uploadFileName('reportPath')"
>
<template #trigger>
<el-button type='primary'>上传文件</el-button>
</template>
</el-upload>
</el-form-item>
</el-form>
</el-scrollbar>
<template #footer>
<span class='dialog-footer'>
<el-button @click='dialogVisible = false'>取消</el-button>
<el-button type='primary' @click='submit'>确认</el-button>
</span>
</template>
</el-dialog>
</template>
<script lang='ts' setup>
import { ref, inject, reactive, nextTick } from 'vue'
import { ElMessage, genFileId, UploadProps, UploadRawFile } from 'element-plus'
import TableStore from '@/utils/tableStore' // 若不是列表页面弹框可删除
import { uploadFile } from '@/api/system-boot/file'
import { addFeedback } from '@/api/supervision-boot/leaflet'
//下拉数据源
const title = ref('')
const tableStore = inject('tableStore') as TableStore
const formRef = ref()
// 上传报告
const uploadRef = ref()
const dialogVisible = ref(false)
// 注意不要和表单ref的命名冲突
const formData = reactive({
id: '',
status: '',
takeStep: '',
reportPath: ''
})
//处理成效报告
const reportPath = ref('')
//form表单校验规则
const rules = {
takeStep: [{ required: true, message: '请输入采取的措施', trigger: 'blur' }]
}
const resetForm = () => {
if (formRef.value) {
formRef.value.resetFields()
}
}
const open = async (text: string, id: string, status: any, takeStep?: string, reportPath?: string) => {
title.value = text
resetForm()
if (takeStep) {
formData.takeStep = takeStep
}
uploadRef.value?.clearFiles()
if (reportPath) {
formData.reportPath = reportPath
}
formData.id = id
formData.status = status
dialogVisible.value = true
}
/**
* 提交用户表单数据
*/
const submit = () => {
formRef.value.validate(async (valid: any) => {
if (valid) {
if (!reportPath.value) {
return ElMessage({
message: '请上传处理成效报告',
type: 'warning'
})
}
if (formData.status == '3') {
// await quitRunningDeviceUpdate(formData)
ElMessage.success('重新发起成功')
tableStore.index()
dialogVisible.value = false
} else {
//此时该告警单处于待反馈状态
await addFeedback(formData)
//查询进线数据避免一直处于loading状态
ElMessage.success('申请成功')
tableStore.index()
dialogVisible.value = false
}
}
})
}
defineExpose({ open })
let uploadName = ref('')
const choose = (e: any) => {
uploadFile(e.raw, '/supervision/').then(res => {
reportPath.value = res.data.name
formData.reportPath = res.data.name
})
}
const handleExceed: UploadProps['onExceed'] = files => {
uploadRef.value!.clearFiles()
const file = files[0] as UploadRawFile
file.uid = genFileId()
uploadRef.value!.handleStart(file)
}
//上传报告改变
const uploadFileName = val => {
uploadName.value = val
}
</script>
<style scoped lang='scss'>
.el-upload-list__item {
transition: none !important;
}
.el-select {
min-width: 180px;
}
</style>