Commit 221be078 by zhaopanyu

zpy 10.31 实验室修改

parent 8bf08967
......@@ -252,7 +252,8 @@
<el-col :span="24">
<el-form-item label="实验室选择">
<el-checkbox-group v-model="postForm.schoolLabClassYearRelationList">
<el-checkbox v-for="classItem in labs" :key="classItem.labId" :label="classItem.labId">
<el-checkbox v-for="classItem in labs" :key="classItem.labId" :label="classItem.labId"
:disabled="classItem.isDisabled">
{{ classItem.labName }}- {{ classItem.useState }}
</el-checkbox>
</el-checkbox-group>
......@@ -391,29 +392,44 @@ export default {
const labId = this.postForm.schoolLabClassYearRelationList[i].labId;
this.selectedLabs.push(labId);
}
// console.log('this.form', this.form);
this.postForm.applyName = response.data.applyName;
this.postForm.experimentClassify = response.data.experimentClassify;
this.postForm.experimentName = response.data.experimentName;
this.postForm.sub = response.data.sub;
this.postForm.chapterContent = response.data.chapterContent;
this.postForm.grade = response.data.grade;
this.postForm.schoolYear = response.data.schoolYear;
this.postForm.experimentUseGoods = response.data.experimentUseGoods;
this.postForm.plannedStartTime = response.data.plannedStartTime;
this.postForm.plannedEndTime = response.data.plannedEndTime;
this.postForm.schoolLabClassYearRelationList = this.selectedLabs; // 仅将已经选择的实验室作为关联数据提交
this.loading = false;
const plannedStartTime = this.postForm.plannedStartTime
const plannedEndTime = this.postForm.plannedEndTime
getLabList(plannedStartTime, plannedEndTime).then(response => {
const sub = this.postForm.sub
getLabList(plannedStartTime, plannedEndTime, sub).then(response => {
const labs = response.data;
this.labs = labs.filter(lab => lab.useState === "空闲"); // 根据状态筛选出空闲的实验室
// console.log(this.labs, 'this.labs');
// 这里不再需要循环添加实验室关联数据
console.log(labs, 'qb');
const selectedLabs = this.postForm.schoolLabClassYearRelationList; // 获取已选择的实验室列表
console.log(selectedLabs, 'xz');
// 将已选择的实验室信息存储在新的数组中
const selectedLabInfo = labs.filter(lab => {
const isSelected = selectedLabs.some(selectedLab => selectedLab.labId === lab.labId);
if (isSelected) {
lab.isSelected = true;
return true;
}
return false;
});
// 更新 labs 数组,将已选择的实验室信息存储在对应实验室对象中
this.labs = labs.map(lab => {
const selectedLab = selectedLabInfo.find(selectedLab => selectedLab.labId === lab.labId);
if (selectedLab) {
lab.selectedLabInfo = selectedLab;
}
return lab;
}).map(lab => {
if (lab.useState === '使用中') {
lab.isDisabled = true;
}
return lab;
})
this.isEdits = true;
this.loading = false;
});
});
this.dialogTableVisible = true;
},
......@@ -478,7 +494,7 @@ export default {
getAllocationLab(params).then(response => {
this.$modal.msgSuccess('保存成功');
this.open = false;
this.dialogTableVisible = false;
this.getList();
});
}
......@@ -510,7 +526,7 @@ export default {
getAllocationLab(params).then(response => {
console.log(params, params);
this.$modal.msgSuccess('提交成功');
this.open = false;
this.dialogTableVisible = false;
this.getList();
});
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment