yyw提交
This commit is contained in:
parent
48b44a69ba
commit
421465917c
@ -59,6 +59,7 @@
|
|||||||
<div class="opaBox">
|
<div class="opaBox">
|
||||||
<el-button type="primary" @click="handleAdd"><el-icon><Plus /></el-icon> 新增</el-button>
|
<el-button type="primary" @click="handleAdd"><el-icon><Plus /></el-icon> 新增</el-button>
|
||||||
<el-button type="primary" v-if="role" :disabled="!chooseList.length" @click="lte_stock = 0, showStock = true">设置预警库存</el-button>
|
<el-button type="primary" v-if="role" :disabled="!chooseList.length" @click="lte_stock = 0, showStock = true">设置预警库存</el-button>
|
||||||
|
<el-button type="warning" @click="handleExport" :loading="exportLoading"><span class="iconfont icon-daochu"></span> 导出</el-button>
|
||||||
</div>
|
</div>
|
||||||
<el-table :data="tableList" style="width: 100%" border v-loading="loading" @select="select"
|
<el-table :data="tableList" style="width: 100%" border v-loading="loading" @select="select"
|
||||||
ref="multipleTable" @select-all="selectAll">
|
ref="multipleTable" @select-all="selectAll">
|
||||||
@ -279,7 +280,8 @@ export default {
|
|||||||
chooseList: [],
|
chooseList: [],
|
||||||
lte_stock: 0,
|
lte_stock: 0,
|
||||||
showStock: false,
|
showStock: false,
|
||||||
showUpdate: false
|
showUpdate: false,
|
||||||
|
exportLoading: false
|
||||||
})
|
})
|
||||||
|
|
||||||
function handleSearch() {
|
function handleSearch() {
|
||||||
@ -306,6 +308,44 @@ export default {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleExport = () => {
|
||||||
|
data.exportLoading = true
|
||||||
|
let params = {
|
||||||
|
page: data.page,
|
||||||
|
pageSize: data.pageSize,
|
||||||
|
service_id: data.service_id,
|
||||||
|
...data.filter,
|
||||||
|
brand_ids: data.brandIds.join(','),
|
||||||
|
goods_ids: data.goodsIds.join(','),
|
||||||
|
export: 1
|
||||||
|
}
|
||||||
|
get(`/api/goods-skus`, params, 'blob').then((res) => {
|
||||||
|
downLoadXls(res)
|
||||||
|
ElMessage({ type: "success", message: "导出成功!" })
|
||||||
|
data.exportLoading = false
|
||||||
|
}).catch(() => {
|
||||||
|
data.exportLoading = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function downLoadXls(response) {
|
||||||
|
const content = response
|
||||||
|
const blob = new Blob([content])
|
||||||
|
const fileName = `商品规格.xlsx`
|
||||||
|
if ('download' in document.createElement('a')) {
|
||||||
|
const elink = document.createElement('a')
|
||||||
|
elink.download = fileName
|
||||||
|
elink.style.display = 'none'
|
||||||
|
elink.href = URL.createObjectURL(blob)
|
||||||
|
document.body.appendChild(elink)
|
||||||
|
elink.click()
|
||||||
|
URL.revokeObjectURL(elink.href)
|
||||||
|
document.body.removeChild(elink)
|
||||||
|
} else {
|
||||||
|
navigator.msSaveBlob(blob, fileName)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function handleCurrentChange(e) {
|
function handleCurrentChange(e) {
|
||||||
data.page = e
|
data.page = e
|
||||||
fetchData()
|
fetchData()
|
||||||
@ -459,6 +499,7 @@ export default {
|
|||||||
handleSearch,
|
handleSearch,
|
||||||
handleCurrentChange,
|
handleCurrentChange,
|
||||||
handleSizeChange,
|
handleSizeChange,
|
||||||
|
handleExport,
|
||||||
fetchData,
|
fetchData,
|
||||||
handleAdd,
|
handleAdd,
|
||||||
handleEdit,
|
handleEdit,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user