
export default {
  components: {
    searchBar: require( '../searchBar/index.searchBar.vue').default,
    mainTable: require('../mainTable/index.mainTable.vue').default,
    webMap: require('../webMap/index.webMap.vue').default,

  },
  computed: {


  },
  data() {
    return {
      mainId: '',
      mainCurrent: null,
      mainsSelectedRowKeys: [],
    }
  },

  methods: {

    r_clearChildrenTableAll(isClearCurrent = false) {
      if (isClearCurrent) {
        this.mainCurrent = null
        this.mainId = ''
      }
      const { table_1, table_2, table_3,} = this.$refs
      let arr = [ table_1, table_2, table_3]
      arr.forEach((item) => {
        if (item) {
          item.dataSource = []
        }
      });
    },

    mx_getUrlType() {
      let p = this.$refs?.searchBar?.getFieldsValue?.()
      if (p) {
       return p.urlType
      }
      return ''
    },
    searchSubmit(data) {
      this.$refs.mainTable.reload({ data })
    },
    clearChildrenTableAll(isClearCurrent = false) {
      if (isClearCurrent) {
        this.mainCurrent = null
        this.mainId = ''
      }
      const { goodsTable, parcelTable, shipbillTable, shipmentsTable, stockUpTable, closeTable } = this.$refs
      let arr = [goodsTable, parcelTable, shipbillTable, shipmentsTable, stockUpTable, closeTable]
      arr.forEach((item) => {
        if (item) {
          item.dataSource = []
        }
      })
    },
    onBack(formName, id, isReload) {
      this.detailsState = 0
      this.currentMainData = null

      if (isReload) {
        if (this.$refs.childrenTable) {
          this.$refs.childrenTable.dataSource = []
        }
        this.clearChildrenTableAll()
        this.$refs[formName + 'Table'].reload().then(() => {
          if (id) {
            if (formName == 'main') {
              this.mainId = id
            } else {
              this.childrenId = id
            }
          }
        })
      }
    },
    handleView(data) {
      this.detailsState = 1
      this.mainCurrent = { ...data }
    },
    handPrint(url) {
      console.log(url)
    },
    viewRemoteBefore(vnode, config) {
      config.data.shipbillIds = [config.data.shipbillId]
      delete config.data.shipbillId
    },
  },
}
