<template>
  <div class="export-paper">
    <div class="part-box">
      <div class="part-title">
        <h2>分数图片导出</h2>
      </div>
      <Form label-position="left" inline>
        <FormItem label="图片类型：">
          <Select v-model="scoreFilter.imageType" placeholder="请选择图片类型">
            <Option
              v-for="(val, key) in IMAGE_TYPE"
              :key="key"
              :value="key * 1"
              >{{ val }}</Option
            >
          </Select>
        </FormItem>
        <FormItem label="考点：">
          <Select v-model="scoreFilter.areaCode" placeholder="请选择考点">
            <Option value=""></Option>
          </Select>
        </FormItem>
        <FormItem label="学校：">
          <Select v-model="scoreFilter.schoolId" placeholder="请选择学校">
            <Option value=""></Option>
          </Select>
        </FormItem>
        <FormItem label="考场：">
          <Select v-model="scoreFilter.examRoom" placeholder="请选择考场">
            <Option value=""></Option>
          </Select>
        </FormItem>
        <FormItem label="科目：">
          <Select v-model="scoreFilter.subjectId" placeholder="请选择科目">
            <Option value=""></Option>
          </Select>
        </FormItem>
        <FormItem label="命名规则：">
          <Select v-model="scoreFilter.nameRule" placeholder="请选择命名规则">
            <Option
              v-for="(val, key) in EXPORT_IMAGE_NAME_TYPE"
              :key="key"
              :value="key * 1"
              >{{ val }}</Option
            >
          </Select>
        </FormItem>
        <FormItem label="起始分数：">
          <InputNumber
            v-model="scoreFilter.startNumber"
            placeholder="请输入数字"
            clearable
          ></InputNumber>
        </FormItem>
        <FormItem label="终止分数：">
          <InputNumber
            v-model="scoreFilter.endNumber"
            placeholder="请输入数字"
            clearable
          ></InputNumber>
        </FormItem>
        <FormItem>
          <Button type="primary" icon="md-download" @click="toExport('score')"
            >导出</Button
          >
        </FormItem>
      </Form>
    </div>

    <div class="part-box">
      <div class="part-title">
        <h2>图片解密、重命名导出</h2>
      </div>
      <Form label-position="left" inline>
        <FormItem label="图片类型：">
          <Select v-model="renameFilter.imageType" placeholder="请选择图片类型">
            <Option
              v-for="(val, key) in IMAGE_TYPE"
              :key="key"
              :value="key * 1"
              >{{ val }}</Option
            >
          </Select>
        </FormItem>
        <FormItem label="考点：">
          <Select v-model="renameFilter.areaCode" placeholder="请选择考点">
            <Option value=""></Option>
          </Select>
        </FormItem>
        <FormItem label="科目：">
          <Select v-model="renameFilter.subjectId" placeholder="请选择科目">
            <Option value=""></Option>
          </Select>
        </FormItem>
        <FormItem>
          <Button type="primary" icon="md-download" @click="toExport('rename')"
            >导出</Button
          >
        </FormItem>
      </Form>
    </div>
  </div>
</template>

<script>
import { IMAGE_TYPE, EXPORT_IMAGE_NAME_TYPE } from "@/constants/enumerate";

export default {
  name: "export-paper",
  data() {
    return {
      scoreFilter: {
        imageType: "",
        areaCode: "",
        examRoom: "",
        schoolID: "",
        subjectId: "",
        nameRule: "",
        startNumber: null,
        endNumber: null
      },
      renameFilter: {
        imageType: "",
        areaCode: "",
        subjectId: ""
      },
      IMAGE_TYPE,
      EXPORT_IMAGE_NAME_TYPE
    };
  },
  methods: {
    toExport(type) {
      console.log(this[`${type}Filter`]);
    }
  }
};
</script>
