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

      <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="sn" slot-scope="sn">
        <span v-if="countType === '01'"> {{ sn }} </span>
        <a-tag v-else :key="sn" color="purple">
          ?
<!--          {{ sn }}-->
        </a-tag>
      </template>

      <template slot="action" slot-scope="text, record">
        <adjustment-doc-modal ref="adjustmentModal" @ok="adjustmentModalFormOk"/>
        <a v-if="record.childStatus <= 15" @click="registration(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: 'CycleCountDetailChildSubTable',
  mixins: [JeecgListMixin],
  components: {
    AdjustmentDocModal,
  },
  props: {
    record: {
      type: Object,
      default: null,
    },
    countType: {
      type: String,
      default: "01",
    }
  },
  data() {
    return {
      description: '盘点容器明细表内嵌列表',
      disableMixinCreated: true,
      loading: false,
      dataSource: [],
      columns: [
        {
          title: '盘点主单编码',
          align: 'center',
          dataIndex: 'cycleCountHeadCode',
        },
        {
          title: '库位',
          align: 'center',
          dataIndex: 'locationCode',
        },
        {
          title: '容器',
          align: 'center',
          dataIndex: 'containerCode',
        },
        {
          title: '序列号',
          align: 'center',
          dataIndex: 'sn',
          scopedSlots: {customRender: 'sn'},
        },
        {
          title: '实盘序列号',
          align: 'center',
          dataIndex: 'countedSn',
        },
        /*{
          title: '差异序列号',
          align: 'center',
          dataIndex: 'gapSn',
        },*/
        {
          title: '合同编码',
          align: 'center',
          dataIndex: 'contractNo'
        },
        {
          title: '合同名称',
          align: 'center',
          dataIndex: 'contractName'
        },
        {
          title: '工单号',
          align: 'center',
          dataIndex: 'workOrder'
        },
        {
          title: '物料编码',
          align: 'center',
          dataIndex: 'materialCode',
        },
        {
          title: '物料名称',
          align: 'center',
          dataIndex: 'materialName',
        },
        {
          title: '物料规格',
          align: 'center',
          dataIndex: 'materialSpec',
        },
        {
          title: '物料单位',
          align: 'center',
          dataIndex: 'materialUnit',
        },
        {
          title: '系统数量',
          align: 'center',
          dataIndex: 'systemQty',
        },
        /*{
          title: '实盘数量',
          align: 'center',
          dataIndex: 'countedQty',
        },
        {
          title: '差异数量',
          align: 'center',
          dataIndex: 'gapQty',
        },*/
        {
          title: '明细状态',
          align: 'center',
          dataIndex: 'childStatus_dictText',
        },
        {
          title: '库存明细ID',
          align: 'center',
          dataIndex: 'inventoryDetailId',
        },
        {
          title: '操作',
          dataIndex: 'action',
          align: 'center',
          width: 147,
          scopedSlots: {customRender: 'action'},
        },
      ],
      url: {
        listByMainId: '/cycleCountDetail/cycleCountDetail/queryCycleCountDetailChildByMainId',
      },
    }
  },
  watch: {
    record: {
      immediate: true,
      handler() {
        if (this.record != null) {
          this.loadData(this.record)
        }
      }
    }
  },
  methods: {
    loadData(record) {
      console.log(record);
      this.loading = true
      this.dataSource = []
      getAction(this.url.listByMainId, {
        id: record.id
      }).then((res) => {
        if (res.success) {
          this.dataSource = res.result.records
        }
      }).finally(() => {
        this.loading = false
      })
    },
    registration(record) {
      record.countType = this.countType;
      this.$refs.adjustmentModal.edit(record);
      this.$refs.adjustmentModal.title = "实盘登记";
    },
    adjustmentModalFormOk(data) {
      this.loadData(data)
    }
  },
}
</script>

<style scoped>

</style>