123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157 |
- <template>
- <a-modal
- centered
- :footer="null"
- :maskClosable="false"
- title="销售单缺货明细"
- v-model="isShow"
- @cancel="isShow=false"
- width="50%">
- <a-descriptions size="small" :column="2">
- <a-descriptions-item label="销售单号">
- {{ detailData&&detailData.salesBillNo || '--' }}
- <span v-if="detailData&&detailData.salesBillNoSource">(原:{{ detailData&&detailData.salesBillNoSource || '--' }})</span>
- </a-descriptions-item>
- <a-descriptions-item label="客户名称">{{ detailData&&detailData.buyerName || '--' }}</a-descriptions-item>
- </a-descriptions>
- <a-spin :spinning="spinning" tip="Loading...">
- <s-table
- class="sTable fixPagination"
- ref="table"
- size="small"
- :rowKey="(record) => record.id"
- :columns="columns"
- :data="loadData"
- :scroll="{ y: 500 }"
- :showPagination="false"
- :defaultLoadData="false"
- bordered>
- </s-table>
- <div class="btn-cont" style="padding:20px 20px 0;text-align: center;">
- <!-- <a-button @click="isShow=false">关闭</a-button> -->
- <a-button
- class="button-warning"
- type="primary"
- @click="handleExport"
- :disabled="disabled"
- :loading="exportLoading"
- id="allocateBillList-export">导出Excel</a-button>
- <a-button
- style="margin-left: 5px"
- @click="handleClassifyExport"
- :disabled="disabled"
- :loading="exportClassifyLoading"
- id="allocateBillList-export">分类导出Excel</a-button>
- </a-button></div>
- </a-spin>
- </a-modal>
- </template>
- <script>
- import { STable } from '@/components'
- import { salesStockoutDetail, exportStockout, exportGroupStockout } from '@/api/salesDetail'
- import { hdExportExcel } from '@/libs/exportExcel'
- export default {
- name: 'StockOutDetail',
- components: { STable },
- props: {
- openModal: {
- type: Boolean,
- default: false
- },
- salesBillSn: {
- type: [Number, String],
- default: ''
- },
- detailData: {
- type: Object,
- default: function () {
- return null
- }
- }
- },
- data () {
- return {
- spinning: false,
- isShow: this.openModal,
- disabled: false,
- exportLoading: false,
- exportClassifyLoading: false,
- columns: [
- { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
- { title: '产品编码', dataIndex: 'productEntity.code', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '产品名称', dataIndex: 'productEntity.name', width: '25%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
- { title: '原厂编码', dataIndex: 'productEntity.origCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '单位', dataIndex: 'productEntity.unit', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '销售数量', dataIndex: 'qty', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '销售价', dataIndex: 'price', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '销售金额', dataIndex: 'totalAmount', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '缺货数量', dataIndex: 'lackQty', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '缺货金额', dataIndex: 'lackAmount', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
- ],
- // 加载数据方法 必须为 Promise 对象
- loadData: parameter => {
- this.spinning = true
- this.disabled = true
- delete parameter.tableId
- delete parameter.index
- return salesStockoutDetail({ isOos: 1, salesBillSn: this.salesBillSn }).then(res => {
- let data
- if (res.status == 200) {
- data = res.data
- const no = 0
- for (var i = 0; i < data.length; i++) {
- data[i].no = no + i + 1
- }
- this.disabled = false
- }
- this.spinning = false
- return data
- })
- }
- }
- },
- methods: {
- handleExport () {
- const _this = this
- _this.exportLoading = true
- _this.disabled = true
- _this.spinning = true
- hdExportExcel(exportStockout, { salesBillSn: _this.salesBillSn }, '销售单缺货产品导出', function () {
- _this.exportLoading = false
- _this.spinning = false
- _this.disabled = false
- })
- },
- handleClassifyExport () {
- const _this = this
- _this.exportClassifyLoading = true
- _this.disabled = true
- _this.spinning = true
- hdExportExcel(exportGroupStockout, { isOos: 1, salesBillSn: _this.salesBillSn }, '销售单缺货产品分类导出', function () {
- _this.exportClassifyLoading = false
- _this.spinning = false
- _this.disabled = false
- })
- }
- },
- watch: {
- openModal (nVal, oVal) {
- this.isShow = nVal
- },
- isShow (nVal, oVal) {
- if (!nVal) {
- this.$emit('close')
- this.$refs.table.clearTable()
- } else {
- this.$nextTick(() => {
- this.$refs.table.refresh()
- })
- }
- }
- }
- }
- </script>
- <style>
- </style>
|