JSelectMultiCycleCount.vue 2.75 KB
<template>
  <!-- 定义在这里的参数都是不可在外部覆盖的,防止出现问题 -->
  <j-select-biz-component
    :value="value"
    :ellipsisLength="25"
    :listUrl="url.list"
    :columns="columns"
    v-on="$listeners"
    v-bind="attrs"
  />

</template>

<script>
import JDate from '@comp/jeecg/JDate'
import JSelectBizComponent from './JButtonBizComponent'
import {getZoneList} from '@/api/api'

export default {
  name: 'JSelectMultiCycleCount',
  components: {JDate, JSelectBizComponent},
  props: {
    value: null, // any type
    testConfig: "",
    headerCode:"",
    queryConfig: {
      type: Array,
      default: () => []
    },
  },
  data() {
    return {
      zoneList: [],
      url: {list: '/inventory/inventoryHeader/freeList'},
      columns: [
        {title: 'ID', align: 'center', widthRight: '70%', dataIndex: 'id'},
        {title: '容器编码', align: 'center', width: '20%', dataIndex: 'containerCode'},
        {title: '容器状态', align: 'center', width: '10%', dataIndex: 'containerStatus'},
        {title: '库位编码', align: 'center', width: '20%', dataIndex: 'locationCode'},
        {title: '总数量', align: 'center', width: '10%', dataIndex: 'totalQty'},
        {title: '库区', align: 'center', width: '10%', widthRight: '70%', dataIndex: 'zoneCode', key: 'zoneCode', scopedSlots: {customRender: 'zoneCode'}},
        {title: '状态', align: 'center', width: '10%', dataIndex: 'enable'},
      ],
      // 定义在这里的参数都是可以在外部传递覆盖的,可以更灵活的定制化使用的组件
      default: {
        name: '库存',
        width: 1250,
        displayKey: 'id',
        returnKeys: ['id','id'],
        queryParamText: 'ID',
      },
      // 多条件查询配置queryConfigDefault
      queryConfigDefault: [
        // {
        //   key: 'containerCode',
        //   label: '容器编码',
        //   // 如果包含 dictCode,那么就会显示成下拉框
        //   dictCode: 'sex',
        // },
      ],
    }
  },
  computed: {
    attrs() {
      return Object.assign(this.default, this.$attrs, {
        queryConfig: this.queryConfigDefault.concat(this.queryConfig),
        testConfig : this.testConfig,
        headerCode : this.headerCode,
      })
    }
  },
  created() {
    this.loadFrom();
  },
  methods: {
    loadFrom() {
      getZoneList().then((res) => {
        if (res.success) {
          this.zoneList = res.result
        }
      });
    },
    solutionZoneCode(value) {
      var actions = []
      Object.keys(this.zoneList).some((key) => {
        if (this.zoneList[key].code == ('' + value)) {
          actions.push(this.zoneList[key].name)
          return true
        }
      })
      return actions.join('')
    },
  }
}
</script>

<style lang="less" scoped></style>