Files
admin-sjzx/src/views/pqs/supervise/retire/terminal.vue

269 lines
8.4 KiB
Vue
Raw Normal View History

<!--待办事项列表-->
<template>
2024-06-19 11:28:18 +08:00
<div>
2024-06-18 16:38:33 +08:00
<TableHeader date-picker nextFlag>
2024-06-05 13:28:21 +08:00
<template v-slot:select>
2024-06-13 13:32:50 +08:00
<el-form-item label="流程状态">
<el-select v-model="tableStore.table.params.status" clearable placeholder="请选择流程状态">
2024-06-05 14:34:23 +08:00
<el-option
v-for="item in statusSelect"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
2024-06-05 13:28:21 +08:00
</template>
<template #operation>
<el-button icon="el-icon-Plus" type="primary" @click="add">新增</el-button>
</template>
</TableHeader>
<!--表格-->
<Table ref="tableRef"></Table>
<!--弹框-->
<device-quit-popup ref="deviceQuitPopup" />
</div>
</template>
2024-06-05 13:28:21 +08:00
<script setup lang="ts">
import TableStore from '@/utils/tableStore'
import Table from '@/components/table/index.vue'
import TableHeader from '@/components/table/header/index.vue'
2024-06-05 13:28:21 +08:00
import { onMounted, provide, ref, watch } from 'vue'
import { useRouter } from 'vue-router'
import DeviceQuitPopup from '@/views/pqs/supervise/retire/deviceQuitPopup.vue'
import { ElMessage } from 'element-plus'
import { ElMessageBox } from 'element-plus/es'
import { cancelQuitRunningDevice } from '@/api/supervision-boot/device/quitRunningDev'
2024-06-05 13:28:21 +08:00
import { useAdminInfo } from '@/stores/adminInfo'
2024-06-05 14:34:23 +08:00
import { useDictData } from '@/stores/dictData'
const dictData = useDictData()
const statusSelect = dictData.statusSelect()
2024-06-05 13:28:21 +08:00
//获取登陆用户姓名和部门
const adminInfo = useAdminInfo()
defineOptions({
2024-06-05 13:28:21 +08:00
name: 'supervision/retire'
})
2024-06-05 13:28:21 +08:00
const { push, options, currentRoute } = useRouter()
const flag = ref(false)
const deviceQuitPopup = ref()
const tableStore = new TableStore({
2024-06-05 13:28:21 +08:00
url: '/supervision-boot/quitRunningDevice/list',
method: 'POST',
2024-06-19 11:28:18 +08:00
publicHeight: 65,
2024-06-05 13:28:21 +08:00
column: [
{
field: 'index',
title: '序号',
width: '60',
formatter: (row: any) => {
return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1
}
},
{ title: '供电公司', field: 'gdName', minWidth: 130 },
{ title: '变电站', field: 'subName', minWidth: 160 },
{ title: '终端名称', field: 'deviceName', minWidth: 130 },
{ title: '变更原因', field: 'propertyNo', minWidth: 160 },
{
2024-06-05 19:44:23 +08:00
title: '变更前状态',
2024-06-05 13:28:21 +08:00
field: 'devOriginalStatus',
minWidth: 130,
render: 'tag',
custom: {
0: 'success',
1: 'warning',
2: 'danger',
3: 'warning',
2024-06-19 19:37:39 +08:00
4: 'info',
null: 'primary'
2024-06-05 13:28:21 +08:00
},
replaceValue: {
0: '运行',
1: '检修',
2: '停运',
3: '调试',
2024-06-19 19:37:39 +08:00
4: '退运',
null: '/'
2024-06-05 13:28:21 +08:00
}
},
{
2024-06-05 19:44:23 +08:00
title: '目标状态',
2024-06-05 13:28:21 +08:00
field: 'devStatus',
minWidth: 130,
render: 'tag',
custom: {
0: 'success',
1: 'warning',
2: 'danger',
3: 'warning',
2024-06-19 19:37:39 +08:00
4: 'info',
null: 'primary'
2024-06-05 13:28:21 +08:00
},
replaceValue: {
0: '运行',
1: '检修',
2: '停运',
3: '调试',
2024-06-19 19:37:39 +08:00
4: '退运',
null:'/'
2024-06-05 13:28:21 +08:00
}
},
{
2024-06-05 13:28:21 +08:00
field: 'status',
2024-06-13 13:32:50 +08:00
title: '流程状态',
2024-06-05 13:28:21 +08:00
minWidth: 100,
render: 'tag',
custom: {
2024-06-19 19:37:39 +08:00
0: 'warning',
2024-06-05 13:28:21 +08:00
1: 'primary',
2: 'success',
3: 'danger',
4: 'warning'
},
replaceValue: {
2024-06-19 19:37:39 +08:00
0: '待提交审批',
2024-06-05 13:28:21 +08:00
1: '审批中',
2: '审批通过',
3: '审批不通过',
4: '已取消'
}
},
{ field: 'createTime', title: '开始时间', minWidth: 170 },
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
}
},
2024-06-05 13:28:21 +08:00
{
title: '操作',
align: 'center',
minWidth: '150',
fixed: 'right',
render: 'buttons',
buttons: [
{
name: 'productSetting',
title: '流程详情',
type: 'primary',
icon: 'el-icon-EditPen',
render: 'basicButton',
click: row => {
flag.value = true
handleAudit(row.processInstanceId, row.historyInstanceId)
}
},
2024-06-19 19:37:39 +08:00
{
name: 'edit',
title: '编辑',
type: 'primary',
icon: 'el-icon-Open',
render: 'basicButton',
disabled: row => {
return row.createBy != adminInfo.$state.id || !(row.status == 0)
},
click: row => {
deviceQuitPopup.value.open('编辑', row)
}
},
2024-06-05 13:28:21 +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-06-05 13:28:21 +08:00
},
click: row => {
deviceQuitPopup.value.open('重新发起终端状态变更', row)
}
},
{
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)
}
}
]
}
2024-06-05 13:28:21 +08:00
],
beforeSearchFun: () => {
2024-06-05 15:35:35 +08:00
// for (let key in tableStore.table.params) {
// if (tableStore.table.params[key] === '') {
// delete tableStore.table.params[key]
// }
// }
2024-06-05 13:28:21 +08:00
tableStore.table.params.deviceType = 1
2024-06-04 18:36:17 +08:00
}
})
2024-06-05 15:21:43 +08:00
tableStore.table.params.status = ''
tableStore.table.params.searchValue = ''
provide('tableStore', tableStore)
2024-06-13 13:32:50 +08:00
//新增退运终端信息
const add = () => {
2024-06-05 13:28:21 +08:00
deviceQuitPopup.value.open('新增终端状态变更')
}
/** 流程实例详情 */
2024-06-04 18:06:17 +08:00
const handleAudit = (instanceId: string, historyInstanceId: string) => {
2024-06-05 13:28:21 +08:00
push({
name: 'BpmProcessInstanceDetail',
state: {
id: instanceId,
historyInstanceId
}
})
}
/**取消流程操作*/
const cancelLeave = async (row: any) => {
2024-06-05 13:28:21 +08:00
// 二次确认
const { value } = await ElMessageBox.prompt('请输入取消原因', '取消流程', {
confirmButtonText: '确定',
cancelButtonText: '取消',
2024-06-19 11:28:18 +08:00
inputType: 'textarea',
2024-06-05 13:28:21 +08:00
inputPattern: /^[\s\S]*.*\S[\s\S]*$/, // 判断非空,且非空格
inputErrorMessage: '取消原因不能为空'
})
// 发起取消
let data = {
id: row.id,
processInstanceId: row.processInstanceId,
reason: value
}
await cancelQuitRunningDevice(data)
ElMessage.success('取消成功')
// 加载数据
tableStore.index()
}
2024-06-05 15:35:35 +08:00
onMounted(() => {
// 加载数据
tableStore.index()
})
2024-06-05 13:28:21 +08:00
watch(
() => currentRoute.value.path,
() => {
if (flag.value && options.history.state.forward?.split('/')[1] == 'bpm') {
tableStore.index()
flag.value = false
}
},
{
deep: true
}
)
</script>