联调普测计划管理页面

This commit is contained in:
GGJ
2024-05-15 12:27:13 +08:00
parent bb67695943
commit 5095592df4
6 changed files with 286 additions and 62 deletions

View File

@@ -22,8 +22,7 @@ export function removeSurvey(data: any) {
return createAxios({
url: '/supervision-boot/generalSurvey/removeSurvey',
method: 'post',
data,
data
})
}
//新增
@@ -152,3 +151,27 @@ export function addSurvey(data: any) {
data
})
}
// 查询普测计划详情
export function querySurveyDetail(data: any) {
return createAxios({
url: '/supervision-boot/generalSurvey/querySurveyDetail',
method: 'POST',
params: data
})
}
// 修改普测计划
export function auditSurvey(data: any) {
return createAxios({
url: '/supervision-boot/generalSurvey/auditSurvey',
method: 'POST',
data
})
}
// 取消普测计划
export function cancel(data: any) {
return createAxios({
url: '/supervision-boot/generalSurvey/cancel',
method: 'POST',
data
})
}

View File

@@ -186,7 +186,7 @@ body,
}
.cn-operate-dialog .el-dialog__body {
height: 60vh;
max-height: 60vh;
padding-top: 20px;
padding-bottom: 52px;
}

View File

@@ -49,7 +49,6 @@
<el-form-item label="上传文件:">
<el-upload
v-model:file-list="formdata.fileList"
v-if="title != '查看计划'"
ref="upload"
action=""
:limit="5"
@@ -60,13 +59,6 @@
<el-button type="primary">上传文件</el-button>
</template>
</el-upload>
<div v-else>
<div v-for="(item, index) in aList">
<el-button type="primary" link @click="downloadFile(item.url, item.fileName)">
{{ item.fileName }}
</el-button>
</div>
</div>
</el-form-item>
</el-form>
</el-form>
@@ -76,7 +68,7 @@
<generalTestTree ref="treeRef" />
</el-col>
</el-row>
<div
<!-- <div
v-if="
(title == '查看计划' || title == '计划审核') &&
(title == '计划审核' || formdata.status == 1 || formdata.status == 3 || formdata.status == 4)
@@ -89,7 +81,7 @@
:autosize="{ minRows: 2, maxRows: 4 }"
v-model="formdata.checkComment"
></el-input>
</div>
</div> -->
<template #footer v-if="title != '查看计划'">
<div class="dialog-footer pd10">
<el-button type="primary" @click="submitFn">提交</el-button>
@@ -101,7 +93,7 @@
<script setup lang="ts">
import generalTestTree from '@/components/tree/pqs/generalTestTree.vue'
import { ref, reactive, nextTick } from 'vue'
import { addSurvey } from '@/api/process-boot/generalTest'
import { addSurvey, auditSurvey } from '@/api/process-boot/generalTest'
import Area from '@/components/form/area/index.vue'
import { ElMessage, UploadProps } from 'element-plus'
import { uploadFile, getFileNameAndFilePath } from '@/api/system-boot/file'
@@ -127,7 +119,6 @@ const formdata: any = ref({
checkComment: '',
filePath: ''
})
const aList: any = ref([])
const formRef = ref()
const treeRef = ref()
const rules = {
@@ -147,17 +138,30 @@ const submitFn = () => {
formRef.value.validate(async (valid: any) => {
if (valid) {
let filePath = ''
formdata.value.subIds = ['123', '3123'] //treeRef.value.treeRef.getCheckedKeys(false)
formdata.value.subIds = treeRef.value.treeRef.getCheckedKeys(false)
for (let i = 0; i < formdata.value.fileList.length; i++) {
await uploadFile(formdata.value.fileList[i].raw, 'supervision/').then(res => {
filePath = filePath + res.data.name + ','
})
if (i == formdata.value.fileList.length - 1) {
await addSurvey({ ...formdata.value, filePath: filePath }).then((res: any) => {
ElMessage.success('新增成功!')
cancelFn()
emit('onsubmit')
if (formdata.value.fileList[i].raw) {
await uploadFile(formdata.value.fileList[i].raw, 'supervision/').then(res => {
filePath = filePath + res.data.name + ','
})
} else {
filePath = filePath + formdata.value.fileList[i].supervision + ','
}
if (i == formdata.value.fileList.length - 1) {
if (title.value == '普测计划新增') {
await addSurvey({ ...formdata.value, filePath: filePath }).then((res: any) => {
ElMessage.success('新增成功!')
cancelFn()
emit('onsubmit')
})
} else if (title.value == '重新发起计划') {
await auditSurvey({ ...formdata.value, filePath: filePath }).then((res: any) => {
ElMessage.success('重新发起计划成功!')
cancelFn()
emit('onsubmit')
})
}
}
}
}
@@ -194,10 +198,19 @@ const open = (text: string, row?: any) => {
if (row) {
formdata.value = JSON.parse(JSON.stringify(row))
nextTick(() => {
getFilePath()
formdata.value.fileList = []
treeRef.value.loadData()
treeRef.value.setKey(row.subIds || [], text)
// formdata.value.filePath.join(',')
let arr = row.filePath.split(',')
arr.slice(0, -1).forEach((item: any) => {
getFileNameAndFilePath({ filePath: item }).then((res: any) => {
formdata.value.fileList.push({
name: res.data.fileName,
supervision: res.data.name,
url: res.data.url
})
})
})
})
} else {
nextTick(() => {
@@ -205,24 +218,6 @@ const open = (text: string, row?: any) => {
})
}
}
const getFilePath = () => {
aList.value = []
let arr = formdata.value.filePath.split(',')
arr.slice(0, -1).forEach((item: any) => {
getFileNameAndFilePath({ filePath: item }).then((res: any) => {
aList.value.push(res.data)
})
})
}
const downloadFile = (url: string, fileName: string) => {
const link = document.createElement('a')
link.href = url
link.download = fileName
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
}
defineExpose({ open })
</script>

View File

@@ -33,13 +33,15 @@ 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 { submitAuditUser } from '@/api/process-boot/generalTest'
import { submitAuditUser,cancel } from '@/api/process-boot/generalTest'
import planAdd from './planAdd.vue'
import { useRouter } from 'vue-router'
import { useDictData } from '@/stores/dictData'
import { queryPlan,removeSurvey } from '@/api/process-boot/generalTest'
import { getUserByRoleType } from '@/api/user-boot/user'
const dictData = useDictData()
const { push } = useRouter()
const dialogVisible=ref(false)
const tableRef = ref()
@@ -71,18 +73,16 @@ const tableStore = new TableStore({
title: '计划状态',
render: 'tag',
custom: {
0: 'info',
1: 'primary',
2: 'warning',
2: 'success',
3: 'danger',
4: 'info',
4: 'warning'
},
replaceValue: {
0: '新建',
1: '审批中',
2: '审批通过',
3: '审批不通',
4: '已取消',
3: '审批不通',
4: '已取消'
}
},
@@ -92,16 +92,43 @@ const tableStore = new TableStore({
render: 'buttons',
buttons: [
{
name: 'edit',
title: '查看',
name: 'productSetting',
title: '流程详情',
type: 'primary',
icon: 'el-icon-Plus',
icon: 'el-icon-EditPen',
render: 'basicButton',
click: row => {
planAddRef.value.open('查看计划', row)
// planAddRef.value.open('查看计划', row)
handleAudit(row.processInstanceId)
}
},
{
name: 'edit',
title: '重新发起',
type: 'warning',
icon: 'el-icon-Open',
render: 'basicButton',
disabled: row => {
return row.status == 1 || row.status == 2
},
click: row => {
// deviceQuitPopup.value.open('重新发起退运', row)
planAddRef.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
},
click: row => {
cancelLeave(row)
}
}
// {
// name: 'edit',
// title: '编辑',
@@ -193,10 +220,42 @@ const exportFn = () => {
})
})
}
/**取消流程操作*/
const cancelLeave = async (row: any) => {
// 二次确认
const { value } = await ElMessageBox.prompt('请输入取消原因', '取消流程', {
confirmButtonText: '确定',
cancelButtonText: '取消',
inputPattern: /^[\s\S]*.*\S[\s\S]*$/, // 判断非空,且非空格
inputErrorMessage: '取消原因不能为空'
})
// 发起取消
let data = {
id: row.planNo,
processInstanceId: row.processInstanceId,
reason: value
}
await cancel(data)
ElMessage.success('取消成功')
// 加载数据
tableStore.index()
}
const handleClose = () => {
dialogVisible.value = false
auditUser.value = ''
}
/** 处理审批按钮 */
const handleAudit = (instanceId: any) => {
push({
name: 'BpmProcessInstanceDetail',
query: {
id: instanceId
}
})
}
// 取消
onMounted(() => {

View File

@@ -1,7 +1,153 @@
<template>
<!--工作流view的路径/pqs/supervise/harmonicSurvey/detail-->
<h1>详细信息回显</h1>
</template>
<script setup lang='ts'>
<!--工作流view的路径/pqs/supervise/retire/detail-->
<div class="default-main">
<!-- <h1>详细信息回显</h1>-->
<el-descriptions :column="2" border>
<el-descriptions-item label="普测计划名称">
{{ detailData?.planName }}
</el-descriptions-item>
<el-descriptions-item label="计划负责人">
{{ detailData?.leader }}
</el-descriptions-item>
<el-descriptions-item label="计划开始时间">
{{ detailData?.planStartTime }}
</el-descriptions-item>
<el-descriptions-item label="计划结束时间">
{{ detailData?.planEndTime }}
</el-descriptions-item>
<el-descriptions-item label="审核状态">
<el-tag :type="getDeviceStatusType(detailData?.status)">
{{ getDeviceStatus(detailData?.status) }}
</el-tag>
</el-descriptions-item>
<el-descriptions-item label="文件">
<div v-for="(item, index) in aList">
<el-icon>
<Link />
</el-icon>
<a :href="item.url">
{{ item.fileName }}
</a>
<!-- <el-button type="primary" link @click="downloadFile(item.url, item.fileName)">
{{ item.fileName }}
</el-button> -->
</div>
</el-descriptions-item>
</el-descriptions>
<div style="height: 300px">
<vxe-table
v-bind="defaultAttribute"
ref="vxeRef"
class="mt10"
height="auto"
:data="detailData?.supervisionGeneralSurveyPlanDetailPOS"
>
<vxe-column field="subName" title="变电站名称"></vxe-column>
<vxe-column field="voltageLevel" title="变电站电压等级" :formatter="formatter"></vxe-column>
<vxe-column field="measurementPointId" title="在线监测点ID">
<template #default="{ row }">{{ row.measurementPointId ? row.measurementPointId : '/' }}</template>
</vxe-column>
<vxe-column field="isSurvey" title="是否实现监测">
<template #default="{ row }">{{ row.isSurvey === 1 ? '是' : '否' }}</template>
</vxe-column>
</vxe-table>
</div>
</div>
</template>
<script setup lang="ts">
import { onMounted, ref } from 'vue'
defineOptions({ name: 'QuitRunningDeviceDetail' })
import { propTypes } from '@/utils/propTypes'
import { querySurveyDetail } from '@/api/process-boot/generalTest'
import { getFileNameAndFilePath } from '@/api/system-boot/file'
import { defaultAttribute } from '@/components/table/defaultAttribute'
import { useDictData } from '@/stores/dictData'
import { Link } from '@element-plus/icons-vue'
const { query } = useRoute() // 查询参数
const props = defineProps({
id: propTypes.string.def(undefined)
})
const dictData = useDictData()
const detailLoading = ref(false) // 表单的加载中
const detailData: any = ref({}) // 详情数据
const levelList = dictData.getBasicData('Dev_Voltage_Stand')
const aList: any = ref([]) // 详情数据
const queryId = query.id // 从 URL 传递过来的 id 编号
/** 获得数据 */
const getInfo = async () => {
detailLoading.value = true
try {
await querySurveyDetail({ id: props.id || queryId }).then(res => {
detailData.value = res.data
aList.value = []
let arr = res.data.filePath.split(',')
arr.slice(0, -1).forEach((item: any) => {
getFileNameAndFilePath({ filePath: item }).then((res: any) => {
aList.value.push(res.data)
})
})
})
} finally {
detailLoading.value = false
}
}
// 下载文件
const downloadFile = (url: string, fileName: string) => {
const link = document.createElement('a')
link.href = url
link.download = fileName
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
}
const getDeviceStatus = (status: number) => {
if (status === 1) {
return '审批中'
}
if (status === 2) {
return '审批通过'
}
if (status === 3) {
return '审批不通过'
}
if (status === 4) {
return '已取消'
}
return '审批通过'
}
const getDeviceStatusType = (status: number) => {
if (status === 1) {
return 'primary'
}
if (status === 2) {
return 'success'
}
if (status === 3) {
return 'danger'
}
if (status === 4) {
return 'warning'
}
return 'success'
}
// 过滤数据
const formatter = (row: any) => {
if (row.column.field == 'voltageLevel') {
return levelList.filter(item => item.id == row.cellValue)[0].name
} else {
return row.cellValue
}
}
defineExpose({ open: getInfo }) // 提供 open 方法,用于打开弹窗
/** 初始化 **/
onMounted(() => {
getInfo()
})
</script>

View File

@@ -1,5 +1,5 @@
<template>
<el-dialog draggable class="cn-operate-dialog" v-model="dialogVisible" :title="title">
<el-dialog draggable class="cn-operate-dialog" width="500px" v-model="dialogVisible" :title="title">
<el-scrollbar>
<el-form :inline="false" :model="form" label-width="120px" :rules="rules" ref="formRef">
<el-form-item label="新密码:" prop="newPwd" style="margin-top: 20px">
@@ -91,3 +91,4 @@ const submit = () => {
defineExpose({ open })
</script>