<template>
  <div id="enterpriseStandard">
    <div
      style="display: flex; margin-bottom: 12px;"
    >
     <el-input v-model="enterpriseStandard" />
    </div>
    <div class="comFile">
      <p>
        <el-tag effect="dark" @close="close(i)" v-for="v,i in enterpriseStandardFile" :key="v.id" size="mini" closable>{{ v.foldername }}</el-tag>
      </p>
      <div class="button-group">
        <el-button type="primary"  @click="clickInput">选择</el-button>
      </div>
    </div>
  </div>
</template>
<script>

export default {
  data() {
    return {
      enterpriseStandardFile: [],
      enterpriseStandard: ""
    };
  },
  watch:{
    enterpriseStandard: {
      handler(val){
        window.basFlow.controls[this.$root.control.id].enterpriseStandard = val
      }
    }
  },
  mounted() {
    if(this.$root.control.enterpriseStandardFile && this.$root.control.enterpriseStandardFile.length > 0) {
      this.enterpriseStandardFile = this.$root.control.enterpriseStandardFile;
    }
    this.enterpriseStandard = this.$root.control.enterpriseStandard
  },
  methods: {
    clickInput(){
      $("#selectEnterprise").click();
    },
    close(index){
      this.enterpriseStandardFile.splice(index, 1)
      window.basFlow.controls[this.$root.control.id].enterpriseStandardFile = this.enterpriseStandardFile
      // window.basFlow.controls[this.$root.control.id] = {
      //   ...window.basFlow.controls[this.$root.control.id],
      //   enterpriseStandardFile: this.enterpriseStandardFile
      // }
    }
  }
};
</script>
<style lang="scss" scoped>
/deep/ .el-tag{
  padding: 0 8px;
  overflow: hidden;
  margin-right: 10px;
  cursor: pointer;
  .el-tag__close {
    transform: scale(1);
  }
}
.comFile {
  display: flex;
  flex-wrap: wrap;
  p {
    width: 330px;
  }
  .button-group {
    width: 80px;
    text-align: right;
  }
}
</style>
