Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import { storeToRefs } from 'pinia';
|
||||||
/**
|
/**
|
||||||
* 该接口声明文件用来声明通用的接口定义,比如 请求参数Base、响应Base、分页等
|
* 该接口声明文件用来声明通用的接口定义,比如 请求参数Base、响应Base、分页等
|
||||||
*/
|
*/
|
||||||
@@ -44,8 +45,11 @@ export interface ResPage<T> {
|
|||||||
*/
|
*/
|
||||||
export interface Dict {
|
export interface Dict {
|
||||||
id: string;
|
id: string;
|
||||||
label: string;
|
name: string;
|
||||||
code: string;
|
code: string;
|
||||||
|
value?: string;
|
||||||
|
sort?:number;
|
||||||
|
algoDescribe?: string;
|
||||||
children?: Dict[];
|
children?: Dict[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -107,24 +107,24 @@ export namespace Dict {
|
|||||||
unit?: string | null;//单位
|
unit?: string | null;//单位
|
||||||
harmStart?:number | null;//起始次数
|
harmStart?:number | null;//起始次数
|
||||||
harmEnd?:number | null;//结束次数
|
harmEnd?:number | null;//结束次数
|
||||||
classId?: string | null;//数据表表名
|
classId: string ;//数据表表名
|
||||||
statMethod?:string | null;//数据统计类型(最大、最小、平均、CP95)
|
statMethod?:string;//数据统计类型(最大、最小、平均、CP95)
|
||||||
systemType?:string | null;//系统类别(区分用能/电能)
|
systemType?:string | null;//系统类别(区分用能/电能)
|
||||||
tranFlag?:number | null;//数据是否上送(0:不上送 1:上送)
|
tranFlag?:number ;//数据是否上送(0:不上送 1:上送)
|
||||||
tranRule?:string | null;//上送规则 变化:“change”周期 :“ period”
|
tranRule?:string | null;//上送规则 变化:“change”周期 :“ period”
|
||||||
eventType?:string | null;//evt的事件类别 "1"、"2";
|
eventType?:string | null;//evt的事件类别 "1"、"2";
|
||||||
storeFlag?:string | null;//sts、di的是否存储 1:存储 0:不存 储;
|
storeFlag?:string ;//sts、di的是否存储 1:存储 0:不存 储;
|
||||||
curSts?:number | null;//sts、do的当前值;
|
curSts?:number | null;//sts、do的当前值;
|
||||||
ctlSts?:number | null;//do的是否可远程控制 1:是 0:否;
|
ctlSts?:number;//do的是否可远程控制 1:是 0:否;
|
||||||
maxNum?:number | null;//设置最大值
|
maxNum?:number ;//设置最大值
|
||||||
minNum?: number | null;//设置最小值
|
minNum?: number;//设置最小值
|
||||||
setValue?:string | null;//参数为enum可设置的所有值序列
|
setValue?:string | null;//参数为enum可设置的所有值序列
|
||||||
strlen?:number | null;//参数string可设置字符串的长度上 限
|
strlen?:number ;//参数string可设置字符串的长度上 限
|
||||||
defaultValue?:string | null; //参数缺省值、告警code值
|
defaultValue?:string | null; //参数缺省值、告警code值
|
||||||
resourcesId?:string | null; //报表数据来源(统计表表名)
|
resourcesId?:string ; //报表数据来源(统计表表名)
|
||||||
limitName?:string | null; //限值字段名称
|
limitName?:string | null; //限值字段名称
|
||||||
limitTable?:string | null;//限值表名
|
limitTable?:string | null;//限值表名
|
||||||
formula?:string | null;//超标判断方式
|
formula?:string ;//超标判断方式
|
||||||
primaryFormula?:string | null;//二次值转一次值公式
|
primaryFormula?:string | null;//二次值转一次值公式
|
||||||
state:number;//状态:0-删除 1-正常
|
state:number;//状态:0-删除 1-正常
|
||||||
createBy?:string | null;//创建用户
|
createBy?:string | null;//创建用户
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Login } from './interface'
|
import type { Login } from './interface'
|
||||||
import { ADMIN as rePrefix } from '@/api/config/serviceName'
|
import { ADMIN as rePrefix } from '@/api/config/serviceName'
|
||||||
import http from '@/api'
|
import http from '@/api'
|
||||||
import type { Dict } from '../interface'
|
import type { Dict } from '../interface'
|
||||||
@@ -26,7 +26,7 @@ export const logoutApi = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//获取下拉框列表
|
//获取下拉框列表
|
||||||
export const getDictList = (params:string) =>{
|
export const getDictList = () =>{
|
||||||
return http.post('/dictData/dictDataCache',params)
|
return http.get<Dict>('/dictData/dictDataCache')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,25 +1,30 @@
|
|||||||
|
import type { Dict } from './../../api/interface/index'
|
||||||
import { defineStore } from 'pinia'
|
import { defineStore } from 'pinia'
|
||||||
import piniaPersistConfig from '@/stores/helper/persist'
|
import piniaPersistConfig from '@/stores/helper/persist'
|
||||||
import { DICT_STORE_KEY } from '@/stores/constant'
|
import { DICT_STORE_KEY } from '@/stores/constant'
|
||||||
// 模拟数据
|
// 模拟数据
|
||||||
import dictData from '@/api/system/dictData'
|
//import dictData from '@/api/system/dictData'
|
||||||
|
|
||||||
//import { getDictList } from '@/api/user/login.ts'
|
|
||||||
//const dictData = getDictList
|
|
||||||
|
|
||||||
export const useDictStore = defineStore({
|
export const useDictStore = defineStore({
|
||||||
id: DICT_STORE_KEY,
|
id: DICT_STORE_KEY,
|
||||||
state: () => ({
|
state: () => ({
|
||||||
dictData,
|
dictData: [] as Dict[],
|
||||||
}),
|
}),
|
||||||
getters: {},
|
getters: {},
|
||||||
actions: {
|
actions: {
|
||||||
// 获取字典数据数组,如果为空则返回空数组
|
// 获取字典数据数组,如果为空则返回空数组
|
||||||
getDictData(code: string) {
|
getDictData(code: string) {
|
||||||
const dict = this.dictData.find(item => item.code === code )
|
if (!this.dictData.length) {
|
||||||
return dict?.children || []
|
return []
|
||||||
|
}
|
||||||
|
const dict = this.dictData.find(item => item.code === code)
|
||||||
|
return dict?.children || []
|
||||||
|
},
|
||||||
|
// 初始化获取全部字典数据并缓存
|
||||||
|
async initDictData(initData: Dict[]) {
|
||||||
|
this.dictData = initData
|
||||||
|
},
|
||||||
},
|
},
|
||||||
// 初始化获取全部字典数据并缓存
|
persist: piniaPersistConfig(DICT_STORE_KEY),
|
||||||
},
|
|
||||||
persist: piniaPersistConfig(DICT_STORE_KEY),
|
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ import { ElMessage } from "element-plus";
|
|||||||
import { useAuthStore } from "@/stores/modules/auth";
|
import { useAuthStore } from "@/stores/modules/auth";
|
||||||
import model from "./tabs/model.vue";
|
import model from "./tabs/model.vue";
|
||||||
import dashboard from "./tabs/dashboard.vue";
|
import dashboard from "./tabs/dashboard.vue";
|
||||||
|
import { onMounted } from "vue";
|
||||||
const authStore = useAuthStore();
|
const authStore = useAuthStore();
|
||||||
console.log(authStore.showMenuFlagGet, "????????????????33333333");
|
console.log(authStore.showMenuFlagGet, "????????????????33333333");
|
||||||
const activeIndex = ref("1-1");
|
const activeIndex = ref("1-1");
|
||||||
|
|||||||
@@ -1,146 +1,154 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-form
|
<el-form
|
||||||
ref="loginFormRef"
|
ref='loginFormRef'
|
||||||
:model="loginForm"
|
:model='loginForm'
|
||||||
:rules="loginRules"
|
:rules='loginRules'
|
||||||
size="large"
|
size='large'
|
||||||
>
|
>
|
||||||
<el-form-item prop="username">
|
<el-form-item prop='username'>
|
||||||
<el-input v-model="loginForm.username" placeholder="用户名">
|
<el-input v-model='loginForm.username' placeholder='用户名'>
|
||||||
<template #prefix>
|
<template #prefix>
|
||||||
<el-icon class="el-input__icon">
|
<el-icon class='el-input__icon'>
|
||||||
<user />
|
<user />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
</template>
|
</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item prop="password">
|
<el-form-item prop='password'>
|
||||||
<el-input
|
<el-input
|
||||||
v-model="loginForm.password"
|
v-model='loginForm.password'
|
||||||
type="password"
|
type='password'
|
||||||
placeholder="密码"
|
placeholder='密码'
|
||||||
show-password
|
show-password
|
||||||
autocomplete="new-password"
|
autocomplete='new-password'
|
||||||
>
|
>
|
||||||
<template #prefix>
|
<template #prefix>
|
||||||
<el-icon class="el-input__icon">
|
<el-icon class='el-input__icon'>
|
||||||
<lock />
|
<lock />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
</template>
|
</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div class="login-btn">
|
<div class='login-btn'>
|
||||||
<el-button
|
<el-button
|
||||||
:icon="UserFilled"
|
:icon='UserFilled'
|
||||||
round
|
round
|
||||||
size="large"
|
size='large'
|
||||||
type="primary"
|
type='primary'
|
||||||
:loading="loading"
|
:loading='loading'
|
||||||
@click="login(loginFormRef)"
|
@click='login(loginFormRef)'
|
||||||
>
|
>
|
||||||
登录
|
登录
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
:icon="CircleClose"
|
:icon='CircleClose'
|
||||||
round
|
round
|
||||||
size="large"
|
size='large'
|
||||||
@click="resetForm(loginFormRef)"
|
@click='resetForm(loginFormRef)'
|
||||||
>
|
>
|
||||||
重置
|
重置
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang='ts'>
|
||||||
import { useRouter } from "vue-router";
|
import { useRouter } from 'vue-router'
|
||||||
import { HOME_URL } from "@/config";
|
import { HOME_URL } from '@/config'
|
||||||
import { getTimeState } from "@/utils";
|
import { getTimeState } from '@/utils'
|
||||||
import { Login } from "@/api/interface";
|
import { type Dict, Login } from '@/api/interface'
|
||||||
import { ElNotification } from "element-plus";
|
import { ElNotification } from 'element-plus'
|
||||||
import { loginApi } from "@/api/user/login";
|
import { getDictList, loginApi } from '@/api/user/login'
|
||||||
import { useUserStore } from "@/stores/modules/user";
|
import { useUserStore } from '@/stores/modules/user'
|
||||||
import { useTabsStore } from "@/stores/modules/tabs";
|
import { useTabsStore } from '@/stores/modules/tabs'
|
||||||
import { useKeepAliveStore } from "@/stores/modules/keepAlive";
|
import { useKeepAliveStore } from '@/stores/modules/keepAlive'
|
||||||
import { initDynamicRouter } from "@/routers/modules/dynamicRouter";
|
import { initDynamicRouter } from '@/routers/modules/dynamicRouter'
|
||||||
import { CircleClose, UserFilled } from "@element-plus/icons-vue";
|
import { CircleClose, UserFilled } from '@element-plus/icons-vue'
|
||||||
import { useAuthStore } from "@/stores/modules/auth";
|
import { useAuthStore } from '@/stores/modules/auth'
|
||||||
import type { ElForm } from "element-plus";
|
import type { ElForm } from 'element-plus'
|
||||||
import md5 from "md5";
|
import md5 from 'md5'
|
||||||
const authStore = useAuthStore();
|
|
||||||
const router = useRouter();
|
const authStore = useAuthStore()
|
||||||
const userStore = useUserStore();
|
const router = useRouter()
|
||||||
const tabsStore = useTabsStore();
|
const userStore = useUserStore()
|
||||||
const keepAliveStore = useKeepAliveStore();
|
const tabsStore = useTabsStore()
|
||||||
|
const keepAliveStore = useKeepAliveStore()
|
||||||
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
|
import { onMounted } from 'vue'
|
||||||
|
|
||||||
|
const dictStore = useDictStore()
|
||||||
|
|
||||||
|
|
||||||
type FormInstance = InstanceType<typeof ElForm>;
|
type FormInstance = InstanceType<typeof ElForm>;
|
||||||
const loginFormRef = ref<FormInstance>();
|
const loginFormRef = ref<FormInstance>()
|
||||||
const loginRules = reactive({
|
const loginRules = reactive({
|
||||||
username: [{ required: true, message: "请输入用户名", trigger: "blur" }],
|
username: [{ required: true, message: '请输入用户名', trigger: 'blur' }],
|
||||||
password: [{ required: true, message: "请输入密码", trigger: "blur" }],
|
password: [{ required: true, message: '请输入密码', trigger: 'blur' }],
|
||||||
});
|
})
|
||||||
|
|
||||||
const loading = ref(false);
|
const loading = ref(false)
|
||||||
const loginForm = reactive<Login.ReqLoginForm>({
|
const loginForm = reactive<Login.ReqLoginForm>({
|
||||||
username: "",
|
username: '',
|
||||||
password: "",
|
password: '',
|
||||||
});
|
})
|
||||||
|
|
||||||
// login
|
// login
|
||||||
const login = (formEl: FormInstance | undefined) => {
|
const login = (formEl: FormInstance | undefined) => {
|
||||||
if (!formEl) return;
|
if (!formEl) return
|
||||||
formEl.validate(async (valid) => {
|
formEl.validate(async (valid) => {
|
||||||
if (!valid) return;
|
if (!valid) return
|
||||||
loading.value = true;
|
loading.value = true
|
||||||
try {
|
try {
|
||||||
// 1.执行登录接口
|
// 1.执行登录接口
|
||||||
const { data } = await loginApi({
|
const { data } = await loginApi({
|
||||||
...loginForm,
|
...loginForm,
|
||||||
password: md5(loginForm.password),
|
password: md5(loginForm.password),
|
||||||
});
|
})
|
||||||
userStore.setToken(data.accessToken);
|
userStore.setToken(data.accessToken)
|
||||||
|
const response = await getDictList()
|
||||||
|
const dictData = response.data as unknown as Dict[]
|
||||||
|
await dictStore.initDictData(dictData)
|
||||||
// 2.添加动态路由
|
// 2.添加动态路由
|
||||||
await initDynamicRouter();
|
await initDynamicRouter()
|
||||||
|
|
||||||
// 3.清空 tabs、keepAlive 数据
|
// 3.清空 tabs、keepAlive 数据
|
||||||
tabsStore.setTabs([]);
|
tabsStore.setTabs([])
|
||||||
keepAliveStore.setKeepAliveName([]);
|
keepAliveStore.setKeepAliveName([])
|
||||||
|
|
||||||
// 4.跳转到首页
|
// 4.跳转到首页
|
||||||
router.push(HOME_URL);
|
router.push(HOME_URL)
|
||||||
// 5.登录默认不显示菜单和导航栏
|
// 5.登录默认不显示菜单和导航栏
|
||||||
authStore.resetAuthStore();
|
authStore.resetAuthStore()
|
||||||
ElNotification({
|
ElNotification({
|
||||||
title: getTimeState(),
|
title: getTimeState(),
|
||||||
message: "登录成功",
|
message: '登录成功',
|
||||||
type: "success",
|
type: 'success',
|
||||||
duration: 3000,
|
duration: 3000,
|
||||||
});
|
})
|
||||||
} finally {
|
} finally {
|
||||||
loading.value = false;
|
loading.value = false
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
};
|
}
|
||||||
|
|
||||||
// resetForm
|
// resetForm
|
||||||
const resetForm = (formEl: FormInstance | undefined) => {
|
const resetForm = (formEl: FormInstance | undefined) => {
|
||||||
if (!formEl) return;
|
if (!formEl) return
|
||||||
formEl.resetFields();
|
formEl.resetFields()
|
||||||
};
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
// 监听 enter 事件(调用登录)
|
// 监听 enter 事件(调用登录)
|
||||||
document.onkeydown = (e: KeyboardEvent) => {
|
document.onkeydown = (e: KeyboardEvent) => {
|
||||||
e = (window.event as KeyboardEvent) || e;
|
e = (window.event as KeyboardEvent) || e
|
||||||
if (e.code === "Enter" || e.code === "enter" || e.code === "NumpadEnter") {
|
if (e.code === 'Enter' || e.code === 'enter' || e.code === 'NumpadEnter') {
|
||||||
if (loading.value) return;
|
if (loading.value) return
|
||||||
login(loginFormRef.value);
|
login(loginFormRef.value)
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
});
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang='scss'>
|
||||||
@import "../index.scss";
|
@import "../index.scss";
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
<script setup lang="ts" name="login">
|
<script setup lang="ts" name="login">
|
||||||
import LoginForm from "./components/LoginForm.vue";
|
import LoginForm from "./components/LoginForm.vue";
|
||||||
const title = import.meta.env.VITE_GLOB_APP_TITLE;
|
const title = import.meta.env.VITE_GLOB_APP_TITLE;
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
|||||||
@@ -1,135 +1,156 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog v-model='dialogVisible' :title='dialogTitle' v-bind='dialogMiddle' @close="close">
|
<el-dialog v-model='dialogVisible' :title='dialogTitle' v-bind='dialogMiddle' @close="close">
|
||||||
<div>
|
|
||||||
<el-form :model='formContent' ref='dialogFormRef' :rules='rules' class='form-two'>
|
<el-form :model='formContent' ref='dialogFormRef' :rules='rules' class='form-two'>
|
||||||
<el-form-item label='数据模型' :label-width='100' prop='dataType'>
|
<el-divider >基础数据</el-divider>
|
||||||
<el-select v-model="formContent.dataType" placeholder="请选择资源类型">
|
<el-form-item label='数据模型' :label-width='140' prop='dataType'>
|
||||||
|
<el-select v-model="formContent.dataType" clearable placeholder="请选择资源类型">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in dictStore.getDictData('dataType')"
|
v-for="item in dictStore.getDictData('High_Cate')"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:label="item.label"
|
:label="item.name"
|
||||||
:value="item.code"
|
:value="item.code"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label='指标名称' :label-width='100' prop='name'>
|
<el-form-item label='指标名称' :label-width='140' prop='name'>
|
||||||
<el-input v-model='formContent.name' placeholder='请输入' autocomplete='off' />
|
<el-input v-model='formContent.name' placeholder='请输入' autocomplete='off' />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label='别名' :label-width='100' prop='otherName'>
|
<el-form-item label='别名' :label-width='140' prop='otherName'>
|
||||||
<el-input v-model='formContent.otherName' placeholder='请输入' autocomplete='off' />
|
<el-input v-model='formContent.otherName' placeholder='请输入' autocomplete='off' />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label='显示名称' :label-width='100' prop='showName'>
|
<el-form-item label='显示名称' :label-width='140' prop='showName'>
|
||||||
<el-input v-model='formContent.showName' placeholder='请输入' autocomplete='off' />
|
<el-input v-model='formContent.showName' placeholder='请输入' autocomplete='off' />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label='相别' :label-width='100' prop='phase'>
|
<el-form-item label='相别' :label-width='140' prop='phase'>
|
||||||
<el-select v-model="formContent.phase" placeholder="请选择相别">
|
<el-select v-model="formContent.phase" clearable placeholder="请选择相别">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in dictStore.getDictData('dataType')"
|
v-for="item in dictStore.getDictData('phase')"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:label="item.label"
|
:name="item.name"
|
||||||
:value="item.code"
|
:value="item.code"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label='单位' :label-width='100' prop='unit'>
|
<el-form-item label='单位' :label-width='140' prop='unit'>
|
||||||
<el-input v-model='formContent.unit' placeholder='请输入单位' autocomplete='off' />
|
<el-input v-model='formContent.unit' placeholder='请输入单位' autocomplete='off' />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label='指标数据类型' :label-width='100' prop='type'>
|
<el-form-item label='指标数据类型' :label-width='140' prop='type'>
|
||||||
<el-input v-model='formContent.type' placeholder='请输入指标数据类型' autocomplete='off' />
|
<el-input v-model='formContent.type' placeholder='请输入指标数据类型' autocomplete='off' />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label='开始结束' :label-width='100' prop='type'>
|
<el-form-item label='次数' :label-width='140'>
|
||||||
<el-input v-model='formContent.type' placeholder='请输入开始结束' autocomplete='off' />
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="11">
|
||||||
|
<el-input v-model="formContent.harmStart" placeholder="请输入起始次数" autocomplete="off" />
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="2" class="text-center" style="line-height: 32px;">-</el-col>
|
||||||
|
<el-col :span="11">
|
||||||
|
<el-input v-model="formContent.harmEnd" placeholder="请输入结束次数" autocomplete="off" />
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label='数据统计类型' :label-width='100' prop='statMethod'>
|
<el-form-item label='数据统计类型' :label-width='140' prop='statMethod'>
|
||||||
<el-select v-model="formContent.statMethod" placeholder="请选择数据统计类型">
|
|
||||||
<el-option
|
<el-select v-model="formContent.statMethod" multiple placeholder="请选择数据统计类型">
|
||||||
|
<el-option
|
||||||
v-for="item in dictStore.getDictData('statMethod')"
|
v-for="item in dictStore.getDictData('statMethod')"
|
||||||
:key="item.id"
|
:key="item.value"
|
||||||
:label="item.label"
|
:name="item.name"
|
||||||
:value="item.code"
|
:value="item.code"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label='报表数据来源' :label-width='100' prop='resourcesId'>
|
<el-form-item label='系统类别' :label-width='140' prop='systemType'>
|
||||||
<el-select v-model="formContent.resourcesId" placeholder="请选择报表数据来源">
|
<el-input v-model='formContent.systemType' placeholder='请输入' autocomplete='off' />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label='报表数据来源' :label-width='140' prop='resourcesId'>
|
||||||
|
<el-select v-model="formContent.resourcesId" clearable placeholder="请选择报表数据来源">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in dictStore.getDictData('statMethod')"
|
v-for="item in dictStore.getDictData('resourcesId')"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:label="item.label"
|
:name="item.name"
|
||||||
:value="item.code"
|
:value="item.code"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label='数据表表名' :label-width='100' prop='statMethod'>
|
<el-form-item label='数据表表名' :label-width='140' prop='classId'>
|
||||||
<el-select v-model="formContent.statMethod" placeholder="请选择数据表表名">
|
<el-select v-model="formContent.classId" clearable placeholder="请选择数据表表名">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in dictStore.getDictData('statMethod')"
|
v-for="item in dictStore.getDictData('classId')"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:label="item.label"
|
:name="item.name"
|
||||||
:value="item.code"
|
:value="item.code"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label='排序' :label-width='100'>
|
<el-form-item label='限值字段名称' :label-width='140' prop='limitName'>
|
||||||
<el-input-number v-model='formContent.sort' />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label='限值字段名称' :label-width='100' prop='limitName'>
|
|
||||||
<el-input v-model='formContent.limitName' placeholder='请输入限值字段名称' autocomplete='off' />
|
<el-input v-model='formContent.limitName' placeholder='请输入限值字段名称' autocomplete='off' />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label='限值表名' :label-width='100' prop='limitTable'>
|
<el-form-item label='限值表名' :label-width='140' prop='limitTable'>
|
||||||
<el-input v-model='formContent.limitTable' placeholder='请输入限值表名' autocomplete='off' />
|
<el-input v-model='formContent.limitTable' placeholder='请输入限值表名' autocomplete='off' />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label='超标判断方式' :label-width='100' prop='formula'>
|
<el-form-item label='超标判断方式' :label-width='140' prop='formula'>
|
||||||
<el-select v-model="formContent.formula" placeholder="请选择超标判断方式">
|
<el-select v-model="formContent.formula" clearable placeholder="请选择超标判断方式">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in dictStore.getDictData('formula')"
|
v-for="item in dictStore.getDictData('formula')"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:label="item.label"
|
:name="item.name"
|
||||||
:value="item.code"
|
:value="item.code"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label='参数缺省值' :label-width='100' prop='defaultValue'>
|
<el-form-item label='排序' :label-width='140'>
|
||||||
|
<el-input-number v-model='formContent.sort' :min="0" controls-position="right" style="width: 300px;"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-divider >拓展数据</el-divider>
|
||||||
|
<el-form-item label='参数缺省值' :label-width='140' prop='defaultValue'>
|
||||||
<el-input v-model='formContent.defaultValue' placeholder='请输入参数缺省值' autocomplete='off' />
|
<el-input v-model='formContent.defaultValue' placeholder='请输入参数缺省值' autocomplete='off' />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label='事件类别' :label-width='100' prop='eventType'>
|
<el-form-item label='事件类别' :label-width='140' prop='eventType'>
|
||||||
<el-input v-model='formContent.eventType' placeholder='请输入事件类别' autocomplete='off' />
|
<el-input v-model='formContent.eventType' placeholder='请输入事件类别' autocomplete='off' />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label='设置最大值' :label-width='100' prop='maxNum'>
|
<el-form-item label='设置最大值' :label-width='140' prop='maxNum'>
|
||||||
<el-input v-model='formContent.maxNum' placeholder='请输入最大值' autocomplete='off' />
|
<el-input-number v-model='formContent.maxNum' controls-position="right" style="width: 300px;"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label='设置最小值' :label-width='100' prop='minNum'>
|
<el-form-item label='设置最小值' :label-width='140' prop='minNum'>
|
||||||
<el-input v-model='formContent.minNum' placeholder='请输入最小值' autocomplete='off' />
|
<el-input-number v-model='formContent.minNum' controls-position="right" style="width: 300px;"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label='枚举序列' :label-width='100' prop='setValue'>
|
<el-form-item label='枚举序列' :label-width='140' prop='setValue'>
|
||||||
<el-input v-model='formContent.setValue' placeholder='请输入枚举序列' autocomplete='off' />
|
<el-input v-model='formContent.setValue' placeholder='请输入枚举序列' autocomplete='off' />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label='字符串长度上限' :label-width='100' prop='strlen'>
|
<el-form-item label='字符串长度上限' :label-width='140' prop='strlen'>
|
||||||
<el-input v-model='formContent.strlen' placeholder='请输入字符串长度上限' autocomplete='off' />
|
<el-input-number v-model='formContent.strlen' controls-position="right" style="width: 300px;"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label='上送规则' :label-width='100' prop='tranRule'>
|
<el-form-item label='上送规则' :label-width='140' prop='tranRule'>
|
||||||
<el-input v-model='formContent.tranRule' placeholder='请输入上送规则' autocomplete='off' />
|
<el-input v-model='formContent.tranRule' placeholder='请输入上送规则' autocomplete='off' />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="是否可远程控制" :label-width="100">
|
<el-form-item label='当前值' :label-width='140' prop='curSts'>
|
||||||
|
<el-input v-model='formContent.curSts' placeholder='请输入当前值' autocomplete='off' />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label='二次值转一次值公式' :label-width='140' prop='primaryFormula'>
|
||||||
|
<el-input v-model='formContent.primaryFormula' placeholder='请输入公式' autocomplete='off' />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="是否可远程控制" :label-width="140">
|
||||||
<el-radio-group v-model="formContent.ctlSts" >
|
<el-radio-group v-model="formContent.ctlSts" >
|
||||||
<el-radio-button label="是" :value="1"></el-radio-button>
|
<el-radio label="是" :value="1"></el-radio>
|
||||||
<el-radio-button label="否" :value="0"></el-radio-button>
|
<el-radio label="否" :value="0"></el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="是否存储" :label-width="100">
|
<el-form-item label="是否存储" :label-width="140">
|
||||||
<el-radio-group v-model="formContent.storeFlag" >
|
<el-radio-group v-model="formContent.storeFlag" >
|
||||||
<el-radio-button label="是" :value="1"></el-radio-button>
|
<el-radio label="是" :value="1"></el-radio>
|
||||||
<el-radio-button label="否" :value="0"></el-radio-button>
|
<el-radio label="否" :value="0"></el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="数据是否上送" :label-width="100">
|
<el-form-item label="数据是否上送" :label-width="140">
|
||||||
<el-radio-group v-model="formContent.tranFlag" >
|
<el-radio-group v-model="formContent.tranFlag" >
|
||||||
<el-radio-button label="是" :value="1"></el-radio-button>
|
<el-radio label="是" :value="1"></el-radio>
|
||||||
<el-radio-button label="否" :value="0"></el-radio-button>
|
<el-radio label="否" :value="0"></el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
</el-form>
|
</el-form>
|
||||||
</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>
|
||||||
@@ -148,9 +169,9 @@
|
|||||||
import { computed, type Ref, ref } from 'vue';
|
import { computed, type Ref, ref } from 'vue';
|
||||||
import { useDictStore } from '@/stores/modules/dict'
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
const dictStore = useDictStore()
|
const dictStore = useDictStore()
|
||||||
|
|
||||||
// 定义弹出组件元信息
|
// 定义弹出组件元信息
|
||||||
const dialogFormRef = ref()
|
const dialogFormRef = ref()
|
||||||
|
|
||||||
function useMetaInfo() {
|
function useMetaInfo() {
|
||||||
const dialogVisible = ref(false)
|
const dialogVisible = ref(false)
|
||||||
const titleType = ref('add')
|
const titleType = ref('add')
|
||||||
@@ -161,12 +182,12 @@
|
|||||||
sort: 100,
|
sort: 100,
|
||||||
dataType: '',
|
dataType: '',
|
||||||
state: 1,
|
state: 1,
|
||||||
|
classId: '',
|
||||||
})
|
})
|
||||||
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 = {
|
||||||
@@ -176,17 +197,20 @@
|
|||||||
sort: 100,
|
sort: 100,
|
||||||
dataType: '',
|
dataType: '',
|
||||||
state: 1,
|
state: 1,
|
||||||
|
classId: '',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let dialogTitle = computed(() => {
|
let dialogTitle = computed(() => {
|
||||||
return titleType.value === 'add' ? '新增字典类型' : '编辑字典类型'
|
return titleType.value === 'add' ? '新增字典' : '编辑字典'
|
||||||
})
|
})
|
||||||
|
|
||||||
// 定义表单校验规则
|
// 定义表单校验规则
|
||||||
const rules: Ref<Record<string, Array<FormItemRule>>> = ref({
|
const rules: Ref<Record<string, Array<FormItemRule>>> = ref({
|
||||||
name: [{ required: true, message: '类型名称必填!', trigger: 'blur' }],
|
dataType: [{ required: true, message: '数据模型必选!', trigger: 'change' }],
|
||||||
code: [{ required: true, message: '类型编码必填!', trigger: 'blur' }],
|
name: [{ required: true, message: '指标名称必填!', trigger: 'blur' }],
|
||||||
|
phase: [{ required: true, message: '相别必选!', trigger: 'change' }],
|
||||||
|
classId: [{ required: true, message: '数据库表名必选!', trigger: 'change' }],
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@@ -202,8 +226,9 @@
|
|||||||
// 保存数据
|
// 保存数据
|
||||||
const save = () => {
|
const save = () => {
|
||||||
try {
|
try {
|
||||||
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 updateDictPq(formContent.value)
|
await updateDictPq(formContent.value)
|
||||||
} else {
|
} else {
|
||||||
@@ -221,9 +246,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 打开弹窗,可能是新增,也可能是编辑
|
// 打开弹窗,可能是新增,也可能是编辑
|
||||||
const open = (sign: string, data: Dict.ResDictType) => {
|
const open = (sign: string, data: Dict.ResDictPq) => {
|
||||||
titleType.value = sign
|
titleType.value = sign
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
|
console.log('123456',dictStore)
|
||||||
if (data.id) {
|
if (data.id) {
|
||||||
formContent.value = { ...data }
|
formContent.value = { ...data }
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
<script setup lang='tsx' name='dict'>
|
<script setup lang='tsx' name='dict'>
|
||||||
import {CirclePlus, Delete, EditPen, Download, View} from '@element-plus/icons-vue'
|
import {CirclePlus, Delete, EditPen, Download, View} from '@element-plus/icons-vue'
|
||||||
import {Dict} from '@/api/system/dictionary/interface'
|
import {type Dict} from '@/api/system/dictionary/interface'
|
||||||
import {ProTableInstance, ColumnProps} from '@/components/ProTable/interface'
|
import {ProTableInstance, ColumnProps} from '@/components/ProTable/interface'
|
||||||
import PqPopup from '@/views/system/dictionary/dictPq/components/pqPopup.vue'
|
import PqPopup from '@/views/system/dictionary/dictPq/components/pqPopup.vue'
|
||||||
import {useDictStore} from '@/stores/modules/dict'
|
import {useDictStore} from '@/stores/modules/dict'
|
||||||
@@ -50,9 +50,9 @@
|
|||||||
prop: 'dataType',
|
prop: 'dataType',
|
||||||
label: '数据模型',
|
label: '数据模型',
|
||||||
width: 180,
|
width: 180,
|
||||||
search: {
|
enum: dictStore.getDictData('High_Cate'),
|
||||||
el: 'select',
|
search: { el: 'select', props: { filterable: true } },
|
||||||
},
|
fieldNames: { label: 'name', value: 'code' },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'name',
|
prop: 'name',
|
||||||
@@ -107,6 +107,16 @@
|
|||||||
prop: 'statMethod',
|
prop: 'statMethod',
|
||||||
label: '数据统计类型',
|
label: '数据统计类型',
|
||||||
width: 180,
|
width: 180,
|
||||||
|
render: (row) => {
|
||||||
|
const methods = row.statMethod || []; // 确保statMethod存在
|
||||||
|
if (methods.length === 0) {
|
||||||
|
return '/'; // 空值时显示/
|
||||||
|
} else if (methods.length > 2) {
|
||||||
|
return methods.join(', '); // 超过两个用逗号分隔
|
||||||
|
} else {
|
||||||
|
return methods.join(' '); // 少于等于两个时用空格分隔
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'classId',
|
prop: 'classId',
|
||||||
|
|||||||
Reference in New Issue
Block a user