<template>
  <div class="code-gen-select-factor">
    <div class="toolbar">
      <pro-action
        text="保存为数据集"
        toComponentUrl="save-dataset"
        icon="el-icon-receiving"
      />
      <pro-action
        icon="el-icon-tickets"
        :splitButton="true"
        :command="$store.previewTemplatesDataSource[0]"
        @handler="handerSelectPreviewTemplate"
        :text="$store.previewTemplatesDataSource[0].label"
        helpText="高级部分模板,参考下来菜单"
        type="primary"
        ui-type="dropdown"
      >
        <template slot="subActions">
          <pro-sub-action
            v-for="(item) in $store.previewTemplatesDataSource"
            :command="item"
            :key="item.value"
            @handler="handerSelectPreviewTemplate"
            :text="item.label"
            icon="el-icon-tickets"
            />
        </template>
      </pro-action>
    </div>
    <el-form :model="$store.currentDataSet" class="pro-full-height-contaner" size="mini">
      <pro-full-height :decrease="-50">
        <template slot-scope="{ height }">
          <pro-form-list
            ref="formlist"
            selectModel="multiple"
            emptyText="暂无数据集要素"
            prop="datas"
            dataKey="name"
            editType="row"
            type="tables"
            :height="parseInt(height) + 'px'"
          >
            <pro-input
              label="label"
              uiType="text"
              prop="label"
              min-width="100px"
              is-edit
            />
            <pro-input
              label="prop"
              uiType="text"
              prop="prop"
              min-width="100px"
              is-edit
            />
            <pro-select
            label="UI"
            uiType="list"
            width="120px"
            dataSource="UI_TYPE"
            prop="uiType"
            is-edit
          />
          <pro-select
            label="null?"
            uiType="checks"
            width="80px"
            dataSource="YES_OR_NOT"
            prop="noempty"
            is-edit
          />
          </pro-form-list>
        </template>
      </pro-full-height>
    </el-form>
  </div>
</template>
<script>
export default {
  data(){
    this.$store.selectfactor = this
    return {}
  },
  methods: {
    handerSelectPreviewTemplate(item){
      this.$store.selectPreviewTemplate = item
    }
  }
}
</script>
<style lang="scss">
.code-gen-select-factor {
  height: 100%;
  width: 700px;
  display: flex;
  border-right: 1px solid #ebebeb;
  flex-direction: column;
  .toolbar {
    height: 40px;
    line-height: 40px;
    border-bottom: 1px solid #ebebeb;
    margin-top: 10px;
    text-align: right;
    padding: 0px 10px;
  }
}
</style>