<template>
  <vxe-modal v-model="value" id="myModa" :width="width?width+'px':'80%'" :height="height?height+'px':'80%'" min-width="460" min-height="320" show-zoom resize storage transfer>
    <template #title>
      <span>选择商品</span>
    </template>
    <template #default>
      <module-view :propConfig="config" ref="view" />
    </template>
  </vxe-modal>
</template>

<script lang="ts">
import { Component, Prop, Vue, Watch } from "vue-property-decorator";
@Component
export default class ProductDialog extends Vue {
  value=false

  @Prop()
  width?:number

  @Prop()
  height?:number

  config:any={
    search:{
      attr:{
        size:'mini'
      },
      columns:[
        [{
          span:6,
          label:'创建时间',
          prop:'created',
          component:'by-date-picker',
          compConfig:{
            format:'yyyy-MM-dd',
            type:'datetime'
          }
        }]
      ]
    },
    tool:{
      tools:{
        search:true,
        refresh:true
      }
    },
    table:{
      attr:{
        size:'mini',
        seq:true,
        align:'center',
        checkbox:true
      },
      columns:[{
        title:'物料名称',
        field:'name',
        width:150
      },{
        title:'简称',
        field:'short_name',
        width:100
      },{
        title:'财务编号',
        field:'accounting_code'
      },{
        title:'国际码',
        field:'ns_code'
      },{
        title:'基本售价',
        field:'base_price'
      },{
        title:'市场价格（统一售价）',
        field:'mark_price'
      }]
    },
    // request:{
    //   url:'/system/maindataMaterial/page'
    // }
  }

  setShow(v:boolean){
    this.value = v;
  }

  created(){
    this.getList();
  }

  getList(){
    (this as any).$request({
      url: '/maindata/maindataMaterial/page',
      method: 'get',
    }).then((res:any) => {
      console.log('/maindataMaterial/page',res);
    })
  }
} 
</script>
<style lang="scss" scoped>

</style>