<template>
  <div id="unit" class="flex-row">
    <div class="flex" style="flex: 1; width:70%">
      <todo-list @select-changed="selected" v-ref:todolist></todo-list>
    </div>
    <div style="width:35%">
      <compile-list :listinfo="listinfo" :title.sync="title"></compile-list>
    </div>
  </div>
</template>

<script>
  export default {
    title: '代办事项',
    data () {
      return {
        listinfo: {
          f_state: ['未测']
        },
        title: '新增'
      }
    },
    methods:{
      selected(obj){
        this.title = '修改状态'
        var row = Object.assign({},obj.val)
        row.f_state = [obj.val.f_state]
        this.listinfo = row
      },
      init(){
        this.listinfo = {f_state: ['未测']}
        this.title = '新增'
      }
    },
    events:{
      'add'(){
        this.init()
      },
      'refresh'(){
        this.$refs.todolist.$refs.paged.$refs.cri.search()
        this.init()
      }
    }
  }
</script>
<style>
</style>
