<template>
  <moduleView :propConfig="config" @clickHandle="clickHandle" />
</template>

<script lang="ts">
import { Component, Prop, Vue, Watch } from "vue-property-decorator";
@Component
export default class ModuleViewDemo extends Vue {
  config:any={
    search:{
      attr:{
        size:'mini',
        rules:{
          name:[{
            required: true, message: '请输入名称', trigger: 'blur'
          }]
        }
      },
      columns:[
        [{
          span:6,
          label:'创建时间',
          prop:'created',
          // rules:[
          //   { required: true, message: '请选择时间', trigger: 'change' }
          // ],
          component:'by-date-picker',
          compConfig:{
            format:'yyyy-MM-dd',
            type:'datetime'
          }
        }]
      ]
    },
    tool:{
      tools:{
        add:true,
        edit:true,
        delete:true,
        export:true,
        search:true,
        refresh:true
      },
      audit:{
        add:'audit:collaborationLog:add',
        edit:'audit:collaborationLog:edit',
        delete:'audit:collaborationLog:remove',
        export:'audit:collaborationLog:export'
      }
    },
    table:{
      attr:{
        size:'mini',
        seq:true,
        align:'center',
        checkbox:true
      },
      columns:[{
        title:'创建时间',
        field:'created',
        width:150
      },
      {
        title:'订单号',
        field:'order_no',
        width:100
      },
      {
        title:'订单类型',
        field:'order_type'
      },
      {
        title:'操作',
        action:true,
        plugins:[{
          icon:'el-icon-edit',
          name:'编辑',
          audit:'',
          event:{
            click:(item:any) => {
              console.log('该行数据：',item)
            }
          }
        },{
          name:'查看',
          event:{
            click:(item:any) => {
              console.log('该行数据：',item);
              this.fun();
              console.log('this:',this)
            }
          }
        }]
      }]
    },
    request:{
      url:'/system/audit/collaborationLog'
    }
  }
  fun(){
    console.log(this)
  }
  clickHandle(e:string){
    console.log(e+'操作')
  }
}
</script>

<style lang="scss" scoped>

</style>