|
@@ -6,8 +6,14 @@
|
|
|
<div class="part-title">
|
|
|
<h2>分数图片导出</h2>
|
|
|
</div>
|
|
|
- <Form label-position="left" inline>
|
|
|
- <FormItem>
|
|
|
+ <Form
|
|
|
+ :rules="scoreRules"
|
|
|
+ :model="scoreFilter"
|
|
|
+ label-position="left"
|
|
|
+ inline
|
|
|
+ ref="scoreForm"
|
|
|
+ >
|
|
|
+ <FormItem prop="imageType">
|
|
|
<Select v-model="scoreFilter.imageType" placeholder="图片类型">
|
|
|
<Option
|
|
|
v-for="(val, key) in IMAGE_TYPE"
|
|
@@ -17,9 +23,9 @@
|
|
|
>
|
|
|
</Select>
|
|
|
</FormItem>
|
|
|
- <FormItem>
|
|
|
+ <FormItem prop="areaId">
|
|
|
<Select
|
|
|
- v-model="scoreFilter.areaCode"
|
|
|
+ v-model="scoreFilter.areaId"
|
|
|
@on-change="areaChange"
|
|
|
placeholder="考点"
|
|
|
>
|
|
@@ -36,6 +42,7 @@
|
|
|
v-model="scoreFilter.school"
|
|
|
@on-change="schoolChange"
|
|
|
placeholder="学校"
|
|
|
+ clearable
|
|
|
>
|
|
|
<Option
|
|
|
v-for="(item, index) in schools"
|
|
@@ -46,7 +53,11 @@
|
|
|
</Select>
|
|
|
</FormItem>
|
|
|
<FormItem>
|
|
|
- <Select v-model="scoreFilter.examRoom" placeholder="考场">
|
|
|
+ <Select
|
|
|
+ v-model="scoreFilter.examRoom"
|
|
|
+ placeholder="考场"
|
|
|
+ clearable
|
|
|
+ >
|
|
|
<Option
|
|
|
v-for="(room, index) in rooms"
|
|
|
:key="index"
|
|
@@ -55,7 +66,7 @@
|
|
|
></Option>
|
|
|
</Select>
|
|
|
</FormItem>
|
|
|
- <FormItem>
|
|
|
+ <FormItem prop="subject">
|
|
|
<Select v-model="scoreFilter.subject" placeholder="科目">
|
|
|
<Option
|
|
|
v-for="(subject, index) in subjects"
|
|
@@ -65,7 +76,7 @@
|
|
|
></Option>
|
|
|
</Select>
|
|
|
</FormItem>
|
|
|
- <FormItem>
|
|
|
+ <FormItem prop="nameRule">
|
|
|
<Select v-model="scoreFilter.nameRule" placeholder="命名规则">
|
|
|
<Option
|
|
|
v-for="(val, key) in EXPORT_IMAGE_NAME_TYPE"
|
|
@@ -77,7 +88,7 @@
|
|
|
</FormItem>
|
|
|
<FormItem>
|
|
|
<InputNumber
|
|
|
- v-model="scoreFilter.startNumber"
|
|
|
+ v-model="scoreFilter.startScore"
|
|
|
:min="1"
|
|
|
:precision="0"
|
|
|
placeholder="输入起始分数"
|
|
@@ -86,8 +97,8 @@
|
|
|
</FormItem>
|
|
|
<FormItem>
|
|
|
<InputNumber
|
|
|
- v-model="scoreFilter.endNumber"
|
|
|
- :min="scoreFilter.startNumber"
|
|
|
+ v-model="scoreFilter.endScore"
|
|
|
+ :min="scoreFilter.startScore"
|
|
|
:precision="0"
|
|
|
placeholder="输入终止分数"
|
|
|
clearable
|
|
@@ -99,7 +110,7 @@
|
|
|
class="export-paper-btn"
|
|
|
type="primary"
|
|
|
shape="circle"
|
|
|
- @click="toExport('score')"
|
|
|
+ @click="toExportScore"
|
|
|
>导出</Button
|
|
|
>
|
|
|
</div>
|
|
@@ -109,9 +120,15 @@
|
|
|
<div class="part-title">
|
|
|
<h2>图片解密、重命名导出</h2>
|
|
|
</div>
|
|
|
- <Form label-position="left" inline>
|
|
|
- <FormItem>
|
|
|
- <Select v-model="renameFilter.imageType" placeholder="图片类型">
|
|
|
+ <Form
|
|
|
+ :rules="decryptRules"
|
|
|
+ :model="decryptFilter"
|
|
|
+ label-position="left"
|
|
|
+ inline
|
|
|
+ ref="decryptForm"
|
|
|
+ >
|
|
|
+ <FormItem prop="imageType">
|
|
|
+ <Select v-model="decryptFilter.imageType" placeholder="图片类型">
|
|
|
<Option
|
|
|
v-for="(val, key) in IMAGE_TYPE"
|
|
|
:key="key"
|
|
@@ -120,8 +137,8 @@
|
|
|
>
|
|
|
</Select>
|
|
|
</FormItem>
|
|
|
- <FormItem>
|
|
|
- <Select v-model="renameFilter.areaCode" placeholder="考点">
|
|
|
+ <FormItem prop="areaId">
|
|
|
+ <Select v-model="decryptFilter.areaId" placeholder="考点">
|
|
|
<Option
|
|
|
v-for="area in cascadeList"
|
|
|
:key="area.areaCode"
|
|
@@ -130,8 +147,8 @@
|
|
|
></Option>
|
|
|
</Select>
|
|
|
</FormItem>
|
|
|
- <FormItem>
|
|
|
- <Select v-model="renameFilter.subject" placeholder="科目">
|
|
|
+ <FormItem prop="subject">
|
|
|
+ <Select v-model="decryptFilter.subject" placeholder="科目">
|
|
|
<Option
|
|
|
v-for="(subject, index) in subjects"
|
|
|
:key="index"
|
|
@@ -146,7 +163,7 @@
|
|
|
class="export-paper-btn"
|
|
|
type="primary"
|
|
|
shape="circle"
|
|
|
- @click="toExport('rename')"
|
|
|
+ @click="toExportDecrypt"
|
|
|
>导出</Button
|
|
|
>
|
|
|
</div>
|
|
@@ -156,8 +173,14 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { subjectList, areaSchoolRoomCascadeList } from "@/api";
|
|
|
+import {
|
|
|
+ subjectList,
|
|
|
+ areaSchoolRoomCascadeList,
|
|
|
+ exportScorePictures,
|
|
|
+ exportDecryptPictures
|
|
|
+} from "@/api";
|
|
|
import { IMAGE_TYPE, EXPORT_IMAGE_NAME_TYPE } from "@/constants/enumerate";
|
|
|
+import { requiredValid } from "@/plugins/formRules";
|
|
|
|
|
|
export default {
|
|
|
name: "export-paper",
|
|
@@ -166,19 +189,30 @@ export default {
|
|
|
workId: this.$route.params.workId,
|
|
|
scoreFilter: {
|
|
|
imageType: "",
|
|
|
- areaCode: "",
|
|
|
+ areaId: "",
|
|
|
examRoom: "",
|
|
|
school: "",
|
|
|
subject: "",
|
|
|
nameRule: "",
|
|
|
- startNumber: null,
|
|
|
- endNumber: null
|
|
|
+ startScore: null,
|
|
|
+ endScore: null
|
|
|
},
|
|
|
- renameFilter: {
|
|
|
+ decryptFilter: {
|
|
|
imageType: "",
|
|
|
- areaCode: "",
|
|
|
+ areaId: "",
|
|
|
subject: ""
|
|
|
},
|
|
|
+ scoreRules: {
|
|
|
+ imageType: requiredValid("请选择图片类型"),
|
|
|
+ areaId: requiredValid("请选择考区"),
|
|
|
+ subject: requiredValid("请选择科目"),
|
|
|
+ nameRule: requiredValid("请选择命名规则")
|
|
|
+ },
|
|
|
+ decryptRules: {
|
|
|
+ imageType: requiredValid("请选择图片类型"),
|
|
|
+ areaId: requiredValid("请选择考区"),
|
|
|
+ subject: requiredValid("请选择科目")
|
|
|
+ },
|
|
|
IMAGE_TYPE,
|
|
|
EXPORT_IMAGE_NAME_TYPE,
|
|
|
subjects: [],
|
|
@@ -201,13 +235,13 @@ export default {
|
|
|
},
|
|
|
areaChange() {
|
|
|
const curArea = this.cascadeList.find(
|
|
|
- item => item.areaCode === this.scoreFilter.areaCode
|
|
|
+ item => item.areaCode === this.scoreFilter.areaId
|
|
|
);
|
|
|
- this.schools = curArea.schools;
|
|
|
+ this.schools = curArea ? curArea.schools : [];
|
|
|
this.rooms = [];
|
|
|
this.scoreFilter.examRoom = null;
|
|
|
this.scoreFilter.school = null;
|
|
|
- if (curArea.schools.length === 1) {
|
|
|
+ if (curArea && curArea.schools.length === 1) {
|
|
|
this.scoreFilter.school = curArea.schools[0].school;
|
|
|
this.schoolChange();
|
|
|
}
|
|
@@ -216,11 +250,28 @@ export default {
|
|
|
const curSchool = this.schools.find(
|
|
|
item => item.school === this.scoreFilter.school
|
|
|
);
|
|
|
- this.rooms = curSchool.rooms;
|
|
|
+ this.rooms = curSchool ? curSchool.rooms : [];
|
|
|
this.scoreFilter.examRoom = null;
|
|
|
+ if (curSchool && curSchool.rooms.length === 1) {
|
|
|
+ this.scoreFilter.examRoom = curSchool.rooms[0];
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async toExportScore() {
|
|
|
+ const valid = await this.$refs.scoreForm.validate();
|
|
|
+ if (!valid) return;
|
|
|
+
|
|
|
+ await exportScorePictures({ ...this.scoreFilter, workId: this.workId });
|
|
|
+ this.$Message.success("操作成功,后台正在导出!");
|
|
|
},
|
|
|
- toExport(type) {
|
|
|
- console.log(this[`${type}Filter`]);
|
|
|
+ async toExportDecrypt() {
|
|
|
+ const valid = await this.$refs.decryptForm.validate();
|
|
|
+ if (!valid) return;
|
|
|
+
|
|
|
+ await exportDecryptPictures({
|
|
|
+ ...this.decryptFilter,
|
|
|
+ workId: this.workId
|
|
|
+ });
|
|
|
+ this.$Message.success("操作成功,后台正在导出!");
|
|
|
}
|
|
|
}
|
|
|
};
|