inventoryDetailDialog.vue 4.85 KB
<!-- 盘点详情弹窗弹窗 -->
<template>
  <GLDialog bigTitle="详细信息"
            width="1500px"
            :visible.sync="inventoryDetailVisible"
            :hasFooter="false"
            :before-close="handleClose"
            class="inventoryDetailDailog"
            mode="big"
            okText="关闭"
            @onCancel="handleClose"
            @onOk="handleClose">
    <div>
      <div class="header"
           slot="header"
           style="padding: 10px 20px">
        <!-- <GLCombiForm ref="showSearch"
                   class="show-search"
                   :search-form="searchForm"
                   :search-select-obj="searchSelectObj"
                   :form-data="showFormData"></GLCombiForm> -->
      </div>
      <div class="d2-container-content">
        <GLTable ref="recordTable"
                 :getListApi="getListApi"
                 :searchForm="searchFormSearch"
                 :tableParams="tableParams"
                 :beforeSearchFn="beforeSearchFn">
          <template slot="profitAndLoss"
                    slot-scope="scope">
            <span v-if="scope.scope.profitAndLoss || scope.scope.profitAndLoss == 0">
              <span v-if="parseFloat(scope.scope.profitAndLoss) > 0"
                    style="color: blue">{{ '+' + parseFloat(scope.scope.profitAndLoss).toFixed(2) + (membraneTypeList.includes(scope.scope.goodsType) ? '米' : '件') }}</span>
              <span v-else-if="parseFloat(scope.scope.profitAndLoss) < 0"
                    style="color: red">{{ parseFloat(scope.scope.profitAndLoss).toFixed(2) + (membraneTypeList.includes(scope.scope.goodsType) ? '米' : '件') }}</span>
              <span
                    v-else>{{ parseFloat(scope.scope.profitAndLoss).toFixed(2) + (membraneTypeList.includes(scope.scope.goodsType) ? '米' : '件') }}</span>
            </span>
            <span v-else>-</span>
          </template>
        </GLTable>
      </div>
    </div>
  </GLDialog>
</template>

<script>
// import { membraneTypeList } from '@/utils/constants.js'
export default {
  name: 'InventoryDetailDialog',
  data() {
    return {
      membraneTypeList: this.$membraneTypeList,
      countObj: {},
      searchForm: {
        id: ''
      },
      searchFormSearch: {},
      searchSelectObj: {},
      showFormData: [],
      getListApi: this.$apis.stockManage.stockCheckDetailPage,
      tableParams: {
        btnId: new Date().getTime() + parseInt(Math.random() * 1000),
        listName: 'list',
        // singleSelectUniqueKey: 'id',
        tableOption: false,
        tableColumns: [
          {
            label: '商品名称',
            prop: 'goodsName',
            width: 180,
            line: 1
          },
          {
            label: '规格',
            prop: 'specificationData',
            width: 180,
            line: 1
          },
          {
            label: '商品编码',
            prop: 'productCode'
            // width: 250
          },
          {
            label: '系列',
            prop: 'sourceMaterialName'
          },
          {
            label: '所属分类',
            prop: 'goodsTypeName'
          },
          {
            label: '系统库存',
            prop: 'stock',
            formatter: cellValue => {
              return cellValue.stock || cellValue.stock == 0 ? parseFloat(cellValue.stock).toFixed(2) + (this.$membraneTypeList.includes(cellValue.goodsType) ? '米' : '件') : '-'
            }
          },
          {
            label: '盘点库存',
            prop: 'checkStock',
            formatter: cellValue => {
              return cellValue.checkStock || cellValue.checkStock == 0 ? parseFloat(cellValue.checkStock).toFixed(2) + (this.$membraneTypeList.includes(cellValue.goodsType) ? '米' : '件') : '-'
            }
          },
          {
            label: '盘盈盘亏',
            prop: 'profitAndLoss',
            addHtml: 'profitAndLoss'
            // formatter: (cellValue) => {
            //   return cellValue.checkTime ? Util.dateFormate(cellValue.checkTime, 'YYYY-MM-DD HH:mm:ss') : ''
            // }
          },
          {
            label: '膜卷号',
            prop: 'filmRollNo'
          }
        ]
      },
      baseData: {}
    }
  },

  props: {
    inventoryDetailVisible: {
      type: Boolean,
      default: false
    },
    recordInfo: {
      type: Object,
      default: () => { }
    }
  },

  computed: {},
  mounted() { },

  methods: {
    beforeSearchFn() {
      return new Promise(resolve => {
        this.searchForm.id = this.recordInfo.id
        this.searchFormSearch = this.$common.utils.deepClone(this.searchForm)
        resolve()
      })
    },

    handleClose() {
      this.$emit('dialogClose')
    }
  }
}
</script>
<style scoped>
.count-txt {
  font-weight: 700;
  color: #2a58ad;
  margin: 0 2px;
}

.inventoryDetailDailog .el-dialog {
  margin-top: 20vh !important;
  min-width: 700px;
}
</style>