From d38ea6ed6725535127e4cd3a8af3a09018ae019e Mon Sep 17 00:00:00 2001
From: ysn <2126564605@qq.com>
Date: Tue, 28 Apr 2026 16:49:54 +0800
Subject: [PATCH] =?UTF-8?q?=E5=9F=BA=E7=A1=80=E6=95=B0=E6=8D=AE-=E9=95=80?=
=?UTF-8?q?=E7=A7=8D=E7=BB=B4=E6=8A=A4-=E9=95=80=E7=A7=8D=E5=88=86?=
=?UTF-8?q?=E7=B1=BB=E6=9B=B4=E6=8D=A2=E7=BB=84=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../processManagement/platingTypeInfo.vue | 133 +++++++++---------
1 file changed, 70 insertions(+), 63 deletions(-)
diff --git a/src/views/processManagement/platingTypeInfo.vue b/src/views/processManagement/platingTypeInfo.vue
index 64579705..8bbd8896 100644
--- a/src/views/processManagement/platingTypeInfo.vue
+++ b/src/views/processManagement/platingTypeInfo.vue
@@ -20,30 +20,57 @@
:before-open="beforeOpen"
@sort-change="sortChange"
:permission="permissionList"
+ v-model:search="search"
>
- 导入
+ 导入
{{ row.bcName }}
+
+ (search.bcId = String(val))"
+ placeholder="请搜索选择"
+ api-url="/api/blade-desk/BA/BasicClazz/list"
+ echo-api="/api/blade-desk/BA/BasicClazz/list"
+ echoParamsKey="id"
+ echo-method="get"
+ api-method="get"
+ list-key="records"
+ total-key="total"
+ label-key="name"
+ value-key="id"
+ search-key="name"
+ :debounce-time="500"
+ />
+
-
-
-
+ (form.bcName = val)"
+ placeholder="请搜索选择"
+ api-url="/api/blade-desk/BA/BasicClazz/list"
+ echo-api="/api/blade-desk/BA/BasicClazz/list"
+ echoParamsKey="id"
+ echo-method="get"
+ api-method="get"
+ list-key="records"
+ total-key="total"
+ label-key="name"
+ value-key="id"
+ search-key="name"
+ :debounce-time="500"
+ :title="'修改'"
+ />
@@ -114,7 +141,7 @@ export default {
currentPage: 1,
total: 0,
},
- bcIdData: [],
+ search: {},
formOption: {
menuSpan: 12,
enter: true,
@@ -191,24 +218,24 @@ export default {
sortable: 'custom',
search: true,
width: 200,
- type: 'select',
- filterable: true,
- remote: true,
- props: {
- label: 'name',
- value: 'id',
- desc: 'code',
- res: 'data.records',
- },
- dicUrl:
- '/api/blade-desk/BA/BasicClazz/list?current=1&size=9999&descs=CODE&name={{key}}',
- rules: [
- {
- required: true,
- message: '请选择镀种分类',
- trigger: 'click',
- },
- ],
+ // type: 'select',
+ // filterable: true,
+ // remote: true,
+ // props: {
+ // label: 'name',
+ // value: 'id',
+ // desc: 'code',
+ // res: 'data.records',
+ // },
+ // dicUrl:
+ // '/api/blade-desk/BA/BasicClazz/list?current=1&size=9999&descs=CODE&name={{key}}',
+ // rules: [
+ // {
+ // required: true,
+ // message: '请选择镀种分类',
+ // trigger: 'click',
+ // },
+ // ],
},
{
label: '镀种',
@@ -370,7 +397,7 @@ export default {
search: false,
width: 200,
labelWidth: 150,
- span:24,
+ span: 24,
dicData: [
{ label: '否', value: 0 },
{ label: '是', value: 1 }, //运行 true 停止false
@@ -508,33 +535,17 @@ export default {
// 打开弹框 前操作 打开表单前会执行beforeOpen方法
async beforeOpen(done, type, loading) {
try {
- // 1. 拉取镀种分类全量数据
- await this.remoteMethod('');
- // 2. 新增默认值
+ // 新增默认值
if (['add'].includes(type)) {
this.form.flagCycleTest = 0;
}
- // 3. 编辑 / 查看时:自动补全 bcId 到下拉数组(解决500条以外不显示)
+ // 编辑 / 查看时:转字符串保证选中
if (['edit', 'view'].includes(type)) {
const currentId = (this.form.bcId || '').toString().trim();
- const currentName = this.form.bcName || '-'; // 你后台返回的名称
- // 判断:如果id不在数组里,就插入到第一个
- if (currentId) {
- const hasItem = this.bcIdData.some(item => item.id == currentId);
- console.log('hasItem =', hasItem);
- if (!hasItem) {
- // 插入到数组最前面
- this.bcIdData.unshift({
- id: currentId,
- name: currentName,
- });
- }
- }
- // 转字符串保证选中
this.form.bcId = currentId;
}
} catch (err) {
- console.error('加载镀种分类失败', err);
+ console.error('加载数据失败', err);
}
done();
},
@@ -558,10 +569,6 @@ export default {
refreshChange() {
this.onLoad(this.page, this.query);
},
- async remoteMethod(query) {
- const res = await getList({ current: 1, size: 9999, descs: 'CODE',name:query })
- this.bcIdData = res.data.data.records || []
- },
// 根据ID查询镀种分类名称 —— 异步Promise
getBcName(id) {
if (!id) return Promise.resolve('-');
@@ -598,14 +605,14 @@ export default {
});
let list = res.data.data.records;
// 批量获取 bcName —— 正确用法!
- //await Promise.all(
- // list.map(async item => {
- // item.bcId = item.bcId + '';
- // item.subClass = item.subClass + '';
- // item.bcName = await this.getBcName(item.bcId); // ✅ 等待返回
- // console.log('item.bcName =', item.bcName); // 现在一定有值
- // })
- //);
+ //await Promise.all(
+ // list.map(async item => {
+ // item.bcId = item.bcId + '';
+ // item.subClass = item.subClass + '';
+ // item.bcName = await this.getBcName(item.bcId); // ✅ 等待返回
+ // console.log('item.bcName =', item.bcName); // 现在一定有值
+ // })
+ //);
this.data = list;
this.page.total = res.data.data.total;
} catch (e) {}