inventoryDetailDialog.vue 4.66 KB
<!-- 盘点详情弹窗弹窗 -->
<template>
  <d2-dialog title="详细信息" :is-visible="inventoryDetailVisible" class="inventoryDetailDailog" width="70%" :no-cancel="true"
             btn-ok-label="关闭" @closeDialog="handleClose" @confirmDialog="handleClose">
    <div>
      <div class="header" slot="header" style="padding: 10px 20px;">
        <d2-search ref="showSearch" class="show-search" :search-form="searchForm" :search-select-obj="searchSelectObj"
                   :form-data="showFormData" />
      </div>
      <div class="d2-container-content">
        <d2-table ref="recordTable" :get-list-api="getListApi" :search-form="searchFormSearch" :table-params="tableParams"
                  :before-search-fn="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>
        </d2-table>
      </div>
    </div>
  </d2-dialog>
</template>

<script>
import { Util, deepClone } from '@/common/util'
import { mapActions, mapState } from 'vuex'
import { stockCheckDetailPage } from '@api/stockManage'
import { baseConfig } from '@/main'
export default {
  name: 'InventoryDetailDialog',
  components: {

  },
  data() {
    return {
      userInfo: this.$store.state.d2admin.user.info,
      membraneTypeList: baseConfig.membraneTypeList,
      countObj: {},
      searchForm: {
        id: ''
      },
      searchFormSearch: {},
      searchSelectObj: {},
      showFormData: [],
      getListApi: stockCheckDetailPage,
      tableParams: {
        btnId: new Date().getTime() + parseInt(Math.random() * 1000),
        listName: 'list',
        // singleSelectUniqueKey: 'id',
        tableOption: false,
        tableColumns: [{
          label: '商品名称',
          prop: 'goodsName'
          // width: '200px'
        }, {
          label: '商品编码',
          prop: 'productCode',
          width: '250px'
        }, {
          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',
          formatter: (cellValue) => {
            return cellValue?.filmRollNo || '-'
          }
        }]
      },
      baseData: {

      }
    }
  },

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

  computed: {

  },
  mounted() {
  },

  methods: {
    ...mapActions({
      get: 'd2admin/base/get',
      close: 'd2admin/page/close'
    }),

    beforeSearchFn() {
      return new Promise(resolve => {
        this.searchForm.id = this.recordInfo.id
        this.searchFormSearch = 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>