修改 重新发起 按钮显示逻辑

This commit is contained in:
GGJ
2024-06-18 13:36:24 +08:00
parent f33aed9b89
commit 16f0a9fa5a
15 changed files with 71 additions and 78 deletions

View File

@@ -1,7 +1,7 @@
<!---试运行列表-->
<template>
<div class="default-main">
<TableHeader area datePicker ref='TableHeaderRef'>
<TableHeader area datePicker ref="TableHeaderRef">
<template #select>
<el-form-item label="流程状态">
<el-select v-model="tableStore.table.params.status" clearable placeholder="请选择流程状态">
@@ -15,10 +15,10 @@
</el-form-item>
</template>
<template #operation>
<el-button icon='el-icon-Plus' type='primary' @click='startRunTest'>试运行</el-button>
<el-button icon="el-icon-Plus" type="primary" @click="startRunTest">试运行</el-button>
</template>
</TableHeader>
<Table ref='tableRef' />
<Table ref="tableRef" :checkbox-config="checkboxConfig" />
<!-- <el-dialog
v-model='timeDialog'
@@ -33,7 +33,7 @@
format="YYYY-MM-DD HH:mm:ss"
value-format="YYYY-MM-DD HH:mm:ss"
type="datetimerange"
range-separator=""
range-separator=""
start-placeholder="开始日期"
end-placeholder="结束日期">
</el-date-picker>
@@ -45,8 +45,8 @@
</el-dialog>-->
</div>
</template>
<script setup lang='ts'>
import { ref, onMounted, provide, nextTick } from 'vue'
<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'
@@ -55,9 +55,7 @@ import { useDictData } from '@/stores/dictData'
import { ElMessage, ElMessageBox } from 'element-plus'
import { addRunTest } from '@/api/supervision-boot/lineRunTest'
import { formatDate } from '@/utils/formatTime'
import { VxeTablePropTypes } from 'vxe-table'
const dictData = useDictData()
const statusSelect = dictData.statusSelect()
const { push } = useRouter()
@@ -95,12 +93,12 @@ const tableStore = new TableStore({
null: '待试运行'
}
},
{
field: 'testRunTime',
title: '试运行时间范围',
{
field: 'testRunTime',
title: '试运行时间范围',
minWidth: 260,
formatter:(row)=>{
return row.cellValue?row.cellValue:'/'
formatter: row => {
return row.cellValue ? row.cellValue : '/'
}
},
{
@@ -138,14 +136,13 @@ const tableStore = new TableStore({
render: 'buttons',
buttons: [
{
name: 'productSetting',
title: '流程详情',
type: 'primary',
icon: 'el-icon-EditPen',
render: 'basicButton',
click: row => {
handleAudit(row.processInstanceId,row.historyInstanceId)
handleAudit(row.processInstanceId, row.historyInstanceId)
},
disabled: row => {
return row.testRunState != 2
@@ -153,7 +150,6 @@ const tableStore = new TableStore({
},
{
name: 'productSetting',
title: '重新试运行',
type: 'primary',
@@ -168,7 +164,6 @@ const tableStore = new TableStore({
return row.status != 3
}
}
]
}
],
@@ -179,18 +174,21 @@ const tableStore = new TableStore({
// tableStore.table.params.relationUserName = tableStore.table.params.userName
}
})
tableStore.table.params.status=''
tableStore.table.params.status = ''
provide('tableStore', tableStore)
onMounted(() => {
tableStore.index()
})
const checkboxConfig = reactive<VxeTablePropTypes.CheckboxConfig>({
labelField: '',
checkMethod: ({ row }) => {
return !(row.testRunState == 1 || row.testRunState == 2)
}
})
/** 处理审批按钮 */
const handleAudit = (instanceId: any,historyInstanceId:any) => {
const handleAudit = (instanceId: any, historyInstanceId: any) => {
push({
name: 'BpmProcessInstanceDetail',
state: {
@@ -221,7 +219,6 @@ const startRunTest = () => {
}
})
if (!flag) {
return ElMessage({
message: '请选择未试运行的监测点进行试运行',
@@ -233,14 +230,14 @@ const startRunTest = () => {
ElMessageBox.confirm('是否确认执行72小时监测点试运行', '试运行', {
confirmButtonText: '确 认',
cancelButtonText: '取 消'
}).then(() => {
runTestSubmit(0)
})
.then(() => {
runTestSubmit(0)
})
.catch(() => console.info('操作取消'))
}
const runTestSubmit = (type:number) => {
const runTestSubmit = (type: number) => {
const start = new Date()
start.setDate(start.getDate() + 1)
start.setHours(0, 0, 0)
@@ -249,12 +246,12 @@ const runTestSubmit = (type:number) => {
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 endString = formatDate(end, 'YYYY-MM-DD')
const data = {
startTime: startString,
endTime: endString,
lineIds: monitorIds,
operateType:type
operateType: type
}
addRunTest(data).then((res: any) => {
if (res.code === 'A0000') {
@@ -266,10 +263,6 @@ const runTestSubmit = (type:number) => {
}
})
}
</script>
<style scoped lang='scss'>
</style>
<style scoped lang="scss"></style>