import { initDictionary, resultExtendedField } from '@/blocks/utils'
import { getOrganization } from '@/blocks/components/formConfig/departmenTree.js'

export default {
  data() {
    return {
      options: {},
      tableExtendedField: [],
      formExtendedField: {
        form: [],
        formTable:[]
      },
      goodsExtendedField: [],
    }
  },
  mounted() {
    let _this = this
    getOrganization(this)
    //运单扩展字段
    resultExtendedField({ extendedObjectCode: '15' }).then((data) => {
      if (data) {
        _this.tableExtendedField = data.table
        _this.formExtendedField.form = data.form
      }
    })
    //商品扩展字段
    resultExtendedField({ extendedObjectCode: '2' }).then((data) => {
      if (data) {
        _this.goodsExtendedField = data.table
      }
    })
    //运单商品扩展字段
    resultExtendedField({ extendedObjectCode: '17' }).then((data) => {
      if (data) {
        _this.formExtendedField.formTable = data.table
      }
    })

    // initDictionary([
    //   { objectcode: 'ORDER_BUSINESS_TYPE' },
    //   { objectcode: 'APPOINTMENT_TYPE' },
    //   { objectcode: 'ORDER_TYPE' },
    //   { objectcode: 'PACK_TYPE' },
    //   { objectcode: 'CARGO_THERMOSPHERE' },
    //   { objectcode: 'DELIVERY_METHOD_TYPE' },
    //   { objectcode: 'TEMPERATURE_REQUIREMENT' },
    //   { objectcode: 'TRANSPORT_TYPE' },
    //   { objectcode: 'SHIPPER_TYPE' },
    //   { objectcode: 'CONSIGNEE_TYPE' },
    //   { objectcode: 'ABNORMAL_TYPES' },
    //   { objectcode: 'ABNORMAL_EVENT' },
    //   { objectcode: 'DELIVERY_STATUS' },
    //   { objectcode: 'DELIVERY_STRANDED_REASON' },
    //   { objectcode: 'DELIVERY_FAILURE_REASON' },
    //   { objectcode: 'ORIG_RECEIPT_STATUS' },
    //   { objectcode: 'ORIG_RECEIPT_TYPE' },
    //   { objectcode: 'LOADING_BILL_STATUS' },
    //   { objectcode: 'SHIPBILL_CLOSE_TYPE' },//关闭类型
    // ]).then((res) => {
    //   for (let key in res) {
    //     res[key].forEach((item) => {
    //       if (!isNaN(item.value)) {
    //         item.value = +item.value
    //       }
    //     })
    //   }

    //   _this.options = { ..._this.options, ...res }
    // })
  },
  computed: {},
  methods: {},
}
