InventoryBomChildList.vue 6.21 KB
<template>
  <div>
    <a-table
      size="middle"
      bordered
      :rowKey="record => record.id"
      :loading="loading"
      :columns="columns"
      :dataSource="dataSource"
      :pagination="false"
      class="j-table-force-nowrap"
      @change="handleTableChange">

      <span slot="stockCategory_dictText" slot-scope="stockCategory_dictText">
        <a-tag :key="stockCategory_dictText" :color="getStatusColor(stockCategory_dictText)">
          {{ stockCategory_dictText }}
        </a-tag>
      </span>

      <span slot="recordStatus_dictText" slot-scope="recordStatus_dictText">
        <a-tag :key="recordStatus_dictText" :color="getStatusColor(recordStatus_dictText)">
          {{ recordStatus_dictText }}
        </a-tag>
      </span>

    </a-table>
  </div>
</template>
<script>
import {JeecgListMixin} from '@/mixins/JeecgListMixin'
import {getAction} from '@api/manage'
import '@/assets/less/TableExpand.less'
import {} from "@/api/api";

export default {
  name: 'InventoryBomChildList',
  mixins: [JeecgListMixin],
  components: {},
  props: {
    record: {
      type: Object,
      default: null,
    },
    isLoad: {
      type: Boolean,
      default: false,
    }
  },
  data() {
    return {
      description: '物料移动类型明细页面',
      columns: [
        {
          title: '库存详情ID',
          align: 'center',
          dataIndex: 'id',
          // fixed: "left",
          // width: 100,
        },
        {
          title: '物料编码',
          align: 'center',
          dataIndex: 'materialCode'
        },
        {
          title: '物料名称',
          align: 'center',
          dataIndex: 'materialName'
        },
        {
          title: '数量',
          align: 'center',
          dataIndex: 'qty'
        },
        {
          title: '任务锁定数量',
          align: 'center',
          dataIndex: 'taskQty'
        },
        {
          title: '库区',
          align: "center",
          dataIndex: 'zoneCode'
        },
        {
          title: '容器编码',
          align: 'center',
          dataIndex: 'containerCode'
        },
        {
          title: '库位编码',
          align: 'center',
          dataIndex: 'locationCode'
        },
        {
          title: '入库日期',
          align: 'center',
          dataIndex: 'receiptDate'
        },
        {
          title: '库龄(天)',
          align: 'center',
          dataIndex: 'inventoryAge'
        },
      ],
      // 字典选项
      dictOptions: {},
      url: {
        list: '/inventory/inventoryBom/childList'
      },
      superFieldList: [],
    }
  },
  created() {
    this.getSuperFieldList();
  },
  computed: {},
  watch: {
    record: {
      immediate: true,
      handler() {
        if (this.record != null) {
          this.loadData(this.record)
        }
      }
    }
  },
  methods: {
    getStatusColor(status) {
      const colors = {
        '可用': 'green',
        '待质检': 'purple',
        '不合格': 'red',
        '锁定': 'red',
        '冻结': 'red',
        '空闲': 'green',
        '有货': 'purple',
        '满盘': 'blue',
        '待处理': 'orange',
        '处理中': 'blue',
        '处理完成': 'green',
        '未识别': 'red',
        default: 'cyan'
      };
      return colors[status] || colors.default;
    },
    loadData(record) {
      if (!record) {
        return;
      }
      this.loading = true;
      this.dataSource = [];
      getAction(this.url.list, {
        materialCode: record.materialCode,
        warehouseCode: record.warehouseCode,
      }).then((res) => {
        if (res.success) {
          this.dataSource = res.result;
        }
      }).finally(() => {
        this.loading = false
      })
    },
    initDictConfig() {
    },
    getSuperFieldList() {
      let fieldList = [];
      fieldList.push({type: 'int', value: 'materialDocItem', text: '物料凭证行号', dictCode: ''})
      fieldList.push({type: 'int', value: 'movementType', text: '移动类型', dictCode: ''})
      fieldList.push({type: 'string', value: 'material', text: '物料号', dictCode: ''})
      fieldList.push({type: 'string', value: 'plant', text: '工厂号', dictCode: ''})
      fieldList.push({type: 'string', value: 'storageLocation', text: '存储地点', dictCode: ''})
      fieldList.push({type: 'string', value: 'stockCategory', text: '库存状态', dictCode: ''})
      fieldList.push({type: 'string', value: 'suNumber', text: '唯一号', dictCode: ''})
      fieldList.push({type: 'string', value: 'container', text: '托盘号', dictCode: ''})
      fieldList.push({type: 'string', value: 'purchaseOrder', text: '采购订单号', dictCode: ''})
      fieldList.push({type: 'string', value: 'item', text: '采购订单行号', dictCode: ''})
      fieldList.push({type: 'string', value: 'supplier', text: '供应商编码', dictCode: ''})
      fieldList.push({type: 'BigDecimal', value: 'quantity', text: '数量', dictCode: ''})
      fieldList.push({type: 'string', value: 'wbsElement', text: '项目号', dictCode: ''})
      fieldList.push({type: 'string', value: 'productionOrder', text: '生产订单号', dictCode: ''})
      fieldList.push({type: 'string', value: 'inOut', text: '库存标识', dictCode: ''})
      fieldList.push({type: 'string', value: 'headerText', text: '物料凭证描述', dictCode: ''})
      fieldList.push({type: 'string', value: 'salesOrder', text: '销售订单号', dictCode: ''})
      fieldList.push({type: 'string', value: 'salesOrderItem', text: '销售订单行号', dictCode: ''})
      fieldList.push({type: 'string', value: 'reference', text: '关联号', dictCode: ''})
      fieldList.push({type: 'string', value: 'deliveryLocation', text: '送货位置', dictCode: ''})
      fieldList.push({type: 'datetime', value: 'deliveryTime', text: '送货时间'})
      fieldList.push({type: 'string', value: 'netWork', text: '网络', dictCode: ''})
      fieldList.push({type: 'string', value: 'orderId', text: '订单号', dictCode: ''})
      fieldList.push({type: 'string', value: 'clientId', text: 'SAP收货标记', dictCode: ''})
      this.superFieldList = fieldList
    },
  }
}

</script>
<style lang="less" scoped>
@import '~@assets/less/common.less';

::v-deep .ant-empty-normal {
  margin: 0px;
}
</style>