型号只能选择已绑定的版本功能完善
This commit is contained in:
parent
d46df2ebd9
commit
8d4432c265
|
@ -260,15 +260,14 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
/** 查询版本号 */
|
/** 查询版本号 */
|
||||||
getVersionByModel(modelId) {
|
getVersionByModel(modelId) {
|
||||||
listVersion({ modelId: modelId }) // 假设后端支持modelId参数过滤
|
return new Promise((resolve, reject) => {
|
||||||
.then(response => {
|
listVersion({ modelId })
|
||||||
this.versionOptions = response.rows;
|
.then(response => {
|
||||||
// 保持当前选择的版本有效性
|
this.versionOptions = response.rows;
|
||||||
if (this.form.versionId &&
|
resolve();
|
||||||
!this.versionOptions.some(v => v.versionId === this.form.versionId)) {
|
})
|
||||||
this.form.versionId = null;
|
.catch(error => reject(error));
|
||||||
}
|
});
|
||||||
});
|
|
||||||
},
|
},
|
||||||
/** 查询型号列表列表 */
|
/** 查询型号列表列表 */
|
||||||
getList() {
|
getList() {
|
||||||
|
@ -336,16 +335,23 @@ export default {
|
||||||
|
|
||||||
},
|
},
|
||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
handleUpdate(row) {
|
async handleUpdate(row) {
|
||||||
this.reset();
|
this.reset();
|
||||||
const modelId = row.modelId || this.ids;
|
const modelId = row.modelId || this.ids;
|
||||||
getModel(modelId).then(response => {
|
try {
|
||||||
this.form = response.data;
|
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.open = true;
|
||||||
this.title = "修改型号";
|
this.title = "修改型号";
|
||||||
|
} catch (error) {
|
||||||
this.getVersionByModel(modelId); // 关键代码
|
console.error('数据加载失败:', error);
|
||||||
});
|
}
|
||||||
},
|
},
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
submitForm() {
|
submitForm() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user