relevantBaseline.vue 2.74 KB
/**
 * @Description: 相关基线
 * @author 李亦康
 * @date 2020/11/2
*/
<template>
  <div class="relevant-baseline">
    <dee-table
      :index-row="{title:'序号',width: '60'}"
      :data="baselineData"
      :columns="baselineColumns"
    >
      <div slot="header" class="version-select">
        <el-select v-model="type" size="small" @change="typeChange">
          <el-option
            v-for="item in versionData"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          />
        </el-select>
      </div>
    </dee-table>
  </div>
</template>

<script>
import { linkColor } from '../styles/variables.scss'

export default {
  name: 'RelevantBaseline',
  components: {},
  props: {
    basicData: {
      type: Object,
      required: true
    }
  },
  data() {
    const that = this
    const link = {
      color: linkColor,
      cursor: 'pointer'
    }
    return {
      type: '1',
      versionData: [{
        value: '1',
        label: '全部版本'
      },
      {
        value: '2',
        label: '修订版本'
      },
      {
        value: '3',
        label: '当前版本'
      }],
      baselineData: [],
      baselineColumns: [
        {
          title: '编号', key: 'name', align: 'center',
          component: {
            render: function(h, data) {
              return <span style={link} v-on:click={() => {
                that.jump(data)
              }}>{data.displayVersion}</span>
            }
          }
        },
        {
          title: '名称', key: 'name1', align: 'center',
          component: {
            render: function(h, data) {
              return <span style={link} v-on:click={() => {
                that.jump(data)
              }}>{data.displayVersion}</span>
            }
          }
        },
        {
          title: '包含所选件的版本',
          key: 'displayVersion',
          align: 'center'
        },
        {
          title: '基线类型', key: 'name1', align: 'center'
        },
        { title: '状态', key: 'state', width: 80, align: 'center' },
        { title: '上次修改时间', key: 'modifyTime', sortable: true, align: 'center' }
      ]
    }
  },
  computed: {},
  watch: {
    basicData: {
      deep: true,
      handler: function(val) {
        if (Object.keys(val).length > 0) {
          this.typeChange('1')
        }
      },
      immediate: true
    }
  },
  mounted: function() {
    this.$nextTick(function() {
    })
  },
  methods: {
    // 跳转到对应对象详情页
    jump(data) {
    },
    typeChange(type) {
      this.baselineData = []
    }
  }
}
</script>
<style lang="scss" scoped>
.relevant-baseline{
  .version-select {
    width: 100%;
    display: flex;
    justify-content: flex-end;
  }
}
</style>