|
@@ -1,250 +1,250 @@
|
|
|
-<template>
|
|
|
- <Modal
|
|
|
- v-model="modalIsShow"
|
|
|
- class="marker-standard marker-modal"
|
|
|
- title="标准卷"
|
|
|
- footer-hide
|
|
|
- fullscreen
|
|
|
- @on-visible-change="visibleChange"
|
|
|
- >
|
|
|
- <div class="level-list">
|
|
|
- <div
|
|
|
- v-for="(level, index) in levels"
|
|
|
- :key="index"
|
|
|
- :class="['level-item', { 'level-item-act': curLevel === level.name }]"
|
|
|
- @click="setCurLevel(level.name)"
|
|
|
- >
|
|
|
- {{ level.name }}
|
|
|
- </div>
|
|
|
- <div
|
|
|
- :class="['level-item', { 'level-item-act': !curLevel }]"
|
|
|
- @click="setCurLevel('')"
|
|
|
- >
|
|
|
- 全部
|
|
|
- </div>
|
|
|
- </div>
|
|
|
-
|
|
|
- <div class="standard-image-list marker-image-list" v-if="papers.length">
|
|
|
- <div
|
|
|
- v-for="(paper, index) in papers"
|
|
|
- :key="paper.id"
|
|
|
- class="marker-image-item"
|
|
|
- >
|
|
|
- <div class="marker-image-content">
|
|
|
- <marker-image-view :data="paper" @to-review="toReview(index)">
|
|
|
- <div class="image-info">
|
|
|
- <div class="image-level">
|
|
|
- {{ paper.level }}
|
|
|
- </div>
|
|
|
- <div class="image-title">{{ paper.title }}</div>
|
|
|
- </div>
|
|
|
- <div v-if="canEditStandard" class="image-action">
|
|
|
- <Button
|
|
|
- type="error"
|
|
|
- size="small"
|
|
|
- icon="md-trash"
|
|
|
- :disabled="paper.loading"
|
|
|
- @click="cancelPaper(paper)"
|
|
|
- ></Button>
|
|
|
- <Button
|
|
|
- type="primary"
|
|
|
- size="small"
|
|
|
- icon="md-create"
|
|
|
- @click="toChangePaper(paper)"
|
|
|
- ></Button>
|
|
|
- </div>
|
|
|
- </marker-image-view>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div v-else class="standard-image-none">
|
|
|
- <p>暂无数据</p>
|
|
|
- </div>
|
|
|
-
|
|
|
- <!-- change-standard -->
|
|
|
- <Modal
|
|
|
- class="change-standard marker-modal"
|
|
|
- v-model="levelModalIsShow"
|
|
|
- title="修改标准卷"
|
|
|
- width="400px"
|
|
|
- :mask-closable="false"
|
|
|
- >
|
|
|
- <div class="level-list">
|
|
|
- <p
|
|
|
- v-for="level in levels"
|
|
|
- :key="level.name"
|
|
|
- :class="[
|
|
|
- 'level-item',
|
|
|
- {
|
|
|
- 'level-item-act': level.name === curSelectLevel,
|
|
|
- 'level-item-disabled': level.name === curChangePaper.level
|
|
|
- }
|
|
|
- ]"
|
|
|
- @click="selectLevel(level.name)"
|
|
|
- >
|
|
|
- {{ level.name }}
|
|
|
- </p>
|
|
|
- </div>
|
|
|
-
|
|
|
- <div slot="footer">
|
|
|
- <Button
|
|
|
- type="primary"
|
|
|
- size="small"
|
|
|
- :disabled="isSubmit || !curSelectLevel"
|
|
|
- @click="confirmChange"
|
|
|
- >确认</Button
|
|
|
- >
|
|
|
- <Button size="small" @click="cancelChange">取消</Button>
|
|
|
- </div>
|
|
|
- </Modal>
|
|
|
- </Modal>
|
|
|
-</template>
|
|
|
-
|
|
|
-<script>
|
|
|
-import { mapState } from "vuex";
|
|
|
-import { paperList, cancelStandardPaper, leaderGradingPaper } from "@/api";
|
|
|
-import MarkerImageView from "./MarkerImageView";
|
|
|
-
|
|
|
-export default {
|
|
|
- name: "marker-standard",
|
|
|
- props: {
|
|
|
- questionId: {
|
|
|
- type: [Number, String]
|
|
|
- },
|
|
|
- levels: {
|
|
|
- type: Array,
|
|
|
- default() {
|
|
|
- return [];
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- components: { MarkerImageView },
|
|
|
- data() {
|
|
|
- return {
|
|
|
- modalIsShow: false,
|
|
|
- curLevel: "",
|
|
|
- paperList: [],
|
|
|
- papers: [],
|
|
|
- isLoading: false,
|
|
|
- // change standard
|
|
|
- levelModalIsShow: false,
|
|
|
- curChangePaper: {},
|
|
|
- curSelectLevel: null,
|
|
|
- isSubmit: false
|
|
|
- };
|
|
|
- },
|
|
|
- computed: {
|
|
|
- ...mapState("marker", ["IS_MARK_LEADER", "paramsSet"]),
|
|
|
- showStandardPaperManage() {
|
|
|
- return this.paramsSet["showStandardPaperManage"] !== 0;
|
|
|
- },
|
|
|
- canEditStandard() {
|
|
|
- const user = this.$ls.get("user", {});
|
|
|
- return (
|
|
|
- this.IS_MARK_LEADER &&
|
|
|
- this.showStandardPaperManage &&
|
|
|
- user.standardVolume
|
|
|
- );
|
|
|
- }
|
|
|
- },
|
|
|
- methods: {
|
|
|
- async visibleChange(visible) {
|
|
|
- if (!visible) return;
|
|
|
-
|
|
|
- this.getPaperList();
|
|
|
- },
|
|
|
- async getPaperList() {
|
|
|
- this.isLoading = true;
|
|
|
- const datas = {
|
|
|
- questionId: this.questionId,
|
|
|
- level: "",
|
|
|
- sort: "secretNumber",
|
|
|
- isSample: true,
|
|
|
- page: 0,
|
|
|
- size: 1000
|
|
|
- };
|
|
|
- const data = await paperList(datas).catch(() => {});
|
|
|
- this.isLoading = false;
|
|
|
- if (!data) return;
|
|
|
- this.paperList = data.data.map(item => {
|
|
|
- item.title = `NO.${item.sn}`;
|
|
|
- item.loading = false;
|
|
|
- return item;
|
|
|
- });
|
|
|
- this.paperList.sort((a, b) => (a.level < b.level ? -1 : 1));
|
|
|
- this.updatePapers();
|
|
|
- },
|
|
|
- updatePapers() {
|
|
|
- if (this.curLevel) {
|
|
|
- this.papers = this.paperList.filter(
|
|
|
- paper => paper.level === this.curLevel
|
|
|
- );
|
|
|
- } else {
|
|
|
- this.papers = this.paperList;
|
|
|
- }
|
|
|
- },
|
|
|
- setCurLevel(levelName) {
|
|
|
- this.curLevel = levelName;
|
|
|
- this.updatePapers();
|
|
|
- },
|
|
|
- cancel() {
|
|
|
- this.modalIsShow = false;
|
|
|
- },
|
|
|
- open() {
|
|
|
- this.modalIsShow = true;
|
|
|
- },
|
|
|
- toReview(index) {
|
|
|
- this.$emit("on-paper-click", index, this.papers);
|
|
|
- },
|
|
|
- cancelPaper(paper) {
|
|
|
- if (paper.loading) return;
|
|
|
- this.$Modal.confirm({
|
|
|
- content: "确定要取消当前标准卷吗?",
|
|
|
- onOk: async () => {
|
|
|
- paper.loading = true;
|
|
|
- const res = await cancelStandardPaper(paper.id).catch(() => {});
|
|
|
- paper.loading = false;
|
|
|
- if (!res) return;
|
|
|
- this.getPaperList();
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
- // change standard paper
|
|
|
- toChangePaper(paper) {
|
|
|
- this.curChangePaper = paper;
|
|
|
- this.levelModalIsShow = true;
|
|
|
- },
|
|
|
- selectLevel(levelName) {
|
|
|
- if (levelName === this.curChangePaper.level) return;
|
|
|
- this.curSelectLevel = levelName;
|
|
|
- },
|
|
|
- async confirmChange() {
|
|
|
- if (!this.curSelectLevel) return;
|
|
|
- if (this.isSubmit) return;
|
|
|
-
|
|
|
- this.isSubmit = true;
|
|
|
- const datas = {
|
|
|
- action: "sampling",
|
|
|
- level: this.curSelectLevel,
|
|
|
- originLevel: this.curChangePaper.level,
|
|
|
- paperIds: this.curChangePaper.id
|
|
|
- };
|
|
|
- let result = true;
|
|
|
- await leaderGradingPaper(datas).catch(() => {
|
|
|
- result = false;
|
|
|
- });
|
|
|
- this.isSubmit = false;
|
|
|
-
|
|
|
- if (!result) return;
|
|
|
-
|
|
|
- this.$Message.success("操作成功!");
|
|
|
- this.getPaperList();
|
|
|
- this.cancelChange();
|
|
|
- },
|
|
|
- cancelChange() {
|
|
|
- this.curSelectLevel = null;
|
|
|
- this.levelModalIsShow = false;
|
|
|
- }
|
|
|
- }
|
|
|
-};
|
|
|
-</script>
|
|
|
+<template>
|
|
|
+ <Modal
|
|
|
+ v-model="modalIsShow"
|
|
|
+ class="marker-standard marker-modal"
|
|
|
+ title="标准卷"
|
|
|
+ footer-hide
|
|
|
+ fullscreen
|
|
|
+ @on-visible-change="visibleChange"
|
|
|
+ >
|
|
|
+ <div class="level-list">
|
|
|
+ <div
|
|
|
+ v-for="(level, index) in levels"
|
|
|
+ :key="index"
|
|
|
+ :class="['level-item', { 'level-item-act': curLevel === level.name }]"
|
|
|
+ @click="setCurLevel(level.name)"
|
|
|
+ >
|
|
|
+ {{ level.name }}
|
|
|
+ </div>
|
|
|
+ <div
|
|
|
+ :class="['level-item', { 'level-item-act': !curLevel }]"
|
|
|
+ @click="setCurLevel('')"
|
|
|
+ >
|
|
|
+ 全部
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="standard-image-list marker-image-list" v-if="papers.length">
|
|
|
+ <div
|
|
|
+ v-for="(paper, index) in papers"
|
|
|
+ :key="paper.id"
|
|
|
+ class="marker-image-item"
|
|
|
+ >
|
|
|
+ <div class="marker-image-content">
|
|
|
+ <marker-image-view :data="paper" @to-review="toReview(index)">
|
|
|
+ <div class="image-info">
|
|
|
+ <div class="image-level">
|
|
|
+ {{ paper.level }}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="image-title">{{ paper.title }}</div>
|
|
|
+ <div v-if="canEditStandard" class="image-action">
|
|
|
+ <Button
|
|
|
+ type="error"
|
|
|
+ size="small"
|
|
|
+ icon="md-trash"
|
|
|
+ :disabled="paper.loading"
|
|
|
+ @click="cancelPaper(paper)"
|
|
|
+ ></Button>
|
|
|
+ <Button
|
|
|
+ type="primary"
|
|
|
+ size="small"
|
|
|
+ icon="md-create"
|
|
|
+ @click="toChangePaper(paper)"
|
|
|
+ ></Button>
|
|
|
+ </div>
|
|
|
+ </marker-image-view>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div v-else class="standard-image-none">
|
|
|
+ <p>暂无数据</p>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- change-standard -->
|
|
|
+ <Modal
|
|
|
+ class="change-standard marker-modal"
|
|
|
+ v-model="levelModalIsShow"
|
|
|
+ title="修改标准卷"
|
|
|
+ width="400px"
|
|
|
+ :mask-closable="false"
|
|
|
+ >
|
|
|
+ <div class="level-list">
|
|
|
+ <p
|
|
|
+ v-for="level in levels"
|
|
|
+ :key="level.name"
|
|
|
+ :class="[
|
|
|
+ 'level-item',
|
|
|
+ {
|
|
|
+ 'level-item-act': level.name === curSelectLevel,
|
|
|
+ 'level-item-disabled': level.name === curChangePaper.level
|
|
|
+ }
|
|
|
+ ]"
|
|
|
+ @click="selectLevel(level.name)"
|
|
|
+ >
|
|
|
+ {{ level.name }}
|
|
|
+ </p>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div slot="footer">
|
|
|
+ <Button
|
|
|
+ type="primary"
|
|
|
+ size="small"
|
|
|
+ :disabled="isSubmit || !curSelectLevel"
|
|
|
+ @click="confirmChange"
|
|
|
+ >确认</Button
|
|
|
+ >
|
|
|
+ <Button size="small" @click="cancelChange">取消</Button>
|
|
|
+ </div>
|
|
|
+ </Modal>
|
|
|
+ </Modal>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { mapState } from "vuex";
|
|
|
+import { paperList, cancelStandardPaper, leaderGradingPaper } from "@/api";
|
|
|
+import MarkerImageView from "./MarkerImageView";
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: "marker-standard",
|
|
|
+ props: {
|
|
|
+ questionId: {
|
|
|
+ type: [Number, String]
|
|
|
+ },
|
|
|
+ levels: {
|
|
|
+ type: Array,
|
|
|
+ default() {
|
|
|
+ return [];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ components: { MarkerImageView },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ modalIsShow: false,
|
|
|
+ curLevel: "",
|
|
|
+ paperList: [],
|
|
|
+ papers: [],
|
|
|
+ isLoading: false,
|
|
|
+ // change standard
|
|
|
+ levelModalIsShow: false,
|
|
|
+ curChangePaper: {},
|
|
|
+ curSelectLevel: null,
|
|
|
+ isSubmit: false
|
|
|
+ };
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapState("marker", ["IS_MARK_LEADER", "paramsSet"]),
|
|
|
+ showStandardPaperManage() {
|
|
|
+ return this.paramsSet["showStandardPaperManage"] !== 0;
|
|
|
+ },
|
|
|
+ canEditStandard() {
|
|
|
+ const user = this.$ls.get("user", {});
|
|
|
+ return (
|
|
|
+ this.IS_MARK_LEADER &&
|
|
|
+ this.showStandardPaperManage &&
|
|
|
+ user.standardVolume
|
|
|
+ );
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ async visibleChange(visible) {
|
|
|
+ if (!visible) return;
|
|
|
+
|
|
|
+ this.getPaperList();
|
|
|
+ },
|
|
|
+ async getPaperList() {
|
|
|
+ this.isLoading = true;
|
|
|
+ const datas = {
|
|
|
+ questionId: this.questionId,
|
|
|
+ level: "",
|
|
|
+ sort: "secretNumber",
|
|
|
+ isSample: true,
|
|
|
+ page: 0,
|
|
|
+ size: 1000
|
|
|
+ };
|
|
|
+ const data = await paperList(datas).catch(() => {});
|
|
|
+ this.isLoading = false;
|
|
|
+ if (!data) return;
|
|
|
+ this.paperList = data.data.map(item => {
|
|
|
+ item.title = `NO.${item.sn}`;
|
|
|
+ item.loading = false;
|
|
|
+ return item;
|
|
|
+ });
|
|
|
+ this.paperList.sort((a, b) => (a.level < b.level ? -1 : 1));
|
|
|
+ this.updatePapers();
|
|
|
+ },
|
|
|
+ updatePapers() {
|
|
|
+ if (this.curLevel) {
|
|
|
+ this.papers = this.paperList.filter(
|
|
|
+ paper => paper.level === this.curLevel
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ this.papers = this.paperList;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ setCurLevel(levelName) {
|
|
|
+ this.curLevel = levelName;
|
|
|
+ this.updatePapers();
|
|
|
+ },
|
|
|
+ cancel() {
|
|
|
+ this.modalIsShow = false;
|
|
|
+ },
|
|
|
+ open() {
|
|
|
+ this.modalIsShow = true;
|
|
|
+ },
|
|
|
+ toReview(index) {
|
|
|
+ this.$emit("on-paper-click", index, this.papers);
|
|
|
+ },
|
|
|
+ cancelPaper(paper) {
|
|
|
+ if (paper.loading) return;
|
|
|
+ this.$Modal.confirm({
|
|
|
+ content: "确定要取消当前标准卷吗?",
|
|
|
+ onOk: async () => {
|
|
|
+ paper.loading = true;
|
|
|
+ const res = await cancelStandardPaper(paper.id).catch(() => {});
|
|
|
+ paper.loading = false;
|
|
|
+ if (!res) return;
|
|
|
+ this.getPaperList();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // change standard paper
|
|
|
+ toChangePaper(paper) {
|
|
|
+ this.curChangePaper = paper;
|
|
|
+ this.levelModalIsShow = true;
|
|
|
+ },
|
|
|
+ selectLevel(levelName) {
|
|
|
+ if (levelName === this.curChangePaper.level) return;
|
|
|
+ this.curSelectLevel = levelName;
|
|
|
+ },
|
|
|
+ async confirmChange() {
|
|
|
+ if (!this.curSelectLevel) return;
|
|
|
+ if (this.isSubmit) return;
|
|
|
+
|
|
|
+ this.isSubmit = true;
|
|
|
+ const datas = {
|
|
|
+ action: "sampling",
|
|
|
+ level: this.curSelectLevel,
|
|
|
+ originLevel: this.curChangePaper.level,
|
|
|
+ paperIds: this.curChangePaper.id
|
|
|
+ };
|
|
|
+ let result = true;
|
|
|
+ await leaderGradingPaper(datas).catch(() => {
|
|
|
+ result = false;
|
|
|
+ });
|
|
|
+ this.isSubmit = false;
|
|
|
+
|
|
|
+ if (!result) return;
|
|
|
+
|
|
|
+ this.$Message.success("操作成功!");
|
|
|
+ this.getPaperList();
|
|
|
+ this.cancelChange();
|
|
|
+ },
|
|
|
+ cancelChange() {
|
|
|
+ this.curSelectLevel = null;
|
|
|
+ this.levelModalIsShow = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|