This commit is contained in:
fengdong777
2023-04-29 14:28:37 +08:00
parent f2bac630c2
commit d3ac059efc
4 changed files with 1064 additions and 0 deletions

View File

@@ -0,0 +1,249 @@
<template>
<el-tabs
class="my-tabs"
v-model="activeName"
type="card"
@tab-click="handleClick"
>
<el-tab-pane label="教师信息" name="roleList">
<div class="container">
<el-table :data="tableData" border style="width: 100%">
<el-table-column prop="name" label="教师姓名" align="center">
</el-table-column>
<el-table-column prop="infoId" label="教师工号" align="center">
</el-table-column>
<el-table-column label="查看" align="center" width="100px">
<template slot-scope="scope">
<el-button type="text" @click="lookstuder(scope.row)"
>查看学生</el-button
>
</template>
</el-table-column>
<el-table-column label="操作" align="center">
<template slot-scope="scope">
<el-button type="primary" size="mini" @click="editRow(scope.row)">
添加
</el-button>
<el-button
type="danger"
size="mini"
@click.native.prevent="deleteRow(scope.row)"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
<pagination
:total="page.total"
:page.sync="page.current"
:limit.sync="page.size"
@pagination="pagination"
/>
<el-dialog title="收货地址" :visible.sync="lookstuders">
<el-table :data="gridData">
<el-table-column
property="infoId"
label="日期"
width="150"
></el-table-column>
<el-table-column
property="name"
label="姓名"
width="200"
></el-table-column>
<el-table-column property="address" label="地址"></el-table-column>
</el-table>
</el-dialog>
<!-- 编辑角色信息 -->
<el-dialog
:title="dialogTitle + '学生'"
:visible.sync="editDialog"
width="40%"
>
<table class="e-table" cellspacing="0">
<tr>
<td>教师姓名</td>
<td>
<el-input
v-model="teacher.teacherName"
style="width: 300px"
></el-input>
</td>
</tr>
<tr>
<td>教师工号</td>
<td>
<el-input
v-model="teacher.teacherNo"
style="width: 300px"
></el-input>
</td>
</tr>
<tr>
<td>学生姓名</td>
<td>
<el-select v-model="teacher.studentName" placeholder="请选择">
<el-option
v-for="item in options"
:key="item.value"
:label="item.name"
:value="item.id"
>
</el-option>
</el-select>
</td>
</tr>
<tr>
<td>学生学号</td>
<td>
<el-select v-model="teacher.studentNo" placeholder="请选择">
<el-option
v-for="item in options"
:key="item.value"
:label="item.infoId"
:value="item.id"
>
</el-option>
</el-select>
</td>
</tr>
</table>
<div style="margin-top: 20px; text-align: center">
<el-button type="primary" @click="save()">保存</el-button>
<!--<el-button @click="editDialog = false">关闭</el-button>-->
</div>
</el-dialog>
</div>
</el-tab-pane>
</el-tabs>
</template>
<script>
import {
pageList,
saveSysInfoShip,
selectTeacherDownStudent,
} from "@/api/system/sources/index.js";
export default {
data() {
return {
activeName: "roleList",
dialogTitle: "",
editDialog: false,
lookstuders: false,
form: {},
gridData: {},
teacher: {},
type: "js",
formBackup: Object.assign({}, this.form),
page: {
total: 0, // 默认数据总数
current: 1, // 默认开始页面
size: 10, // 每页的数据条数
params: {
psid: "",
sourceId: "",
sourceName: "",
},
},
tableData: [],
zylb: [],
sourceList: [],
options: {},
value: "",
};
},
mounted() {
this.getPageList(this.page);
pageList("xs").then((res) => {
this.options = res.data;
console.log(res);
});
},
methods: {
lookstuder(row) {
this.lookstuders = true;
console.log(row.infoId);
selectTeacherDownStudent({ infoId: row.infoId }).then((res) => {
this.gridData=res.data
});
},
pagination(val) {
// 分页
this.page.current = val.pageNum;
this.page.size = val.pageSize;
this.getPageList(this.page);
},
resetSearch() {
// 重置
this.page = {
total: 0, // 默认数据总数
current: 1, // 默认开始页面
size: 10, // 每页的数据条数
params: {
name: "",
psid: "",
sourceId: "",
sourceName: "",
},
};
this.getPageList();
},
getPageList() {
// 获取列表
pageList(this.type).then((res) => {
this.tableData = res.data;
this.page.total = res.data.total;
});
},
handleClick(tab, event) {
if (tab.name == "addrole") {
this.dialogTitle = "新增";
this.roleForm = Object.assign({}, this.formBackup);
} else {
this.getPageList();
}
},
reset() {
this.form = {};
},
editRow(row) {
this.dialogTitle = "添加";
this.editDialog = true;
this.form = Object.assign({}, row);
},
save() {
console.log(this.teacher);
saveSysInfoShip(this.teacher).then((res) => {
console.log(res);
});
this.editDialog = false;
},
deleteRow(row) {
this.$confirm("确定要删除该资源吗, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(() => {
delSources({ sid: row.sid }).then((res) => {
this.getPageList();
this.$message({
type: "success",
message: "删除成功!",
});
});
});
},
},
};
</script>
<style scoped="scoped" lang="scss">
.my-tabs {
margin-top: 10px;
}
</style>