<template>
  <section>
    <nav-bar title="设备维修执行"></nav-bar>
    <section class="content mgt186">
      <div class="filter-wraper">
        <search-box
        label="设备"
        v-model="val1"
        @handleChange="handleChange1"
        ></search-box>
      </div>
      <div class="grid-wraper">
        <div class="left_fixed">
          <table class="layout-t left_layout_t">
            <tr>
            <th>维修单</th>
            </tr>
            <tr v-for="e in dataList" :key="e.worktask_id" @click="toCheck(e)" :class="{'checked': e.worktask_id === pkId}">
              <td>{{e.device_code}}</td>
            </tr>
          </table>
        </div>
        <div class="slide">
          <table class="layout-t">
            <tr>
              <th>设备编号</th>
              <th>设备名称</th>
              <th>状态</th>
              <th>计划维修日期</th>
            </tr>
            <tr v-for="e in dataList" :key="e.worktask_id" @click="toCheck(e)" :class="{'checked': e.worktask_id === pkId}">
              <td>{{e.workorder_code}}</td>
              <td>{{e.material_code}}</td>
              <td>{{e.pcsn}}</td>
              <td>{{e.status_name}}</td>
            </tr>
          </table>
        </div>
      </div>
    </section>
    <section class="submit-bar">
      <button class="btn submit-button">开始维修</button>
      <button class="btn submit-button">填报</button>
      <button class="btn submit-button">委外维修</button>
      <button class="btn submit-button">结束维修</button>
    </section>
  </section>
</template>

<script>
import NavBar from '@components/NavBar.vue'
import SearchBox from '@components/SearchBox.vue'
export default {
  name: 'EquipRepairExecute',
  components: {
    NavBar,
    SearchBox
  },
  data () {
    return {
      val1: '',
      dataList: [],
      pkId: '',
      pkObj: {}
    }
  },
  methods: {
    handleChange1 (e, type) {
      if (type) {
        console.log(e)
      }
    },
    toCheck (e) {
      this.pkId = this.pkId === e.worktask_id ? '' : e.worktask_id
      this.pkObj = this.pkId === e.worktask_id ? e : {}
    }
  }
}
</script>
