联调检测脚本

This commit is contained in:
GGJ
2025-02-24 08:38:54 +08:00
parent 7a76c2da8a
commit 034b31ba47
8 changed files with 344 additions and 150 deletions

View File

@@ -46,3 +46,7 @@ export const updateDtls = (params: any) => {
export const scriptDtlsCheckDataList = (params: any) => {
return http.post(`/pqScript/scriptDtlsCheckDataList`, params)
}
// 通讯脚本回显
export const checkDataList = (params: any) => {
return http.post(`/pqScript/checkDataList`, params)
}

View File

@@ -16,7 +16,7 @@
<el-table-column prop="name" label="指标" show-overflow-tooltip width="180px" />
<el-table-column align="center" label="参与误差比较">
<template #default="{ row }">
<el-switch v-model="row.compare" v-if="row.show">
<el-switch v-model="row.errorFlag" v-if="row.show" :active-value="1" :inactive-value="0">
<template #active-action>
<span></span>
</template>
@@ -28,7 +28,7 @@
</el-table-column>
<el-table-column align="center" label="是否启用">
<template #default="{ row }">
<el-switch v-model="row.enable" v-if="row.show">
<el-switch v-model="row.enable" v-if="row.show" :active-value="1" :inactive-value="0">
<template #active-action>
<span></span>
</template>
@@ -45,20 +45,17 @@
import { ref, reactive } from 'vue'
import type { Dict } from '@/api/system/dictionary/interface'
import { getDictTreeByCode } from '@/api/system/dictionary/dictTree'
interface TabOption {
label: string
name: string
children?: TabOption[]
}
import { checkDataList } from '@/api/device/testScript'
const props = defineProps({
options: {
type: Array ,
activeName: {
type: String,
required: true
}
})
const tableData = ref<any[]>([])
onMounted(async () => {
let data = await getDictTreeByCode({
const info = async () => {
let { data } = await getDictTreeByCode({
name: '',
id: '',
pid: '',
@@ -67,7 +64,7 @@ onMounted(async () => {
sort: 0
})
data.data[0].children.forEach((item: any, i: number) => {
data[0].children.forEach((item: any, i: number) => {
tableData.value.push({
id: item.id,
name: item.name,
@@ -77,13 +74,18 @@ onMounted(async () => {
item.children.forEach((k: any) => {
tableData.value[i].children.push({
id: k.id,
pid: item.id,
name: k.name,
dataType: 'real',
show: true,
compare: false,
enable: false
errorFlag: 0,
enable: 0
})
})
})
}
onMounted(() => {
info()
// tableData.value = data.data[0].children || []
})

View File

@@ -26,10 +26,10 @@ let scriptForm: any = {
}
], //间谐波
flickerData: {
fchagValue: 0, //电压变动幅度
fchagFre: 0, //波动频度
waveFluType: 0, //波动类型
waveType: 0, //波类型
fchagValue: '', //变动量
fchagFre: '', //波动频度
waveType: 'CPM', // 波动类型
waveFluType: 'SQU', //波类型
fdutyCycle: 50 //占空比
}, //闪变
dipData: {
@@ -55,10 +55,10 @@ let scriptForm: any = {
}
], //间谐波
flickerData: {
fchagValue: 0, //电压变动幅度
fchagFre: 0, //波动频度
waveFluType: 0, //波动类型
waveType: 0, //波类型
fchagValue: '', //变动量
fchagFre: '', //波动频度
waveType: 'CMP', // 波动类型
waveFluType: 'SQU', //波类型
fdutyCycle: 50 //占空比
}, //闪变
dipData: {
@@ -84,10 +84,10 @@ let scriptForm: any = {
}
], //间谐波
flickerData: {
fchagValue: 0, //电压变动幅度
fchagFre: 0, //波动频度
waveFluType: 0, //波动类型
waveType: 0, //波类型
fchagValue: '', //变动量
fchagFre: '', //波动频度
waveType: 'CMP', // 波动类型
waveFluType: 'SQU', //波类型
fdutyCycle: 50 //占空比
}, //闪变
dipData: {
@@ -113,10 +113,10 @@ let scriptForm: any = {
}
], //间谐波
flickerData: {
fchagValue: 0, //电压变动幅度
fchagFre: 0, //波动频度
waveFluType: 0, //波动类型
waveType: 0, //波类型
fchagValue: '', //变动量
fchagFre: '', //波动频度
waveType: 'CMP', // 波动类型
waveFluType: 'SQU', //波类型
fdutyCycle: 50 //占空比
}, //闪变
dipData: {
@@ -142,10 +142,10 @@ let scriptForm: any = {
}
], //间谐波
flickerData: {
fchagValue: 0, //电压变动幅度
fchagFre: 0, //波动频度
waveFluType: 0, //波动类型
waveType: 0, //波类型
fchagValue: '', //变动量
fchagFre: '', //波动频度
waveType: 'CMP', // 波动类型
waveFluType: 'SQU', //波类型
fdutyCycle: 50 //占空比
}, //闪变
dipData: {
@@ -171,10 +171,10 @@ let scriptForm: any = {
}
], //间谐波
flickerData: {
fchagValue: 0, //电压变动幅度
fchagFre: 0, //波动频度
waveFluType: 0, //波动类型
waveType: 0, //波类型
fchagValue: '', //变动量
fchagFre: '', //波动频度
waveType: 'CMP', // 波动类型
waveFluType: 'SQU', //波类型
fdutyCycle: 50 //占空比
}, //闪变
dipData: {

View File

@@ -1,9 +1,32 @@
import { ref } from "vue"
<template>
<el-dialog :title="dialogTitle" v-model="dialogVisible" @close="close" v-bind="dialogBig" width="1400">
<div class="table-box">
<ProTable
<el-dialog title="检测项目信息" v-model="dialogVisible" @close="close" v-bind="dialogBig" width="1400">
<div class="table-container">
<el-table
:data="tableData"
:header-cell-style="{
textAlign: 'center',
backgroundColor: '#003078',
color: '#fff'
}"
stripe
:cell-style="{ textAlign: 'center' }"
height="600px"
>
<el-table-column type="index" label="序号" width="60" />
<el-table-column prop="pname" label="参考设定值类型" />
<el-table-column prop="name" label="参考设定值子类型" />
<el-table-column prop="phase" label="相别" />
<el-table-column prop="value" label="参考设定值" />
<el-table-column label="操作">
<template #default="{ row }">
<el-button type="primary" link :icon="EditPen">编辑</el-button>
</template>
</el-table-column>
</el-table>
</div>
<!-- <ProTable
ref="proTable"
:columns="columns"
:request-api="getTableList"
@@ -11,8 +34,7 @@ import { ref } from "vue"
:toolButton="false"
:style="{ height: '530px', maxHeight: '530px', overflow: 'hidden' }"
>
<!-- :data='testScriptData' 如果要显示静态数据就切换该配置 -->
<!-- 表格 header 按钮 -->
<template #tableHeader="scope">
<el-button v-auth.testScript="'add'" type="primary" :icon="CirclePlus" @click="add">新增</el-button>
<el-button
@@ -26,7 +48,7 @@ import { ref } from "vue"
删除
</el-button>
</template>
<!-- 表格操作 -->
<template #operation="scope">
<el-button
v-auth.testScript="'upgrade'"
@@ -58,12 +80,11 @@ import { ref } from "vue"
删除
</el-button>
</template>
</ProTable>
</div>
</ProTable> -->
<template #footer>
<div>
<el-button @click="close()"> </el-button>
<el-button @click="close"> </el-button>
<el-button type="primary" @click="save">保存</el-button>
</div>
</template>
@@ -87,8 +108,6 @@ import { ref } from "vue"
</div>
</template>
</el-dialog>
<SetValuePopup ref="setValuePopup" />
</template>
<script setup lang="ts">
@@ -96,32 +115,30 @@ import type { TestScript } from '@/api/device/interface/testScript'
import type { ColumnProps } from '@/components/ProTable/interface'
import { CirclePlus, EditPen, Delete, Share } from '@element-plus/icons-vue'
import { reactive, ref } from 'vue'
import { getDictTreeByCode } from '@/api/system/dictionary/dictTree'
import { dialogBig } from '@/utils/elementBind'
import { checkDataList, scriptDtlsCheckDataList } from '@/api/device/testScript/index'
const showForm = ref(false)
const dialogVisible = ref(false)
const dialogTitle = ref('')
const props = defineProps({
activeName: {
type: String,
required: true
},
formContent: {
type: [Object, Array],
required: true
},
form: {
type: [Object, Array],
required: true
}
})
const tableData: any = ref([])
// 表格配置项
const columns = reactive<ColumnProps<TestScript.ResTestScript>[]>([
{ type: 'selection', fixed: 'left', width: 70 },
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
{
prop: 'name',
label: '参考设定值类型',
minWidth: 350
},
{
prop: 'standardName',
label: '参考设定值子类型',
minWidth: 150
},
{
prop: 'standardTime',
label: '参考设定值',
minWidth: 150
},
{ prop: 'operation', label: '操作', fixed: 'right', width: 250 }
])
const form = ref({
name: 220,
standardName: 0,
@@ -129,9 +146,45 @@ const form = ref({
})
// 打开弹窗,可能是新增,也可能是编辑
const open = (sign: string, row: any) => {
const open = async (row: any) => {
dialogVisible.value = true
dialogTitle.value = sign === 'add' ? '新增检测项目信息' : '编辑检测项目信息'
// checkDataList({ scriptId: props.formContent.id, scriptType: props.activeName }).then((res: any) => {
// })
let treeData: any = []
await getDictTreeByCode({
name: '',
id: '',
pid: '',
pids: '',
code: 'Script_Error',
sort: 0
}).then((res: any) => {
treeData = res.data[0].children
})
let checkDataList = [
{
pid: '004e06c7145e8454493dd69ad485c2a9',
valueType: '2da2a32c0cd19fb6368b9f4c249c2b3c',
dataType: 'real',
enable: 1,
errorFlag: 1
}
]
await scriptDtlsCheckDataList({
...props.form,
scriptId: props.formContent?.id,
scriptType: props.activeName,
checkDataList: checkDataList
}).then((res: any) => {
res.data.forEach((item: any) => {
let pList = treeData.filter((i: any) => i.id == item.pid)[0]
item.pname = pList.name
item.name = pList.children.filter((i: any) => i.id == item.valueType)[0].name
})
tableData.value = res.data
})
}
const save = () => {
dialogVisible.value = false
@@ -141,16 +194,7 @@ const save = () => {
const close = () => {
dialogVisible.value = false
}
// 新增
const add = () => {
showForm.value = true
}
//编辑
const edit = (row: any) => {}
// 复制
const copy = (row: any) => {}
//批量删除
const batchDelete = (row: any) => {}
// 对外映射
defineExpose({ open })
</script>

View File

@@ -135,7 +135,7 @@
</el-tabs>
</div>
<SetValueTable ref="setValueTableRef" />
<!-- <SetValueTable ref="setValueTableRef" v-if="showSetValueTable" /> -->
<template #footer>
<div>
@@ -144,6 +144,13 @@
</div>
</template>
</el-dialog>
<SetValueTable
ref="setValueTableRef"
:activeName="props.activeName"
:formContent="props.formContent"
:form="form"
v-if="showSetValueTable"
/>
</template>
<script setup lang="ts">
@@ -158,7 +165,7 @@ import TestScriptInHarmTab from '@/views/machine/testScript/components/testScrip
import TestScriptFlickerTab from '@/views/machine/testScript/components/testScriptFlickerTab.vue'
import TestScriptDipTab from '@/views/machine/testScript/components/testScriptDipTab.vue'
import { useDictStore } from '@/stores/modules/dict'
import { addScriptDtls, scriptDtlsCheckDataList } from '@/api/device/testScript'
import { addScriptDtls, } from '@/api/device/testScript'
import scriptForm from './scriptForm'
const emit = defineEmits(['addTab', 'close'])
@@ -183,6 +190,7 @@ const props = defineProps({
})
const key = ref(0)
// let valueType
const showSetValueTable = ref(false)
const form: any = ref(JSON.parse(JSON.stringify(scriptForm)))
const childForm: any = ref([])
const ScriptValueType = ref('')
@@ -335,10 +343,12 @@ const copyRow = (index: number) => {
// 打开 drawer(新增、编辑)
const openDialog = () => {
let copyForm = JSON.parse(JSON.stringify(form.value))
scriptDtlsCheckDataList({ ...copyForm, scriptId: props.formContent?.id, scriptType: props.activeName }).then(
res => {}
)
showSetValueTable.value = true
// setValueTableRef.value?.open()
setTimeout(() => {
setValueTableRef.value?.open(props.formContent)
}, 100)
}
// 对外映射

View File

@@ -15,13 +15,13 @@
<el-tab-pane v-for="tab in tabData" :key="tab.value" :label="tab.label" :name="tab.value">
<div class="dialog-footer">
<el-button :icon="CirclePlus" type="primary" @click="openDialog('add')">新增</el-button>
<el-button :icon="Check" type="primary">保存通讯脚本</el-button>
<el-button :icon="Check" type="primary" @click="saveTheNewsletter">保存通讯脚本</el-button>
</div>
<div style="display: flex">
<!-- 通信脚本 -->
<el-tabs type="border-card" v-model="firstName" style="height: 100%">
<el-tab-pane label="通讯脚本" name="first">
<Commun :options="props.options" style="width: 400px" />
<Commun :activeName="activeName" style="width: 400px" />
</el-tab-pane>
</el-tabs>
<!-- 2级tab -->
@@ -156,7 +156,7 @@ import { CirclePlus, Delete, Check, CopyDocument } from '@element-plus/icons-vue
import type { TestScript } from '@/api/device/interface/testScript'
import TestProjectPopup from '@/views/machine/testScript/components/testProjectPopup.vue'
import { CheckData } from '@/api/check/interface'
import { dlsDetails, deleteDtls, updateDtls, addScriptDtls } from '@/api/device/testScript'
import { dlsDetails, deleteDtls, updateDtls, addScriptDtls, checkDataList } from '@/api/device/testScript'
import { useDictStore } from '@/stores/modules/dict'
import { useHandleData } from '@/hooks/useHandleData'
interface TabOption {
@@ -324,27 +324,10 @@ const enableRow = async (row: any) => {
// 新增保存
const addTab = (row: any) => {
getTree()
// let data = JSON.parse(JSON.stringify(row))
// let flag = true
// let list: any = {}
// let childrenList: any = {}
// tabData.value.forEach(item => {
// if (item.value == activeName.value) {
// // item.children.push(JSON.parse(JSON.stringify(row)))
// list = item
// item.children.forEach(k => {
// if (k.value == row.value) {
// flag = false
// childrenList = k
// }
// })
// }
// })
// if (flag) {
// list.children.push(data)
// } else {
// childrenList.children.push(data)
// }
}
// 保存通信脚本
const saveTheNewsletter=()=>{
}
onMounted(() => {
getTree()

View File

@@ -1,63 +1,82 @@
<template>
<div class="tabs-container">
<el-tabs type="border-card" class="fixed-width-tabs" style="height: 100%">
<el-tab-pane label="Modulation">
<!-- 全局设置菜单内容 -->
<div class="form-container">
<el-form-item label=""></el-form-item>
<el-form-item label="电压变动幅度(%)" label-width="140px" prop="name">
<el-input
style="width: 150px"
v-model="form[0].flickerData.fchagValue"
:disabled="!form[0].flickerFlag"
/>
</el-form-item>
</div>
<div class="form-container">
<el-form-item label="波动类型" prop="name">
<el-select
placeholder="请选择波动类型"
style="width: 150px"
v-model="form[0].flickerData.waveFluType"
:disabled="!form[0].flickerFlag"
>
<el-option label="Hz" :value="1"></el-option>
<el-option label="CPM" :value="0"></el-option>
<el-tab-pane label="波动">
<!-- 全局设置菜单内容 Modulation-->
<div>
<el-form-item label="标准值" label-width="180px">
<el-select v-model="standardValue" style="width: 180px" placeholder="请选择标准值">
<el-option
v-for="item in standard"
:key="item.label"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item
:label="`波动频度( ${form[0].flickerData.waveFluType == 1 ? 'Hz/min' : '次/min'})`"
label-width="140px"
prop="name"
>
<el-input
style="width: 150px"
<el-form-item abel-width="180px">
<template #label>
<el-select
v-model="form[0].flickerData.waveType"
@change="changeLable"
style="width: 170px"
>
<el-option
v-for="item in waveList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</template>
<el-select
placeholder="请选择波动类型"
style="width: 180px"
filterable
allow-create
v-model="form[0].flickerData.fchagFre"
:disabled="!form[0].flickerFlag"
@change="changeWaveType"
>
<el-option
v-for="(item, i) in waveChildrenList"
:key="item.fchagFre"
:value="item.fchagFre"
:label="item.fchagFre"
/>
</el-select>
</el-form-item>
<el-form-item label="变动量(%)" label-width="180px">
<el-input
style="width: 180px"
v-model="form[0].flickerData.fchagValue"
:disabled="!form[0].flickerFlag"
/>
</el-form-item>
</div>
</el-tab-pane>
</el-tabs>
<el-tabs type="border-card" class="fixed-width-tabs" style="height: 100%">
<el-tab-pane label="WaveForm">
<!-- 全局设置菜单内容 -->
<el-tab-pane label="波形">
<!-- 全局设置菜单内容 WaveForm -->
<div>
<el-form-item label="波类型" label-width="100px" prop="name">
<el-form-item label="波类型" label-width="100px">
<el-select
placeholder="请选择波类型"
style="width: 150px"
v-model="form[0].flickerData.waveType"
v-model="form[0].flickerData.waveFluType"
:disabled="!form[0].flickerFlag"
>
<el-option label="RECT" :value="2"></el-option>
<el-option label="SIN" :value="1"></el-option>
<el-option label="SQU" :value="0"></el-option>
<el-option label="RECT" value="RECT"></el-option>
<el-option label="SIN" value="SIN"></el-option>
<el-option label="SQU" value="SQU"></el-option>
</el-select>
</el-form-item>
</div>
<div>
<el-form-item label="占空比(%)" label-width="100px" prop="name">
<el-form-item label="占空比(%)" label-width="100px">
<el-input
style="width: 150px"
v-model="form[0].flickerData.fdutyCycle"
@@ -71,13 +90,145 @@
</template>
<script setup lang="ts">
import { onMounted, ref, watch } from 'vue'
import { onMounted, ref, computed } from 'vue'
const props = defineProps({
childForm: {
type: Array,
type: [Array, Object] as any,
required: true
}
})
const standardValue = ref('1')
const standard = [
{
label: '1',
value: '1'
},
{
label: '3',
value: '3'
}
]
const waveList = [
{
label: '变动频度(次/min)',
value: 'CPM',
children1: [
{
fchagFre: '1',
fchagValue: '2.724'
},
{
fchagFre: '2',
fchagValue: '2.211'
},
{
fchagFre: '7',
fchagValue: '1.459'
},
{
fchagFre: '39',
fchagValue: '0.906'
},
{
fchagFre: '110',
fchagValue: '0.725'
},
{
fchagFre: '1620',
fchagValue: '0.402'
}
],
children3: [
{
fchagFre: '7',
fchagValue: '4.377'
},
{
fchagFre: '110',
fchagValue: '2.175'
},
{
fchagFre: '1620',
fchagValue: '1.206'
}
]
},
{
label: '变动频率(HZ)',
value: 'HZ',
children1: [
{
fchagFre: '0.008333',
fchagValue: '2.724'
},
{
fchagFre: '0.016667',
fchagValue: '2.211'
},
{
fchagFre: '0.058333',
fchagValue: '1.459'
},
{
fchagFre: '0.325',
fchagValue: '0.906'
},
{
fchagFre: '0.916',
fchagValue: '0.725'
},
{
fchagFre: '13.5',
fchagValue: '0.402'
}
],
children3: [
{
fchagFre: '0.058333',
fchagValue: '4.377'
},
{
fchagFre: '0.916',
fchagValue: '2.175'
},
{
fchagFre: '13.5',
fchagValue: '1.206'
}
]
}
]
const waveChildrenList = computed(() => {
return waveList.filter((item: any) => item.value === form.value[0].flickerData.waveType)[0][
standardValue.value == '1' ? 'children1' : 'children3'
]
})
const changeLable = e => {
setTimeout(() => {
if (props.childForm[0].flickerData.fchagFre != '') {
let data = waveChildrenList.value.filter((item: any) =>
props.childForm[0].flickerData.waveType == 'CPM'
? item.fchagFre == Math.round(props.childForm[0].flickerData.fchagFre * 120)
: (item.fchagFre - 0).toFixed(3) == (props.childForm[0].flickerData.fchagFre / 120).toFixed(3)
)
if (data.length > 0) {
props.childForm[0].flickerData.fchagValue = data[0].fchagValue
props.childForm[0].flickerData.fchagFre = data[0].fchagFre
} else {
props.childForm[0].flickerData.fchagFre =
props.childForm[0].flickerData.waveType == 'CPM'
? Math.round(props.childForm[0].flickerData.fchagFre * 120)
: (props.childForm[0].flickerData.fchagFre / 120).toFixed(3)
}
}
}, 100)
}
// [频率变化]
const changeWaveType = e => {
props.childForm[0].flickerData.fchagValue = waveChildrenList.value?.filter(
(item: any) => item.fchagFre == e
)[0].fchagValue
}
const form: any = computed({
get() {
return props.childForm

View File

@@ -138,7 +138,7 @@ const save = () => {
pqScriptAdd(formContent.value).then(res => {
if (res.code === 'A0000') {
ElMessage.success({ message: res.message })
formContent.value.id = JSON.stringify(res.data)
formContent.value.id = res.data
titleType.value == '编辑检测脚本'
show.value = true
}