模式切换

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

@@ -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

@@ -1,6 +1,6 @@
<template>
<!-- 基础信息弹出框 -->
<el-dialog v-model='dialogVisible' :title="dialogTitle" v-bind="dialogSmall" @close="close">
<el-dialog v-model='dialogVisible' :title="dialogTitle" v-bind="dialogSmall" @close="close" >
<div>
<el-form :model="formContent"
ref='dialogFormRef'

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>