|
@@ -0,0 +1,396 @@
|
|
|
+<style>
|
|
|
+.form_width {
|
|
|
+ width: 180px;
|
|
|
+}
|
|
|
+</style>
|
|
|
+<template>
|
|
|
+ <div>
|
|
|
+ <section class="content">
|
|
|
+ <div>
|
|
|
+ <!-- 头信息 -->
|
|
|
+ <div><h3 class="box-title">精确结构预设</h3></div>
|
|
|
+ <!-- 正文信息 -->
|
|
|
+ <div class="box-body">
|
|
|
+ <el-form
|
|
|
+ :inline="true"
|
|
|
+ :model="formSearch"
|
|
|
+ label-position="right"
|
|
|
+ label-width="90px"
|
|
|
+ >
|
|
|
+ <el-row :gutter="10">
|
|
|
+ <el-col :xs="7" :sm="7" :md="7" :lg="8">
|
|
|
+ <el-form-item label="结构名称" class="pull-left">
|
|
|
+ <el-input
|
|
|
+ placeholder="请输入结构名称"
|
|
|
+ v-model="formSearch.name"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :xs="7" :sm="7" :md="7" :lg="8">
|
|
|
+ <el-form-item label="创建人" class="pull-left">
|
|
|
+ <el-input
|
|
|
+ placeholder="请输入创建人"
|
|
|
+ v-model="formSearch.creator"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :xs="7" :sm="7" :md="7" :lg="8">
|
|
|
+ <el-form-item label="制定课程">
|
|
|
+ <el-select
|
|
|
+ v-model="formSearch.courseNo"
|
|
|
+ class="form_width"
|
|
|
+ filterable
|
|
|
+ :remote-method="getCourses"
|
|
|
+ remote
|
|
|
+ clearable
|
|
|
+ placeholder="请选择"
|
|
|
+ >
|
|
|
+ <el-option label="请选择" value="ALL" key="ALL"></el-option>
|
|
|
+ <el-option label="公用" value="" key=""></el-option>
|
|
|
+ <el-option
|
|
|
+ v-for="item in courseInfoSelect"
|
|
|
+ :label="item.courseInfo"
|
|
|
+ :value="item.courseNo"
|
|
|
+ :key="item.courseNo"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-form-item class="pull-right buttonframe">
|
|
|
+ <el-button
|
|
|
+ size="small"
|
|
|
+ style="margin-left:90px;"
|
|
|
+ type="primary"
|
|
|
+ icon="search"
|
|
|
+ @click="searchPaperStructs"
|
|
|
+ >查询</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ size="small"
|
|
|
+ type="primary"
|
|
|
+ icon="plus"
|
|
|
+ @click="addPaperStruct"
|
|
|
+ >新增</el-button
|
|
|
+ >
|
|
|
+ <el-button size="small" type="danger" @click="deletePapers"
|
|
|
+ ><i class="el-icon-delete"></i> 删除</el-button
|
|
|
+ >
|
|
|
+ </el-form-item>
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
+
|
|
|
+ <!-- 页面列表 -->
|
|
|
+ <el-table
|
|
|
+ :data="tableData"
|
|
|
+ v-loading="loading"
|
|
|
+ element-loading-text="拼命加载中"
|
|
|
+ border
|
|
|
+ style="width: 100%;text-align:center;"
|
|
|
+ @selection-change="selectionChange"
|
|
|
+ >
|
|
|
+ <el-table-column type="selection"> </el-table-column>
|
|
|
+ <el-table-column label="预设精确结构名称" width="200">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <div>
|
|
|
+ <span>{{ scope.row.name }}</span>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="关联课程" width="180">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <div>
|
|
|
+ <span>{{ scope.row.courseName }}</span>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="课程代码" width="110">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <div>
|
|
|
+ <span>{{ scope.row.courseNo }}</span>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="类型" width="110">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <div>
|
|
|
+ <span>{{ getType(scope.row.courseNo) }}</span>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="大题数" width="80">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <div>
|
|
|
+ <span>{{ scope.row.detailCount }}</span>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="小题数" width="80">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <div>
|
|
|
+ <span>{{ scope.row.detailUnitCount }}</span>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="总分" width="70">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <div>
|
|
|
+ <span>{{ scope.row.totalScore }}</span>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="创建人" width="110">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <div>
|
|
|
+ <span>{{ scope.row.creator }}</span>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column :context="_self" label="操作" width="140">
|
|
|
+ <div>
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ type="info"
|
|
|
+ @click="editPaperStruct(row);"
|
|
|
+ >
|
|
|
+ 修改
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ type="danger"
|
|
|
+ @click="deletePaper($index, row);"
|
|
|
+ >
|
|
|
+ 删除
|
|
|
+ </el-button>
|
|
|
+ </div>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <div class="page pull-right">
|
|
|
+ <el-pagination
|
|
|
+ @current-change="handleCurrentChange"
|
|
|
+ :current-page="currentPage"
|
|
|
+ :page-size="pageSize"
|
|
|
+ layout="total, prev, pager, next, jumper"
|
|
|
+ :total="total"
|
|
|
+ >
|
|
|
+ </el-pagination>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </section>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { CORE_API, Q_API } from "../constants/constants";
|
|
|
+export default {
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ courseLoading: false,
|
|
|
+ formSearch: {
|
|
|
+ name: "",
|
|
|
+ creator: "",
|
|
|
+ courseNo: "ALL",
|
|
|
+ type: "EXACT"
|
|
|
+ },
|
|
|
+ paperStructId: "",
|
|
|
+ loading: false,
|
|
|
+ tableData: [],
|
|
|
+ selectedList: [],
|
|
|
+ currentPage: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ total: 10,
|
|
|
+ courseList: [],
|
|
|
+ isClear: 0
|
|
|
+ };
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ //查询
|
|
|
+ searchPaperStructs() {
|
|
|
+ this.loading = true;
|
|
|
+ var url =
|
|
|
+ Q_API + "/paperStruct/" + this.currentPage + "/" + this.pageSize;
|
|
|
+ this.$http.get(url, { params: this.formSearch }).then(response => {
|
|
|
+ console.log("response:", response);
|
|
|
+ this.tableData = response.data.content;
|
|
|
+ this.total = response.data.totalElements;
|
|
|
+ });
|
|
|
+ this.loading = false;
|
|
|
+ },
|
|
|
+ //全选
|
|
|
+ selectionChange(val) {
|
|
|
+ this.selectedList = [];
|
|
|
+ var selectedList = this.selectedList;
|
|
|
+ val.forEach(element => {
|
|
|
+ selectedList.push(element.id);
|
|
|
+ });
|
|
|
+ this.selectedList = selectedList;
|
|
|
+ },
|
|
|
+ editPaperStruct(row) {
|
|
|
+ sessionStorage.setItem("paper_stucture", JSON.stringify(this.formSearch));
|
|
|
+ sessionStorage.setItem("paper_stucture_currentPage", this.currentPage);
|
|
|
+ sessionStorage.setItem("paperStruct", JSON.stringify(row));
|
|
|
+ this.$router.push({
|
|
|
+ path: "/index/insert_paper_structure/" + row.id
|
|
|
+ });
|
|
|
+ },
|
|
|
+ //删除单条数据
|
|
|
+ deletePaper(index, row) {
|
|
|
+ this.$confirm("是否删除试卷结构?", "提示", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning"
|
|
|
+ }).then(() => {
|
|
|
+ var url = Q_API + "/paperStruct/" + row.id;
|
|
|
+ this.loading = true;
|
|
|
+ this.$http.delete(url).then(
|
|
|
+ () => {
|
|
|
+ this.$notify({
|
|
|
+ type: "success",
|
|
|
+ message: "删除成功!"
|
|
|
+ });
|
|
|
+ this.searchPaperStructs();
|
|
|
+ },
|
|
|
+ () => {
|
|
|
+ this.$notify({
|
|
|
+ type: "error",
|
|
|
+ message: "删除失败!"
|
|
|
+ });
|
|
|
+ }
|
|
|
+ );
|
|
|
+ });
|
|
|
+ this.loading = false;
|
|
|
+ },
|
|
|
+ //删除多条数据
|
|
|
+ deletePapers() {
|
|
|
+ var selectedList = this.selectedList;
|
|
|
+ if (selectedList.length === 0) {
|
|
|
+ this.$notify({
|
|
|
+ type: "error",
|
|
|
+ message: "请选择要删除的试卷结构"
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.$confirm("是否删除试卷结构?", "提示", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "error"
|
|
|
+ }).then(() => {
|
|
|
+ this.loading = true;
|
|
|
+ var url = Q_API + "/paperStruct/" + this.selectedIds;
|
|
|
+ this.$http
|
|
|
+ .delete(url)
|
|
|
+ .then(() => {
|
|
|
+ this.$notify({
|
|
|
+ type: "success",
|
|
|
+ message: "删除成功!"
|
|
|
+ });
|
|
|
+ this.searchPaperStructs();
|
|
|
+ this.selectedList = [];
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.$notify({
|
|
|
+ type: "error",
|
|
|
+ message: "删除失败!"
|
|
|
+ });
|
|
|
+ this.selectedList = [];
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ this.loading = false;
|
|
|
+ },
|
|
|
+
|
|
|
+ //新增
|
|
|
+ addPaperStruct() {
|
|
|
+ sessionStorage.setItem("paper_stucture", JSON.stringify(this.formSearch));
|
|
|
+ sessionStorage.setItem("paper_stucture_currentPage", this.currentPage);
|
|
|
+ this.$router.push({
|
|
|
+ path: "/index/insert_paper_structure/add"
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ //分页跳转
|
|
|
+ handleCurrentChange(val) {
|
|
|
+ this.currentPage = val;
|
|
|
+ this.searchPaperStructs();
|
|
|
+ },
|
|
|
+
|
|
|
+ removeItem() {
|
|
|
+ sessionStorage.removeItem("paperStruct");
|
|
|
+ },
|
|
|
+ //查询所有课程
|
|
|
+ getCourses(query) {
|
|
|
+ console.log("query:", query);
|
|
|
+ query = query.trim();
|
|
|
+ if (query) {
|
|
|
+ if (!(query.indexOf("(") > -1 && query.indexOf(")") > -1)) {
|
|
|
+ this.courseLoading = true;
|
|
|
+ this.$http
|
|
|
+ .get(CORE_API + "/course/query?name=" + query + "&enable=true")
|
|
|
+ .then(response => {
|
|
|
+ this.courseList = response.body;
|
|
|
+ this.courseLoading = false;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.courseList = [];
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getType(val) {
|
|
|
+ if (val == "ENSEMBLE") {
|
|
|
+ return "宏观结构";
|
|
|
+ }
|
|
|
+ return "微观结构";
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ selectedIds() {
|
|
|
+ var selectedIdsStr = "";
|
|
|
+ for (let id of this.selectedList) {
|
|
|
+ if (!selectedIdsStr) {
|
|
|
+ selectedIdsStr += id;
|
|
|
+ } else {
|
|
|
+ selectedIdsStr += "," + id;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return selectedIdsStr;
|
|
|
+ },
|
|
|
+ courseInfoSelect() {
|
|
|
+ var courseList = [];
|
|
|
+ for (let course of this.courseList) {
|
|
|
+ var courseInfo = course.name + "(" + course.code + ")";
|
|
|
+ var courseNo = course.code;
|
|
|
+ courseList.push({ courseNo: courseNo, courseInfo: courseInfo });
|
|
|
+ }
|
|
|
+ return courseList;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.isClear = this.$route.params.isClear;
|
|
|
+ if (this.isClear == 0 || !this.isClear) {
|
|
|
+ sessionStorage.removeItem("paper_stucture");
|
|
|
+ sessionStorage.removeItem("paper_stucture_currentPage");
|
|
|
+ } else {
|
|
|
+ this.formSearch = JSON.parse(sessionStorage.getItem("paper_stucture"));
|
|
|
+ this.currentPage = parseInt(
|
|
|
+ sessionStorage.getItem("paper_stucture_currentPage")
|
|
|
+ );
|
|
|
+ if (!this.formSearch) {
|
|
|
+ this.formSearch = {
|
|
|
+ name: "",
|
|
|
+ creator: "",
|
|
|
+ courseNo: "ALL",
|
|
|
+ type: "EXACT"
|
|
|
+ };
|
|
|
+ }
|
|
|
+ if (!this.currentPage) {
|
|
|
+ this.currentPage = 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.removeItem();
|
|
|
+ this.searchPaperStructs();
|
|
|
+ //this.getCourses();
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|