检测脚本添加额定电压、额定电流 修改bug
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-card style="margin-bottom: 10px" class="cardTop">
|
||||
<el-card style="margin-bottom: 10px" class="cardTop" :style="{ height: height }">
|
||||
<el-form
|
||||
:model="formContent"
|
||||
:inline="true"
|
||||
@@ -30,6 +30,18 @@
|
||||
<el-option v-for="item in stencil" :key="item.value" :label="item.name" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<div class="formBut">
|
||||
<el-button
|
||||
type="primary"
|
||||
:icon="shrink ? ArrowUpBold : ArrowDownBold"
|
||||
@click="shrinkChange"
|
||||
></el-button>
|
||||
<el-button type="primary" :icon="Select" @click="save">保存</el-button>
|
||||
<el-button :icon="Close" @click="close">返回</el-button>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="检测脚本值类型" prop="valueType">
|
||||
<el-select
|
||||
v-model="formContent.valueType"
|
||||
@@ -46,16 +58,30 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<div class="formBut">
|
||||
<el-button type="primary" :icon="Select" @click="save">保存</el-button>
|
||||
<el-button :icon="Close" @click="close">返回</el-button>
|
||||
</div>
|
||||
<el-form-item label="额定电流" prop="ratedCurr">
|
||||
<el-input-number
|
||||
v-model.trim="formContent.ratedCurr"
|
||||
min="0"
|
||||
max="20"
|
||||
style="width: 100%"
|
||||
placeholder="请输入额定电流"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="额定电压" prop="ratedVolt">
|
||||
<el-input-number
|
||||
v-model.trim="formContent.ratedVolt"
|
||||
min="0"
|
||||
max="380"
|
||||
style="width: 100%"
|
||||
placeholder="请输入额定电压"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
<el-card v-if="show">
|
||||
<TestScriptDetail :options="secondLevelOptions" :formContent="formContent" />
|
||||
<TestScriptDetail :options="secondLevelOptions" :formContent="formContent" :shrink="shrink" />
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
@@ -67,11 +93,12 @@ import { type TestScript } from '@/api/device/interface/testScript'
|
||||
import type { Dict } from '@/api/system/dictionary/interface'
|
||||
import { getDictTreeByCode } from '@/api/system/dictionary/dictTree'
|
||||
import type { CascaderOption } from 'element-plus'
|
||||
import { Select, Close } from '@element-plus/icons-vue'
|
||||
import { Select, Close, ArrowDownBold, ArrowUpBold } from '@element-plus/icons-vue'
|
||||
import { pqScriptAdd, pqScriptUpdate } from '@/api/device/testScript'
|
||||
import { useRouter } from 'vue-router'
|
||||
const modeId = ref()
|
||||
const show = ref(false)
|
||||
const height = ref('125px')
|
||||
const router = useRouter()
|
||||
|
||||
const secondLevelOptions: any[] = []
|
||||
@@ -87,10 +114,13 @@ function useMetaInfo() {
|
||||
pattern: modeId.value,
|
||||
standardName: '',
|
||||
standardTime: '',
|
||||
state: 1
|
||||
state: 1,
|
||||
ratedCurr: 0,
|
||||
ratedVolt: 0
|
||||
})
|
||||
return { titleType, formContent }
|
||||
}
|
||||
const shrink = ref(true)
|
||||
const stencil = [
|
||||
{ name: '脚本', value: 0 },
|
||||
{ name: '模版', value: 1 }
|
||||
@@ -100,11 +130,17 @@ const rules = {
|
||||
standardName: [{ required: true, message: '请输入参照标准名称', trigger: 'blur' }],
|
||||
standardTime: [{ required: true, message: '请选择标准推行年份', trigger: 'change' }],
|
||||
type: [{ required: true, message: '请选择模版类型', trigger: 'change' }],
|
||||
valueType: [{ required: true, message: '请选择检测脚本值类型', trigger: 'change' }]
|
||||
valueType: [{ required: true, message: '请选择检测脚本值类型', trigger: 'change' }],
|
||||
ratedCurr: [{ required: true, message: '请填写额定电流', trigger: 'change' }],
|
||||
ratedVolt: [{ required: true, message: '请填写额定电压', trigger: 'change' }]
|
||||
}
|
||||
|
||||
const { titleType, formContent } = useMetaInfo()
|
||||
|
||||
// 收缩
|
||||
const shrinkChange = () => {
|
||||
shrink.value = !shrink.value
|
||||
shrink.value ? (height.value = '125px') : (height.value = '70px')
|
||||
}
|
||||
// 清空formContent
|
||||
const resetFormContent = () => {
|
||||
formContent.value = {
|
||||
@@ -114,13 +150,14 @@ const resetFormContent = () => {
|
||||
pattern: '',
|
||||
standardName: '',
|
||||
standardTime: '',
|
||||
state: 1
|
||||
state: 1,
|
||||
ratedCurr: 0,
|
||||
ratedVolt: 0
|
||||
}
|
||||
router.go(-1)
|
||||
}
|
||||
// 关闭弹窗
|
||||
const close = () => {
|
||||
|
||||
// 清空dialogForm中的值
|
||||
resetFormContent()
|
||||
// 重置表单
|
||||
@@ -151,6 +188,9 @@ const save = () => {
|
||||
}
|
||||
})
|
||||
}
|
||||
} else {
|
||||
shrink.value = true
|
||||
height.value = '125px'
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -163,7 +203,7 @@ const open = async (title: string, row: any) => {
|
||||
} else {
|
||||
let list = JSON.parse(row)
|
||||
formContent.value = list
|
||||
console.log('🚀 ~ open ~ list:', formContent.value )
|
||||
console.log('🚀 ~ open ~ list:', formContent.value)
|
||||
show.value = true
|
||||
}
|
||||
// 重置表单
|
||||
@@ -239,7 +279,7 @@ defineExpose({ open })
|
||||
// justify-content: space-between;
|
||||
.el-form-item {
|
||||
display: flex;
|
||||
width: 15.8%;
|
||||
width: 18.8%;
|
||||
|
||||
.el-form-item__content {
|
||||
flex: 1;
|
||||
|
||||
Reference in New Issue
Block a user