123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380 |
- <template>
- <section class="content">
- <div v-show="isClear == 1">
- <LinkTitlesCustom :currentPaths="['基础信息', '精确结构预设']" />
- </div>
- <!-- 正文信息 -->
- <div class="box-body">
- <el-form
- :inline="true"
- :model="formSearch"
- label-position="right"
- label-width="90px"
- >
- <el-row>
- <el-col :span="6">
- <el-form-item label="结构名称" class="pull-left">
- <el-input
- class="search_width"
- placeholder="请输入结构名称"
- v-model="formSearch.name"
- size="small"
- ></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="创建人" class="pull-left">
- <el-input
- class="search_width"
- placeholder="请输入创建人"
- v-model="formSearch.creator"
- size="small"
- ></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="制定课程">
- <el-select
- class="search_width"
- v-model="formSearch.courseNo"
- filterable
- :remote-method="getCourses"
- remote
- placeholder="请选择"
- size="small"
- >
- <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-col :span="6">
- <div class="search_down">
- <el-button size="small" type="primary" @click="searchPaperStructs"
- ><i class="el-icon-search"></i> 查询</el-button
- >
- <el-button size="small" @click="resetForm">重 置</el-button>
- <el-button size="small" type="primary" @click="addPaperStruct"
- ><i class="el-icon-plus"></i> 新增</el-button
- >
- </div>
- </el-col>
- </el-row>
- <el-row>
- <el-form-item class="pull-left">
- <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" width="35"></el-table-column>
- <el-table-column label="预设精确结构名称">
- <template slot-scope="scope">
- <span>{{ scope.row.name }}</span>
- </template>
- </el-table-column>
- <el-table-column label="关联课程" width="180">
- <template slot-scope="scope">
- <span>{{ scope.row.courseName }}</span>
- </template>
- </el-table-column>
- <el-table-column label="课程代码" width="90">
- <template slot-scope="scope">
- <span>{{ scope.row.courseNo }}</span>
- </template>
- </el-table-column>
- <el-table-column label="类型" width="80">
- <template slot-scope="scope">
- <span>{{ getType(scope.row.courseNo) }}</span>
- </template>
- </el-table-column>
- <el-table-column label="大题数" width="65">
- <template slot-scope="scope">
- <span>{{ scope.row.detailCount }}</span>
- </template>
- </el-table-column>
- <el-table-column label="小题数" width="65">
- <template slot-scope="scope">
- <span>{{ scope.row.detailUnitCount }}</span>
- </template>
- </el-table-column>
- <el-table-column label="总分" width="55">
- <template slot-scope="scope">
- <span>{{ scope.row.totalScore }}</span>
- </template>
- </el-table-column>
- <el-table-column label="创建人" width="100">
- <template slot-scope="scope">
- <span>{{ scope.row.creator }}</span>
- </template>
- </el-table-column>
- <el-table-column label="操作" width="175">
- <template slot-scope="scope">
- <div class="operate_left">
- <el-button
- size="mini"
- type="primary"
- @click="editPaperStruct(scope.row)"
- ><i class="el-icon-edit"></i>编辑</el-button
- >
- <el-button
- size="mini"
- type="danger"
- @click="deletePaper(scope.$index, scope.row)"
- ><i class="el-icon-delete"></i> 删除</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>
- </section>
- </template>
- <script>
- import { CORE_API, QUESTION_API } from "@/constants/constants";
- import LinkTitlesCustom from "@/components/LinkTitlesCustom.vue";
- export default {
- components: { LinkTitlesCustom },
- 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: {
- //重置
- resetForm() {
- this.formSearch = {
- name: "",
- creator: "",
- courseNo: "ALL"
- };
- },
- //查询
- searchPaperStructs() {
- this.loading = true;
- var url =
- QUESTION_API + "/paperStruct/" + 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;
- },
- //全选
- 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: "/questions/insert_paper_structure/" + row.id
- });
- },
- //删除单条数据
- deletePaper(index, row) {
- this.$confirm("是否删除试卷结构?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- var url = QUESTION_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 = QUESTION_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: "/questions/insert_paper_structure/add"
- });
- },
- //分页跳转
- handleCurrentChange(val) {
- this.currentPage = val;
- this.searchPaperStructs();
- },
- //查询所有课程
- 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 = [];
- }
- },
- getType(val) {
- if (val == "ENSEMBLE") {
- return "宏观结构";
- }
- return "微观结构";
- },
- removeItem() {
- sessionStorage.removeItem("paperStruct");
- },
- initVue() {
- this.isClear = this.$route.params.isClear;
- if (this.isClear == 0 || !this.isClear) {
- sessionStorage.removeItem("paper_stucture");
- sessionStorage.removeItem("paper_stucture_currentPage");
- this.formSearch = {
- name: "",
- creator: "",
- courseNo: "ALL",
- type: "EXACT"
- };
- this.currentPage = 1;
- } else {
- this.formSearch = JSON.parse(sessionStorage.getItem("paper_stucture"));
- this.currentPage = parseInt(
- sessionStorage.getItem("paper_stucture_currentPage")
- );
- }
- this.searchPaperStructs();
- }
- },
- 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;
- }
- },
- watch: {
- $route: "initVue"
- },
- created() {
- this.initVue();
- this.removeItem();
- }
- };
- </script>
- <style scoped src="../styles/Common.css"></style>
|