联调 试运行 编辑功能 修改 在线监测页面

This commit is contained in:
GGJ
2024-07-05 09:05:22 +08:00
parent 2fc40a2136
commit a398ca6361
11 changed files with 401 additions and 27 deletions

View File

@@ -53,7 +53,7 @@ import TableHeader from '@/components/table/header/index.vue'
import { useRouter } from 'vue-router'
import { useDictData } from '@/stores/dictData'
import { ElMessage, ElMessageBox } from 'element-plus'
import { addRunTest } from '@/api/supervision-boot/lineRunTest'
import { addRunTest, update, cancel } from '@/api/supervision-boot/lineRunTest'
import { formatDate } from '@/utils/formatTime'
import { VxeTablePropTypes } from 'vxe-table'
import { useAdminInfo } from '@/stores/adminInfo'
@@ -149,7 +149,7 @@ const tableStore = new TableStore({
handleAudit(row.processInstanceId, row.historyInstanceId)
},
disabled: row => {
return row.testRunState != 2 || !row.processInstanceId
return !row.processInstanceId
}
},
{
@@ -174,10 +174,49 @@ const tableStore = new TableStore({
click: row => {
monitorIds = []
monitorIds.push(row.id)
runTestSubmit(1)
monitorIds = []
monitorIds.push(row.id)
const start = new Date()
start.setDate(start.getDate() + 1)
start.setHours(0, 0, 0)
const end = new Date()
end.setDate(end.getDate() + 3)
end.setHours(23, 59, 59)
const startString = formatDate(start, 'YYYY-MM-DD') // 转换为 YYYY-MM-DD 格式
const endString = formatDate(end, 'YYYY-MM-DD')
const data = {
startTime: startString,
endTime: endString,
lineIds: monitorIds,
operateType: 1,
id: row.id
}
update(data).then((res: any) => {
if (res.code === 'A0000') {
ElMessage({
message: '发起试运行成功',
type: 'success'
})
tableStore.index()
}
})
},
disabled: row => {
return row.status != 3
return !(row.status == 3 || row.status == 4)
}
},
{
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)
}
}
]
@@ -213,6 +252,28 @@ const handleAudit = (instanceId: any, historyInstanceId: any) => {
}
})
}
/**取消流程操作*/
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 cancel(data).then(res => {
ElMessage.success('取消成功')
// 加载数据
tableStore.index()
})
}
//试运行
let monitorIds: any = []
@@ -256,7 +317,6 @@ const startRunTest = () => {
// 下载报告
const downloadTheReport = (url: string) => {
getFileNameAndFilePath({ filePath: url }).then((res: any) => {
const link = document.createElement('a')
link.href = res.data.url
link.download = res.data.name