featip(w-nalinv): 添加可用层数选择功能

- 在 AGV 卷取手动呼叫界面添加可用层数选择下拉框
- 实现获取可用层数列表的接口和相关逻辑
- 在选择熟化间入口后自动加载可用层数
This commit is contained in:
tangyu 2025-04-26 16:30:29 +08:00
parent f186659431
commit 189df469af
2 changed files with 79 additions and 16 deletions

View File

@ -77,3 +77,16 @@ export function agvTaskDestination(data) {
data: data
})
}
export function fetchAvailableLayersApi(data) {
return request({
url: iep('/basefilmwork/get-available-layer'),
method: 'post',
data: data,
headers : {
'Content-Type': 'application/json'
}
})
}

View File

@ -58,12 +58,29 @@
</el-col>
<el-col :span="12">
<el-form-item label="熟化间入口" prop="taskDestination">
<el-input v-model="mainForm.taskDestination" :readonly="true">
<el-input v-model="mainForm.taskDestination" :readonly="true" >
<i slot="suffix" class="el-input__icon el-icon-copy-document" @click.stop="showResourceDialog"></i>
</el-input>
{{mainForm.taskDestinationDesc}}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="可用层数" prop="selectedLayer">
<el-select
v-model="mainForm.selectedLayer"
clearable
placeholder="请选择可用层数"
:loading="layerLoading"
>
<el-option
v-for="item in availableLayersList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
@ -87,7 +104,7 @@
<script>
import {clearValidate} from '@/util/util'
import {showLoading, hideLoading} from '@/const/loading'
import {agvReelingManualCall, agvTaskDestination, nextStep} from '@/api/mes/wip-nalinv/jm-auto-reeling';
import {agvReelingManualCall, agvTaskDestination, nextStep,fetchAvailableLayersApi} from '@/api/mes/wip-nalinv/jm-auto-reeling';
import {findJmResourceList} from "@/api/mes/pms/resrce";
import {getByCode as getFastCode} from '@/api/mes/sys/fast-code-detail';
@ -100,6 +117,8 @@ export default {
},
data() {
return {
availableLayersList: [], // 存储可用层数选项
layerLoading: false, // 控制加载状态
rules: {
taskType: [{required: true, message: '任务类别不能为空', trigger: ['change']}],
taskTypeId: [{required: true, message: '任务类型不能为空', trigger: ['change']}],
@ -141,6 +160,33 @@ export default {
},
},
methods: {
// 获取可用层数列表
fetchAvailableLayers(taskDestination) {
console.log("taskDestination:", taskDestination);
console.log('发送参数:', {taskDestination: this.mainForm.taskDestination});
let me = this;
me.layerLoading = true;
me.availableLayersList = []; // 清空旧数据
fetchAvailableLayersApi(taskDestination)
.then(res => {
if (res.data.code === 0) {
// 修改这里:直接使用 res.data.data,不需要 .layers
me.availableLayersList = res.data.data.map(item => ({
value: item.value, // 使用返回的value字段
label: item.label // 使用返回的label字段
}));
}
})
.catch(err => {
console.error("获取可用层数失败:", err);
me.$message.error("获取可用层数失败");
})
.finally(() => {
me.layerLoading = false;
});
},
//显示设备弹窗框
showResourceDialog() {
let me = this;
@ -163,6 +209,10 @@ export default {
me.mainForm.taskDestination = row.resrce;
me.mainForm.taskDestinationDesc = row.description;
me.setAgvAutomaticCallThreshold(row.resrce);
console.log('Selected resrce:', row.resrce);
// 新增:调用获取可用层数的接口
me.fetchAvailableLayers(row.resrce); // 传递选择的资源编码
},
setAgvAutomaticCallThreshold(resrce) {
let params = {
@ -237,20 +287,20 @@ export default {
},
handleTaskTypeIdChange(value) {
let me = this;
if (value === '3') {
// 下卷作业调用熟化间入口接口
let params = Object.assign({}, me.mainForm);
showLoading();
agvTaskDestination(params).then(res => {
hideLoading();
if (res.data.code !== 0) {
return this.$message.error(res.data.msg);
}
me.mainForm.taskDestination = res.data.data
}).catch(err => {
hideLoading();
});
}
// if (value === '3') {
// // 下卷作业调用熟化间入口接口
// let params = Object.assign({}, me.mainForm);
// showLoading();
// agvTaskDestination(params).then(res => {
// hideLoading();
// if (res.data.code !== 0) {
// return this.$message.error(res.data.msg);
// }
// me.mainForm.taskDestination = res.data.data
// }).catch(err => {
// hideLoading();
// });
// }
},
closeForm() {
this.visible = false