海南验收问题整改

This commit is contained in:
GGJ
2024-11-22 08:45:42 +08:00
parent 94ac7ee227
commit 7e315466d0
17 changed files with 710 additions and 589 deletions

View File

@@ -1,451 +1,71 @@
<!---试运行列表-->
<template>
<div class="default-main">
<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-Plus" type="primary" @click="startRunTest">试运行</el-button>
<el-button icon="el-icon-Delete" type="primary" @click="deleteEven">删除</el-button>
</template>
</TableHeader>
<Table ref="tableRef" :checkbox-config="checkboxConfig" />
<!-- <el-dialog
v-model='timeDialog'
width='500px'
append-to-body
destroy-on-close>
<div class='block'>
<span class="demonstration">试运行时间</span>
<el-date-picker
:popper-append-to-body="false"
:v-model="dateValue"
format="YYYY-MM-DD HH:mm:ss"
value-format="YYYY-MM-DD HH:mm:ss"
type="datetimerange"
range-separator=""
start-placeholder="开始日期"
end-placeholder="结束日期">
</el-date-picker>
</div>
<div class='block' style='text-align: center'>
<el-button type='primary' style='margin-top: 50px' @click='runTestSubmit'>确认</el-button>
</div>
</el-dialog>-->
<el-tabs v-model="activeName" type="border-card">
<el-tab-pane label="监测点台账录入" name="1">
<monitorpoint :id="id" v-if="activeName == '1'" />
</el-tab-pane>
<el-tab-pane label="监测点联调列表" name="2">
<jointDebugList :id="id" v-if="activeName == '2'" />
</el-tab-pane>
<el-tab-pane label="试运行评估" name="3">
<testRun :id="id" v-if="activeName == '3'" />
</el-tab-pane>
</el-tabs>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted, provide, reactive } from 'vue'
import TableStore from '@/utils/tableStore'
import Table from '@/components/table/index.vue'
import TableHeader from '@/components/table/header/index.vue'
import { useRoute, useRouter } from 'vue-router'
import { useDictData } from '@/stores/dictData'
import { ElMessage, ElMessageBox } from 'element-plus'
import { addRunTest, update, cancel } from '@/api/supervision-boot/lineRunTest'
import { formatDate } from '@/utils/formatTime'
import { VxeTablePropTypes } from 'vxe-table'
import { useAdminInfo } from '@/stores/adminInfo'
import { getFileNameAndFilePath } from '@/api/system-boot/file'
import { deleteTempLineRunTestReport } from '@/api/supervision-boot/delete/index'
const dictData = useDictData()
const statusSelect = dictData.statusSelect()
const { push } = useRouter()
const adminInfo = useAdminInfo()
const TableHeaderRef = ref()
const tableRef = ref()
</template>
<script setup lang="ts">
import { ref } from 'vue'
const tableStore = new TableStore({
url: '/supervision-boot/tempLinedebug/pageHasDebug',
method: 'POST',
column: [
{ title: '', type: 'checkbox', width: 40 },
{ field: 'lineName', title: '监测点名称', minWidth: 160 },
{ field: 'connectedBus', title: '接入母线', minWidth: 160 },
// { field: 'monitoringTerminalCode', title: '终端编号', minWidth: 140 },
{ field: 'monitoringTerminalName', title: '终端名称', minWidth: 140 },
{ field: 'powerSubstationName', title: '变电站', minWidth: 160 },
{ field: 'reason', title: '调试原因', minWidth: 160 },
{
field: 'testRunState',
title: '试运行状态',
minWidth: 100,
render: 'tag',
custom: {
0: 'primary',
2: 'success',
3: 'danger',
1: 'warning'
},
replaceValue: {
0: '待试运行',
1: '试运行中',
2: '试运行成功',
3: '试运行失败',
null: '待试运行'
}
},
{
field: 'testRunTime',
title: '试运行时间范围',
minWidth: 200,
formatter: row => {
return row.cellValue ? row.cellValue : '/'
}
},
{
field: 'status',
title: '流程状态',
minWidth: 100,
render: 'tag',
custom: {
0: 'warning',
1: 'primary',
2: 'success',
3: 'danger',
4: 'warning'
},
replaceValue: {
0: '待提交审批',
1: '审批中',
2: '审批通过',
3: '审批不通过',
4: '已取消',
null: '/',
9: '/'
}
},
{
field: 'createBy',
title: '填报人',
minWidth: 100,
formatter: (row: any) => {
return dictData.state.userList.filter(item => item.id == row.cellValue)[0]?.name
}
},
{
title: '操作',
minWidth: 230,
fixed: 'right',
render: 'buttons',
buttons: [
{
name: 'productSetting',
title: '查看报告',
type: 'primary',
icon: 'el-icon-EditPen',
render: 'basicButton',
disabled: row => {
return row.testRunReport == null || row.testRunReport.length == 0
},
click: row => {
// const match = row.filePath.match(/excelreport(\/[^?#]*)/)
import { mainHeight } from '@/utils/layout'
import monitorpoint from '@/views/pqs/supervise/terminalNetworkDetection/components/monitorpoint/index.vue'
import jointDebugList from '@/views/pqs/supervise/terminalNetworkDetection/components/jointDebugList/index.vue'
import testRun from './testRun.vue'
window.open(window.location.origin + '/#/previewFile?' + row.testRunReport)
}
},
{
name: 'productSetting',
title: '下载报告',
type: 'primary',
icon: 'el-icon-EditPen',
render: 'basicButton',
click: row => {
downloadTheReport(row.testRunReport)
},
disabled: row => {
return row.testRunReport == null || row.testRunReport.length == 0
}
},
{
name: 'productSetting',
title: '流程详情',
type: 'primary',
icon: 'el-icon-EditPen',
render: 'basicButton',
click: row => {
handleAudit(row.processInstanceId, row.historyInstanceId)
},
disabled: row => {
return !row.processInstanceId
}
},
{
name: 'productSetting',
title: '重新试运行',
type: 'primary',
icon: 'el-icon-EditPen',
render: 'basicButton',
click: row => {
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 || 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)
}
}
]
}
],
beforeSearchFun: () => {
tableStore.table.params.orgNo = tableStore.table.params.deptIndex
tableStore.table.params.statveList = [2]
// tableStore.table.params.relationUserName = tableStore.table.params.userName
import { useRoute } from "vue-router";
defineOptions({
name: 'terminalNetwotk'
})
const activeName = ref('2')
const route = useRoute()
const id = ref('')
const key = ref('')
watch(() => route.query.t, async (newValue, oldValue) => {
if (route.fullPath.includes('terminalNetwotk')) {
let type = (route.query.type as string) || 'null'
if (type == 'null') { }
else if (type == '1') {
activeName.value = '1'
} else if (type == '2') {
activeName.value = '2'
} else if (type == '3') {
activeName.value = '3'
} else {
activeName.value = '4'
}
id.value = (route.query.id as string) || 'null'
key.value = (route.query.key as string) || 'null'
id.value = id.value + '@' + route.query.t
}
})
tableStore.table.params.status = ''
provide('tableStore', tableStore)
onMounted(() => {
tableStore.index()
})
const checkboxConfig = reactive<VxeTablePropTypes.CheckboxConfig>({
labelField: '',
checkMethod: ({ row }) => {
return adminInfo.roleCode.includes('delete_info') || !(row.testRunState == 1 || row.testRunState == 2)
}
})
const deleteEven = () => {
if (tableStore.table.selection.length == 0) {
ElMessage({
type: 'warning',
message: '请选择要删除的数据'
})
} else {
ElMessageBox.confirm('此操作将永久删除, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
let createBy = tableStore.table.selection.map(item => item.createBy)
let status = tableStore.table.selection.map(item => item.status)
if (adminInfo.roleCode.includes('delete_info')) {
deleteList()
} else if (createBy.includes(adminInfo.$state.id) && status.includes(0)) {
deleteList()
} else {
ElMessage({
type: 'warning',
message: '只能删除自己填报的数据!!!'
})
}
})
}
}
const deleteList = () => {
deleteTempLineRunTestReport(tableStore.table.selection.map(item => item.id)).then(res => {
ElMessage({
type: 'success',
message: '删除成功!'
})
tableStore.index()
})
}
/** 处理审批按钮 */
const handleAudit = (instanceId: any, historyInstanceId: any) => {
push({
name: 'BpmProcessInstanceDetail',
state: {
id: instanceId,
historyInstanceId
}
})
}
/**取消流程操作*/
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 = []
const startRunTest = () => {
monitorIds = []
let flag = true
if (tableStore.table.selection.length === 0) {
return ElMessage({
message: '请至少选择一个监测点进行试运行',
type: 'warning'
})
}
tableStore.table.selection.forEach(item => {
if (item.testRunState != 0) {
flag = false
}
if (item.testRunState == 0) {
monitorIds.push(item.id)
}
})
if (!flag) {
return ElMessage({
message: '请选择未试运行的监测点进行试运行',
type: 'warning'
})
return
}
ElMessageBox.confirm('是否确认执行72小时监测点试运行', '试运行', {
confirmButtonText: '确 认',
cancelButtonText: '取 消'
})
.then(() => {
runTestSubmit(0)
})
.catch(() => console.info('操作取消'))
}
// 下载报告
const downloadTheReport = (url: string) => {
getFileNameAndFilePath({ filePath: url }).then((res: any) => {
console.log(res.data.url, 'res')
const link = document.createElement('a')
link.href = res.data.url
link.download = res.data.name
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
})
}
const runTestSubmit = (type: number) => {
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: type
}
addRunTest(data).then((res: any) => {
if (res.code === 'A0000') {
ElMessage({
message: '发起试运行成功',
type: 'success'
})
tableStore.index()
}
})
}
const route = useRoute()
watch(() => route.query.t, async (newValue, oldValue) => {
let nowTime = Date.now()
let routeTime = route.query.t as number || 1
if (isNaN(routeTime) || nowTime - routeTime > import.meta.env.VITE_ROUTE_TIME_OUT) return // 路由时间超过500ms则不执行
if (route.fullPath.includes('/testRun')) {
let id = (route.query.id as string) || 'null'
if (id != 'null') {
monitorIds = []
monitorIds.push(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
}
update(data).then((res: any) => {
if (res.code === 'A0000') {
ElMessage({
message: '发起试运行成功',
type: 'success'
})
tableStore.index()
}
})
}
}
}, { deep: true, immediate: true })
</script>
<style scoped lang="scss"></style>
}, { deep: true, immediate: true })
const layout = mainHeight(63) as any
</script>
<style lang="scss" scoped>
.bars_w {
width: 100%;
height: 500px;
}
:deep(.el-tabs__content) {
height: v-bind('layout.height');
overflow-y: auto;
}
</style>