<template>
  <div class="excelHtnl">
    <div class="header">
      <div
        class="GoBack"
        @click="GoBack()"
      >
        返回上一级
      </div>
      <div>
        <el-button
          type="info"
          size="small"
          @click="setUptype=0"
        >设置输入框</el-button>
        <el-button
          type="info"
          size="small"
          @click="setUptype=1"
        >电签位置配置</el-button>
        <el-button
          type="success"
          size="small"
          @click="setUptype=2"
        >设置公式开放条件</el-button>
        <el-button
          type="primary"
          size="small"
          @click="setUptype=3"
        >编辑默认信息</el-button>
      </div>
    </div>
    <div class="excelBox">
      <div
        style="width:60%;"
        class='parent'
        id='parent'
      ></div>
      <div
        class="excelRight"
        style="width:30%;margin-left:6%;"
      >
        <setInputTPT
          v-if="setUptype===0"
          :pkeyId='pkeyId'
          @cop='domss'
        />
        <electronicSignature v-if="setUptype===1" />
        <setFormula v-if="setUptype===2" />
        <editDefault v-if="setUptype===3" />
      </div>
    </div>
  </div>
</template>

<script>
import setInputTPT from './template/setInputTPT.vue'
import electronicSignature from './template/electronicSignature.vue'
import setFormula from './template/setFormula.vue'
import editDefault from './template/editDefault.vue'
import Vue from 'vue'
// import dictVue from '../../../system/dict.vue'
export default {
  props: ['pkeyId'],
  data () {
    return {
      setUptype: 0,//右侧显示的类型1
    }
  },
  mounted () {
    this.cop()
  },
  methods: {
    GoBack () {//返回上一级
      this.$emit('remove')
    },
    async cop () {
      var MyComponent = await Vue.extend({
        template: localStorage.getItem('excelHtml')
      })
      var component = new MyComponent().$mount()
      let na = document.getElementById('parent')
      document.getElementById('parent').appendChild(component.$el);
    },
    async copss () {
      var MyComponent = await Vue.extend({
        template: localStorage.getItem('excelHtml')
      })
      var component = new MyComponent().$mount()
      let na = document.getElementById('parent')
      na.innerHTML = `<div
        class='parent'
        id='parent'
      ></div>`
      document.getElementById('parent').appendChild(component.$el);
    },
    domss () {
      this.copss()
    },
  },
  components: {
    setInputTPT,
    electronicSignature,
    setFormula,
    editDefault
  }
}
</script>

<style lang="scss" scoped>
.excelHtnl {
  margin: 0 0 0 10px;
  background-color: #fff;
  box-sizing: border-box;
  padding: 0 20px 100px 20px;
  height: 100%;
  overflow: scroll;
  .header {
    display: flex;
    justify-content: space-between;
    height: 50px;
    align-items: center;
    .GoBack {
      color: rgba(0, 82, 216, 1);
      text-decoration: underline;
      font-family: SourceHanSansSC;
      cursor: pointer;
    }
  }
  .excelBox {
    margin-top: 10px;
    display: flex;
    justify-content: flex-start;
    .excelRight {
      flex-grow: 1;
      box-sizing: border-box;
      padding: 20px 0px 0px 30px;
    }
  }
}
</style>



 