修改检测脚本页面
This commit is contained in:
11
frontend/.prettierrc
Normal file
11
frontend/.prettierrc
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"singleQuote": true,
|
||||||
|
"trailingComma": "none",
|
||||||
|
"tabWidth": 4,
|
||||||
|
"printWidth": 120,
|
||||||
|
"useTabs": false,
|
||||||
|
"semi": false,
|
||||||
|
"arrowParens": "avoid",
|
||||||
|
"endOfLine": "lf",
|
||||||
|
"htmlWhitespaceSensitivity": "ignore"
|
||||||
|
}
|
||||||
@@ -23,11 +23,11 @@ export const getFormData = (params: {
|
|||||||
* @param params
|
* @param params
|
||||||
*/
|
*/
|
||||||
export const getTreeData = (params: {
|
export const getTreeData = (params: {
|
||||||
scriptId: string,
|
scriptId?: string,
|
||||||
devId: string,
|
devId?: string,
|
||||||
devNum: string,
|
devNum?: string,
|
||||||
scriptType: string | null,
|
scriptType?: string | null,
|
||||||
code: number,
|
code?: number,
|
||||||
}) => {
|
}) => {
|
||||||
return http.post<CheckData.TreeItem[]>("/result/treeData/", params, {loading: true});
|
return http.post<CheckData.TreeItem[]>("/result/treeData/", params, {loading: true});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ export namespace TestScript {
|
|||||||
createTime?: string;
|
createTime?: string;
|
||||||
updateBy?: string;
|
updateBy?: string;
|
||||||
updateTime?: string;
|
updateTime?: string;
|
||||||
|
selectedValue?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,229 +1,260 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog :title="dialogTitle" v-model='dialogVisible' @close="close" v-bind="dialogBig" width="1400px">
|
<el-dialog :title="dialogTitle" v-model="dialogVisible" @close="close" v-bind="dialogBig" width="1400px">
|
||||||
<div class="dialog-content" >
|
<div class="dialog-content">
|
||||||
<el-tabs type="border-card" class="left-tabs" style="height: 100%;">
|
<el-tabs type="border-card" class="left-tabs" style="height: 100%">
|
||||||
<el-tab-pane label="输出菜单">
|
<el-tab-pane label="输出菜单">
|
||||||
<!-- 输出菜单内容 -->
|
<!-- 输出菜单内容 -->
|
||||||
<el-table :data="tableData"
|
<el-table
|
||||||
:header-cell-style="{ textAlign: 'center',backgroundColor: '#003078',color: '#fff' } "
|
:data="tableData"
|
||||||
:cell-style="{ textAlign: 'center' }"
|
:header-cell-style="{ textAlign: 'center', backgroundColor: '#003078', color: '#fff' }"
|
||||||
style="width: 100%"
|
:cell-style="{ textAlign: 'center' }"
|
||||||
:style="{ height: '295px',overflow:'hidden'}"
|
style="width: 100%"
|
||||||
:show-header="false"
|
:style="{ height: '295px', overflow: 'hidden' }"
|
||||||
:span-method="arraySpanMethod">
|
:show-header="false"
|
||||||
<el-table-column prop="sort" label="相别" width="60" />
|
:span-method="arraySpanMethod"
|
||||||
<el-table-column prop="frequency" label="电压/电流" width="90" />
|
>
|
||||||
<el-table-column prop="L1" label="值" width="180"/>
|
<el-table-column prop="sort" label="相别" width="60" />
|
||||||
<el-table-column label="操作" width="80">
|
<el-table-column prop="frequency" label="电压/电流" width="90" />
|
||||||
<template #default="{ }">
|
<el-table-column prop="L1" label="值" width="180" />
|
||||||
<el-button type="info" :icon="Bottom"></el-button>
|
<el-table-column label="操作" width="80">
|
||||||
</template>
|
<template #default="{}">
|
||||||
</el-table-column>
|
<el-button type="info" :icon="Bottom"></el-button>
|
||||||
<el-table-column label="操作">
|
</template>
|
||||||
<template #default="{ row, $index }">
|
</el-table-column>
|
||||||
<el-button :type="buttonTypes[$index].channel || 'info'" @click="toggleType(row, $index,'channel')">通道使能</el-button>
|
<el-table-column label="操作">
|
||||||
<el-button :type="buttonTypes[$index]?.harmonic || 'info'" @click="toggleType(row, $index, 'harmonic')">谐波使能</el-button>
|
<template #default="{ row, $index }">
|
||||||
<el-button :type="buttonTypes[$index]?.interHarmonic || 'info'" @click="toggleType(row, $index, 'interHarmonic')">间谐波使能</el-button>
|
<el-button
|
||||||
<el-button :type="buttonTypes[$index]?.flicker || 'info'" @click="toggleType(row, $index, 'flicker')">闪变使能</el-button>
|
:type="buttonTypes[$index].channel || 'info'"
|
||||||
<el-button :type="buttonTypes[$index]?.transient || 'info'" @click="toggleType(row, $index, 'transient')">暂态使能</el-button>
|
@click="toggleType(row, $index, 'channel')"
|
||||||
</template>
|
>
|
||||||
</el-table-column>
|
通道使能
|
||||||
</el-table>
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
:type="buttonTypes[$index]?.harmonic || 'info'"
|
||||||
|
@click="toggleType(row, $index, 'harmonic')"
|
||||||
|
>
|
||||||
|
谐波使能
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
:type="buttonTypes[$index]?.interHarmonic || 'info'"
|
||||||
|
@click="toggleType(row, $index, 'interHarmonic')"
|
||||||
|
>
|
||||||
|
间谐波使能
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
:type="buttonTypes[$index]?.flicker || 'info'"
|
||||||
|
@click="toggleType(row, $index, 'flicker')"
|
||||||
|
>
|
||||||
|
闪变使能
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
:type="buttonTypes[$index]?.transient || 'info'"
|
||||||
|
@click="toggleType(row, $index, 'transient')"
|
||||||
|
>
|
||||||
|
暂态使能
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
<el-tabs type="border-card" class="right-tabs" style="height: 100%;">
|
<el-tabs type="border-card" class="right-tabs" style="height: 100%">
|
||||||
<el-tab-pane label="全局设置菜单">
|
<el-tab-pane label="全局设置菜单">
|
||||||
<!-- 全局设置菜单内容 -->
|
<!-- 全局设置菜单内容 -->
|
||||||
<div class="form-item-container">
|
<div style="height: 295px;">
|
||||||
<el-form-item label="频率:" prop='name'>
|
<div class="form-item-container">
|
||||||
<div class="input-label-container">
|
<el-form-item label="频率:" prop="name">
|
||||||
<el-input style="width: 100px;" />
|
<div class="input-label-container">
|
||||||
<label>Hz</label>
|
<el-input style="width: 100px" />
|
||||||
|
<label>Hz</label>
|
||||||
|
</div>
|
||||||
|
</el-form-item>
|
||||||
|
</div>
|
||||||
|
<div class="button-label-container">
|
||||||
|
<label>参考设定值列表:</label>
|
||||||
|
<el-button type="primary" :icon="EditPen" @click="openDialog">编辑</el-button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
|
||||||
</div>
|
|
||||||
<div class="button-label-container">
|
|
||||||
<label>参考设定值列表:</label>
|
|
||||||
<el-button type="primary" :icon='EditPen' @click="openDialog">编辑</el-button>
|
|
||||||
</div>
|
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
</div>
|
</div>
|
||||||
<div style="margin-top: 20px;">
|
<div style="margin-top: 10px">
|
||||||
<el-tabs type="border-card" class="custom-tabs">
|
<el-tabs type="border-card" class="custom-tabs">
|
||||||
<el-tab-pane label="电压/电流编辑">
|
<el-tab-pane label="电压/电流编辑">
|
||||||
<TestScriptVolCurTab/>
|
<TestScriptVolCurTab />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="谐波编辑">
|
<el-tab-pane label="谐波编辑">
|
||||||
<TestScriptHarmTab/>
|
<TestScriptHarmTab />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="间谐波编辑">
|
<el-tab-pane label="间谐波编辑">
|
||||||
<TestScriptInHarmTab/>
|
<TestScriptInHarmTab />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="闪变编辑">
|
<el-tab-pane label="闪变编辑">
|
||||||
<TestScriptFlickerTab/>
|
<TestScriptFlickerTab />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="暂态编辑">
|
<el-tab-pane label="暂态编辑">
|
||||||
<TestScriptDipTab/>
|
<TestScriptDipTab />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<SetValueTable ref="setValueTable"/>
|
|
||||||
|
|
||||||
<template #footer>
|
<SetValueTable ref="setValueTable" />
|
||||||
<div >
|
|
||||||
<el-button @click='close()'>取 消</el-button>
|
<template #footer>
|
||||||
<el-button type="primary" @click='save()'>保存</el-button>
|
<div>
|
||||||
</div>
|
<el-button @click="close()">取 消</el-button>
|
||||||
</template>
|
<el-button type="primary" @click="save()">保存</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { dialogBig } from '@/utils/elementBind'
|
import { dialogBig } from '@/utils/elementBind'
|
||||||
import { onMounted, reactive, ref } from 'vue'
|
import { onMounted, reactive, ref } from 'vue'
|
||||||
import SetValueTable from '@/views/machine/testScript/components/setValueTable.vue';
|
import SetValueTable from '@/views/machine/testScript/components/setValueTable.vue'
|
||||||
import {EditPen,ArrowDown, Bottom} from '@element-plus/icons-vue'
|
import { EditPen, ArrowDown, Bottom } from '@element-plus/icons-vue'
|
||||||
import { type TabsInstance } from 'element-plus';
|
import { type TabsInstance } from 'element-plus'
|
||||||
import TestScriptVolCurTab from '@/views/machine/testScript/components/testScriptVolCurTab.vue';
|
import TestScriptVolCurTab from '@/views/machine/testScript/components/testScriptVolCurTab.vue'
|
||||||
import TestScriptHarmTab from '@/views/machine/testScript/components/testScriptHarmTab.vue';
|
import TestScriptHarmTab from '@/views/machine/testScript/components/testScriptHarmTab.vue'
|
||||||
import TestScriptInHarmTab from '@/views/machine/testScript/components/testScriptInHarmTab.vue';
|
import TestScriptInHarmTab from '@/views/machine/testScript/components/testScriptInHarmTab.vue'
|
||||||
import TestScriptFlickerTab from '@/views/machine/testScript/components/testScriptFlickerTab.vue';
|
import TestScriptFlickerTab from '@/views/machine/testScript/components/testScriptFlickerTab.vue'
|
||||||
import TestScriptDipTab from '@/views/machine/testScript/components/testScriptDipTab.vue';
|
import TestScriptDipTab from '@/views/machine/testScript/components/testScriptDipTab.vue'
|
||||||
|
|
||||||
|
|
||||||
const dialogVisible = ref(false)
|
const dialogVisible = ref(false)
|
||||||
const dialogTitle = ref()
|
const dialogTitle = ref()
|
||||||
const setValueTable = ref()
|
const setValueTable = ref()
|
||||||
const buttonTypeOptions = ['default', 'text', 'success', 'warning', 'info', 'primary', 'danger'] as const;
|
const buttonTypeOptions = ['default', 'text', 'success', 'warning', 'info', 'primary', 'danger'] as const
|
||||||
type ButtonType = typeof buttonTypeOptions[number];
|
type ButtonType = (typeof buttonTypeOptions)[number]
|
||||||
// 初始化按钮类型
|
// 初始化按钮类型
|
||||||
const buttonTypes = reactive<{ [key: number]: { channel: ButtonType, harmonic: ButtonType, interHarmonic: ButtonType, flicker: ButtonType, transient: ButtonType } }>({});
|
const buttonTypes = reactive<{
|
||||||
|
[key: number]: {
|
||||||
|
channel: ButtonType
|
||||||
|
harmonic: ButtonType
|
||||||
|
interHarmonic: ButtonType
|
||||||
|
flicker: ButtonType
|
||||||
|
transient: ButtonType
|
||||||
|
}
|
||||||
|
}>({})
|
||||||
|
|
||||||
const tableData= [
|
const tableData = [
|
||||||
{ sort: 'L1', frequency: 'V', L1: '电压:57.75V 相角:0°'},
|
{ sort: 'L1', frequency: 'V', L1: '电压:57.75V 相角:0°' },
|
||||||
{ sort: 'L1', frequency: 'I', L1: '电压:57.75V 相角:0°'},
|
{ sort: 'L1', frequency: 'I', L1: '电压:57.75V 相角:0°' },
|
||||||
{ sort: 'L2', frequency: 'V', L1: '电压:57.75V 相角:0°'},
|
{ sort: 'L2', frequency: 'V', L1: '电压:57.75V 相角:0°' },
|
||||||
{ sort: 'L2', frequency: 'I', L1: '电压:57.75V 相角:0°'},
|
{ sort: 'L2', frequency: 'I', L1: '电压:57.75V 相角:0°' },
|
||||||
{ sort: 'L3', frequency: 'V', L1: '电压:57.75V 相角:0°'},
|
{ sort: 'L3', frequency: 'V', L1: '电压:57.75V 相角:0°' },
|
||||||
{ sort: 'L3', frequency: 'I', L1: '电压:57.75V 相角:0°'},
|
{ sort: 'L3', frequency: 'I', L1: '电压:57.75V 相角:0°' }
|
||||||
]
|
]
|
||||||
|
|
||||||
// 定义 span-method 逻辑
|
// 定义 span-method 逻辑
|
||||||
const arraySpanMethod = ({ rowIndex, columnIndex }: { rowIndex: number; columnIndex: number }) => {
|
const arraySpanMethod = ({ rowIndex, columnIndex }: { rowIndex: number; columnIndex: number }) => {
|
||||||
if (columnIndex === 0 || columnIndex === 3) { // 第一列
|
if (columnIndex === 0 || columnIndex === 3) {
|
||||||
if (rowIndex % 2 === 0) {
|
// 第一列
|
||||||
return {
|
if (rowIndex % 2 === 0) {
|
||||||
rowspan: 2,
|
return {
|
||||||
colspan: 1
|
rowspan: 2,
|
||||||
};
|
colspan: 1
|
||||||
} else {
|
}
|
||||||
return {
|
} else {
|
||||||
rowspan: 0,
|
return {
|
||||||
colspan: 0
|
rowspan: 0,
|
||||||
};
|
colspan: 0
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// 切换按钮类型
|
// 切换按钮类型
|
||||||
const toggleType = (row: any, $index: number, buttonType: 'channel' | 'harmonic' | 'interHarmonic' | 'flicker' | 'transient') => {
|
const toggleType = (
|
||||||
if ($index !== undefined) {
|
row: any,
|
||||||
const currentType = buttonTypes[$index][buttonType];
|
$index: number,
|
||||||
buttonTypes[$index][buttonType] = currentType === 'info' ? 'primary' : 'info';
|
buttonType: 'channel' | 'harmonic' | 'interHarmonic' | 'flicker' | 'transient'
|
||||||
}
|
) => {
|
||||||
};
|
if ($index !== undefined) {
|
||||||
|
const currentType = buttonTypes[$index][buttonType]
|
||||||
|
buttonTypes[$index][buttonType] = currentType === 'info' ? 'primary' : 'info'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 关闭弹窗
|
// 关闭弹窗
|
||||||
const close = () => {
|
const close = () => {
|
||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
// 保存数据
|
// 保存数据
|
||||||
const save = () => {
|
const save = () => {}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 打开弹窗,可能是新增,也可能是编辑
|
// 打开弹窗,可能是新增,也可能是编辑
|
||||||
const open = (sign: string,row: any) => {
|
const open = (sign: string, row: any) => {
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
dialogTitle.value = sign === 'add'? '新增检测项目信息' : '编辑检测项目信息'
|
dialogTitle.value = sign === 'add' ? '新增检测项目信息' : '编辑检测项目信息'
|
||||||
|
|
||||||
// 初始化按钮类型
|
// 初始化按钮类型
|
||||||
tableData.forEach((_, index) => {
|
tableData.forEach((_, index) => {
|
||||||
buttonTypes[index] = {
|
buttonTypes[index] = {
|
||||||
channel: 'info',
|
channel: 'info',
|
||||||
harmonic: 'info',
|
harmonic: 'info',
|
||||||
interHarmonic: 'info',
|
interHarmonic: 'info',
|
||||||
flicker: 'info',
|
flicker: 'info',
|
||||||
transient: 'info'
|
transient: 'info'
|
||||||
};
|
}
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 打开 drawer(新增、编辑)
|
// 打开 drawer(新增、编辑)
|
||||||
const openDialog = () => {
|
const openDialog = () => {
|
||||||
setValueTable.value?.open()
|
setValueTable.value?.open()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 对外映射
|
// 对外映射
|
||||||
defineExpose({ open })
|
defineExpose({ open })
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.dialog-content {
|
.dialog-content {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
align-items: stretch;
|
align-items: stretch;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tabs-container {
|
.tabs-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.left-tabs {
|
.left-tabs {
|
||||||
flex: 3; /* 左侧 tab 占据 3/4 的宽度 */
|
flex: 3; /* 左侧 tab 占据 3/4 的宽度 */
|
||||||
margin-right: 10px; /* 可选:添加间距 */
|
margin-right: 10px; /* 可选:添加间距 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.right-tabs {
|
.right-tabs {
|
||||||
flex: 1; /* 右侧 tab 占据 1/4 的宽度 */
|
flex: 1; /* 右侧 tab 占据 1/4 的宽度 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-item-container {
|
.form-item-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center; /* 水平居中 */
|
justify-content: center; /* 水平居中 */
|
||||||
margin-bottom: 10px; /* 可选:添加间距 */
|
margin-bottom: 10px; /* 可选:添加间距 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.button-label-container {
|
.button-label-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center; /* 水平居中 */
|
justify-content: center; /* 水平居中 */
|
||||||
align-items: center; /* 垂直居中 */
|
align-items: center; /* 垂直居中 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.button-label-container label {
|
.button-label-container label {
|
||||||
margin-right: 10px; /* 按钮和文字之间的距离 */
|
margin-right: 10px; /* 按钮和文字之间的距离 */
|
||||||
}
|
}
|
||||||
.input-label-container {
|
.input-label-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center; /* 垂直居中对齐 */
|
align-items: center; /* 垂直居中对齐 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.input-label-container label {
|
.input-label-container label {
|
||||||
margin-left: 5px; /* 添加标签与输入框之间的间距 */
|
margin-left: 5px; /* 添加标签与输入框之间的间距 */
|
||||||
}
|
}
|
||||||
|
</style>
|
||||||
</style>
|
|
||||||
|
|||||||
@@ -1,266 +1,288 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="divider-container">
|
<div class="divider-container">
|
||||||
<el-divider style="width: 400px">检测脚本信息</el-divider>
|
<el-divider style="width: 400px">检测脚本信息</el-divider>
|
||||||
<el-divider style="width: 1300px">检测项目概要信息</el-divider>
|
<el-divider style="width: 1300px">检测项目概要信息</el-divider>
|
||||||
</div>
|
</div>
|
||||||
<div class="data-check-content">
|
<div class="data-check-content">
|
||||||
<div class="content-tree" >
|
<div class="content-tree">
|
||||||
<el-tree
|
<Tree />
|
||||||
:default-expanded-keys="['0', '0-1', '0-2', '0-3', '1']"
|
</div>
|
||||||
node-key="id"
|
|
||||||
:data="data"
|
<div class="content-right-Tabs" style="height: 570px; width: 100px">
|
||||||
:props="defaultProps"
|
<el-tabs type="border-card" style="height: 100%">
|
||||||
@node-click="handleNodeClick" />
|
<el-tab-pane
|
||||||
|
v-for="tab in props.options"
|
||||||
|
:key="tab.name"
|
||||||
|
:label="tab.label.replace(/准确度|检测/g, '')"
|
||||||
|
:name="tab.name"
|
||||||
|
>
|
||||||
|
<!-- 频率tab -->
|
||||||
|
<el-tabs type="border-card" style="height: 500px">
|
||||||
|
<el-tab-pane
|
||||||
|
v-for="subTab in tab.children || []"
|
||||||
|
:key="subTab.name"
|
||||||
|
:label="subTab.label"
|
||||||
|
:name="subTab.name"
|
||||||
|
>
|
||||||
|
<!-- 子标签页内容 -->
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button :icon="CirclePlus" type="primary" @click="openDialog('add')">新增</el-button>
|
||||||
|
<el-button :icon="CirclePlus" type="primary" @click="openAddDialog()">
|
||||||
|
保存测试项
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
<div class="table-container">
|
||||||
|
<el-table
|
||||||
|
:data="tableData"
|
||||||
|
:header-cell-style="{
|
||||||
|
textAlign: 'center',
|
||||||
|
backgroundColor: '#003078',
|
||||||
|
color: '#fff'
|
||||||
|
}"
|
||||||
|
:cell-style="{ textAlign: 'center' }"
|
||||||
|
style="width: 100%"
|
||||||
|
:style="{ height: '390px', overflow: 'hidden' }"
|
||||||
|
>
|
||||||
|
<el-table-column prop="sort" label="组次" width="60" />
|
||||||
|
<el-table-column prop="frequency" label="频率(Hz)" width="100" />
|
||||||
|
<el-table-column prop="L1" label="L1">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-descriptions border :column="1" size="small">
|
||||||
|
<el-descriptions-item label="V">0.000V 0.000°</el-descriptions-item>
|
||||||
|
<el-descriptions-item label=" I">0.000A 0.000°</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="L2" label="L2">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-descriptions border :column="1" size="small">
|
||||||
|
<el-descriptions-item label="V">0.000V 0.000°</el-descriptions-item>
|
||||||
|
<el-descriptions-item label=" I">0.000A 0.000°</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="L3" label="L3">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-descriptions border :column="1" size="small">
|
||||||
|
<el-descriptions-item label="V">0.000V 0.000°</el-descriptions-item>
|
||||||
|
<el-descriptions-item label=" I">0.000A 0.000°</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" min-width="100">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-button type="primary" link :icon="CopyDocument" @click="copyRow(row)">
|
||||||
|
复制
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
link
|
||||||
|
:icon="CopyDocument"
|
||||||
|
@click="openAddDialog('edit', row)"
|
||||||
|
>
|
||||||
|
编辑
|
||||||
|
</el-button>
|
||||||
|
<el-button type="primary" link :icon="Delete" @click="deleteRow(row)">
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</div>
|
||||||
|
<!-- <div class="dialog-footer" style="margin-top: 20px;">
|
||||||
|
|
||||||
|
</div> -->
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="content-right-Tabs" style="height: 470px;width: 100px;">
|
|
||||||
<el-tabs type="border-card" style="height: 100%;">
|
|
||||||
<el-tab-pane
|
|
||||||
v-for="tab in props.options"
|
|
||||||
:key="tab.name"
|
|
||||||
:label="tab.label.replace(/准确度|检测/g, '')"
|
|
||||||
:name="tab.name">
|
|
||||||
<!-- 频率tab -->
|
|
||||||
<el-tabs type="border-card" style="height: 400px;">
|
|
||||||
<el-tab-pane
|
|
||||||
v-for="subTab in tab.children || []"
|
|
||||||
:key="subTab.name"
|
|
||||||
:label="subTab.label"
|
|
||||||
:name="subTab.name">
|
|
||||||
<!-- 子标签页内容 -->
|
|
||||||
<div class="dialog-footer">
|
|
||||||
<el-button :icon='CirclePlus' type="primary" @click="openDialog('add')">新增</el-button>
|
|
||||||
</div>
|
|
||||||
<div class="table-container">
|
|
||||||
<el-table :data="tableData"
|
|
||||||
:header-cell-style="{ textAlign: 'center',backgroundColor: '#003078',color: '#fff' } "
|
|
||||||
:cell-style="{ textAlign: 'center' }"
|
|
||||||
style="width: 100%"
|
|
||||||
:style="{ height: '240px',overflow:'hidden'}">
|
|
||||||
<el-table-column prop="sort" label="组次" width="60" />
|
|
||||||
<el-table-column prop="frequency" label="频率(Hz)" width="100" />
|
|
||||||
<el-table-column prop="L1" label="L1"/>
|
|
||||||
<el-table-column prop="L2" label="L2"/>
|
|
||||||
<el-table-column prop="L3" label="L3"/>
|
|
||||||
<el-table-column label="操作" min-width="100">
|
|
||||||
<template #default="{ row }">
|
|
||||||
<el-button type="primary" link :icon='CopyDocument' @click="copyRow(row)">复制</el-button>
|
|
||||||
<el-button type="primary" link :icon='CopyDocument' @click="openAddDialog('edit',row)">编辑</el-button>
|
|
||||||
<el-button type='primary' link :icon='Delete' @click="deleteRow(row)">删除</el-button>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
</div>
|
|
||||||
<div class="dialog-footer" style="margin-top: 20px;">
|
|
||||||
<el-button :icon='CirclePlus' type="primary" @click="openAddDialog()">保存测试项</el-button>
|
|
||||||
</div>
|
|
||||||
</el-tab-pane>
|
|
||||||
</el-tabs>
|
|
||||||
</el-tab-pane>
|
|
||||||
</el-tabs>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<TestProjectPopup ref="testProjectPopup" />
|
<TestProjectPopup ref="testProjectPopup" />
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { type PropType, ref } from 'vue';
|
import { type PropType, ref } from 'vue'
|
||||||
import { data } from "@/api/plan/autoTest.json";
|
import Tree from './tree.vue'
|
||||||
import type { CascaderOption } from 'element-plus';
|
import type { CascaderOption } from 'element-plus'
|
||||||
import {CirclePlus, Delete, EditPen,CopyDocument} from '@element-plus/icons-vue'
|
import { CirclePlus, Delete, EditPen, CopyDocument } from '@element-plus/icons-vue'
|
||||||
import type { TestScript } from '@/api/device/interface/testScript';
|
import type { TestScript } from '@/api/device/interface/testScript'
|
||||||
import TestProjectPopup from '@/views/machine/testScript/components/testProjectPopup.vue';
|
import TestProjectPopup from '@/views/machine/testScript/components/testProjectPopup.vue'
|
||||||
|
|
||||||
const testProjectPopup = ref()
|
const testProjectPopup = ref()
|
||||||
|
|
||||||
interface TabOption {
|
interface TabOption {
|
||||||
label: string;
|
label: string
|
||||||
name: string;
|
name: string
|
||||||
children?: TabOption[];
|
children?: TabOption[]
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
options: {
|
options: {
|
||||||
type: Array as PropType<TabOption[]>,
|
type: Array as PropType<TabOption[]>,
|
||||||
required: true
|
required: true
|
||||||
},
|
}
|
||||||
});
|
})
|
||||||
|
|
||||||
const tableData= [
|
|
||||||
{ sort: 1, frequency: 42.5, L1: '电压:57.75V 相角:0°', L2: '电压:57.75V 相角:120°', L3: '电压:57.75V 相角:-120°' },
|
|
||||||
{ sort: 2, frequency: 50, L1: '电压:57.75V 相角:0°', L2: '电压:57.75V 相角:120°', L3: '电压:57.75V 相角:-120°' },
|
|
||||||
{ sort: 3, frequency: 50.05, L1: '电压:57.75V 相角:0°', L2: '电压:57.75V 相角:120°', L3: '电压:57.75V 相角:-120°' },
|
|
||||||
{ sort: 4, frequency: 57.5, L1: '电压:57.75V 相角:0°', L2: '电压:57.75V 相角:120°', L3: '电压:57.75V 相角:-120°' },
|
|
||||||
{ sort: 5, frequency: 57.5, L1: '电压:57.75V 相角:0°', L2: '电压:57.75V 相角:120°', L3: '电压:57.75V 相角:-120°' },
|
|
||||||
{ sort: 6, frequency: 57.5, L1: '电压:57.75V 相角:0°', L2: '电压:57.75V 相角:120°', L3: '电压:57.75V 相角:-120°' },
|
|
||||||
]
|
|
||||||
|
|
||||||
|
const tableData = [
|
||||||
|
{ sort: 1, frequency: 42.5, L1: '电压:57.75V 相角:0°', L2: '电压:57.75V 相角:120°', L3: '电压:57.75V 相角:-120°' },
|
||||||
|
{ sort: 2, frequency: 50, L1: '电压:57.75V 相角:0°', L2: '电压:57.75V 相角:120°', L3: '电压:57.75V 相角:-120°' },
|
||||||
|
{ sort: 3, frequency: 50.05, L1: '电压:57.75V 相角:0°', L2: '电压:57.75V 相角:120°', L3: '电压:57.75V 相角:-120°' },
|
||||||
|
{ sort: 4, frequency: 57.5, L1: '电压:57.75V 相角:0°', L2: '电压:57.75V 相角:120°', L3: '电压:57.75V 相角:-120°' },
|
||||||
|
{ sort: 5, frequency: 57.5, L1: '电压:57.75V 相角:0°', L2: '电压:57.75V 相角:120°', L3: '电压:57.75V 相角:-120°' },
|
||||||
|
{ sort: 6, frequency: 57.5, L1: '电压:57.75V 相角:0°', L2: '电压:57.75V 相角:120°', L3: '电压:57.75V 相角:-120°' }
|
||||||
|
]
|
||||||
|
|
||||||
const tabs = ref([
|
const tabs = ref([
|
||||||
{
|
{
|
||||||
label: '频率',
|
label: '频率',
|
||||||
name: 'resultTab',
|
name: 'resultTab',
|
||||||
subTabs: [
|
subTabs: [
|
||||||
{ label: '额度工作条件下的检测', name: 'quotaConditionTab' },
|
{ label: '额度工作条件下的检测', name: 'quotaConditionTab' },
|
||||||
{ label: '电压对频率测量的影响', name: 'voltageFrequencyImpactTab' },
|
{ label: '电压对频率测量的影响', name: 'voltageFrequencyImpactTab' },
|
||||||
{ label: '谐波对频率测量的影响', name: 'harmonicFrequencyImpactTab' }
|
{ label: '谐波对频率测量的影响', name: 'harmonicFrequencyImpactTab' }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '电压',
|
label: '电压',
|
||||||
name: 'resultTab1',
|
name: 'resultTab1',
|
||||||
subTabs: [
|
subTabs: [
|
||||||
{ label: '额度工作条件下的检测', name: 'quotaConditionTab1' },
|
{ label: '额度工作条件下的检测', name: 'quotaConditionTab1' },
|
||||||
{ label: '电压对频率测量的影响', name: 'voltageFrequencyImpactTab1' },
|
{ label: '电压对频率测量的影响', name: 'voltageFrequencyImpactTab1' },
|
||||||
{ label: '谐波对频率测量的影响', name: 'harmonicFrequencyImpactTab1' }
|
{ label: '谐波对频率测量的影响', name: 'harmonicFrequencyImpactTab1' }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '电流',
|
label: '电流',
|
||||||
name: 'resultTab2',
|
name: 'resultTab2',
|
||||||
subTabs: [
|
subTabs: [
|
||||||
{ label: '额度工作条件下的检测', name: 'quotaConditionTab2' },
|
{ label: '额度工作条件下的检测', name: 'quotaConditionTab2' },
|
||||||
{ label: '电压对频率测量的影响', name: 'voltageFrequencyImpactTab2' },
|
{ label: '电压对频率测量的影响', name: 'voltageFrequencyImpactTab2' },
|
||||||
{ label: '谐波对频率测量的影响', name: 'harmonicFrequencyImpactTab2' }
|
{ label: '谐波对频率测量的影响', name: 'harmonicFrequencyImpactTab2' }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '电压不平衡度',
|
label: '电压不平衡度',
|
||||||
name: 'resultTab3',
|
name: 'resultTab3',
|
||||||
subTabs: [
|
subTabs: [
|
||||||
{ label: '额度工作条件下的检测', name: 'quotaConditionTab3' },
|
{ label: '额度工作条件下的检测', name: 'quotaConditionTab3' },
|
||||||
{ label: '电压对频率测量的影响', name: 'voltageFrequencyImpactTab3' },
|
{ label: '电压对频率测量的影响', name: 'voltageFrequencyImpactTab3' },
|
||||||
{ label: '谐波对频率测量的影响', name: 'harmonicFrequencyImpactTab3' }
|
{ label: '谐波对频率测量的影响', name: 'harmonicFrequencyImpactTab3' }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '电流不平衡度',
|
label: '电流不平衡度',
|
||||||
name: 'resultTab4',
|
name: 'resultTab4',
|
||||||
subTabs: [
|
subTabs: [
|
||||||
{ label: '额度工作条件下的检测', name: 'quotaConditionTab4' },
|
{ label: '额度工作条件下的检测', name: 'quotaConditionTab4' },
|
||||||
{ label: '电压对频率测量的影响', name: 'voltageFrequencyImpactTab4' },
|
{ label: '电压对频率测量的影响', name: 'voltageFrequencyImpactTab4' },
|
||||||
{ label: '谐波对频率测量的影响', name: 'harmonicFrequencyImpactTab4' }
|
{ label: '谐波对频率测量的影响', name: 'harmonicFrequencyImpactTab4' }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '谐波电压',
|
label: '谐波电压',
|
||||||
name: 'resultTab5',
|
name: 'resultTab5',
|
||||||
subTabs: [
|
subTabs: [
|
||||||
{ label: '额度工作条件下的检测', name: 'quotaConditionTab5' },
|
{ label: '额度工作条件下的检测', name: 'quotaConditionTab5' },
|
||||||
{ label: '电压对频率测量的影响', name: 'voltageFrequencyImpactTab5' },
|
{ label: '电压对频率测量的影响', name: 'voltageFrequencyImpactTab5' },
|
||||||
{ label: '谐波对频率测量的影响', name: 'harmonicFrequencyImpactTab5' }
|
{ label: '谐波对频率测量的影响', name: 'harmonicFrequencyImpactTab5' }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '谐波电流',
|
label: '谐波电流',
|
||||||
name: 'resultTab6',
|
name: 'resultTab6',
|
||||||
subTabs: [
|
subTabs: [
|
||||||
{ label: '额度工作条件下的检测', name: 'quotaConditionTab6' },
|
{ label: '额度工作条件下的检测', name: 'quotaConditionTab6' },
|
||||||
{ label: '电压对频率测量的影响', name: 'voltageFrequencyImpactTab6' },
|
{ label: '电压对频率测量的影响', name: 'voltageFrequencyImpactTab6' },
|
||||||
{ label: '谐波对频率测量的影响', name: 'harmonicFrequencyImpactTab6' }
|
{ label: '谐波对频率测量的影响', name: 'harmonicFrequencyImpactTab6' }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '间谐波电压',
|
label: '间谐波电压',
|
||||||
name: 'resultTab7',
|
name: 'resultTab7',
|
||||||
subTabs: [
|
subTabs: [
|
||||||
{ label: '额度工作条件下的检测', name: 'quotaConditionTab7' },
|
{ label: '额度工作条件下的检测', name: 'quotaConditionTab7' },
|
||||||
{ label: '电压对频率测量的影响', name: 'voltageFrequencyImpactTab7' },
|
{ label: '电压对频率测量的影响', name: 'voltageFrequencyImpactTab7' },
|
||||||
{ label: '谐波对频率测量的影响', name: 'harmonicFrequencyImpactTab7' }
|
{ label: '谐波对频率测量的影响', name: 'harmonicFrequencyImpactTab7' }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '间谐波电流',
|
label: '间谐波电流',
|
||||||
name: 'resultTab8',
|
name: 'resultTab8',
|
||||||
subTabs: [
|
subTabs: [
|
||||||
{ label: '额度工作条件下的检测', name: 'quotaConditionTab8' },
|
{ label: '额度工作条件下的检测', name: 'quotaConditionTab8' },
|
||||||
{ label: '电压对频率测量的影响', name: 'voltageFrequencyImpactTab8' },
|
{ label: '电压对频率测量的影响', name: 'voltageFrequencyImpactTab8' },
|
||||||
{ label: '谐波对频率测量的影响', name: 'harmonicFrequencyImpactTab8' }
|
{ label: '谐波对频率测量的影响', name: 'harmonicFrequencyImpactTab8' }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '电压暂升暂降',
|
label: '电压暂升暂降',
|
||||||
name: 'resultTab9',
|
name: 'resultTab9',
|
||||||
subTabs: [
|
subTabs: [
|
||||||
{ label: '额度工作条件下的检测', name: 'quotaConditionTab9' },
|
{ label: '额度工作条件下的检测', name: 'quotaConditionTab9' },
|
||||||
{ label: '电压对频率测量的影响', name: 'voltageFrequencyImpactTab9' },
|
{ label: '电压对频率测量的影响', name: 'voltageFrequencyImpactTab9' },
|
||||||
{ label: '谐波对频率测量的影响', name: 'harmonicFrequencyImpactTab9' }
|
{ label: '谐波对频率测量的影响', name: 'harmonicFrequencyImpactTab9' }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '闪变',
|
label: '闪变',
|
||||||
name: 'resultTab10',
|
name: 'resultTab10',
|
||||||
subTabs: [
|
subTabs: [
|
||||||
{ label: '额度工作条件下的检测', name: 'quotaConditionTab10' },
|
{ label: '额度工作条件下的检测', name: 'quotaConditionTab10' },
|
||||||
{ label: '电压对频率测量的影响', name: 'voltageFrequencyImpactTab10' },
|
{ label: '电压对频率测量的影响', name: 'voltageFrequencyImpactTab10' },
|
||||||
{ label: '谐波对频率测量的影响', name: 'harmonicFrequencyImpactTab10' }
|
{ label: '谐波对频率测量的影响', name: 'harmonicFrequencyImpactTab10' }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]);
|
])
|
||||||
|
|
||||||
|
|
||||||
const defaultProps = {
|
|
||||||
children: "children",
|
|
||||||
label: "name",
|
|
||||||
pid: "pid",
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleNodeClick = (data: any) => {
|
|
||||||
console.log(data);
|
|
||||||
};
|
|
||||||
|
|
||||||
// 打开 drawer(新增、编辑)
|
// 打开 drawer(新增、编辑)
|
||||||
const openDialog = (titleType: string, row: Partial<TestScript.ResTestScript> = {}) => {
|
const openDialog = (titleType: string, row: Partial<TestScript.ResTestScript> = {}) => {
|
||||||
testProjectPopup.value?.open(titleType, row)
|
testProjectPopup.value?.open(titleType, row)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.data-check-content {
|
.data-check-content {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.content-tree {
|
.content-tree {
|
||||||
width: 300px;
|
width: 300px;
|
||||||
height: 470px;
|
height: 560px;
|
||||||
border: 1px solid #dcdfe6;
|
border: 1px solid #dcdfe6;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
overflow: auto; /* 同时启用垂直和水平滚动 */
|
overflow: auto; /* 同时启用垂直和水平滚动 */
|
||||||
overflow-x: auto; /* 确保水平滚动条生效 */
|
overflow-x: auto; /* 确保水平滚动条生效 */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 确保 el-tree 内容可以超出容器宽度 */
|
/* 确保 el-tree 内容可以超出容器宽度 */
|
||||||
.el-tree {
|
.el-tree {
|
||||||
width: fit-content; /* 根据内容自适应宽度 */
|
width: fit-content; /* 根据内容自适应宽度 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.content-right-Tabs {
|
.content-right-Tabs {
|
||||||
flex: 1; /* 根据需要调整宽度比例 */
|
flex: 1; /* 根据需要调整宽度比例 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.dialog-footer{
|
.dialog-footer {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.divider-container {
|
.divider-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.divider-container .el-divider {
|
.divider-container .el-divider {
|
||||||
margin-right: 30px; /* 根据需要调整间距 */
|
margin-right: 30px; /* 根据需要调整间距 */
|
||||||
|
}
|
||||||
|
:deep(.el-descriptions__body .el-descriptions__table:not(.is-bordered) .el-descriptions__cell) {
|
||||||
|
padding: 3px 11px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -6,18 +6,19 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="right-editor">
|
<div class="right-editor">
|
||||||
<!-- 右侧编辑区域内容 -->
|
<!-- 右侧编辑区域内容 -->
|
||||||
<el-form-item label="设定幅度(%)">
|
<el-form-item label-width="120px" label="设定幅度(%)">
|
||||||
<el-input v-model="input1" />
|
<el-input v-model="input1" style="width: 150px;" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="持续时间(周波)">
|
<el-form-item label-width="120px" label="持续时间(周波)">
|
||||||
<el-input v-model="input2" />
|
<el-input v-model="input2" style="width: 150px;"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
const input1 = ref('')
|
||||||
|
const input2 = ref('')
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
@@ -4,13 +4,13 @@
|
|||||||
<el-tab-pane label="Modulation">
|
<el-tab-pane label="Modulation">
|
||||||
<!-- 全局设置菜单内容 -->
|
<!-- 全局设置菜单内容 -->
|
||||||
<div>
|
<div>
|
||||||
<el-form-item label="电压变动幅度(%)" prop='name'>
|
<el-form-item label="电压变动幅度(%)" label-width="140px" prop='name'>
|
||||||
<el-input style="width: 200px;" />
|
<el-input style="width: 150px;"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-container">
|
<div class="form-container">
|
||||||
<el-form-item label="波动频度(/min/Hz)" prop='name'>
|
<el-form-item label="波动频度(/min/Hz)" label-width="140px" prop='name'>
|
||||||
<el-input />
|
<el-input style="width: 150px;"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="波动类型" prop='name'>
|
<el-form-item label="波动类型" prop='name'>
|
||||||
<el-select placeholder="请选择波动类型" style="width: 150px;">
|
<el-select placeholder="请选择波动类型" style="width: 150px;">
|
||||||
@@ -25,8 +25,8 @@
|
|||||||
<el-tab-pane label="WaveForm">
|
<el-tab-pane label="WaveForm">
|
||||||
<!-- 全局设置菜单内容 -->
|
<!-- 全局设置菜单内容 -->
|
||||||
<div >
|
<div >
|
||||||
<el-form-item label="波类型" prop='name'>
|
<el-form-item label="波类型" label-width="100px" prop='name'>
|
||||||
<el-select placeholder="请选择波类型">
|
<el-select placeholder="请选择波类型" style="width: 150px;">
|
||||||
<el-option label="RECT" :value="2"></el-option>
|
<el-option label="RECT" :value="2"></el-option>
|
||||||
<el-option label="SIN" :value="1"></el-option>
|
<el-option label="SIN" :value="1"></el-option>
|
||||||
<el-option label="SQU" :value="0"></el-option>
|
<el-option label="SQU" :value="0"></el-option>
|
||||||
@@ -34,8 +34,8 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</div>
|
</div>
|
||||||
<div >
|
<div >
|
||||||
<el-form-item label="占空比(%)" prop='name'>
|
<el-form-item label="占空比(%)" label-width="100px" prop='name'>
|
||||||
<el-input />
|
<el-input style="width: 150px;"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</div>
|
</div>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
|
|||||||
@@ -1,166 +1,166 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="tabs-container">
|
<div class="tabs-container">
|
||||||
<el-tabs type="border-card" class="right-tabs" style="height: 100%;">
|
<el-tabs type="border-card" class="right-tabs" style="height: 100%">
|
||||||
<el-tab-pane label="电压通道">
|
<el-tab-pane label="电压通道">
|
||||||
<!-- 电压通道内容 -->
|
<!-- 电压通道内容 -->
|
||||||
<div class="table-container">
|
<div class="table-container">
|
||||||
<el-table :data="tableData1" border class="half-width-table">
|
<el-table :data="tableData1" border size="small" class="half-width-table">
|
||||||
<el-table-column prop="date" label="次数" width="60"/>
|
<el-table-column prop="date" align="center" label="次数" width="60" />
|
||||||
<el-table-column prop="date" label="谐波含有率" width="120">
|
<el-table-column prop="date" align="center" label="谐波含有率" width="120">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<div class="input-label-container">
|
<div class="input-label-container">
|
||||||
<el-input />
|
<el-input size="small" />
|
||||||
<label>%</label>
|
<label>%</label>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="name" label="谐波相角" align="center" width="120">
|
||||||
|
<template #default="scope">
|
||||||
|
<div class="input-label-container">
|
||||||
|
<el-input size="small" />
|
||||||
|
<label>°</label>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<el-table :data="tableData2" border size="small" class="half-width-table">
|
||||||
|
<el-table-column prop="date" label="次数" align="center" width="60" />
|
||||||
|
<el-table-column prop="date" label="谐波含有率" align="center" width="120">
|
||||||
|
<template #default="scope">
|
||||||
|
<div class="input-label-container">
|
||||||
|
<el-input size="small" />
|
||||||
|
<label>%</label>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="name" label="谐波相角" align="center" width="120">
|
||||||
|
<template #default="scope">
|
||||||
|
<div class="input-label-container">
|
||||||
|
<el-input size="small" />
|
||||||
|
<label>°</label>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</el-tab-pane>
|
||||||
</el-table-column>
|
</el-tabs>
|
||||||
<el-table-column prop="name" label="谐波相角" width="120">
|
<el-tabs type="border-card" style="height: 100%">
|
||||||
<template #default="scope">
|
<el-tab-pane label="电流通道">
|
||||||
<div class="input-label-container">
|
<!-- 电流通道内容 -->
|
||||||
<el-input />
|
<div class="table-container">
|
||||||
<label>°</label>
|
<el-table :data="tableData1" border size="small" class="half-width-table">
|
||||||
|
<el-table-column prop="date" label="次数" align="center" width="60" />
|
||||||
|
<el-table-column prop="date" label="谐波含有率" align="center" width="120">
|
||||||
|
<template #default="scope">
|
||||||
|
<div class="input-label-container">
|
||||||
|
<el-input size="small" />
|
||||||
|
<label>%</label>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="name" align="center" label="谐波相角" width="120">
|
||||||
|
<template #default="scope">
|
||||||
|
<div class="input-label-container">
|
||||||
|
<el-input size="small" />
|
||||||
|
<label>°</label>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<el-table :data="tableData2" border size="small" class="half-width-table">
|
||||||
|
<el-table-column prop="date" label="次数" align="center" width="60" />
|
||||||
|
<el-table-column prop="date" label="谐波含有率" align="center" width="120">
|
||||||
|
<template #default="scope">
|
||||||
|
<div class="input-label-container">
|
||||||
|
<el-input size="small" />
|
||||||
|
<label>%</label>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="name" label="谐波相角" align="center" width="120">
|
||||||
|
<template #default="scope">
|
||||||
|
<div class="input-label-container">
|
||||||
|
<el-input size="small" />
|
||||||
|
<label>°</label>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</el-tab-pane>
|
||||||
</el-table-column>
|
</el-tabs>
|
||||||
</el-table>
|
|
||||||
<el-table :data="tableData2" border class="half-width-table">
|
|
||||||
<el-table-column prop="date" label="次数" width="60"/>
|
|
||||||
<el-table-column prop="date" label="谐波含有率" width="120">
|
|
||||||
<template #default="scope">
|
|
||||||
<div class="input-label-container">
|
|
||||||
<el-input />
|
|
||||||
<label>%</label>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column prop="name" label="谐波相角" width="120">
|
|
||||||
<template #default="scope">
|
|
||||||
<div class="input-label-container">
|
|
||||||
<el-input />
|
|
||||||
<label>°</label>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
</div>
|
|
||||||
</el-tab-pane>
|
|
||||||
</el-tabs>
|
|
||||||
<el-tabs type="border-card" style="height: 100%;">
|
|
||||||
<el-tab-pane label="电流通道">
|
|
||||||
<!-- 电流通道内容 -->
|
|
||||||
<div class="table-container">
|
|
||||||
<el-table :data="tableData1" border class="half-width-table">
|
|
||||||
<el-table-column prop="date" label="次数" width="60"/>
|
|
||||||
<el-table-column prop="date" label="谐波含有率" width="120">
|
|
||||||
<template #default="scope">
|
|
||||||
<div class="input-label-container">
|
|
||||||
<el-input />
|
|
||||||
<label>%</label>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column prop="name" label="谐波相角" width="120">
|
|
||||||
<template #default="scope">
|
|
||||||
<div class="input-label-container">
|
|
||||||
<el-input />
|
|
||||||
<label>°</label>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
<el-table :data="tableData2" border class="half-width-table">
|
|
||||||
<el-table-column prop="date" label="次数" width="60"/>
|
|
||||||
<el-table-column prop="date" label="谐波含有率" width="120">
|
|
||||||
<template #default="scope">
|
|
||||||
<div class="input-label-container">
|
|
||||||
<el-input />
|
|
||||||
<label>%</label>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column prop="name" label="谐波相角" width="120">
|
|
||||||
<template #default="scope">
|
|
||||||
<div class="input-label-container">
|
|
||||||
<el-input />
|
|
||||||
<label>°</label>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
</div>
|
|
||||||
</el-tab-pane>
|
|
||||||
</el-tabs>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from "vue";
|
import { ref } from 'vue'
|
||||||
|
|
||||||
// 定义表格数据项的类型
|
// 定义表格数据项的类型
|
||||||
interface TableItem {
|
interface TableItem {
|
||||||
date: string;
|
date: string
|
||||||
harmonicRate?: string;
|
harmonicRate?: string
|
||||||
harmonicPhase?: string;
|
harmonicPhase?: string
|
||||||
name?: string;
|
name?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
// 定义并初始化 tableData
|
// 定义并初始化 tableData
|
||||||
const tableData1 = ref<TableItem[]>([]);
|
const tableData1 = ref<TableItem[]>([])
|
||||||
const tableData2 = ref<TableItem[]>([]);
|
const tableData2 = ref<TableItem[]>([])
|
||||||
|
|
||||||
for (let i = 1; i <= 25; i++) {
|
for (let i = 1; i <= 25; i++) {
|
||||||
tableData1.value.push({
|
tableData1.value.push({
|
||||||
date: i.toString(),
|
date: i.toString(),
|
||||||
harmonicRate: `谐波含有率${i}`,
|
harmonicRate: `谐波含有率${i}`,
|
||||||
harmonicPhase: `谐波相角${i}`
|
harmonicPhase: `谐波相角${i}`
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
for (let i = 26; i <= 50; i++) {
|
for (let i = 26; i <= 50; i++) {
|
||||||
tableData2.value.push({
|
tableData2.value.push({
|
||||||
date: i.toString(),
|
date: i.toString(),
|
||||||
harmonicRate: `谐波含有率${i}`,
|
harmonicRate: `谐波含有率${i}`,
|
||||||
harmonicPhase: `谐波相角${i}`
|
harmonicPhase: `谐波相角${i}`
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.tabs-container {
|
.tabs-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between; /* 使两个 el-tabs 之间有间距 */
|
justify-content: space-between; /* 使两个 el-tabs 之间有间距 */
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.right-tabs {
|
.right-tabs {
|
||||||
flex: 1; /* 使两个 el-tabs 占据相同的空间 */
|
flex: 1; /* 使两个 el-tabs 占据相同的空间 */
|
||||||
margin-right: 10px; /* 可选:添加右侧间距 */
|
margin-right: 10px; /* 可选:添加右侧间距 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-tabs {
|
.el-tabs {
|
||||||
flex: 1; /* 使两个 el-tabs 占据相同的空间 */
|
flex: 1; /* 使两个 el-tabs 占据相同的空间 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.table-container {
|
.table-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between; /* 使两个表格之间有间距 */
|
justify-content: space-between; /* 使两个表格之间有间距 */
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.half-width-table {
|
.half-width-table {
|
||||||
flex: 1; /* 使两个表格占据相同的空间 */
|
flex: 1; /* 使两个表格占据相同的空间 */
|
||||||
margin-right: 10px; /* 可选:添加表格之间的间距 */
|
margin-right: 10px; /* 可选:添加表格之间的间距 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.half-width-table:last-child {
|
.half-width-table:last-child {
|
||||||
margin-right: 0; /* 最后一个表格不需要右侧间距 */
|
margin-right: 0; /* 最后一个表格不需要右侧间距 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.input-label-container {
|
.input-label-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center; /* 垂直居中对齐 */
|
align-items: center; /* 垂直居中对齐 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.input-label-container label {
|
.input-label-container label {
|
||||||
margin-left: 5px; /* 添加标签与输入框之间的间距 */
|
margin-left: 5px; /* 添加标签与输入框之间的间距 */
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,158 +1,170 @@
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<el-dialog :title="dialogTitle"
|
<el-dialog :title="dialogTitle" v-model="dialogVisible" @close="close" v-bind="dialogBig" width="1400px">
|
||||||
v-model='dialogVisible'
|
<TestScriptDetail :options="secondLevelOptions" />
|
||||||
@close="close"
|
<template #footer>
|
||||||
v-bind="dialogBig"
|
<div>
|
||||||
width="1400px">
|
<el-button @click="close()">取 消</el-button>
|
||||||
<div class="dialog-content" >
|
<el-button type="primary" @click="save()">保存脚本</el-button>
|
||||||
<el-form :model='formContent' label-width="auto" class="form-three ">
|
<!-- <el-button type="primary" @click='save()'>脚本另存为</el-button> -->
|
||||||
<el-divider >基础信息</el-divider>
|
</div>
|
||||||
<el-form-item label="脚本名称" prop='name'>
|
</template>
|
||||||
<el-input v-model='formContent.name' />
|
|
||||||
</el-form-item>
|
<el-dialog
|
||||||
<el-form-item label="参照标准名称" prop='standardName'>
|
title="基础信息"
|
||||||
<el-input v-model='formContent.standardName' />
|
v-model="basicInformation"
|
||||||
</el-form-item>
|
@close="closeInformation"
|
||||||
<el-form-item label="标准推行年份" prop='standardTime'>
|
v-bind="dialogBig"
|
||||||
|
width="500px"
|
||||||
|
>
|
||||||
|
<div class="dialog-content">
|
||||||
|
<el-form :model="formContent" label-width="auto" class="form-one">
|
||||||
|
<el-form-item label="脚本名称" prop="name">
|
||||||
|
<el-input v-model.trim="formContent.name" placeholder="请输入脚本名称" clearable />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="参照标准名称" prop="standardName">
|
||||||
|
<el-input v-model.trim="formContent.standardName" placeholder="请输入参照标准名称" clearable />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="标准推行年份" prop="standardTime">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="formContent.standardTime"
|
v-model="formContent.standardTime"
|
||||||
type="year"
|
type="year"
|
||||||
placeholder="请选择标准推行年份"
|
placeholder="请选择标准推行年份"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
<el-form-item label="检测脚本值类型">
|
||||||
</div>
|
<el-select v-model="formContent.selectedValue" filterable clearable placeholder="请选择值类型">
|
||||||
<TestScriptDetail :options="secondLevelOptions" />
|
<el-option
|
||||||
<template #footer>
|
v-for="item in dictStore.getDictData('Script_Value_Type')"
|
||||||
<div >
|
:key="item.id"
|
||||||
<el-button @click='close()'>取 消</el-button>
|
:label="item.name"
|
||||||
<el-button type="primary" @click='save()'>保存脚本</el-button>
|
:value="item.id"
|
||||||
<el-button type="primary" @click='save()'>脚本另存为</el-button>
|
/>
|
||||||
</div>
|
</el-select>
|
||||||
</template>
|
</el-form-item>
|
||||||
</el-dialog>
|
</el-form>
|
||||||
|
</div>
|
||||||
|
<template #footer>
|
||||||
|
<div>
|
||||||
|
<el-button @click="closeInformation()">取 消</el-button>
|
||||||
|
<el-button type="primary">确定</el-button>
|
||||||
|
<!-- <el-button type="primary" @click='save()'>脚本另存为</el-button> -->
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang='ts'>
|
<script setup lang="ts">
|
||||||
import { dialogBig } from '@/utils/elementBind'
|
import { dialogBig } from '@/utils/elementBind'
|
||||||
import { computed, ref } from 'vue'
|
import { computed, ref } from 'vue'
|
||||||
import { useDictStore } from '@/stores/modules/dict'
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
import TestScriptDetail from '@/views/machine/testScript/components/testScriptDetail.vue';
|
import TestScriptDetail from '@/views/machine/testScript/components/testScriptDetail.vue'
|
||||||
import { type TestScript } from '@/api/device/interface/testScript';
|
import { type TestScript } from '@/api/device/interface/testScript'
|
||||||
import type { Dict } from '@/api/system/dictionary/interface';
|
import type { Dict } from '@/api/system/dictionary/interface'
|
||||||
import {getDictTreeList} from '@/api/system/dictionary/dictTree'
|
import { getDictTreeList } from '@/api/system/dictionary/dictTree'
|
||||||
import type { CascaderOption } from 'element-plus';
|
import type { CascaderOption } from 'element-plus'
|
||||||
const modeId = ref()
|
const modeId = ref()
|
||||||
const secondLevelOptions: any[] = [];
|
const secondLevelOptions: any[] = []
|
||||||
|
const basicInformation: boolean = ref(false)
|
||||||
// 定义弹出组件元信息
|
// 定义弹出组件元信息
|
||||||
const dialogFormRef = ref()
|
const dialogFormRef = ref()
|
||||||
const dictStore = useDictStore()
|
const dictStore = useDictStore()
|
||||||
function useMetaInfo() {
|
function useMetaInfo() {
|
||||||
const dialogVisible = ref(false)
|
const dialogVisible = ref(false)
|
||||||
const titleType = ref('add')
|
const titleType = ref('add')
|
||||||
const formContent = ref<TestScript.ResTestScript>({
|
const formContent = ref<TestScript.ResTestScript>({
|
||||||
name: '',
|
name: '',
|
||||||
type: '',
|
type: '',
|
||||||
valueType:'',
|
valueType: '',
|
||||||
pattern: modeId.value,
|
pattern: modeId.value,
|
||||||
standardName: '',
|
standardName: '',
|
||||||
standardTime: '',
|
standardTime: '',
|
||||||
state:1,
|
state: 1,
|
||||||
|
selectedValue: ''
|
||||||
})
|
})
|
||||||
return { dialogVisible, titleType,formContent }
|
return { dialogVisible, titleType, formContent }
|
||||||
}
|
}
|
||||||
|
|
||||||
const { dialogVisible, titleType,formContent } = useMetaInfo()
|
|
||||||
|
|
||||||
let dialogTitle = computed(() => {
|
const { dialogVisible, titleType, formContent } = useMetaInfo()
|
||||||
|
|
||||||
|
let dialogTitle = computed(() => {
|
||||||
return titleType.value === 'add' ? '新增检测脚本' : '编辑检测脚本'
|
return titleType.value === 'add' ? '新增检测脚本' : '编辑检测脚本'
|
||||||
})
|
})
|
||||||
|
|
||||||
// 清空formContent
|
// 清空formContent
|
||||||
const resetFormContent = () => {
|
const resetFormContent = () => {
|
||||||
formContent.value = {
|
formContent.value = {
|
||||||
name: '',
|
name: '',
|
||||||
type: '',
|
type: '',
|
||||||
valueType:'',
|
valueType: '',
|
||||||
pattern: modeId.value,
|
pattern: modeId.value,
|
||||||
standardName: '',
|
standardName: '',
|
||||||
standardTime: '',
|
standardTime: '',
|
||||||
state:1,
|
state: 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 关闭弹窗
|
// 关闭弹窗
|
||||||
const close = () => {
|
const close = () => {
|
||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
// 清空dialogForm中的值
|
// 清空dialogForm中的值
|
||||||
resetFormContent()
|
resetFormContent()
|
||||||
// 重置表单
|
// 重置表单
|
||||||
dialogFormRef.value?.resetFields()
|
dialogFormRef.value?.resetFields()
|
||||||
|
}
|
||||||
}
|
// 关闭信息弹框
|
||||||
|
const closeInformation = () => {
|
||||||
// 保存数据
|
basicInformation.value = false
|
||||||
const save = () => {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 保存数据
|
||||||
|
const save = () => {
|
||||||
|
basicInformation.value = true
|
||||||
|
}
|
||||||
|
|
||||||
// 打开弹窗,可能是新增,也可能是编辑
|
// 打开弹窗,可能是新增,也可能是编辑
|
||||||
const open = async (sign: string,row: any,currentMode: string,id:string) => {
|
const open = async (sign: string, row: any, currentMode: string, id: string) => {
|
||||||
const dictCode = '测试脚本字典表'; // 替换为实际需要的字典代码
|
const dictCode = '测试脚本字典表' // 替换为实际需要的字典代码
|
||||||
const resDictTree: Dict.ResDictTree = {
|
const resDictTree: Dict.ResDictTree = {
|
||||||
name: dictCode,
|
name: dictCode,
|
||||||
id: '',
|
id: '',
|
||||||
pid: '',
|
pid: '',
|
||||||
pids: '',
|
pids: '',
|
||||||
code: '',
|
code: '',
|
||||||
sort: 0
|
sort: 0
|
||||||
};
|
}
|
||||||
const result = await getDictTreeList(resDictTree);
|
const result = await getDictTreeList(resDictTree)
|
||||||
//allOptions.value = convertToOptions(result.data as Dict.ResDictTree[]);
|
const allOptions = convertToOptions(result.data as Dict.ResDictTree[])
|
||||||
const allOptions = convertToOptions(result.data as Dict.ResDictTree[]);
|
|
||||||
// 提取第二层节点
|
|
||||||
allOptions.forEach(option => {
|
|
||||||
if (option.children && option.children.length > 0) {
|
|
||||||
secondLevelOptions.push(...option.children);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
//console.log('secondLevelOptions',secondLevelOptions);
|
secondLevelOptions.push(...(allOptions[0]?.children || []))
|
||||||
|
|
||||||
if(id != ''){//新增的时候才会重新赋值值类型
|
//console.log('secondLevelOptions',secondLevelOptions);
|
||||||
formContent.value.valueType = id
|
|
||||||
|
if (id != '') {
|
||||||
|
//新增的时候才会重新赋值值类型
|
||||||
|
formContent.value.valueType = id
|
||||||
}
|
}
|
||||||
titleType.value = sign
|
titleType.value = sign
|
||||||
modeId.value = dictStore.getDictData('Pattern').find(item => item.name === currentMode)?.id;
|
modeId.value = dictStore.getDictData('Pattern').find(item => item.name === currentMode)?.id
|
||||||
|
|
||||||
|
|
||||||
// 重置表单
|
// 重置表单
|
||||||
dialogFormRef.value?.resetFields()
|
dialogFormRef.value?.resetFields()
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// 转换函数
|
// 转换函数
|
||||||
const convertToOptions = (dictTree: Dict.ResDictTree[]): CascaderOption[] => {
|
const convertToOptions = (dictTree: Dict.ResDictTree[]): CascaderOption[] => {
|
||||||
return dictTree.map(item => ({
|
return dictTree.map(item => ({
|
||||||
value: item.id,
|
value: item.id,
|
||||||
label: item.name,
|
label: item.name,
|
||||||
children: item.children ? convertToOptions(item.children) : undefined
|
children: item.children ? convertToOptions(item.children) : undefined
|
||||||
}));
|
}))
|
||||||
};
|
}
|
||||||
|
|
||||||
// 对外映射
|
// 对外映射
|
||||||
defineExpose({ open })
|
defineExpose({ open })
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
/* .dialog-content {
|
/* .dialog-content {
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
} */
|
} */
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,120 +1,131 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="editor-container">
|
<div class="editor-container">
|
||||||
<div class="left-editor">
|
<div class="left-editor">
|
||||||
<!-- 左侧编辑区域内容 -->
|
<!-- 左侧编辑区域内容 -->
|
||||||
<canvas ref="canvas" width="600" height="165"></canvas>
|
<canvas ref="canvas" width="700" height="165"></canvas>
|
||||||
|
</div>
|
||||||
|
<div class="right-editor">
|
||||||
|
<!-- 右侧编辑区域内容 -->
|
||||||
|
<el-form :inline="true" label-width="auto" :model="form" class="form-two" >
|
||||||
|
<el-form-item label="电压有效值(V)">
|
||||||
|
<el-input v-model="form.input1" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="电流有效值(A)">
|
||||||
|
<el-input v-model="form.input2" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="电压相角(°)">
|
||||||
|
<el-input v-model="form.input3" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="电流相角(°)">
|
||||||
|
<el-input v-model="form.input4" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="right-editor">
|
|
||||||
<!-- 右侧编辑区域内容 -->
|
|
||||||
<el-form-item label="电压有效值(V)">
|
|
||||||
<el-input v-model="input1" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="电流有效值(A)">
|
|
||||||
<el-input v-model="input1" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="相角(°)">
|
|
||||||
<el-input v-model="input2" />
|
|
||||||
</el-form-item>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { onMounted, ref } from "vue";
|
import { onMounted, ref } from 'vue'
|
||||||
|
const form = ref({
|
||||||
const canvas = ref<HTMLCanvasElement | null>(null);
|
input1: 220,
|
||||||
|
input2: 0,
|
||||||
|
input3: 0,
|
||||||
|
input4: 0
|
||||||
|
})
|
||||||
|
const canvas = ref<HTMLCanvasElement | null>(null)
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (canvas.value) {
|
if (canvas.value) {
|
||||||
const ctx = canvas.value.getContext('2d');
|
const ctx = canvas.value.getContext('2d')
|
||||||
if (ctx) {
|
if (ctx) {
|
||||||
drawSineWave(ctx);
|
drawSineWave(ctx)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
});
|
|
||||||
|
|
||||||
function drawSineWave(ctx: CanvasRenderingContext2D) {
|
function drawSineWave(ctx: CanvasRenderingContext2D) {
|
||||||
const width = canvas.value!.width;
|
const width = canvas.value!.width
|
||||||
const height = canvas.value!.height;
|
const height = canvas.value!.height
|
||||||
const amplitude = 50; // 振幅
|
const amplitude = 50 // 振幅
|
||||||
const frequency = 0.02; // 频率
|
const frequency = 0.02 // 频率
|
||||||
const offset = height / 2; // 偏移量
|
const offset = height / 2 // 偏移量
|
||||||
|
|
||||||
// 绘制横轴
|
// 绘制横轴
|
||||||
ctx.beginPath();
|
ctx.beginPath()
|
||||||
ctx.moveTo(0, offset);
|
ctx.moveTo(0, offset)
|
||||||
ctx.lineTo(width, offset);
|
ctx.lineTo(width, offset)
|
||||||
ctx.strokeStyle = 'black';
|
ctx.strokeStyle = 'black'
|
||||||
ctx.stroke();
|
ctx.stroke()
|
||||||
|
|
||||||
// 绘制纵轴
|
// 绘制纵轴
|
||||||
ctx.beginPath();
|
ctx.beginPath()
|
||||||
ctx.moveTo(0, 0);
|
ctx.moveTo(0, 0)
|
||||||
ctx.lineTo(0, height);
|
ctx.lineTo(0, height)
|
||||||
ctx.stroke();
|
ctx.stroke()
|
||||||
|
|
||||||
// 绘制横轴刻度
|
// 绘制横轴刻度
|
||||||
const xStep = width / 10;
|
const xStep = width / 10
|
||||||
for (let x = 0; x <= width; x += xStep) {
|
for (let x = 0; x <= width; x += xStep) {
|
||||||
ctx.beginPath();
|
ctx.beginPath()
|
||||||
ctx.moveTo(x, offset - 5);
|
ctx.moveTo(x, offset - 5)
|
||||||
ctx.lineTo(x, offset + 5);
|
ctx.lineTo(x, offset + 5)
|
||||||
ctx.stroke();
|
ctx.stroke()
|
||||||
|
|
||||||
// 添加横轴刻度标签
|
// 添加横轴刻度标签
|
||||||
ctx.font = '12px Arial';
|
ctx.font = '12px Arial'
|
||||||
ctx.fillStyle = 'black';
|
ctx.fillStyle = 'black'
|
||||||
ctx.textAlign = 'center';
|
ctx.textAlign = 'center'
|
||||||
ctx.fillText((x / xStep).toFixed(0), x, offset + 20);
|
ctx.fillText((x / xStep).toFixed(0), x, offset + 20)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 绘制纵轴刻度
|
// 绘制纵轴刻度
|
||||||
const yStep = height / 10;
|
const yStep = height / 10
|
||||||
for (let y = 0; y <= height; y += yStep) {
|
for (let y = 0; y <= height; y += yStep) {
|
||||||
ctx.beginPath();
|
ctx.beginPath()
|
||||||
ctx.moveTo(-5, y);
|
ctx.moveTo(-5, y)
|
||||||
ctx.lineTo(5, y);
|
ctx.lineTo(5, y)
|
||||||
ctx.stroke();
|
ctx.stroke()
|
||||||
|
|
||||||
// 添加纵轴刻度标签
|
// 添加纵轴刻度标签
|
||||||
ctx.font = '12px Arial';
|
ctx.font = '12px Arial'
|
||||||
ctx.fillStyle = 'black';
|
ctx.fillStyle = 'black'
|
||||||
ctx.textAlign = 'right';
|
ctx.textAlign = 'right'
|
||||||
ctx.fillText(((offset - y) / yStep - 5).toFixed(1), -10, y + 5);
|
ctx.fillText(((offset - y) / yStep - 5).toFixed(1), -10, y + 5)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 绘制正弦波
|
// 绘制正弦波
|
||||||
ctx.beginPath();
|
ctx.beginPath()
|
||||||
ctx.moveTo(0, offset);
|
ctx.moveTo(0, offset)
|
||||||
|
|
||||||
for (let x = 0; x < width; x++) {
|
for (let x = 0; x < width; x++) {
|
||||||
const y = offset + amplitude * Math.sin(frequency * x);
|
const y = offset + amplitude * Math.sin(frequency * x)
|
||||||
ctx.lineTo(x, y);
|
ctx.lineTo(x, y)
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.strokeStyle = 'red';
|
ctx.strokeStyle = 'red'
|
||||||
ctx.lineWidth = 2;
|
ctx.lineWidth = 2
|
||||||
ctx.stroke();
|
ctx.stroke()
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
canvas {
|
canvas {
|
||||||
border: 1px solid #ccc;
|
border: 1px solid #ccc;
|
||||||
}
|
}
|
||||||
|
|
||||||
.editor-container {
|
.editor-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.left-editor {
|
.left-editor {
|
||||||
flex: 3; /* 左侧区域占据 3/4 的宽度 */
|
flex: 1;
|
||||||
margin-left: 150px; /* 可选:添加间距 */
|
margin-left: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.right-editor {
|
.right-editor {
|
||||||
flex: 1; /* 右侧区域占据 1/4 的宽度 */
|
width: 600px;
|
||||||
margin-right: 250px; /* 向左侧移动一点 */
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
25
frontend/src/views/machine/testScript/components/tree.vue
Normal file
25
frontend/src/views/machine/testScript/components/tree.vue
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<template>
|
||||||
|
<el-tree node-key="id" default-expand-all :data="dataTree" :props="defaultProps" />
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, reactive } from 'vue'
|
||||||
|
import { getTreeData } from '@/api/check/test'
|
||||||
|
import { CheckData } from '@/api/check/interface'
|
||||||
|
const dataTree = ref<CheckData.TreeItem[]>([])
|
||||||
|
const defaultProps = {
|
||||||
|
children: 'children',
|
||||||
|
label: 'scriptTypeName',
|
||||||
|
pid: 'pid'
|
||||||
|
}
|
||||||
|
const open = () => {
|
||||||
|
getTreeData({
|
||||||
|
scriptId: 'a303b2224845fcc6f60198b8ca23dca9'
|
||||||
|
}).then(res => {
|
||||||
|
dataTree.value = res.data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
onMounted(() => {
|
||||||
|
open()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped></style>
|
||||||
@@ -1,78 +1,67 @@
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<el-dialog title="请确认检测脚本值类型"
|
<el-dialog title="请确认检测脚本值类型" v-model="dialogVisible" @close="close" v-bind="dialogSmall">
|
||||||
v-model='dialogVisible'
|
<div class="dialog-content">
|
||||||
@close="close"
|
<el-form>
|
||||||
v-bind="dialogSmall"
|
<el-form-item label="值类型">
|
||||||
>
|
<el-select v-model="selectedValue" filterable clearable placeholder="请选择值类型">
|
||||||
<div class="dialog-content" >
|
<el-option
|
||||||
<el-form>
|
v-for="item in dictStore.getDictData('Script_Value_Type')"
|
||||||
<el-form-item label='值类型'>
|
:key="item.id"
|
||||||
<el-select v-model="selectedValue" filterable clearable placeholder="请选择值类型">
|
:label="item.name"
|
||||||
<el-option
|
:value="item.id"
|
||||||
v-for="item in dictStore.getDictData('Script_Value_Type')"
|
/>
|
||||||
:key="item.id"
|
</el-select>
|
||||||
:label="item.name"
|
</el-form-item>
|
||||||
:value="item.id"
|
</el-form>
|
||||||
/>
|
</div>
|
||||||
</el-select>
|
<TestScriptPopup ref="testScriptPopup" />
|
||||||
</el-form-item>
|
<template #footer>
|
||||||
</el-form>
|
<div>
|
||||||
</div>
|
<el-button @click="close()">取 消</el-button>
|
||||||
<TestScriptPopup ref='testScriptPopup' />
|
<el-button type="primary" @click="save()">新增</el-button>
|
||||||
<template #footer>
|
</div>
|
||||||
<div>
|
</template>
|
||||||
<el-button @click='close()'>取 消</el-button>
|
|
||||||
<el-button type="primary" @click='save()'>新增</el-button>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
</template>
|
import { dialogSmall } from '@/utils/elementBind'
|
||||||
<script setup lang='ts'>
|
import { ref } from 'vue'
|
||||||
import { dialogSmall } from '@/utils/elementBind'
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
import { ref } from 'vue'
|
import { type TestScript } from '@/api/device/interface/testScript'
|
||||||
import { useDictStore } from '@/stores/modules/dict'
|
|
||||||
import { type TestScript } from '@/api/device/interface/testScript';
|
|
||||||
|
|
||||||
const mode = ref()
|
|
||||||
const testScriptPopup = ref()
|
|
||||||
// 定义弹出组件元信息
|
|
||||||
const dialogFormRef = ref()
|
|
||||||
const dictStore = useDictStore()
|
|
||||||
const dialogVisible = ref(false)
|
|
||||||
const selectedValue = ref()
|
|
||||||
|
|
||||||
// 关闭弹窗
|
|
||||||
const close = () => {
|
|
||||||
dialogVisible.value = false
|
|
||||||
// 重置表单
|
|
||||||
dialogFormRef.value?.resetFields()
|
|
||||||
}
|
|
||||||
|
|
||||||
// 保存数据
|
|
||||||
const save = () => {
|
|
||||||
testScriptPopup.value?.open('新增检测脚本', {}, mode.value,selectedValue.value)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// 打开弹窗,可能是新增,也可能是编辑
|
|
||||||
const open = (sign: string,row: any,currentMode: string) => {
|
|
||||||
mode.value = currentMode
|
|
||||||
// 重置表单
|
|
||||||
dialogFormRef.value?.resetFields()
|
|
||||||
dialogVisible.value = true
|
|
||||||
}
|
|
||||||
|
|
||||||
// 对外映射
|
|
||||||
defineExpose({ open })
|
|
||||||
|
|
||||||
|
const mode = ref()
|
||||||
|
const testScriptPopup = ref()
|
||||||
</script>
|
// 定义弹出组件元信息
|
||||||
<style scoped>
|
const dialogFormRef = ref()
|
||||||
/* .dialog-content {
|
const dictStore = useDictStore()
|
||||||
|
const dialogVisible = ref(false)
|
||||||
|
const selectedValue = ref()
|
||||||
|
|
||||||
|
// 关闭弹窗
|
||||||
|
const close = () => {
|
||||||
|
dialogVisible.value = false
|
||||||
|
// 重置表单
|
||||||
|
dialogFormRef.value?.resetFields()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 保存数据
|
||||||
|
const save = () => {
|
||||||
|
testScriptPopup.value?.open('新增检测脚本', {}, mode.value, selectedValue.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 打开弹窗,可能是新增,也可能是编辑
|
||||||
|
const open = (sign: string, row: any, currentMode: string) => {
|
||||||
|
mode.value = currentMode
|
||||||
|
// 重置表单
|
||||||
|
dialogFormRef.value?.resetFields()
|
||||||
|
dialogVisible.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
// 对外映射
|
||||||
|
defineExpose({ open })
|
||||||
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
/* .dialog-content {
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
} */
|
} */
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,158 +1,172 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class='table-box'>
|
<div class="table-box">
|
||||||
<ProTable
|
<ProTable ref="proTable" :columns="columns" :request-api="getTableList">
|
||||||
ref='proTable'
|
<!-- :data='testScriptData' 如果要显示静态数据,就切换该配置 -->
|
||||||
:columns='columns'
|
<!-- 表格 header 按钮 -->
|
||||||
:request-api="getTableList"
|
<template #tableHeader="scope">
|
||||||
>
|
<el-button v-auth.testScript="'add'" type="primary" :icon="CirclePlus" @click="openDialog('add')">
|
||||||
<!-- :data='testScriptData' 如果要显示静态数据,就切换该配置 -->
|
新增
|
||||||
<!-- 表格 header 按钮 -->
|
</el-button>
|
||||||
<template #tableHeader='scope'>
|
<el-button
|
||||||
<el-button v-auth.testScript="'add'" type='primary' :icon='CirclePlus' @click="openDialog('add')">新增</el-button>
|
v-auth.testScript="'delete'"
|
||||||
<el-button v-auth.testScript="'delete'" type='danger' :icon='Delete' plain :disabled='!scope.isSelected'
|
type="danger"
|
||||||
@click='batchDelete(scope.selectedListIds)'>
|
:icon="Delete"
|
||||||
删除
|
plain
|
||||||
</el-button>
|
:disabled="!scope.isSelected"
|
||||||
</template>
|
@click="batchDelete(scope.selectedListIds)"
|
||||||
<!-- 表格操作 -->
|
>
|
||||||
<template #operation='scope'>
|
删除
|
||||||
<el-button v-auth.testScript="'edit'" type='primary' link :icon='EditPen' :model-value="false" @click="openDialog('edit', scope.row)">编辑</el-button>
|
</el-button>
|
||||||
<el-button v-auth.testScript="'delete'" type='primary' link :icon='Delete' @click='handleDelete(scope.row)'>删除</el-button>
|
</template>
|
||||||
<el-button v-auth.testScript="'upgrade'" type='primary' v-if="scope.row.type !== 1" link :icon='Share' @click='updateType(scope.row)'>升级</el-button>
|
<!-- 表格操作 -->
|
||||||
</template>
|
<template #operation="scope">
|
||||||
|
<el-button
|
||||||
</ProTable>
|
v-auth.testScript="'edit'"
|
||||||
</div>
|
type="primary"
|
||||||
<ComparisonPopup ref='comparisonPopup' />
|
link
|
||||||
<ValueTypePopup ref='valueTypePopup' />
|
:icon="EditPen"
|
||||||
<TestScriptPopup ref='testScriptPopup' />
|
:model-value="false"
|
||||||
|
@click="openDialog('edit', scope.row)"
|
||||||
|
>
|
||||||
|
编辑
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
v-auth.testScript="'delete'"
|
||||||
|
type="primary"
|
||||||
|
link
|
||||||
|
:icon="Delete"
|
||||||
|
@click="handleDelete(scope.row)"
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
v-auth.testScript="'upgrade'"
|
||||||
|
type="primary"
|
||||||
|
v-if="scope.row.type !== 1"
|
||||||
|
link
|
||||||
|
:icon="Share"
|
||||||
|
@click="updateType(scope.row)"
|
||||||
|
>
|
||||||
|
升级
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</ProTable>
|
||||||
|
</div>
|
||||||
|
<ComparisonPopup ref="comparisonPopup" />
|
||||||
|
<ValueTypePopup ref="valueTypePopup" />
|
||||||
|
<TestScriptPopup ref="testScriptPopup" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang='tsx' name='useRole'>
|
<script setup lang="tsx" name="useRole">
|
||||||
import { type TestScript } from '@/api/device/interface/testScript'
|
import { type TestScript } from '@/api/device/interface/testScript'
|
||||||
import { useHandleData } from '@/hooks/useHandleData'
|
import { useHandleData } from '@/hooks/useHandleData'
|
||||||
import ProTable from '@/components/ProTable/index.vue'
|
import ProTable from '@/components/ProTable/index.vue'
|
||||||
import type{ ProTableInstance, ColumnProps } from '@/components/ProTable/interface'
|
import type { ProTableInstance, ColumnProps } from '@/components/ProTable/interface'
|
||||||
import { CirclePlus, Delete, EditPen, Share } from '@element-plus/icons-vue'
|
import { CirclePlus, Delete, EditPen, Share } from '@element-plus/icons-vue'
|
||||||
import { useDictStore } from '@/stores/modules/dict'
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
import ComparisonPopup from './components/comparisonPopup.vue'
|
import ComparisonPopup from './components/comparisonPopup.vue'
|
||||||
import TestScriptPopup from './components/testScriptPopup.vue'
|
import TestScriptPopup from './components/testScriptPopup.vue'
|
||||||
import ValueTypePopup from './components/valueTypePopup.vue'
|
import ValueTypePopup from './components/valueTypePopup.vue'
|
||||||
import {
|
import { getPqScriptList, updatePqScript, deletePqScript } from '@/api/device/testScript/index'
|
||||||
getPqScriptList,updatePqScript,deletePqScript,
|
|
||||||
} from '@/api/device/testScript/index'
|
|
||||||
import { computed, reactive, ref } from 'vue'
|
import { computed, reactive, ref } from 'vue'
|
||||||
import { useModeStore } from '@/stores/modules/mode'; // 引入模式 store
|
import { useModeStore } from '@/stores/modules/mode' // 引入模式 store
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'testScript'
|
name: 'testScript'
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
const comparisonPopup = ref()
|
const comparisonPopup = ref()
|
||||||
const testScriptPopup = ref()
|
const testScriptPopup = ref()
|
||||||
const valueTypePopup = ref()
|
const valueTypePopup = ref()
|
||||||
const modeStore = useModeStore();
|
const modeStore = useModeStore()
|
||||||
const dictStore = useDictStore()
|
const dictStore = useDictStore()
|
||||||
|
|
||||||
const getTableList = (params: any) => {
|
const getTableList = (params: any) => {
|
||||||
let newParams = JSON.parse(JSON.stringify(params))
|
let newParams = JSON.parse(JSON.stringify(params))
|
||||||
const patternId = dictStore.getDictData('Pattern').find(item=>item.name=== modeStore.currentMode)?.id//获取数据字典中对应的id
|
const patternId = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id //获取数据字典中对应的id
|
||||||
newParams.pattern = patternId
|
newParams.pattern = patternId
|
||||||
return getPqScriptList(newParams)
|
return getPqScriptList(newParams)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ProTable 实例
|
// ProTable 实例
|
||||||
const proTable = ref<ProTableInstance>()
|
const proTable = ref<ProTableInstance>()
|
||||||
|
|
||||||
const showValueSearch = computed(() => {
|
const showValueSearch = computed(() => {
|
||||||
if(modeStore.currentMode == '比对式'){
|
if (modeStore.currentMode == '比对式') {
|
||||||
return false;
|
return false
|
||||||
}else{
|
} else {
|
||||||
return true;
|
return true
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
|
||||||
|
|
||||||
// 表格配置项
|
// 表格配置项
|
||||||
const columns = reactive<ColumnProps<TestScript.ResTestScript>[]>([
|
const columns = reactive<ColumnProps<TestScript.ResTestScript>[]>([
|
||||||
{ type: 'selection', fixed: 'left', width: 70 },
|
{ type: 'selection', fixed: 'left', width: 70 },
|
||||||
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
||||||
{
|
{
|
||||||
prop: 'name',
|
prop: 'name',
|
||||||
label: '名称',
|
label: '名称',
|
||||||
minWidth: 350,
|
minWidth: 350,
|
||||||
search: {el:'input'}
|
search: { el: 'input' }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'standardName',
|
prop: 'standardName',
|
||||||
label: '参照标准名称',
|
label: '参照标准名称',
|
||||||
minWidth: 150,
|
minWidth: 150
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'standardTime',
|
prop: 'standardTime',
|
||||||
label: '标准推行年份',
|
label: '标准推行年份',
|
||||||
minWidth: 150,
|
minWidth: 150
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'valueType',
|
prop: 'valueType',
|
||||||
label: '值类型',
|
label: '值类型',
|
||||||
enum: dictStore.getDictData('Script_Value_Type'),
|
enum: dictStore.getDictData('Script_Value_Type'),
|
||||||
fieldNames: { label: 'name', value: 'id' },
|
fieldNames: { label: 'name', value: 'id' },
|
||||||
search: showValueSearch.value ? { el: 'select' } : undefined,
|
search: showValueSearch.value ? { el: 'select' } : undefined,
|
||||||
minWidth: 150,
|
minWidth: 150
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'type',
|
prop: 'type',
|
||||||
label: '模板类型',
|
label: '模板类型',
|
||||||
minWidth: 150,
|
minWidth: 150,
|
||||||
render: scope => {
|
render: scope => {
|
||||||
return (
|
return <el-tag type={scope.row.type ? 'success' : 'primary'}> {scope.row.type ? '模版' : '脚本'} </el-tag>
|
||||||
<el-tag type={scope.row.type ? 'success' : 'primary'} > {scope.row.type ? '模版' : '脚本'} </el-tag>
|
}
|
||||||
)
|
},
|
||||||
},
|
{ prop: 'operation', label: '操作', fixed: 'right', width: 250 }
|
||||||
},
|
|
||||||
{ prop: 'operation', label: '操作', fixed: 'right', width: 250 },
|
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 打开 drawer(新增、编辑)
|
// 打开 drawer(新增、编辑)
|
||||||
const openDialog = (titleType: string, row: Partial<TestScript.ResTestScript> = {}) => {
|
const openDialog = (titleType: string, row: Partial<TestScript.ResTestScript> = {}) => {
|
||||||
if(modeStore.currentMode == '比对式'){
|
if (modeStore.currentMode == '比对式') {
|
||||||
comparisonPopup.value?.open(titleType, row,modeStore.currentMode,)
|
comparisonPopup.value?.open(titleType, row, modeStore.currentMode)
|
||||||
}else{
|
} else {
|
||||||
if(titleType == 'add'){
|
if (titleType == 'add') {
|
||||||
valueTypePopup.value?.open(titleType, row,modeStore.currentMode)
|
// valueTypePopup.value?.open(titleType, row,modeStore.currentMode)
|
||||||
}else{
|
testScriptPopup.value?.open('新增检测脚本', {}, row, modeStore.currentMode, '')
|
||||||
testScriptPopup.value?.open(titleType, row,modeStore.currentMode,'')
|
} else {
|
||||||
|
testScriptPopup.value?.open(titleType, row, modeStore.currentMode, '')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 批量删除设备
|
// 批量删除设备
|
||||||
const batchDelete = async (id: string[]) => {
|
const batchDelete = async (id: string[]) => {
|
||||||
await useHandleData(deletePqScript, id, '删除所选脚本')
|
await useHandleData(deletePqScript, id, '删除所选脚本')
|
||||||
proTable.value?.clearSelection()
|
proTable.value?.clearSelection()
|
||||||
proTable.value?.getTableList()
|
proTable.value?.getTableList()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除设备
|
// 删除设备
|
||||||
const handleDelete = async (params: TestScript.ResTestScript) => {
|
const handleDelete = async (params: TestScript.ResTestScript) => {
|
||||||
await useHandleData(deletePqScript, [params.id], `删除【${params.name}】脚本`)
|
await useHandleData(deletePqScript, [params.id], `删除【${params.name}】脚本`)
|
||||||
proTable.value?.getTableList()
|
proTable.value?.getTableList()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 升级为模版
|
// 升级为模版
|
||||||
const updateType = async (params: TestScript.ResTestScript) => {
|
const updateType = async (params: TestScript.ResTestScript) => {
|
||||||
await useHandleData(updatePqScript, params, `升级【${params.name}】为模版`)
|
await useHandleData(updatePqScript, params, `升级【${params.name}】为模版`)
|
||||||
proTable.value?.getTableList()
|
proTable.value?.getTableList()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user