<template>
  <Modal v-model="showModal" :width="800" class="modal-footer-none">
    <p slot="header">{{modalTitle}}</p>
    <div>
      <!-- 表格 -->
      <form id="sub-rel-form">
        <input v-model="standardId" type="hidden" name="standardId"/>
      </form>
      <Row>
        <Col span="24">
        <element-table ref="pageTable" @on-result-change="_tableResultChange"
                      :getPage="getPage" table-height="300"  hide-checkbox>
          <el-table-column
            :prop="item.key"
            :label="item.title"
            :min-width="item.width"
            :fixed="item.fixed?item.fixed:undefined"
            v-for="item in pageColumns"
            :key="item.id"
            sortable show-overflow-tooltip>
            <template slot-scope="scope">
              <span>{{scope.row[item.key]}}</span>
            </template>
          </el-table-column>
        </element-table>
        </Col>
      </Row>
    </div>
  </Modal>
</template>

<script>
export default {
  components: {},
  data() {
    return {
      showModal: false,
      modalTitle: '替代关系',
      pageColumns: [
        { title: '标准号', key: 'standardNum' },
        { title: '替代标准号(旧)', key: 'standardInsteadNum' },
        { title: '被替代标准号（新）', key: 'standardInsteadedNum' }
      ],
      getPage: {},
      // 选中的内容
      selectIds: [],
      // 多选
      standardId: ''
    }
  },
  methods: {
    _open(id) {
      this.showModal = true
      this.standardId = id
      $('input[name=standardId]').val(id)
      this._page()
    },
    // 获取数据
    _page() {
      console.log('page')
      // this.$refs.pageTable._page('sub-rel-form', 'StandardInstead/page')
    },
    // 表格内容
    _tableResultChange(msg, data) {
      switch (msg) {
        case 'page':
          this._page()
          // this.getPage = this.$store.state.StandardInstead.page
          break
        case 'selectIds':
          this.selectIds = data
          break
        case 'iconClick':
          this._iconClick(data.name, data.rowData)
          break
        default:
          this._page()
      }
    }
  }
}
</script>
