<template>
  <div class="export-paper">
    <Row :gutter="20" type="flex">
      <Col span="12">
        <div class="part-box">
          <div class="part-title">
            <h2>分数图片导出</h2>
          </div>
          <Form label-position="left" inline>
            <FormItem>
              <Select v-model="scoreFilter.imageType" placeholder="图片类型">
                <Option
                  v-for="(val, key) in IMAGE_TYPE"
                  :key="key"
                  :value="key * 1"
                  >{{ val }}</Option
                >
              </Select>
            </FormItem>
            <FormItem>
              <Select v-model="scoreFilter.areaCode" placeholder="考点">
                <Option value=""></Option>
              </Select>
            </FormItem>
            <FormItem>
              <Select v-model="scoreFilter.schoolId" placeholder="学校">
                <Option value=""></Option>
              </Select>
            </FormItem>
            <FormItem>
              <Select v-model="scoreFilter.examRoom" placeholder="考场">
                <Option value=""></Option>
              </Select>
            </FormItem>
            <FormItem>
              <Select v-model="scoreFilter.subjectId" placeholder="科目">
                <Option value=""></Option>
              </Select>
            </FormItem>
            <FormItem>
              <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>
              <InputNumber
                v-model="scoreFilter.startNumber"
                :min="1"
                :precision="0"
                placeholder="输入起始分数"
                clearable
              ></InputNumber>
            </FormItem>
            <FormItem>
              <InputNumber
                v-model="scoreFilter.endNumber"
                :min="scoreFilter.startNumber"
                :precision="0"
                placeholder="输入终止分数"
                clearable
              ></InputNumber>
            </FormItem>
          </Form>

          <Button
            class="export-paper-btn"
            type="primary"
            shape="circle"
            @click="toExport('score')"
            >导出</Button
          >
        </div>
      </Col>
      <Col span="12">
        <div class="part-box">
          <div class="part-title">
            <h2>图片解密、重命名导出</h2>
          </div>
          <Form label-position="left" inline>
            <FormItem>
              <Select v-model="renameFilter.imageType" placeholder="图片类型">
                <Option
                  v-for="(val, key) in IMAGE_TYPE"
                  :key="key"
                  :value="key * 1"
                  >{{ val }}</Option
                >
              </Select>
            </FormItem>
            <FormItem>
              <Select v-model="renameFilter.areaCode" placeholder="考点">
                <Option value=""></Option>
              </Select>
            </FormItem>
            <FormItem>
              <Select v-model="renameFilter.subjectId" placeholder="科目">
                <Option value=""></Option>
              </Select>
            </FormItem>
            <br />
          </Form>
          <Button
            class="export-paper-btn"
            type="primary"
            shape="circle"
            @click="toExport('rename')"
            >导出</Button
          >
        </div>
      </Col>
    </Row>
  </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>
