LocationChildSubTable.vue 5.2 KB
<template>
  <a-card :bordered="false">
    <a-table
      rowKey="id"
      size="middle"
      bordered
      :loading="loading"
      :columns="columns"
      :dataSource="dataSource"
      :pagination="false"
    >

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

      <template slot="htmlSlot" slot-scope="text">
        <div v-html="text"></div>
      </template>

      <template slot="imgSlot" slot-scope="text">
        <div style="font-size: 12px;font-style: italic;">
          <span v-if="!text">无图片</span>
          <img v-else :src="getImgView(text)" alt="" style="max-width:80px;height:25px;"/>
        </div>
      </template>

      <template slot="action" slot-scope="text, record">
        <adjustment-doc-modal ref="adjustmentModal" @ok="modalFormOk"/>
        <!--      <a v-if="record.childStatus != 1 && record.childStatus != 100" @click="createMany(record)"><a-icon />实盘登记</a>-->
      </template>

      <template slot="fileSlot" slot-scope="text">
        <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
        <a-button
          v-else
          ghost
          type="primary"
          icon="download"
          size="small"
          @click="downloadFile(text)"
        >
          <span>下载</span>
        </a-button>
      </template>
    </a-table>
  </a-card>
</template>

<script>
import {getAction} from '@api/manage'
import {JeecgListMixin} from '@/mixins/JeecgListMixin'
import AdjustmentDocModal from "../modules/AdjustmentDocModal";

export default {
  name: 'LocationChildSubTable',
  mixins: [JeecgListMixin],
  components: {
    AdjustmentDocModal,
  },
  props: {
    record: {
      type: Object,
      default: null,
    }
  },
  data() {
    return {
      description: '盘点容器明细表内嵌列表',
      disableMixinCreated: true,
      loading: false,
      dataSource: [],
      columns: [
        {
          title: '库位编码',
          align: 'center',
          dataIndex: 'code'
        },
        {
          title: '设备编码',
          align: 'center',
          dataIndex: 'deviceCode'
        },
        {
          title: '容器编码',
          align: 'center',
          dataIndex: 'containerCode'
        },
        {
          title: '状态',
          align: 'center',
          dataIndex: 'status_dictText',
          scopedSlots: {customRender: 'status_dictText'},
          filterMultiple: true,
          filters: [
            {text: '空闲', value: 'empty'},
            {text: '锁定', value: 'lock'},
            {text: '禁用', value: 'disable'},
          ]
        },
        {
          title: '库区',
          align: 'center',
          dataIndex: 'zoneCode',
          key: 'zoneCode',
          scopedSlots: {customRender: 'zoneCode'},
          filterMultiple: true,
          filters: [
          ]
        },
        {
          title: '库位类型',
          align: 'center',
          dataIndex: 'locationTypeCode',
          key: 'locationTypeCode',
          scopedSlots: {customRender: 'locationTypeCode'}
        },
        {
          title: '巷道',
          align: 'center',
          dataIndex: 'roadWay'
        },
        {
          title: '行',
          align: 'center',
          dataIndex: 'row'
        },
        {
          title: '列',
          align: 'center',
          dataIndex: 'icolumn'
        },
        {
          title: '层',
          align: 'center',
          dataIndex: 'layer'
        },
        {
          title: '高低位',
          align: 'center',
          dataIndex: 'high_dictText',
          scopedSlots: {customRender: 'high_dictText'}
        },
        {
          title: '内外侧',
          align: 'center',
          dataIndex: 'rowFlag_dictText',
          scopedSlots: {customRender: 'rowFlag_dictText'}
        },
        {
          title: '物料分区存放',
          align: 'center',
          dataIndex: 'materialAreaCode'
        },
        {
          title: '是否有托盘',
          align: 'center',
          dataIndex: 'haveContainer_dictText',
          scopedSlots: {customRender: 'haveContainer_dictText'}
        },
        {
          title: '操作',
          dataIndex: 'action',
          align: 'center',
          width: 147,
          scopedSlots: {customRender: 'action'},
        },
      ],
      url: {
        listByMainId: '/config/location/queryLocationChildByDeviceCode',
      },
    }
  },
  watch: {
    record: {
      immediate: true,
      handler() {
        if (this.record != null) {
          this.loadData(this.record)
        }
      }
    }
  },
  methods: {
    loadData(record) {
      this.loading = true
      this.dataSource = []
      getAction(this.url.listByMainId, {
        deviceCode: record.deviceCode
      }).then((res) => {
        if (res.success) {
          this.dataSource = res.result.records
        }
      }).finally(() => {
        this.loading = false
      })
    },
    createMany(id) {
      this.$refs.adjustmentModal.edit(id);
      this.$refs.adjustmentModal.title = "实盘登记";
    },
  },
}
</script>

<style scoped>

</style>