Merge branch 'master' of http://192.168.1.125:3000/root/pqs-9100_client
This commit is contained in:
@@ -133,6 +133,10 @@ class RequestHttp {
|
|||||||
await router.replace(LOGIN_URL)
|
await router.replace(LOGIN_URL)
|
||||||
return Promise.reject(data)
|
return Promise.reject(data)
|
||||||
}
|
}
|
||||||
|
// 对于blob类型的响应,返回完整的response对象以保留响应头
|
||||||
|
if (response.config.responseType === 'blob') {
|
||||||
|
return response
|
||||||
|
}
|
||||||
return data
|
return data
|
||||||
},
|
},
|
||||||
async (error: AxiosError) => {
|
async (error: AxiosError) => {
|
||||||
@@ -171,6 +175,10 @@ class RequestHttp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
download(url: string, params?: object, _object = {}): Promise<BlobPart> {
|
download(url: string, params?: object, _object = {}): Promise<BlobPart> {
|
||||||
|
return this.service.post(url, params, { ..._object, responseType: 'blob' }).then(res => res.data)
|
||||||
|
}
|
||||||
|
|
||||||
|
downloadWithHeaders(url: string, params?: object, _object = {}): Promise<AxiosResponse<Blob>> {
|
||||||
return this.service.post(url, params, { ..._object, responseType: 'blob' })
|
return this.service.post(url, params, { ..._object, responseType: 'blob' })
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -189,7 +197,7 @@ class RequestHttp {
|
|||||||
..._object,
|
..._object,
|
||||||
headers: { 'Content-Type': 'multipart/form-data' },
|
headers: { 'Content-Type': 'multipart/form-data' },
|
||||||
responseType: 'blob'
|
responseType: 'blob'
|
||||||
})
|
}).then(res => res.data)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 添加SSE连接方法
|
// 添加SSE连接方法
|
||||||
|
|||||||
@@ -85,6 +85,11 @@ export const downloadDevData = (params: Device.ReqDevReportParams) => {
|
|||||||
return http.download(`/report/downloadReport`, params)
|
return http.download(`/report/downloadReport`, params)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 装置检测报告下载(带响应头)
|
||||||
|
export const downloadDevDataWithHeaders = (params: Device.ReqDevReportParams) => {
|
||||||
|
return http.downloadWithHeaders(`/report/downloadReport`, params)
|
||||||
|
}
|
||||||
|
|
||||||
export const staticsAnalyse = (params: { id: string[] }) => {
|
export const staticsAnalyse = (params: { id: string[] }) => {
|
||||||
return http.download('/adPlan/analyse', params)
|
return http.download('/adPlan/analyse', params)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -106,6 +106,7 @@ const uploadExcel = async (param: UploadRequestOptions) => {
|
|||||||
isCover.value && excelFormData.append('isCover', isCover.value as unknown as Blob)
|
isCover.value && excelFormData.append('isCover', isCover.value as unknown as Blob)
|
||||||
//await parameter.value.importApi!(excelFormData);
|
//await parameter.value.importApi!(excelFormData);
|
||||||
await parameter.value.importApi!(excelFormData).then(res => handleImportResponse(res))
|
await parameter.value.importApi!(excelFormData).then(res => handleImportResponse(res))
|
||||||
|
|
||||||
parameter.value.getTableList && parameter.value.getTableList()
|
parameter.value.getTableList && parameter.value.getTableList()
|
||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
}
|
}
|
||||||
@@ -121,7 +122,10 @@ async function handleImportResponse(res: any) {
|
|||||||
if (jsonData.code === 'A0000') {
|
if (jsonData.code === 'A0000') {
|
||||||
ElMessage.success('导入成功')
|
ElMessage.success('导入成功')
|
||||||
} else {
|
} else {
|
||||||
ElMessage.error(jsonData.message)
|
ElMessageBox.alert(jsonData.message, {
|
||||||
|
title: '导入结果',
|
||||||
|
type: 'error'
|
||||||
|
})
|
||||||
}
|
}
|
||||||
emit('result', jsonData.data)
|
emit('result', jsonData.data)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { ElNotification } from "element-plus";
|
import { ElNotification } from "element-plus";
|
||||||
|
import type { AxiosResponse } from "axios";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 接收数据流生成 blob,创建链接,下载文件
|
* @description 接收数据流生成 blob,创建链接,下载文件
|
||||||
@@ -8,6 +9,55 @@ import { ElNotification } from "element-plus";
|
|||||||
* @param {Boolean} isNotify 是否有导出消息提示 (默认为 true)
|
* @param {Boolean} isNotify 是否有导出消息提示 (默认为 true)
|
||||||
* @param {String} fileType 导出的文件格式 (默认为.xlsx)
|
* @param {String} fileType 导出的文件格式 (默认为.xlsx)
|
||||||
* */
|
* */
|
||||||
|
/**
|
||||||
|
* 从 Content-Disposition 头解析文件名
|
||||||
|
*/
|
||||||
|
const getFileNameFromContentDisposition = (contentDisposition: string | undefined | null): string | null => {
|
||||||
|
if (!contentDisposition) return null;
|
||||||
|
|
||||||
|
// 优先匹配 filename*=UTF-8'' 格式(RFC 5987)
|
||||||
|
const filenameStarRegex = /filename\*\s*=\s*UTF-8''([^;]+)/i;
|
||||||
|
const starMatches = filenameStarRegex.exec(contentDisposition);
|
||||||
|
|
||||||
|
if (starMatches && starMatches[1]) {
|
||||||
|
try {
|
||||||
|
return decodeURIComponent(starMatches[1]);
|
||||||
|
} catch (e) {
|
||||||
|
console.warn('解码 filename* 失败:', e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 其次匹配 filename="文件名" 或 filename=文件名 格式
|
||||||
|
const filenameRegex = /filename\s*=\s*([^;]+)/i;
|
||||||
|
const matches = filenameRegex.exec(contentDisposition);
|
||||||
|
|
||||||
|
if (matches && matches[1]) {
|
||||||
|
let filename = matches[1].trim();
|
||||||
|
|
||||||
|
// 去除引号
|
||||||
|
filename = filename.replace(/^["']|["']$/g, "");
|
||||||
|
|
||||||
|
// 尝试解码 URL 编码的文件名
|
||||||
|
try {
|
||||||
|
// 检查是否包含 URL 编码字符
|
||||||
|
if (filename.includes('%') || filename.includes('UTF-8')) {
|
||||||
|
// 处理可能的 UTF-8 前缀
|
||||||
|
if (filename.startsWith("UTF-8''") || filename.startsWith("utf-8''")) {
|
||||||
|
filename = filename.substring(7);
|
||||||
|
}
|
||||||
|
filename = decodeURIComponent(filename);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
// 如果解码失败,返回原始文件名
|
||||||
|
console.warn('解码文件名失败,使用原始值:', e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return filename;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
|
||||||
export const useDownload = async (
|
export const useDownload = async (
|
||||||
api: (param: any) => Promise<any>,
|
api: (param: any) => Promise<any>,
|
||||||
tempName: string,
|
tempName: string,
|
||||||
@@ -42,3 +92,70 @@ export const useDownload = async (
|
|||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 支持服务器文件名的下载方法,会从 Content-Disposition 头获取文件名
|
||||||
|
* @param {Function} api 导出表格的api方法 (必传)
|
||||||
|
* @param {String} fallbackName 备用文件名,当服务器未提供时使用 (可选)
|
||||||
|
* @param {Object} params 导出的参数 (默认{})
|
||||||
|
* @param {Boolean} isNotify 是否有导出消息提示 (默认为 true)
|
||||||
|
* @param {String} fallbackFileType 备用文件格式,当服务器未提供时使用 (默认为.xlsx)
|
||||||
|
*/
|
||||||
|
export const useDownloadWithServerFileName = async (
|
||||||
|
api: (param: any) => Promise<AxiosResponse<Blob> | any>,
|
||||||
|
fallbackName: string = "",
|
||||||
|
params: any = {},
|
||||||
|
isNotify: boolean = true,
|
||||||
|
fallbackFileType: string = ".xlsx"
|
||||||
|
) => {
|
||||||
|
if (isNotify) {
|
||||||
|
ElNotification({
|
||||||
|
title: "温馨提示",
|
||||||
|
message: "如果数据庞大会导致下载缓慢哦,请您耐心等待!",
|
||||||
|
type: "info",
|
||||||
|
duration: 3000
|
||||||
|
});
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const res = await api(params);
|
||||||
|
|
||||||
|
// 检查响应是否包含 data 属性(AxiosResponse)还是直接是 Blob
|
||||||
|
const blob = res.data ? new Blob([res.data]) : new Blob([res]);
|
||||||
|
|
||||||
|
// 尝试从响应头获取文件名(如果存在)
|
||||||
|
let serverFileName: string | null = null;
|
||||||
|
if (res.headers) {
|
||||||
|
const headers = res.headers || {};
|
||||||
|
const contentDisposition = headers['content-disposition'] || headers['Content-Disposition'];
|
||||||
|
serverFileName = getFileNameFromContentDisposition(contentDisposition);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 确定最终使用的文件名
|
||||||
|
let finalFileName: string;
|
||||||
|
if (serverFileName) {
|
||||||
|
finalFileName = serverFileName;
|
||||||
|
} else if (fallbackName) {
|
||||||
|
finalFileName = `${fallbackName}${fallbackFileType}`;
|
||||||
|
} else {
|
||||||
|
finalFileName = `download${fallbackFileType}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 兼容 edge 不支持 createObjectURL 方法
|
||||||
|
if ("msSaveOrOpenBlob" in navigator) {
|
||||||
|
return window.navigator.msSaveOrOpenBlob(blob, finalFileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
const blobUrl = window.URL.createObjectURL(blob);
|
||||||
|
const exportFile = document.createElement("a");
|
||||||
|
exportFile.style.display = "none";
|
||||||
|
exportFile.download = finalFileName;
|
||||||
|
exportFile.href = blobUrl;
|
||||||
|
document.body.appendChild(exportFile);
|
||||||
|
exportFile.click();
|
||||||
|
// 去除下载对 url 的影响
|
||||||
|
document.body.removeChild(exportFile);
|
||||||
|
window.URL.revokeObjectURL(blobUrl);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('文件下载失败:', error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|||||||
@@ -6,8 +6,9 @@
|
|||||||
width="750"
|
width="750"
|
||||||
draggable
|
draggable
|
||||||
:close-on-click-modal="false"
|
:close-on-click-modal="false"
|
||||||
|
@close="handleClose"
|
||||||
>
|
>
|
||||||
<el-tabs v-model="activeName" @tab-click="handleTabClick">
|
<el-tabs v-if="dialogVisible" v-model="activeName" @tab-click="handleTabClick">
|
||||||
<el-tab-pane
|
<el-tab-pane
|
||||||
v-for="(result, index) in resultData"
|
v-for="(result, index) in resultData"
|
||||||
:key="result.monitorId"
|
:key="result.monitorId"
|
||||||
@@ -89,7 +90,7 @@
|
|||||||
</el-tabs>
|
</el-tabs>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<el-button type="primary" size="small" @click="handleChooseClick">重新选择</el-button>
|
<el-button type="primary" size="small" @click="handleChooseClick">重新选择</el-button>
|
||||||
<el-button type="primary">确认生成</el-button>
|
<el-button type="primary" @click="handleConfirmGenerate">确认生成</el-button>
|
||||||
</template>
|
</template>
|
||||||
<!-- 选择检测数据源弹框-->
|
<!-- 选择检测数据源弹框-->
|
||||||
<el-dialog
|
<el-dialog
|
||||||
@@ -157,11 +158,20 @@
|
|||||||
<script setup lang="ts" name="reportPopup">
|
<script setup lang="ts" name="reportPopup">
|
||||||
import { getMonitorDataSourceResult, getMonitorResult, updateMonitorResult } from '@/api/result/result'
|
import { getMonitorDataSourceResult, getMonitorResult, updateMonitorResult } from '@/api/result/result'
|
||||||
import { type MonitorResult } from '@/api/result/interface'
|
import { type MonitorResult } from '@/api/result/interface'
|
||||||
|
import { generateDevReport } from '@/api/plan/plan'
|
||||||
|
import { useCheckStore } from '@/stores/modules/check'
|
||||||
|
import { ElMessage } from 'element-plus'
|
||||||
|
|
||||||
const dialogVisible = ref(false)
|
const dialogVisible = ref(false)
|
||||||
const dialogSourceVisible = ref(false)
|
const dialogSourceVisible = ref(false)
|
||||||
const devData = ref<any>()
|
const devData = ref<any>()
|
||||||
const activeName = ref<number>(0)
|
const activeName = ref<number>(0)
|
||||||
|
const checkStore = useCheckStore()
|
||||||
|
|
||||||
|
// 定义 emit 事件
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'reportGenerated'): void
|
||||||
|
}>()
|
||||||
const resultData = ref<MonitorResult[]>([])
|
const resultData = ref<MonitorResult[]>([])
|
||||||
const resultSourceData = ref<any>({})
|
const resultSourceData = ref<any>({})
|
||||||
const whichTimeData = ref<any>([])
|
const whichTimeData = ref<any>([])
|
||||||
@@ -178,7 +188,9 @@ const rules = {
|
|||||||
whichTime: [{ required: true, message: '请选择次数', trigger: 'change' }],
|
whichTime: [{ required: true, message: '请选择次数', trigger: 'change' }],
|
||||||
resultType: [{ required: true, message: '请选择数据源和检测结论', trigger: 'change' }]
|
resultType: [{ required: true, message: '请选择数据源和检测结论', trigger: 'change' }]
|
||||||
}
|
}
|
||||||
|
const handleClose = () => {
|
||||||
|
activeName.value = 0
|
||||||
|
}
|
||||||
const open = (data: any) => {
|
const open = (data: any) => {
|
||||||
devData.value = data
|
devData.value = data
|
||||||
getResultData()
|
getResultData()
|
||||||
@@ -228,6 +240,26 @@ const handleSureChoose = () => {
|
|||||||
dialogSourceVisible.value = false
|
dialogSourceVisible.value = false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 处理确认生成报告
|
||||||
|
const handleConfirmGenerate = async () => {
|
||||||
|
try {
|
||||||
|
await generateDevReport({
|
||||||
|
planId: checkStore.plan.id,
|
||||||
|
devIdList: [devData.value.id],
|
||||||
|
scriptId: checkStore.plan.scriptId,
|
||||||
|
planCode: checkStore.plan.code + '',
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 999
|
||||||
|
})
|
||||||
|
ElMessage.success({ message: `报告生成成功!` })
|
||||||
|
dialogVisible.value = false
|
||||||
|
emit('reportGenerated') // 触发事件通知父组件
|
||||||
|
} catch (error) {
|
||||||
|
ElMessage.error('报告生成失败')
|
||||||
|
console.error('报告生成错误:', error)
|
||||||
|
}
|
||||||
|
}
|
||||||
defineExpose({
|
defineExpose({
|
||||||
open
|
open
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -195,7 +195,7 @@
|
|||||||
:append-to-body="true"
|
:append-to-body="true"
|
||||||
/>
|
/>
|
||||||
<!-- 报告生成弹框 -->
|
<!-- 报告生成弹框 -->
|
||||||
<ReportResultPopup ref="reportPopup"></ReportResultPopup>
|
<ReportResultPopup ref="reportPopup" @reportGenerated="handleReportGenerated"></ReportResultPopup>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -214,13 +214,13 @@ import { type Device } from '@/api/device/interface/device'
|
|||||||
import { type ColumnProps, type ProTableInstance } from '@/components/ProTable/interface'
|
import { type ColumnProps, type ProTableInstance } from '@/components/ProTable/interface'
|
||||||
import { type Plan } from '@/api/plan/interface'
|
import { type Plan } from '@/api/plan/interface'
|
||||||
import { type StandardDevice } from '@/api/device/interface/standardDevice'
|
import { type StandardDevice } from '@/api/device/interface/standardDevice'
|
||||||
import { downloadDevData, generateDevReport, getBoundPqDevList } from '@/api/plan/plan'
|
import { downloadDevData, downloadDevDataWithHeaders, generateDevReport, getBoundPqDevList } from '@/api/plan/plan'
|
||||||
import { getPqDev } from '@/api/device/device'
|
import { getPqDev } from '@/api/device/device'
|
||||||
import { useAppSceneStore, useModeStore } from '@/stores/modules/mode' // 引入模式 store
|
import { useAppSceneStore, useModeStore } from '@/stores/modules/mode' // 引入模式 store
|
||||||
import { useCheckStore } from '@/stores/modules/check'
|
import { useCheckStore } from '@/stores/modules/check'
|
||||||
import { CheckData } from '@/api/check/interface'
|
import { CheckData } from '@/api/check/interface'
|
||||||
import { useAuthStore } from '@/stores/modules/auth'
|
import { useAuthStore } from '@/stores/modules/auth'
|
||||||
import { useDownload } from '@/hooks/useDownload'
|
import { useDownload, useDownloadWithServerFileName } from '@/hooks/useDownload'
|
||||||
import { documentedPqDev } from '@/api/device/report'
|
import { documentedPqDev } from '@/api/device/report'
|
||||||
import { ResultEnum } from '@/enums/httpEnum'
|
import { ResultEnum } from '@/enums/httpEnum'
|
||||||
import { getPqMonList } from '@/api/device/monitor/index.ts'
|
import { getPqMonList } from '@/api/device/monitor/index.ts'
|
||||||
@@ -1029,6 +1029,7 @@ const openDrawer = async (title: string, row: any) => {
|
|||||||
// 单个设备报告生成
|
// 单个设备报告生成
|
||||||
if (title === '报告生成') {
|
if (title === '报告生成') {
|
||||||
if (modeStore.currentMode == '比对式'){
|
if (modeStore.currentMode == '比对式'){
|
||||||
|
console.log(row)
|
||||||
reportPopup.value?.open(row)
|
reportPopup.value?.open(row)
|
||||||
}else{
|
}else{
|
||||||
await generateDevReport({
|
await generateDevReport({
|
||||||
@@ -1045,9 +1046,9 @@ const openDrawer = async (title: string, row: any) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (title === '报告下载') {
|
if (title === '报告下载') {
|
||||||
await useDownload(
|
await useDownloadWithServerFileName(
|
||||||
downloadDevData,
|
downloadDevDataWithHeaders,
|
||||||
row.createId,
|
row.createId, // 备用文件名
|
||||||
{
|
{
|
||||||
planId: checkStore.plan.id,
|
planId: checkStore.plan.id,
|
||||||
devId: row.id
|
devId: row.id
|
||||||
@@ -1117,6 +1118,11 @@ const handleQuitClicked = () => {
|
|||||||
emit('batchGenerateClicked') // 触发事件
|
emit('batchGenerateClicked') // 触发事件
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 处理报告生成完成事件
|
||||||
|
const handleReportGenerated = () => {
|
||||||
|
emit('batchGenerateClicked') // 触发事件通知父组件刷新数据
|
||||||
|
}
|
||||||
|
|
||||||
defineExpose({ changeActiveTabs })
|
defineExpose({ changeActiveTabs })
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
@@ -2,22 +2,28 @@
|
|||||||
<!-- 基础信息弹出框 -->
|
<!-- 基础信息弹出框 -->
|
||||||
<el-dialog :model-value="dialogVisible" :title="dialogTitle" v-bind="dialogMiddle" @close="close" align-center>
|
<el-dialog :model-value="dialogVisible" :title="dialogTitle" v-bind="dialogMiddle" @close="close" align-center>
|
||||||
<div>
|
<div>
|
||||||
<el-form :model="formContent" ref='dialogFormRef' :rules='rules' class="form-two">
|
<el-form :model="formContent" ref="dialogFormRef" :rules="rules" class="form-two">
|
||||||
<el-form-item label="名称" prop="name" >
|
<el-form-item label="名称" prop="name">
|
||||||
<el-input v-model='formContent.name' placeholder="请输入监测点名称"/>
|
<el-input v-model="formContent.name" placeholder="请输入监测点名称" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="线路号" prop="num" >
|
<el-form-item label="线路号" prop="num">
|
||||||
<el-select v-model="formContent.num" clearable placeholder="请选择线路号" @change="handleMonNumChange">
|
<el-select
|
||||||
<el-option
|
v-model="formContent.num"
|
||||||
v-for="item in lineNum"
|
clearable
|
||||||
:key="item.id"
|
placeholder="请选择线路号"
|
||||||
:label="item.name"
|
@change="handleMonNumChange"
|
||||||
:value="item.id"
|
>
|
||||||
/>
|
<el-option v-for="item in lineNum" :key="item.id" :label="item.name" :value="item.id" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="所属母线" prop="busbar">
|
<el-form-item label="所属母线" prop="busbar">
|
||||||
<el-select v-model="formContent.busbar" clearable placeholder="请选择所属母线" filterable allow-create>
|
<el-select
|
||||||
|
v-model="formContent.busbar"
|
||||||
|
clearable
|
||||||
|
placeholder="请选择所属母线"
|
||||||
|
filterable
|
||||||
|
allow-create
|
||||||
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in selectOptions['busbar']"
|
v-for="item in selectOptions['busbar']"
|
||||||
:key="item.value"
|
:key="item.value"
|
||||||
@@ -46,7 +52,7 @@
|
|||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label='接线方式' prop='connection' >
|
<el-form-item label="接线方式" prop="connection">
|
||||||
<el-select v-model="formContent.connection" clearable placeholder="请选择接线方式">
|
<el-select v-model="formContent.connection" clearable placeholder="请选择接线方式">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in dictStore.getDictData('Dev_Connect')"
|
v-for="item in dictStore.getDictData('Dev_Connect')"
|
||||||
@@ -56,8 +62,8 @@
|
|||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label='统计间隔' prop='statInterval' >
|
<el-form-item label="统计间隔" prop="statInterval">
|
||||||
<el-select v-model="formContent.statInterval" clearable placeholder="请选择统计间隔" >
|
<el-select v-model="formContent.statInterval" clearable placeholder="请选择统计间隔">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in dictStore.getDictData('Dev_Chns')"
|
v-for="item in dictStore.getDictData('Dev_Chns')"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
@@ -66,10 +72,10 @@
|
|||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="谐波系统检测点id" prop="harmSysId" placeholder="请输入谐波系统检测点id" >
|
<el-form-item label="谐波系统检测点id" prop="harmSysId" placeholder="请输入谐波系统检测点id">
|
||||||
<el-input v-model="formContent.harmSysId" />
|
<el-input v-model="formContent.harmSysId" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="是否参与检测" prop="checkFlag" placeholder="请输入CT编号" >
|
<el-form-item label="是否参与检测" prop="checkFlag" placeholder="请输入CT编号">
|
||||||
<el-select v-model="formContent.checkFlag" clearable placeholder="请选择是否加密">
|
<el-select v-model="formContent.checkFlag" clearable placeholder="请选择是否加密">
|
||||||
<el-option label="是" :value="1"></el-option>
|
<el-option label="是" :value="1"></el-option>
|
||||||
<el-option label="否" :value="0"></el-option>
|
<el-option label="否" :value="0"></el-option>
|
||||||
@@ -80,33 +86,29 @@
|
|||||||
<template #footer>
|
<template #footer>
|
||||||
<div class="dialog-footer">
|
<div class="dialog-footer">
|
||||||
<el-button @click="close()">取消</el-button>
|
<el-button @click="close()">取消</el-button>
|
||||||
<el-button type="primary" @click="save()" >
|
<el-button type="primary" @click="save()">保存</el-button>
|
||||||
保存
|
|
||||||
</el-button>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
</template>
|
<script lang="ts" setup>
|
||||||
|
import { ElMessage, type FormItemRule } from 'element-plus'
|
||||||
|
import { computed, ref, Ref } from 'vue'
|
||||||
|
import { type Monitor } from '@/api/device/interface/monitor'
|
||||||
|
import { dialogMiddle } from '@/utils/elementBind'
|
||||||
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
|
import { generateUUID } from '@/utils'
|
||||||
|
import { Device } from '@/api/device/interface/device'
|
||||||
|
|
||||||
<script lang="ts" setup>
|
const dictStore = useDictStore()
|
||||||
import{ ElMessage, type FormInstance,type FormItemRule } from 'element-plus'
|
const lineNum = ref<{ id: number; name: string }[]>([])
|
||||||
import type { ProTableInstance } from '@/components/ProTable/interface'
|
const originalNum = ref<number | null>(null) // 存储编辑前的 num 值
|
||||||
import { ref,computed, Ref, toRaw } from 'vue'
|
const monitorTable = ref<any[]>()
|
||||||
import { type Monitor } from '@/api/device/interface/monitor'
|
const selectOptions = ref<Record<string, Device.SelectOption[]>>({})
|
||||||
import {dialogMiddle} from '@/utils/elementBind'
|
// 定义弹出组件元信息
|
||||||
import { useDictStore } from '@/stores/modules/dict'
|
const dialogFormRef = ref()
|
||||||
import { generateUUID } from '@/utils'
|
function useMetaInfo() {
|
||||||
import { Device } from '@/api/device/interface/device'
|
|
||||||
|
|
||||||
const dictStore = useDictStore()
|
|
||||||
const lineNum = ref<{ id: number; name: string }[]>([])
|
|
||||||
const originalNum = ref<number | null>(null) // 存储编辑前的 num 值
|
|
||||||
const monitorTable = ref<any[]>()
|
|
||||||
const selectOptions = ref<Record<string, Device.SelectOption[]>>({})
|
|
||||||
// 定义弹出组件元信息
|
|
||||||
const dialogFormRef = ref()
|
|
||||||
function useMetaInfo() {
|
|
||||||
const dialogVisible = ref(false)
|
const dialogVisible = ref(false)
|
||||||
const titleType = ref('add')
|
const titleType = ref('add')
|
||||||
const formContent = ref<Monitor.ResPqMon>({
|
const formContent = ref<Monitor.ResPqMon>({
|
||||||
@@ -120,15 +122,14 @@
|
|||||||
connection: '',
|
connection: '',
|
||||||
statInterval: 1,
|
statInterval: 1,
|
||||||
harmSysId: '',
|
harmSysId: '',
|
||||||
checkFlag:1
|
checkFlag: 1
|
||||||
})
|
})
|
||||||
return { dialogVisible, titleType, formContent }
|
return { dialogVisible, titleType, formContent }
|
||||||
}
|
}
|
||||||
|
|
||||||
const { dialogVisible, titleType, formContent } = useMetaInfo()
|
const { dialogVisible, titleType, formContent } = useMetaInfo()
|
||||||
|
|
||||||
|
const emit = defineEmits(['get-parameter'])
|
||||||
const emit = defineEmits(['get-parameter'])
|
|
||||||
// 清空formContent
|
// 清空formContent
|
||||||
const resetFormContent = () => {
|
const resetFormContent = () => {
|
||||||
formContent.value = {
|
formContent.value = {
|
||||||
@@ -142,24 +143,23 @@ const resetFormContent = () => {
|
|||||||
connection: '',
|
connection: '',
|
||||||
statInterval: 1,
|
statInterval: 1,
|
||||||
harmSysId: '',
|
harmSysId: '',
|
||||||
checkFlag:1
|
checkFlag: 1
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let dialogTitle = computed(() => {
|
let dialogTitle = computed(() => {
|
||||||
return titleType.value === 'add' ? '新增监测点台账' : '编辑监测点台账'
|
return titleType.value === 'add' ? '新增监测点台账' : '编辑监测点台账'
|
||||||
})
|
})
|
||||||
|
|
||||||
// 关闭弹窗
|
// 关闭弹窗
|
||||||
const close = () => {
|
const close = () => {
|
||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//定义校验规则
|
||||||
//定义校验规则
|
const rules: Ref<Record<string, Array<FormItemRule>>> = ref({
|
||||||
const rules: Ref<Record<string, Array<FormItemRule>>> = ref({
|
name: [{ required: true, message: '监测点名称必填!', trigger: 'blur' }],
|
||||||
name : [{ required: true, message: '监测点名称必填!', trigger: 'blur' }],
|
num: [{ required: true, message: '线路号必选', trigger: 'change' }],
|
||||||
num:[ { required: true, message: '线路号必选', trigger: 'change' }],
|
|
||||||
pt: [
|
pt: [
|
||||||
{ required: true, message: 'PT变比必选!', trigger: 'blur' },
|
{ required: true, message: 'PT变比必选!', trigger: 'blur' },
|
||||||
{ pattern: /^[1-9]\d*:[1-9]\d*$/, message: 'PT变比格式应为 n:n 形式,例如 1:1', trigger: 'change' }
|
{ pattern: /^[1-9]\d*:[1-9]\d*$/, message: 'PT变比格式应为 n:n 形式,例如 1:1', trigger: 'change' }
|
||||||
@@ -169,14 +169,13 @@ const resetFormContent = () => {
|
|||||||
{ pattern: /^[1-9]\d*:[1-9]\d*$/, message: 'CT变比格式应为 n:n 形式,例如 1:1', trigger: 'change' }
|
{ pattern: /^[1-9]\d*:[1-9]\d*$/, message: 'CT变比格式应为 n:n 形式,例如 1:1', trigger: 'change' }
|
||||||
],
|
],
|
||||||
connection: [{ required: true, message: '接线方式必选!', trigger: 'change' }],
|
connection: [{ required: true, message: '接线方式必选!', trigger: 'change' }],
|
||||||
busbar : [{ required: true, message: '所属母线必选!', trigger: 'change' }],
|
busbar: [{ required: true, message: '所属母线必选!', trigger: 'change' }],
|
||||||
harmSysId : [{ required: true, message: '谐波系统检测点id必填!', trigger: 'blur' }],
|
// harmSysId : [{ required: true, message: '谐波系统检测点id必填!', trigger: 'blur' }],
|
||||||
checkFlag : [{ required: true, message: '是否参与检测必选!', trigger: 'change' }]
|
checkFlag: [{ required: true, message: '是否参与检测必选!', trigger: 'change' }]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 保存数据
|
||||||
// 保存数据
|
const save = () => {
|
||||||
const save = () => {
|
|
||||||
try {
|
try {
|
||||||
dialogFormRef.value?.validate(async (valid: boolean) => {
|
dialogFormRef.value?.validate(async (valid: boolean) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
@@ -189,9 +188,8 @@ const resetFormContent = () => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (titleType.value != 'edit')
|
if (titleType.value != 'edit') {
|
||||||
{
|
formContent.value.id = generateUUID().replaceAll('-', '')
|
||||||
formContent.value.id = generateUUID().replaceAll("-","")
|
|
||||||
}
|
}
|
||||||
emit('get-parameter', formContent.value)
|
emit('get-parameter', formContent.value)
|
||||||
//ElMessage.success({ message: `${dialogTitle.value}成功!` })
|
//ElMessage.success({ message: `${dialogTitle.value}成功!` })
|
||||||
@@ -201,18 +199,16 @@ const resetFormContent = () => {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('验证过程中出现错误', err)
|
console.error('验证过程中出现错误', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 打开弹窗,可能是新增,也可能是编辑
|
||||||
|
const open = async (sign: string, data: Monitor.ResPqMon, device: Device.ResPqDev, table: any[], options: any) => {
|
||||||
// 打开弹窗,可能是新增,也可能是编辑
|
|
||||||
const open = async (sign: string, data: Monitor.ResPqMon,device: Device.ResPqDev,table: any[],options: any) => {
|
|
||||||
// 重置表单
|
// 重置表单
|
||||||
//dialogFormRef.value?.resetFields()
|
//dialogFormRef.value?.resetFields()
|
||||||
selectOptions.value = options
|
selectOptions.value = options
|
||||||
titleType.value = sign
|
titleType.value = sign
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
monitorTable.value = table|| []
|
monitorTable.value = table || []
|
||||||
// 提取 table 中已使用的 num(安全处理)
|
// 提取 table 中已使用的 num(安全处理)
|
||||||
const usedNums = new Set<number>()
|
const usedNums = new Set<number>()
|
||||||
if (table && table.length > 0) {
|
if (table && table.length > 0) {
|
||||||
@@ -224,13 +220,12 @@ const resetFormContent = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
lineNum.value = Array.from({ length: device.devChns }, (_, i) => {
|
lineNum.value = Array.from({ length: device.devChns }, (_, i) => {
|
||||||
const id = i + 1;
|
const id = i + 1
|
||||||
return {
|
return {
|
||||||
id,
|
id,
|
||||||
name: id.toString()
|
name: id.toString()
|
||||||
};
|
}
|
||||||
}).filter(item => !usedNums.has(item.id)); // 过滤掉已被使用的线路号
|
}).filter(item => !usedNums.has(item.id)) // 过滤掉已被使用的线路号
|
||||||
|
|
||||||
|
|
||||||
if (sign == 'edit') {
|
if (sign == 'edit') {
|
||||||
formContent.value = { ...data }
|
formContent.value = { ...data }
|
||||||
@@ -244,11 +239,9 @@ const resetFormContent = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
formContent.value.devId = device.id
|
formContent.value.devId = device.id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleMonNumChange = (value: string) => {
|
||||||
|
|
||||||
const handleMonNumChange = (value: string) => {
|
|
||||||
const newValue = parseInt(value)
|
const newValue = parseInt(value)
|
||||||
if (originalNum.value && originalNum.value !== newValue) {
|
if (originalNum.value && originalNum.value !== newValue) {
|
||||||
// 将原来的 num 添加回 lineNum(表示释放)
|
// 将原来的 num 添加回 lineNum(表示释放)
|
||||||
@@ -262,13 +255,10 @@ const resetFormContent = () => {
|
|||||||
// 更新 originalNum 为最新值,以便下次修改
|
// 更新 originalNum 为最新值,以便下次修改
|
||||||
originalNum.value = newValue
|
originalNum.value = newValue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 对外映射
|
// 对外映射
|
||||||
defineExpose({ open })
|
defineExpose({ open })
|
||||||
|
</script>
|
||||||
|
|
||||||
</script>
|
<style scoped></style>
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
|
|
||||||
</style>
|
|
||||||
|
|||||||
@@ -7,11 +7,12 @@
|
|||||||
:title="title"
|
:title="title"
|
||||||
:width="width"
|
:width="width"
|
||||||
class="table-box"
|
class="table-box"
|
||||||
top="114px"
|
top="111px"
|
||||||
@close="handleClose"
|
@close="handleClose"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
:style="{ height: height - 64 + 'px', maxHeight: height - 64 + 'px', overflow: 'hidden' }"
|
v-if="dialogVisible"
|
||||||
|
:style="{ height: height - 70 + 'px', maxHeight: height - 70 + 'px', overflow: 'hidden' }"
|
||||||
class="table-box"
|
class="table-box"
|
||||||
>
|
>
|
||||||
<el-tabs v-model="editableTabsValue" type="card" @tab-remove="removeTab" @tab-click="handleTabClick">
|
<el-tabs v-model="editableTabsValue" type="card" @tab-remove="removeTab" @tab-click="handleTabClick">
|
||||||
@@ -23,16 +24,17 @@
|
|||||||
:name="item.name"
|
:name="item.name"
|
||||||
></el-tab-pane>
|
></el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
<ProTable :key="planId" ref="proTable" :columns="columns" :request-api="getTableList" type="selection">
|
<ProTable
|
||||||
|
class="children-plan-table"
|
||||||
|
:key="planId"
|
||||||
|
ref="proTable"
|
||||||
|
:columns="columns"
|
||||||
|
:request-api="getTableList"
|
||||||
|
type="selection"
|
||||||
|
>
|
||||||
<!-- 表格 header 按钮 -->
|
<!-- 表格 header 按钮 -->
|
||||||
<template #tableHeader="scope">
|
<template #tableHeader="scope">
|
||||||
<el-button
|
<el-button v-if="!isTabPlanFather" icon="CirclePlus" type="primary" @click="addTab('add')">
|
||||||
v-if="!isTabPlanFather"
|
|
||||||
v-auth.plan="'add_subplan'"
|
|
||||||
icon="CirclePlus"
|
|
||||||
type="primary"
|
|
||||||
@click="addTab('add')"
|
|
||||||
>
|
|
||||||
新增子计划
|
新增子计划
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
@@ -46,7 +48,6 @@
|
|||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
v-if="isTabPlanFather && planFormContent?.testState === 0"
|
v-if="isTabPlanFather && planFormContent?.testState === 0"
|
||||||
v-auth.plan="'export_subplan'"
|
|
||||||
icon="Download"
|
icon="Download"
|
||||||
type="primary"
|
type="primary"
|
||||||
@click="exportPlan"
|
@click="exportPlan"
|
||||||
@@ -54,7 +55,6 @@
|
|||||||
导出子计划元信息
|
导出子计划元信息
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
v-auth.plan="'import_subplan'"
|
|
||||||
:disabled="!scope.isSelected"
|
:disabled="!scope.isSelected"
|
||||||
v-if="planFormContent?.importFlag === 1"
|
v-if="planFormContent?.importFlag === 1"
|
||||||
icon="Download"
|
icon="Download"
|
||||||
@@ -70,7 +70,6 @@
|
|||||||
planFormContent.children &&
|
planFormContent.children &&
|
||||||
planFormContent?.children?.length > 0
|
planFormContent?.children?.length > 0
|
||||||
"
|
"
|
||||||
v-auth.plan="'add_subplan'"
|
|
||||||
icon="Box"
|
icon="Box"
|
||||||
type="primary"
|
type="primary"
|
||||||
@click="importAndMergePlanCheckDataClick"
|
@click="importAndMergePlanCheckDataClick"
|
||||||
@@ -89,7 +88,6 @@
|
|||||||
</el-button>
|
</el-button>
|
||||||
<el-dropdown
|
<el-dropdown
|
||||||
v-if="planFormContent && planFormContent.children && planFormContent.children?.length > 0"
|
v-if="planFormContent && planFormContent.children && planFormContent.children?.length > 0"
|
||||||
v-auth.plan="'add_subplan'"
|
|
||||||
:disabled="!scope.isSelected"
|
:disabled="!scope.isSelected"
|
||||||
placement="right-start"
|
placement="right-start"
|
||||||
trigger="hover"
|
trigger="hover"
|
||||||
@@ -117,7 +115,6 @@
|
|||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
<el-dropdown
|
<el-dropdown
|
||||||
v-if="planFormContent && planFormContent.children && planFormContent.children?.length > 0"
|
v-if="planFormContent && planFormContent.children && planFormContent.children?.length > 0"
|
||||||
v-auth.plan="'add_subplan'"
|
|
||||||
placement="right-start"
|
placement="right-start"
|
||||||
trigger="hover"
|
trigger="hover"
|
||||||
>
|
>
|
||||||
@@ -179,6 +176,7 @@
|
|||||||
draggable
|
draggable
|
||||||
:show-close="false"
|
:show-close="false"
|
||||||
:close-on-click-modal="false"
|
:close-on-click-modal="false"
|
||||||
|
destroy-on-close
|
||||||
>
|
>
|
||||||
<el-row style="margin-top: 10px">
|
<el-row style="margin-top: 10px">
|
||||||
<el-text v-if="progressData.status === ''" type="info">
|
<el-text v-if="progressData.status === ''" type="info">
|
||||||
@@ -269,12 +267,30 @@ const getTableList = async (params: any) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
||||||
{ type: 'selection', fixed: 'left', width: 70, selectable: row => row.checkState == 0 },
|
{ type: 'selection', fixed: 'left', width: 70, selectable: row => row.checkState == 0 || row.importFlag == 1 },
|
||||||
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
||||||
|
{
|
||||||
|
prop: 'keywords',
|
||||||
|
label: '关键词',
|
||||||
|
search: {
|
||||||
|
el: 'input',
|
||||||
|
label: '搜索',
|
||||||
|
order: 1,
|
||||||
|
render: (scope: SearchRenderScope) => {
|
||||||
|
return (
|
||||||
|
<el-input
|
||||||
|
v-model={scope.searchParam.keywords}
|
||||||
|
placeholder="设备名称、地市、供电公司、变电站"
|
||||||
|
clearable
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
isShow: false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
prop: 'name',
|
prop: 'name',
|
||||||
label: '名称',
|
label: '名称',
|
||||||
search: { el: 'input' },
|
|
||||||
minWidth: 180
|
minWidth: 180
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -306,28 +322,26 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
|||||||
prop: 'manufacturer',
|
prop: 'manufacturer',
|
||||||
label: '设备厂家',
|
label: '设备厂家',
|
||||||
enum: dictStore.getDictData('Dev_Manufacturers'),
|
enum: dictStore.getDictData('Dev_Manufacturers'),
|
||||||
search: { el: 'select', props: { filterable: true }, order: 1 },
|
search: { el: 'select', props: { filterable: true, style: { width: 150 } }, order: 2 },
|
||||||
fieldNames: { label: 'name', value: 'id' },
|
fieldNames: { label: 'name', value: 'id' },
|
||||||
minWidth: 200
|
minWidth: 200
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
prop: 'assignSub',
|
||||||
|
label: '是否分配',
|
||||||
|
enum: [
|
||||||
|
{ id: 0, name: '未分配' },
|
||||||
|
{ id: 1, name: '已分配' }
|
||||||
|
],
|
||||||
|
search: { el: 'select', props: { filterable: true }, order: 3 },
|
||||||
|
fieldNames: { label: 'name', value: 'id' },
|
||||||
|
isShow: false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
prop: 'cityName',
|
prop: 'cityName',
|
||||||
label: '地市',
|
label: '地市',
|
||||||
minWidth: 150
|
minWidth: 150
|
||||||
},
|
},
|
||||||
{
|
|
||||||
prop: 'region',
|
|
||||||
label: '地市',
|
|
||||||
minWidth: 150,
|
|
||||||
isShow: false,
|
|
||||||
search: {
|
|
||||||
el: 'input',
|
|
||||||
label: '关键词',
|
|
||||||
render: (scope: SearchRenderScope) => {
|
|
||||||
return <el-input v-model={scope.searchParam.region} placeholder="请输入关键词" clearable />
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
prop: 'gdName',
|
prop: 'gdName',
|
||||||
label: '供电公司',
|
label: '供电公司',
|
||||||
@@ -342,9 +356,7 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
|||||||
prop: 'boundPlanName',
|
prop: 'boundPlanName',
|
||||||
label: '子计划',
|
label: '子计划',
|
||||||
minWidth: 150,
|
minWidth: 150,
|
||||||
isShow: planFormContent.value?.importFlag === 0,
|
|
||||||
render: scope => {
|
render: scope => {
|
||||||
console.log('boundPlanName', isTabPlanFather.value)
|
|
||||||
const value = scope.row.boundPlanName
|
const value = scope.row.boundPlanName
|
||||||
if (!value) {
|
if (!value) {
|
||||||
return '/' // 空值直接返回空字符串
|
return '/' // 空值直接返回空字符串
|
||||||
@@ -359,7 +371,8 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
|||||||
{
|
{
|
||||||
prop: 'checkState',
|
prop: 'checkState',
|
||||||
label: '检测状态',
|
label: '检测状态',
|
||||||
minWidth: 150,
|
minWidth: 120,
|
||||||
|
fixed: 'right',
|
||||||
render: (scope: { row: { checkState: number } }) => {
|
render: (scope: { row: { checkState: number } }) => {
|
||||||
return scope.row.checkState === 0 ? (
|
return scope.row.checkState === 0 ? (
|
||||||
<el-tag type="warning" effect="dark">
|
<el-tag type="warning" effect="dark">
|
||||||
@@ -516,10 +529,9 @@ const removeTab = async (targetName: TabPaneName) => {
|
|||||||
editableTabsValue.value = mainTab.name
|
editableTabsValue.value = mainTab.name
|
||||||
editableTabs.value = tabs.filter(tab => tab.name !== targetName)
|
editableTabs.value = tabs.filter(tab => tab.name !== targetName)
|
||||||
await props.refreshTable!() //刷新检测计划列表
|
await props.refreshTable!() //刷新检测计划列表
|
||||||
|
planFormContent.value = props.currentPlan
|
||||||
handleTabClick({ props: mainTab })
|
handleTabClick({ props: mainTab })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 弹窗打开方法
|
// 弹窗打开方法
|
||||||
const open = async (textTitle: string, data: Plan.ReqPlan, pattern: string) => {
|
const open = async (textTitle: string, data: Plan.ReqPlan, pattern: string) => {
|
||||||
console.log('open', data)
|
console.log('open', data)
|
||||||
@@ -800,6 +812,7 @@ defineExpose({ open, handleTableDataUpdate })
|
|||||||
|
|
||||||
interface ChildrenPlanProps {
|
interface ChildrenPlanProps {
|
||||||
refreshTable?: () => Promise<void>
|
refreshTable?: () => Promise<void>
|
||||||
|
currentPlan?: any
|
||||||
width?: number
|
width?: number
|
||||||
height?: number
|
height?: number
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -154,7 +154,7 @@
|
|||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label-width="110" label="守时检测" prop="timeCheck">
|
<!-- <el-form-item :label-width="110" label="守时检测" prop="timeCheck">
|
||||||
<el-radio-group
|
<el-radio-group
|
||||||
v-model="formContent.timeCheck"
|
v-model="formContent.timeCheck"
|
||||||
:disabled="planType != 0 || allDisabled || !canEdited"
|
:disabled="planType != 0 || allDisabled || !canEdited"
|
||||||
@@ -162,7 +162,7 @@
|
|||||||
<el-radio :value="1">是</el-radio>
|
<el-radio :value="1">是</el-radio>
|
||||||
<el-radio :value="0">否</el-radio>
|
<el-radio :value="0">否</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>-->
|
||||||
<!-- <el-form-item label="关联报告模版" :label-width="100" prop='associateReport'>
|
<!-- <el-form-item label="关联报告模版" :label-width="100" prop='associateReport'>
|
||||||
<el-radio-group v-model="formContent.associateReport">
|
<el-radio-group v-model="formContent.associateReport">
|
||||||
<el-radio :value="1">是</el-radio>
|
<el-radio :value="1">是</el-radio>
|
||||||
@@ -235,7 +235,7 @@
|
|||||||
:titles="['被检设备列表', '已选被检设备列表']"
|
:titles="['被检设备列表', '已选被检设备列表']"
|
||||||
filter-placeholder="请输入内容搜索"
|
filter-placeholder="请输入内容搜索"
|
||||||
:data="devData"
|
:data="devData"
|
||||||
:height="selectByMode ? 325 : 220"
|
:height="selectByMode ? 272 : 220"
|
||||||
:disabled="allDisabled"
|
:disabled="allDisabled"
|
||||||
:expand-all="planType != 0"
|
:expand-all="planType != 0"
|
||||||
>
|
>
|
||||||
@@ -504,7 +504,7 @@ function useMetaInfo() {
|
|||||||
sourceName: '',
|
sourceName: '',
|
||||||
devIds: [],
|
devIds: [],
|
||||||
sourceIds: '',
|
sourceIds: '',
|
||||||
datasourceIds: '',
|
datasourceIds: [],
|
||||||
associateReport: 0,
|
associateReport: 0,
|
||||||
reportTemplateName: '',
|
reportTemplateName: '',
|
||||||
reportTemplateVersion: '',
|
reportTemplateVersion: '',
|
||||||
@@ -823,7 +823,7 @@ const open = async (sign: string, data: Plan.ReqPlan, currentMode: string, plan:
|
|||||||
formContent.errorSysId = pqErrSysList.value[0]?.id ?? ''
|
formContent.errorSysId = pqErrSysList.value[0]?.id ?? ''
|
||||||
formContent.sourceIds = pqSourceList.value[0]?.id ?? ''
|
formContent.sourceIds = pqSourceList.value[0]?.id ?? ''
|
||||||
const datasourceDicts = dictStore.getDictData('Datasource')
|
const datasourceDicts = dictStore.getDictData('Datasource')
|
||||||
formContent.datasourceIds = datasourceDicts[0]?.code ?? ''
|
formContent.datasourceIds = [datasourceDicts[0]?.code] ?? []
|
||||||
} else {
|
} else {
|
||||||
//编辑时先给表单赋值(这会没接收被检设备),需要手动再给被检设备复制后整体表单赋值
|
//编辑时先给表单赋值(这会没接收被检设备),需要手动再给被检设备复制后整体表单赋值
|
||||||
|
|
||||||
@@ -934,7 +934,6 @@ const open = async (sign: string, data: Plan.ReqPlan, currentMode: string, plan:
|
|||||||
const boundData = Array.isArray(boundPqDevList_Result.data) ? boundPqDevList_Result.data : []
|
const boundData = Array.isArray(boundPqDevList_Result.data) ? boundPqDevList_Result.data : []
|
||||||
const unboundData = Array.isArray(unboundPqDevList_Result.data) ? unboundPqDevList_Result.data : []
|
const unboundData = Array.isArray(unboundPqDevList_Result.data) ? unboundPqDevList_Result.data : []
|
||||||
pqDevList.value = [...boundData, ...unboundData] as Device.ResPqDev[]
|
pqDevList.value = [...boundData, ...unboundData] as Device.ResPqDev[]
|
||||||
formContent.devIds = boundData.map((i: any) => i.id) // 已绑定设备id集合
|
|
||||||
|
|
||||||
Object.assign(formContent, { ...data })
|
Object.assign(formContent, { ...data })
|
||||||
//设备绑定显示
|
//设备绑定显示
|
||||||
@@ -967,6 +966,7 @@ const open = async (sign: string, data: Plan.ReqPlan, currentMode: string, plan:
|
|||||||
const fatherMemberData = Array.isArray(fatherMemberData_Result.data) ? fatherMemberData_Result.data : []
|
const fatherMemberData = Array.isArray(fatherMemberData_Result.data) ? fatherMemberData_Result.data : []
|
||||||
memberData.value = fatherMemberData.map((user: any) => ({ ...user, disabled: false }))
|
memberData.value = fatherMemberData.map((user: any) => ({ ...user, disabled: false }))
|
||||||
}
|
}
|
||||||
|
formContent.devIds = boundData.map((i: any) => i.id) // 已绑定设备id集合
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -990,9 +990,9 @@ const open = async (sign: string, data: Plan.ReqPlan, currentMode: string, plan:
|
|||||||
formContent.sourceIds = formContent.sourceIds.join(',')
|
formContent.sourceIds = formContent.sourceIds.join(',')
|
||||||
}
|
}
|
||||||
// 将 formContent.sourceIds 从数组转换为字符串
|
// 将 formContent.sourceIds 从数组转换为字符串
|
||||||
if (Array.isArray(formContent.datasourceIds)) {
|
/*if (Array.isArray(formContent.datasourceIds)) {
|
||||||
formContent.datasourceIds = formContent.datasourceIds.join(',')
|
formContent.datasourceIds = formContent.datasourceIds.join(',')
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AppSceneStore.currentScene == '1') {
|
if (AppSceneStore.currentScene == '1') {
|
||||||
@@ -1170,13 +1170,13 @@ const handleDataSourceChange = () => {
|
|||||||
|
|
||||||
if (hasThreeSeconds && hasMinuteStats) {
|
if (hasThreeSeconds && hasMinuteStats) {
|
||||||
ElMessage.warning('3s实时数据与分钟统计数据不能同时选择')
|
ElMessage.warning('3s实时数据与分钟统计数据不能同时选择')
|
||||||
formContent.datasourceIds = ''
|
formContent.datasourceIds = []
|
||||||
}
|
}
|
||||||
// 判断是否选择了多个“分钟统计数据”项
|
// 判断是否选择了多个“分钟统计数据”项
|
||||||
const minuteStatLabels = selectedLabels.filter(label => label.includes('分钟'))
|
const minuteStatLabels = selectedLabels.filter(label => label.includes('分钟'))
|
||||||
if (minuteStatLabels.length > 1) {
|
if (minuteStatLabels.length > 1) {
|
||||||
ElMessage.warning('分钟统计数据不能多选')
|
ElMessage.warning('分钟统计数据不能多选')
|
||||||
formContent.datasourceIds = ''
|
formContent.datasourceIds = []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,6 @@
|
|||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
v-auth.plan="'import_subplan'"
|
|
||||||
icon="Upload"
|
icon="Upload"
|
||||||
@click="importSubClick"
|
@click="importSubClick"
|
||||||
v-if="modeStore.currentMode === '比对式'"
|
v-if="modeStore.currentMode === '比对式'"
|
||||||
@@ -140,6 +139,7 @@
|
|||||||
|
|
||||||
<ChildrenPlan
|
<ChildrenPlan
|
||||||
:refresh-table="refreshTable"
|
:refresh-table="refreshTable"
|
||||||
|
:current-plan="selectedPlan"
|
||||||
ref="childrenPlanView"
|
ref="childrenPlanView"
|
||||||
:width="viewWidth"
|
:width="viewWidth"
|
||||||
:height="viewHeight"
|
:height="viewHeight"
|
||||||
@@ -158,7 +158,7 @@ import {
|
|||||||
importPlan,
|
importPlan,
|
||||||
importSubPlan,
|
importSubPlan,
|
||||||
staticsAnalyse
|
staticsAnalyse
|
||||||
} from '@/api/plan/plan.ts'
|
} from '@/api/plan/plan'
|
||||||
import { computed, onMounted, reactive, ref, watch } from 'vue'
|
import { computed, onMounted, reactive, ref, watch } from 'vue'
|
||||||
import type { Plan } from '@/api/plan/interface'
|
import type { Plan } from '@/api/plan/interface'
|
||||||
import PlanPopup from '@/views/plan/planList/components/planPopup.vue' // 导入子组件
|
import PlanPopup from '@/views/plan/planList/components/planPopup.vue' // 导入子组件
|
||||||
@@ -171,8 +171,8 @@ import TestSourcePopup from '@/views/machine/testSource/components/testSourcePop
|
|||||||
import { type TestSource } from '@/api/device/interface/testSource'
|
import { type TestSource } from '@/api/device/interface/testSource'
|
||||||
import { useModeStore } from '@/stores/modules/mode' // 引入模式 store
|
import { useModeStore } from '@/stores/modules/mode' // 引入模式 store
|
||||||
import { useHandleData } from '@/hooks/useHandleData'
|
import { useHandleData } from '@/hooks/useHandleData'
|
||||||
import { dictReportState, dictResult, dictTestState } from '@/api/plan/planData.ts'
|
import { dictReportState, dictResult, dictTestState } from '@/api/plan/planData'
|
||||||
import { getTestSourceById } from '@/api/device/testSource/index'
|
import { getTestSourceById } from '@/api/device/testSource'
|
||||||
import ImportExcel from '@/components/ImportExcel/index.vue'
|
import ImportExcel from '@/components/ImportExcel/index.vue'
|
||||||
import ImportZip from '@/components/ImportZip/index.vue'
|
import ImportZip from '@/components/ImportZip/index.vue'
|
||||||
import { useDownload } from '@/hooks/useDownload'
|
import { useDownload } from '@/hooks/useDownload'
|
||||||
@@ -198,6 +198,7 @@ const currentPage = ref(1)
|
|||||||
const pageSize = ref(10)
|
const pageSize = ref(10)
|
||||||
const currentPageData = ref<any[]>([]) //当前页的数据
|
const currentPageData = ref<any[]>([]) //当前页的数据
|
||||||
const patternId = ref('')
|
const patternId = ref('')
|
||||||
|
const selectedPlan = ref()
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
refreshTable()
|
refreshTable()
|
||||||
@@ -634,7 +635,8 @@ const handleDelete = async (params: Plan.ReqPlanParams) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const openChildrenPlan = (row: Partial<Plan.ReqPlan> = {}) => {
|
const openChildrenPlan = (row: Partial<Plan.ReqPlan> = {}) => {
|
||||||
childrenPlanView.value.open('检测计划详情', row, patternId.value)
|
selectedPlan.value = row
|
||||||
|
childrenPlanView.value.open('子计划管理', row, patternId.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
const statisticalAnalysisMore = async (ids: string[], rows: Plan.ReqPlan[]) => {
|
const statisticalAnalysisMore = async (ids: string[], rows: Plan.ReqPlan[]) => {
|
||||||
@@ -659,7 +661,7 @@ const importSubClick = () => {
|
|||||||
title: '导入检测计划',
|
title: '导入检测计划',
|
||||||
patternId: dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id ?? '',
|
patternId: dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id ?? '',
|
||||||
importApi: importSubPlan,
|
importApi: importSubPlan,
|
||||||
confirmMessage: '本次导入会覆盖已有数据信息,是否确认继续?'
|
confirmMessage: '本次导入会覆盖已有系统配置数据,是否确认继续?'
|
||||||
}
|
}
|
||||||
planImportZip.value?.acceptParams(params)
|
planImportZip.value?.acceptParams(params)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user