<template>
  <div id="achieve-1">
    <el-row>
      <el-col :span="24" class="main">
        <el-col :span="24" class="one">
          <el-form ref="form" :model="form" label-width="100px">
            <el-form-item label="成绩导入文件">
              <s-upload :limit="1" :data="form.uri" type="uri" listType="" :url="uri" @upload="uplSuc" @delete="uplDel"></s-upload>
            </el-form-item>
            <el-form-item>
              <el-button type="danger" size="mini" @click="achClose">取消导入</el-button>
              <el-button type="primary" size="mini" @click="twoSubmit">提交导入</el-button>
            </el-form-item>
          </el-form>
        </el-col>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import { mapState, createNamespacedHelpers } from 'vuex';
export default {
  name: 'achieve-1',
  props: { form: { type: Object }, uri: { type: String, default: '/files/baoan/examAchieve/upload' } },
  components: {},
  data: function () {
    return {};
  },
  created() {},
  methods: {
    // 取消导入
    achClose() {
      this.$emit('achClose');
    },
    // 提交导入
    twoSubmit() {
      this.$emit('twoSubmit', { data: this.form });
    },
    // 上传图片
    uplSuc({ type, data }) {
      this.$set(this.form, `${type}`, data.uri);
    },
    uplDel({ type }) {
      this.$set(this.form, `${type}`, null);
    },
  },
  computed: {
    ...mapState(['user']),
  },
  metaInfo() {
    return { title: this.$route.meta.title };
  },
  watch: {
    test: {
      deep: true,
      immediate: true,
      handler(val) {},
    },
  },
};
</script>

<style lang="less" scoped></style>
