解决禁止勾选已经选过的系统bug

dev
yujialong 3 years ago
parent 74c7bd4b83
commit bcba973009
  1. 44
      src/views/course/AddCurriculum.vue

@ -143,7 +143,7 @@
@input="practiceSortChange(scope.row, scope.$index)"></el-input> @input="practiceSortChange(scope.row, scope.$index)"></el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="展示控制" align="center"> <el-table-column label="展示控制" align="center" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<el-switch <el-switch
v-model="scope.row.isShow" v-model="scope.row.isShow"
@ -189,7 +189,7 @@
@input="assessmentSortChange(scope.row, scope.$index)"></el-input> @input="assessmentSortChange(scope.row, scope.$index)"></el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="展示控制" align="center"> <el-table-column label="展示控制" align="center" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<el-switch <el-switch
v-model="scope.row.isShow" v-model="scope.row.isShow"
@ -200,8 +200,7 @@
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" width="100"> <el-table-column label="操作" align="center" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button @click.native.prevent="handleDelete(scope.$index, assessmentData)">移除 <el-button @click.native.prevent="handleDelete(scope.$index, assessmentData)">移除</el-button>
</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -219,12 +218,11 @@
<span>应用列表</span> <span>应用列表</span>
</div> </div>
<div> <div>
<el-input placeholder="请输入系统名称" prefix-icon="el-icon-search" v-model.trim="configSearch" <el-input placeholder="请输入系统名称" prefix-icon="el-icon-search" v-model.trim="configSearch" clearable></el-input>
clearable></el-input>
</div> </div>
</div> </div>
<el-table ref="table" :data="permissionData" class="table" stripe header-align="center" <el-table ref="table" :data="permissionData" class="table" stripe header-align="center"
@selection-change="handleSelectionChange"> @selection-change="handleSelectionChange" row-key="systemId">
<el-table-column type="selection" :selectable="practiceSelectable" width="55" align="center"></el-table-column> <el-table-column type="selection" :selectable="practiceSelectable" width="55" align="center"></el-table-column>
<el-table-column type="index" width="100" label="序号" align="center"></el-table-column> <el-table-column type="index" width="100" label="序号" align="center"></el-table-column>
<el-table-column prop="systemName" label="系统名称" align="center"></el-table-column> <el-table-column prop="systemName" label="系统名称" align="center"></el-table-column>
@ -368,9 +366,24 @@ export default {
}, },
getInfoData() { getInfoData() {
this.$post(`${this.api.curriculumDetail}?cid=${this.form.cid}`).then(res => { this.$post(`${this.api.curriculumDetail}?cid=${this.form.cid}`).then(res => {
this.form = res.data; if (res.status === 200) {
this.practiceData = res.data.practiceConfig; let { data } = res;
this.assessmentData = res.data.assessmentConfig; if (data.categoryId) {
this.$get(this.api.courseProfessionalClass, { disciplineId: data.categoryId }).then(res => {
this.ProfessionalClassList = res.list;
}).catch(res => {});
}
if (data.professionalCategoryId) {
this.$get(this.api.courseProfessional, { professionalClassId: data.professionalCategoryId }).then(res => {
this.ProfessionalList = res.list;
}).catch(res => {});
}
this.$nextTick(() => {
this.form = data;
this.practiceData = data.practiceConfig;
this.assessmentData = data.assessmentConfig;
});
}
}).catch(err => { }).catch(err => {
}); });
}, },
@ -456,7 +469,6 @@ export default {
}); });
}, },
practiceSelectable(row, index) { // practiceSelectable(row, index) { //
// console.log(row,index);
let boolean = true; let boolean = true;
if (this.permissions) { if (this.permissions) {
this.assessmentData.length && this.assessmentData.some(e => { this.assessmentData.length && this.assessmentData.some(e => {
@ -466,7 +478,6 @@ export default {
}); });
} else { } else {
this.practiceData.length && this.practiceData.some(e => { this.practiceData.length && this.practiceData.some(e => {
// console.log(e.systemId, row.systemId);
if (e.systemId == row.systemId) { if (e.systemId == row.systemId) {
boolean = false; boolean = false;
} }
@ -498,11 +509,10 @@ export default {
getConfigData() { // getConfigData() { //
let ids = this.multipleSelection.map(i => i.systemId); let ids = this.multipleSelection.map(i => i.systemId);
this.$get(`${this.api.getInternalProjectBySystemId}?permissions=${this.permissions}&systemId=${ids.toString()}`).then((res) => { this.$get(`${this.api.getInternalProjectBySystemId}?permissions=${this.permissions}&systemId=${ids.toString()}`).then((res) => {
let data = res.map((item, index) => { let data = res.map((e, i) => {
item.isShow = 0; // isShow(0: 1:) e.isShow = 0; // isShow(0: 1:)
item.sort = index + 1; e.sort = i + 1; //
item.systemId = this.multipleSelection[0].systemId; return e;
return item;
}); });
if (this.permissions) { if (this.permissions) {
this.assessmentData = data; this.assessmentData = data;

Loading…
Cancel
Save