|
@@ -57,6 +57,13 @@
|
|
|
<a-col :md="6" :sm="24">
|
|
|
<a-button style="margin-bottom: 18px;" type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="productInfoList-refresh">查询</a-button>
|
|
|
<a-button style="margin: 0 0 18px 8px" @click="resetSearchForm" :disabled="disabled" id="productInfoList-reset">重置</a-button>
|
|
|
+ <a-button
|
|
|
+ style="margin: 0 0 18px 8px"
|
|
|
+ type="danger"
|
|
|
+ @click="handleExport"
|
|
|
+ :disabled="disabled"
|
|
|
+ :loading="exportLoading"
|
|
|
+ id="productInfoList-export">导出</a-button>
|
|
|
<a @click="advanced=!advanced" style="margin-left: 8px">
|
|
|
{{ advanced ? '收起' : '展开' }}
|
|
|
<a-icon :type="advanced ? 'up' : 'down'"/>
|
|
@@ -168,12 +175,13 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import moment from 'moment'
|
|
|
import { STable, VSelect } from '@/components'
|
|
|
import productInfoDetailModal from './detailModal.vue'
|
|
|
import productInfoOfflineModal from './offlineModal.vue'
|
|
|
import { productBrandQuery } from '@/api/productBrand'
|
|
|
import { productTypeQuery } from '@/api/productType'
|
|
|
-import { productList, productAudit, productBatchAudit, productDel, productOnline, productBatchOnline } from '@/api/product'
|
|
|
+import { productList, productAudit, productBatchAudit, productDel, productOnline, productBatchOnline, productExport } from '@/api/product'
|
|
|
export default {
|
|
|
components: { STable, VSelect, productInfoDetailModal, productInfoOfflineModal },
|
|
|
data () {
|
|
@@ -192,6 +200,7 @@ export default {
|
|
|
},
|
|
|
productType: [],
|
|
|
disabled: false, // 查询、重置按钮是否可操作
|
|
|
+ exportLoading: false,
|
|
|
columns: [
|
|
|
{ title: '序号', dataIndex: 'no', width: 80, align: 'center' },
|
|
|
{ title: '创建时间', dataIndex: 'createDate', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
|
|
@@ -465,6 +474,27 @@ export default {
|
|
|
this.offlineProductList = []
|
|
|
this.openOfflineModal = false
|
|
|
},
|
|
|
+ // 导出
|
|
|
+ handleExport () {
|
|
|
+ const params = this.queryParam
|
|
|
+ this.exportLoading = true
|
|
|
+ productExport(params).then(res => {
|
|
|
+ this.exportLoading = false
|
|
|
+ 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()
|
|
|
+ },
|
|
|
// 产品分类 change
|
|
|
changeProductType (val, opt) {
|
|
|
this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
|