Compare commits
10 Commits
2025-10
...
be95e792a8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
be95e792a8 | ||
|
|
308965751a | ||
|
|
6e8851f415 | ||
|
|
d99064c82e | ||
|
|
9ff9e7b923 | ||
|
|
ff5c435b6e | ||
|
|
5106149483 | ||
|
|
d5d04bd1ef | ||
|
|
bd5692fa23 | ||
|
|
f6b4979e7c |
@@ -20,12 +20,12 @@ export const getICDAllList = (params: ICD.ResICD) => {
|
||||
|
||||
//添加ICD
|
||||
export const addICD = (params: ICD.ResICD) => {
|
||||
return http.post(`/icd/add`, params)
|
||||
return http.upload(`/icd/add`, params)
|
||||
}
|
||||
|
||||
//编辑ICD
|
||||
export const updateICD = (params: ICD.ResICD) => {
|
||||
return http.post(`/icd/update`, params)
|
||||
return http.upload(`/icd/update`, params)
|
||||
}
|
||||
|
||||
//删除ICD
|
||||
|
||||
@@ -26,6 +26,7 @@ export namespace ICD {
|
||||
updateTime?: string| null; //更新时间
|
||||
angle: number; // 是否支持电压相角、电流相角指标
|
||||
usePhaseIndex: number; // 角型接线时是否使用相别的指标来进行检测
|
||||
mappingFile: string | null;//映射文件
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -18,7 +18,7 @@ export namespace Monitor {
|
||||
export interface ResPqMon {
|
||||
id: string; //监测点ID
|
||||
devId: string; //所属设备ID
|
||||
busbar: string;//所属母线
|
||||
busbar: string;//母线名称
|
||||
name: string; //监测点名称
|
||||
num: number; //线路号,监测点序号
|
||||
pt: string; //PT变比
|
||||
|
||||
@@ -29,6 +29,7 @@ export namespace TestScript {
|
||||
selectedValue?: string
|
||||
ratedCurr?: number
|
||||
ratedVolt?: number
|
||||
fluke?:number|boolean
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -24,8 +24,8 @@ export interface ResultData<T = any> extends Result {
|
||||
* 分页请求参数
|
||||
*/
|
||||
export interface ReqPage {
|
||||
pageNum: number;
|
||||
pageSize: number;
|
||||
pageNum?: number;
|
||||
pageSize?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,7 +3,7 @@ import { type VersionRegister } from '@/api/system/versionRegister/interface'
|
||||
|
||||
//获取有效数据配置
|
||||
export const getRegRes = (params: { type: string }) => {
|
||||
return http.get(`/sysRegRes/getRegResByType?id=${params.type}`)
|
||||
return http.get(`/sysRegRes/getRegResByType?typeId=${params.type}`)
|
||||
}
|
||||
|
||||
//编辑有效数据配置
|
||||
|
||||
@@ -72,7 +72,15 @@ const handelOpen = async (item: string, key: string) => {
|
||||
// 强制刷新页面
|
||||
await tabsStore.closeMultipleTab()
|
||||
await initDynamicRouter()
|
||||
await router.push({ path: '/home/index' })
|
||||
|
||||
// 只有当目标路径与当前路径不同时才跳转
|
||||
if (router.currentRoute.value.path !== '/home/index') {
|
||||
await router.push({ path: '/home/index' })
|
||||
} else {
|
||||
// 如果已在目标页面,手动触发组件更新
|
||||
window.location.reload() // 或者采用其他方式刷新数据
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
|
||||
@@ -190,8 +190,8 @@ export default class SocketService {
|
||||
* WebSocket连接配置
|
||||
*/
|
||||
private config: SocketConfig = {
|
||||
//url: 'ws://127.0.0.1:7777/hello',
|
||||
url: 'ws://192.168.1.124:7777/hello',
|
||||
url: 'ws://127.0.0.1:7777/hello',
|
||||
// url: 'ws://192.168.1.124:7777/hello',
|
||||
heartbeatInterval: 9000, // 9秒心跳间隔
|
||||
reconnectDelay: 5000, // 5秒重连延迟
|
||||
maxReconnectAttempts: 5, // 最多重连5次
|
||||
|
||||
@@ -129,6 +129,7 @@ import {useCheckStore} from '@/stores/modules/check'
|
||||
import {ElMessage, ElMessageBox} from 'element-plus'
|
||||
import {getBigTestItem} from '@/api/check/test'
|
||||
import {getAutoGenerate} from '@/api/user/login'
|
||||
import { generateDevReport } from '@/api/plan/plan'
|
||||
import {useModeStore} from '@/stores/modules/mode' // 引入模式 store
|
||||
import {useDictStore} from '@/stores/modules/dict'
|
||||
const checkStore = useCheckStore()
|
||||
@@ -668,19 +669,19 @@ const updatePercentage = async () => {
|
||||
percentage.value = 100
|
||||
emit('update:testStatus', 'success')
|
||||
|
||||
let {data: autoGenerate} = await getAutoGenerate()
|
||||
|
||||
// 检查是否需要自动生成报告
|
||||
let { data: autoGenerate } = await getAutoGenerate()
|
||||
if (autoGenerate == 1) {
|
||||
//调用自动生成报告接口
|
||||
// 自动生成报告
|
||||
let devIdList = checkStore.devices.map(item => {
|
||||
return item.deviceId
|
||||
})
|
||||
|
||||
// await generateDevReport({
|
||||
// planId: checkStore.plan.id,
|
||||
// devIdList: devIdList,
|
||||
// scriptId: checkStore.plan.scriptId,
|
||||
// planCode: checkStore.plan.code + ''
|
||||
// })
|
||||
await generateDevReport({
|
||||
'planId': checkStore.plan.id,
|
||||
'devIdList': devIdList,
|
||||
'planCode': checkStore.plan.code + ''
|
||||
})
|
||||
}
|
||||
stopTimeCount(1)
|
||||
ElMessageBox.alert(
|
||||
|
||||
@@ -278,7 +278,6 @@ const open = async (
|
||||
pairs.value = pair
|
||||
showSteps.value = true
|
||||
initOperate()
|
||||
dialogTitle.value = title
|
||||
dialogVisible.value = true
|
||||
|
||||
// 等待组件渲染完成
|
||||
|
||||
@@ -215,7 +215,7 @@ const planIdKey = ref<string>('')
|
||||
const deviceMonitor = ref<Map<string, any[]>>();
|
||||
const planIsOnlyWave = ref(false)
|
||||
const open = async (
|
||||
|
||||
title: string,
|
||||
device: Device.ResPqDev[],
|
||||
standardDev: StandardDevice.ResPqStandardDevice[],
|
||||
fatherPlanId: string,
|
||||
@@ -223,6 +223,7 @@ const open = async (
|
||||
checkType: string,
|
||||
isOnlyWave:boolean
|
||||
) => {
|
||||
dialogTitle.value = title
|
||||
planIsOnlyWave.value = isOnlyWave
|
||||
CompareTestVisible.value = false
|
||||
devIdList.value = device
|
||||
|
||||
@@ -650,7 +650,7 @@ function tableHeaderInit(val: number) {
|
||||
break
|
||||
case 3: // 报告生成模式
|
||||
if (modeStore.currentMode === '比对式') {
|
||||
checkStateTable.value = [1, 2, 3] // 显示检测中,检测完成和归档状态
|
||||
checkStateTable.value = [2, 3] // 显示检测中,检测完成和归档状态
|
||||
} else {
|
||||
checkStateTable.value = [2, 3] // 显示检测完成和归档状态
|
||||
}
|
||||
@@ -845,8 +845,9 @@ const handleTest2 = async (val: string) => {
|
||||
|
||||
// 检查数组长度是否为1且唯一元素是'wave_data'
|
||||
const isOnlyWave = targetPlan.datasourceIds.length === 1 && targetPlan.datasourceIds[0] === 'wave_data'
|
||||
|
||||
dialogTitle.value = val
|
||||
deviceConnectionPopupRef.value?.open(
|
||||
dialogTitle.value,
|
||||
filteredChannelsSelection,
|
||||
pqStandardDevList.value,
|
||||
props.id,
|
||||
@@ -1018,9 +1019,7 @@ const handleTest = async (val: string) => {
|
||||
planId: checkStore.plan.id,
|
||||
devIdList: devIdList,
|
||||
scriptId: checkStore.plan.scriptId,
|
||||
planCode: checkStore.plan.code + '',
|
||||
pageNum: 1,
|
||||
pageSize: 999
|
||||
planCode: checkStore.plan.code + ''
|
||||
})
|
||||
emit('batchGenerateClicked') // 触发事件
|
||||
ElMessage.success({ message: `报告生成成功!` })
|
||||
@@ -1060,9 +1059,7 @@ const openDrawer = async (title: string, row: any) => {
|
||||
planId: checkStore.plan.id,
|
||||
devIdList: [row.id],
|
||||
scriptId: checkStore.plan.scriptId,
|
||||
planCode: checkStore.plan.code + '',
|
||||
pageNum: 1,
|
||||
pageSize: 999
|
||||
planCode: checkStore.plan.code + ''
|
||||
})
|
||||
emit('batchGenerateClicked') // 触发事件
|
||||
ElMessage.success({ message: `报告生成成功!` })
|
||||
|
||||
@@ -706,9 +706,7 @@ const updatePercentage = async () => {
|
||||
'planId': checkStore.plan.id,
|
||||
'devIdList': devIdList,
|
||||
'scriptId': checkStore.plan.scriptId,
|
||||
'planCode': checkStore.plan.code + '',
|
||||
'pageNum': 1,
|
||||
'pageSize': 999,
|
||||
'planCode': checkStore.plan.code + ''
|
||||
})
|
||||
}
|
||||
// 提示检测完成
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<el-input
|
||||
v-model="formContent.name"
|
||||
placeholder="请输入设备名称"
|
||||
:disabled="scene === '1' || formContent.importFlag == 1"
|
||||
:disabled="scene === '1'"
|
||||
maxlength="32"
|
||||
show-word-limit
|
||||
/>
|
||||
@@ -38,7 +38,7 @@
|
||||
clearable
|
||||
placeholder="请选择设备类型"
|
||||
@change="handleDevTypeChange"
|
||||
:disabled="formContent.importFlag == 1"
|
||||
|
||||
>
|
||||
<el-option
|
||||
v-for="item in devTypeOptions"
|
||||
@@ -63,7 +63,7 @@
|
||||
v-model="formContent.manufacturer"
|
||||
clearable
|
||||
placeholder="请选择设备厂家"
|
||||
:disabled="formContent.importFlag == 1"
|
||||
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dictStore.getDictData('Dev_Manufacturers')"
|
||||
@@ -78,7 +78,7 @@
|
||||
v-model="formContent.createDate"
|
||||
:placeholder="`请选择${createDateTitle}`"
|
||||
:disabled-date="disabledDate"
|
||||
:disabled="formContent.importFlag == 1"
|
||||
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="固件版本" prop="hardwareVersion" v-if="scene === '0'">
|
||||
@@ -92,7 +92,7 @@
|
||||
v-model="formContent.inspectDate"
|
||||
placeholder="请选择定检日期"
|
||||
:disabled-date="disabledDate"
|
||||
:disabled="formContent.importFlag == 1"
|
||||
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-divider>参数信息</el-divider>
|
||||
@@ -128,7 +128,7 @@
|
||||
v-model="formContent.protocol"
|
||||
clearable
|
||||
placeholder="请选择通讯协议"
|
||||
:disabled="formContent.importFlag == 1"
|
||||
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dictStore.getDictData('Protocol')"
|
||||
@@ -139,17 +139,17 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="IP地址" prop="ip" placeholder="请输入IP地址">
|
||||
<el-input v-model="formContent.ip" :disabled="formContent.importFlag == 1" />
|
||||
<el-input v-model="formContent.ip" />
|
||||
</el-form-item>
|
||||
<el-form-item label="端口号" prop="port" placeholder="请输入端口号">
|
||||
<el-input v-model="formContent.port" :disabled="formContent.importFlag == 1" />
|
||||
<el-input v-model="formContent.port" />
|
||||
</el-form-item>
|
||||
<el-form-item label="是否加密" prop="encryptionFlag">
|
||||
<el-select
|
||||
v-model="formContent.encryptionFlag"
|
||||
clearable
|
||||
placeholder="请选择是否加密"
|
||||
:disabled="formContent.importFlag == 1"
|
||||
|
||||
>
|
||||
<el-option label="是" :value="1"></el-option>
|
||||
<el-option label="否" :value="0"></el-option>
|
||||
@@ -160,7 +160,7 @@
|
||||
v-model="formContent.series"
|
||||
placeholder="请输入识别码"
|
||||
show-password
|
||||
:disabled="formContent.importFlag == 1"
|
||||
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="密钥" prop="devKey" clearable v-if="formContent.encryptionFlag">
|
||||
@@ -168,7 +168,7 @@
|
||||
v-model="formContent.devKey"
|
||||
placeholder="请输入密钥"
|
||||
show-password
|
||||
:disabled="formContent.importFlag == 1"
|
||||
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="样品编号" prop="sampleId" clearable v-if="DevIsShow && scene === '0'">
|
||||
@@ -196,7 +196,7 @@
|
||||
v-model="formContent.cityName"
|
||||
clearable
|
||||
placeholder="请输入所属地市"
|
||||
:disabled="formContent.importFlag == 1"
|
||||
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="所属供电公司" prop="gdName" v-if="MonIsShow">
|
||||
@@ -204,7 +204,7 @@
|
||||
v-model="formContent.gdName"
|
||||
clearable
|
||||
placeholder="请输入所属供电公司"
|
||||
:disabled="formContent.importFlag == 1"
|
||||
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="所属电站" prop="subName" v-if="MonIsShow">
|
||||
@@ -212,7 +212,7 @@
|
||||
v-model="formContent.subName"
|
||||
clearable
|
||||
placeholder="请输入所属电站"
|
||||
:disabled="formContent.importFlag == 1"
|
||||
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
@@ -232,7 +232,7 @@
|
||||
prop="harmSysId"
|
||||
placeholder="请输入谐波系统设备id"
|
||||
>
|
||||
<el-input v-model="formContent.harmSysId" :disabled="formContent.importFlag == 1" />
|
||||
<el-input v-model="formContent.harmSysId" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
@@ -11,17 +11,17 @@
|
||||
<div>
|
||||
<el-form :model="formContent" ref="dialogFormRef" :rules="rules" label-width="140" class="form-two">
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-input clearable v-model="formContent.name" placeholder="请输入监测点名称" :disabled="props.DevFormContent.importFlag == 1 || formContent.resultType!=null"/>
|
||||
<el-input clearable v-model="formContent.name" placeholder="请输入监测点名称" :disabled=" formContent.resultType!=null"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="线路号" prop="num">
|
||||
<el-select v-model="formContent.num" placeholder="请选择线路号" @change="handleMonNumChange" :disabled="props.DevFormContent.importFlag == 1 || formContent.resultType!=null">
|
||||
<el-select v-model="formContent.num" placeholder="请选择线路号" @change="handleMonNumChange" :disabled=" formContent.resultType!=null">
|
||||
<el-option v-for="item in lineNum" :key="item.id" :label="item.name" :value="item.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="所属母线" prop="busbar">
|
||||
<el-input v-model="formContent.busbar" clearable placeholder="请输入所属母线" :disabled="props.DevFormContent.importFlag == 1 || formContent.resultType!=null"/>
|
||||
<el-form-item label="母线名称" prop="busbar">
|
||||
<el-input v-model="formContent.busbar" clearable placeholder="请输入所属母线" :disabled=" formContent.resultType!=null"/>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="所属母线" prop="busbar">
|
||||
<!-- <el-form-item label="母线名称" prop="busbar">
|
||||
<el-select
|
||||
v-model="formContent.busbar"
|
||||
clearable
|
||||
@@ -38,7 +38,7 @@
|
||||
</el-select>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="接线方式" prop="connection">
|
||||
<el-select v-model="formContent.connection" clearable placeholder="请选择接线方式" :disabled="props.DevFormContent.importFlag == 1 || formContent.resultType!=null">
|
||||
<el-select v-model="formContent.connection" clearable placeholder="请选择接线方式" :disabled=" formContent.resultType!=null">
|
||||
<el-option
|
||||
v-for="item in dictStore.getDictData('Dev_Connect')"
|
||||
:key="item.id"
|
||||
@@ -56,11 +56,11 @@
|
||||
</template>
|
||||
<div class="ratio-input-group">
|
||||
<el-form-item prop="ptPrimary" class="ratio-form-item">
|
||||
<el-input v-model="ptPrimary" placeholder="一次侧" @input="handlePtInput" :disabled="props.DevFormContent.importFlag == 1 || formContent.resultType!=null"/>
|
||||
<el-input v-model="ptPrimary" placeholder="一次侧" @input="handlePtInput" :disabled=" formContent.resultType!=null"/>
|
||||
</el-form-item>
|
||||
<div class="colon">:</div>
|
||||
<el-form-item prop="ptSecondary" style="margin-left: 10px" class="ratio-form-item">
|
||||
<el-input v-model="ptSecondary" placeholder="二次侧" @input="handlePtInput" :disabled="props.DevFormContent.importFlag == 1 || formContent.resultType!=null"/>
|
||||
<el-input v-model="ptSecondary" placeholder="二次侧" @input="handlePtInput" :disabled=" formContent.resultType!=null"/>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-form-item>
|
||||
@@ -75,17 +75,17 @@
|
||||
</template>
|
||||
<div class="ratio-input-group">
|
||||
<el-form-item prop="ctPrimary" class="ratio-form-item">
|
||||
<el-input v-model="ctPrimary" placeholder="一次侧" @input="handleCtInput" :disabled="props.DevFormContent.importFlag == 1 || formContent.resultType!=null"/>
|
||||
<el-input v-model="ctPrimary" placeholder="一次侧" @input="handleCtInput" :disabled=" formContent.resultType!=null"/>
|
||||
</el-form-item>
|
||||
<div class="colon">:</div>
|
||||
<el-form-item prop="ctSecondary" style="margin-left: 10px" class="ratio-form-item">
|
||||
<el-input v-model="ctSecondary" placeholder="二次侧" @input="handleCtInput" :disabled="props.DevFormContent.importFlag == 1 || formContent.resultType!=null"/>
|
||||
<el-input v-model="ctSecondary" placeholder="二次侧" @input="handleCtInput" :disabled=" formContent.resultType!=null"/>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="统计间隔" prop="statInterval">
|
||||
<el-select v-model="formContent.statInterval" clearable placeholder="请选择统计间隔" :disabled="props.DevFormContent.importFlag == 1 || formContent.resultType!=null">
|
||||
<el-select v-model="formContent.statInterval" clearable placeholder="请选择统计间隔" :disabled=" formContent.resultType!=null">
|
||||
<el-option
|
||||
v-for="item in dictStore.getDictData('Dev_Chns')"
|
||||
:key="item.id"
|
||||
@@ -95,7 +95,7 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="谐波系统检测点id" prop="harmSysId" placeholder="请输入谐波系统检测点id">
|
||||
<el-input v-model="formContent.harmSysId" :disabled="props.DevFormContent.importFlag == 1 || formContent.resultType!=null"/>
|
||||
<el-input v-model="formContent.harmSysId" :disabled=" formContent.resultType!=null"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否参与检测" prop="checkFlag" placeholder="请输入CT编号">
|
||||
<el-select v-model="formContent.checkFlag" :disabled="formContent.resultType!=null">
|
||||
|
||||
@@ -93,7 +93,7 @@ const columns = reactive<ColumnProps<Monitor.ResPqMon>[]>([
|
||||
},
|
||||
{
|
||||
prop: 'busbar',
|
||||
label: '所属母线',
|
||||
label: '母线名称',
|
||||
width: 200
|
||||
},
|
||||
{
|
||||
|
||||
@@ -14,6 +14,23 @@
|
||||
show-word-limit
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="映射文件" prop="mappingFile">
|
||||
<el-upload
|
||||
action="#"
|
||||
:limit="1"
|
||||
:on-change='MappingHandleChange'
|
||||
:auto-upload="false"
|
||||
:file-list="mappingFileList"
|
||||
:on-exceed="MappingHandleExceed"
|
||||
:on-remove="MappingHandleRemove"
|
||||
style="width: 100% !important;"
|
||||
accept=".txt"
|
||||
class="upload-container"
|
||||
>
|
||||
<el-button type="primary">选择文件</el-button>
|
||||
</el-upload>
|
||||
仅支持上传大小不超过1MB的.txt文件
|
||||
</el-form-item>
|
||||
<el-form-item label="是否支持电压相角、电流相角指标" prop="angle" label-width="auto">
|
||||
<el-switch
|
||||
v-model="formContent.angle"
|
||||
@@ -46,7 +63,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ElMessage, type FormInstance, type FormItemRule } from 'element-plus'
|
||||
import { ElMessage, UploadFile, type FormInstance, type FormItemRule } from 'element-plus'
|
||||
import { computed, ref, Ref } from 'vue'
|
||||
import { type ICD } from '@/api/device/interface/icd'
|
||||
import { dialogSmall } from '@/utils/elementBind'
|
||||
@@ -56,6 +73,17 @@ import { addICD, updateICD } from '@/api/device/icd'
|
||||
const dictStore = useDictStore()
|
||||
// 定义弹出组件元信息
|
||||
const dialogFormRef = ref()
|
||||
const mappingFileName = ref('')
|
||||
const mappingFileUrl = ref('')
|
||||
let excelFormData = new FormData()
|
||||
|
||||
|
||||
const mappingFileList = computed(() => {
|
||||
if (mappingFileName.value && mappingFileUrl.value) {
|
||||
return [{name: mappingFileName.value, url: mappingFileUrl.value}];
|
||||
}
|
||||
return [];
|
||||
});
|
||||
function useMetaInfo() {
|
||||
const dialogVisible = ref(false)
|
||||
const titleType = ref('add')
|
||||
@@ -65,7 +93,8 @@ function useMetaInfo() {
|
||||
path: '',
|
||||
state: 1,
|
||||
angle: 0,
|
||||
usePhaseIndex: 0
|
||||
usePhaseIndex: 0,
|
||||
mappingFile: ''
|
||||
})
|
||||
return { dialogVisible, titleType, formContent }
|
||||
}
|
||||
@@ -80,7 +109,8 @@ const resetFormContent = () => {
|
||||
path: '',
|
||||
state: 1,
|
||||
angle: 0,
|
||||
usePhaseIndex: 0
|
||||
usePhaseIndex: 0,
|
||||
mappingFile: ''
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,11 +123,13 @@ const formRuleRef = ref<FormInstance>()
|
||||
//定义校验规则
|
||||
const rules: Ref<Record<string, Array<FormItemRule>>> = ref({
|
||||
name: [{ required: true, message: 'icd名称必填!', trigger: 'blur' }],
|
||||
path: [{ required: true, message: 'icd存储地址必填!', trigger: 'blur' }]
|
||||
path: [{ required: true, message: 'icd存储地址必填!', trigger: 'blur' }],
|
||||
mappingFile: [{required: true, message: '请上传映射文件', trigger: 'change'}],
|
||||
})
|
||||
|
||||
// 关闭弹窗
|
||||
const close = () => {
|
||||
excelFormData = new FormData()
|
||||
dialogVisible.value = false
|
||||
// 清空dialogForm中的值
|
||||
resetFormContent()
|
||||
@@ -110,10 +142,27 @@ const save = () => {
|
||||
try {
|
||||
dialogFormRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
// 清空 excelFormData
|
||||
excelFormData.delete('name')
|
||||
excelFormData.delete('path')
|
||||
excelFormData.delete('angle')
|
||||
excelFormData.delete('usePhaseIndex')
|
||||
|
||||
excelFormData.append('name', formContent.value.name)
|
||||
excelFormData.append('path', formContent.value.path)
|
||||
excelFormData.append('angle', formContent.value.angle)
|
||||
excelFormData.append('usePhaseIndex', formContent.value.usePhaseIndex)
|
||||
|
||||
let baseFileFlag = handleFileLimit(excelFormData.get('mappingFile') as File)
|
||||
if (!baseFileFlag) {
|
||||
return
|
||||
}
|
||||
|
||||
if (formContent.value.id) {
|
||||
await updateICD(formContent.value)
|
||||
excelFormData.append('id', formContent.value.id)
|
||||
await updateICD(excelFormData)
|
||||
} else {
|
||||
await addICD(formContent.value)
|
||||
await addICD(excelFormData)
|
||||
}
|
||||
ElMessage.success({ message: `${dialogTitle.value}成功!` })
|
||||
close()
|
||||
@@ -135,11 +184,66 @@ const open = async (sign: string, data: ICD.ResICD) => {
|
||||
|
||||
if (data.id) {
|
||||
formContent.value = { ...data }
|
||||
formContent.value.id = data.id
|
||||
// 文件信息回显
|
||||
if (data.mappingFile) {
|
||||
mappingFileName.value = data.mappingFile.name
|
||||
mappingFileUrl.value = data.mappingFile.url
|
||||
// 模拟文件列表显示
|
||||
formContent.value.mappingFile = data.mappingFile.name
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
mappingFileName.value = ''
|
||||
mappingFileUrl.value = ''
|
||||
resetFormContent()
|
||||
// 清空 excelFormData
|
||||
excelFormData = new FormData();
|
||||
}
|
||||
}
|
||||
|
||||
const MappingHandleChange = async (param: UploadFile) => {
|
||||
mappingFileName.value = param.name;
|
||||
mappingFileUrl.value = URL.createObjectURL(param.raw as Blob);
|
||||
excelFormData.append('mappingFile', param.raw as Blob, param.name);
|
||||
|
||||
formContent.value.mappingFile = param.name;
|
||||
};
|
||||
|
||||
const MappingHandleRemove = () => {
|
||||
excelFormData.delete('mappingFile');
|
||||
formContent.value.mappingFile = ''
|
||||
};
|
||||
|
||||
const MappingHandleExceed = (files: File[]) => {
|
||||
// 移除旧文件
|
||||
excelFormData.delete('mappingFile');
|
||||
// 添加新文件
|
||||
if (files.length > 0) {
|
||||
const newFile = files[0] as unknown as UploadFile;
|
||||
mappingFileName.value = newFile.name;
|
||||
excelFormData.append('mappingFile', newFile as Blob, newFile.name);
|
||||
|
||||
formContent.value.mappingFile = newFile.name
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
const fileSizeLimit = 1 * 1024 * 1024; // 1MB
|
||||
|
||||
const handleFileLimit = (file: File) => {
|
||||
if (file) {
|
||||
if (file.size > fileSizeLimit) {
|
||||
ElMessage.error({message: `文件大小不能超过${fileSizeLimit / 1024 / 1024}MB`});
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// 对外映射
|
||||
defineExpose({ open })
|
||||
const props = defineProps<{
|
||||
|
||||
@@ -69,6 +69,14 @@
|
||||
label: '存储地址',
|
||||
|
||||
},
|
||||
{
|
||||
prop: 'mappingFile',
|
||||
label: '映射文件路径',
|
||||
minWidth: 150,
|
||||
render: scope => {
|
||||
return scope.row.mappingFile.url
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'createTime',
|
||||
label: '创建时间',
|
||||
|
||||
@@ -84,6 +84,13 @@
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item v-if="appSceneStore.currentScene=='1'" label="福禄克专用" prop="fluke">
|
||||
<el-switch
|
||||
v-model="formContent.fluke"
|
||||
active-color="#13ce66"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
<el-card v-if="show">
|
||||
@@ -102,6 +109,7 @@ import type { CascaderOption } from 'element-plus'
|
||||
import { Select, Close, ArrowDownBold, ArrowUpBold } from '@element-plus/icons-vue'
|
||||
import { pqScriptAdd, pqScriptUpdate } from '@/api/device/testScript'
|
||||
import { useRouter } from 'vue-router'
|
||||
import {useAppSceneStore} from "@/stores/modules/mode";
|
||||
const modeId = ref()
|
||||
const show = ref(false)
|
||||
const height = ref('125px')
|
||||
@@ -113,6 +121,8 @@ const secondLevelOptions: any[] = []
|
||||
// 定义弹出组件元信息
|
||||
const dialogFormRef = ref()
|
||||
const dictStore = useDictStore()
|
||||
const appSceneStore = useAppSceneStore()
|
||||
|
||||
function useMetaInfo() {
|
||||
const titleType = ref('add')
|
||||
const formContent = ref<TestScript.ResTestScript>({
|
||||
@@ -124,7 +134,8 @@ function useMetaInfo() {
|
||||
standardTime: '',
|
||||
state: 1,
|
||||
ratedCurr: 0,
|
||||
ratedVolt: 0
|
||||
ratedVolt: 0,
|
||||
fluke: 0,
|
||||
})
|
||||
return { titleType, formContent }
|
||||
}
|
||||
@@ -140,7 +151,8 @@ const rules = {
|
||||
type: [{ required: true, message: '请选择模版类型', trigger: 'change' }],
|
||||
valueType: [{ required: true, message: '请选择检测脚本值类型', trigger: 'change' }],
|
||||
ratedCurr: [{ required: true, message: '请填写额定电流', trigger: 'change' }],
|
||||
ratedVolt: [{ required: true, message: '请填写额定电压', trigger: 'change' }]
|
||||
ratedVolt: [{ required: true, message: '请填写额定电压', trigger: 'change' }],
|
||||
fluke: [{ required: true }],
|
||||
}
|
||||
|
||||
const { titleType, formContent } = useMetaInfo()
|
||||
@@ -160,7 +172,8 @@ const resetFormContent = () => {
|
||||
standardTime: '',
|
||||
state: 1,
|
||||
ratedCurr: 0,
|
||||
ratedVolt: 0
|
||||
ratedVolt: 0,
|
||||
fluke: 0,
|
||||
}
|
||||
router.go(-1)
|
||||
}
|
||||
@@ -190,7 +203,9 @@ const save = () => {
|
||||
if (valid) {
|
||||
if (titleType.value == '新增检测脚本') {
|
||||
formContent.value.pattern = modeId.value
|
||||
pqScriptAdd(formContent.value).then(res => {
|
||||
let params = {...formContent.value}
|
||||
params.fluke = params.fluke ? 1 : 0
|
||||
pqScriptAdd(params).then(res => {
|
||||
if (res.code === 'A0000') {
|
||||
ElMessage.success({ message: res.message })
|
||||
formContent.value.id = res.data
|
||||
@@ -199,7 +214,9 @@ const save = () => {
|
||||
}
|
||||
})
|
||||
} else {
|
||||
pqScriptUpdate(formContent.value).then(res => {
|
||||
let params = {...formContent.value}
|
||||
params.fluke = params.fluke ? 1 : 0
|
||||
pqScriptUpdate(params).then(res => {
|
||||
if (res.code === 'A0000') {
|
||||
ElMessage.success({ message: res.message })
|
||||
}
|
||||
@@ -224,6 +241,7 @@ const open = async (title: string, row: any) => {
|
||||
} else {
|
||||
let list = JSON.parse(row)
|
||||
formContent.value = list
|
||||
formContent.value.fluke = formContent.value.fluke == 1? true : false
|
||||
show.value = true
|
||||
}
|
||||
// 重置表单
|
||||
|
||||
@@ -33,36 +33,23 @@
|
||||
multiple
|
||||
placeholder="请选择标准设备"
|
||||
>
|
||||
<el-option
|
||||
v-for="option in pqStandardDevArray"
|
||||
:key="option.value"
|
||||
:disabled="subPlanBindStandardDev.includes(option.label) || option.disabled"
|
||||
:label="option.label"
|
||||
:value="option.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="selectByMode" :label-width="110" label="检测项" prop="testItems">
|
||||
<el-select
|
||||
v-model="formContent.testItems"
|
||||
:disabled="planType != 0 || allDisabled || !canEdited"
|
||||
:max-collapse-tags="1"
|
||||
clearable
|
||||
collapse-tags
|
||||
collapse-tags-tooltip
|
||||
filterable
|
||||
multiple
|
||||
placeholder="请选择检测项"
|
||||
@blur="handleTestItemChange"
|
||||
>
|
||||
<el-option
|
||||
v-for="(option, index) in secondLevelOptions"
|
||||
:key="index"
|
||||
:label="option.label"
|
||||
:value="option.value"
|
||||
/>
|
||||
<!-- <el-option-->
|
||||
<!-- v-for="option in pqStandardDevArray"-->
|
||||
<!-- :key="option.value"-->
|
||||
<!-- :disabled="subPlanBindStandardDev.includes(option.label) || option.disabled"-->
|
||||
<!-- :label="option.label"-->
|
||||
<!-- :value="option.value"-->
|
||||
<!-- />-->
|
||||
<el-option
|
||||
v-for="option in pqStandardDevArray"
|
||||
:key="option.value"
|
||||
:disabled="subPlanBindStandardDev.includes(option.label) || option.disabled"
|
||||
:label="option.label"
|
||||
:value="option.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item v-if="!selectByMode" :label-width="110" label="检测源" prop="sourceIds">
|
||||
<el-select
|
||||
v-model="formContent.sourceIds"
|
||||
@@ -72,6 +59,7 @@
|
||||
collapse-tags
|
||||
filterable
|
||||
placeholder="请选择检测源"
|
||||
@change="handleSourceChange"
|
||||
>
|
||||
<el-option
|
||||
v-for="(option, index) in pqSourceArray"
|
||||
@@ -118,6 +106,7 @@
|
||||
:key="index"
|
||||
:label="option.label"
|
||||
:value="option.value"
|
||||
:disabled="option.fluke!=1&&pqSourceArray?.find(item=>formContent.sourceIds==item.value)?.label.includes('FLUKE')"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
@@ -139,6 +128,28 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="selectByMode" :label-width="110" label="检测项" prop="testItems">
|
||||
<el-select
|
||||
v-model="formContent.testItems"
|
||||
:disabled="planType != 0 || allDisabled || !canEdited"
|
||||
:max-collapse-tags="1"
|
||||
clearable
|
||||
collapse-tags
|
||||
collapse-tags-tooltip
|
||||
filterable
|
||||
multiple
|
||||
placeholder="请选择检测项"
|
||||
@blur="handleTestItemChange"
|
||||
>
|
||||
<el-option
|
||||
v-for="(option, index) in secondLevelOptions"
|
||||
:disabled="shouldDisableTestItem(option)"
|
||||
:key="index"
|
||||
:label="option.label"
|
||||
:value="option.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label-width="110" label="数据处理原则" prop="dataRule">
|
||||
<el-select
|
||||
v-model="formContent.dataRule"
|
||||
@@ -465,7 +476,7 @@ const pqStandardDevList = ref<StandardDevice.ResPqStandardDevice[]>([]) //获取
|
||||
const pqReportName = ref<{ name: string }[]>([])
|
||||
|
||||
const pqSourceArray = ref<{ label: string; value: string }[]>()
|
||||
const pqScriptArray = ref<{ label: string; value: string }[]>()
|
||||
const pqScriptArray = ref<{ label: string; value: string,fluke?:number|boolean}[]>()
|
||||
const pqErrorArray = ref<{ label: string; value: string }[]>()
|
||||
const pqStandardDevArray = ref<{ label: string; value: string }[]>()
|
||||
const secondLevelOptions: any[] = []
|
||||
@@ -485,6 +496,8 @@ const waveRecordSetting = ref(false)
|
||||
const realTimeSetting = ref(false)
|
||||
const statisticsSetting = ref(false)
|
||||
const flickerSetting = ref(false)
|
||||
|
||||
|
||||
const generateData = () => {
|
||||
const manufacturerDict = dictStore.getDictData('Dev_Manufacturers')
|
||||
|
||||
@@ -522,6 +535,8 @@ const generateData = () => {
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
function useMetaInfo() {
|
||||
const dialogVisible = ref(false)
|
||||
const titleType = ref('add')
|
||||
@@ -591,6 +606,18 @@ watch(
|
||||
}
|
||||
)
|
||||
|
||||
const handleSourceChange = () => {
|
||||
let pqSource = pqSourceArray.value?.find(item => item.value === formContent.sourceIds)
|
||||
|
||||
if (pqSource?.label.includes('FLUKE')) {
|
||||
|
||||
let pqScript = pqScriptArray.value?.find(item => item.value === formContent.scriptId)
|
||||
if (pqScript?.fluke!=1) {
|
||||
formContent.scriptId = ''
|
||||
ElMessage.warning('专用检测脚本只能使用福禄克检测源!')
|
||||
}
|
||||
}
|
||||
}
|
||||
// 清空formContent
|
||||
const resetFormContent = () => {
|
||||
Object.assign(formContent, {
|
||||
@@ -804,7 +831,7 @@ const open = async (sign: string, data: Plan.ReqPlan, currentMode: string, plan:
|
||||
user_Result: any
|
||||
|
||||
if (mode.value === '比对式') {
|
||||
;[
|
||||
[
|
||||
PqErrSys_Result,
|
||||
pqDevList_Result,
|
||||
pqReportName_Result,
|
||||
@@ -849,7 +876,7 @@ const open = async (sign: string, data: Plan.ReqPlan, currentMode: string, plan:
|
||||
const rule = dataRuleDict.find(item => item.code === 'Cp95_Value')
|
||||
formContent.dataRule = rule ? rule.id : ''
|
||||
} else {
|
||||
;[pqSource_Result, PqScript_Result, PqErrSys_Result, pqDevList_Result, pqReportName_Result] =
|
||||
[pqSource_Result, PqScript_Result, PqErrSys_Result, pqDevList_Result, pqReportName_Result] =
|
||||
await Promise.all([
|
||||
getTestSourceList(data),
|
||||
getPqScriptList(data),
|
||||
@@ -886,6 +913,7 @@ const open = async (sign: string, data: Plan.ReqPlan, currentMode: string, plan:
|
||||
formContent.datasourceIds = datasourceDicts
|
||||
.filter(item => ['real', 'wave_data'].includes(item.code))
|
||||
.map(item => item.code)
|
||||
|
||||
realTimeSetting.value = true
|
||||
waveRecordSetting.value = true
|
||||
} else {
|
||||
@@ -964,7 +992,7 @@ const open = async (sign: string, data: Plan.ReqPlan, currentMode: string, plan:
|
||||
}
|
||||
}
|
||||
} else {
|
||||
;[
|
||||
[
|
||||
pqSource_Result,
|
||||
PqScript_Result,
|
||||
PqErrSys_Result,
|
||||
@@ -1040,7 +1068,10 @@ const open = async (sign: string, data: Plan.ReqPlan, currentMode: string, plan:
|
||||
formContent.devIds = boundData.map((i: any) => i.id) // 已绑定设备id集合
|
||||
}
|
||||
handleDataSourceChange()
|
||||
handleTestItemChange(false)
|
||||
if (mode.value === '比对式'){
|
||||
handleTestItemChange(false)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
pqToArray() //将对象转为数组
|
||||
@@ -1054,6 +1085,13 @@ const open = async (sign: string, data: Plan.ReqPlan, currentMode: string, plan:
|
||||
formContent.testItems = data.testItems
|
||||
}
|
||||
}
|
||||
//数据源选中录波,检测项禁止频率和闪变
|
||||
if(formContent.datasourceIds.includes('wave_data')){
|
||||
const frequencyOption = secondLevelOptions.find(option => option.label.includes('频率'));
|
||||
if (frequencyOption && Array.isArray(formContent.testItems)) {
|
||||
formContent.testItems = formContent.testItems.filter(id => id !== frequencyOption.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mode.value != '比对式') {
|
||||
@@ -1189,7 +1227,8 @@ function pqToArray() {
|
||||
const sourceArray2 = Array.isArray(pqScriptList.value) ? pqScriptList.value : []
|
||||
pqScriptArray.value = sourceArray2.map(item => ({
|
||||
label: item.name || '',
|
||||
value: item.id || ''
|
||||
value: item.id || '',
|
||||
fluke:item.fluke
|
||||
}))
|
||||
|
||||
const sourceArray3 = Array.isArray(pqErrSysList.value) ? pqErrSysList.value : []
|
||||
@@ -1296,11 +1335,48 @@ const handleDataSourceChange = () => {
|
||||
}
|
||||
if (hasLuBo) {
|
||||
waveRecordSetting.value = true
|
||||
|
||||
// 当选中录波数据源时,从已选检测项中移除频率和闪变项
|
||||
const frequencyOption = secondLevelOptions.find(option => option.label.includes('频率'));
|
||||
const flickerOption = secondLevelOptions.find(option => option.label.includes('闪变'));
|
||||
|
||||
if (Array.isArray(formContent.testItems)) {
|
||||
let filteredItems = [...formContent.testItems];
|
||||
|
||||
if (frequencyOption) {
|
||||
filteredItems = filteredItems.filter(id => id !== frequencyOption.value);
|
||||
}
|
||||
|
||||
if (flickerOption) {
|
||||
filteredItems = filteredItems.filter(id => id !== flickerOption.value);
|
||||
}
|
||||
|
||||
formContent.testItems = filteredItems;
|
||||
}
|
||||
} else {
|
||||
waveRecordSetting.value = false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 判断检测项是否应被禁用
|
||||
const shouldDisableTestItem = computed(() => {
|
||||
return (option: { label: string; value: string }) => {
|
||||
// 当数据源选中录波时,禁用频率和闪变选项
|
||||
if (Array.isArray(formContent.datasourceIds)) {
|
||||
const hasLuBo = formContent.datasourceIds.some(id => {
|
||||
const dictItem = dictStore.getDictData(dataSourceType.value).find(item => item.code === id);
|
||||
return dictItem ? dictItem.name.includes('录波') : false;
|
||||
});
|
||||
|
||||
if (hasLuBo && (option.label.includes('频率') || option.label.includes('闪变'))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
});
|
||||
|
||||
//导入设备
|
||||
const deviceImportExcel = ref<InstanceType<typeof ImportExcel> | null>(null)
|
||||
|
||||
|
||||
@@ -239,7 +239,7 @@ const BaseHandleExceed = (files: File[]) => {
|
||||
baseFileName.value = newFile.name;
|
||||
excelFormData.append('baseFile', newFile as Blob, newFile.name);
|
||||
|
||||
formContent.value.detailFile = newFile.name
|
||||
formContent.value.baseFile = newFile.name
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user