
<template>
  <div class="app-content" style="height: 70vh;overflow: auto;">
    <a-spin :spinning="loading" style="width: 100%;height: 100%;">
      <div class="page-content">
        <project-edit v-model="value" @onSave="onSave" @load="onLoad" ref="projCreate" v-if="projType"></project-edit>
        <project-edit-key v-model="value" @onSave="onSave" @load="onLoad" ref="projCreate" v-else></project-edit-key>
      </div>
      <div class="page-footer">
        <a-button @click="save">保存</a-button>
        <a-button style="margin-left: 10px" type="primary" @click="submit">完成填写</a-button>
      </div>
    </a-spin>
  </div>
</template>

<script>
import { getType } from '@/views/utils/auth'
import projectEdit from "@/views/report/project/components/projectEdit"
import projectEditKey from "@/views/report/project/components/keyProject/projectEdit"
export default {
  name: "projectCreate",
  components: {
    projectEdit, projectEditKey,
  },
  data () {
    return {
      loading: false,
      projType: getType() == "1"
    }
  },
  props: {
    value: {
      type: String,
      default: () => {
        return null
      }
    }
  },
  created () {
  },
  methods: {
    save () {
      this.$refs.projCreate.save()
    },
    submit () {
      this.$refs.projCreate.submit()
    },
    onSave (value) {
      this.$emit('closeWindow', value)
    },
    onLoad (value) {
      this.loading = value
    },
  },
}
</script>
<style scoped lang="less">
.page-content {
  width: 100%;
  height: calc(100% - 40px);
  overflow: auto;
}
.page-footer {
  width: 100%;
  height: 40px;
  line-height: 40px;
  background: rgb(248, 248, 248);
  text-align: center;
}
</style>


