使用真登录功能前拉取报错,提交代码
This commit is contained in:
@@ -42,7 +42,7 @@ class RequestHttp {
|
||||
config.loading ?? (config.loading = true)
|
||||
config.loading && showFullScreenLoading()
|
||||
if (config.headers && typeof config.headers.set === 'function') {
|
||||
config.headers.set('x-access-token', userStore.token)
|
||||
config.headers.set('Authorization', 'Bearer '+userStore.token)
|
||||
}
|
||||
return config
|
||||
},
|
||||
@@ -63,6 +63,7 @@ class RequestHttp {
|
||||
// 登陆失效
|
||||
if (data.code == ResultEnum.OVERDUE) {
|
||||
userStore.setToken('')
|
||||
userStore.setUserInfo({name: ''})
|
||||
router.replace(LOGIN_URL)
|
||||
ElMessage.error(data.message)
|
||||
return Promise.reject(data)
|
||||
|
||||
@@ -8,6 +8,9 @@ export namespace Login {
|
||||
}
|
||||
export interface ResLogin {
|
||||
accessToken: string;
|
||||
userInfo:{
|
||||
name: string;
|
||||
}
|
||||
}
|
||||
export interface ResAuthButtons {
|
||||
[key: string]: string[];
|
||||
|
||||
@@ -25,6 +25,7 @@ export default {
|
||||
personalData: "Personal Data",
|
||||
changePassword: "Change Password",
|
||||
changeMode:"Change Mode",
|
||||
versionRegister:"Version Register",
|
||||
logout: "Logout"
|
||||
}
|
||||
};
|
||||
|
||||
@@ -25,6 +25,7 @@ export default {
|
||||
personalData: "个人信息",
|
||||
changePassword: "修改密码",
|
||||
changeMode:"模式切换",
|
||||
versionRegister:"版本注册",
|
||||
logout: "退出登录"
|
||||
}
|
||||
};
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
<el-dropdown-item @click="changeMode">
|
||||
<el-icon><Edit /></el-icon>{{ $t("header.changeMode") }}
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item @click="openDialog('versionRegisterRef')">
|
||||
<el-icon><SetUp /></el-icon>{{ $t("header.versionRegister") }}
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
@@ -29,6 +32,8 @@
|
||||
<InfoDialog ref="infoRef"></InfoDialog>
|
||||
<!-- passwordDialog -->
|
||||
<PasswordDialog ref="passwordRef"></PasswordDialog>
|
||||
<!-- versionRegisterDialog -->
|
||||
<VersionDialog ref="versionRegisterRef"></VersionDialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
@@ -40,6 +45,7 @@ import { useUserStore } from "@/stores/modules/user";
|
||||
import { ElMessageBox, ElMessage } from "element-plus";
|
||||
import InfoDialog from "./InfoDialog.vue";
|
||||
import PasswordDialog from "./PasswordDialog.vue";
|
||||
import VersionDialog from "@/views/system/versionRegister/index.vue";
|
||||
import { computed } from "vue";
|
||||
import { Avatar } from "@element-plus/icons-vue";
|
||||
import AssemblySize from "./components/AssemblySize.vue";
|
||||
@@ -49,7 +55,9 @@ import ThemeSetting from "./components/ThemeSetting.vue";
|
||||
import Message from "./components/Message.vue";
|
||||
import Fullscreen from "./components/Fullscreen.vue";
|
||||
import { useAuthStore } from "@/stores/modules/auth";
|
||||
import {useDictStore} from "@/stores/modules/dict";
|
||||
const userStore = useUserStore();
|
||||
const dictStore = useDictStore();
|
||||
const username = computed(() => userStore.userInfo.name);
|
||||
const router = useRouter();
|
||||
const authStore = useAuthStore();
|
||||
@@ -64,6 +72,8 @@ const logout = () => {
|
||||
await logoutApi();
|
||||
// 2.清除 Token
|
||||
userStore.setToken("");
|
||||
userStore.setUserInfo({name: ""});
|
||||
dictStore.setDictData([]);
|
||||
// 3.重定向到登陆页
|
||||
router.replace(LOGIN_URL);
|
||||
ElMessage.success("退出登录成功!");
|
||||
@@ -75,9 +85,12 @@ const logout = () => {
|
||||
// 打开修改密码和个人信息弹窗
|
||||
const infoRef = ref<InstanceType<typeof InfoDialog> | null>(null);
|
||||
const passwordRef = ref<InstanceType<typeof PasswordDialog> | null>(null);
|
||||
const versionRegisterRef = ref<InstanceType<typeof VersionDialog> | null>(null);
|
||||
|
||||
const openDialog = (ref: string) => {
|
||||
if (ref == "infoRef") infoRef.value?.openDialog();
|
||||
if (ref == "passwordRef") passwordRef.value?.openDialog();
|
||||
if (ref == "versionRegisterRef") versionRegisterRef.value?.openDialog();
|
||||
};
|
||||
//模式切换
|
||||
const changeMode = () => {
|
||||
|
||||
@@ -13,6 +13,9 @@ export const useDictStore = defineStore({
|
||||
}),
|
||||
getters: {},
|
||||
actions: {
|
||||
setDictData(data: Dict[]) {
|
||||
this.dictData = data
|
||||
},
|
||||
// 获取字典数据数组,如果为空则返回空数组
|
||||
getDictData(code: string) {
|
||||
if (!this.dictData.length) {
|
||||
|
||||
26
frontend/src/stores/modules/mode.ts
Normal file
26
frontend/src/stores/modules/mode.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
// src/stores/modules/mode.ts
|
||||
import { defineStore } from 'pinia';
|
||||
|
||||
// export const useModeStore = defineStore('mode', {
|
||||
// state: () => ({
|
||||
// currentMode: '' as string,
|
||||
// }),
|
||||
// actions: {
|
||||
// setCurrentMode(modeName: string) {
|
||||
// this.currentMode = modeName;
|
||||
// },
|
||||
// },
|
||||
// });
|
||||
|
||||
|
||||
export const useModeStore = defineStore('mode', {
|
||||
state: () => ({
|
||||
currentMode: localStorage.getItem('currentMode') || '' as string,
|
||||
}),
|
||||
actions: {
|
||||
setCurrentMode(modeName: string) {
|
||||
this.currentMode = modeName;
|
||||
localStorage.setItem('currentMode', modeName); // 保存到 localStorage
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -124,12 +124,21 @@ const resetFormContent = () => {
|
||||
const formRuleRef = ref<FormInstance>()
|
||||
const rules : Ref<Record<string, Array<FormItemRule>>> = ref({
|
||||
name :[{required:true,trigger:'blur',message:'菜单名称必填!'}],
|
||||
path :[{required:true,trigger:'blur',message:'菜单路径必填!'}],
|
||||
type :[{required:true,trigger:'change',message:'菜单类型必选!'}],
|
||||
component :[{required:true,trigger:'blur',message:'组件地址必填!'}],
|
||||
code :[{required:true,trigger:'blur',message:'编码必填!'}]
|
||||
})
|
||||
|
||||
watch(() => formContent.value.type, (newVal) => {
|
||||
if (newVal === 1) {
|
||||
// 选择按钮时,路由地址和组件地址无需校验
|
||||
rules.value.path = [];
|
||||
rules.value.component = [];
|
||||
} else {
|
||||
// 其他情况下,路由地址和组件地址需要校验
|
||||
rules.value.path = [{ required: true, trigger: 'blur', message: '路由地址必填!' }];
|
||||
rules.value.component = [{ required: true, trigger: 'blur', message: '组件地址必填!' }];
|
||||
}
|
||||
});
|
||||
|
||||
// 关闭弹窗
|
||||
const close = () => {
|
||||
dialogVisible.value = false
|
||||
@@ -155,7 +164,7 @@ const displayPid = computed({
|
||||
const save = () => {
|
||||
try {
|
||||
dialogFormRef.value?.validate(async (valid: boolean) => {
|
||||
console.log(formContent.value)
|
||||
|
||||
if (formContent.value.pid === undefined || formContent.value.pid === null || formContent.value.pid === '') {
|
||||
formContent.value.pid = '0';
|
||||
}
|
||||
|
||||
@@ -160,7 +160,6 @@
|
||||
LoginNameIsShow.value = true
|
||||
formContent.value = { ...data }
|
||||
|
||||
console.log(formContent.value,111);
|
||||
|
||||
} else {
|
||||
IsPasswordShow.value = true
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
</el-steps>
|
||||
</div>
|
||||
<div class="dialog-right">
|
||||
<el-collapse :v-model="activeIndex" accordion>
|
||||
<el-collapse v-model="collapseActiveName" accordion>
|
||||
<el-collapse-item title="源通讯校验" name="1">
|
||||
<div>
|
||||
暂无数据,等待检测开始
|
||||
@@ -54,6 +54,7 @@
|
||||
</template>
|
||||
<script lang="tsx" setup name="preTest">
|
||||
|
||||
const collapseActiveName = ref('1')
|
||||
const activeIndex = ref(0)
|
||||
const activeTotalNum = ref(5)
|
||||
//定义与预检测配置数组
|
||||
@@ -108,6 +109,14 @@ const currentStepStatus = ref<'error' | 'finish' | 'wait' | 'success' | 'process
|
||||
})
|
||||
const testStatus = toRef(props, 'testStatus');
|
||||
const ts = ref('');
|
||||
|
||||
watch(activeIndex, function (newValue, oldValue) {
|
||||
if(activeIndex.value < activeTotalNum.value - 2)
|
||||
collapseActiveName.value = (newValue+1).toString()
|
||||
else
|
||||
collapseActiveName.value = (activeTotalNum.value - 1).toString()
|
||||
})
|
||||
|
||||
//监听goods_sn的变化
|
||||
watch(testStatus, function (newValue, oldValue) {
|
||||
ts.value = props.testStatus;
|
||||
|
||||
@@ -54,29 +54,29 @@
|
||||
<el-button
|
||||
type="primary"
|
||||
:icon="Clock"
|
||||
@click="handleTest"
|
||||
@click="handleTest('手动检测')"
|
||||
v-if="form.activeTabs === 0"
|
||||
>手动检测</el-button
|
||||
>
|
||||
<el-button
|
||||
type="primary"
|
||||
:icon="ChatLineRound"
|
||||
@click="handleTest"
|
||||
@click="handleTest('自动检测')"
|
||||
v-if="form.activeTabs === 0"
|
||||
>自动检测</el-button
|
||||
>
|
||||
<el-button type="primary" :icon="ChatLineSquare" v-if="form.activeTabs === 2"
|
||||
<el-button type="primary" :icon="ChatLineSquare" @click="handleTest('不合格项复检')" v-if="form.activeTabs === 2"
|
||||
>不合格项复检</el-button
|
||||
>
|
||||
<el-button type="primary" :icon="ChatDotSquare" v-if="form.activeTabs === 2"
|
||||
<el-button type="primary" :icon="ChatDotSquare" @click="handleTest('全部复检')" v-if="form.activeTabs === 2"
|
||||
>全部复检</el-button
|
||||
>
|
||||
|
||||
<el-button type="primary" :icon="Postcard" v-if="form.activeTabs === 3"
|
||||
<el-button type="primary" :icon="Postcard" @click="handleTest('批量生成')" v-if="form.activeTabs === 3"
|
||||
>批量生成</el-button
|
||||
>
|
||||
|
||||
<el-button type="primary" :icon="Notebook" v-if="form.activeTabs === 4"
|
||||
<el-button type="primary" :icon="Notebook" @click="handleTest('批量归档')" v-if="form.activeTabs === 4"
|
||||
>批量归档</el-button
|
||||
>
|
||||
</el-form-item>
|
||||
@@ -742,8 +742,9 @@ function disablecheckResultList(val: string){
|
||||
});
|
||||
}
|
||||
|
||||
//启动自动检测/手动检测
|
||||
const handleTest = () => {
|
||||
|
||||
const handleTest = (val:string) => {
|
||||
|
||||
//自动检测
|
||||
if (form.value.activeTabs === 0) {
|
||||
ElMessage.success("手动检测");
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="dialog-log">
|
||||
<el-collapse :v-model="1" accordion>
|
||||
<el-collapse model-value="1" accordion>
|
||||
<el-collapse-item title="检测日志:" name="1">
|
||||
<div>
|
||||
暂无数据,等待检测开始
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<template>
|
||||
<el-dialog :title="dialogTitle" :model-value="visible" @close="handleCancel" v-bind="dialogBig" width="900px">
|
||||
<el-dialog :title="dialogTitle" :model-value="visible" @close="handleCancel" v-bind="dialogBig" width="1200px" height="900px">
|
||||
|
||||
<!-- simple -->
|
||||
<!-- :style="{color:node.label=='未检测'?'#F56C6C':node.label=='检测中'?'#E6A23C':'#67C23A'}" -->
|
||||
<el-steps class="test-head-steps" :space="200" :active="stepsActiveIndex" process-status="finish" finish-status="success" simple>
|
||||
<el-step title="预检测" :icon="stepsActiveIndex > 0 ? SuccessFilled : Edit" />
|
||||
<el-steps class="test-head-steps" :space="200" :active="stepsActiveIndex" process-status="finish" finish-status="success" >
|
||||
<el-step title="预检测" :icon="stepsActiveIndex > 0 ? SuccessFilled : Edit" style="height:100px" />
|
||||
<el-step title="守时检测" :icon="stepsActiveIndex > 1 ? SuccessFilled :UploadFilled"/>
|
||||
<el-step title="系数校准" :icon="stepsActiveIndex > 2 ? SuccessFilled :Picture" />
|
||||
<el-step title="正式检测" :icon="stepsActiveIndex > 3 ? SuccessFilled :Picture" />
|
||||
@@ -376,45 +376,32 @@ const detectionOptions = ref([
|
||||
|
||||
<style scoped>
|
||||
.test-head-steps{
|
||||
height: 200px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.test-dialog{
|
||||
display: flex;
|
||||
flex: 30% 65%; /* 控件宽度 */
|
||||
flex-direction: row; /* 横向排列 */
|
||||
|
||||
/* .dialog-left{
|
||||
margin-right: 20px;
|
||||
} */
|
||||
}
|
||||
.form-grid {
|
||||
display: flex;
|
||||
flex-direction: row; /* 横向排列 */
|
||||
flex-wrap: wrap; /* 允许换行 */
|
||||
}
|
||||
.form-grid .el-form-item {
|
||||
flex: 1 1 30%; /* 控件宽度 */
|
||||
margin-right: 20px; /* 控件间距 */
|
||||
}
|
||||
.form-grid .el-form-item:last-child {
|
||||
margin-right: 0; /* 最后一个控件不需要右边距 */
|
||||
}
|
||||
.dialog-footer {
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
margin-bottom: 10px; /* 调整这里的值以增加或减少间距 */
|
||||
}
|
||||
.el-tabs {
|
||||
margin-bottom: 20px; /* 添加底部边距 */
|
||||
.test-head-steps .el-step__line{
|
||||
height:50px !important;
|
||||
}
|
||||
|
||||
.el-table th, .el-table td {
|
||||
text-align: center; /* 所有单元格文字居中 */
|
||||
.test-head-steps .el-step__icon-inner{
|
||||
width: 40px !important;
|
||||
height:40px !important;
|
||||
}
|
||||
|
||||
.table-container {
|
||||
max-height: 400px; /* 根据需要调整高度 */
|
||||
overflow-y: auto; /* 允许垂直滚动 */
|
||||
overflow-x: hidden; /* 隐藏水平滚动条 */
|
||||
.test-head-steps .el-step__icon{
|
||||
width: 80px !important;
|
||||
height:80px !important;
|
||||
font-size: 40px !important; /* 调整图标大小 */
|
||||
line-height: 80px !important; /* 使图标居中 */
|
||||
}
|
||||
|
||||
.test-head-steps .el-step__title {
|
||||
font-size: 20px !important; /* 设置标题字体大小 */
|
||||
margin-top: 10px !important; /* 调整标题与图标的间距 */
|
||||
}
|
||||
|
||||
.test-head-steps .el-step__description {
|
||||
font-size: 20px !important; /* 设置描述字体大小 */
|
||||
}
|
||||
</style>
|
||||
@@ -34,6 +34,7 @@
|
||||
import { useRouter } from "vue-router";
|
||||
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";
|
||||
|
||||
@@ -28,7 +28,9 @@
|
||||
|
||||
<!-- <el-collapse v-model="activeNames" @change="handleChange">
|
||||
<el-collapse-item title="检测进度展示" name="1"> -->
|
||||
|
||||
<!-- <div class="dialog-log">
|
||||
<el-collapse model-value="1" accordion>
|
||||
<el-collapse-item title="检测进度展示:" name="1"> -->
|
||||
<!-- 饼图 -->
|
||||
<div class="container_charts">
|
||||
<div class="charts_info">
|
||||
@@ -79,9 +81,9 @@
|
||||
></pie>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- </el-collapse-item>
|
||||
</el-collapse> -->
|
||||
<!-- </el-collapse-item>
|
||||
</el-collapse>
|
||||
</div> -->
|
||||
|
||||
<el-tabs type="border-card" @tab-change="handleTabsChange" v-model="editableTabsValue">
|
||||
<el-tab-pane :label="tabLabel1">
|
||||
@@ -337,7 +339,7 @@ onMounted(() => {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
// background-color: #eee;
|
||||
//background-color: #eee;
|
||||
|
||||
.left_tree {
|
||||
width: 14% !important;
|
||||
@@ -353,9 +355,9 @@ onMounted(() => {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
box-sizing: border-box;
|
||||
//justify-content: space-between;
|
||||
//align-items: center;
|
||||
//box-sizing: border-box;
|
||||
|
||||
.container_function {
|
||||
width: 100%;
|
||||
@@ -438,6 +440,16 @@ onMounted(() => {
|
||||
}
|
||||
}
|
||||
|
||||
.dialog-log{
|
||||
width: 100% !important;
|
||||
min-height: 200px !important;
|
||||
height:auto;
|
||||
background-color: #eee;
|
||||
// display: flex;
|
||||
// justify-content: space-between;
|
||||
// padding-left: 2ch;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.el-collapse {
|
||||
width: 100% !important;
|
||||
// min-height: 200px !important;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<el-button
|
||||
size="small"
|
||||
type="primary"
|
||||
@click="handelOpen(item.isActive)"
|
||||
@click="handelOpen(item)"
|
||||
:disabled="item.isActive == false"
|
||||
>进入检测</el-button
|
||||
>
|
||||
@@ -33,7 +33,9 @@
|
||||
import { useRouter } from "vue-router";
|
||||
import { ElMessage } from "element-plus";
|
||||
import { useAuthStore } from "@/stores/modules/auth";
|
||||
import { useModeStore } from "@/stores/modules/mode"; // 引入模式 store
|
||||
const authStore = useAuthStore();
|
||||
const modeStore = useModeStore(); // 使用模式 store
|
||||
const activeIndex = ref("1-1");
|
||||
const router = useRouter();
|
||||
const modeList = [
|
||||
@@ -56,8 +58,10 @@ const modeList = [
|
||||
isActive: false,
|
||||
},
|
||||
];
|
||||
const handelOpen = async (isActive: any) => {
|
||||
const handelOpen = async (item: any) => {
|
||||
|
||||
await authStore.setShowMenu();
|
||||
modeStore.setCurrentMode(item.name); // 将模式名称存入 store
|
||||
return;
|
||||
if (isActive) {
|
||||
router.push({ path: "/static" });
|
||||
|
||||
@@ -67,15 +67,13 @@ import { initDynamicRouter } from '@/routers/modules/dynamicRouter'
|
||||
import { CircleClose, UserFilled } from '@element-plus/icons-vue'
|
||||
import { useAuthStore } from '@/stores/modules/auth'
|
||||
import type { ElForm } from 'element-plus'
|
||||
import md5 from 'md5'
|
||||
import {useDictStore} from "@/stores/modules/dict";
|
||||
|
||||
const authStore = useAuthStore()
|
||||
const router = useRouter()
|
||||
const userStore = useUserStore()
|
||||
const tabsStore = useTabsStore()
|
||||
const keepAliveStore = useKeepAliveStore()
|
||||
import { useDictStore } from '@/stores/modules/dict'
|
||||
import { onMounted } from 'vue'
|
||||
|
||||
const dictStore = useDictStore()
|
||||
|
||||
@@ -103,9 +101,10 @@ const login = (formEl: FormInstance | undefined) => {
|
||||
// 1.执行登录接口
|
||||
const { data } = await loginApi({
|
||||
...loginForm,
|
||||
password: md5(loginForm.password),
|
||||
password: loginForm.password,
|
||||
})
|
||||
userStore.setToken(data.accessToken)
|
||||
userStore.setUserInfo(data.userInfo)
|
||||
const response = await getDictList()
|
||||
const dictData = response.data as unknown as Dict[]
|
||||
await dictStore.initDictData(dictData)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<el-divider >检测配置</el-divider>
|
||||
<el-row :gutter="24" >
|
||||
<el-col :span="8">
|
||||
<el-form-item label='一键检测方式' prop='autoGenerate' :label-width="100">
|
||||
<el-form-item label='一键检测方式' prop='autoGenerate' :label-width="125">
|
||||
<el-select v-model="TestConfigForm.autoGenerate" clearable placeholder="请选择一键检测方式" >
|
||||
<el-option label="只检测,报告后续手动生成" :value="0"></el-option>
|
||||
<el-option label="检测和生成报告同时进行" :value="1"></el-option>
|
||||
@@ -14,12 +14,12 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label='复检最大次数' prop='maxTime' :label-width="100">
|
||||
<el-form-item label='复检最大次数' prop='maxTime' >
|
||||
<el-input-number v-model='TestConfigForm.maxTime' :min='1' :max='999' />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label='数据处理原则' prop='dataRule' :label-width="100">
|
||||
<el-form-item label='数据处理原则' prop='dataRule' :label-width="125">
|
||||
<el-select v-model="TestConfigForm.dataRule" clearable placeholder="请选择数据处理原则" >
|
||||
<el-option
|
||||
v-for="item in dictStore.getDictData('Data_Rule')"
|
||||
@@ -32,6 +32,7 @@
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
<el-form :model="RegResForm" ref='dialogFormRef' :rules='rules' >
|
||||
<el-divider >有效数据配置</el-divider>
|
||||
<el-row :gutter="24" >
|
||||
<el-col :span="8">
|
||||
@@ -40,22 +41,22 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="实时数据有效组数" prop="realTime" :label-width="125">
|
||||
<el-form-item label="实时数据有效组数" prop="realTime" :label-width="125" >
|
||||
<el-input number v-model.number='RegResForm.realTime' placeholder="请输入实时数据有效组数"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="统计数据有效组数" prop="statistics" :label-width="125">
|
||||
<el-form-item label="统计数据有效组数" prop="statistics" :label-width="125" >
|
||||
<el-input number v-model.number='RegResForm.statistics' placeholder="请输入统计数据有效组数"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="闪变数据有效组数" prop="flicker" :label-width="125">
|
||||
<el-form-item label="闪变数据有效组数" prop="flicker" :label-width="125" >
|
||||
<el-input number v-model.number='RegResForm.flicker' placeholder="请输入闪变数据有效组数"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
</el-form>
|
||||
</div>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm()">保存配置</el-button>
|
||||
@@ -77,14 +78,18 @@
|
||||
import PqPopup from '@/views/system/dictionary/dictPq/components/pqPopup.vue'
|
||||
import { useDictStore } from '@/stores/modules/dict'
|
||||
import { useHandleData } from '@/hooks/useHandleData'
|
||||
import { onMounted, reactive, ref } from 'vue'
|
||||
import { computed, onMounted, reactive, Ref, ref } from 'vue'
|
||||
import {type Base } from '@/api/system/base/interface'
|
||||
import {type VersionRegister } from '@/api/system/versionRegister/interface'
|
||||
import {getTestConfig,updateTestConfig } from '@/api/system/base/index'
|
||||
import {getRegRes,updateRegRes } from '@/api/system/versionRegister/index'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { el } from 'element-plus/es/locale'
|
||||
import { ElMessage, FormItemRule } from 'element-plus'
|
||||
import { useModeStore } from '@/stores/modules/mode'; // 引入模式 store
|
||||
|
||||
const modeStore = useModeStore();
|
||||
const dictStore = useDictStore()
|
||||
const dialogFormRef = ref()
|
||||
const mode = ref()
|
||||
const TestConfigForm = ref<Base.ResTestConfig>({
|
||||
id: '',
|
||||
autoGenerate: 0,
|
||||
@@ -106,23 +111,53 @@ import { el } from 'element-plus/es/locale'
|
||||
state: 1, //状态
|
||||
})
|
||||
|
||||
const RegResForm2 = ref<VersionRegister.Sys_Reg_Res>({
|
||||
waveRecord: 0,
|
||||
realTime: 20,
|
||||
statistics: 5,
|
||||
flicker: 1,
|
||||
})
|
||||
const RegResForm2 = ref<VersionRegister.Sys_Reg_Res>({
|
||||
id:'',
|
||||
waveRecord: 0,
|
||||
realTime: 20,
|
||||
statistics: 5,
|
||||
flicker: 1,
|
||||
})
|
||||
|
||||
|
||||
// 定义弹出组件元信息
|
||||
const rules = computed(() =>{
|
||||
const baseRules : Ref<Record<string, Array<FormItemRule>>> = ref({
|
||||
realTime :[
|
||||
{required:true,trigger:'blur',message:'实时数据有效组数必填!'},
|
||||
{ pattern: /^[0-9]\d*$/, message: '实时数据有效组数为含0的正整数', trigger: 'blur' }
|
||||
],
|
||||
statistics :[
|
||||
{required:true,trigger:'blur',message:'统计数据有效组数必填!'},
|
||||
{ pattern: /^[0-9]\d*$/, message: '统计数据有效组数为含0的正整数', trigger: 'blur' }
|
||||
],
|
||||
flicker :[
|
||||
{required:true,trigger:'blur',message:'闪变数据有效组数必填!'},
|
||||
{ pattern: /^[0-9]\d*$/, message: '闪变数据有效组数为含0的正整数', trigger: 'blur' }
|
||||
],
|
||||
});
|
||||
|
||||
|
||||
if(mode.value == '比对式'){
|
||||
baseRules.value.waveRecord = [
|
||||
{required:true,trigger:'blur',message:'录波数据有效组数必填!'},
|
||||
{ pattern: /^[0-9]\d*$/, message: '录波数据有效组数为含0的正整数', trigger: 'blur' }
|
||||
];
|
||||
}
|
||||
|
||||
return baseRules;
|
||||
})
|
||||
|
||||
|
||||
const TestConfigList = ref<Base.ResTestConfig>()
|
||||
const RegResList = ref<VersionRegister.ResSys_Reg_Res>()
|
||||
// 初始化时获取
|
||||
onMounted(async () => {
|
||||
mode.value =modeStore.currentMode.replace('模块', '');//pinia中获取当前是那个模块进来的,临时处理去除模块两字
|
||||
const response = await getTestConfig()
|
||||
TestConfigForm.value = response.data as unknown as Base.ResTestConfig
|
||||
|
||||
const patternId = dictStore.getDictData('Pattern').find(item=>item.name==='模拟式')?.id
|
||||
//console.log(mode)
|
||||
const patternId = dictStore.getDictData('Pattern').find(item=>item.name=== mode.value)?.id//获取数据字典中对应的id
|
||||
RegResForm.value.type = patternId || '';
|
||||
const response2 = await getRegRes(RegResForm.value)
|
||||
RegResForm.value = response2.data as unknown as VersionRegister.ResSys_Reg_Res
|
||||
@@ -131,7 +166,8 @@ const RegResForm2 = ref<VersionRegister.Sys_Reg_Res>({
|
||||
|
||||
const submitForm = async () => {
|
||||
try {
|
||||
if (TestConfigForm.value.id) {
|
||||
dialogFormRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
await updateTestConfig(TestConfigForm.value);
|
||||
|
||||
// 提取并传递 4 个参数
|
||||
@@ -145,6 +181,7 @@ const RegResForm2 = ref<VersionRegister.Sys_Reg_Res>({
|
||||
|
||||
ElMessage.success({ message: `保存配置成功!` })
|
||||
}
|
||||
})
|
||||
} catch (err) {
|
||||
console.error('验证过程中出现错误', err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user