电能质量字典界面

This commit is contained in:
sjl
2024-11-06 08:45:51 +08:00
parent 29bc14d3e1
commit 51f408ce7a
4 changed files with 92 additions and 46 deletions

View File

@@ -25,9 +25,9 @@
<el-form-item label='相别' :label-width='140' prop='phase'>
<el-select v-model="formContent.phase" clearable placeholder="请选择相别">
<el-option
v-for="item in dictStore.getDictData('phase')"
v-for="item in dictStore.getDictData('High_Cate')"
:key="item.id"
:name="item.name"
:label="item.name"
:value="item.code"
/>
</el-select>
@@ -50,12 +50,11 @@
</el-row>
</el-form-item>
<el-form-item label='数据统计类型' :label-width='140' prop='statMethod'>
<el-select v-model="formContent.statMethod" multiple placeholder="请选择数据统计类型">
<el-select v-model="selectedStatMethods" multiple placeholder="请选择数据统计类型">
<el-option
v-for="item in dictStore.getDictData('statMethod')"
v-for="item in dictStore.getDictData('Event_Type')"
:key="item.value"
:name="item.name"
:label="item.name"
:value="item.code"
/>
</el-select>
@@ -66,9 +65,9 @@
<el-form-item label='报表数据来源' :label-width='140' prop='resourcesId'>
<el-select v-model="formContent.resourcesId" clearable placeholder="请选择报表数据来源">
<el-option
v-for="item in dictStore.getDictData('resourcesId')"
v-for="item in dictStore.getDictData('Dev_Series')"
:key="item.id"
:name="item.name"
:label="item.name"
:value="item.code"
/>
</el-select>
@@ -76,9 +75,9 @@
<el-form-item label='数据表表名' :label-width='140' prop='classId'>
<el-select v-model="formContent.classId" clearable placeholder="请选择数据表表名">
<el-option
v-for="item in dictStore.getDictData('classId')"
v-for="item in dictStore.getDictData('High_Cate')"
:key="item.id"
:name="item.name"
:label="item.name"
:value="item.code"
/>
</el-select>
@@ -94,7 +93,7 @@
<el-option
v-for="item in dictStore.getDictData('formula')"
:key="item.id"
:name="item.name"
:label="item.name"
:value="item.code"
/>
</el-select>
@@ -168,8 +167,9 @@
import { addDictPq, updateDictPq } from '@/api/system/dictionary/dictPq'
import { computed, type Ref, ref } from 'vue';
import { useDictStore } from '@/stores/modules/dict'
import { el } from 'element-plus/es/locale';
const dictStore = useDictStore()
const selectedStatMethods = ref<string[]>([])
// 定义弹出组件元信息
const dialogFormRef = ref()
function useMetaInfo() {
@@ -213,7 +213,6 @@
classId: [{ required: true, message: '数据库表名必选!', trigger: 'change' }],
})
// 关闭弹窗
const close = () => {
dialogVisible.value = false
@@ -221,6 +220,7 @@
resetFormContent()
// 重置表单
dialogFormRef.value?.resetFields()
selectedStatMethods.value = []
}
// 保存数据
@@ -228,13 +228,26 @@
try {
dialogFormRef.value?.validate(async (valid: boolean) => {
if (valid) {
formContent.value.statMethod = selectedStatMethods.value.join(',')
if (formContent.value.id) {
await updateDictPq(formContent.value)
updateDictPq(formContent.value).then(result => {
if(result.code != 'A0000'){
ElMessage.error({ message: result.message})
}else{
ElMessage.success({ message: `${dialogTitle.value}成功!` })
}
})
} else {
await addDictPq(formContent.value)
addDictPq(formContent.value).then(result => {
if(result.code != 'A0000'){
ElMessage.error({ message: result.message})
}else{
ElMessage.success({ message: `${dialogTitle.value}成功!` })
}
})
}
ElMessage.success({ message: `${dialogTitle.value}成功!` })
//ElMessage.success({ message: `${dialogTitle.value}成功!` })
close()
// 刷新表格
await props.refreshTable!()
@@ -249,7 +262,8 @@
const open = (sign: string, data: Dict.ResDictPq) => {
titleType.value = sign
dialogVisible.value = true
console.log('123456',dictStore)
console.log(dictStore)
selectedStatMethods.value = data.statMethod ? data.statMethod.split(',') : []
if (data.id) {
formContent.value = { ...data }
} else {
@@ -263,4 +277,6 @@
refreshTable: (() => Promise<void>) | undefined;
}>()
</script>