|
@@ -63,7 +63,7 @@
|
|
|
type="primary"
|
|
|
style="margin-left: 5px"
|
|
|
class="button-warning"
|
|
|
- @click="handleExport"
|
|
|
+ @click="openExcelModal=true"
|
|
|
:disabled="disabled"
|
|
|
:loading="exportLoading"
|
|
|
id="inventoryQueryList-export">导出</a-button>
|
|
@@ -116,6 +116,8 @@
|
|
|
</a-spin>
|
|
|
<!-- 库存详情 -->
|
|
|
<inventory-query-detail-modal :openModal="openModal" :itemId="itemId" @close="closeModal" />
|
|
|
+ <!-- 导出Excel -->
|
|
|
+ <export-excel-modal :openModal="openExcelModal" @ok="handleExcelOk" @close="openExcelModal=false" />
|
|
|
</a-card>
|
|
|
</template>
|
|
|
|
|
@@ -123,11 +125,13 @@
|
|
|
import moment from 'moment'
|
|
|
import { STable, VSelect } from '@/components'
|
|
|
import inventoryQueryDetailModal from './detailModal.vue'
|
|
|
+import exportExcelModal from './exportExcelModal.vue'
|
|
|
import { productBrandQuery } from '@/api/productBrand'
|
|
|
import { productTypeQuery } from '@/api/productType'
|
|
|
+import { hdExportExcel } from '@/libs/exportExcel'
|
|
|
import { stockList, stockCount, stockExport } from '@/api/stock'
|
|
|
export default {
|
|
|
- components: { STable, VSelect, inventoryQueryDetailModal },
|
|
|
+ components: { STable, VSelect, inventoryQueryDetailModal, exportExcelModal },
|
|
|
data () {
|
|
|
return {
|
|
|
spinning: false,
|
|
@@ -194,7 +198,8 @@ export default {
|
|
|
},
|
|
|
openModal: false, // 查看库存详情 弹框
|
|
|
itemId: '', // 当前库存记录id
|
|
|
- currentStock: null
|
|
|
+ currentStock: null,
|
|
|
+ openExcelModal: false
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
@@ -253,59 +258,18 @@ export default {
|
|
|
goWarehouseDetail (row) {
|
|
|
this.$router.push({ path: `/inventoryManagement/inventoryQuery/warehouseDetail/${row.productSn}` })
|
|
|
},
|
|
|
- // 导出
|
|
|
- handleExport () {
|
|
|
+ // 导出Excel
|
|
|
+ handleExcelOk (exportType) {
|
|
|
const _this = this
|
|
|
const params = JSON.parse(JSON.stringify(this.queryParam))
|
|
|
- if (params.zeroQtyFlag) {
|
|
|
- params.zeroQtyFlag = '0'
|
|
|
- } else {
|
|
|
- params.zeroQtyFlag = ''
|
|
|
- }
|
|
|
+ params.exportType = exportType
|
|
|
this.exportLoading = true
|
|
|
- _this.spinning = true
|
|
|
- stockExport(params).then(res => {
|
|
|
- this.exportLoading = false
|
|
|
+ this.spinning = true
|
|
|
+ hdExportExcel(stockExport, params, '库存查询', function () {
|
|
|
+ _this.exportLoading = false
|
|
|
_this.spinning = false
|
|
|
- if (res.type == 'application/json') {
|
|
|
- var reader = new FileReader()
|
|
|
- reader.addEventListener('loadend', function () {
|
|
|
- const obj = JSON.parse(reader.result)
|
|
|
- _this.$notification.error({
|
|
|
- message: '提示',
|
|
|
- description: obj.message
|
|
|
- })
|
|
|
- })
|
|
|
- reader.readAsText(res)
|
|
|
- } else {
|
|
|
- this.download(res)
|
|
|
- }
|
|
|
})
|
|
|
},
|
|
|
- download (data) {
|
|
|
- if (!data) { return }
|
|
|
- const url = window.URL.createObjectURL(new Blob([data]))
|
|
|
- const link = document.createElement('a')
|
|
|
- link.style.display = 'none'
|
|
|
- link.href = url
|
|
|
- const a = moment().format('YYYYMMDDHHmmss')
|
|
|
- const fname = '库存查询' + a
|
|
|
- link.setAttribute('download', fname + '.xlsx')
|
|
|
- document.body.appendChild(link)
|
|
|
- link.click()
|
|
|
- },
|
|
|
- // 递归函数
|
|
|
- recursionFun (data) {
|
|
|
- if (data) {
|
|
|
- data.map((item, index) => {
|
|
|
- if (item.children && item.children.length == 0) {
|
|
|
- delete item.children
|
|
|
- } else {
|
|
|
- this.recursionFun(item.children)
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- },
|
|
|
// 产品分类 change
|
|
|
changeProductType (val, opt) {
|
|
|
this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
|