|
|
|
|
@ -20,30 +20,57 @@ |
|
|
|
|
:before-open="beforeOpen" |
|
|
|
|
@sort-change="sortChange" |
|
|
|
|
:permission="permissionList" |
|
|
|
|
v-model:search="search" |
|
|
|
|
> |
|
|
|
|
<template #menu-left> </template> |
|
|
|
|
|
|
|
|
|
<template #menu-right="{ size }"> |
|
|
|
|
<span style="display: inline-flex; margin-right: 12px"> |
|
|
|
|
<el-button type="primary" v-if="permission.platingTypeInfo_import" @click="handleImport">导入</el-button> |
|
|
|
|
<el-button type="primary" v-if="permission.platingTypeInfo_import" @click="handleImport" |
|
|
|
|
>导入</el-button |
|
|
|
|
> |
|
|
|
|
</span> |
|
|
|
|
</template> |
|
|
|
|
<template #bcId="{ row }"> |
|
|
|
|
{{ row.bcName }} |
|
|
|
|
</template> |
|
|
|
|
<template #bcId-search="{ type }"> |
|
|
|
|
<jhSelect |
|
|
|
|
:value="search.bcId" |
|
|
|
|
@input="val => (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" |
|
|
|
|
/> |
|
|
|
|
</template> |
|
|
|
|
<template #bcId-form="{ type }"> |
|
|
|
|
<span v-show="type == 'edit' || type == 'add'"> |
|
|
|
|
<el-select v-model="form.bcId" placeholder="请选择镀种分类" filterable |
|
|
|
|
remote |
|
|
|
|
reserve-keyword |
|
|
|
|
:remote-method="remoteMethod"> |
|
|
|
|
<el-option |
|
|
|
|
v-for="item in bcIdData" |
|
|
|
|
:key="item.id" |
|
|
|
|
:value="item.id" |
|
|
|
|
:label="item.name" |
|
|
|
|
<jhSelect |
|
|
|
|
:value="form.bcId" |
|
|
|
|
@input="val => (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="'修改'" |
|
|
|
|
/> |
|
|
|
|
</el-select> |
|
|
|
|
</span> |
|
|
|
|
</template> |
|
|
|
|
<template #bsBasicClass.name="scope"> |
|
|
|
|
@ -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('-'); |
|
|
|
|
|