|
@@ -61,8 +61,15 @@
|
|
|
<a-col :md="6" :sm="24">
|
|
|
<span class="table-page-search-submitButtons">
|
|
|
<a-button type="primary" :disabled="disabled" @click="$refs.table.refresh(true)">查询</a-button>
|
|
|
- <a-button style="margin-left: 8px" :disabled="disabled" @click="resetSearchForm()">重置</a-button>
|
|
|
- <a @click="advanced=!advanced" style="margin-left: 8px">
|
|
|
+ <a-button style="margin-left: 5px" :disabled="disabled" @click="resetSearchForm()">重置</a-button>
|
|
|
+ <a-button
|
|
|
+ type="primary"
|
|
|
+ class="button-warning"
|
|
|
+ @click="handleExport"
|
|
|
+ :disabled="disabled"
|
|
|
+ :loading="exportLoading"
|
|
|
+ id="salesManagementList-export">导出</a-button>
|
|
|
+ <a @click="advanced=!advanced" style="margin-left: 5px">
|
|
|
{{ advanced ? '收起' : '展开' }}
|
|
|
<a-icon :type="advanced ? 'up' : 'down'"/>
|
|
|
</a>
|
|
@@ -168,10 +175,11 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import moment from 'moment'
|
|
|
import { STable, VSelect } from '@/components'
|
|
|
import chooseCustomModal from './chooseCustomModal.vue'
|
|
|
import auditModal from '@/views/common/auditModal.vue'
|
|
|
-import { salesList, salesDel, salesWriteAudit, salesWriteStockOut, salesCount } from '@/api/sales'
|
|
|
+import { salesList, salesDel, salesWriteAudit, salesWriteStockOut, salesCount, salesExport } from '@/api/sales'
|
|
|
import { settleStyleQueryAll } from '@/api/settleStyle'
|
|
|
import rangeDate from '@/views/common/rangeDate.vue'
|
|
|
import custList from '@/views/common/custList.vue'
|
|
@@ -184,6 +192,7 @@ export default {
|
|
|
tableHeight: 0,
|
|
|
advanced: true, // 高级搜索 展开/关闭
|
|
|
disabled: false, // 查询、重置按钮是否可操作
|
|
|
+ exportLoading: false, // 导出loading
|
|
|
openModal: false, // 选择客户弹框是否显示
|
|
|
settleStyleList: [], // 收款方式
|
|
|
// 查询参数
|
|
@@ -359,6 +368,42 @@ export default {
|
|
|
this.$refs.custList.resetForm()
|
|
|
this.$refs.table.refresh(true)
|
|
|
},
|
|
|
+ // 导出
|
|
|
+ handleExport () {
|
|
|
+ const _this = this
|
|
|
+ const params = this.queryParam
|
|
|
+ this.exportLoading = true
|
|
|
+ _this.spinning = true
|
|
|
+ salesExport(params).then(res => {
|
|
|
+ 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()
|
|
|
+ },
|
|
|
// 获取收款方式
|
|
|
getSettleStyle () {
|
|
|
settleStyleQueryAll().then(res => {
|