|
|
@@ -3,7 +3,9 @@
|
|
|
<div class="filters-container">
|
|
|
<el-input placeholder="输入关键字" v-model="search" clearable class="filter-item"></el-input>
|
|
|
<el-button @click="getData" type="primary" icon="el-icon-search" class="filter-item">搜索</el-button>
|
|
|
- <el-button @click="openDialog" type="primary" icon="el-icon-plus" class="filter-item">添加</el-button>
|
|
|
+ <el-button @click="openDialog" type="primary" icon="el-icon-plus" class="filter-item" v-if="showAdd"
|
|
|
+ >添加</el-button
|
|
|
+ >
|
|
|
</div>
|
|
|
<el-table
|
|
|
:data="tableData"
|
|
|
@@ -23,7 +25,7 @@
|
|
|
<template slot-scope="{ row }">
|
|
|
<el-button @click="monitor(row)" type="success" size="mini" plain>监控</el-button>
|
|
|
<!-- <el-button @click="editRow(row)" type="primary" size="mini" plain>编辑</el-button> -->
|
|
|
- <el-button @click="deleteRow(row)" type="danger" size="mini" plain>删除</el-button>
|
|
|
+ <el-button @click="deleteRow(row)" type="danger" size="mini" plain v-if="showAdd">删除</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
@@ -78,7 +80,7 @@ export default {
|
|
|
return {
|
|
|
multipleMode: false,
|
|
|
search: '',
|
|
|
- url: '/examRoom/all',
|
|
|
+ url: '/examRoom/byRecord',
|
|
|
downloading: false,
|
|
|
dialogVisible: false,
|
|
|
form: {
|
|
|
@@ -90,29 +92,33 @@ export default {
|
|
|
formRoom: {
|
|
|
id: '',
|
|
|
addRooms: []
|
|
|
- }
|
|
|
+ },
|
|
|
+ showAdd: false
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
if (this.$route.query.id) {
|
|
|
this.formRoom.id = Number(this.$route.query.id);
|
|
|
}
|
|
|
- this.$http
|
|
|
- .post('/examRoom/all', { size: 100, query: { organizationId: this.organization.id } }, { body: 'json' })
|
|
|
- .then(res => {
|
|
|
- if (res.content.length > 0) {
|
|
|
- res.content.forEach(item => {
|
|
|
- this.rooms.push({
|
|
|
- label: item.name,
|
|
|
- value: item.id
|
|
|
+ if (this.organization != null) {
|
|
|
+ this.showAdd = true;
|
|
|
+ this.$http
|
|
|
+ .post('/examRoom/all', { size: 100, query: { organizationId: this.organization.id } }, { body: 'json' })
|
|
|
+ .then(res => {
|
|
|
+ if (res.content.length > 0) {
|
|
|
+ res.content.forEach(item => {
|
|
|
+ this.rooms.push({
|
|
|
+ label: item.name,
|
|
|
+ value: item.id
|
|
|
+ });
|
|
|
});
|
|
|
- });
|
|
|
- }
|
|
|
- })
|
|
|
- .catch(e => {
|
|
|
- console.log(e);
|
|
|
- this.$message.error(e.error);
|
|
|
- });
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(e => {
|
|
|
+ console.log(e);
|
|
|
+ this.$message.error(e.error);
|
|
|
+ });
|
|
|
+ }
|
|
|
},
|
|
|
computed: {
|
|
|
selection() {
|
|
|
@@ -122,7 +128,12 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
beforeGetData() {
|
|
|
- return { search: this.search };
|
|
|
+ return {
|
|
|
+ search: this.search,
|
|
|
+ query: {
|
|
|
+ recordId: this.$route.query.id
|
|
|
+ }
|
|
|
+ };
|
|
|
},
|
|
|
toggleMultipleMode(multipleMode) {
|
|
|
this.multipleMode = multipleMode;
|
|
|
@@ -182,7 +193,10 @@ export default {
|
|
|
deleteRow(row) {
|
|
|
this.$alert('删除将无法恢复,确认要删除么?', '警告', { type: 'error' })
|
|
|
.then(() => {
|
|
|
- return this.$http.post(`/examRoom/del/${row.id}`);
|
|
|
+ return this.$http.post(`/recordExamRoom/delByRecord`, {
|
|
|
+ recordId: this.formRoom.id,
|
|
|
+ examRoomId: row.id
|
|
|
+ });
|
|
|
})
|
|
|
.then(() => {
|
|
|
this.$message.success('删除成功');
|