修改登录退出逻辑

This commit is contained in:
dxc
2026-02-04 14:29:59 +08:00
parent 13590b1fac
commit fd5600b65b
12 changed files with 411 additions and 235 deletions

View File

@ -5,7 +5,7 @@
<div class="filter-container">
<el-input
v-model="queryParams.keyword"
placeholder="请输入名称或规格 (支持模糊搜索)"
placeholder="请输入名称、俗名或规格"
style="width: 240px; margin-right: 10px;"
clearable
@input="handleInputSearch"
@ -82,6 +82,7 @@
</div>
<el-checkbox v-model="columns.id.visible" label="ID" />
<el-checkbox v-model="columns.name.visible" label="名称" />
<el-checkbox v-model="columns.commonName.visible" label="俗名" />
<el-checkbox v-model="columns.category.visible" label="类别" />
<el-checkbox v-model="columns.type.visible" label="类型" />
<el-checkbox v-model="columns.spec.visible" label="规格型号" />
@ -103,7 +104,15 @@
style="width: 100%; margin-top: 15px"
>
<el-table-column v-if="columns.id.visible" prop="id" label="ID" min-width="80" align="center" fixed="left" />
<el-table-column v-if="columns.name.visible" prop="name" label="基础信息名称" min-width="180" show-overflow-tooltip />
<el-table-column v-if="columns.name.visible" prop="name" label="名称" min-width="160" show-overflow-tooltip />
<el-table-column v-if="columns.commonName.visible" prop="commonName" label="俗名" min-width="140" show-overflow-tooltip>
<template #default="scope">
<span v-if="scope.row.commonName">{{ scope.row.commonName }}</span>
<span v-else style="color: #ccc;">-</span>
</template>
</el-table-column>
<el-table-column v-if="columns.category.visible" prop="category" label="类别" min-width="120" align="center" show-overflow-tooltip>
<template #default="scope">{{ scope.row.category || '-' }}</template>
</el-table-column>
@ -162,9 +171,18 @@
>
<el-form ref="formRef" :model="form" :rules="rules" label-width="110px">
<el-form-item label="名称" prop="name">
<el-input v-model="form.name" placeholder="请输入基础信息名称" />
</el-form-item>
<el-row>
<el-col :span="12">
<el-form-item label="名称" prop="name">
<el-input v-model="form.name" placeholder="标准名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="俗名" prop="commonName">
<el-input v-model="form.commonName" placeholder="日常叫法/别名" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
@ -254,6 +272,7 @@ import {
interface MaterialBaseVO {
id: number;
name: string;
commonName?: string; // ✅ 新增类型定义
category: string;
type: string;
spec: string;
@ -284,6 +303,7 @@ const tableSize = ref<'large' | 'default' | 'small'>('large');
const columns = reactive({
id: { visible: true },
name: { visible: true },
commonName: { visible: true }, // ✅ 新增列控制
category: { visible: true },
type: { visible: true },
spec: { visible: true },
@ -316,6 +336,7 @@ const formRef = ref<FormInstance>();
const initForm = {
id: undefined,
name: '',
commonName: '', // ✅ 初始化新增字段
category: '',
type: '',
spec: '',
@ -350,13 +371,10 @@ const extractDynamicOptions = (items: MaterialBaseVO[]) => {
typeOptions.value = Array.from(newTypes);
};
// 【核心新增】Autocomplete 的建议查询方法
// 格式化数据以适配 el-autocomplete 的回调参数格式 [{ value: 'abc' }]
const querySearchCategory = (queryString: string, cb: any) => {
const results = queryString
? categoryOptions.value.filter(item => item.toLowerCase().includes(queryString.toLowerCase()))
: categoryOptions.value;
// el-autocomplete 默认只展示 value 属性
const formattedResults = results.map(item => ({ value: item }));
cb(formattedResults);
};