123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- <template>
- <a-modal
- centered
- class="chainStockReportDetail-modal"
- :footer="null"
- :maskClosable="false"
- :title="modalTit"
- v-model="isShow"
- @cancle="isShow=false"
- :width="960">
- <!-- 合计 -->
- <a-alert type="info" style="margin-bottom:10px">
- <div class="ftext" slot="message">
- 现有库存总数量(个):<strong> {{ (currentStock && currentStock.totalQty) || 0 }} </strong>;
- 现有库存总成本(¥):<strong> {{ (currentStock && currentStock.totalCost) || 0 }} </strong>。
- </div>
- </a-alert>
- <!-- 详情 -->
- <s-table
- v-if="openModal"
- class="sTable"
- ref="table"
- size="small"
- :rowKey="(record) => record.id"
- :columns="columns"
- :data="loadData"
- bordered>
- <!-- 库存数量 -->
- <template slot="currentQty" slot-scope="text, record">
- {{ (Number(record.currentQty) + Number(record.freezeQty)) || 0 }}
- <span v-if="Number(record.freezeQty)">(冻结{{ record.freezeQty }})</span>
- </template>
- </s-table>
- <div class="btn-cont">
- <a-button id="chainStockReportDetail-detail-modal-back" @click="isShow = false">返回列表</a-button>
- </div>
- </a-modal>
- </template>
- <script>
- import { STable } from '@/components'
- import { reportStockDetailList, reportStockDetailCount } from '@/api/reportStock'
- export default {
- name: 'InventoryQueryDetailModal',
- components: { STable },
- props: {
- openModal: { // 弹框显示状态
- type: Boolean,
- default: false
- },
- productSn: {
- type: [Number, String],
- default: ''
- },
- stockSn: {
- type: [Number, String],
- default: ''
- }
- },
- computed: {
- modalTit () {
- return '详情'
- }
- },
- data () {
- return {
- isShow: this.openModal, // 是否打开弹框
- // 表头
- columns: [
- { title: '产品编码', dataIndex: 'productEntity.code', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '产品名称', dataIndex: 'productEntity.name', width: '15%', align: 'left', ellipsis: true, customRender: function (text) { return text || '--' } },
- { title: '原厂编码', dataIndex: 'productEntity.origCode', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '入库时间', dataIndex: 'putTime', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '仓库', dataIndex: 'warehouseName', width: '10%', align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
- { title: '仓位', dataIndex: 'warehouseLocationName', width: '10%', align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
- { title: '入库类型', dataIndex: 'putBizTypeDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '库存数量', scopedSlots: { customRender: 'currentQty' }, width: '8%', align: 'center' },
- { title: '成本单价', dataIndex: 'putCost', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
- ],
- // 加载数据方法 必须为 Promise 对象
- loadData: parameter => {
- const params = Object.assign(parameter, { productSn: this.productSn, stockSn: this.stockSn })
- return reportStockDetailList(params).then(res => {
- const data = res.data
- const no = (data.pageNo - 1) * data.pageSize
- for (var i = 0; i < data.list.length; i++) {
- data.list[i].no = no + i + 1
- }
- // 总计
- this.getCount(params)
- return data
- })
- },
- currentStock: null
- }
- },
- methods: {
- // 合计
- getCount (param) {
- reportStockDetailCount(param).then(res => {
- if (res.status == 200 && res.data) {
- this.currentStock = res.data
- } else {
- this.currentStock = null
- }
- })
- }
- },
- watch: {
- // 父页面传过来的弹框状态
- openModal (newValue, oldValue) {
- this.isShow = newValue
- },
- // 重定义的弹框状态
- isShow (newValue, oldValue) {
- if (!newValue) {
- this.$emit('close')
- }
- }
- }
- }
- </script>
- <style lang="less">
- .chainStockReportDetail-modal{
- .btn-cont {
- text-align: center;
- margin: 10px 0 10px;
- }
- }
- </style>
|