zhangjie 1 年之前
父節點
當前提交
e266e9444e

+ 4 - 3
src/assets/styles/element-ui-costom.scss

@@ -4,7 +4,7 @@
 */
 */
 // dialog
 // dialog
 .el-dialog {
 .el-dialog {
-  border-radius: $--border-radius;
+  border-radius: 8px;
   overflow: hidden;
   overflow: hidden;
   border: 1px solid #c8c8ca;
   border: 1px solid #c8c8ca;
   box-shadow: 5px 5px 4px 0px rgba(0, 0, 0, 0.1);
   box-shadow: 5px 5px 4px 0px rgba(0, 0, 0, 0.1);
@@ -21,6 +21,7 @@
     }
     }
     .el-dialog__body {
     .el-dialog__body {
       padding-top: 90px;
       padding-top: 90px;
+      min-height: 100%;
     }
     }
   }
   }
 }
 }
@@ -49,7 +50,7 @@
   }
   }
 }
 }
 .el-dialog__body {
 .el-dialog__body {
-  padding: 30px 40px;
+  padding: 30px;
   position: relative;
   position: relative;
   border-top: 1px solid $--color-border;
   border-top: 1px solid $--color-border;
   color: $--color-text-dark-1;
   color: $--color-text-dark-1;
@@ -66,7 +67,7 @@
   overflow: hidden;
   overflow: hidden;
   .el-button {
   .el-button {
     width: 100px;
     width: 100px;
-    border-radius: $--border-radius;
+    border-radius: 8px;
     float: right;
     float: right;
     margin-left: 10px;
     margin-left: 10px;
   }
   }

+ 7 - 3
src/assets/styles/home.scss

@@ -59,7 +59,6 @@
       line-height: 20px;
       line-height: 20px;
       padding: 5px 12px;
       padding: 5px 12px;
       color: #fff;
       color: #fff;
-      cursor: pointer;
 
 
       &:not(:last-child) {
       &:not(:last-child) {
         margin-right: 8px;
         margin-right: 8px;
@@ -67,10 +66,15 @@
 
 
       > i {
       > i {
         margin-right: 8px;
         margin-right: 8px;
+        margin-top: -2px;
       }
       }
 
 
-      &:hover {
-        border-color: #fff;
+      &.hover {
+        cursor: pointer;
+
+        &:hover {
+          border-color: #fff;
+        }
       }
       }
     }
     }
   }
   }

+ 113 - 0
src/components/SecSelect.vue

@@ -0,0 +1,113 @@
+<template>
+  <div :class="['sec-select', { inline: inline }]">
+    <el-form-item v-if="filterProps.includes('semesterId')" label="学期:">
+      <semester-select
+        v-model.trim="filter.semesterId"
+        placeholder="学期"
+        default-select
+        :clearable="!defaultSelectExam"
+        @default-selected="semesterDefaultSelect"
+      ></semester-select>
+    </el-form-item>
+    <el-form-item v-if="filterProps.includes('examId')" label="考试:">
+      <exam-select
+        v-model="filter.examId"
+        :semester-id="filter.semesterId"
+        :clearable="!defaultSelectExam"
+        :default-select="defaultSelectExam"
+        @default-selected="examDefaultSelect"
+      ></exam-select>
+    </el-form-item>
+    <el-form-item
+      v-if="filterProps.includes('courseCode')"
+      label="课程(代码):"
+      label-width="110px"
+    >
+      <course-select
+        v-model.trim="filter.courseCode"
+        :filter-data="{ semesterId: filter.semesterId, examId: filter.examId }"
+        placeholder="课程(代码)"
+        clearable
+      ></course-select>
+    </el-form-item>
+  </div>
+</template>
+
+<script>
+import SemesterSelect from "./base/SemesterSelect.vue";
+import ExamSelect from "./base/ExamSelect.vue";
+import CourseSelect from "./base/CourseSelect.vue";
+
+const fullProps = ["semesterId", "examId", "courseCode"];
+
+export default {
+  name: "sec-select",
+  components: { SemesterSelect, ExamSelect, CourseSelect },
+  props: {
+    value: {
+      type: Object,
+      default() {
+        return {};
+      },
+    },
+    inline: {
+      type: Boolean,
+      default: true,
+    },
+    defaultSelectExam: { type: Boolean, default: false },
+  },
+  data() {
+    return {
+      filter: {},
+      filterProps: [],
+    };
+  },
+  watch: {
+    filter: {
+      deep: true,
+      handler() {
+        this.emitChange();
+      },
+    },
+  },
+  created() {
+    this.initData();
+    this.filter = this.$objAssign(this.filter, this.value);
+  },
+  methods: {
+    initData() {
+      this.filterProps = fullProps.filter((field) =>
+        Object.prototype.hasOwnProperty.call(this.value, field)
+      );
+      let filter = {};
+      this.filterProps.forEach((field) => {
+        filter[field] = "";
+      });
+      this.filter = filter;
+    },
+    getFilterData() {
+      return Object.assign({}, this.value, this.filter);
+    },
+    emitChange() {
+      const data = this.getFilterData();
+      this.$emit("input", data);
+      this.$emit("change", data);
+    },
+    semesterDefaultSelect() {
+      if (this.defaultSelectExam) return;
+      this.emitChange();
+      this.$emit("semester-default", this.getFilterData());
+    },
+    examDefaultSelect() {
+      this.emitChange();
+      this.$emit("exam-default", this.getFilterData());
+    },
+  },
+};
+</script>
+
+<style scoped>
+.sec-select.inline {
+  display: inline;
+}
+</style>

+ 39 - 88
src/components/SimpleImagePreview.vue

@@ -1,30 +1,33 @@
 <template>
 <template>
-  <Modal
-    :class="prefixCls"
-    v-model="modalIsShow"
+  <el-dialog
+    :class="[prefixCls, 'opacity-dialog']"
+    :visible.sync="modalIsShow"
     title="图片预览"
     title="图片预览"
     fullscreen
     fullscreen
-    footer-hide
-    @on-visible-change="visibleChange"
+    append-to-body
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
   >
   >
-    <div slot="header"></div>
+    <div slot="title"></div>
+    <div slot="footer"></div>
     <div :class="[`${prefixCls}-close`]" @click="cancel">
     <div :class="[`${prefixCls}-close`]" @click="cancel">
       <i class="el-icon-circle-close"></i>
       <i class="el-icon-circle-close"></i>
-      <Icon type="ios-close" />
     </div>
     </div>
 
 
     <div :class="[`${prefixCls}-body`]" ref="ReviewBody">
     <div :class="[`${prefixCls}-body`]" ref="ReviewBody">
       <div
       <div
+        v-if="!simple"
         :class="[`${prefixCls}-guide`, `${prefixCls}-guide-prev`]"
         :class="[`${prefixCls}-guide`, `${prefixCls}-guide-prev`]"
         @click.stop="showPrev"
         @click.stop="showPrev"
       >
       >
-        <Icon type="ios-arrow-back" />
+        <i class="el-icon-arrow-left"></i>
       </div>
       </div>
       <div
       <div
+        v-if="!simple"
         :class="[`${prefixCls}-guide`, `${prefixCls}-guide-next`]"
         :class="[`${prefixCls}-guide`, `${prefixCls}-guide-next`]"
         @click.stop="showNext"
         @click.stop="showNext"
       >
       >
-        <Icon type="ios-arrow-forward" />
+        <i class="el-icon-arrow-right"></i>
       </div>
       </div>
       <div
       <div
         :class="[
         :class="[
@@ -32,60 +35,37 @@
           { [`${prefixCls}-imgs-nosition`]: nosition },
           { [`${prefixCls}-imgs-nosition`]: nosition },
         ]"
         ]"
         :style="styles"
         :style="styles"
-        v-move-ele.prevent.stop="{ mouseMove, click: cancel }"
         v-if="modalIsShow"
         v-if="modalIsShow"
       >
       >
         <img
         <img
           :key="curImage.url"
           :key="curImage.url"
           :src="curImage.url"
           :src="curImage.url"
-          :alt="curImage.name"
+          :alt="curImage.filename"
           ref="PreviewImgDetail"
           ref="PreviewImgDetail"
           @load="reizeImage"
           @load="reizeImage"
         />
         />
       </div>
       </div>
       <div :class="[`${prefixCls}-none`]" v-if="!curImage.url">
       <div :class="[`${prefixCls}-none`]" v-if="!curImage.url">
-        <Icon type="md-image" />
+        <i class="el-icon-picture"></i>
         <p>暂无数据</p>
         <p>暂无数据</p>
       </div>
       </div>
 
 
       <div :class="[`${prefixCls}-loading`]" v-show="loading">
       <div :class="[`${prefixCls}-loading`]" v-show="loading">
-        <Icon class="ivu-load-loop" type="ios-loading" />
+        <i class="el-icon-loading"></i>
       </div>
       </div>
     </div>
     </div>
 
 
-    <div :class="[`${prefixCls}-footer`]">
+    <div v-if="!simple" :class="[`${prefixCls}-footer`]">
       <ul>
       <ul>
-        <li title="合适大小" @click="toOrigin">
-          <Icon type="md-expand" />
-        </li>
-        <li
-          title="放大"
-          @click="toMagnify"
-          :class="{
-            'li-disabled': transform.scale === maxScale,
-          }"
-        >
-          <Icon type="md-add-circle" />
-        </li>
-        <li
-          title="缩小"
-          @click="toShrink"
-          :class="{
-            'li-disabled': transform.scale === minScale,
-          }"
-        >
-          <Icon type="md-remove-circle" />
-        </li>
         <li title="旋转" @click.stop="toRotate">
         <li title="旋转" @click.stop="toRotate">
-          <Icon type="ios-refresh-circle" />
+          <i class="el-icon-refresh-right"></i>
         </li>
         </li>
       </ul>
       </ul>
     </div>
     </div>
-  </Modal>
+  </el-dialog>
 </template>
 </template>
 
 
 <script>
 <script>
-import MoveEle from "./move-ele";
 const prefixCls = "cc-image-preview";
 const prefixCls = "cc-image-preview";
 
 
 export default {
 export default {
@@ -97,16 +77,17 @@ export default {
         return {};
         return {};
       },
       },
     },
     },
+    simple: {
+      type: Boolean,
+      default: false,
+    },
   },
   },
-  directives: { MoveEle },
   data() {
   data() {
     return {
     return {
       prefixCls,
       prefixCls,
       modalIsShow: false,
       modalIsShow: false,
       styles: { width: "", height: "", top: "", left: "", transform: "" },
       styles: { width: "", height: "", top: "", left: "", transform: "" },
       initWidth: 500,
       initWidth: 500,
-      minScale: 0.2,
-      maxScale: 3,
       transform: {
       transform: {
         scale: 1,
         scale: 1,
         rotate: 0,
         rotate: 0,
@@ -116,23 +97,25 @@ export default {
       nosition: false,
       nosition: false,
     };
     };
   },
   },
-  mounted() {
-    this.registWheelHandle();
+  watch: {
+    "curImage.url": {
+      handler(val) {
+        if (val) {
+          this.loadingSetT = setTimeout(() => {
+            this.loading = true;
+          }, 300);
+          this.styles = {
+            width: "",
+            height: "",
+            top: "",
+            left: "",
+            transform: "",
+          };
+        }
+      },
+    },
   },
   },
   methods: {
   methods: {
-    visibleChange(visible) {
-      if (!visible) return;
-      // this.loading = true;
-      // this.$nextTick(() => {
-      //   this.registfileLoad();
-      // });
-    },
-    // registfileLoad() {
-    //   const imgDom = this.$refs.PreviewImgDetail;
-    //   imgDom.onload = () => {
-    //     this.reizeImage(imgDom);
-    //   };
-    // },
     reizeImage() {
     reizeImage() {
       if (this.loadingSetT) clearTimeout(this.loadingSetT);
       if (this.loadingSetT) clearTimeout(this.loadingSetT);
 
 
@@ -219,42 +202,10 @@ export default {
       // this.initData();
       // this.initData();
     },
     },
     // dome-move
     // dome-move
-    registWheelHandle() {
-      this.$refs.ReviewBody.addEventListener("wheel", (e) => {
-        e.preventDefault();
-        this.mouseWheel(e.wheelDeltaY);
-      });
-    },
-    mouseMove({ left, top }) {
-      this.styles.left = left + "px";
-      this.styles.top = top + "px";
-    },
-    mouseWheel(delta) {
-      if (delta < 0) {
-        this.toMagnify();
-      } else {
-        this.toShrink();
-      }
-    },
     setStyleTransform() {
     setStyleTransform() {
       const { scale, rotate } = this.transform;
       const { scale, rotate } = this.transform;
       this.styles.transform = `scale(${scale}, ${scale}) rotate(${rotate}deg)`;
       this.styles.transform = `scale(${scale}, ${scale}) rotate(${rotate}deg)`;
     },
     },
-    toOrigin() {
-      this.transform.scale = 1;
-      this.setStyleTransform();
-      this.reizeImage();
-    },
-    toMagnify() {
-      const scale = (this.transform.scale * 1.2).toFixed(2);
-      this.transform.scale = scale >= this.maxScale ? this.maxScale : scale;
-      this.setStyleTransform();
-    },
-    toShrink() {
-      const scale = (this.transform.scale * 0.75).toFixed(2);
-      this.transform.scale = scale <= this.minScale ? this.minScale : scale;
-      this.setStyleTransform();
-    },
     toRotate() {
     toRotate() {
       this.transform.rotate = this.transform.rotate + 90;
       this.transform.rotate = this.transform.rotate + 90;
       this.setStyleTransform();
       this.setStyleTransform();

+ 18 - 20
src/components/base/CourseSelect.vue

@@ -30,12 +30,7 @@ export default {
     clearable: { type: Boolean, default: true },
     clearable: { type: Boolean, default: true },
     filterData: {
     filterData: {
       type: Object,
       type: Object,
-      default() {
-        return {
-          paperArchivesId: "",
-          semesterId: "",
-        };
-      },
+      default: null,
     },
     },
   },
   },
   data() {
   data() {
@@ -51,27 +46,30 @@ export default {
         this.selected = val;
         this.selected = val;
       },
       },
     },
     },
-    "filterData.paperArchivesId": {
-      handler(val, oldval) {
-        console.log(val);
-        if (val !== oldval) {
-          this.search();
-          this.$emit("input", "");
-          this.$emit("change", {});
-        }
-      },
+    filterData(val, oldval) {
+      if (val !== oldval) {
+        this.search();
+        this.$emit("input", "");
+        this.$emit("change", {});
+      }
     },
     },
   },
   },
-  created() {
+  async created() {
     this.search();
     this.search();
   },
   },
   methods: {
   methods: {
     async search() {
     async search() {
       this.optionList = [];
       this.optionList = [];
-      if (!this.filterData.paperArchivesId) return;
-      const res = await commonCourseQuery({
-        ...this.filterData,
-      });
+
+      if (
+        this.filterData &&
+        (!this.filterData.semesterId || !this.filterData.examId)
+      )
+        return;
+
+      const datas = this.filterData || {};
+
+      const res = await commonCourseQuery(datas);
       this.optionList = res;
       this.optionList = res;
     },
     },
     select() {
     select() {

+ 87 - 0
src/components/base/ExamSelect.vue

@@ -0,0 +1,87 @@
+<template>
+  <el-select
+    v-model="selected"
+    class="exam-select"
+    :placeholder="placeholder"
+    filterable
+    :clearable="clearable"
+    :disabled="disabled"
+    @change="select"
+  >
+    <el-option
+      v-for="item in optionList"
+      :key="item.id"
+      :value="item.id"
+      :label="item.name"
+    >
+    </el-option>
+  </el-select>
+</template>
+
+<script>
+import { commonExamQuery } from "../../modules/client/api";
+
+export default {
+  name: "exam-select",
+  props: {
+    disabled: { type: Boolean, default: false },
+    placeholder: { type: String, default: "考试" },
+    value: { type: [Number, String], default: "" },
+    clearable: { type: Boolean, default: true },
+    semesterId: { type: String, default: "" },
+    defaultSelect: { type: Boolean, default: false },
+  },
+  data() {
+    return {
+      optionList: [],
+      selected: "",
+    };
+  },
+  watch: {
+    value: {
+      immediate: true,
+      handler(val) {
+        this.selected = val;
+      },
+    },
+    semesterId(val, oldval) {
+      if (val !== oldval) {
+        this.search();
+        this.$emit("input", "");
+        this.$emit("change", {});
+      }
+    },
+  },
+  created() {
+    this.search();
+  },
+  methods: {
+    async search() {
+      this.optionList = [];
+      if (!this.semesterId) return;
+
+      let data = {
+        semesterId: this.semesterId,
+      };
+      const res = await commonExamQuery(data);
+      this.optionList = res;
+      if (this.defaultSelect && !this.value) this.selectDefault();
+    },
+    select() {
+      this.$emit("input", this.selected);
+      this.$emit(
+        "change",
+        this.optionList.find((item) => item.id === this.selected)
+      );
+    },
+    selectDefault() {
+      const defaultData = this.optionList[0];
+      if (defaultData) {
+        this.selected = defaultData.id;
+        this.$emit("input", this.selected);
+        this.$emit("default-selected", defaultData);
+      }
+    },
+  },
+};
+</script>

+ 75 - 0
src/components/base/SemesterSelect.vue

@@ -0,0 +1,75 @@
+<template>
+  <el-select
+    v-model="selected"
+    class="semester-select"
+    :placeholder="placeholder"
+    filterable
+    :clearable="clearable"
+    :disabled="disabled"
+    @change="select"
+  >
+    <el-option
+      v-for="item in optionList"
+      :key="item.id"
+      :value="item.id"
+      :label="item.name"
+    >
+    </el-option>
+  </el-select>
+</template>
+
+<script>
+import { commonSemesterQuery } from "../../modules/client/api";
+
+export default {
+  name: "semester-select",
+  props: {
+    disabled: { type: Boolean, default: false },
+    placeholder: { type: String, default: "请选择学期" },
+    value: { type: [Number, String], default: "" },
+    clearable: { type: Boolean, default: true },
+    defaultSelectInUsed: { type: Boolean, default: false },
+  },
+  data() {
+    return {
+      optionList: [],
+      selected: "",
+    };
+  },
+  watch: {
+    value: {
+      immediate: true,
+      handler(val) {
+        this.selected = val;
+      },
+    },
+  },
+  created() {
+    this.search();
+  },
+  methods: {
+    async search() {
+      this.optionList = [];
+
+      const res = await commonSemesterQuery({}, "SEMESTER");
+      this.optionList = res;
+
+      if (this.defaultSelectInUsed) this.selectDefault();
+    },
+    select() {
+      this.$emit("input", this.selected);
+      this.$emit(
+        "change",
+        this.optionList.find((item) => item.id === this.selected)
+      );
+    },
+    selectDefault() {
+      const defaultCollege = this.optionList.find((item) => item.inUsed);
+      if (defaultCollege) {
+        this.selected = defaultCollege.id;
+        this.select();
+      }
+    },
+  },
+};
+</script>

+ 15 - 28
src/modules/client/api.js

@@ -1,5 +1,13 @@
 import { $post, $postParam } from "@/plugins/axios";
 import { $post, $postParam } from "@/plugins/axios";
 
 
+// 学期
+export const commonSemesterQuery = () => {
+  return $postParam("/api/admin/common/semester/query", {});
+};
+// 考试
+export const commonExamQuery = (data) => {
+  return $postParam("/api/admin/common/exam/query", data);
+};
 // 课程
 // 课程
 export const commonCourseQuery = ({
 export const commonCourseQuery = ({
   paperArchivesId = "",
   paperArchivesId = "",
@@ -10,38 +18,17 @@ export const commonCourseQuery = ({
     semesterId,
     semesterId,
   });
   });
 };
 };
-// 教学班
-export const commonTeachClazzQuery = ({
-  paperArchivesId = "",
-  courseName = "",
-}) => {
-  return $postParam("/api/admin/common/teach_clazz/query", {
-    paperArchivesId,
-    courseName,
-  });
-};
-// 档案
-export const commonArchivesQuery = (data) => {
-  return $postParam("/api/admin/common/archives/query", data);
-};
 
 
 // scan
 // scan
-export const uploadFormalImage = (datas, config = {}) => {
-  return $post(`/api/admin/client/picture/upload`, datas, {
+export const uploadImage = (isFormal, datas, config = {}) => {
+  const url = isFormal
+    ? "/api/admin/client/picture/upload"
+    : "/api/admin/client/other/upload";
+  return $post(url, datas, {
     ...config,
     ...config,
     slientRequest: true,
     slientRequest: true,
   });
   });
 };
 };
-
-export const bingScanUser = ({ paperScanTaskId, userId }) => {
-  return $postParam(`/api/admin/client/bind/user`, { paperScanTaskId, userId });
-};
-export const taskListPage = (datas) => {
-  return $postParam(`/api/admin/client/task/page`, datas);
-};
-export const enableScanTask = ({ paperScanTaskId, enable }) => {
-  return $postParam(`/api/admin/client/task/enable`, {
-    paperScanTaskId,
-    enable,
-  });
+export const taskInfos = (datas) => {
+  return $postParam(`/api/admin/client/task/get`, datas);
 };
 };

+ 0 - 260
src/modules/client/components/ScanTaskDialog.vue

@@ -1,260 +0,0 @@
-<template>
-  <el-dialog
-    class="scan-task-dialog"
-    :visible.sync="modalIsShow"
-    top="10vh"
-    width="550px"
-    :close-on-click-modal="false"
-    :close-on-press-escape="false"
-    :show-close="false"
-    append-to-body
-    @open="visibleChange"
-  >
-    <div class="scan-head" slot="title">
-      <h3>扫描</h3>
-      <div
-        v-if="scanStatus !== 'START'"
-        class="scan-head-btn cont-link"
-        @click="closeDialog"
-      >
-        <i class="el-icon-close"></i>
-      </div>
-    </div>
-    <el-form
-      ref="modalFormComp"
-      :model="modalForm"
-      :rules="rules"
-      label-width="100px"
-    >
-      <el-form-item label="课程名称:">
-        {{ task.courseName }}
-      </el-form-item>
-      <el-form-item prop="preScanCount" label="预扫张数:">
-        <el-input-number
-          v-model="modalForm.preScanCount"
-          :min="0"
-          :max="1000000"
-          :step="1"
-          step-strictly
-          :controls="false"
-        ></el-input-number>
-      </el-form-item>
-      <el-form-item label="实扫张数:">
-        <span class="color-danger">
-          {{ realScanCount }}
-        </span>
-        <i v-if="scanStatus === 'START'" class="el-icon-loading"></i>
-      </el-form-item>
-    </el-form>
-    <div slot="footer">
-      <el-button v-if="scanStatus === 'INIT'" type="primary" @click="startTask"
-        >开始扫描</el-button
-      >
-      <el-button
-        v-if="scanStatus === 'PAUSE'"
-        type="primary"
-        @click="continueTask"
-        >继续扫描</el-button
-      >
-      <el-button v-if="scanStatus === 'PAUSE'" type="primary" @click="confirm"
-        >确认</el-button
-      >
-      <el-button v-if="scanStatus === 'PAUSE'" @click="cancel">取消</el-button>
-    </div>
-  </el-dialog>
-</template>
-
-<script>
-import { bingScanUser } from "../api";
-import {
-  getPreUploadFilesAutoSerial,
-  getPreUploadFileCount,
-  saveOutputImage,
-} from "../../../plugins/imageOcr";
-import setTimeMixins from "../../../mixins/setTimeMixins";
-import db from "../../../plugins/db";
-const fs = window.nodeRequire("fs");
-
-export default {
-  name: "scan-task-dialog",
-  props: {
-    task: {
-      type: Object,
-      default() {
-        return {};
-      },
-    },
-  },
-  mixins: [setTimeMixins],
-  data() {
-    return {
-      modalIsShow: false,
-      loading: false,
-      user: this.$ls.get("user", {}),
-      scanStatus: "INIT", // INIT:初始状态,START:已开始,PAUSE:已暂停
-      modalForm: {
-        preScanCount: undefined,
-      },
-      rules: {
-        preScanCount: [
-          {
-            required: true,
-            message: "请输入预扫张数",
-            trigger: "change",
-          },
-        ],
-      },
-      scaningImageList: [],
-      realScanCount: 0,
-    };
-  },
-  computed: {
-    taskBound() {
-      return this.user.id === this.task.scanUserId;
-    },
-  },
-  beforeDestroy() {
-    this.clearSetTs();
-  },
-  methods: {
-    initData() {
-      this.loading = false;
-      this.modalForm.preScanCount = undefined;
-      this.scaningImageList = [];
-      this.scanStatus = "INIT";
-      this.realScanCount = 0;
-    },
-    visibleChange() {
-      this.initData();
-    },
-    close() {
-      this.modalIsShow = false;
-      this.$emit("on-close");
-    },
-    open() {
-      this.modalIsShow = true;
-    },
-    closeDialog() {
-      if (this.scanStatus === "START") return;
-
-      if (this.scanStatus === "INIT") {
-        this.close();
-        return;
-      }
-
-      this.cancel();
-    },
-    async startTask() {
-      const valid = await this.$refs.modalFormComp.validate().catch(() => {});
-      if (!valid) return;
-
-      if (this.loading) return;
-      this.loading = true;
-
-      if (!this.taskBound) {
-        await bingScanUser({
-          paperScanTaskId: this.task.id,
-          userId: this.user.id,
-        });
-      }
-
-      this.scaningImageList = [];
-      this.scanStatus = "START";
-      this.getInitFile();
-
-      // 唤起采集程序
-      this.evokeScanExe();
-    },
-    async continueTask() {
-      this.scanStatus = "START";
-      this.getInitFile();
-
-      this.evokeScanExe();
-    },
-    evokeScanExe() {
-      console.log("唤起扫描仪");
-      setTimeout(() => {
-        this.scanStatus = "PAUSE";
-        console.log("扫描仪停止");
-      }, 1 * 1000);
-    },
-    async confirm() {
-      this.scaningImageList = getPreUploadFilesAutoSerial(this.GLOBAL.input);
-      if (!this.scaningImageList.length) {
-        this.$message.error("当前没有要保存的数据!");
-        return;
-      }
-      await this.saveScanImage();
-
-      const confirm = await this.$confirm(`是否继续扫描?`, "提示", {
-        type: "warning",
-      }).catch(() => {});
-
-      if (confirm !== "confirm") {
-        this.close();
-        return;
-      }
-
-      this.initData();
-    },
-    async cancel() {
-      const confirm = await this.$confirm(
-        `取消扫描后,当前未保存的数据将会被清空,确定要取消扫描吗?`,
-        "提示",
-        {
-          type: "warning",
-        }
-      ).catch(() => {});
-      if (confirm !== "confirm") return;
-
-      this.clearScanList();
-      this.close();
-    },
-    // scan relate
-    getInitFile() {
-      this.clearSetTs();
-      if (this.scanStatus !== "START") return;
-
-      this.realScanCount = getPreUploadFileCount(this.GLOBAL.input);
-      this.addSetTime(() => {
-        this.getInitFile();
-      }, 500);
-    },
-    async saveScanImage() {
-      for (let i = 0, len = this.scaningImageList.length; i < len; i++) {
-        const files = this.scaningImageList[i];
-        const ouputImageList = saveOutputImage(
-          [files.frontFile, files.versoFile],
-          {
-            taskId: this.task.id,
-          }
-        );
-        const fileInfo = {
-          taskId: this.task.id,
-          taskName: this.task.scanTaskName,
-          courseCode: "",
-          courseName: this.task.courseName,
-          teachingClassName: this.task.teachClazzName,
-          frontOriginImgPath: ouputImageList[0],
-          versoOriginImgPath: ouputImageList[1],
-          clientUserId: this.user.id,
-          clientUsername: this.user.name,
-          clientUserLoginTime: this.user.loginTime,
-        };
-
-        await db.saveUploadInfo(fileInfo).catch((err) => {
-          console.log(err);
-        });
-      }
-    },
-    clearScanList() {
-      for (let i = 0; i < this.scaningImageList.length; i++) {
-        const item = this.scaningImageList[i];
-        fs.unlinkSync(item.frontFile);
-        fs.unlinkSync(item.versoFile);
-      }
-      this.scaningImageList = [];
-    },
-  },
-};
-</script>

+ 67 - 220
src/modules/client/components/ScanTaskProcessDialog.vue

@@ -1,7 +1,7 @@
 <template>
 <template>
   <div>
   <div>
     <el-dialog
     <el-dialog
-      class="scan-task-dialog"
+      class="scan-task-dialog page-dialog"
       :visible.sync="modalIsShow"
       :visible.sync="modalIsShow"
       fullscreen
       fullscreen
       :close-on-click-modal="false"
       :close-on-click-modal="false"
@@ -9,18 +9,23 @@
       :show-close="false"
       :show-close="false"
       append-to-body
       append-to-body
       @open="dialogOpen"
       @open="dialogOpen"
-      @closed="dialogClosed"
     >
     >
       <div class="scan-head" slot="title">
       <div class="scan-head" slot="title">
-        <h3>扫描</h3>
+        <h3>
+          扫描详情
+          <span class="color-gray ml-2"
+            >{{ task.courseName }}({{ task.courseCode }})</span
+          >
+        </h3>
         <div
         <div
-          v-if="scanStatus !== 'START'"
+          v-if="scanStatus === 'INIT'"
           class="scan-head-btn cont-link"
           class="scan-head-btn cont-link"
-          @click="closeDialog"
+          @click="close"
         >
         >
           <i class="el-icon-close"></i>
           <i class="el-icon-close"></i>
         </div>
         </div>
       </div>
       </div>
+
       <div class="scan-image-list">
       <div class="scan-image-list">
         <div
         <div
           v-for="item in scanHistoryList"
           v-for="item in scanHistoryList"
@@ -31,54 +36,15 @@
           <img :src="item" />
           <img :src="item" />
         </div>
         </div>
       </div>
       </div>
+
       <div slot="footer">
       <div slot="footer">
-        <el-form
-          ref="modalFormComp"
-          :model="modalForm"
-          :rules="rules"
-          label-width="100px"
+        <el-button
+          type="primary"
+          :loading="scanStatus !== 'INIT'"
+          @click="startTask"
         >
         >
-          <el-form-item label="课程名称:">
-            {{ task.courseName }}
-          </el-form-item>
-          <el-form-item prop="preScanCount" label="预扫张数:">
-            <el-input-number
-              v-model="modalForm.preScanCount"
-              :min="0"
-              :max="1000000"
-              :step="1"
-              step-strictly
-              :controls="false"
-            ></el-input-number>
-          </el-form-item>
-          <el-form-item label="实扫张数:">
-            <span class="color-danger">
-              {{ realScanCount }}
-            </span>
-            <i v-if="scanStatus === 'START'" class="el-icon-loading"></i>
-          </el-form-item>
-        </el-form>
-        <div>
-          <el-button
-            v-if="scanStatus === 'INIT'"
-            type="primary"
-            @click="startTask"
-            >开始扫描</el-button
-          >
-          <el-button
-            v-if="scanStatus === 'PAUSE'"
-            type="primary"
-            :loading="submiting"
-            @click="confirm"
-            >确认</el-button
-          >
-          <el-button
-            v-if="scanStatus === 'PAUSE'"
-            :loading="submiting"
-            @click="cancel"
-            >取消</el-button
-          >
-        </div>
+          {{ statusDesc[scanStatus] }}
+        </el-button>
       </div>
       </div>
     </el-dialog>
     </el-dialog>
 
 
@@ -94,17 +60,12 @@
 
 
 <script>
 <script>
 import { mapState } from "vuex";
 import { mapState } from "vuex";
-import { bingScanUser } from "../api";
 import {
 import {
   getPreUploadFiles,
   getPreUploadFiles,
-  getPreUploadFileCount,
   saveOutputImage,
   saveOutputImage,
-  renamePreUploadJsonFile,
   clearDir,
   clearDir,
   decodeImageCode,
   decodeImageCode,
-  getScanHistoryFiles,
 } from "../../../plugins/imageOcr";
 } from "../../../plugins/imageOcr";
-import setGroupTimeMixins from "../../../mixins/setGroupTimeMixins";
 import db from "../../../plugins/db";
 import db from "../../../plugins/db";
 import { evokeScanner } from "../../../plugins/scanner";
 import { evokeScanner } from "../../../plugins/scanner";
 import SimpleImagePreview from "@/components/SimpleImagePreview.vue";
 import SimpleImagePreview from "@/components/SimpleImagePreview.vue";
@@ -124,61 +85,33 @@ export default {
       },
       },
     },
     },
   },
   },
-  mixins: [setGroupTimeMixins],
   data() {
   data() {
     return {
     return {
-      modalIsShow: false,
-      loading: false,
-      submiting: false,
-      user: this.$ls.get("user", { id: "" }),
-      scanStatus: "INIT", // INIT:初始状态,START:已开始,PAUSE:已暂停
-      modalForm: {
-        preScanCount: 0,
-      },
-      rules: {
-        preScanCount: [
-          {
-            required: true,
-            message: "请输入预扫张数",
-            trigger: "change",
-          },
-        ],
-      },
-      scaningImageList: [],
+      modalIsShow: true,
+      scanStatus: "INIT",
       realScanCount: 0,
       realScanCount: 0,
-      taskScanUserId: "",
       scanHistoryList: [],
       scanHistoryList: [],
       curPaper: {},
       curPaper: {},
+      statusDesc: {
+        INIT: "开始扫描",
+        SCAN: "扫描中",
+        SAVING: "保存数据中",
+      },
     };
     };
   },
   },
   computed: {
   computed: {
     ...mapState("client", ["ocrArea"]),
     ...mapState("client", ["ocrArea"]),
-    openBarCode() {
-      return this.$store.state.user.openBarCode;
-    },
-    taskBound() {
-      return this.user.id === this.taskScanUserId;
-    },
-  },
-  beforeDestroy() {
-    this.clearSetTs();
   },
   },
   methods: {
   methods: {
     initData() {
     initData() {
-      this.loading = false;
-      this.modalForm.preScanCount = undefined;
-      this.scaningImageList = [];
       this.scanStatus = "INIT";
       this.scanStatus = "INIT";
       this.realScanCount = 0;
       this.realScanCount = 0;
+      this.getScanHistory();
     },
     },
     dialogOpen() {
     dialogOpen() {
       logger.info(`00进入扫描`);
       logger.info(`00进入扫描`);
-      this.taskScanUserId = this.task.scanUserId;
       this.initData();
       this.initData();
     },
     },
-    dialogClosed() {
-      this.clearSetTs();
-    },
     close() {
     close() {
       this.modalIsShow = false;
       this.modalIsShow = false;
       this.$emit("on-close");
       this.$emit("on-close");
@@ -187,43 +120,9 @@ export default {
     open() {
     open() {
       this.modalIsShow = true;
       this.modalIsShow = true;
     },
     },
-    closeDialog() {
-      if (this.scanStatus === "START") return;
-
-      if (this.scanStatus === "INIT") {
-        this.close();
-        return;
-      }
-
-      this.cancel();
-    },
-    async startTask() {
-      const valid = await this.$refs.modalFormComp.validate().catch(() => {});
-      if (!valid) return;
-
-      if (this.loading) return;
-      this.loading = true;
-
-      if (!this.taskBound) {
-        await bingScanUser({
-          paperScanTaskId: this.task.id,
-          userId: this.user.id,
-        });
-        this.taskScanUserId = this.user.id;
-      }
+    startTask() {
       logger.info(`01开始扫描`);
       logger.info(`01开始扫描`);
-      this.scaningImageList = [];
-      this.scanStatus = "START";
-      this.getInitFile();
-      this.getScanHistory();
-
-      this.evokeScanExe();
-    },
-    async continueTask() {
-      logger.info(`01继续扫描`);
-      this.scanStatus = "START";
-      this.getInitFile();
-
+      this.scanStatus = "SCAN";
       this.evokeScanExe();
       this.evokeScanExe();
     },
     },
     async evokeScanExe() {
     async evokeScanExe() {
@@ -232,99 +131,48 @@ export default {
       await evokeScanner(this.GLOBAL.input).catch((error) => {
       await evokeScanner(this.GLOBAL.input).catch((error) => {
         console.error(error);
         console.error(error);
       });
       });
-      this.scanStatus = "PAUSE";
-      this.realScanCount = getPreUploadFileCount(this.GLOBAL.input);
 
 
       // 缓存已扫描的数据
       // 缓存已扫描的数据
       const res = getPreUploadFiles(this.GLOBAL.input);
       const res = getPreUploadFiles(this.GLOBAL.input);
       if (!res.succeed) {
       if (!res.succeed) {
         logger.error(`03扫描仪停止,故障:${res.errorMsg}`);
         logger.error(`03扫描仪停止,故障:${res.errorMsg}`);
         this.$message.error(res.errorMsg);
         this.$message.error(res.errorMsg);
-        renamePreUploadJsonFile(this.GLOBAL.input);
+        this.scanStatus = "INIT";
         return;
         return;
       }
       }
       logger.info(`03扫描仪停止,扫描数:${res.data.length}`);
       logger.info(`03扫描仪停止,扫描数:${res.data.length}`);
-      this.scaningImageList.push(...res.data);
-      // console.log(this.scaningImageList);
-      renamePreUploadJsonFile(this.GLOBAL.input);
-    },
-    async confirm() {
-      if (!this.scaningImageList.length) {
-        this.$message.error("当前没有需要保存的数据!");
-        return;
-      }
-      if (this.realScanCount !== this.modalForm.preScanCount) {
-        this.$message.error("实扫张数与预扫张数不一致!");
-        return;
-      }
-      if (this.submiting) return;
-      this.submiting = true;
-
-      logger.info(`04-1开始保存数据`);
-      let res = true;
-      await this.saveScanImage().catch(() => {
-        res = false;
+      this.scanStatus = "SAVING";
+      await this.saveScanImage(res.data).catch(() => {
+        this.$message.error("保存数据失败,请重新扫描!");
+        logger.error(`保存数据失败,请重新扫描!`);
       });
       });
-      this.submiting = false;
-      logger.info(`04-2保存数据结束`);
-      if (!res) {
-        this.$message.error("保存数据错误!");
-        return;
-      }
-
-      const confirm = await this.$confirm(`是否继续扫描?`, "提示", {
-        type: "warning",
-      }).catch(() => {});
-      this.clearScanList();
-
-      if (confirm !== "confirm") {
-        this.close();
-        return;
-      }
-
-      this.initData();
-    },
-    async cancel() {
-      const confirm = await this.$confirm(
-        `取消扫描后,当前未保存的数据将会被清空,确定要取消扫描吗?`,
-        "提示",
-        {
-          type: "warning",
-        }
-      ).catch(() => {});
-      if (confirm !== "confirm") return;
-
-      this.clearScanList();
-      this.close();
+      clearDir(this.GLOBAL.input);
+      this.scanStatus = "INIT";
+      await this.getScanHistory();
     },
     },
     // scan relate
     // scan relate
-    getInitFile() {
-      this.clearSetTs("scan");
-      if (this.scanStatus !== "START") return;
+    async getScanHistory() {
+      const res = await db
+        .searchHistoryList({
+          isFormal: this.task.isFormal ? 1 : 0,
+          taskId: this.task.id,
+        })
+        .catch(() => {});
+      if (!res) return;
 
 
-      this.realScanCount = getPreUploadFileCount(this.GLOBAL.input);
-      this.addSetTime(
-        "scan",
-        () => {
-          this.getInitFile();
-        },
-        500
-      );
-    },
-    getScanHistory() {
-      this.clearSetTs("history");
-      this.scanHistoryList = getScanHistoryFiles(this.GLOBAL.input);
-      this.addSetTime(
-        "history",
-        () => {
-          this.getScanHistory();
-        },
-        1000
-      );
+      this.scanHistoryList = [];
+      res.forEach((item) => {
+        this.scanHistoryList.push(item.frontOriginImgPath);
+        this.scanHistoryList.push(item.versoOriginImgPath);
+      });
+
+      this.curPaper = {};
+      this.$refs.SimpleImagePreview.close();
     },
     },
-    async saveScanImage() {
-      for (let i = 0, len = this.scaningImageList.length; i < len; i++) {
-        const files = this.scaningImageList[i];
+    async saveScanImage(imageList) {
+      logger.info(`04-1开始保存数据`);
+      for (let i = 0, len = imageList.length; i < len; i++) {
+        const files = imageList[i];
         const ouputImageList = saveOutputImage(
         const ouputImageList = saveOutputImage(
           [files.frontFile, files.versoFile],
           [files.frontFile, files.versoFile],
           {
           {
@@ -333,28 +181,30 @@ export default {
         );
         );
         const fileInfo = {
         const fileInfo = {
           taskId: this.task.id,
           taskId: this.task.id,
-          taskName: this.task.scanTaskName,
-          courseCode: "",
+          schoolId: this.task.schoolId,
+          examId: this.task.examId,
+          courseCode: this.task.courseCode,
           courseName: this.task.courseName,
           courseName: this.task.courseName,
-          teachingClassName: "1",
           frontOriginImgPath: ouputImageList[0],
           frontOriginImgPath: ouputImageList[0],
           versoOriginImgPath: ouputImageList[1],
           versoOriginImgPath: ouputImageList[1],
-          examNumber: "",
+          isFormal: this.task.isFormal ? 1 : 0,
+          studentCode: "",
           clientUserId: this.user.id,
           clientUserId: this.user.id,
-          clientUsername: this.user.name,
+          clientUsername: this.user.loginName,
           clientUserLoginTime: this.user.loginTime,
           clientUserLoginTime: this.user.loginTime,
         };
         };
 
 
-        if (this.openBarCode) {
+        if (this.task.isFormal) {
           const num = await decodeImageCode(
           const num = await decodeImageCode(
-            ouputImageList[0],
+            fileInfo.frontOriginImgPath,
             this.ocrArea
             this.ocrArea
           ).catch((err) => {
           ).catch((err) => {
             console.error(err);
             console.error(err);
             logger.error(`04-2条码解析失败,${err}`);
             logger.error(`04-2条码解析失败,${err}`);
           });
           });
           console.log(num);
           console.log(num);
-          fileInfo.examNumber = num || "";
+          fileInfo.studentCode = num || "";
+          fileInfo.ocrArea = JSON.stringify(this.ocrArea);
         }
         }
         let res = true;
         let res = true;
         await db.saveUploadInfo(fileInfo).catch((err) => {
         await db.saveUploadInfo(fileInfo).catch((err) => {
@@ -364,11 +214,8 @@ export default {
         });
         });
         if (!res) return Promise.reject();
         if (!res) return Promise.reject();
       }
       }
-    },
-    clearScanList() {
-      this.scaningImageList = [];
-      this.scanHistoryList = [];
-      clearDir(this.GLOBAL.input);
+
+      logger.info(`04-2保存数据结束`);
     },
     },
     // image-preview
     // image-preview
     toViewPaper(imgUrl) {
     toViewPaper(imgUrl) {

+ 4 - 4
src/modules/client/router.js

@@ -1,9 +1,9 @@
-import TaskManage from "./views/TaskManage.vue";
+import Scan from "./views/Scan.vue";
 
 
 export default [
 export default [
   {
   {
-    path: "/task-manage",
-    name: "TaskManage",
-    component: TaskManage,
+    path: "/scan",
+    name: "Scan",
+    component: Scan,
   },
   },
 ];
 ];

+ 47 - 67
src/modules/client/views/TaskManage.vue → src/modules/client/views/Scan.vue

@@ -5,16 +5,14 @@
         <el-form-item>
         <el-form-item>
           <h3 class="filter-title">选择考试</h3>
           <h3 class="filter-title">选择考试</h3>
         </el-form-item>
         </el-form-item>
-        <el-form-item label="档案:">
-          <archives-select
-            v-model="filter.paperArchivesId"
-            placeholder="请选择档案"
-          >
-          </archives-select>
+        <el-form-item>
+          <sec-select v-model="filter" defaultSelectExam></sec-select>
         </el-form-item>
         </el-form-item>
         <el-form-item label-width="0px">
         <el-form-item label-width="0px">
-          <el-button type="primary" @click="search">查询</el-button>
-          <el-button v-if="openBarCode" type="primary" @click="toSetOrcArea"
+          <el-button type="primary" :disabled="!searchEnable" @click="search"
+            >查询</el-button
+          >
+          <el-button type="success" @click="toSetOrcArea"
             >设置条码识别区</el-button
             >设置条码识别区</el-button
           >
           >
         </el-form-item>
         </el-form-item>
@@ -34,26 +32,30 @@
                   <i class="icon icon-person-grid"></i>
                   <i class="icon icon-person-grid"></i>
                   <span>考生总数</span>
                   <span>考生总数</span>
                 </div>
                 </div>
-                <div class="task-info-cont">123</div>
+                <div class="task-info-cont">{{ task.studentCount }}</div>
               </div>
               </div>
               <div class="task-info-item">
               <div class="task-info-item">
                 <div class="task-info-title">
                 <div class="task-info-title">
                   <i class="icon icon-right-grid"></i>
                   <i class="icon icon-right-grid"></i>
                   <span>已扫人数/张数</span>
                   <span>已扫人数/张数</span>
                 </div>
                 </div>
-                <div class="task-info-cont">1231</div>
+                <div class="task-info-cont">
+                  <span>{{ task.scanStudentCount }}</span>
+                  <span>/</span>
+                  <span>{{ task.scanCount }}</span>
+                </div>
               </div>
               </div>
               <div class="task-info-item">
               <div class="task-info-item">
                 <div class="task-info-title">
                 <div class="task-info-title">
                   <i class="icon icon-close-grid"></i>
                   <i class="icon icon-close-grid"></i>
                   <span>未扫人数</span>
                   <span>未扫人数</span>
                 </div>
                 </div>
-                <div class="task-info-cont">111</div>
+                <div class="task-info-cont">{{ unScanStudentCount }}</div>
               </div>
               </div>
             </div>
             </div>
           </div>
           </div>
           <div class="task-part-foot">
           <div class="task-part-foot">
-            <div class="task-btn">
+            <div class="task-btn" @click="toScan(true)">
               <span>开始扫描</span>
               <span>开始扫描</span>
               <i class="icon icon-narrow-right"></i>
               <i class="icon icon-narrow-right"></i>
             </div>
             </div>
@@ -67,7 +69,7 @@
           </div>
           </div>
           <div class="task-part-body"></div>
           <div class="task-part-body"></div>
           <div class="task-part-foot">
           <div class="task-part-foot">
-            <div class="task-btn">
+            <div class="task-btn" @click="toScan(false)">
               <span>开始扫描</span>
               <span>开始扫描</span>
               <i class="icon icon-narrow-right"></i>
               <i class="icon icon-narrow-right"></i>
             </div>
             </div>
@@ -77,51 +79,58 @@
     </el-row>
     </el-row>
 
 
     <!-- OcrAreaSetDialog -->
     <!-- OcrAreaSetDialog -->
-    <ocr-area-set-dialog
-      v-if="openBarCode"
-      ref="OcrAreaSetDialog"
-      @modified="getOcrArea"
-    >
+    <ocr-area-set-dialog ref="OcrAreaSetDialog" @modified="getOcrArea">
     </ocr-area-set-dialog>
     </ocr-area-set-dialog>
+    <!-- ScanTaskProcessDialog -->
+    <scan-task-process-dialog
+      ref="ScanTaskProcessDialog"
+      :task="scanInfo"
+      @on-close="search"
+    ></scan-task-process-dialog>
   </div>
   </div>
 </template>
 </template>
 
 
 <script>
 <script>
 import db from "../../../plugins/db";
 import db from "../../../plugins/db";
-import { taskListPage } from "../api";
+import { taskInfos } from "../api";
+import SecSelect from "@/components/SecSelect.vue";
 import OcrAreaSetDialog from "../components/OcrAreaSetDialog.vue";
 import OcrAreaSetDialog from "../components/OcrAreaSetDialog.vue";
+import ScanTaskProcessDialog from "../components/ScanTaskProcessDialog.vue";
 
 
 export default {
 export default {
-  name: "task-manage",
-  components: { OcrAreaSetDialog },
+  name: "scan",
+  components: { OcrAreaSetDialog, SecSelect, ScanTaskProcessDialog },
   data() {
   data() {
     return {
     return {
       filter: {
       filter: {
-        paperArchivesId: "",
+        semesterId: "",
+        examId: "",
         courseCode: "",
         courseCode: "",
-        isMine: false,
       },
       },
-      current: 1,
-      size: 10,
-      total: 0,
-      dataList: [],
-      curRow: {},
+      task: {},
+      scanInfo: {},
       ocrArea: null,
       ocrArea: null,
     };
     };
   },
   },
   computed: {
   computed: {
-    openBarCode() {
-      return this.$store.state.user.openBarCode;
+    unScanStudentCount() {
+      return (this.task.scanCount || 0) - (this.task.scanStudentCount || 0);
+    },
+    searchEnable() {
+      return (
+        this.filter.semesterId && this.filter.examId && this.filter.courseCode
+      );
     },
     },
   },
   },
   mounted() {
   mounted() {
-    this.getOcrArea();
-    this.search();
+    this.$store.commit("setBreadcrumbs", [{ url: "Scan", name: "扫描" }]);
+    // this.getOcrArea();
+    // this.search();
   },
   },
   methods: {
   methods: {
-    search() {
-      this.cacheData[this.curTab] = {};
-      this.toPage(1);
+    async search() {
+      const res = await taskInfos(this.filter);
+      this.task = res || {};
     },
     },
     async getOcrArea() {
     async getOcrArea() {
       const ocrArea = await db.getDict("ocrArea", "").catch(() => {});
       const ocrArea = await db.getDict("ocrArea", "").catch(() => {});
@@ -131,41 +140,12 @@ export default {
         ocrArea ? JSON.parse(ocrArea) : {}
         ocrArea ? JSON.parse(ocrArea) : {}
       );
       );
     },
     },
-    async getList() {
-      let datas = {
-        pageNumber: this.current,
-        pageSize: this.size,
-      };
-      if (this.curTab === "all") {
-        datas = { ...datas, ...this.filter };
-      } else {
-        datas = { ...datas, isMine: true };
-      }
-      const data = await taskListPage(datas);
-      this.dataList = data.records;
-      this.total = data.total;
-      this.updateTaskCount();
-    },
-    async updateTaskCount() {
-      for (let i = 0; i < this.dataList.length; i++) {
-        const task = this.dataList[i];
-        const scanCount = await db.countScanList({ taskId: task.id });
-        this.$set(task, "clientScanCount", scanCount);
-        const uploadCount = await db.countScanList({
-          taskId: task.id,
-          isUpload: 1,
-        });
-        this.$set(task, "clientUploadCount", uploadCount);
-      }
-    },
-
-    toScan(row) {
-      if (row.enable) return;
-      if (this.openBarCode && !this.ocrArea) {
+    toScan(isFormal) {
+      if (isFormal && !this.ocrArea) {
         this.$message.error("请先设置条形码识别区!");
         this.$message.error("请先设置条形码识别区!");
         return;
         return;
       }
       }
-      this.curRow = row;
+      this.scanInfo = { ...this.task, isFormal };
       this.$refs.ScanTaskProcessDialog.open();
       this.$refs.ScanTaskProcessDialog.open();
     },
     },
     toSetOrcArea() {
     toSetOrcArea() {

+ 1 - 1
src/modules/login/api.js

@@ -4,5 +4,5 @@ export const login = (datas) => {
   return $post("/api/admin/client/user/login", datas);
   return $post("/api/admin/client/user/login", datas);
 };
 };
 export const schoolListQuery = () => {
 export const schoolListQuery = () => {
-  return $post("/api/admin/client/user/login", {});
+  return $post("/api/admin/common/school/list", {});
 };
 };

+ 9 - 3
src/modules/login/views/Login.vue

@@ -23,6 +23,7 @@
             placeholder="请选择学校"
             placeholder="请选择学校"
             name="schoolCode"
             name="schoolCode"
             class="width-full"
             class="width-full"
+            @change="schoolChange"
           >
           >
             <el-option
             <el-option
               v-for="item in schools"
               v-for="item in schools"
@@ -104,13 +105,15 @@ export default {
         ],
         ],
       },
       },
       isSubmit: false,
       isSubmit: false,
+      curSchool: {},
     };
     };
   },
   },
   mounted() {
   mounted() {
     this.$ls.remove("token");
     this.$ls.remove("token");
     this.$ls.remove("user");
     this.$ls.remove("user");
     this.$ls.remove("orgId");
     this.$ls.remove("orgId");
-    this.$ls.remove("schoolId");
+    this.$ls.remove("curSchool");
+    // this.getSchools();
   },
   },
   methods: {
   methods: {
     toSet() {
     toSet() {
@@ -120,6 +123,9 @@ export default {
       const res = await schoolListQuery();
       const res = await schoolListQuery();
       this.schools = res || [];
       this.schools = res || [];
     },
     },
+    schoolChange(val) {
+      this.curSchool = this.schools.find((item) => item.code === val);
+    },
     async submit() {
     async submit() {
       let domain = this.$ls.get("domain");
       let domain = this.$ls.get("domain");
       if (!domain) {
       if (!domain) {
@@ -144,9 +150,9 @@ export default {
 
 
       this.$ls.set("user", data);
       this.$ls.set("user", data);
       this.$store.commit("setUser", data);
       this.$store.commit("setUser", data);
-      if (data.orgInfo) this.$ls.set("orgId", data.orgInfo.id);
-      if (data.schoolInfo) this.$ls.set("schoolId", data.schoolInfo.id);
       this.$ls.set("token", data.accessToken);
       this.$ls.set("token", data.accessToken);
+      this.$ls.set("curSchool", this.curSchool);
+      if (data.orgInfo) this.$ls.set("orgId", data.orgInfo.id);
 
 
       this.$router.push({
       this.$router.push({
         name: "Home",
         name: "Home",

+ 1 - 1
src/plugins/axios.js

@@ -48,7 +48,7 @@ axios.interceptors.request.use(
     if (token) {
     if (token) {
       const ids = {
       const ids = {
         orgId: Vue.ls.get("orgId", ""),
         orgId: Vue.ls.get("orgId", ""),
-        schoolId: Vue.ls.get("schoolId", ""),
+        schoolId: Vue.ls.get("curSchool", { id: "" }).id,
         userId: Vue.ls.get("user", { id: "" }).id,
         userId: Vue.ls.get("user", { id: "" }).id,
       };
       };
       Object.entries(ids).forEach(([key, val]) => {
       Object.entries(ids).forEach(([key, val]) => {

+ 22 - 5
src/plugins/db.js

@@ -60,22 +60,25 @@ function serializeWhere(params) {
 
 
 // scan
 // scan
 function saveUploadInfo(params) {
 function saveUploadInfo(params) {
-  const sql = `INSERT INTO scan (taskId, taskName, courseCode, courseName, teachingClassName, frontOriginImgPath, versoOriginImgPath, examNumber,clientUserId, clientUsername, clientUserLoginTime, isUpload,createdTime, finishTime) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)`;
+  const sql = `INSERT INTO scan (taskId, schoolId, semesterId, examId, courseCode, courseName, frontOriginImgPath, versoOriginImgPath, studentCode, ocrArea, isFormal, clientUserId, clientUsername, clientUserLoginTime, isUpload,createdTime, finishTime) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)`;
   const datas = [
   const datas = [
     params.taskId,
     params.taskId,
-    params.taskName,
+    params.schoolId,
+    params.semesterId,
+    params.examId,
     params.courseCode,
     params.courseCode,
     params.courseName,
     params.courseName,
-    params.teachingClassName,
     params.frontOriginImgPath,
     params.frontOriginImgPath,
     params.versoOriginImgPath,
     params.versoOriginImgPath,
-    params.examNumber,
+    params.studentCode,
+    params.ocrArea,
+    params.isFormal,
     params.clientUserId,
     params.clientUserId,
     params.clientUsername,
     params.clientUsername,
     params.clientUserLoginTime,
     params.clientUserLoginTime,
     0, // isUpload
     0, // isUpload
     formatDate(), // createdTime
     formatDate(), // createdTime
-    null,
+    null, // finishTime
   ];
   ];
   return new Promise((resolve, reject) => {
   return new Promise((resolve, reject) => {
     db.serialize(() => {
     db.serialize(() => {
@@ -100,6 +103,19 @@ function searchUploadList(params) {
   });
   });
 }
 }
 
 
+function searchHistoryList(params) {
+  const { where, whereData } = serializeWhere(params);
+
+  const sql = `SELECT * FROM scan WHERE ${where} LIMIT 100 OFFSET 0 ORDER BY id DESC`;
+
+  return new Promise((resolve, reject) => {
+    db.all(sql, whereData, (err, rows) => {
+      if (err) reject("search info fail!");
+      resolve(rows);
+    });
+  });
+}
+
 function countScanList(params) {
 function countScanList(params) {
   const { where, whereData } = serializeWhere(params);
   const { where, whereData } = serializeWhere(params);
   const sql = `SELECT COUNT(1) AS count FROM scan WHERE ${where}`;
   const sql = `SELECT COUNT(1) AS count FROM scan WHERE ${where}`;
@@ -211,6 +227,7 @@ export default {
   // scan
   // scan
   saveUploadInfo,
   saveUploadInfo,
   searchUploadList,
   searchUploadList,
+  searchHistoryList,
   countScanList,
   countScanList,
   getUploadCount,
   getUploadCount,
   updateUploadState,
   updateUploadState,

+ 6 - 3
src/plugins/db.sql

@@ -18,13 +18,16 @@ DROP TABLE IF EXISTS "scan";
 CREATE TABLE "scan" (
 CREATE TABLE "scan" (
   "id" INTEGER NOT NULL,
   "id" INTEGER NOT NULL,
   "taskId" text NOT NULL,
   "taskId" text NOT NULL,
-  "taskName" TEXT,
+  "schoolId" text NOT NULL,
+  "semesterId" text NOT NULL,
+  "examId" text NOT NULL,
   "courseCode" text NOT NULL,
   "courseCode" text NOT NULL,
   "courseName" TEXT NOT NULL,
   "courseName" TEXT NOT NULL,
-  "teachingClassName" text NOT NULL,
   "frontOriginImgPath" TEXT,
   "frontOriginImgPath" TEXT,
   "versoOriginImgPath" TEXT,
   "versoOriginImgPath" TEXT,
-  "examNumber" TEXT,
+  "studentCode" TEXT,
+  "ocrArea" TEXT,
+  "isFormal" integer NOT NULL DEFAULT 0,
   "isUpload" integer NOT NULL DEFAULT 0,
   "isUpload" integer NOT NULL DEFAULT 0,
   "clientUserId" text NOT NULL,
   "clientUserId" text NOT NULL,
   "clientUsername" text NOT NULL,
   "clientUsername" text NOT NULL,

+ 0 - 6
src/plugins/globalVuePlugins.js

@@ -2,16 +2,10 @@ import { objAssign, randomCode } from "@/plugins/utils";
 import globalMixins from "./mixins";
 import globalMixins from "./mixins";
 import ViewHeader from "@/components/ViewHeader.vue";
 import ViewHeader from "@/components/ViewHeader.vue";
 import ViewFooter from "@/components/ViewFooter.vue";
 import ViewFooter from "@/components/ViewFooter.vue";
-import ArchivesSelect from "../components/base/ArchivesSelect.vue";
-import CourseSelect from "../components/base/CourseSelect.vue";
-import TeachClazzSelect from "../components/base/TeachClazzSelect.vue";
 
 
 const components = {
 const components = {
   ViewFooter,
   ViewFooter,
   ViewHeader,
   ViewHeader,
-  ArchivesSelect,
-  CourseSelect,
-  TeachClazzSelect,
 };
 };
 
 
 export default {
 export default {

+ 10 - 3
src/plugins/imageUpload.js

@@ -1,7 +1,7 @@
 const fs = window.nodeRequire("fs");
 const fs = window.nodeRequire("fs");
 const path = window.nodeRequire("path");
 const path = window.nodeRequire("path");
 const crypto = window.require("crypto");
 const crypto = window.require("crypto");
-import { uploadFormalImage } from "../modules/client/api";
+import { uploadImage } from "../modules/client/api";
 import { Message } from "element-ui";
 import { Message } from "element-ui";
 
 
 /**
 /**
@@ -24,9 +24,16 @@ function toUploadImg(options) {
   formData.append("versoFile", versoFile);
   formData.append("versoFile", versoFile);
 
 
   formData.append("paperScanTaskId", options.taskId);
   formData.append("paperScanTaskId", options.taskId);
-  formData.append("studentCode", options.examNumber);
+  formData.append("studentCode", options.studentCode);
 
 
-  return uploadFormalImage(formData);
+  if (options.isFormal && options.ocrArea) {
+    const ocrArea = JSON.parse(options.ocrArea);
+    Object.keys(ocrArea).forEach((k) => {
+      formData.append(k, ocrArea[k]);
+    });
+  }
+
+  return uploadImage(options.isFormal, formData);
 }
 }
 
 
 function getFileAdnMd5(filepath) {
 function getFileAdnMd5(filepath) {

+ 1 - 1
src/router.js

@@ -27,7 +27,7 @@ let router = new Router({
       path: "/home",
       path: "/home",
       name: "Home",
       name: "Home",
       component: Home,
       component: Home,
-      redirect: { name: "TaskManage" },
+      redirect: { name: "Scan" },
       children: [...client],
       children: [...client],
     },
     },
     { ...test },
     { ...test },

+ 4 - 0
src/store.js

@@ -10,6 +10,7 @@ export default new Vuex.Store({
   state: {
   state: {
     user: {},
     user: {},
     domain: "",
     domain: "",
+    breadcrumbs: [],
   },
   },
   mutations: {
   mutations: {
     setUser(state, user) {
     setUser(state, user) {
@@ -21,6 +22,9 @@ export default new Vuex.Store({
     setSchoolCode(state, schoolCode) {
     setSchoolCode(state, schoolCode) {
       state.schoolCode = schoolCode;
       state.schoolCode = schoolCode;
     },
     },
+    setBreadcrumbs(state, breadcrumbs) {
+      state.breadcrumbs = breadcrumbs;
+    },
   },
   },
   actions: {},
   actions: {},
   modules: {
   modules: {

+ 10 - 9
src/views/Home.vue

@@ -16,13 +16,13 @@
         <ul>
         <ul>
           <li>
           <li>
             <i class="icon icon-org"></i>
             <i class="icon icon-org"></i>
-            <span>{{ schoolName }}</span>
+            <span>{{ curSchool.name }}</span>
           </li>
           </li>
           <li>
           <li>
             <i class="icon icon-user-fill"></i>
             <i class="icon icon-user-fill"></i>
             <span>{{ userName }}</span>
             <span>{{ userName }}</span>
           </li>
           </li>
-          <li>
+          <li class="hover" @click="toBack">
             <i class="icon icon-logout"></i>
             <i class="icon icon-logout"></i>
             <span>退出</span>
             <span>退出</span>
           </li>
           </li>
@@ -42,18 +42,19 @@ export default {
   name: "home",
   name: "home",
   mixins: [uploadTaskMixin, setTimeMixins],
   mixins: [uploadTaskMixin, setTimeMixins],
   data() {
   data() {
-    return {};
+    return {
+      userName: this.$ls.get("user", { realName: "" }).realName,
+      curSchool: this.$ls.get("curSchool", {}),
+    };
   },
   },
   created() {
   created() {
+    console.log(this.curSchool);
     this.initUploadTask();
     this.initUploadTask();
-    this.updateUnuploadCount();
+    // this.updateUnuploadCount();
   },
   },
   computed: {
   computed: {
     breadcrumbs() {
     breadcrumbs() {
-      return [];
-    },
-    schoolName() {
-      return "";
+      return this.$store.state.breadcrumbs;
     },
     },
   },
   },
   methods: {
   methods: {
@@ -67,7 +68,7 @@ export default {
       }, 2 * 1000);
       }, 2 * 1000);
     },
     },
     toBack() {
     toBack() {
-      if (this.$route.name === "TaskManage") {
+      if (this.$route.name === "Scan") {
         this.$confirm("确定要退出采集吗?", "提示", {
         this.$confirm("确定要退出采集吗?", "提示", {
           type: "warning",
           type: "warning",
         })
         })