ADD:ICD添加检测是否两个开关字段
This commit is contained in:
@@ -24,6 +24,8 @@ export namespace ICD {
|
|||||||
createTime?: string| null; //创建时间
|
createTime?: string| null; //创建时间
|
||||||
updateBy?: string| null; //更新用户
|
updateBy?: string| null; //更新用户
|
||||||
updateTime?: string| null; //更新时间
|
updateTime?: string| null; //更新时间
|
||||||
|
angle: number; // 是否支持电压相角、电流相角指标
|
||||||
|
usePhaseIndex: number; // 角型接线时是否使用相别的指标来进行检测
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -2,35 +2,57 @@
|
|||||||
<!-- 基础信息弹出框 -->
|
<!-- 基础信息弹出框 -->
|
||||||
<el-dialog :model-value="dialogVisible" :title="dialogTitle" v-bind="dialogSmall" @close="close" align-center>
|
<el-dialog :model-value="dialogVisible" :title="dialogTitle" v-bind="dialogSmall" @close="close" align-center>
|
||||||
<div>
|
<div>
|
||||||
<el-form :model="formContent" ref='dialogFormRef' :rules='rules'>
|
<el-form :model="formContent" label-position="right" label-width="80" ref="dialogFormRef" :rules="rules">
|
||||||
<el-form-item label="名称" prop="name">
|
<el-form-item label="名称" prop="name">
|
||||||
<el-input v-model='formContent.name' placeholder="请输入icd名称" maxlength="32" show-word-limit/>
|
<el-input v-model="formContent.name" placeholder="请输入icd名称" maxlength="32" show-word-limit />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="存储地址" prop="path">
|
<el-form-item label="存储地址" prop="path">
|
||||||
<el-input v-model='formContent.path' placeholder="请输入icd存储地址" maxlength="32" show-word-limit/>
|
<el-input
|
||||||
|
v-model="formContent.path"
|
||||||
|
placeholder="请输入icd存储地址"
|
||||||
|
maxlength="32"
|
||||||
|
show-word-limit
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="是否支持电压相角、电流相角指标" prop="angle" label-width="auto">
|
||||||
|
<el-switch
|
||||||
|
v-model="formContent.angle"
|
||||||
|
:active-value="1"
|
||||||
|
:inactive-value="0"
|
||||||
|
inline-prompt
|
||||||
|
active-text="是"
|
||||||
|
inactive-text="否"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="角型接线时是否使用相别的指标来进行检测" prop="usePhaseIndex" label-width="auto">
|
||||||
|
<el-switch
|
||||||
|
v-model="formContent.usePhaseIndex"
|
||||||
|
:active-value="1"
|
||||||
|
:inactive-value="0"
|
||||||
|
inline-prompt
|
||||||
|
active-text="是"
|
||||||
|
inactive-text="否"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div class="dialog-footer">
|
<div class="dialog-footer">
|
||||||
<el-button @click="close()">取消</el-button>
|
<el-button @click="close()">取消</el-button>
|
||||||
<el-button type="primary" @click="save()" >
|
<el-button type="primary" @click="save()">保存</el-button>
|
||||||
保存
|
|
||||||
</el-button>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ElMessage, type FormInstance, type FormItemRule } from 'element-plus'
|
import { ElMessage, type FormInstance, type FormItemRule } from 'element-plus'
|
||||||
import type { ProTableInstance } from '@/components/ProTable/interface'
|
import { computed, ref, Ref } from 'vue'
|
||||||
import { ref,computed, Ref} from 'vue'
|
|
||||||
import { type ICD } from '@/api/device/interface/icd'
|
import { type ICD } from '@/api/device/interface/icd'
|
||||||
import { dialogSmall } from '@/utils/elementBind'
|
import { dialogSmall } from '@/utils/elementBind'
|
||||||
import { useDictStore } from '@/stores/modules/dict'
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
import { addICD, updateICD } from '@/api/device/icd'
|
import { addICD, updateICD } from '@/api/device/icd'
|
||||||
|
|
||||||
const dictStore = useDictStore()
|
const dictStore = useDictStore()
|
||||||
// 定义弹出组件元信息
|
// 定义弹出组件元信息
|
||||||
const dialogFormRef = ref()
|
const dialogFormRef = ref()
|
||||||
@@ -42,13 +64,14 @@
|
|||||||
name: '',
|
name: '',
|
||||||
path: '',
|
path: '',
|
||||||
state: 1,
|
state: 1,
|
||||||
|
angle: 0,
|
||||||
|
usePhaseIndex: 0
|
||||||
})
|
})
|
||||||
return { dialogVisible, titleType, formContent }
|
return { dialogVisible, titleType, formContent }
|
||||||
}
|
}
|
||||||
|
|
||||||
const { dialogVisible, titleType, formContent } = useMetaInfo()
|
const { dialogVisible, titleType, formContent } = useMetaInfo()
|
||||||
|
|
||||||
|
|
||||||
// 清空formContent
|
// 清空formContent
|
||||||
const resetFormContent = () => {
|
const resetFormContent = () => {
|
||||||
formContent.value = {
|
formContent.value = {
|
||||||
@@ -56,6 +79,8 @@ const resetFormContent = () => {
|
|||||||
name: '',
|
name: '',
|
||||||
path: '',
|
path: '',
|
||||||
state: 1,
|
state: 1,
|
||||||
|
angle: 0,
|
||||||
|
usePhaseIndex: 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,17 +88,14 @@ const resetFormContent = () => {
|
|||||||
return titleType.value === 'add' ? '新增ICD' : '编辑ICD'
|
return titleType.value === 'add' ? '新增ICD' : '编辑ICD'
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//定义规则
|
//定义规则
|
||||||
const formRuleRef = ref<FormInstance>()
|
const formRuleRef = ref<FormInstance>()
|
||||||
//定义校验规则
|
//定义校验规则
|
||||||
const rules: Ref<Record<string, Array<FormItemRule>>> = ref({
|
const rules: Ref<Record<string, Array<FormItemRule>>> = ref({
|
||||||
name: [{ required: true, message: 'icd名称必填!', trigger: 'blur' }],
|
name: [{ required: true, message: 'icd名称必填!', trigger: 'blur' }],
|
||||||
path: [{ required: true, message: 'icd存储地址必填!', trigger: 'blur' }],
|
path: [{ required: true, message: 'icd存储地址必填!', trigger: 'blur' }]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
// 关闭弹窗
|
// 关闭弹窗
|
||||||
const close = () => {
|
const close = () => {
|
||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
@@ -89,9 +111,9 @@ const close = () => {
|
|||||||
dialogFormRef.value?.validate(async (valid: boolean) => {
|
dialogFormRef.value?.validate(async (valid: boolean) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (formContent.value.id) {
|
if (formContent.value.id) {
|
||||||
await updateICD(formContent.value);
|
await updateICD(formContent.value)
|
||||||
} else {
|
} else {
|
||||||
await addICD(formContent.value);
|
await addICD(formContent.value)
|
||||||
}
|
}
|
||||||
ElMessage.success({ message: `${dialogTitle.value}成功!` })
|
ElMessage.success({ message: `${dialogTitle.value}成功!` })
|
||||||
close()
|
close()
|
||||||
@@ -121,7 +143,6 @@ const close = () => {
|
|||||||
// 对外映射
|
// 对外映射
|
||||||
defineExpose({ open })
|
defineExpose({ open })
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
refreshTable: (() => Promise<void>) | undefined;
|
refreshTable: (() => Promise<void>) | undefined
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
Reference in New Issue
Block a user