<template>
  <div>
    WMS
    <a-button @click="handleClick">数据回传</a-button>
    <a-button @click="getClick">获取数据</a-button>
    <!-- 地址选择 -->
    <p-grid-form ref="grid" :span="span" :label-col="{ span: 9 }" :items="items" @submit="hanlderSubmit">
      <template slot="diy" slot-scope="value, form">
        <p-cascader-zone-wms
          :paramValue="fields"
          @change="
            (...args) => {
              handerChange(...args, form)
            }
          "
          @popupVisibleChange="
            (open, value) => {
              popupVisibleChange(open, form)
            }
          "
        />
      </template>
    </p-grid-form>
  </div>
</template>
<script>
import pCascaderZoneWms from '@/blocks/CascaderZone/wms.index.js'

export default {
  components: { pCascaderZoneWms },
  data() {
    return {
      span: 8,

      fields: ['湖北省', '武汉市', '硚口区'],
      items: this.setItems()
    }
  },
  mounted() {
    // this.$refs.grid.form.setFieldsValue({ num: 'asfd', address: this.fields })
  },

  computed: {},
  methods: {
    getClick() {
      console.log(this.$refs.grid.form.getFieldsValue())
    },
    handleClick() {
      this.$refs.grid.form.setFieldsValue({ address: this.fields })
      console.log(this.$refs.grid.form.getFieldsValue())
    },
    setItems() {
      return [
        {
          label: '选择地址',
          name: 'address',
          scopedSlots: { customRender: 'diy' }
        }
      ]
    },
    handerChange(...args) {
      console.log(args)
    },
    popupVisibleChange(open, form) {},
    hanlderSubmit() {}
  }
}
</script>
<style></style>
