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

      <span slot="childStatus" slot-scope="childStatus">
        <a-tag :key="childStatus" :color="getStatusColor(childStatus)">
          {{ childStatus }}
        </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" @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: 'CycleCountDetailChildSubTable',
  mixins: [JeecgListMixin],
  components: {
    AdjustmentDocModal,
  },
  props: {
    record: {
      type: Object,
      default: null,
    }
  },
  data() {
    return {
      description: '盘点容器明细表内嵌列表',
      disableMixinCreated: true,
      loading: false,
      dataSource: [],
      columns: [
        {
          title: this.$t('inventory.mainCheckCode'),
          align: 'center',
          dataIndex: 'cyclecountheadcode',
        },
        /*{
          title: '盘点明细ID主id',
          align: 'center',
          dataIndex: 'cycleCountDetailid',
        },*/
        {
          title: this.$t('inventory.location'),
          align: 'center',
          dataIndex: 'locationCode',
        },
        {
          title: this.$t('inventory.container'),
          align: 'center',
          dataIndex: 'containerCode',
        },
        {
          title: this.$t('inventory.materialCode'),
          align: 'center',
          dataIndex: 'materialCode',
        },
        {
          title: this.$t('inventory.materialName'),
          align: 'center',
          dataIndex: 'materialName',
        },
        {
          title: this.$t('inventory.materialSpec'),
          align: 'center',
          dataIndex: 'materialSpec',
        },
        {
          title: this.$t('inventory.materialUnit'),
          align: 'center',
          dataIndex: 'materialUnit',
        },
        {
          title: this.$t('inventory.systemQty'),
          align: 'center',
          dataIndex: 'systemQty',
        },
        {
          title: this.$t('inventory.actualQty'),
          align: 'center',
          dataIndex: 'countedQty',
        },
        {
          title: this.$t('inventory.discrepancyQty'),
          align: 'center',
          dataIndex: 'gapQty',
        },
        {
          title: this.$t('system.status'),
          align: 'center',
          dataIndex: 'childStatus_dictText' + this.$ls.get('language'),
          scopedSlots: {customRender: 'childStatus'}
        },
        {
          title: this.$t('inventory.discrepancyQty'),
          align: 'center',
          dataIndex: 'inventoryDetaiId',
        },
        {
          title: this.$t('system.options'),
          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) {
      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
      })
    },
    createMany(id) {
      this.$refs.adjustmentModal.edit(id);
      this.$refs.adjustmentModal.title = "实盘登记";
    },

  },
}
</script>

<style scoped>

</style>