✨ feat(mes): 添加条码清单导出功能
实现条码清单的 Excel 导出功能,用户可以通过点击导出按钮下载条码清单。此功能增强了用户体验,方便用户管理和使用条码数据。pull/871/MERGE
parent
c7f9d41e07
commit
21821c92d9
|
|
@ -48,5 +48,10 @@ export const WmBarcodeApi = {
|
|||
// 删除条码
|
||||
deleteBarcode: async (id: number) => {
|
||||
return await request.delete({ url: '/mes/wm/barcode/delete?id=' + id })
|
||||
},
|
||||
|
||||
// 导出条码 Excel
|
||||
exportBarcode: async (params: any) => {
|
||||
return await request.download({ url: '/mes/wm/barcode/export-excel', params })
|
||||
}
|
||||
}
|
||||
|
|
@ -78,6 +78,15 @@
|
|||
>
|
||||
<Icon icon="ep:setting" class="mr-5px" /> 条码设置
|
||||
</el-button>
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
@click="handleExport"
|
||||
:loading="exportLoading"
|
||||
v-hasPermi="['mes:wm-barcode:export']"
|
||||
>
|
||||
<Icon icon="ep:download" class="mr-5px" /> 导出
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</ContentWrap>
|
||||
|
|
@ -167,6 +176,7 @@ import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
|||
import { WmBarcodeApi } from '@/api/mes/wm/barcode'
|
||||
import { Barcode, BarcodeDetail } from './components'
|
||||
import BarcodeForm from './BarcodeForm.vue'
|
||||
import download from '@/utils/download'
|
||||
|
||||
defineOptions({ name: 'MesWmBarcode' })
|
||||
|
||||
|
|
@ -245,6 +255,22 @@ const handleConfig = () => {
|
|||
push({ name: 'MesWmBarcodeConfig' })
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const exportLoading = ref(false)
|
||||
const handleExport = async () => {
|
||||
try {
|
||||
// 导出的二次确认
|
||||
await message.exportConfirm()
|
||||
// 发起导出
|
||||
exportLoading.value = true
|
||||
const data = await WmBarcodeApi.exportBarcode(queryParams)
|
||||
download.excel(data, '条码清单.xls')
|
||||
} catch {
|
||||
} finally {
|
||||
exportLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getList()
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue