This commit is contained in:
sjl
2024-11-21 14:42:26 +08:00
parent 4de59336b2
commit 0d063e887c
8 changed files with 271 additions and 28 deletions

View File

@@ -0,0 +1,130 @@
<template>
<el-dialog title="检测脚本信息" v-model='dialogVisible' @close="close" v-bind="dialogSmall">
<div>
<el-form :model="formContent" ref='dialogFormRef'>
<el-tree
:data="data"
:props="defaultProps"
node-key="id"
show-checkbox
:default-expanded-keys="[1]"
>
</el-tree>
</el-form>
</div>
<template #footer>
<div >
<el-button @click='close()'> </el-button>
<el-button type="primary" @click='save()'>保存脚本</el-button>
<el-button type="primary" @click='save()'>脚本另存为</el-button>
</div>
</template>
</el-dialog>
</template>
<script setup lang='ts'>
import { dialogSmall } from '@/utils/elementBind'
import { ElMessage, type FormItemRule } from 'element-plus'
import { computed, reactive, type Ref, ref } from 'vue'
import { CirclePlus, Delete, EditPen } from '@element-plus/icons-vue'
const defaultProps = {
children: 'children',
label: 'label',
}
const data = [
{
id: 1,
label: '比对模式检测脚本',
children: [
{
id: 2,
label: '频率',
},
{
id: 3,
label: '电压',
},
{
id: 4,
label: '电流',
},
{
id: 5,
label: '电压不平衡',
},
{
id: 6,
label: '电流不平衡',
},
{
id: 7,
label: '谐波电压',
},
{
id: 8,
label: '谐波电流',
},
{
id: 9,
label: '间谐波电压',
},
{
id: 10,
label: '间谐波电流',
},
{
id: 11,
label: '闪变',
},
],
},
]
// 定义弹出组件元信息
const dialogFormRef = ref()
function useMetaInfo() {
const dialogVisible = ref(false)
const formContent = ref()
return { dialogVisible, formContent }
}
const { dialogVisible, formContent } = useMetaInfo()
// 清空formContent
const resetFormContent = () => {
formContent.value = {
}
}
// 关闭弹窗
const close = () => {
dialogVisible.value = false
// 清空dialogForm中的值
resetFormContent()
// 重置表单
dialogFormRef.value?.resetFields()
}
// 保存数据
const save = () => {
}
// 打开弹窗,可能是新增,也可能是编辑
const open = (currentMode: string) => {
// 重置表单
dialogFormRef.value?.resetFields()
dialogVisible.value = true
}
// 对外映射
defineExpose({ open })
const props = defineProps<{
refreshTable: (() => Promise<void>) | undefined;
}>()
</script>

View File

@@ -0,0 +1,75 @@
<template>
<el-dialog title="请确认检测脚本值类型" v-model='dialogVisible' @close="close" v-bind="dialogSmall">
<div>
<el-form :model="formContent" ref='dialogFormRef'>
<el-form-item label="检测脚本值类型" >
<el-select clearable placeholder="请选择类型检测脚本值类型" >
<el-option label="相对值" :value="0"></el-option>
<el-option label="绝对值" :value="1"></el-option>
</el-select>
</el-form-item>
</el-form>
</div>
<template #footer>
<div >
<el-button @click='close()'> </el-button>
<el-button type="primary" @click='save()'>新增</el-button>
</div>
</template>
</el-dialog>
</template>
<script setup lang='ts'>
import { dialogSmall } from '@/utils/elementBind'
import { ElMessage, type FormItemRule } from 'element-plus'
import { computed, reactive, type Ref, ref } from 'vue'
import { CirclePlus, Delete, EditPen } from '@element-plus/icons-vue'
// 定义弹出组件元信息
const dialogFormRef = ref()
function useMetaInfo() {
const dialogVisible = ref(false)
const formContent = ref()
return { dialogVisible, formContent }
}
const { dialogVisible, formContent } = useMetaInfo()
// 清空formContent
const resetFormContent = () => {
formContent.value = {
}
}
// 关闭弹窗
const close = () => {
dialogVisible.value = false
// 清空dialogForm中的值
resetFormContent()
// 重置表单
dialogFormRef.value?.resetFields()
}
// 保存数据
const save = () => {
}
// 打开弹窗,可能是新增,也可能是编辑
const open = (currentMode: string) => {
// 重置表单
dialogFormRef.value?.resetFields()
dialogVisible.value = true
}
// 对外映射
defineExpose({ open })
const props = defineProps<{
refreshTable: (() => Promise<void>) | undefined;
}>()
</script>