型号只能选择已绑定的版本功能完善

This commit is contained in:
SjS 2025-04-11 14:54:45 +08:00
parent d46df2ebd9
commit 8d4432c265

View File

@ -260,15 +260,14 @@ export default {
methods: {
/** 查询版本号 */
getVersionByModel(modelId) {
listVersion({ modelId: modelId }) // modelId
.then(response => {
this.versionOptions = response.rows;
//
if (this.form.versionId &&
!this.versionOptions.some(v => v.versionId === this.form.versionId)) {
this.form.versionId = null;
}
});
return new Promise((resolve, reject) => {
listVersion({ modelId })
.then(response => {
this.versionOptions = response.rows;
resolve();
})
.catch(error => reject(error));
});
},
/** 查询型号列表列表 */
getList() {
@ -336,16 +335,23 @@ export default {
},
/** 修改按钮操作 */
handleUpdate(row) {
async handleUpdate(row) {
this.reset();
const modelId = row.modelId || this.ids;
getModel(modelId).then(response => {
this.form = response.data;
try {
await this.getVersionByModel(modelId);
const res = await getModel(modelId);
this.form = {
...res.data,
versionId: this.versionOptions.some(v => v.versionId === res.data.versionId)
? res.data.versionId
: null
};
this.open = true;
this.title = "修改型号";
this.getVersionByModel(modelId); //
});
} catch (error) {
console.error('数据加载失败:', error);
}
},
/** 提交按钮 */
submitForm() {