智慧保安考试系统
liuyg
2021-10-09 2bd7308602abe6dee89f848d12923431150558f1
去掉控制台打印
5 files modified
1481 ■■■■ changed files
src/components/Subjects/Choices/index.vue 164 ●●●● patch | view | raw | blame | history
src/components/Subjects/PracticalOperation/index.vue 6 ●●●● patch | view | raw | blame | history
src/views/base/region.vue 767 ●●●●● patch | view | raw | blame | history
src/views/resource/attach.vue 518 ●●●● patch | view | raw | blame | history
src/views/startexam/index.vue 26 ●●●● patch | view | raw | blame | history
src/components/Subjects/Choices/index.vue
@@ -1,95 +1,101 @@
<template>
    <div>
        <div class="subject-content">
            <div class="subject-title">
                {{ index }}
                <span class="subject-title-content"
                      v-html="subjectInfo.subjectName" />
                <span class="subject-title-content">
                    (&nbsp;单选题&nbsp;<span v-if="subjectInfo.score !== undefined && subjectInfo.score !== 0">&nbsp;{{subjectInfo.score}}分&nbsp;</span>)
                </span>
            </div>
  <div>
    <div class="subject-content">
      <div class="subject-title">
        {{ index }}
        <span class="subject-title-content" v-html="subjectInfo.subjectName" />
        <span class="subject-title-content">
          (&nbsp;单选题&nbsp;<span
            v-if="subjectInfo.score !== undefined && subjectInfo.score !== 0"
            >&nbsp;{{ subjectInfo.score }}分&nbsp;</span
          >)
        </span>
      </div>
            <ul class="subject-options"
                id="subjectOptions"
                v-for="option in options"
                :key="option.id">
                <li class="subject-option">
                    <input
                            :disabled="currentAnswer"
                            class="toggle"
                           type="checkbox"
                           :checked="userAnswer === option.optionName"
                           :id="'option' + option.id"
                           @change="toggleOption(option)">
                    <label :for="'option' + option.id">
                        <span class="subject-option-prefix">{{ option.optionName + '.' }}&nbsp;</span>
                        <span v-html="option.optionContent"
                              class="subject-option-prefix" />
                    </label>
                </li>
            </ul>
        </div>
      <ul
        class="subject-options"
        id="subjectOptions"
        v-for="option in options"
        :key="option.id"
      >
        <li class="subject-option">
          <input
            :disabled="currentAnswer"
            class="toggle"
            type="checkbox"
            :checked="userAnswer === option.optionName"
            :id="'option' + option.id"
            @change="toggleOption(option)"
          />
          <label :for="'option' + option.id">
            <span class="subject-option-prefix"
              >{{ option.optionName + "." }}&nbsp;</span
            >
            <span v-html="option.optionContent" class="subject-option-prefix" />
          </label>
        </li>
      </ul>
    </div>
  </div>
</template>
<script>
export default {
    name: 'Choices',
    data () {
        return {
            subjectCount: 0,
            subjectInfo: {
                subjectName: '',
                score: 0
            },
            options: [],
            userAnswer: '',
            index: '',
            currentAnswer: false,
        }
  name: "Choices",
  data() {
    return {
      subjectCount: 0,
      subjectInfo: {
        subjectName: "",
        score: 0,
      },
      options: [],
      userAnswer: "",
      index: "",
      currentAnswer: false,
    };
  },
  methods: {
    getAnswer() {
      return this.userAnswer;
    },
    methods: {
        getAnswer () {
            return this.userAnswer
        },
        setAnswer (answer) {
            this.userAnswer = answer
        },
        setSubjectInfo (subject, subjectCount, index) {
            this.currentAnswer = false
            this.subjectCount = subjectCount
            this.subjectInfo = subject
            if (subject.hasOwnProperty('examSubjectOptions')) {
                this.options = subject.examSubjectOptions
    setAnswer(answer) {
      this.userAnswer = answer;
    },
    setSubjectInfo(subject, subjectCount, index) {
      this.currentAnswer = false;
      this.subjectCount = subjectCount;
      this.subjectInfo = subject;
      if (subject.hasOwnProperty("examSubjectOptions")) {
        this.options = subject.examSubjectOptions;
                console.log(this.options)
            }
            if (subject.hasOwnProperty('answer')) {
                if (subject.answer) {
                    this.currentAnswer = true
                }
                this.setAnswer(subject.answer)
            }
            this.index = index + '.'
            console.log(subject, subjectCount, index, this.options, 5656565656)
        },
        getSubjectInfo () {
            this.subjectInfo.options = this.options
            return this.subjectInfo
        },
        // 选中选项
        toggleOption (option) {
            this.userAnswer = option.optionName
        // console.log(this.options)
      }
      if (subject.hasOwnProperty("answer")) {
        if (subject.answer) {
          this.currentAnswer = true;
        }
    }
}
        this.setAnswer(subject.answer);
      }
      this.index = index + ".";
      // console.log(subject, subjectCount, index, this.options, 5656565656)
    },
    getSubjectInfo() {
      this.subjectInfo.options = this.options;
      return this.subjectInfo;
    },
    // 选中选项
    toggleOption(option) {
      this.userAnswer = option.optionName;
    },
  },
};
</script>
<style lang="scss" scoped>
@import '../../../assets/css/subject.scss';
@import "../../../assets/css/subject.scss";
.subject-options > li label {
    line-height: 36px !important;
  line-height: 36px !important;
}
</style>
src/components/Subjects/PracticalOperation/index.vue
@@ -55,7 +55,7 @@
      return this.userAnswer;
    },
    setAnswer(answer, option) {
      console.log(answer);
      //   console.log(answer);
      if (answer != "") {
        this.userAnswer = answer;
      } else {
@@ -131,9 +131,9 @@
        });
      }
      console.log(this.userAnswer, 123);
      //   console.log(this.userAnswer, 123);
      for (var k in this.userAnswer) {
        console.log(this.userAnswer[k]);
        // console.log(this.userAnswer[k]);
      }
    },
src/views/base/region.vue
@@ -4,7 +4,11 @@
      <div class="box">
        <el-scrollbar>
          <basic-container>
            <avue-tree :option="treeOption" :data="treeData" @node-click="nodeClick"/>
            <avue-tree
              :option="treeOption"
              :data="treeData"
              @node-click="nodeClick"
            />
          </basic-container>
        </el-scrollbar>
      </div>
@@ -12,26 +16,75 @@
    <el-col :span="15">
      <basic-container>
        <el-button-group>
          <el-button v-if="permission.region_add" type="primary" size="small" icon="el-icon-circle-plus-outline" @click="addChildren">新增下级</el-button>
          <el-button v-if="permission.region_delete" type="primary" size="small" icon="el-icon-delete" @click="handleDelete">删除</el-button>
          <el-button v-if="permission.region_import" type="primary" size="small" icon="el-icon-upload2" @click="handleImport">导入</el-button>
          <el-button v-if="permission.region_export" type="primary" size="small" icon="el-icon-download" @click="handleExport">导出</el-button>
          <el-button v-if="permission.region_debug" type="primary" size="small" icon="el-icon-video-play" @click="handleDebug">调试</el-button>
          <el-button
            v-if="permission.region_add"
            type="primary"
            size="small"
            icon="el-icon-circle-plus-outline"
            @click="addChildren"
            >新增下级</el-button
          >
          <el-button
            v-if="permission.region_delete"
            type="primary"
            size="small"
            icon="el-icon-delete"
            @click="handleDelete"
            >删除</el-button
          >
          <el-button
            v-if="permission.region_import"
            type="primary"
            size="small"
            icon="el-icon-upload2"
            @click="handleImport"
            >导入</el-button
          >
          <el-button
            v-if="permission.region_export"
            type="primary"
            size="small"
            icon="el-icon-download"
            @click="handleExport"
            >导出</el-button
          >
          <el-button
            v-if="permission.region_debug"
            type="primary"
            size="small"
            icon="el-icon-video-play"
            @click="handleDebug"
            >调试</el-button
          >
        </el-button-group>
      </basic-container>
      <basic-container>
        <avue-form ref="form" :option="regionOption" v-model="regionForm" @submit="handleSubmit">
        <avue-form
          ref="form"
          :option="regionOption"
          v-model="regionForm"
          @submit="handleSubmit"
        >
          <template slot="code" slot-scope="{}">
            <el-input placeholder="请输入 区划子编号" v-model="regionForm.subCode">
              <template slot="prepend">{{regionForm.parentCode}}</template>
            <el-input
              placeholder="请输入 区划子编号"
              v-model="regionForm.subCode"
            >
              <template slot="prepend">{{ regionForm.parentCode }}</template>
            </el-input>
          </template>
        </avue-form>
        <el-dialog title="行政区划数据导入"
                   append-to-body
                   :visible.sync="excelBox"
                   width="555px">
          <avue-form :option="excelOption" v-model="excelForm" :upload-after="uploadAfter">
        <el-dialog
          title="行政区划数据导入"
          append-to-body
          :visible.sync="excelBox"
          width="555px"
        >
          <avue-form
            :option="excelOption"
            v-model="excelForm"
            :upload-after="uploadAfter"
          >
            <template slot="excelTemplate">
              <el-button type="primary" @click="handleTemplate">
                点击下载<i class="el-icon-download el-icon--right"></i>
@@ -39,11 +92,13 @@
            </template>
          </avue-form>
        </el-dialog>
        <el-dialog title="行政区划数据调试"
                   append-to-body
                   :visible.sync="debugBox"
                   width="350px">
          <avue-form :option="debugOption" v-model="debugForm"/>
        <el-dialog
          title="行政区划数据调试"
          append-to-body
          :visible.sync="debugBox"
          width="350px"
        >
          <avue-form :option="debugOption" v-model="debugForm" />
        </el-dialog>
      </basic-container>
    </el-col>
@@ -51,367 +106,399 @@
</template>
<script>
  import {getLazyTree, getDetail, submit, remove} from "@/api/base/region";
  import {mapGetters} from "vuex";
  import {validatenull} from "@/util/validate";
  import {getToken} from "@/util/auth";
import { getLazyTree, getDetail, submit, remove } from "@/api/base/region";
import { mapGetters } from "vuex";
import { validatenull } from "@/util/validate";
import { getToken } from "@/util/auth";
  export default {
    data() {
      return {
        topCode: '00',
        treeCode: '',
        treeParentCode: '',
        treeData: [],
        treeOption: {
          nodeKey: 'id',
          lazy: true,
          treeLoad: function (node, resolve) {
            const parentCode = (node.level === 0) ? "00" : node.data.id;
            getLazyTree(parentCode).then(res => {
              resolve(res.data.data.map(item => {
export default {
  data() {
    return {
      topCode: "00",
      treeCode: "",
      treeParentCode: "",
      treeData: [],
      treeOption: {
        nodeKey: "id",
        lazy: true,
        treeLoad: function (node, resolve) {
          const parentCode = node.level === 0 ? "00" : node.data.id;
          getLazyTree(parentCode).then((res) => {
            resolve(
              res.data.data.map((item) => {
                return {
                  ...item,
                  leaf: !item.hasChildren
                }
              }))
            });
          },
          addBtn: false,
          menu: false,
          size: 'small',
          props: {
            labelText: '标题',
            label: 'title',
            value: 'value',
            children: 'children'
          }
                  leaf: !item.hasChildren,
                };
              })
            );
          });
        },
        regionForm: {},
        regionOption: {
          labelWidth: 100,
          column: [
            {
              label: "父区划编号",
              prop: "parentCode",
              span: 24,
              disabled: true,
              rules: [{
        addBtn: false,
        menu: false,
        size: "small",
        props: {
          labelText: "标题",
          label: "title",
          value: "value",
          children: "children",
        },
      },
      regionForm: {},
      regionOption: {
        labelWidth: 100,
        column: [
          {
            label: "父区划编号",
            prop: "parentCode",
            span: 24,
            disabled: true,
            rules: [
              {
                required: true,
                message: "请输入父区划编号",
                trigger: "blur"
              }]
            },
            {
              label: "父区划名称",
              prop: "parentName",
              span: 24,
              disabled: true,
            },
            {
              label: "区划编号",
              prop: "code",
              formslot: true,
              span: 24,
              rules: [{
                trigger: "blur",
              },
            ],
          },
          {
            label: "父区划名称",
            prop: "parentName",
            span: 24,
            disabled: true,
          },
          {
            label: "区划编号",
            prop: "code",
            formslot: true,
            span: 24,
            rules: [
              {
                required: true,
                message: "请输入区划编号",
                trigger: "blur"
              }]
            },
            {
              label: "区划子编号",
              prop: "subCode",
              display: false,
            },
            {
              label: "区划名称",
              prop: "name",
              span: 24,
              rules: [{
                trigger: "blur",
              },
            ],
          },
          {
            label: "区划子编号",
            prop: "subCode",
            display: false,
          },
          {
            label: "区划名称",
            prop: "name",
            span: 24,
            rules: [
              {
                required: true,
                message: "请输入区划名称",
                trigger: "blur"
              }]
            },
            {
              label: "区划等级",
              prop: "regionLevel",
              type: "radio",
              dicUrl: "/api/blade-system/dict/dictionary?code=region",
              props: {
                label: "dictValue",
                value: "dictKey"
                trigger: "blur",
              },
              dataType: "number",
              span: 24,
              rules: [{
            ],
          },
          {
            label: "区划等级",
            prop: "regionLevel",
            type: "radio",
            dicUrl: "/api/blade-system/dict/dictionary?code=region",
            props: {
              label: "dictValue",
              value: "dictKey",
            },
            dataType: "number",
            span: 24,
            rules: [
              {
                required: true,
                message: "请选择区划等级",
                trigger: "blur"
              }]
            },
            {
              label: "区划排序",
              prop: "sort",
              type: "number",
              span: 24,
              rules: [{
                trigger: "blur",
              },
            ],
          },
          {
            label: "区划排序",
            prop: "sort",
            type: "number",
            span: 24,
            rules: [
              {
                required: true,
                message: "请输入区划排序",
                trigger: "blur"
              }]
            },
            {
              label: "区划备注",
              prop: "remark",
              type: "textarea",
              minRows: 6,
              span: 24,
            },
          ]
        },
        excelBox: false,
        excelForm: {},
        excelOption: {
          submitBtn: false,
          emptyBtn: false,
          column: [
            {
              label: '模板上传',
              prop: 'excelFile',
              type: 'upload',
              drag: true,
              loadText: '模板上传中,请稍等',
              span: 24,
              propsHttp: {
                res: 'data'
                trigger: "blur",
              },
              tip: '请上传 .xls,.xlsx 标准格式文件',
              action: "/api/blade-system/region/import-region"
            ],
          },
          {
            label: "区划备注",
            prop: "remark",
            type: "textarea",
            minRows: 6,
            span: 24,
          },
        ],
      },
      excelBox: false,
      excelForm: {},
      excelOption: {
        submitBtn: false,
        emptyBtn: false,
        column: [
          {
            label: "模板上传",
            prop: "excelFile",
            type: "upload",
            drag: true,
            loadText: "模板上传中,请稍等",
            span: 24,
            propsHttp: {
              res: "data",
            },
            {
              label: "数据覆盖",
              prop: "isCovered",
              type: "switch",
              align: "center",
              width: 80,
              dicData: [
                {
                  label: "否",
                  value: 0
                },
                {
                  label: "是",
                  value: 1
                }
              ],
              value: 0,
              slot: true,
              rules: [
                {
                  required: true,
                  message: "请选择是否覆盖",
                  trigger: "blur"
                }
              ]
            },
            {
              label: '模板下载',
              prop: 'excelTemplate',
              formslot: true,
              span: 24,
            }
          ]
        },
        debugBox: false,
        debugForm: {},
        debugOption: {
          labelWidth: 50,
          submitBtn: false,
          emptyBtn: false,
          column: [
            {
              label: '省份',
              prop: 'province',
              type: 'select',
              props: {
                label: 'name',
                value: 'code'
            tip: "请上传 .xls,.xlsx 标准格式文件",
            action: "/api/blade-system/region/import-region",
          },
          {
            label: "数据覆盖",
            prop: "isCovered",
            type: "switch",
            align: "center",
            width: 80,
            dicData: [
              {
                label: "否",
                value: 0,
              },
              cascaderItem: ['city', 'district'],
              dicUrl: '/api/blade-system/region/select',
              span: 24,
            },
            {
              label: '地市',
              prop: 'city',
              type: 'select',
              props: {
                label: 'name',
                value: 'code'
              {
                label: "是",
                value: 1,
              },
              dicFlag: false,
              dicUrl: '/api/blade-system/region/select?code={{key}}',
              span: 24,
            },
            {
              label: '区县',
              prop: 'district',
              type: 'select',
              props: {
                label: 'name',
                value: 'code'
            ],
            value: 0,
            slot: true,
            rules: [
              {
                required: true,
                message: "请选择是否覆盖",
                trigger: "blur",
              },
              dicFlag: false,
              dicUrl: '/api/blade-system/region/select?code={{key}}',
              span: 24,
            }
          ]
        }
            ],
          },
          {
            label: "模板下载",
            prop: "excelTemplate",
            formslot: true,
            span: 24,
          },
        ],
      },
      debugBox: false,
      debugForm: {},
      debugOption: {
        labelWidth: 50,
        submitBtn: false,
        emptyBtn: false,
        column: [
          {
            label: "省份",
            prop: "province",
            type: "select",
            props: {
              label: "name",
              value: "code",
            },
            cascaderItem: ["city", "district"],
            dicUrl: "/api/blade-system/region/select",
            span: 24,
          },
          {
            label: "地市",
            prop: "city",
            type: "select",
            props: {
              label: "name",
              value: "code",
            },
            dicFlag: false,
            dicUrl: "/api/blade-system/region/select?code={{key}}",
            span: 24,
          },
          {
            label: "区县",
            prop: "district",
            type: "select",
            props: {
              label: "name",
              value: "code",
            },
            dicFlag: false,
            dicUrl: "/api/blade-system/region/select?code={{key}}",
            span: 24,
          },
        ],
      },
    };
  },
  watch: {
    "regionForm.subCode"() {
      this.regionForm.code =
        this.regionForm.parentCode + this.regionForm.subCode;
    },
    "excelForm.isCovered"() {
      if (this.excelForm.isCovered !== "") {
        const column = this.findObject(this.excelOption.column, "excelFile");
        column.action = `/api/blade-system/region/import-region?isCovered=${this.excelForm.isCovered}`;
      }
    },
  },
  computed: {
    ...mapGetters(["permission"]),
    permissionList() {
      return {
        addBtn: this.vaildData(this.permission.region_add, false),
        viewBtn: this.vaildData(this.permission.region_view, false),
        delBtn: this.vaildData(this.permission.region_delete, false),
        editBtn: this.vaildData(this.permission.region_edit, false),
      };
    },
    watch: {
      'regionForm.subCode'() {
        this.regionForm.code = this.regionForm.parentCode + this.regionForm.subCode;
      },
      'excelForm.isCovered'() {
        if (this.excelForm.isCovered !== '') {
          const column = this.findObject(this.excelOption.column, "excelFile");
          column.action = `/api/blade-system/region/import-region?isCovered=${this.excelForm.isCovered}`;
        }
      }
    ids() {
      let ids = [];
      this.selectionList.forEach((ele) => {
        ids.push(ele.id);
      });
      return ids.join(",");
    },
    computed: {
      ...mapGetters(["permission"]),
      permissionList() {
        return {
          addBtn: this.vaildData(this.permission.region_add, false),
          viewBtn: this.vaildData(this.permission.region_view, false),
          delBtn: this.vaildData(this.permission.region_delete, false),
          editBtn: this.vaildData(this.permission.region_edit, false)
        };
      },
      ids() {
        let ids = [];
        this.selectionList.forEach(ele => {
          ids.push(ele.id);
  },
  methods: {
    initTree() {
      this.treeData = [];
      getLazyTree(this.topCode).then((res) => {
        this.treeData = res.data.data.map((item) => {
          return {
            ...item,
            leaf: !item.hasChildren,
          };
        });
        return ids.join(",");
      }
      });
    },
    methods: {
      initTree() {
        this.treeData = [];
        getLazyTree(this.topCode).then(res => {
          this.treeData = res.data.data.map(item => {
            return {
              ...item,
              leaf: !item.hasChildren
            }
          })
        });
      },
      nodeClick(data) {
        const column = this.findObject(this.regionOption.column, "parentCode");
        column.disabled = true;
        this.treeCode = data.id;
        this.treeParentCode = data.parentId;
        getDetail(this.treeCode).then(res => {
          this.regionForm = res.data.data;
          this.regionForm.subCode = this.regionForm.code.replace(this.regionForm.parentCode, '');
        })
      },
      addChildren() {
        if (validatenull(this.regionForm.code) || validatenull(this.regionForm.name)) {
          this.$message.warning("请先选择一项区划");
          return;
        }
        this.regionForm.parentCode = this.regionForm.code;
        this.regionForm.parentName = this.regionForm.name;
        this.regionForm.code = '';
        this.regionForm.subCode = '';
        this.regionForm.name = '';
        this.regionForm.regionLevel = (this.regionForm.regionLevel === 5) ? 5 : this.regionForm.regionLevel + 1;
      },
      handleSubmit(form, done, loading) {
        const parentCode = form.parentCode === this.topCode ? '' : form.parentCode;
        form.code = parentCode + form.subCode;
        submit(form).then(() => {
    nodeClick(data) {
      const column = this.findObject(this.regionOption.column, "parentCode");
      column.disabled = true;
      this.treeCode = data.id;
      this.treeParentCode = data.parentId;
      getDetail(this.treeCode).then((res) => {
        this.regionForm = res.data.data;
        this.regionForm.subCode = this.regionForm.code.replace(
          this.regionForm.parentCode,
          ""
        );
      });
    },
    addChildren() {
      if (
        validatenull(this.regionForm.code) ||
        validatenull(this.regionForm.name)
      ) {
        this.$message.warning("请先选择一项区划");
        return;
      }
      this.regionForm.parentCode = this.regionForm.code;
      this.regionForm.parentName = this.regionForm.name;
      this.regionForm.code = "";
      this.regionForm.subCode = "";
      this.regionForm.name = "";
      this.regionForm.regionLevel =
        this.regionForm.regionLevel === 5 ? 5 : this.regionForm.regionLevel + 1;
    },
    handleSubmit(form, done, loading) {
      const parentCode =
        form.parentCode === this.topCode ? "" : form.parentCode;
      form.code = parentCode + form.subCode;
      submit(form).then(
        () => {
          this.$message({
            type: "success",
            message: "操作成功!"
            message: "操作成功!",
          });
          this.initTree();
          this.regionForm.subCode = '';
          this.regionForm.subCode = "";
          this.$refs.form.resetForm();
          done();
        }, error => {
        },
        (error) => {
          loading();
          window.console.log(error);
        });
      },
      handleDelete() {
        if (validatenull(this.regionForm.code)) {
          this.$message.warning("请先选择一项区划");
          return;
        }
        this.$confirm(`确定将 [${this.regionForm.name}] 数据删除?`, {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
      );
    },
    handleDelete() {
      if (validatenull(this.regionForm.code)) {
        this.$message.warning("请先选择一项区划");
        return;
      }
      this.$confirm(`确定将 [${this.regionForm.name}] 数据删除?`, {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          return remove(this.treeCode);
        })
          .then(() => {
            return remove(this.treeCode);
          })
          .then(() => {
            this.$message({
              type: "success",
              message: "操作成功!"
            });
            this.initTree();
            this.regionForm.subCode = '';
            this.$refs.form.resetForm();
        .then(() => {
          this.$message({
            type: "success",
            message: "操作成功!",
          });
      },
      uploadAfter(res, done, loading, column) {
        window.console.log(column);
        this.excelBox = false;
        this.initTree();
        done();
      },
      handleDebug() {
        this.debugBox = true;
      },
      handleImport() {
        this.excelBox = true;
      },
      handleExport() {
        this.$confirm("是否导出行政区划数据?", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(() => {
          window.open(`/api/blade-system/region/export-region?${this.website.tokenHeader}=${getToken()}`);
          this.initTree();
          this.regionForm.subCode = "";
          this.$refs.form.resetForm();
        });
      },
      handleTemplate() {
        window.open(`/api/blade-system/region/export-template?${this.website.tokenHeader}=${getToken()}`);
      },
    }
  };
    },
    uploadAfter(res, done, loading, column) {
      // window.console.log(column);
      this.excelBox = false;
      this.initTree();
      done();
    },
    handleDebug() {
      this.debugBox = true;
    },
    handleImport() {
      this.excelBox = true;
    },
    handleExport() {
      this.$confirm("是否导出行政区划数据?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      }).then(() => {
        window.open(
          `/api/blade-system/region/export-region?${
            this.website.tokenHeader
          }=${getToken()}`
        );
      });
    },
    handleTemplate() {
      window.open(
        `/api/blade-system/region/export-template?${
          this.website.tokenHeader
        }=${getToken()}`
      );
    },
  },
};
</script>
<style>
  .box {
    height: 800px;
  }
.box {
  height: 800px;
}
  .el-scrollbar {
    height: 100%;
  }
.el-scrollbar {
  height: 100%;
}
  .box .el-scrollbar__wrap {
    overflow: scroll;
  }
.box .el-scrollbar__wrap {
  overflow: scroll;
}
</style>
src/views/resource/attach.vue
@@ -1,287 +1,317 @@
<template>
  <basic-container>
    <avue-crud :option="option"
               :table-loading="loading"
               :data="data"
               :page.sync="page"
               :permission="permissionList"
               :before-open="beforeOpen"
               v-model="form"
               ref="crud"
               @row-del="rowDel"
               @search-change="searchChange"
               @search-reset="searchReset"
               @selection-change="selectionChange"
               @current-change="currentChange"
               @size-change="sizeChange"
               @refresh-change="refreshChange"
               @on-load="onLoad">
    <avue-crud
      :option="option"
      :table-loading="loading"
      :data="data"
      :page.sync="page"
      :permission="permissionList"
      :before-open="beforeOpen"
      v-model="form"
      ref="crud"
      @row-del="rowDel"
      @search-change="searchChange"
      @search-reset="searchReset"
      @selection-change="selectionChange"
      @current-change="currentChange"
      @size-change="sizeChange"
      @refresh-change="refreshChange"
      @on-load="onLoad"
    >
      <template slot="menuLeft">
        <el-button type="primary"
                   size="small"
                   plain
                   v-if="permission.attach_upload"
                   icon="el-icon-upload2"
                   @click="handleUpload">上 传
        <el-button
          type="primary"
          size="small"
          plain
          v-if="permission.attach_upload"
          icon="el-icon-upload2"
          @click="handleUpload"
          >上 传
        </el-button>
        <el-button type="danger"
                   size="small"
                   icon="el-icon-delete"
                   plain
                   v-if="permission.attach_delete"
                   @click="handleDelete">删 除
        <el-button
          type="danger"
          size="small"
          icon="el-icon-delete"
          plain
          v-if="permission.attach_delete"
          @click="handleDelete"
          >删 除
        </el-button>
      </template>
      <template slot-scope="scope" slot="menu">
        <el-button type="text"
                   icon="el-icon-download"
                   size="small"
                   v-if="permission.attach_download"
                   @click="handleDownload(scope.row)">下载
        <el-button
          type="text"
          icon="el-icon-download"
          size="small"
          v-if="permission.attach_download"
          @click="handleDownload(scope.row)"
          >下载
        </el-button>
      </template>
      <template slot-scope="{row}"
                slot="attachSize">
        <el-tag>{{`${row.attachSize} KB`}}</el-tag>
      <template slot-scope="{ row }" slot="attachSize">
        <el-tag>{{ `${row.attachSize} KB` }}</el-tag>
      </template>
    </avue-crud>
    <el-dialog title="附件管理"
               append-to-body
               :visible.sync="attachBox"
               width="555px">
      <avue-form ref="form" :option="attachOption" v-model="attachForm" :upload-after="uploadAfter">
    <el-dialog
      title="附件管理"
      append-to-body
      :visible.sync="attachBox"
      width="555px"
    >
      <avue-form
        ref="form"
        :option="attachOption"
        v-model="attachForm"
        :upload-after="uploadAfter"
      >
      </avue-form>
    </el-dialog>
  </basic-container>
</template>
<script>
  import {getList, getDetail, remove} from "@/api/resource/attach";
  import {mapGetters} from "vuex";
import { getList, getDetail, remove } from "@/api/resource/attach";
import { mapGetters } from "vuex";
  export default {
    data() {
      return {
        form: {},
        query: {},
        loading: true,
        page: {
          pageSize: 10,
          currentPage: 1,
          total: 0
        },
        attachBox: false,
        selectionList: [],
        option: {
          height: 'auto',
          calcHeight: 30,
          tip: false,
          searchShow: true,
          searchMenuSpan: 6,
          border: true,
          index: true,
          viewBtn: true,
          selection: true,
          dialogClickModal: false,
          column: [
            {
              label: "附件地址",
              prop: "link",
              rules: [{
export default {
  data() {
    return {
      form: {},
      query: {},
      loading: true,
      page: {
        pageSize: 10,
        currentPage: 1,
        total: 0,
      },
      attachBox: false,
      selectionList: [],
      option: {
        height: "auto",
        calcHeight: 30,
        tip: false,
        searchShow: true,
        searchMenuSpan: 6,
        border: true,
        index: true,
        viewBtn: true,
        selection: true,
        dialogClickModal: false,
        column: [
          {
            label: "附件地址",
            prop: "link",
            rules: [
              {
                required: true,
                message: "请输入附件地址",
                trigger: "blur"
              }]
            },
            {
              label: "附件域名",
              prop: "domain",
              search: true,
              rules: [{
                trigger: "blur",
              },
            ],
          },
          {
            label: "附件域名",
            prop: "domain",
            search: true,
            rules: [
              {
                required: true,
                message: "请输入附件域名",
                trigger: "blur"
              }]
            },
            {
              label: "附件名称",
              prop: "name",
              search: true,
              rules: [{
                trigger: "blur",
              },
            ],
          },
          {
            label: "附件名称",
            prop: "name",
            search: true,
            rules: [
              {
                required: true,
                message: "请输入附件名称",
                trigger: "blur"
              }]
            },
            {
              label: "附件原名",
              prop: "originalName",
              search: true,
              rules: [{
                trigger: "blur",
              },
            ],
          },
          {
            label: "附件原名",
            prop: "originalName",
            search: true,
            rules: [
              {
                required: true,
                message: "请输入附件原名",
                trigger: "blur"
              }]
            },
            {
              label: "附件拓展名",
              prop: "extension",
              rules: [{
                trigger: "blur",
              },
            ],
          },
          {
            label: "附件拓展名",
            prop: "extension",
            rules: [
              {
                required: true,
                message: "请输入附件拓展名",
                trigger: "blur"
              }]
            },
            {
              label: "附件大小",
              prop: "attachSize",
              slot: true,
              rules: [{
                trigger: "blur",
              },
            ],
          },
          {
            label: "附件大小",
            prop: "attachSize",
            slot: true,
            rules: [
              {
                required: true,
                message: "请输入附件大小",
                trigger: "blur"
              }]
            },
          ]
        },
        data: [],
        attachForm: {},
        attachOption: {
          submitBtn: false,
          emptyBtn: false,
          column: [
            {
              label: '附件上传',
              prop: 'attachFile',
              type: 'upload',
              drag: true,
              loadText: '模板上传中,请稍等',
              span: 24,
              propsHttp: {
                res: 'data'
                trigger: "blur",
              },
              action: "/api/blade-resource/oss/endpoint/put-file-attach"
            }
          ]
        }
            ],
          },
        ],
      },
      data: [],
      attachForm: {},
      attachOption: {
        submitBtn: false,
        emptyBtn: false,
        column: [
          {
            label: "附件上传",
            prop: "attachFile",
            type: "upload",
            drag: true,
            loadText: "模板上传中,请稍等",
            span: 24,
            propsHttp: {
              res: "data",
            },
            action: "/api/blade-resource/oss/endpoint/put-file-attach",
          },
        ],
      },
    };
  },
  computed: {
    ...mapGetters(["permission"]),
    permissionList() {
      return {
        addBtn: false,
        editBtn: false,
        viewBtn: false,
        delBtn: this.vaildData(this.permission.attach_delete, false),
      };
    },
    computed: {
      ...mapGetters(["permission"]),
      permissionList() {
        return {
          addBtn: false,
          editBtn: false,
          viewBtn: false,
          delBtn: this.vaildData(this.permission.attach_delete, false)
        };
      },
      ids() {
        let ids = [];
        this.selectionList.forEach(ele => {
          ids.push(ele.id);
        });
        return ids.join(",");
      }
    ids() {
      let ids = [];
      this.selectionList.forEach((ele) => {
        ids.push(ele.id);
      });
      return ids.join(",");
    },
    methods: {
      handleUpload() {
        this.attachBox = true;
      },
      uploadAfter(res, done, loading, column) {
        window.console.log(column);
        this.attachBox = false;
        this.refreshChange();
        done();
      },
      handleDownload(row) {
        window.open(`${row.link}`);
      },
      rowDel(row) {
        this.$confirm("确定将选择数据删除?", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
  },
  methods: {
    handleUpload() {
      this.attachBox = true;
    },
    uploadAfter(res, done, loading, column) {
      // window.console.log(column);
      this.attachBox = false;
      this.refreshChange();
      done();
    },
    handleDownload(row) {
      window.open(`${row.link}`);
    },
    rowDel(row) {
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          return remove(row.id);
        })
          .then(() => {
            return remove(row.id);
          })
          .then(() => {
            this.onLoad(this.page);
            this.$message({
              type: "success",
              message: "操作成功!"
            });
        .then(() => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
      },
      handleDelete() {
        if (this.selectionList.length === 0) {
          this.$message.warning("请选择至少一条数据");
          return;
        }
        this.$confirm("确定将选择数据删除?", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        });
    },
    handleDelete() {
      if (this.selectionList.length === 0) {
        this.$message.warning("请选择至少一条数据");
        return;
      }
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          return remove(this.ids);
        })
          .then(() => {
            return remove(this.ids);
          })
          .then(() => {
            this.onLoad(this.page);
            this.$message({
              type: "success",
              message: "操作成功!"
            });
            this.$refs.crud.toggleSelection();
        .then(() => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
      },
      beforeOpen(done, type) {
        if (["edit", "view"].includes(type)) {
          getDetail(this.form.id).then(res => {
            this.form = res.data.data;
          });
        }
        done();
      },
      searchReset() {
        this.query = {};
        this.onLoad(this.page);
      },
      searchChange(params, done) {
        this.query = params;
        this.page.currentPage = 1;
        this.onLoad(this.page, params);
        done();
      },
      selectionChange(list) {
        this.selectionList = list;
      },
      selectionClear() {
        this.selectionList = [];
        this.$refs.crud.toggleSelection();
      },
      currentChange(currentPage) {
        this.page.currentPage = currentPage;
      },
      sizeChange(pageSize) {
        this.page.pageSize = pageSize;
      },
      refreshChange() {
        this.onLoad(this.page, this.query);
      },
      onLoad(page, params = {}) {
        this.loading = true;
        getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
          const data = res.data.data;
          this.page.total = data.total;
          this.data = data.records;
          this.loading = false;
          this.selectionClear();
          this.$refs.crud.toggleSelection();
        });
    },
    beforeOpen(done, type) {
      if (["edit", "view"].includes(type)) {
        getDetail(this.form.id).then((res) => {
          this.form = res.data.data;
        });
      }
    }
  };
      done();
    },
    searchReset() {
      this.query = {};
      this.onLoad(this.page);
    },
    searchChange(params, done) {
      this.query = params;
      this.page.currentPage = 1;
      this.onLoad(this.page, params);
      done();
    },
    selectionChange(list) {
      this.selectionList = list;
    },
    selectionClear() {
      this.selectionList = [];
      this.$refs.crud.toggleSelection();
    },
    currentChange(currentPage) {
      this.page.currentPage = currentPage;
    },
    sizeChange(pageSize) {
      this.page.pageSize = pageSize;
    },
    refreshChange() {
      this.onLoad(this.page, this.query);
    },
    onLoad(page, params = {}) {
      this.loading = true;
      getList(
        page.currentPage,
        page.pageSize,
        Object.assign(params, this.query)
      ).then((res) => {
        const data = res.data.data;
        this.page.total = data.total;
        this.data = data.records;
        this.loading = false;
        this.selectionClear();
      });
    },
  },
};
</script>
<style>
src/views/startexam/index.vue
@@ -351,7 +351,7 @@
    },
    startExam(currentTime) {
      var scoreId = window.localStorage.getItem("scoreId");
      console.log(scoreId, this.first, "scoreIdscoreIdscoreIdscoreId");
      // console.log(scoreId, this.first, "scoreIdscoreIdscoreIdscoreId");
      this.subjectIds = [];
      // if (this.first) {
      //   const current = currentTime.valueOf();
@@ -365,7 +365,7 @@
      if (!this.first) {
        getSubjectRefresh(scoreId).then((obj) => {
          const objs = obj.data.data;
          console.log(objs, "objobjobjobjobjobj");
          // console.log(objs, "objobjobjobjobjobj");
          const subjectData = objs.examSubjectChoicesVOSList;
          if (subjectData.length > 0) {
            //重载题目
@@ -506,11 +506,11 @@
      getSubjectIds(scoreId)
        .then((subjectResponse) => {
          const subjectData = subjectResponse.data.data;
          console.log(
            subjectResponse,
            "subjectResponsesubjectResponsesubjectResponse"
          );
          console.log(subjectData, "subjectDatasubjectDatasubjectData");
          // console.log(
          //   subjectResponse,
          //   "subjectResponsesubjectResponsesubjectResponse"
          // );
          // console.log(subjectData, "subjectDatasubjectDatasubjectData");
          if (subjectData.length > 0) {
            for (let i = 0; i < subjectData.length; i++) {
              this.subjectIds.push({
@@ -647,7 +647,7 @@
          if (response.data.data !== null) {
            // 保存成功后更新答题卡状态
            const subject = response.data.data;
            console.log(subject.answer, 123456);
            // console.log(subject.answer, 123456);
            //结果
            this.result = response.data.data.result;
@@ -769,9 +769,9 @@
      this.subjectIndex = index + 1;
      this.firstFlag = true;
      // 保存当前题目,同时加载下一题
      console.log(nextSubjectType.next, 111);
      console.log(everyID, 222);
      console.log(type, 333);
      // console.log(nextSubjectType.next, 111);
      // console.log(everyID, 222);
      // console.log(type, 333);
      this.saveCurrentSubjectAndGetNextSubject(
        nextSubjectType.next,
        everyID,
@@ -782,7 +782,7 @@
    },
    // 提交
    submitExam(val) {
      console.log(val);
      // console.log(val);
      var ind = this.subjectIndex;
      if (this.firstFlag == false) {
@@ -858,7 +858,7 @@
          });
        }
      }
      console.log(arr);
      // console.log(arr);
      // return;
      obj.examResultVOS = arr;
      // console.log(this.subjectIds);