<template>
  <vxe-modal v-model="value" id="updateStateModal" width="400" @hide="hide" height="200" show-footer title="修改状态">
    <by-form :propConfig="config" ref="form" class="form"></by-form>
    <template #footer>
      <div class="btn">
        <el-button plain size="small" @click="value = false">取消</el-button>
        <el-button type="primary" size="small" @click="btn">确定</el-button>
      </div>
    </template>
  </vxe-modal>
</template>
<script lang="ts">
import { Component, Prop, Vue, Watch } from "vue-property-decorator";
import { setQuestions } from '@/api/omsOrder'
@Component({components:{}})
export default class UpdateStateModal extends Vue {
  value = false;
  load = false;
  billValue:Array<any>=[]
  config:any={
    attr:{
      labelWidth:'80px',
      rules:{
        state: [
          { required: true, message: '请选择状态', trigger: 'change' }
        ]
      }
    },
    columns:[
      [{
        label:'状态',
        prop:'state',
        component: 'by-select',
        compConfig: {
          attr: {
            placeholder: '请选择状态',
            clearable: true,
            data: [{
              value: '等待拣货',
              label: '等待拣货'
            }, {
              value: '正在拣货',
              label: '正在拣货'
            }, {
              value: '正在播种',
              label: '正在播种'
            }, {
              value: '等待出库验货',
              label: '等待出库验货'
            }, {
              value: '终止拣货',
              label: '终止拣货'
            }]
          }
        }
      }]
    ]
  }
  show(){
    
  }
  hide(){
    (this.$refs.form as any).clearValidate();
    (this.$refs.form as any).clearValue();
  }
  setShow(v:boolean){
    this.value = v;
  }
  btn(){
    (this.$refs.form as any).validate().then(()=>{
      let data = (this.$refs.form as any).getValue();
      this.$emit('stateHandle',data.state);
      this.value = false;
      this.$message({
        message:'修改成功！',
        type:'success'
      })
    })
  }
}
</script>

<style lang="scss" scoped>
.form{
  padding-top: 30px;
}
</style>