ADD:ICD添加检测是否两个开关字段
This commit is contained in:
@@ -24,6 +24,8 @@ export namespace ICD {
|
||||
createTime?: string| null; //创建时间
|
||||
updateBy?: 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>
|
||||
<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-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 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>
|
||||
</div>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<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 lang="ts" setup>
|
||||
import { ElMessage, type FormInstance, type FormItemRule } from 'element-plus'
|
||||
import type { ProTableInstance } from '@/components/ProTable/interface'
|
||||
import { ref,computed, Ref} from 'vue'
|
||||
import { computed, ref, Ref } from 'vue'
|
||||
import { type ICD } from '@/api/device/interface/icd'
|
||||
import { dialogSmall } from '@/utils/elementBind'
|
||||
import { useDictStore } from '@/stores/modules/dict'
|
||||
import { addICD, updateICD } from '@/api/device/icd'
|
||||
|
||||
const dictStore = useDictStore()
|
||||
// 定义弹出组件元信息
|
||||
const dialogFormRef = ref()
|
||||
@@ -42,13 +64,14 @@
|
||||
name: '',
|
||||
path: '',
|
||||
state: 1,
|
||||
angle: 0,
|
||||
usePhaseIndex: 0
|
||||
})
|
||||
return { dialogVisible, titleType, formContent }
|
||||
}
|
||||
|
||||
const { dialogVisible, titleType, formContent } = useMetaInfo()
|
||||
|
||||
|
||||
// 清空formContent
|
||||
const resetFormContent = () => {
|
||||
formContent.value = {
|
||||
@@ -56,6 +79,8 @@ const resetFormContent = () => {
|
||||
name: '',
|
||||
path: '',
|
||||
state: 1,
|
||||
angle: 0,
|
||||
usePhaseIndex: 0
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,17 +88,14 @@ const resetFormContent = () => {
|
||||
return titleType.value === 'add' ? '新增ICD' : '编辑ICD'
|
||||
})
|
||||
|
||||
|
||||
|
||||
//定义规则
|
||||
const formRuleRef = ref<FormInstance>()
|
||||
//定义校验规则
|
||||
const rules: Ref<Record<string, Array<FormItemRule>>> = ref({
|
||||
name: [{ required: true, message: 'icd名称必填!', trigger: 'blur' }],
|
||||
path: [{ required: true, message: 'icd存储地址必填!', trigger: 'blur' }],
|
||||
path: [{ required: true, message: 'icd存储地址必填!', trigger: 'blur' }]
|
||||
})
|
||||
|
||||
|
||||
// 关闭弹窗
|
||||
const close = () => {
|
||||
dialogVisible.value = false
|
||||
@@ -89,9 +111,9 @@ const close = () => {
|
||||
dialogFormRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
if (formContent.value.id) {
|
||||
await updateICD(formContent.value);
|
||||
await updateICD(formContent.value)
|
||||
} else {
|
||||
await addICD(formContent.value);
|
||||
await addICD(formContent.value)
|
||||
}
|
||||
ElMessage.success({ message: `${dialogTitle.value}成功!` })
|
||||
close()
|
||||
@@ -121,7 +143,6 @@ const close = () => {
|
||||
// 对外映射
|
||||
defineExpose({ open })
|
||||
const props = defineProps<{
|
||||
refreshTable: (() => Promise<void>) | undefined;
|
||||
refreshTable: (() => Promise<void>) | undefined
|
||||
}>()
|
||||
|
||||
</script>
|
||||
Reference in New Issue
Block a user