refactor(mes/qc/template): 替换方案单位输入框为可创建选择器

1. 将搜索区和弹窗中的方案单位输入框改为可创建的下拉选择器
2. 从列表数据中提取已有的方案单位作为选项
3. 重置查询时不再重置页码
4. 移除冗余的分页组件展示逻辑
This commit is contained in:
2026-05-13 10:37:38 +08:00
parent 863ff5f9e2
commit 43dcef4aa9

View File

@@ -9,8 +9,9 @@
@keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="方案单位" prop="templateUnit">
<el-input v-model="queryParams.templateUnit" placeholder="请输入方案单位" clearable
@keyup.enter.native="handleQuery" />
<el-select v-model="queryParams.templateUnit" placeholder="请选择方案单位" clearable filterable allow-create @keyup.enter.native="handleQuery">
<el-option v-for="unit in templateUnitOptions" :key="unit" :label="unit" :value="unit" />
</el-select>
</el-form-item>
</el-form>
@@ -44,9 +45,6 @@
<el-empty v-if="inspectionItemTemplateList.length === 0" description="暂无数据" :image-size="100" />
</div>
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" @pagination="getList" />
<!-- 添加或修改待检项方案对话框 -->
<el-dialog :title="title" :visible.sync="open" width="700px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
@@ -54,7 +52,9 @@
<el-input v-model="form.templateName" placeholder="请输入方案名称" />
</el-form-item>
<el-form-item label="方案单位" prop="templateUnit">
<el-input v-model="form.templateUnit" placeholder="请输入方案单位" />
<el-select v-model="form.templateUnit" placeholder="请选择方案单位" filterable allow-create>
<el-option v-for="unit in templateUnitOptions" :key="unit" :label="unit" :value="unit" />
</el-select>
</el-form-item>
<el-form-item label="方案描述" prop="templateDesc">
<el-input v-model="form.templateDesc" type="textarea" placeholder="请输入内容" />
@@ -186,18 +186,16 @@ export default {
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 待检项方案表格数据
inspectionItemTemplateList: [],
// 方案单位选项
templateUnitOptions: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
templateName: undefined,
templateUnit: undefined,
templateDesc: undefined,
@@ -235,8 +233,9 @@ export default {
getList() {
this.loading = true;
listInspectionItemTemplate(this.queryParams).then(response => {
this.inspectionItemTemplateList = response.rows;
this.total = response.total;
this.inspectionItemTemplateList = response.rows || response.data || response;
const units = [...new Set(this.inspectionItemTemplateList.map(item => item.templateUnit).filter(Boolean))];
this.templateUnitOptions = units.sort();
this.loading = false;
});
},
@@ -369,7 +368,6 @@ export default {
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */