From 1f22234b458e1f3fb5a2bdff9665c0e9c19e7f7a Mon Sep 17 00:00:00 2001 From: sjl <1716605279@qq.com> Date: Tue, 5 Nov 2024 14:15:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8C=87=E6=A0=87=E5=AD=97=E5=85=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/system/dictionary/interface/index.ts | 8 +-- frontend/src/api/user/login.ts | 2 +- frontend/src/stores/modules/dict.ts | 4 +- frontend/src/views/home/index.vue | 1 + .../src/views/login/components/LoginForm.vue | 3 +- .../dictionary/dictPq/components/pqPopup.vue | 67 +++++++------------ .../views/system/dictionary/dictPq/index.vue | 8 +-- 7 files changed, 37 insertions(+), 56 deletions(-) diff --git a/frontend/src/api/system/dictionary/interface/index.ts b/frontend/src/api/system/dictionary/interface/index.ts index a2d96fd..f8ee2fa 100644 --- a/frontend/src/api/system/dictionary/interface/index.ts +++ b/frontend/src/api/system/dictionary/interface/index.ts @@ -107,7 +107,7 @@ export namespace Dict { unit?: string | null;//单位 harmStart?:number | null;//起始次数 harmEnd?:number | null;//结束次数 - classId?: string | null;//数据表表名 + classId: string ;//数据表表名 statMethod?:string;//数据统计类型(最大、最小、平均、CP95) systemType?:string | null;//系统类别(区分用能/电能) tranFlag?:number ;//数据是否上送(0:不上送 1:上送) @@ -116,10 +116,10 @@ export namespace Dict { storeFlag?:string ;//sts、di的是否存储 1:存储 0:不存 储; curSts?:number | null;//sts、do的当前值; ctlSts?:number;//do的是否可远程控制 1:是 0:否; - maxNum?:number | null;//设置最大值 - minNum?: number | null;//设置最小值 + maxNum?:number ;//设置最大值 + minNum?: number;//设置最小值 setValue?:string | null;//参数为enum可设置的所有值序列 - strlen?:number | null;//参数string可设置字符串的长度上 限 + strlen?:number ;//参数string可设置字符串的长度上 限 defaultValue?:string | null; //参数缺省值、告警code值 resourcesId?:string ; //报表数据来源(统计表表名) limitName?:string | null; //限值字段名称 diff --git a/frontend/src/api/user/login.ts b/frontend/src/api/user/login.ts index 6111f98..0af8b28 100644 --- a/frontend/src/api/user/login.ts +++ b/frontend/src/api/user/login.ts @@ -1,4 +1,4 @@ -import { Login } from './interface' +import type { Login } from './interface' import { ADMIN as rePrefix } from '@/api/config/serviceName' import http from '@/api' import type { Dict } from '../interface' diff --git a/frontend/src/stores/modules/dict.ts b/frontend/src/stores/modules/dict.ts index 09fb546..fb869e2 100644 --- a/frontend/src/stores/modules/dict.ts +++ b/frontend/src/stores/modules/dict.ts @@ -4,12 +4,12 @@ import piniaPersistConfig from '@/stores/helper/persist' import { DICT_STORE_KEY } from '@/stores/constant' // 模拟数据 //import dictData from '@/api/system/dictData' -import { getDictList } from '@/api/user/login.ts' + export const useDictStore = defineStore({ id: DICT_STORE_KEY, state: () => ({ - dictData: [], + dictData: [] as Dict[], }), getters: {}, actions: { diff --git a/frontend/src/views/home/index.vue b/frontend/src/views/home/index.vue index 932478f..3203e12 100644 --- a/frontend/src/views/home/index.vue +++ b/frontend/src/views/home/index.vue @@ -36,6 +36,7 @@ import { ElMessage } from "element-plus"; import { useAuthStore } from "@/stores/modules/auth"; import model from "./tabs/model.vue"; import dashboard from "./tabs/dashboard.vue"; +import { onMounted } from "vue"; const authStore = useAuthStore(); console.log(authStore.showMenuFlagGet, "????????????????33333333"); const activeIndex = ref("1-1"); diff --git a/frontend/src/views/login/components/LoginForm.vue b/frontend/src/views/login/components/LoginForm.vue index 7e4e68a..e7feefe 100644 --- a/frontend/src/views/login/components/LoginForm.vue +++ b/frontend/src/views/login/components/LoginForm.vue @@ -56,7 +56,7 @@ import { useRouter } from 'vue-router' import { HOME_URL } from '@/config' import { getTimeState } from '@/utils' -import { Dict, Login } from '@/api/interface' +import { type Dict, Login } from '@/api/interface' import { ElNotification } from 'element-plus' import { getDictList, loginApi } from '@/api/user/login' import { useUserStore } from '@/stores/modules/user' @@ -74,6 +74,7 @@ const userStore = useUserStore() const tabsStore = useTabsStore() const keepAliveStore = useKeepAliveStore() import { useDictStore } from '@/stores/modules/dict' +import { onMounted } from 'vue' const dictStore = useDictStore() diff --git a/frontend/src/views/system/dictionary/dictPq/components/pqPopup.vue b/frontend/src/views/system/dictionary/dictPq/components/pqPopup.vue index e4e0289..b8b755d 100644 --- a/frontend/src/views/system/dictionary/dictPq/components/pqPopup.vue +++ b/frontend/src/views/system/dictionary/dictPq/components/pqPopup.vue @@ -8,7 +8,7 @@ @@ -50,12 +50,13 @@ + @@ -72,10 +73,10 @@ /> - - + + - + 拓展数据 @@ -109,16 +110,16 @@ - + - + - + @@ -131,20 +132,20 @@ - - + + - - + + - - + + @@ -167,34 +168,10 @@ import { addDictPq, updateDictPq } from '@/api/system/dictionary/dictPq' import { computed, type Ref, ref } from 'vue'; import { useDictStore } from '@/stores/modules/dict' -import { getDictList } from '@/api/user/login.ts' const dictStore = useDictStore() // 定义弹出组件元信息 const dialogFormRef = ref() - const options = [ - { - value: 'Option1', - label: 'Option1', - }, - { - value: 'Option2', - label: 'Option2', - }, - { - value: 'Option3', - label: 'Option3', - }, - { - value: 'Option4', - label: 'Option4', - }, - { - value: 'Option5', - label: 'Option5', - }, -] - function useMetaInfo() { const dialogVisible = ref(false) const titleType = ref('add') @@ -205,7 +182,7 @@ import { getDictList } from '@/api/user/login.ts' sort: 100, dataType: '', state: 1, - + classId: '', }) return { dialogVisible, titleType, formContent } } @@ -220,7 +197,7 @@ import { getDictList } from '@/api/user/login.ts' sort: 100, dataType: '', state: 1, - + classId: '', } } @@ -233,6 +210,7 @@ import { getDictList } from '@/api/user/login.ts' dataType: [{ required: true, message: '数据模型必选!', trigger: 'change' }], name: [{ required: true, message: '指标名称必填!', trigger: 'blur' }], phase: [{ required: true, message: '相别必选!', trigger: 'change' }], + classId: [{ required: true, message: '数据库表名必选!', trigger: 'change' }], }) @@ -250,6 +228,7 @@ import { getDictList } from '@/api/user/login.ts' try { dialogFormRef.value?.validate(async (valid: boolean) => { if (valid) { + if (formContent.value.id) { await updateDictPq(formContent.value) } else { @@ -270,7 +249,7 @@ import { getDictList } from '@/api/user/login.ts' const open = (sign: string, data: Dict.ResDictPq) => { titleType.value = sign dialogVisible.value = true - console.log('123456',dictStore.getDictData('High_Cate')) + console.log('123456',dictStore) if (data.id) { formContent.value = { ...data } } else { diff --git a/frontend/src/views/system/dictionary/dictPq/index.vue b/frontend/src/views/system/dictionary/dictPq/index.vue index 2718695..bf662f7 100644 --- a/frontend/src/views/system/dictionary/dictPq/index.vue +++ b/frontend/src/views/system/dictionary/dictPq/index.vue @@ -24,7 +24,7 @@