Compare commits
2 Commits
6e71c38dad
...
a71d2c9350
| Author | SHA1 | Date | |
|---|---|---|---|
| a71d2c9350 | |||
| a1c8e7c1ce |
22
.workbuddy/memory/2026-07-29.md
Normal file
22
.workbuddy/memory/2026-07-29.md
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
# 2026-07-29 工作日志
|
||||||
|
|
||||||
|
## cargo-type 顶部按钮区优化
|
||||||
|
- **文件**: `src/views/base/cargo-type.vue` + `src/option/base/cargo-type.js`
|
||||||
|
- **改动**:
|
||||||
|
1. 新增按钮文字 `添加分类` → `新增`(与截图一致)
|
||||||
|
2. 为 4 个按钮补齐 Element Plus 图标:批量导入(Upload)、下载模板(Download)、批量导出(Download)、批量删除(Delete),均带 `el-icon--left`
|
||||||
|
3. 图标导入注册:`import { Plus, Upload, Download, Delete }`(移除不再需要的 Search),components 同步注册
|
||||||
|
4. 补充规范样式:`:deep(.basic-container__card) > .el-card__body { padding: 0 }`
|
||||||
|
|
||||||
|
## cargo-type 按钮迁移至 menu-left + 移除紧凑搜索栏(本次)
|
||||||
|
- **用户要求**:功能按钮从自定义紧凑搜索栏迁移到 avue-crud 的 `menu-left` 插槽(表格工具栏右侧),同时删除自定义紧凑搜索栏,恢复 Avue 原生搜索。
|
||||||
|
- **模板改动**:
|
||||||
|
- 删除整个 `.compact-search` 自定义搜索栏 div(含 el-select + el-input + 按钮)
|
||||||
|
- 在 `<avue-crud>` 内新增 `<template #menu-left>` 插槽,放置全部 5 个按钮(新增/批量导入/下载模板/批量导出/批量删除)
|
||||||
|
- **Option 改动**:`searchShow: false` → `searchShow: true`,恢复 Avue 原生搜索表单(类型 radio + 货物类型编码 input)
|
||||||
|
- **清理**:移除 `Search` 图标导入、`handleCompactSearch()` 方法、`.compact-search` 相关样式、隐藏 `.avue-crud__search-btn` 规则
|
||||||
|
- **确认无需改动项**:操作列(220px)、分页组件布局均符合规范
|
||||||
|
|
||||||
|
## cargo-type 导出逻辑修复 + 去重新增按钮(本次)
|
||||||
|
- **导出逻辑**:`buildExportParams()` 移除 `ids` 参数拼接,始终按当前搜索条件导出(不再受勾选行影响)
|
||||||
|
- **去重新增按钮**:Avue 内置 addBtn 由 `validData(permission, false)` 改为 `false`,隐藏内置"新增"按钮;仅保留 `menu-left` 插槽中带图标的"新增"按钮
|
||||||
@@ -33,7 +33,7 @@ export const getCargoTypeOption = ctx => ({
|
|||||||
emptyBtnText: '重置',
|
emptyBtnText: '重置',
|
||||||
saveBtnText: '提交',
|
saveBtnText: '提交',
|
||||||
updateBtnText: '提交',
|
updateBtnText: '提交',
|
||||||
searchShow: false,
|
searchShow: true,
|
||||||
searchIcon: false,
|
searchIcon: false,
|
||||||
searchMenuSpan: 24,
|
searchMenuSpan: 24,
|
||||||
searchIndex: 8,
|
searchIndex: 8,
|
||||||
|
|||||||
@@ -1,70 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<basic-container class="cargo-type-page">
|
<basic-container class="cargo-type-page">
|
||||||
<!-- 紧凑搜索栏 -->
|
|
||||||
<div class="compact-search">
|
|
||||||
<div class="compact-search__form">
|
|
||||||
<el-select
|
|
||||||
v-model="query.typeLevel"
|
|
||||||
placeholder="选择类型"
|
|
||||||
clearable
|
|
||||||
class="compact-search__select"
|
|
||||||
@change="handleCompactSearch"
|
|
||||||
>
|
|
||||||
<el-option label="一级货物类型" :value="1" />
|
|
||||||
<el-option label="二级货物类型" :value="2" />
|
|
||||||
</el-select>
|
|
||||||
<el-input
|
|
||||||
v-model="query.keyword"
|
|
||||||
placeholder="搜索分类名称"
|
|
||||||
clearable
|
|
||||||
class="compact-search__input"
|
|
||||||
@keyup.enter="handleCompactSearch"
|
|
||||||
@clear="handleCompactSearch"
|
|
||||||
>
|
|
||||||
<template #append>
|
|
||||||
<el-button @click="handleCompactSearch">
|
|
||||||
<el-icon><Search /></el-icon>
|
|
||||||
</el-button>
|
|
||||||
</template>
|
|
||||||
</el-input>
|
|
||||||
</div>
|
|
||||||
<div class="compact-search__actions">
|
|
||||||
<el-button type="primary" v-if="permission.cargo_type_add" @click="$refs.crud.rowAdd()">
|
|
||||||
<el-icon class="el-icon--left"><Plus /></el-icon>添加分类
|
|
||||||
</el-button>
|
|
||||||
<el-button
|
|
||||||
type="primary"
|
|
||||||
plain
|
|
||||||
v-if="permission.cargo_type_import"
|
|
||||||
@click="handleImport"
|
|
||||||
>批量导入</el-button>
|
|
||||||
<el-button
|
|
||||||
type="primary"
|
|
||||||
plain
|
|
||||||
v-if="permission.cargo_type_template"
|
|
||||||
@click="handleTemplate"
|
|
||||||
>下载模板</el-button>
|
|
||||||
<el-button
|
|
||||||
type="primary"
|
|
||||||
plain
|
|
||||||
v-if="permission.cargo_type_export"
|
|
||||||
@click="handleExport"
|
|
||||||
>批量导出</el-button>
|
|
||||||
<el-button
|
|
||||||
type="danger"
|
|
||||||
plain
|
|
||||||
v-if="permission.cargo_type_delete"
|
|
||||||
@click="handleDelete"
|
|
||||||
>批量删除</el-button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<avue-crud
|
<avue-crud
|
||||||
:option="option"
|
:option="option"
|
||||||
:table-loading="loading"
|
:table-loading="loading"
|
||||||
:data="data"
|
:data="data"
|
||||||
v-model:page="page"
|
v-model:page="page"
|
||||||
v-model="form"
|
v-model:form="form"
|
||||||
ref="crud"
|
ref="crud"
|
||||||
:permission="permissionList"
|
:permission="permissionList"
|
||||||
:before-open="beforeOpen"
|
:before-open="beforeOpen"
|
||||||
@@ -79,6 +20,35 @@
|
|||||||
@refresh-change="refreshChange"
|
@refresh-change="refreshChange"
|
||||||
@on-load="onLoad"
|
@on-load="onLoad"
|
||||||
>
|
>
|
||||||
|
<template #menu-left>
|
||||||
|
<el-button type="primary" v-if="permission.cargo_type_add" @click="$refs.crud.rowAdd()">
|
||||||
|
<el-icon class="el-icon--left"><Plus /></el-icon>新增
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
v-if="permission.cargo_type_import"
|
||||||
|
@click="handleImport"
|
||||||
|
><el-icon class="el-icon--left"><Upload /></el-icon>批量导入</el-button>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
v-if="permission.cargo_type_template"
|
||||||
|
@click="handleTemplate"
|
||||||
|
><el-icon class="el-icon--left"><Download /></el-icon>下载模板</el-button>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
v-if="permission.cargo_type_export"
|
||||||
|
@click="handleExport"
|
||||||
|
><el-icon class="el-icon--left"><Download /></el-icon>批量导出</el-button>
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
plain
|
||||||
|
v-if="permission.cargo_type_delete"
|
||||||
|
@click="handleDelete"
|
||||||
|
><el-icon class="el-icon--left"><Delete /></el-icon>批量删除</el-button>
|
||||||
|
</template>
|
||||||
|
|
||||||
<template #parentCargoName="{ row }">
|
<template #parentCargoName="{ row }">
|
||||||
{{ row.typeLevel === 1 ? '/' : row.parentCargoName || '/' }}
|
{{ row.typeLevel === 1 ? '/' : row.parentCargoName || '/' }}
|
||||||
@@ -176,7 +146,7 @@ import { openImportDialog } from '@/utils/import-excel';
|
|||||||
import { getToken } from '@/utils/auth';
|
import { getToken } from '@/utils/auth';
|
||||||
import NProgress from 'nprogress';
|
import NProgress from 'nprogress';
|
||||||
import 'nprogress/nprogress.css';
|
import 'nprogress/nprogress.css';
|
||||||
import { Search, Plus } from '@element-plus/icons-vue';
|
import { Plus, Upload, Download, Delete } from '@element-plus/icons-vue';
|
||||||
|
|
||||||
// 导入失败明细中,每个错误文本对应的「字段列」与「规则说明」
|
// 导入失败明细中,每个错误文本对应的「字段列」与「规则说明」
|
||||||
const CARGO_TYPE_FAIL_RULES = [
|
const CARGO_TYPE_FAIL_RULES = [
|
||||||
@@ -273,7 +243,7 @@ export const decorateCargoTypeFailDetail = async workbook => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { Search, Plus },
|
components: { Plus, Upload, Download, Delete },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
form: {},
|
form: {},
|
||||||
@@ -327,7 +297,7 @@ export default {
|
|||||||
...mapGetters(['permission']),
|
...mapGetters(['permission']),
|
||||||
permissionList() {
|
permissionList() {
|
||||||
return {
|
return {
|
||||||
addBtn: this.validData(this.permission.cargo_type_add, false),
|
addBtn: false,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
ids() {
|
ids() {
|
||||||
@@ -538,17 +508,6 @@ export default {
|
|||||||
this.syncColumnDisplay();
|
this.syncColumnDisplay();
|
||||||
done();
|
done();
|
||||||
},
|
},
|
||||||
handleCompactSearch() {
|
|
||||||
this.page.currentPage = 1;
|
|
||||||
const params = {};
|
|
||||||
if (this.query.typeLevel != null) {
|
|
||||||
params.typeLevel = this.query.typeLevel;
|
|
||||||
}
|
|
||||||
if (this.query.keyword) {
|
|
||||||
params.cargoName = this.query.keyword;
|
|
||||||
}
|
|
||||||
this.onLoad(this.page, params);
|
|
||||||
},
|
|
||||||
searchReset() {
|
searchReset() {
|
||||||
this.query = {};
|
this.query = {};
|
||||||
this.page.currentPage = 1;
|
this.page.currentPage = 1;
|
||||||
@@ -595,11 +554,7 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
buildExportParams() {
|
buildExportParams() {
|
||||||
const params = { ...this.query };
|
return { ...this.query };
|
||||||
if (this.ids) {
|
|
||||||
params.ids = this.ids;
|
|
||||||
}
|
|
||||||
return params;
|
|
||||||
},
|
},
|
||||||
handleExport() {
|
handleExport() {
|
||||||
this.$confirm('是否导出货物类型数据?', '提示', {
|
this.$confirm('是否导出货物类型数据?', '提示', {
|
||||||
@@ -652,47 +607,9 @@ export default {
|
|||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 隐藏表格工具栏中的搜索图标按钮
|
// 去除 basic-container 卡片内层 el-card 的 padding(规范 4.4)
|
||||||
:deep(.avue-crud__search-btn) {
|
:deep(.basic-container__card) > .el-card__body {
|
||||||
display: none !important;
|
padding: 0;
|
||||||
}
|
|
||||||
|
|
||||||
// 紧凑搜索栏
|
|
||||||
.compact-search {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
padding: 12px 16px;
|
|
||||||
margin-bottom: 8px;
|
|
||||||
background: #fff;
|
|
||||||
border-radius: 4px;
|
|
||||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
|
|
||||||
gap: 16px;
|
|
||||||
|
|
||||||
&__form {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
flex: 1;
|
|
||||||
gap: 12px;
|
|
||||||
min-width: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
&__select {
|
|
||||||
width: 160px;
|
|
||||||
flex-shrink: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
&__input {
|
|
||||||
width: 280px;
|
|
||||||
flex-shrink: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
&__actions {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 10px;
|
|
||||||
flex-shrink: 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.el-table) {
|
:deep(.el-table) {
|
||||||
|
|||||||
Reference in New Issue
Block a user