Bladeren bron

题库新页面提交:课程属性页面,题库列表页面,卷库列表页面

weiwenhai 6 jaren geleden
bovenliggende
commit
3cdb09a9de

+ 4 - 0
src/modules/questions/constants/constants.js

@@ -17,6 +17,10 @@ export const QUESTION_TYPES = [
   { value: "TEXT_ANSWER_QUESTION", label: "问答" },
   { value: "NESTED_ANSWER_QUESTION", label: "套题" }
 ];
+export const PUBLICITY_LIST = [
+  { label: "公开", value: true },
+  { label: "非公开", value: false }
+];
 //option字母顺序过滤器
 Vue.filter("optionOrderWordFilter", function(value) {
   return String.fromCharCode(65 + value);

+ 20 - 0
src/modules/questions/routes/routes.js

@@ -5,6 +5,10 @@ import InsertPaperStructureInfo from "../views/InsertPaperStructureInfo.vue";
 import BluePaperStructure from "../views/BluePaperStructure.vue";
 import InsertBluePaperStructure from "../views/InsertBluePaperStructure.vue";
 import InsertBluePaperStructureInfo from "../views/InsertBluePaperStructureInfo.vue";
+import CourseProperty from "../views/CourseProperty.vue";
+import PropertyInfo from "../views/PropertyInfo.vue";
+import ImportPaper from "../views/ImportPaper.vue";
+import GenPaper from "../views/GenPaper.vue";
 
 export default [
   {
@@ -35,6 +39,22 @@ export default [
       {
         path: "insert_blue_paper_structure_info/:id/:paperStructId", //蓝图试卷结构添加题型结构
         component: InsertBluePaperStructureInfo
+      },
+      {
+        path: "course_property/:isClear", //课程属性列表
+        component: CourseProperty
+      },
+      {
+        path: "property_info/:id", //课程属性
+        component: PropertyInfo
+      },
+      {
+        path: "import_paper/:isClear", //题库试卷列表
+        component: ImportPaper
+      },
+      {
+        path: "gen_paper/:isClear", //卷库试卷列表
+        component: GenPaper
       }
     ]
   }

+ 540 - 0
src/modules/questions/views/CourseProperty.vue

@@ -0,0 +1,540 @@
+<template>
+  <div>
+    <section class="content">
+      <div class="box box-info">
+        <!-- 头信息 -->
+        <div class="box-header with-border">
+          <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="课程名称">
+                  <el-select
+                    v-model="formSearch.courseId"
+                    class="form_width"
+                    filterable
+                    :remote-method="getCourses"
+                    remote
+                    clearable
+                    placeholder="请选择"
+                  >
+                    <el-option
+                      v-for="item in courseInfoSelect"
+                      :label="item.courseInfo"
+                      :value="item.courseId"
+                      :key="item.courseId"
+                    >
+                    </el-option>
+                  </el-select>
+                </el-form-item>
+              </el-col>
+              <el-form-item class="pull-right buttonframe">
+                <el-button
+                  size="small"
+                  style="margin-left:90px;"
+                  type="primary"
+                  icon="search"
+                  @click="searchCourseProperty"
+                  >查询</el-button
+                >
+                <el-button
+                  size="small"
+                  type="primary"
+                  icon="plus"
+                  @click="addCourseProperty"
+                  >新增</el-button
+                >
+                <el-button
+                  size="small"
+                  type="success"
+                  @click="openCoursePropertys"
+                  ><i class="el-icon-delete"></i> 启用</el-button
+                >
+                <el-button
+                  size="small"
+                  type="danger"
+                  @click="closeCoursePropertys"
+                  ><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%;"
+            @selection-change="selectionChange"
+          >
+            <el-table-column type="selection"></el-table-column>
+            <el-table-column label="课程名称">
+              <template slot-scope="scope">
+                <div>
+                  <span>{{ scope.row.courseName }}</span>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="属性名称">
+              <template slot-scope="scope">
+                <div>
+                  <span>{{ scope.row.name }}</span>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="状态">
+              <template slot-scope="scope">
+                <div>
+                  <span>{{ getEnable(scope.row.enable) }}</span>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column :context="_self" label="操作">
+              <template slot-scope="scope">
+                <div>
+                  <el-button
+                    size="mini"
+                    type="info"
+                    @click="editCourseProperty(scope.row);"
+                  >
+                    详情
+                  </el-button>
+                  <el-button
+                    size="mini"
+                    type="success"
+                    @click="openCourseProperty(scope.row);"
+                  >
+                    启用
+                  </el-button>
+                  <el-button
+                    size="mini"
+                    type="danger"
+                    @click="closeCourseProperty(scope.row);"
+                  >
+                    禁用
+                  </el-button>
+                </div>
+              </template>
+            </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>
+        <el-dialog
+          title="新增课程属性名称"
+          :visible.sync="coursePropertyDialog"
+        >
+          <el-form :model="coursePropertyForm">
+            <el-row>
+              <el-form-item label="属性名称">
+                <el-input
+                  v-model="coursePropertyForm.name"
+                  auto-complete="off"
+                  style="width:210px;"
+                  @change="showTile"
+                ></el-input>
+                <span style="color: red;" v-show="showName"
+                  >请输入属性名称</span
+                >
+              </el-form-item>
+            </el-row>
+            <el-form-item label="课程名称">
+              <el-select
+                v-model="coursePropertyForm.courseId"
+                class="form_width"
+                @change="showTile"
+                filterable
+                :remote-method="getCourses"
+                remote
+                clearable
+                placeholder="请选择"
+              >
+                <el-option
+                  v-for="item in courseInfoSelect"
+                  :label="item.courseInfo"
+                  :value="item.courseId"
+                  :key="item.courseId"
+                >
+                </el-option>
+              </el-select>
+              <span style="color: red;" v-show="showCourseNo"
+                >请选择课程名称</span
+              >
+            </el-form-item>
+          </el-form>
+          <div slot="footer" class="dialog-footer">
+            <el-button @click="coursePropertyDialog = false;">取 消</el-button>
+            <el-button type="primary" @click="submit">确 定</el-button>
+          </div>
+        </el-dialog>
+      </div>
+    </section>
+  </div>
+</template>
+
+<script>
+import { CORE_API, Q_API } from "../constants/constants";
+export default {
+  data() {
+    return {
+      formSearch: {
+        name: "",
+        courseId: ""
+      },
+      courseList: [],
+      loading: false,
+      tableData: [],
+      currentPage: 1,
+      pageSize: 10,
+      total: 10,
+      coursePropertyForm: {
+        name: "",
+        courseId: "",
+        courseCode: ""
+      },
+      coursePropertyDialog: false,
+      showName: false,
+      showCourseNo: false,
+      selectedList: []
+    };
+  },
+
+  methods: {
+    //查询所有课程属性
+    searchCourseProperty() {
+      this.loading = true;
+      var url =
+        Q_API + "/courseProperty/all/" + this.currentPage + "/" + this.pageSize;
+      this.$http.get(url, { params: this.formSearch }).then(response => {
+        this.tableData = response.data.content;
+        this.total = response.data.totalElements;
+        this.loading = false;
+      });
+    },
+    //新增
+    addCourseProperty() {
+      this.showName = false;
+      this.showCourseNo = false;
+      this.coursePropertyDialog = true;
+      this.coursePropertyForm.name = "";
+      this.coursePropertyForm.courseId = "";
+    },
+    //修改
+    editCourseProperty(row) {
+      sessionStorage.setItem("course_property_name", this.formSearch.name);
+      sessionStorage.setItem(
+        "course_property_courseId",
+        this.formSearch.courseId
+      );
+      sessionStorage.setItem("course_property_currentPage", this.currentPage);
+      sessionStorage.setItem("courseProperty", JSON.stringify(row));
+      this.$router.push({
+        path: "/questions/property_info/" + row.id
+      });
+    },
+    //开启
+    openCourseProperty(row) {
+      this.$confirm("确认开启?", "提示", {
+        type: "success"
+      }).then(() => {
+        this.loading = true;
+        this.$http
+          .put(Q_API + "/courseProperty/open/" + row.id)
+          .then(() => {
+            this.$notify({
+              message: "开启成功",
+              type: "success"
+            });
+            this.searchCourseProperty();
+          })
+          .catch(() => {
+            this.$notify({
+              type: "error",
+              message: "开启失败"
+            });
+          });
+      });
+    },
+    //批量启用
+    openCoursePropertys() {
+      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 + "/courseProperty/opens/" + this.selectedIds;
+          this.$http
+            .put(url)
+            .then(() => {
+              this.$notify({
+                type: "success",
+                message: "开启成功!"
+              });
+              this.searchCourseProperty();
+              this.selectedList = [];
+            })
+            .catch(() => {
+              this.$notify({
+                type: "error",
+                message: "开启失败!"
+              });
+              this.selectedList = [];
+            });
+        });
+      }
+      this.loading = false;
+    },
+    //关闭
+    closeCourseProperty(row) {
+      this.$confirm("确认禁用?", "提示", {
+        type: "warning"
+      }).then(() => {
+        this.loading = true;
+        this.$http
+          .put(Q_API + "/courseProperty/close/" + row.id)
+          .then(() => {
+            this.$notify({
+              message: "禁用成功",
+              type: "success"
+            });
+            this.searchCourseProperty();
+          })
+          .catch(() => {
+            this.$notify({
+              type: "error",
+              message: "禁用失败"
+            });
+          });
+      });
+    },
+    //批量关闭
+    closeCoursePropertys() {
+      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 + "/courseProperty/closes/" + this.selectedIds;
+          this.$http
+            .put(url)
+            .then(() => {
+              this.$notify({
+                type: "success",
+                message: "禁用成功!"
+              });
+              this.searchCourseProperty();
+              this.selectedList = [];
+            })
+            .catch(() => {
+              this.$notify({
+                type: "error",
+                message: "禁用失败!"
+              });
+              this.selectedList = [];
+            });
+        });
+      }
+      this.loading = false;
+    },
+    //分页
+    handleCurrentChange(val) {
+      console.log(`当前页: ${val}`);
+      this.currentPage = val;
+      this.searchCourseProperty();
+    },
+    //确定
+    submit() {
+      if (!this.coursePropertyForm.name && !this.coursePropertyForm.courseId) {
+        this.showName = true;
+        this.showCourseNo = true;
+        return 0;
+      }
+      if (!this.coursePropertyForm.name) {
+        this.showName = true;
+        return 0;
+      }
+      if (!this.coursePropertyForm.courseId) {
+        this.showCourseNo = true;
+        return 0;
+      }
+      for (let course of this.courseList) {
+        if (course.id == this.coursePropertyForm.courseId) {
+          this.coursePropertyForm.courseCode = course.code;
+        }
+      }
+      this.$http
+        .post(Q_API + "/courseProperty/save", this.coursePropertyForm)
+        .then(() => {
+          this.$notify({
+            message: "新增成功",
+            type: "success"
+          });
+          this.coursePropertyDialog = false;
+          this.searchCourseProperty();
+        })
+        .catch(() => {
+          this.$notify({
+            type: "error",
+            message: "课程属性名称重复,请重新命名"
+          });
+        });
+    },
+    showTile() {
+      if (!this.coursePropertyForm.name) {
+        this.showName = true;
+      }
+      if (!this.coursePropertyForm.courseId) {
+        this.showCourseNo = true;
+      }
+      if (this.coursePropertyForm.name) {
+        this.showName = false;
+      }
+      if (this.coursePropertyForm.courseId) {
+        this.showCourseNo = false;
+      }
+    },
+    getEnable(value) {
+      if (value === true) {
+        return "开启";
+      } else {
+        return "禁用";
+      }
+    },
+    //查询所有课程
+    getCourses(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.data;
+              this.courseLoading = false;
+            });
+        }
+      } else {
+        this.courseList = [];
+      }
+    },
+    removeItem() {
+      sessionStorage.removeItem("course_property_name");
+      sessionStorage.removeItem("course_property_courseId");
+      sessionStorage.removeItem("course_property_currentPage");
+    },
+    //页面回填值
+    initValue() {
+      this.isClear = this.$route.params.isClear;
+      if (this.isClear == 0 || !this.isClear) {
+        console.log("clear");
+        this.removeItem();
+      } else {
+        this.formSearch.name =
+          sessionStorage.getItem("course_property_name") == "null"
+            ? ""
+            : sessionStorage.getItem("course_property_name");
+        this.formSearch.courseId =
+          sessionStorage.getItem("course_property_courseId") == ""
+            ? ""
+            : parseInt(sessionStorage.getItem("course_property_courseId"));
+        this.currentPage =
+          sessionStorage.getItem("course_property_currentPage") == null
+            ? 1
+            : parseInt(sessionStorage.getItem("course_property_currentPage"));
+      }
+      console.log("this.formSearch.courseId:", this.formSearch.courseId);
+      this.getOneCourse(this.formSearch.courseId);
+    },
+    //查询单个课程
+    getOneCourse(courseId) {
+      if (courseId) {
+        this.$http.get(CORE_API + "/course/" + courseId).then(response => {
+          this.courseList.push(response.data);
+        });
+      } else {
+        this.courseList = [];
+      }
+    },
+    //全选
+    selectionChange(val) {
+      this.selectedList = [];
+      var selectedList = this.selectedList;
+      val.forEach(element => {
+        selectedList.push(element.id);
+      });
+      this.selectedList = selectedList;
+    }
+  },
+  computed: {
+    selectedIds() {
+      var selectedIdsStr = "";
+      for (let id of this.selectedList) {
+        if (!selectedIdsStr) {
+          selectedIdsStr += id;
+        } else {
+          selectedIdsStr += "," + id;
+        }
+      }
+      return selectedIdsStr;
+    },
+    courseInfoSelect() {
+      var courseList = [];
+      for (var i = 0; i < this.courseList.length; i++) {
+        var courseInfo = {
+          courseInfo:
+            this.courseList[i].name + "(" + this.courseList[i].code + ")",
+          courseId: this.courseList[i].id
+        };
+        courseList.push(courseInfo);
+      }
+      return courseList;
+    }
+  },
+  created() {
+    this.initValue();
+    this.searchCourseProperty();
+  }
+};
+</script>

+ 712 - 0
src/modules/questions/views/GenPaper.vue

@@ -0,0 +1,712 @@
+<template>
+  <div>
+    <section class="content">
+      <div class="box box-info">
+        <div class="box-header with-border">
+          <h3 class="box-title">考试试卷管理</h3>
+        </div>
+        <div class="box-body">
+          <el-form
+            :inline="true"
+            :model="formSearch"
+            label-position="right"
+            label-width="110px"
+          >
+            <el-form-item label="课程名称" class="pull-left">
+              <el-select
+                v-model="formSearch.courseNo"
+                :remote-method="getCourses"
+                :loading="courseLoading"
+                remote
+                filterable
+                clearable
+                placeholder="全部"
+              >
+                <el-option
+                  v-for="item in courseInfoSelect"
+                  :label="item.courseInfo"
+                  :value="item.courseNo"
+                  :key="item.courseNo"
+                >
+                </el-option>
+              </el-select>
+            </el-form-item>
+            <el-form-item label="试卷名称" class="pull-left">
+              <el-input
+                v-model="formSearch.name"
+                placeholder="试卷名称"
+              ></el-input>
+            </el-form-item>
+            <el-form-item label="层次" class="pull-left">
+              <el-select v-model="formSearch.level">
+                <el-option label="请选择" value=""> </el-option>
+                <el-option
+                  v-for="item in levelList"
+                  :label="item.label"
+                  :value="item.value"
+                  :key="item.value"
+                >
+                </el-option>
+              </el-select>
+            </el-form-item>
+            <el-form-item class="pull-right">
+              <el-button
+                size="small"
+                type="primary"
+                icon="search"
+                @click="searchGenPaper"
+                >查询</el-button
+              >
+              <el-button
+                size="small"
+                type="primary"
+                icon="plus"
+                @click="genPaperDetail"
+                >组卷</el-button
+              >
+              <el-button
+                size="small"
+                type="danger"
+                icon="delete"
+                @click="batchDeleteGenPaper"
+                >批量删除
+              </el-button>
+              <el-button
+                size="small"
+                type="primary"
+                icon="upload2"
+                @click="openBatchExportPaperDialog"
+              >
+                批量导出
+              </el-button>
+            </el-form-item>
+          </el-form>
+          <el-table
+            v-loading="loading"
+            element-loading-text="拼命加载中"
+            :data="tableData"
+            border
+            style="width: 100%"
+            @selection-change="selectChange"
+          >
+            <el-table-column type="selection" width="55"></el-table-column>
+            <el-table-column label="课程名称" width="150">
+              <template slot-scope="scope">
+                <div>
+                  <span>{{ scope.row.course.name }}</span>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="课程代码" width="120">
+              <template slot-scope="scope">
+                <div>
+                  <span>{{ scope.row.course.code }}</span>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="试卷名称" width="150">
+              <template slot-scope="scope">
+                <div>
+                  <span>{{ scope.row.name }}</span>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="试卷总分" width="100">
+              <template slot-scope="scope">
+                <div>
+                  <span>{{ scope.row.totalScore }}</span>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="试卷难度" width="100">
+              <template slot-scope="scope">
+                <div>
+                  <span>{{ scope.row.difficultyDegree }}</span>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="大题数量" width="100">
+              <template slot-scope="scope">
+                <div>
+                  <span>{{ scope.row.paperDetailCount }}</span>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="录入员" width="100">
+              <template slot-scope="scope">
+                <div>
+                  <span>{{ scope.row.creator }}</span>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="创建时间" width="120">
+              <template slot-scope="scope">
+                <div>
+                  <span>{{ scope.row.createTime }}</span>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="最后修改人" width="120">
+              <template slot-scope="scope">
+                <div>
+                  <span>{{ scope.row.lastModifyName }}</span>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="操作" width="330">
+              <template slot-scope="scope">
+                <div>
+                  <el-button
+                    @click="openExportDialog(scope.row);"
+                    type="success"
+                    size="mini"
+                    >导出</el-button
+                  >
+                  <el-button
+                    @click="editGenPaper(scope.row);"
+                    type="info"
+                    size="mini"
+                    >编辑</el-button
+                  >
+                  <el-button
+                    @click="deleteGenPaper(scope.row);"
+                    type="danger"
+                    size="mini"
+                    >删除</el-button
+                  >
+                  <el-button
+                    @click="previewPDF2(scope.row);"
+                    type="warning"
+                    size="mini"
+                    >预览PDF</el-button
+                  >
+                  <el-button
+                    @click="openPrint(scope.row);"
+                    type="warning"
+                    size="mini"
+                    >传至印刷</el-button
+                  >
+                </div>
+              </template>
+            </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>
+      <el-dialog title="导出" v-model="exportDialog">
+        <el-form :model="exportModel" label-position="right" label-width="80px">
+          <el-row v-if="isShow">
+            <el-col :md="12">
+              <el-form-item label="课程名称">
+                {{ exportModel.courseName }}
+              </el-form-item>
+            </el-col>
+          </el-row>
+          <el-row v-if="isShow">
+            <el-col :md="12">
+              <el-form-item label="课程代码">
+                {{ exportModel.courseCode }}
+              </el-form-item>
+            </el-col>
+          </el-row>
+          <el-row>
+            <el-col :md="24">
+              <el-form-item label="导出内容">
+                <el-checkbox-group v-model="exportModel.exportContentList">
+                  <el-checkbox label="PAPER">试卷</el-checkbox>
+                  <el-checkbox label="ANSWER">答案</el-checkbox>
+                  <el-checkbox label="COMPUTERTEST_PACKAGE"
+                    >机考数据包</el-checkbox
+                  >
+                  <el-checkbox
+                    v-if="isShowPrintExamPackage"
+                    label="PRINT_EXAM_PACKAGE"
+                    >分布式印刷数据包
+                  </el-checkbox>
+                  <el-input
+                    v-if="isShowPrintExamPackagePassword"
+                    v-model="printExamPackagePassword"
+                    placeholder="加密密码 (可选)"
+                    type="password"
+                    style="width: 150px"
+                  ></el-input>
+                </el-checkbox-group>
+              </el-form-item>
+            </el-col>
+          </el-row>
+          <el-row>
+            <el-col :md="24" class="text-center">
+              <el-button type="primary" @click="exportPaperInfo"
+                >开始导出</el-button
+              >
+            </el-col>
+          </el-row>
+        </el-form>
+      </el-dialog>
+
+      <el-dialog title="传送印刷平台" v-model="dialogModel">
+        <el-form>
+          <el-row>
+            <el-form-item label="学校名称" label-width="120px">
+              <el-input v-model="this.Org.name" :disabled="true"></el-input>
+            </el-form-item>
+          </el-row>
+          <el-row>
+            <el-form-item label="考试名称" label-width="120px">
+              <el-select
+                v-model="examId"
+                filterable
+                clearable
+                :remote-method="getExams"
+                remote
+                placeholder="请选择"
+              >
+                <el-option
+                  v-for="item in examList"
+                  :label="item.name"
+                  :value="item.id"
+                  :key="item.id"
+                ></el-option>
+              </el-select>
+            </el-form-item>
+          </el-row>
+        </el-form>
+        <div slot="footer" class="dialog-footer">
+          <el-button @click="cancel">取 消</el-button>
+          <el-button type="primary" @click="sendPrint">确 定</el-button>
+        </div>
+      </el-dialog>
+    </section>
+  </div>
+</template>
+
+<script>
+import {
+  CORE_API,
+  EXAM_WORK_API,
+  LEVEL_TYPE,
+  Q_API
+} from "../constants/constants";
+import { mapState } from "vuex";
+export default {
+  data() {
+    return {
+      courseLoading: false,
+      formSearch: {
+        courseNo: "",
+        courseName: "",
+        level: "",
+        name: ""
+      },
+      tableData: [],
+      currentPage: 1,
+      pageSize: 10,
+      total: 0,
+      loading: false,
+      courseList: [],
+      levelList: LEVEL_TYPE,
+      dialogVisible: false,
+      selectedPaperIds: [],
+      fileList: [],
+      uploadAction: "",
+      formUpload: {
+        paperName: ""
+      },
+      uploadData: {},
+      fileLoading: false,
+      exportDialog: false,
+      exportModel: {
+        id: "",
+        courseCode: "",
+        courseName: "",
+        exportContentList: []
+      },
+      isShow: true,
+      examList: [],
+      Org: {},
+      dialogModel: false,
+      examId: "",
+      rowId: "",
+      isShowPrintExamPackage: false,
+      isShowPrintExamPackagePassword: false,
+      printExamPackagePassword: ""
+    };
+  },
+  methods: {
+    searchGenPaper() {
+      this.loading = true;
+      var url = Q_API + "/genPaper/" + this.currentPage + "/" + this.pageSize;
+      this.$http.get(url, { params: this.formSearch }).then(response => {
+        this.tableData = response.data.content;
+        this.total = response.data.totalElements;
+      });
+      this.loading = false;
+    },
+    genPaperDetail() {
+      var courseNo = this.formSearch.courseNo;
+      this.getCourseName(courseNo);
+      var courseName = this.formSearch.courseName;
+      var level = this.formSearch.level;
+      if (!courseNo) {
+        this.$notify({
+          message: "请选择课程",
+          type: "error"
+        });
+      } else {
+        sessionStorage.setItem("gen_paper_courseNo", this.formSearch.courseNo);
+        sessionStorage.setItem("gen_paper_name", this.formSearch.name);
+        sessionStorage.setItem(
+          "gen_paper_specialtyNo",
+          this.formSearch.specialtyNo
+        );
+        sessionStorage.setItem("gen_paper_currentPage", this.currentPage);
+        sessionStorage.setItem("gen_paper_courseName", courseName);
+        this.$router.push({
+          path: "/index/gen_paper_detail/" + courseNo + "/" + level
+        });
+      }
+    },
+    handleCurrentChange(val) {
+      this.currentPage = val;
+      this.searchGenPaper();
+    },
+    getCoursesByKey(query) {
+      this.$http.get(Q_API + "/course?keyword=" + query).then(response => {
+        this.courseList = response.data;
+        this.loading = false;
+      });
+    },
+    getCourseName(courseNo) {
+      for (let course of this.courseList) {
+        if (course.code == courseNo) {
+          this.formSearch.courseName = course.name;
+          this.formSearch.level = course.level;
+          console.log(course.level);
+        }
+      }
+    },
+    exportGenPaper(row) {
+      window.open(
+        Q_API + "/paper/export/" + row.id + "/" + this.user.rootOrgName
+      );
+    },
+    editGenPaper(row) {
+      sessionStorage.setItem("gen_paper_courseNo", this.formSearch.courseNo);
+      sessionStorage.setItem("gen_paper_name", this.formSearch.name);
+      sessionStorage.setItem(
+        "gen_paper_specialtyNo",
+        this.formSearch.specialtyNo
+      );
+      sessionStorage.setItem("gen_paper_currentPage", this.currentPage);
+      this.$router.push({ path: "/edit_paper/" + row.id + "/gen_paper" });
+    },
+    deleteGenPaper(row) {
+      this.$confirm("确认删除试卷吗?", "提示", {
+        type: "warning"
+      }).then(() => {
+        this.loading = true;
+        this.$http.delete(Q_API + "/paper/" + row.id).then(
+          () => {
+            this.$notify({
+              message: "删除成功",
+              type: "success"
+            });
+            this.searchGenPaper();
+          },
+          response => {
+            this.$notify({
+              message: response.data.msg,
+              type: "error"
+            });
+            this.loading = false;
+          }
+        );
+      });
+    },
+    selectChange(row) {
+      this.selectedPaperIds = [];
+      row.forEach(element => {
+        this.selectedPaperIds.push(element.id);
+      });
+    },
+    batchDeleteGenPaper() {
+      var paperIds = this.paperIds;
+      console.log("试卷id:", paperIds);
+      if (this.selectedPaperIds.length != 0) {
+        this.$confirm("确认删除试卷吗?", "提示", {
+          type: "warning"
+        }).then(() => {
+          this.loading = true;
+          this.$http.delete(Q_API + "/paper/" + paperIds).then(
+            () => {
+              this.$notify({
+                message: "删除成功",
+                type: "success"
+              });
+              this.searchGenPaper();
+              this.selectedPaperIds = [];
+            },
+            response => {
+              this.$notify({
+                message: response.data.msg,
+                type: "error"
+              });
+              this.loading = false;
+            }
+          );
+        });
+      } else {
+        this.$notify({
+          message: "请勾选删除的数据",
+          type: "warning"
+        });
+      }
+    },
+    //查询所有课程
+    getCourses(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.data;
+              this.courseLoading = false;
+            });
+        }
+      } else {
+        this.courseList = [];
+      }
+    },
+    //打开导出弹框
+    openExportDialog(row) {
+      this.isShow = true;
+      this.isShow = true;
+      this.exportDialog = true;
+      this.exportModel.id = row.id;
+      this.exportModel.courseCode = row.course.code;
+      this.exportModel.courseName = row.course.name;
+      this.exportModel.exportContentList = [];
+      /* 分布式印刷数据包设置 */
+      this.isShowPrintExamPackage = true;
+      this.isShowPrintExamPackagePassword = false;
+      this.printExamPackagePassword = "";
+    },
+    //打开批量弹出框
+    openBatchExportPaperDialog() {
+      if (this.selectedPaperIds.length != 0) {
+        this.exportDialog = true;
+        this.isShow = false;
+        this.isShow = false;
+        this.exportModel.exportContentList = [];
+      } else {
+        this.$notify({
+          message: "请勾选导出的数据",
+          type: "warning"
+        });
+      }
+      /* 分布式印刷数据包设置 */
+      this.isShowPrintExamPackage = false;
+      this.isShowPrintExamPackagePassword = false;
+      this.printExamPackagePassword = "";
+    },
+    //导出试卷,答案,机考数据包
+    exportPaperInfo() {
+      if (this.exportModel.exportContentList.length == 0) {
+        this.$notify({
+          message: "请选择导出内容",
+          type: "error"
+        });
+        return false;
+      }
+      if (this.printExamPackagePassword.length > 0) {
+        var reg = /^[0-9A-Za-z]{6,12}$/;
+        if (!reg.test(this.printExamPackagePassword)) {
+          this.$notify({
+            message: "加密密码请输入6至12位的数字或字母!",
+            type: "error"
+          });
+          return false;
+        }
+      }
+      var key = this.user.key;
+      var token = this.user.token;
+      if (this.isShow) {
+        console.log("单个导出");
+        window.location.href =
+          Q_API +
+          "/paper/export/" +
+          this.exportModel.id +
+          "/" +
+          this.exportModel.exportContentList +
+          "/" +
+          this.user.rootOrgName +
+          "/" +
+          this.user.displayName +
+          "/onLine" +
+          "?psw=" +
+          this.printExamPackagePassword +
+          "&$key=" +
+          key +
+          "&$token=" +
+          token;
+        this.exportDialog = false;
+      } else {
+        console.log("批量导出");
+        var paperIds = this.paperIds;
+        console.log(paperIds);
+        window.location.href =
+          Q_API +
+          "/paper/batch_export/" +
+          paperIds +
+          "/" +
+          this.exportModel.exportContentList +
+          "/" +
+          this.user.rootOrgName +
+          "/" +
+          this.user.displayName +
+          "/onLine" +
+          "?$key=" +
+          key +
+          "&$token=" +
+          token;
+        this.exportDialog = false;
+        console.log(paperIds);
+      }
+    },
+    removeItem() {
+      sessionStorage.removeItem("gen_paper_courseNo");
+      sessionStorage.removeItem("gen_paper_name");
+      sessionStorage.removeItem("gen_paper_specialtyNo");
+      sessionStorage.removeItem("gen_paper_currentPage");
+    },
+    previewPDF2(row) {
+      window.open(Q_API + "/paper/pdf/" + row.id);
+    },
+    openPrint(row) {
+      this.dialogModel = true;
+      this.examId = "";
+      this.rowId = row.id;
+      console.log("this.examList:", this.examList);
+    },
+    cancel() {
+      this.dialogModel = false;
+    },
+    //传至印刷模块
+    sendPrint() {
+      var orgId = "";
+      for (let exam of this.examList) {
+        if ((exam.id = this.examId)) {
+          orgId = exam.rootOrgId;
+        }
+      }
+      if (orgId != "") {
+        this.$http.get(
+          Q_API + "/sendPrint/" + this.rowId + "/" + this.examId + "/" + orgId
+        );
+        this.$notify({
+          message: "已推送",
+          type: "success"
+        });
+        this.dialogModel = false;
+      }
+    },
+    //查询考试
+    getExams(query) {
+      query = query.trim();
+      this.$http
+        .get(
+          EXAM_WORK_API + "/exam/queryByNameLike?name=" + query + "&enable=true"
+        )
+        .then(response => {
+          this.examList = response.data;
+        });
+    },
+    searchExamList() {
+      //查询所有考试
+      this.$http
+        .get(EXAM_WORK_API + "/exam/queryByNameLike?name=&enable=true")
+        .then(response => {
+          var list = response.data;
+          for (var i = 0; i < list.length; i++) {
+            if (list[i].examType == "TRADITION") {
+              this.examList.push(list[i]);
+            }
+          }
+        });
+    },
+    //根据orgId查询学校名称
+    searchOrgName() {
+      this.$http
+        .get(CORE_API + "/org/rootOrg/" + this.user.rootOrgId)
+        .then(response => {
+          this.Org = response.data;
+        });
+    }
+  },
+  computed: {
+    paperIds() {
+      var paperIds = "";
+      for (let paperId of this.selectedPaperIds) {
+        if (!paperIds) {
+          paperIds += paperId;
+        } else {
+          paperIds += "," + paperId;
+        }
+      }
+      return paperIds;
+    },
+    courseInfoSelect() {
+      var courseList = [];
+      for (let course of this.courseList) {
+        var courseInfo = course.name + "(" + course.code + ")";
+        var courseNo = course.code;
+        var courseName = course.name;
+        courseList.push({
+          courseNo: courseNo,
+          courseInfo: courseInfo,
+          courseName: courseName
+        });
+      }
+      return courseList;
+    },
+    ...mapState({ user: state => state.user })
+  },
+  created() {
+    this.isClear = this.$route.params.isClear;
+    if (this.isClear == 0 || !this.isClear) {
+      this.removeItem();
+    } else {
+      this.formSearch.courseNo =
+        sessionStorage.getItem("gen_paper_courseNo") == "null"
+          ? ""
+          : sessionStorage.getItem("gen_paper_courseNo");
+      this.formSearch.specialtyNo =
+        sessionStorage.getItem("gen_paper_specialtyNo") == "null"
+          ? ""
+          : sessionStorage.getItem("gen_paper_specialtyNo");
+      this.formSearch.name =
+        sessionStorage.getItem("gen_paper_name") == "null"
+          ? ""
+          : sessionStorage.getItem("gen_paper_name");
+      this.currentPage =
+        sessionStorage.getItem("gen_paper_currentPage") == null
+          ? 1
+          : parseInt(sessionStorage.getItem("gen_paper_currentPage"));
+    }
+    this.searchGenPaper();
+    this.searchExamList();
+    this.searchOrgName();
+  }
+};
+</script>

+ 769 - 0
src/modules/questions/views/ImportPaper.vue

@@ -0,0 +1,769 @@
+<template>
+  <div>
+    <section class="content">
+      <div class="box box-info">
+        <div class="box-header with-border">
+          <h3 class="box-title">导入试卷管理</h3>
+          <div class="box-tools pull-right">
+            <el-button
+              size="small"
+              type="warning"
+              @click="exportQuesType"
+              :disabled="isDisabled"
+              >试题分布</el-button
+            >
+            <el-button
+              size="small"
+              type="warning"
+              @click="openQuesPropertyByPaper"
+              :disabled="isDisabled2"
+              >试卷属性</el-button
+            >
+            <el-button
+              size="small"
+              type="warning"
+              @click="openQuesPropertyByCourse"
+              :disabled="isDisabled"
+              >课程属性</el-button
+            >
+          </div>
+        </div>
+        <div class="box-body">
+          <el-form
+            :inline="true"
+            :model="formSearch"
+            label-position="right"
+            label-width="110px"
+          >
+            <el-form-item label="课程名称" class="pull-left">
+              <el-select
+                v-model="formSearch.courseNo"
+                :remote-method="getCourses"
+                :loading="courseLoading"
+                remote
+                filterable
+                clearable
+                placeholder="全部"
+              >
+                <el-option
+                  v-for="item in courseInfoSelect"
+                  :label="item.courseInfo"
+                  :value="item.courseNo"
+                  :key="item.courseNo"
+                >
+                </el-option>
+              </el-select>
+            </el-form-item>
+            <el-form-item label="试卷名称" class="pull-left">
+              <el-input
+                v-model="formSearch.name"
+                placeholder="试卷名称"
+              ></el-input>
+            </el-form-item>
+            <el-form-item label="层次" class="pull-left">
+              <el-select v-model="formSearch.level">
+                <el-option label="请选择" value=""></el-option>
+                <el-option
+                  v-for="item in levelList"
+                  :label="item.label"
+                  :value="item.value"
+                  :key="item.value"
+                >
+                </el-option>
+              </el-select>
+            </el-form-item>
+            <el-form-item class="pull-right">
+              <el-button
+                size="small"
+                type="primary"
+                icon="search"
+                @click="searchImportPaper"
+                >查询</el-button
+              >
+              <el-button
+                size="small"
+                type="primary"
+                icon="share"
+                @click="useBasePaper"
+                >使用原卷</el-button
+              >
+              <el-button
+                size="small"
+                type="primary"
+                icon="upload2"
+                @click="impPaper"
+                >导入试卷</el-button
+              >
+              <el-button
+                size="small"
+                type="danger"
+                icon="delete"
+                @click="batchDeleteImportPaper"
+                >批量删除</el-button
+              >
+            </el-form-item>
+          </el-form>
+          <el-table
+            v-loading="loading"
+            element-loading-text="拼命加载中"
+            :data="tableData"
+            border
+            style="width: 100%"
+            @selection-change="selectChange"
+          >
+            <el-table-column type="selection" width="55"></el-table-column>
+            <el-table-column label="课程名称" width="180">
+              <template slot-scope="scope">
+                <div>
+                  <span>{{ scope.row.course.name }}</span>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="课程代码" width="120">
+              <template slot-scope="scope">
+                <div>
+                  <span>{{ scope.row.course.code }}</span>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="试卷名称" width="140">
+              <template slot-scope="scope">
+                <div>
+                  <span>{{ scope.row.name }}</span>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="试卷总分" width="100">
+              <template slot-scope="scope">
+                <div>
+                  <span>{{ scope.row.totalScore }}</span>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="试卷难度" width="100">
+              <template slot-scope="scope">
+                <div>
+                  <span>{{ scope.row.difficultyDegree }}</span>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="大题数量" width="100">
+              <template slot-scope="scope">
+                <div>
+                  <span>{{ scope.row.paperDetailCount }}</span>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="录入员" width="100">
+              <template slot-scope="scope">
+                <div>
+                  <span>{{ scope.row.creator }}</span>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="创建时间" width="120">
+              <template slot-scope="scope">
+                <div>
+                  <span>{{ scope.row.createTime }}</span>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="最后修改人" width="80">
+              <template slot-scope="scope">
+                <div>
+                  <span>{{ scope.row.lastModifyName }}</span>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="操作" width="220">
+              <template slot-scope="scope">
+                <div>
+                  <el-button
+                    @click="copyImportPaper(scope.row);"
+                    type="warning"
+                    size="mini"
+                    >复制</el-button
+                  >
+                  <el-button
+                    @click="editImportPaper(scope.row);"
+                    type="info"
+                    size="mini"
+                    >编辑</el-button
+                  >
+                  <el-button
+                    @click="deleteImportPaper(scope.row);"
+                    type="danger"
+                    size="mini"
+                    >删除</el-button
+                  >
+                  <el-button
+                    @click="exportOriginalPaper(scope.row);"
+                    type="success"
+                    size="mini"
+                    >导出</el-button
+                  >
+                </div>
+              </template>
+            </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>
+        <el-dialog
+          title="克隆试卷"
+          :visible.sync="copyPaperDialog"
+          v-loading.body="cloneLoading"
+        >
+          <el-form :model="copyPaperForm">
+            <el-row>
+              <el-form-item label="试卷名称">
+                <el-input
+                  v-model="copyPaperForm.paperName"
+                  style="width: 220px;"
+                  placeholder="请输试卷名称"
+                  @change="showTitle();"
+                ></el-input>
+                <span style="color: red;" v-show="showName">请输试卷名称</span>
+              </el-form-item>
+            </el-row>
+            <el-row>
+              <el-form-item label="课程名称">
+                <el-select
+                  v-model="copyPaperForm.courseNo"
+                  @change="showTitle();"
+                  :remote-method="getCourses"
+                  :loading="courseLoading"
+                  remote
+                  filterable
+                  clearable
+                  placeholder="全部"
+                >
+                  <el-option
+                    v-for="item in courseInfoSelect"
+                    :label="item.courseInfo"
+                    :value="item.courseNo"
+                    :key="item.courseNo"
+                  >
+                  </el-option>
+                </el-select>
+                <span style="color: red;" v-show="showCourseNo"
+                  >请选择课程名称</span
+                >
+              </el-form-item>
+            </el-row>
+          </el-form>
+          <div slot="footer" class="dialog-footer">
+            <el-button @click="closeCopy();">取 消</el-button>
+            <el-button type="primary" @click="submitCopy();">确 定</el-button>
+          </div>
+        </el-dialog>
+        <el-dialog title="属性修改" :visible.sync="quesPropertyDialog">
+          <el-form :loading="quesLoading">
+            <el-row>
+              <el-form-item label="难  度">
+                <el-select v-model="difficultyDegree">
+                  <el-option
+                    v-for="item in difficultyDegreeList"
+                    :label="item.label"
+                    :value="item.value"
+                    :key="item.value"
+                  ></el-option>
+                </el-select>
+              </el-form-item>
+            </el-row>
+            <el-row>
+              <el-form-item label="公开度">
+                <el-select v-model="publicity">
+                  <el-option
+                    v-for="item in publicityList"
+                    :label="item.label"
+                    :value="item.value"
+                    :key="item.value"
+                  ></el-option>
+                </el-select>
+              </el-form-item>
+            </el-row>
+          </el-form>
+          <div slot="footer" class="dialog-footer">
+            <el-button @click="closePropertyDialog();">取 消</el-button>
+            <el-button
+              type="primary"
+              @click="submitUpdate();"
+              v-loading.fullscreen.lock="quesLoading"
+              >确 定</el-button
+            >
+          </div>
+        </el-dialog>
+      </div>
+    </section>
+  </div>
+</template>
+
+<script>
+import {
+  CORE_API,
+  Q_API,
+  LEVEL_TYPE,
+  PUBLICITY_LIST
+} from "../constants/constants";
+import { mapState } from "vuex";
+export default {
+  data() {
+    return {
+      courseLoading: false,
+      quesLoading: false,
+      formSearch: {
+        courseNo: null,
+        specialtyNo: null,
+        level: "",
+        name: ""
+      },
+      tableData: [],
+      levelList: LEVEL_TYPE,
+      currentPage: 1,
+      pageSize: 10,
+      isClear: 0,
+      total: 0,
+      loading: false,
+      courseList: [],
+      options: [],
+      selectedPaperIds: [],
+      cloneLoading: false,
+      copyPaperDialog: false,
+      copyPaperForm: {
+        paperName: "",
+        courseNo: null
+      },
+      copyPaperId: "",
+      quesPropertyDialog: false,
+      showName: false,
+      showCourseNo: false,
+      difficultyDegree: 0.1,
+      publicity: true,
+      updateType: "",
+      difficultyDegreeList: [
+        { label: 0.1, value: 0.1 },
+        { label: 0.2, value: 0.2 },
+        { label: 0.3, value: 0.3 },
+        { label: 0.4, value: 0.4 },
+        { label: 0.5, value: 0.5 },
+        { label: 0.6, value: 0.6 },
+        { label: 0.7, value: 0.7 },
+        { label: 0.8, value: 0.8 },
+        { label: 0.9, value: 0.9 },
+        { label: 1.0, value: 1.0 }
+      ],
+      publicityList: PUBLICITY_LIST
+    };
+  },
+  methods: {
+    searchImportPaper() {
+      this.loading = true;
+      var url =
+        Q_API + "/importPaper/" + this.currentPage + "/" + this.pageSize;
+      this.$http.get(url, { params: this.formSearch }).then(response => {
+        this.tableData = response.data.content;
+        this.total = response.data.totalElements;
+        this.loading = false;
+      });
+    },
+    handleCurrentChange(val) {
+      this.currentPage = val;
+      this.searchImportPaper();
+    },
+    editImportPaper(row) {
+      sessionStorage.setItem("import_paper_courseNo", this.formSearch.courseNo);
+      sessionStorage.setItem(
+        "import_paper_specialtyNo",
+        this.formSearch.specialtyNo
+      );
+      sessionStorage.setItem("import_paper_currentPage", this.currentPage);
+      this.$router.push({ path: "/edit_paper/" + row.id + "/import_paper" });
+    },
+    deleteImportPaper(row) {
+      this.$confirm("确认删除试卷吗?", "提示", {
+        type: "warning"
+      }).then(() => {
+        this.loading = true;
+        this.$http.delete(Q_API + "/paper/" + row.id).then(
+          () => {
+            this.$notify({
+              message: "删除成功",
+              type: "success"
+            });
+            this.searchImportPaper();
+          },
+          error => {
+            this.$notify({
+              message: error.data.msg,
+              type: "error"
+            });
+            this.loading = false;
+          }
+        );
+      });
+    },
+    selectChange(row) {
+      this.selectedPaperIds = [];
+      row.forEach(element => {
+        this.selectedPaperIds.push(element.id);
+      });
+    },
+    batchDeleteImportPaper() {
+      var paperIds = this.paperIds;
+      if (this.selectedPaperIds.length != 0) {
+        this.$confirm("确认删除试卷吗?", "提示", {
+          type: "warning"
+        }).then(() => {
+          this.loading = true;
+          this.$http.delete(Q_API + "/paper/" + paperIds).then(
+            () => {
+              this.$notify({
+                message: "删除成功",
+                type: "success"
+              });
+              this.searchImportPaper();
+              this.selectedPaperIds = [];
+            },
+            error => {
+              this.$notify({
+                message: error.data.msg,
+                type: "error"
+              });
+              this.loading = false;
+            }
+          );
+        });
+      } else {
+        this.$notify({
+          message: "请勾选删除的数据",
+          type: "warning"
+        });
+      }
+    },
+    //导入试卷
+    impPaper() {
+      console.log("导入试卷新页面!");
+      this.$router.push({
+        path: "/index/imp_paper"
+      });
+    },
+    //查询所有课程
+    getCourses(query) {
+      console.log("查询课程!");
+      if (query) {
+        this.courseLoading = true;
+        this.$http
+          .get(CORE_API + "/course/query?name=" + query + "&enable=true")
+          .then(response => {
+            this.courseList = response.data;
+            this.courseLoading = false;
+          });
+      } else {
+        this.courseList = [];
+      }
+    },
+    useBasePaper() {
+      if (this.selectedPaperIds.length == 0) {
+        this.$notify({
+          message: "请勾选使用的试卷",
+          type: "warning"
+        });
+      } else {
+        this.loading = true;
+        this.$http.put(Q_API + "/useBasePaper/" + this.selectedPaperIds).then(
+          response => {
+            console.log("come in response:", response);
+            if (!response.data.desc) {
+              this.$notify({
+                message: "操作成功",
+                type: "success"
+              });
+            } else {
+              this.$notify({
+                message: response.data.desc,
+                type: "error"
+              });
+            }
+            this.loading = false;
+          },
+          error => {
+            console.log("com in error:", error.body);
+            var message = error.body.desc;
+            var err = message
+              .replace("[", "")
+              .replace("]", "")
+              .substring(message.indexOf("desc") + 4);
+            this.$notify({
+              message: err,
+              type: "error"
+            });
+            this.loading = false;
+          }
+        );
+      }
+    },
+    //克隆试卷
+    copyImportPaper(row) {
+      this.showName = false;
+      this.showCourseNo = false;
+      this.copyPaperForm.paperName = "";
+      this.copyPaperForm.courseNo = null;
+      this.copyPaperId = row.id;
+      this.copyPaperDialog = true;
+    },
+    //取消
+    closeCopy() {
+      this.copyPaperDialog = false;
+    },
+    //确定
+    submitCopy() {
+      if (!this.copyPaperForm.paperName && !this.copyPaperForm.courseNo) {
+        this.showName = true;
+        this.showCourseNo = true;
+        return;
+      }
+      if (!this.copyPaperForm.paperName) {
+        this.showName = true;
+        return;
+      }
+      if (!this.copyPaperForm.courseNo) {
+        this.showCourseNo = true;
+        return;
+      }
+      this.cloneLoading = true;
+      this.$http
+        .post(
+          Q_API +
+            "/clonePaper/" +
+            this.copyPaperId +
+            "/" +
+            this.copyPaperForm.paperName +
+            "/" +
+            this.copyPaperForm.courseNo
+        )
+        .then(() => {
+          this.$notify({
+            message: "复制成功",
+            type: "success"
+          });
+          this.cloneLoading = false;
+          this.copyPaperDialog = false;
+          this.searchImportPaper();
+        })
+        .catch(() => {
+          this.$notify({
+            type: "error",
+            message: "试卷名称重复,请重新命名"
+          });
+          this.cloneLoading = false;
+        });
+    },
+    showTitle() {
+      if (!this.copyPaperForm.paperName) {
+        this.showName = true;
+      }
+      if (this.copyPaperForm.paperName) {
+        this.showName = false;
+      }
+      if (!this.copyPaperForm.courseNo) {
+        this.showCourseNo = true;
+      }
+      if (this.copyPaperForm.courseNo) {
+        this.showCourseNo = false;
+      }
+    },
+    removeItem() {
+      sessionStorage.removeItem("import_paper_courseNo");
+      sessionStorage.removeItem("import_paper_specialtyNo");
+      sessionStorage.removeItem("import_paper_currentPage");
+    },
+    exportQuesType() {
+      var key = this.user.key;
+      var token = this.user.token;
+      window.location.href =
+        Q_API +
+        "/paper/export/course/question/" +
+        this.formSearch.courseNo +
+        "?$key=" +
+        key +
+        "&$token=" +
+        token;
+    },
+    exportOriginalPaper(row) {
+      var key = this.user.key;
+      var token = this.user.token;
+      //window.location.href = Q_API+"/originalPaper/export/"+row.id+"/"+ this.user.displayName;
+      window.open(
+        Q_API +
+          "/originalPaper/export/" +
+          row.id +
+          "/" +
+          this.user.displayName +
+          "?$key=" +
+          key +
+          "&$token=" +
+          token
+      );
+    },
+    openInit() {
+      this.difficultyDegree = 0.1;
+      this.publicity = true;
+      this.quesPropertyDialog = true;
+    },
+    //试卷修改属性 openQuesPropertyByPaper,openQuesPropertyByCourse
+    openQuesPropertyByPaper() {
+      this.updateType = "paper";
+      this.openInit();
+    },
+    //课程修改属性
+    openQuesPropertyByCourse() {
+      this.updateType = "course";
+      this.openInit();
+    },
+    closePropertyDialog() {
+      this.quesPropertyDialog = false;
+    },
+    submitUpdate() {
+      console.log("aaa");
+      if (this.updateType == "paper") {
+        console.log("paper");
+        this.updateQuesPropertyByPaper();
+      }
+      if (this.updateType == "course") {
+        console.log("course");
+        this.updateQuesPropertyByCourse();
+      }
+    },
+    updateQuesPropertyByPaper() {
+      this.quesLoading = true;
+      this.$http
+        .put(
+          Q_API +
+            "/question/updatePro/paperIds/" +
+            this.selectedPaperIds +
+            "/" +
+            this.difficultyDegree +
+            "/" +
+            this.publicity
+        )
+        .then(() => {
+          this.$notify({
+            message: "更新成功",
+            type: "success"
+          });
+          this.searchImportPaper();
+          this.quesLoading = false;
+          this.closePropertyDialog();
+        })
+        .catch(() => {
+          this.$notify({
+            type: "error",
+            message: "更新失败"
+          });
+          this.quesLoading = false;
+          this.closePropertyDialog();
+        });
+    },
+    updateQuesPropertyByCourse() {
+      this.quesLoading = true;
+      var orgId = this.user.rootOrgId;
+      this.$http
+        .put(
+          Q_API +
+            "/question/updatePro/courseCode/" +
+            this.formSearch.courseNo +
+            "/" +
+            this.difficultyDegree +
+            "/" +
+            this.publicity +
+            "/" +
+            orgId
+        )
+        .then(() => {
+          this.$notify({
+            message: "更新成功",
+            type: "success"
+          });
+          this.quesLoading = false;
+          this.closePropertyDialog();
+        })
+        .catch(() => {
+          this.$notify({
+            type: "error",
+            message: "更新失败"
+          });
+          this.quesLoading = false;
+          this.closePropertyDialog();
+        });
+    }
+  },
+  computed: {
+    paperIds() {
+      var paperIds = "";
+      for (let paperId of this.selectedPaperIds) {
+        if (!paperIds) {
+          paperIds += paperId;
+        } else {
+          paperIds += "," + paperId;
+        }
+      }
+      return paperIds;
+    },
+    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;
+    },
+    isDisabled() {
+      if (this.formSearch.courseNo) {
+        return false;
+      }
+      return true;
+    },
+    isDisabled2() {
+      if (this.selectedPaperIds && this.selectedPaperIds.length > 0) {
+        return false;
+      }
+      return true;
+    },
+    ...mapState({ user: state => state.user })
+  },
+  created() {
+    this.isClear = this.$route.params.isClear;
+    if (this.isClear == 0 || !this.isClear) {
+      this.removeItem();
+    } else {
+      console.log(
+        "sessionStorage.getItem('import_paper_specialtyNo'):",
+        sessionStorage.getItem("import_paper_specialtyNo")
+      );
+      this.formSearch.courseNo =
+        sessionStorage.getItem("import_paper_courseNo") == "null"
+          ? ""
+          : sessionStorage.getItem("import_paper_courseNo");
+      this.formSearch.specialtyNo =
+        sessionStorage.getItem("import_paper_specialtyNo") == "null"
+          ? ""
+          : sessionStorage.getItem("import_paper_specialtyNo");
+      this.currentPage =
+        sessionStorage.getItem("import_paper_currentPage") == null
+          ? 1
+          : parseInt(sessionStorage.getItem("import_paper_currentPage"));
+    }
+    this.searchImportPaper();
+  }
+};
+</script>

+ 455 - 0
src/modules/questions/views/PropertyInfo.vue

@@ -0,0 +1,455 @@
+<template>
+  <div>
+    <section class="content">
+      <div class="box box-info">
+        <!-- 头信息 -->
+        <div class="box-header with-border">
+          <h3 class="box-title">属性结构</h3>
+        </div>
+        <!-- 正文信息 -->
+        <div class="box-body">
+          <el-form
+            :inline="true"
+            :model="courseProperty"
+            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="courseProperty.name"
+                    :disabled="true"
+                  ></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="courseProperty.courseId"
+                    class="form_width"
+                    filterable
+                    :remote-method="getCourses"
+                    remote
+                    clearable
+                    :disabled="true"
+                  >
+                    <el-option
+                      v-for="item in courseInfoSelect"
+                      :label="item.courseInfo"
+                      :value="item.courseId"
+                      :key="item.courseId"
+                    >
+                    </el-option>
+                  </el-select>
+                </el-form-item>
+              </el-col>
+            </el-row>
+            <el-row :xs="7" :sm="7" :md="7" :lg="8">
+              <div style="margin-left: 20px;">
+                <el-form-item>
+                  <el-button type="info" @click="insertParent"
+                    >新增一级</el-button
+                  >
+                </el-form-item>
+                <el-button
+                  type="info"
+                  @click="insertSon"
+                  :disabled="showSonButtton"
+                  >新增二级</el-button
+                >
+                <el-button
+                  type="warning"
+                  @click="updateProperty"
+                  :disabled="showButton"
+                  >修改</el-button
+                >
+                <el-button
+                  type="danger"
+                  @click="deleteProperty"
+                  :disabled="showButton"
+                  >删除</el-button
+                >
+                <el-button
+                  type="info"
+                  @click="moveUp"
+                  :disabled="showMoveButtton"
+                  >上移</el-button
+                >
+                <el-button
+                  type="info"
+                  @click="moveDown"
+                  :disabled="showMoveButtton"
+                  >下移</el-button
+                >
+                <el-button type="primary" icon="caret-left" @click="back"
+                  >返 回</el-button
+                >
+              </div>
+            </el-row>
+          </el-form>
+
+          <el-tree
+            :data="data"
+            node-key="id"
+            :props="defaultProps"
+            :default-expanded-keys="ids"
+            @node-click="handleNodeClick"
+          ></el-tree>
+        </div>
+        <el-dialog :title="title" :visible.sync="propertyDialog">
+          <el-form :model="propertyForm">
+            <el-row v-show="parentName">
+              <el-form-item label="一级名称">
+                <el-input
+                  v-model="propertyForm.parentName"
+                  auto-complete="off"
+                  style="width: 220px;"
+                  @change="showTitle"
+                ></el-input>
+                <span style="color: red;" v-show="showParentName"
+                  >请输一级名称</span
+                >
+              </el-form-item>
+            </el-row>
+            <el-row v-show="sonName">
+              <el-form-item label="二级名称">
+                <el-input
+                  v-model="propertyForm.sonName"
+                  auto-complete="off"
+                  style="width: 220px;"
+                  @change="showTitle"
+                ></el-input>
+                <span style="color: red;" v-show="showSonName"
+                  >请输二级名称</span
+                >
+              </el-form-item>
+            </el-row>
+            <el-row>
+              <el-form-item label="名称备注">
+                <el-input
+                  v-model="propertyForm.remark"
+                  auto-complete="off"
+                  style="width: 220px;"
+                  @change="showTitle"
+                ></el-input>
+              </el-form-item>
+            </el-row>
+          </el-form>
+          <div slot="footer" class="dialog-footer">
+            <el-button @click="propertyDialog = false;">取 消</el-button>
+            <el-button type="primary" @click="submit">确 定</el-button>
+          </div>
+        </el-dialog>
+      </div>
+    </section>
+  </div>
+</template>
+
+<script>
+import { CORE_API, Q_API } from "../constants/constants";
+export default {
+  data() {
+    return {
+      courseProperty: {
+        name: "",
+        courseId: ""
+      },
+      courseList: [],
+      ids: [],
+      loading: false,
+      parentName: false,
+      sonName: false,
+      propertyDialog: false,
+      propertyForm: {
+        parentName: "",
+        sonName: "",
+        remark: ""
+      },
+      property: {
+        id: "",
+        name: "",
+        parentId: "",
+        number: "",
+        coursePropertyId: "",
+        remark: ""
+      },
+      showButton: true,
+      showSonButtton: true,
+      showParentName: false,
+      showSonName: false,
+      data: [],
+      defaultProps: {
+        children: "propertyDtos",
+        label: "name"
+      },
+      title: "新增属性",
+      showMoveButtton: true
+    };
+  },
+  methods: {
+    //树形节点选中
+    handleNodeClick(object) {
+      //得到选中的节点
+      console.log(object);
+      this.showButton = false;
+      //判断选中节点,如果是父节点,可以新增二级
+      if (object.parentId === 0) {
+        this.showSonButtton = false;
+        this.showMoveButtton = false;
+      } else {
+        this.showSonButtton = true;
+        this.showMoveButtton = true;
+      }
+      this.property.id = object.id;
+      this.property.name = object.name;
+      this.property.parentId = object.parentId;
+      this.property.number = object.number;
+      this.property.coursePropertyId = object.coursePropertyId;
+      this.property.remark = object.remark;
+    },
+    //查询所有课程
+    getCourses(query) {
+      this.courseList = [];
+      if (query) {
+        this.courseLoading = true;
+        this.$http.get(CORE_API + "/course/" + query).then(response => {
+          var courseBean = response.data;
+          this.courseList.push(courseBean);
+        });
+      } else {
+        this.courseList = [];
+      }
+    },
+    //查询
+    searchProperty() {
+      this.loading = true;
+      var coursePropertyStorge = sessionStorage.getItem("courseProperty");
+      if (typeof coursePropertyStorge == "string") {
+        this.courseProperty = JSON.parse(coursePropertyStorge);
+        this.getCourses(this.courseProperty.courseId);
+      }
+      this.$http
+        .get(Q_API + "/property/all/" + this.coursePropertyId)
+        .then(response => {
+          this.data = response.data;
+          for (var i = 0; i < this.data.length; i++) {
+            var property = this.data[i];
+            this.ids.push(property.id);
+          }
+          this.loading = false;
+        });
+    },
+    //新增一级
+    insertParent() {
+      this.title = "新增属性";
+      this.showParentName = false;
+      this.property = {
+        id: "",
+        name: "",
+        parentId: 0,
+        number: "",
+        coursePropertyId: this.coursePropertyId,
+        remark: ""
+      };
+      this.propertyForm.parentName = "";
+      this.propertyForm.remark = "";
+      this.sonName = false;
+      this.parentName = true;
+      this.propertyDialog = true;
+    },
+    //新增二级
+    insertSon() {
+      this.title = "新增属性";
+      this.showSonName = false;
+      //父对象id赋值
+      this.property.parentId = this.property.id;
+      this.property.id = "";
+      this.property.name = "";
+      this.property.remark = "";
+      this.property.coursePropertyId = this.coursePropertyId;
+      this.propertyForm.sonName = "";
+      this.propertyForm.remark = "";
+      this.parentName = false;
+      this.sonName = true;
+      this.propertyDialog = true;
+    },
+    //修改
+    updateProperty() {
+      this.title = "修改属性";
+      //判断是父节点还是子节点
+      if (this.property.parentId === 0) {
+        this.propertyForm.parentName = this.property.name;
+        this.propertyForm.remark = this.property.remark;
+        this.sonName = false;
+        this.parentName = true;
+      } else {
+        this.propertyForm.sonName = this.property.name;
+        this.propertyForm.remark = this.property.remark;
+        this.parentName = false;
+        this.sonName = true;
+      }
+      this.propertyDialog = true;
+    },
+    //保存
+    submit() {
+      if (this.property.parentId === 0) {
+        //非空判断
+        if (!this.propertyForm.parentName) {
+          this.showParentName = true;
+          return 0;
+        }
+        this.property.name = this.propertyForm.parentName;
+      } else {
+        //非空判断
+        if (!this.propertyForm.sonName) {
+          this.showSonName = true;
+          return 0;
+        }
+        this.property.name = this.propertyForm.sonName;
+      }
+      this.property.remark = this.propertyForm.remark;
+      if (this.property.id) {
+        this.$http
+          .put(Q_API + "/property/save", this.property)
+          .then(() => {
+            this.$notify({
+              message: "修改成功",
+              type: "success"
+            });
+            this.propertyDialog = false;
+            this.searchProperty();
+          })
+          .catch(() => {
+            this.$notify({
+              type: "error",
+              message: "名称重复,请重新命名"
+            });
+          });
+      } else {
+        this.$http
+          .post(Q_API + "/property/save", this.property)
+          .then(() => {
+            this.$notify({
+              message: "新增成功",
+              type: "success"
+            });
+            this.propertyDialog = false;
+            this.searchProperty();
+          })
+          .catch(() => {
+            this.$notify({
+              type: "error",
+              message: "名称重复,请重新命名"
+            });
+          });
+      }
+      this.showButton = true;
+      this.showSonButtton = true;
+    },
+    //删除
+    deleteProperty() {
+      this.$confirm("确认删除试卷吗?", "提示", {
+        type: "warning"
+      }).then(() => {
+        this.loading = true;
+        this.$http
+          .delete(
+            Q_API +
+              "/property/delete/" +
+              this.property.id +
+              "/" +
+              this.property.coursePropertyId
+          )
+          .then(() => {
+            this.$notify({
+              message: "删除成功",
+              type: "success"
+            });
+            this.searchProperty();
+          })
+          .catch(() => {
+            this.$notify({
+              type: "error",
+              message: "删除失败"
+            });
+          });
+      });
+      this.showButton = true;
+      this.showSonButtton = true;
+    },
+    //效验
+    showTitle() {
+      if (this.propertyForm.parentName) {
+        this.showParentName = false;
+      }
+      if (!this.propertyForm.parentName) {
+        this.showParentName = true;
+      }
+      if (this.propertyForm.sonName) {
+        this.showSonName = false;
+      }
+      if (!this.propertyForm.sonName) {
+        this.showSonName = true;
+      }
+    },
+    //返回
+    back() {
+      this.$router.push({
+        path: "/questions/course_property/1"
+      });
+    },
+    //上移
+    moveUp() {
+      this.$http
+        .put(Q_API + "/property/moveUp", this.property)
+        .then(() => {
+          this.searchProperty();
+          this.showMoveButtton = true;
+        })
+        .catch(() => {
+          this.$notify({
+            type: "error",
+            message: "无法上移"
+          });
+          this.showMoveButtton = true;
+        });
+    },
+    //下移
+    moveDown() {
+      this.$http
+        .put(Q_API + "/property/moveDown", this.property)
+        .then(() => {
+          this.searchProperty();
+          this.showMoveButtton = true;
+        })
+        .catch(() => {
+          this.$notify({
+            type: "error",
+            message: "无法下移"
+          });
+          this.showMoveButtton = true;
+        });
+    }
+  },
+  computed: {
+    courseInfoSelect() {
+      var courseList = [];
+      for (var i = 0; i < this.courseList.length; i++) {
+        var courseInfo = {
+          courseInfo:
+            this.courseList[i].name + "(" + this.courseList[i].code + ")",
+          courseId: this.courseList[i].id
+        };
+        courseList.push(courseInfo);
+      }
+      return courseList;
+    }
+  },
+  created() {
+    this.coursePropertyId = this.$route.params.id;
+    this.searchProperty();
+  }
+};
+</script>