complementLogDialog.vue 3.6 KB
<!-- 补库存标签码日志弹窗 -->
<template>
  <GLDialog title="补库存标签码日志" :visible.sync="dialogVisible" class="complementLogDialog" width="700px" mode="mid" :destroy-on-close="true" :close-on-click-modal="false" okText="关闭" :hasFooter="false" :before-close="handleClose" @onOk="handleClose" @onCancel="handleClose">
    <div class="complement-log-content">
      <div class="section-title">
        产品基础信息
      </div>
      <div class="info-box">
        <el-row>
          <el-col class="info-item" :span="24">
            <span class="label">产品名称:</span>
            <span class="value">{{ row.upgradeGoodsName || '-' }}</span>
          </el-col>
          <el-col class="info-item" :span="24">
            <span class="label">产品编码:</span>
            <span class="value">{{ row.productCode || '-' }}</span>
          </el-col>
          <el-col class="info-item" :span="24">
            <span class="label">产品ID:</span>
            <span class="value">{{ row.upgradeCommodityCode || '-' }}</span>
          </el-col>
        </el-row>
      </div>

      <div class="section-title" style="margin-top: 20px;">
        操作日志
      </div>
      <div class="d2-container-content">
        <GLTable ref="logTable" :getListApi="getListApi" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn"></GLTable>
      </div>
    </div>
  </GLDialog>
</template>

<script>
import * as dayjs from 'dayjs'

export default {
  name: 'ComplementLogDialog',
  props: {
    visibleSync: {
      type: Boolean,
      default: false
    },
    row: {
      type: Object,
      default: () => ({})
    }
  },
  data() {
    const tableColumns = []

    if (this.row && this.row.isFilm) {
      tableColumns.push({
        label: '库存数量',
        prop: 'stockNum',
        formatter: cellValue => {
          return cellValue.stockNum || cellValue.stockNum == 0 ? `${cellValue.stockNum}米` : '-'
        }
      })
    }

    tableColumns.push(
      {
        label: '操作人',
        prop: 'createdBy'
      },
      {
        label: '操作时间',
        prop: 'createdDate',
        formatter: cellValue => {
          return cellValue.createdDate ? dayjs(cellValue.createdDate).format('YYYY-MM-DD HH:mm:ss') : '-'
        }
      }
    )

    return {
      pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' },
      tableSearchForm: {},
      getListApi: this.$apis.stockManage.labelCodeRecodeLog,
      tableParams: {
        listName: 'list',

        tableColumns: tableColumns
      }
    }
  },
  computed: {
    dialogVisible: {
      get() {
        return this.visibleSync
      },
      set(newVal) {
        this.$emit('update:visibleSync', newVal)
      }
    }
  },
  methods: {
    handleClose(done) {
      this.dialogVisible = false
      if (typeof done === 'function') done()
    },
    beforeSearchFn() {
      return new Promise(resolve => {
        this.tableSearchForm = {
          upgradeGoodsId: this.row.upgradeGoodsId,
          merchantId: this.row.yqMerchantId
        }
        resolve()
      })
    }
  }
}
</script>

<style scoped lang="scss">
.complement-log-content {
  padding: 0 10px 20px 10px;

  .section-title {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    margin-bottom: 15px;
  }

  .info-box {
    padding: 0 20px;

    .info-item {
      margin-bottom: 12px;
      font-size: 14px;

      .label {
        color: #666;
        display: inline-block;
        width: 80px;
        text-align: right;
      }

      .value {
        color: #333;
      }
    }
  }
}
</style>