G<template>
  <div>
    <div class="edit-container">
      <div class="edit-top">
        <div class="left-top">
          <img src="@/assets/images/back.png" @click="cancel()" />
          <div class="left-title"></div>
        </div>
        <div class="center-top">
          {{ form.bdmc }}
        </div>
        <div class="right-top">
          <el-button @click="cancel()">{{ $t('form.cancel') }}</el-button>
          <el-button type="primary" @click="save">填报</el-button>
        </div>
      </div>
      <div class="edit-content ">
        表单详情todo
      </div>
    </div>
  </div>
</template>

<script>
import { studyFormPre_tb, studyFormPre_info } from "@/api/business/study/studyFormPre"
import { mapGetters } from 'vuex'

export default {
  name: "Xq",
  components: {},
  data() {
    return {
      open: false,
      showIndex: 1,
      form: {},
      rules: {
        bdmc: [{
          required: true,
          message: ' ',
          trigger: 'blur'
        }],
        templateId: [{
          required: true,
          message: ' ',
          trigger: 'blur'
        }]

      }
    }
  },
  computed: {
    ...mapGetters([
      'nickName'
    ]),
  },
  created() {
  },
  methods: {
    cancel() {
      this.$emit('close')
    },
    reset() {
      this.form = {
        id: null,
        studyId: null,
        bdbh: null,
        bdmc: null,
        bdsm: null,
        templateId: null,
        templateMc: null,
        bdnr: null
      }
      this.resetForm("form")
    },
    edit(row) {
      this.reset()
      this.$modal.loading()
      studyFormPre_info({ id: row.id }).then(response => {
        this.form = response.data
        this.open = true
        this.$modal.closeLoading()
      })
    },
    save() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          this.$modal.loading()
          studyFormPre_tb(this.form).then(response => {
            this.$emit('close')
            this.$modal.closeLoading()
          })
        }
      })
    }
  }
}
</script>
