模式切换

This commit is contained in:
sjl
2024-12-05 11:07:45 +08:00
parent 9e8cdaead6
commit 2878dce69d
11 changed files with 156 additions and 26 deletions

View File

@@ -15,7 +15,7 @@ export namespace TestSource {
// 检测源接口
export interface ResTestSource {
id: string; //检测源ID
name: string; //检测源名称(检测源类型 + 设备类型 + 数字自动生成)
name?: string; //检测源名称(检测源类型 + 设备类型 + 数字自动生成)
pattern: string;//检测源模式(字典表Code字段数字、模拟、比对)
type: string; //检测源类型(字典表Code字段标准源、高精度设备)
devType: string;//检测源设备类型(字典表Code字段)

View File

@@ -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 ;//设置最大值
minNum?: number;//设置最小值
maxNum?:number | null;//设置最大值
minNum?: number| null;//设置最小值
setValue?:string | null;//参数为enum可设置的所有值序列
strlen?:number ;//参数string可设置字符串的长度上 限
strlen?:number | null;//参数string可设置字符串的长度上 限
defaultValue?:string | null; //参数缺省值、告警code值
resourcesId?:string ; //报表数据来源(统计表表名)
limitName?:string | null; //限值字段名称

View File

@@ -13,7 +13,7 @@
<el-button :icon='customIcons[iconValue]' />
</template>
</el-input>
<el-dialog v-model='dialogVisible' :title='placeholder' top='50px' width='66%'>
<el-dialog v-model='dialogVisible' :title='placeholder' top='5%' width='30%' >
<el-input v-model='inputValue' placeholder='搜索图标' size='large' :prefix-icon='Icons.Search' />
<el-scrollbar v-if='Object.keys(iconsList).length'>
<div class='icon-list'>

View File

@@ -18,13 +18,13 @@
<!-- </el-button> -->
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item @click="title = '模拟式模块'"
<el-dropdown-item @click="handelOpen('模拟式')"
>模拟式模块</el-dropdown-item
>
<el-dropdown-item @click="title = '数字式模块'"
<el-dropdown-item @click="handelOpen('数字式')"
>数字式模块</el-dropdown-item
>
<el-dropdown-item @click="title = '比对式模块'"
<el-dropdown-item @click="handelOpen('比对式')"
>比对式模块</el-dropdown-item
>
</el-dropdown-menu>
@@ -39,9 +39,13 @@
</template>
<script lang="ts" setup>
import { ref, reactive, computed, onMounted, watch } from "vue";
import { useAuthStore } from "@/stores/modules/auth";
const title = ref("模拟式模块");
import { useModeStore } from '@/stores/modules/mode'; // 引入模式 store
import { useRouter } from "vue-router";
const router = useRouter();
const authStore = useAuthStore();
const modeStore = useModeStore();
watch(() => modeStore.currentMode, (newVal) => {
//console.log('当前模式:', newVal);
@@ -59,6 +63,13 @@ watch(() => modeStore.currentMode, (newVal) => {
title.value = '模拟式模块';
}
});
const handelOpen = async (item: string) => {
await authStore.setShowMenu();
modeStore.setCurrentMode(item); // 将模式code存入 store
router.push({ path: "/home/index" });
};
</script>
<style scoped lang="scss">
@import "./index.scss";

View File

@@ -1,6 +1,6 @@
<template>
<el-dialog :title="dialogTitle" :model-value="dialogVisible" @close="close" v-bind="dialogMiddle">
<el-form :model="formContent" ref='dialogFormRef' :rules='rules' >
<el-form :model="formContent" ref='dialogFormRef' :rules='rules' class="form-two">
<el-form-item label="上级菜单" prop="pid" :label-width="100">
<el-tree-select
v-model="displayPid"

View File

@@ -74,9 +74,9 @@ const columns = ref<ColumnProps<ErrorSystem.ErrorSystemList>[]>([
// 打开 drawer(新增、编辑)
const openDialog = (titleType: string, row: Partial<ErrorSystem.ErrorSystemList> = {}) => {
if(titleType == 'view'){
//errorStandardPopup.value?.open(row.name, row)
errorStandardPopup.value?.open(row.name, row)
}else{
//errorSystemPopup.value?.open(titleType, row)
errorSystemPopup.value?.open(titleType, row)
}

View File

@@ -68,7 +68,6 @@ function useMetaInfo() {
const titleType = ref('add')
const formContent = ref<TestSource.ResTestSource>({
id: '',
name: '',
pattern: modeId.value,
parameter: '',
type: '',
@@ -83,7 +82,6 @@ const {dialogVisible, titleType, formContent} = useMetaInfo()
const resetFormContent = () => {
formContent.value = {
id: '',
name: '',
pattern: modeId.value,
parameter: '',
type: '',
@@ -157,7 +155,7 @@ const open = async (sign: string, data: TestSource.ResTestSource, currentMode: s
dialogFormRef.value?.resetFields()
}
const changeParameter = (parameterArr) => {
const changeParameter = (parameterArr: any) => {
formContent.value.parameter = JSON.stringify(parameterArr)
}

View File

@@ -279,6 +279,7 @@ function getScriptName(id: string) {
}
function getErrSysName(id: string) {
return testErrSystDataList.find(item => item.id == id)?.label
}

View File

@@ -268,14 +268,13 @@ import {dialogBig} from '@/utils/elementBind'
import {type Dict} from '@/api/system/dictionary/interface'
import {ElMessage, type FormItemRule} from 'element-plus'
import {addDictPq, updateDictPq} from '@/api/system/dictionary/dictPq'
import {computed, type Ref, ref} from 'vue';
import {computed, reactive, type Ref, ref} from 'vue';
import {useDictStore} from '@/stores/modules/dict'
import selectCheckBox from "@/views/system/dictionary/dictPq/components/selectCheckBox.vue";
const dictStore = useDictStore()
const selectedStatMethods = ref<string[]>([])
// 定义弹出组件元信息
const dialogFormRef = ref()
function useMetaInfo() {
const dialogVisible = ref(false)
const titleType = ref('add')
@@ -288,8 +287,8 @@ function useMetaInfo() {
phase: '',
unit: '',
type: 'Number',
harmStart: '',
harmEnd: '',
harmStart: null,
harmEnd: null,
systemType: '',
resourcesId: '',
classId: '',
@@ -299,15 +298,15 @@ function useMetaInfo() {
sort: 100,
defaultValue: '',
eventType: '',
maxNum: '',
minNum: '',
maxNum: null,
minNum: null,
setValue: '',
strlen: '',
strlen: null,
tranRule: '',
curSts: '',
curSts: null,
primaryFormula: '',
ctlSts: 0,
storeFlag: 0,
storeFlag: '',
tranFlag: 0,
state: 1,
})

View File

@@ -0,0 +1,121 @@
<template>
<el-select
v-model="menusTitle"
multiple
collapse-tags
collapse-tags-tooltip
:placeholder="props.placeholder"
clearable
@clear="clearData"
:popper-append-to-body="false"
>
<!-- @change="changeSelectMenu" -->
<el-checkbox v-model="checkedAll" @change="selectAll">全选</el-checkbox>
<el-option
v-for="(item, index) in menuList"
:key="item[props.id]"
:value="item[props.id]"
>
<el-checkbox
:label="item[props.label]"
size="large"
@change="changeCheckBox(item, index)"
:checked="isChecked(item, index)"
v-model="checkBoxObj[index]"
/>
</el-option>
</el-select>
</template>
<script lang="ts" setup>
import { ref, reactive, defineProps, defineEmits } from "vue";
const props = defineProps({
list: { type: Array, required: true },
id: { type: String, required: true },
label: { type: String, required: true },
modelValue: { type: Array },
placeholder: { type: String, default: "选择" },
});
const emit = defineEmits(["update:modelValue"]);
const value = ref("");
const checkedAll = ref("false");
const menus = ref([]);
const menuList = props.list;
const checkBoxObj = ref({});
menuList.forEach((res, index) => {
checkBoxObj.value[index] = false;
});
const menusTitle = ref([]);
const changeSelectMenu = (val) => {};
const selectAll = (value) => {
menus.value = [];
menusTitle.value = [];
if (value) {
menuList.forEach((item, index) => {
menus.value.push(item[props.id]);
menusTitle.value.push(item[props.label]);
checkBoxObj.value[index] = true;
});
} else {
menus.value = [];
menusTitle.value = [];
menuList.forEach((item, index) => {
checkBoxObj.value[index] = false;
});
}
emit("update:modelValue", menus.value);
};
const isChecked = (item) => {
return menus.value.indexOf(item[props.id]) > -1;
};
const changeCheckBox = (item, index) => {
let i = menus.value.indexOf(item[props.id]);
if (i == -1) {
menus.value.push(item[props.id]);
menusTitle.value.push(item[props.label]);
} else {
menus.value.splice(i, 1);
menusTitle.value.splice(i, 1);
}
if (menus.value.length == menuList.length) {
checkedAll.value = true;
} else {
checkedAll.value = false;
}
emit("update:modelValue", menus.value);
};
const clearData = () => {
menus.value = [];
menusTitle.value = [];
emit("update:modelValue", menus.value);
checkedAll.value = false;
menuList.forEach((item, index) => {
checkBoxObj.value[index] = false;
});
};
</script>
<style lang="scss" scoped>
.el-select-dropdown {
.el-checkbox {
display: flex;
align-items: center;
padding-left: 20px;
width: 100%;
box-sizing: border-box;
}
.el-select-dropdown__item {
// background-color: red !important;
padding: 0;
display: flex;
align-items: center;
}
}
.el-select-dropdown.is-multiple .el-select-dropdown__item.is-selected::after{
display: none;
}
</style>