|
@@ -5,46 +5,82 @@
|
|
<template #custom="{item, row}">
|
|
<template #custom="{item, row}">
|
|
<template v-if="item.prop === 'studentList'">
|
|
<template v-if="item.prop === 'studentList'">
|
|
<el-row type="flex" justify="left">
|
|
<el-row type="flex" justify="left">
|
|
- <el-col :span="6" v-for="(stud, index) in row.studentList" :key="index">{{ stud }}</el-col>
|
|
|
|
|
|
+ <el-col :span="6" v-for="(stud, index) in row.stus" :key="index" @click.native="changeRoom(stud)">{{ stud.name }}</el-col>
|
|
</el-row>
|
|
</el-row>
|
|
</template>
|
|
</template>
|
|
</template>
|
|
</template>
|
|
</data-table>
|
|
</data-table>
|
|
</detail-frame>
|
|
</detail-frame>
|
|
|
|
+ <el-dialog :visible.sync="dialog" title="修改寝室" @close="toClose" width="30%">
|
|
|
|
+ <data-form :data="form" :fields="turnBedRoomFields" :rules="{}" @save="turnSave">
|
|
|
|
+ <template #options="{item,form}">
|
|
|
|
+ <template v-if="item.model == 'bedroom'">
|
|
|
|
+ <template v-for="(i, index) in list">
|
|
|
|
+ <el-option v-if="i.bedroom" :key="index" :label="`${i.bedroom}`" :value="i.bedroom"></el-option>
|
|
|
|
+ </template>
|
|
|
|
+ </template>
|
|
|
|
+ </template>
|
|
|
|
+ </data-form>
|
|
|
|
+ </el-dialog>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
|
+import _ from 'lodash';
|
|
import { mapActions, mapState, createNamespacedHelpers } from 'vuex';
|
|
import { mapActions, mapState, createNamespacedHelpers } from 'vuex';
|
|
import dataTable from '@frame/components/data-table';
|
|
import dataTable from '@frame/components/data-table';
|
|
|
|
+import dataForm from '@frame/components/form';
|
|
import detailFrame from '@frame/layout/admin/detail-frame';
|
|
import detailFrame from '@frame/layout/admin/detail-frame';
|
|
-const { mapActions: student } = createNamespacedHelpers('student'); //班级
|
|
|
|
|
|
+const { mapActions: bedroom } = createNamespacedHelpers('bedroom'); //班级
|
|
export default {
|
|
export default {
|
|
metaInfo: { title: '寝室安排' },
|
|
metaInfo: { title: '寝室安排' },
|
|
name: 'bedroom',
|
|
name: 'bedroom',
|
|
props: {},
|
|
props: {},
|
|
- components: { detailFrame, dataTable },
|
|
|
|
|
|
+ components: { detailFrame, dataTable, dataForm },
|
|
data: () => ({
|
|
data: () => ({
|
|
|
|
+ dialog: false,
|
|
fields: [
|
|
fields: [
|
|
{ label: '寝室号', prop: 'bedroom', options: { width: `150px` } },
|
|
{ label: '寝室号', prop: 'bedroom', options: { width: `150px` } },
|
|
{ label: '寝室人员', prop: 'studentList', custom: true },
|
|
{ label: '寝室人员', prop: 'studentList', custom: true },
|
|
],
|
|
],
|
|
|
|
+ turnBedRoomFields: [
|
|
|
|
+ { label: '姓名', model: 'name', type: 'text' },
|
|
|
|
+ { label: '学校', model: 'school_name', type: 'text' },
|
|
|
|
+ { label: '寝室', model: 'bedroom', type: 'select' },
|
|
|
|
+ ],
|
|
list: [],
|
|
list: [],
|
|
|
|
+ form: {},
|
|
}),
|
|
}),
|
|
created() {
|
|
created() {
|
|
this.search();
|
|
this.search();
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
- ...student(['bedRoom']),
|
|
|
|
|
|
+ ...bedroom(['getClassList']),
|
|
async search() {
|
|
async search() {
|
|
- let res = await this.bedRoom({ classid: this.id });
|
|
|
|
|
|
+ let res = await this.getClassList(this.id);
|
|
if (this.$checkRes(res)) {
|
|
if (this.$checkRes(res)) {
|
|
this.$set(this, `list`, res.data);
|
|
this.$set(this, `list`, res.data);
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+ //转寝保存
|
|
|
|
+ async turnSave({ data }) {
|
|
|
|
+ let res = await this.updateStudent(data);
|
|
|
|
+ if (this.$checkRes(res, `转寝成功`, res.errmsg || `转寝失败`)) {
|
|
|
|
+ this.getStudent();
|
|
|
|
+ this.toClose();
|
|
|
|
+ }
|
|
|
|
+ },
|
|
toreturn() {
|
|
toreturn() {
|
|
window.history.go(-1);
|
|
window.history.go(-1);
|
|
},
|
|
},
|
|
|
|
+ changeRoom(stu) {
|
|
|
|
+ this.$set(this, `form`, _.cloneDeep(stu));
|
|
|
|
+ this.dialog = true;
|
|
|
|
+ },
|
|
|
|
+ toClose() {
|
|
|
|
+ this.dialog = false;
|
|
|
|
+ this.form = {};
|
|
|
|
+ },
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
id() {
|
|
id() {
|