123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324 |
- <template>
- <div class="pb_content" style="background: #fff" v-loading="loading">
- <div class="pb_content_body" style="position: relative; margin: 0">
- <div class="right">
- <div class="courseTop">
- <div class="stepsNav">
- <el-breadcrumb separator-class="el-icon-arrow-right">
- <el-breadcrumb-item v-if="!back"
- :to="{
- path:
- '/test?userid=' +
- userid +
- '&oid=' +
- oid +
- '&org=' +
- org +
- '&role=' +
- role,
- }"
- >表单管理</el-breadcrumb-item
- >
- <el-breadcrumb-item v-if="back=='sass'"
- :to="{
- path:
- '/sassPlatform?userid=' +
- userid +
- '&oid=' +
- oid +
- '&org=' +
- org +
- '&role=' +
- role,
- }"
- >sass平台</el-breadcrumb-item
- >
- <el-breadcrumb-item>
- <span style="color: rgb(15, 126, 255)">查看表单</span>
- </el-breadcrumb-item>
- </el-breadcrumb>
- </div>
- <div class="r_pub_button_retrun" @click="retrunCourse">返回</div>
- </div>
- <div class="step_box" ref="stepBox">
- <div class="pb_content_body">
- <div class="student_table">
- <el-table
- ref="table"
- :data="tableData"
- border
- :height="tableHeight"
- :fit="true"
- v-loading="isLoading"
- style="width: 100%"
- :header-cell-style="{ background: '#f1f1f1', fontSize: '17px' }"
- :row-class-name="tableRowClassName"
- >
- <el-table-column
- prop="username"
- label="提交人"
- min-width="15"
- align="center"
- >
- </el-table-column>
- <el-table-column
- prop="title"
- label="表单名称"
- min-width="15"
- align="center"
- >
- </el-table-column>
- <el-table-column
- prop="time"
- label="提交时间"
- min-width="15"
- align="center"
- >
- </el-table-column>
- <el-table-column
- prop="time"
- label="是否批改"
- min-width="15"
- align="center"
- >
- <template slot-scope="scope">
- <div>{{ scope.row.type == 3 ? '是' : '否' }}</div>
- </template>
- </el-table-column>
- <el-table-column label="操作" width="200px">
- <template slot-scope="scope">
- <el-button
- @click="getTest(scope.row)"
- type="primary"
- size="small"
- >查看</el-button
- >
- <el-button
- @click="delTest(scope.row.id)"
- type="primary"
- size="small"
- >删除</el-button
- >
- </template>
- </el-table-column>
- </el-table>
- </div>
- <div class="student_page">
- <el-pagination
- background
- layout="prev, pager, next"
- :page-size="pageSize"
- :total="total"
- @current-change="handleCurrentChange"
- >
- </el-pagination>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- export default {
- components: {},
- data() {
- return {
- userid: this.$route.query.userid,
- oid: this.$route.query.oid,
- org: this.$route.query.org,
- role: this.$route.query.role,
- cid: this.$route.query.cid,
- uid: this.$route.query.uid,
- back: this.$route.query.back,
- title: "",
- testType: [],
- see: false,
- cJson: [],
- loading: false,
- look: "",
- tableHeight: 500,
- isLoading: false,
- pageSize: 10,
- total: 0,
- page: 1,
- tableData: [],
- };
- },
- watch: {},
- methods: {
- retrunCourse() {
- this.goTo(
- "/test?userid=" +
- this.userid +
- "&oid=" +
- this.oid +
- "&org=" +
- this.org +
- "&role=" +
- this.role
- );
- },
- goTo(path) {
- this.$router.push(path);
- },
- tableRowClassName({ row, rowIndex }) {
- if ((rowIndex + 1) % 2 === 0) {
- return "even_row";
- } else {
- return "";
- }
- },
- changeHeight() {
- this.tableHeight = this.$refs.stepBox.offsetHeight - 100;
- if (this.tableHeight <= 530) {
- this.tableHeight = 530;
- }
- // 监听窗口大小变化
- let self = this;
- window.onresize = function () {
- self.tableHeight = this.$refs.stepBox.offsetHeight - 100;
- if (self.tableHeight <= 530) {
- self.tableHeight = 530;
- }
- };
- // this.$refs.table.$el.offsetTop:表格距离浏览器的高度 //200表示你想要调整的表格距离底部的高度(你可以自己随意调整),因为我们一般都有放分页组件的,所以需要给它留一个高度
- },
- handleCurrentChange(val) {
- this.page = val;
- this.getData();
- },
- getTest(row) {
- this.$router.push(
- "/checkTest2?cid=" +
- row.courseid +
- "&userid=" +
- this.userid +
- "&userid2=" +
- row.userid +
- "&tid=" +
- row.id +
- "&oid=" +
- this.oid +
- "&org=" +
- this.org +
- "&type=3" +
- "&role=" +
- this.role
- );
- },
- delTest(tid){
- let _this = this
- _this
- .$confirm("确定删除此提交的表单么?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- })
- .then(() => {
- let params = [{
- tid: tid,
- }];
- _this.ajax
- .post(_this.$store.state.api + "deleteTestCourseWorks", params)
- .then((res) => {
- _this.$message.success("删除成功");
- _this.getData();
- })
- .catch((err) => {
- console.error(err);
- });
- })
- .catch(() => {
- return;
- });
- },
- getData() {
- this.isLoading = true;
- let params = {
- cid: this.uid,
- page: this.page,
- pageSize: this.pageSize,
- };
- this.ajax
- .get(this.$store.state.api + "getTestWorksPage2", params)
- .then((res) => {
- this.isLoading = false;
- this.total = res.data[0].length > 0 ? res.data[0][0].num : 0;
- this.tableData = res.data[0];
- })
- .catch((err) => {
- console.error(err);
- });
- },
- },
- mounted() {
- this.$nextTick(function () {
- this.page = 1;
- this.changeHeight();
- this.getData();
- });
- },
- };
- </script>
- <style scoped>
- .pb_content {
- height: 100% !important;
- /* margin: 0 20px 0 20px; */
- }
- .pb_content_body {
- width: 100% !important;
- height: 100%;
- }
- .right {
- height: 100%;
- width: 100%;
- display: flex;
- overflow: hidden;
- flex-direction: column;
- }
- .basic_box {
- margin: 0 auto;
- position: relative;
- padding: 0 20px 0 20px;
- }
- .courseTop {
- display: flex;
- flex-direction: row;
- justify-content: space-between;
- align-items: center;
- width: calc(100% - 40px);
- margin: 0 auto;
- padding: 10px 0;
- }
- .stepsNav {
- display: flex;
- flex-direction: row;
- justify-content: flex-start;
- align-items: center;
- }
- .step_box {
- width: calc(100% - 40px);
- margin: 0 auto;
- height: calc(100% - 38px);
- overflow: auto;
- }
- .el-table >>> .even_row {
- background-color: #f1f1f1 !important;
- }
- .student_page {
- margin-top: 10px;
- }
- </style>
|