123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162 |
- <template>
- <a-modal
- centered
- class="inventoryQueryDetail-modal"
- :footer="null"
- :maskClosable="false"
- :title="modalTit"
- v-model="isShow"
- @cancel="isShow=false"
- :width="960">
- <a-spin :spinning="spinning" tip="Loading...">
- <!-- 基础信息 -->
- <div style="text-align:right;margin-bottom:10px;"><a-button
- type="primary"
- style="margin-left: 5px"
- @click="handleExport"
- :disabled="disabled"
- :loading="exportLoading"
- id="inventoryWarningList-export-btn">导出</a-button></div>
- <a-card size="small" :bordered="false" class="purchaseReturnDetail-cont">
- <a-collapse :activeKey="['1']">
- <a-collapse-panel key="1" header="基础信息">
- <a-descriptions :column="3">
- <a-descriptions-item label="采购单号">{{ objItem&&objItem.purchaseBillNo || '--' }}</a-descriptions-item>
- </a-descriptions>
- </a-collapse-panel>
- </a-collapse>
- </a-card>
- <!-- 合计 -->
- <a-alert type="info" style="margin-bottom:10px" v-if="objItem">
- <div class="ftext" slot="message">
- 缺货总款数:<strong>{{ objItem.totalCategory || objItem.totalCategory==0 ? objItem.totalCategory : '--' }}个</strong>;
- 缺货总数量:<strong>{{ objItem.totalQty || objItem.totalQty==0 ? objItem.totalQty : '--' }}个</strong>;
- <div style="display: inline-block;" v-if="$hasPermissions('M_ShowAllCost')">
- 缺货总售价:<strong>{{ objItem.totalAmount || objItem.totalAmount==0 ? toThousands(objItem.totalAmount) : '--' }}</strong>。
- </div>
- </div>
- </a-alert>
- <!-- 详情 -->
- <s-table
- class="sTable"
- ref="table"
- size="small"
- :rowKey="(record) => record.id"
- :columns="columns"
- :data="loadData"
- :scroll="{ y: 500 }"
- bordered>
- </s-table>
- <div class="btn-cont">
- <a-button id="inventoryQueryDetail-detail-modal-back" @click="isShow = false">返回列表</a-button>
- </div>
- </a-spin>
- </a-modal>
- </template>
- <script>
- import { commonMixin } from '@/utils/mixin'
- import { STable } from '@/components'
- import { outOfStockExportDetail, outOfStockDetailList } from '@/api/oos'
- import { downloadExcel } from '@/libs/JGPrint.js'
- export default {
- name: 'DetailModal',
- components: { STable },
- mixins: [commonMixin],
- props: {
- openModal: { // 弹框显示状态
- type: Boolean,
- default: false
- },
- objItem: {
- type: Object,
- default: () => {
- return {}
- }
- }
- },
- computed: {
- modalTit () {
- return '详情'
- },
- columns () {
- const _this = this
- const arr = [
- { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
- { title: '产品编码', dataIndex: 'productCode', width: '17%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '产品名称', dataIndex: 'productName', width: '17%', align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
- { title: '原厂编码', dataIndex: 'productOrigCode', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '单位', dataIndex: 'unit', width: '10%', align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
- { title: '缺货数量', dataIndex: 'qty', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '单价', dataIndex: 'price', width: '7%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
- { title: '缺货金额', dataIndex: 'totalAmount', width: '7%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
- ]
- return arr
- }
- },
- data () {
- return {
- spinning: false,
- isShow: this.openModal, // 是否打开弹框
- // 加载数据方法 必须为 Promise 对象
- loadData: parameter => {
- this.disabled = true
- this.spinning = true
- return outOfStockDetailList(Object.assign(parameter, { purchaseBillSn: this.objItem && this.objItem.purchaseBillSn || '' })).then(res => {
- let data
- if (res.status == 200) {
- 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.disabled = false
- }
- this.spinning = false
- return data
- })
- },
- exportLoading: false, // 导出loading
- disabled: false // 查询、重置按钮是否可操作
- }
- },
- methods: {
- // 导出
- handleExport () {
- const _this = this
- _this.exportLoading = true
- outOfStockExportDetail({ purchaseBillSn: this.objItem && this.objItem.purchaseBillSn || '' }).then(res => {
- downloadExcel(res, '采购缺货列表')
- _this.exportLoading = false
- })
- },
- // 合计
- pageInit () {
- this.$refs.table.refresh(true)
- }
- },
- watch: {
- // 父页面传过来的弹框状态
- openModal (newValue, oldValue) {
- this.isShow = newValue
- },
- // 重定义的弹框状态
- isShow (newValue, oldValue) {
- if (!newValue) {
- this.$emit('close')
- this.currentStock = null
- this.$refs.table.clearTable()
- }
- }
- }
- }
- </script>
- <style lang="less">
- .inventoryQueryDetail-modal{
- .btn-cont {
- text-align: center;
- margin: 5px 0 10px;
- }
- }
- </style>
|