<template>
      <div>
            <functionBar class="F_bar" />
    <b-container fluid>
      <b-row class="no-padding" style="padding-top: 70px">
        <b-col cols="12">
          <submitProjectName style="margin-left: 0px" ref="submitprojectName" @isEdit="isEdit" @isSaved="isSaved" />
        </b-col>
      </b-row>
      <b-row>
        <submitTable style="margin-left: 0px" ref="submitTable" @isedit="isedit" @ispatch="ispatch"/>
      </b-row>
    </b-container>
      </div>
</template>

<script>
import functionBar from '@/views/FileManagement/FileEdit/functionBar.vue'
import submitProjectName from '@/views/FileManagement/FileEdit/submitProjectName.vue'
import submitTable from '@/views/FileManagement/FileEdit/submitTable.vue'
export default {
  data () {
    return {
      toName: ''
    }
  },
  beforeRouteLeave (to, from, next) {
    if (this.isFix === true || this.isfix === true) {
      const answer = window.confirm('尚未儲存，確定離開當前畫面?')
      if (answer) {
        next()
      } else {
        next(false)
      }
    } else {
      next()
    }
  },
  // mounted () {
  //   this.toName = this.$route.params.toName
  // },
  components: {
    functionBar,
    submitProjectName,
    submitTable
  },
  methods: {
    // isDeliver () {
    //   this.$refs.submitTable.isDeliver()
    // },
    isedit () {
      this.isFix = true
    },
    ispatch () {
      this.isFix = false
    },
    isEdit () {
      this.isfix = true
    },
    isSaved () {
      this.isfix = false
    }
  },
  watch: {
    // $route: function (to, from) {
    //   // if (this.$route.router.from('/FileSubmitList')) {

    //   // } else if () {

    //   // }
    //   console.log(to)
    //   console.log(from)
    //   // if (this.$router.history.listen('/FileSubmitList')) {
    //   //   console.log(123)
    //   //   this.isButton = false
    //   // } else if (this.$router.history.listen('/Deliver')) {
    //   //   console.log(456)
    //   //   this.isButton = true
    //   // }
    // }
  }
}
</script>

<style >

</style>
