style:质量管理模块导出支持多选

main
黄伟杰 1 week ago
parent d1f15a12b6
commit d036d353e1

@ -61,7 +61,15 @@ type="success" plain @click="handleExport" :loading="exportLoading"
</ContentWrap> </ContentWrap>
<ContentWrap> <ContentWrap>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true"> <el-table
v-loading="loading"
:data="list"
:stripe="true"
:show-overflow-tooltip="true"
row-key="id"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" fixed="left" reserve-selection />
<el-table-column label="序号" type="index" width="80" /> <el-table-column label="序号" type="index" width="80" />
<el-table-column label="单号" align="center" prop="code" /> <el-table-column label="单号" align="center" prop="code" />
<el-table-column label="质检分类" align="center"> <el-table-column label="质检分类" align="center">
@ -168,6 +176,8 @@ const exportLoading = ref(false)
const orgTypeOptions = getStrDictOptions(DICT_TYPE.MES_ORG_TYPE) const orgTypeOptions = getStrDictOptions(DICT_TYPE.MES_ORG_TYPE)
const selectedIds = ref<number[]>([])
const getList = async () => { const getList = async () => {
loading.value = true loading.value = true
try { try {
@ -210,11 +220,19 @@ const handleDelete = async (id: number) => {
} catch { } } catch { }
} }
const handleSelectionChange = (rows: ZjTaskVO[]) => {
selectedIds.value = (rows.map((row) => row.id).filter((id) => id !== undefined && id !== null) as number[])
}
const handleExport = async () => { const handleExport = async () => {
try { try {
await message.exportConfirm() await message.exportConfirm()
exportLoading.value = true exportLoading.value = true
const data = await ZjTaskApi.exportZjTask(queryParams) const params = {
...queryParams,
ids: selectedIds.value.length ? selectedIds.value.join(',') : undefined,
}
const data = await ZjTaskApi.exportZjTask(params)
download.excel(data, '检验任务.xls') download.excel(data, '检验任务.xls')
} catch { } catch {
} finally { } finally {

@ -44,7 +44,15 @@ type="success" plain @click="handleExport" :loading="exportLoading"
<!-- 列表 --> <!-- 列表 -->
<ContentWrap> <ContentWrap>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true"> <el-table
v-loading="loading"
:data="list"
:stripe="true"
:show-overflow-tooltip="true"
row-key="id"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" fixed="left" reserve-selection />
<!-- <el-table-column label="ID" align="center" prop="id" /> --> <!-- <el-table-column label="ID" align="center" prop="id" /> -->
<el-table-column label="名称" align="center" prop="name" /> <el-table-column label="名称" align="center" prop="name" />
<el-table-column label="作业方式" align="center" prop="tool" /> <el-table-column label="作业方式" align="center" prop="tool" />
@ -113,6 +121,7 @@ const queryParams = reactive({
}) })
const queryFormRef = ref() // const queryFormRef = ref() //
const exportLoading = ref(false) // const exportLoading = ref(false) //
const selectedIds = ref<number[]>([])
/** 查询列表 */ /** 查询列表 */
const getList = async () => { const getList = async () => {
@ -157,6 +166,10 @@ const handleDelete = async (id: number) => {
} catch { } } catch { }
} }
const handleSelectionChange = (rows: any[]) => {
selectedIds.value = rows?.map((row) => row.id).filter((id) => id !== undefined) ?? []
}
/** 导出按钮操作 */ /** 导出按钮操作 */
const handleExport = async () => { const handleExport = async () => {
try { try {
@ -164,7 +177,11 @@ const handleExport = async () => {
await message.exportConfirm() await message.exportConfirm()
// //
exportLoading.value = true exportLoading.value = true
const data = await ZjItemApi.exportZjItem(queryParams) const params = {
...queryParams,
ids: selectedIds.value.length ? selectedIds.value.join(',') : undefined,
}
const data = await ZjItemApi.exportZjItem(params)
download.excel(data, '质量管理-检验项目.xls') download.excel(data, '质量管理-检验项目.xls')
} catch { } catch {
} finally { } finally {

@ -61,7 +61,15 @@ type="success" plain @click="handleExport" :loading="exportLoading"
<!-- 列表 --> <!-- 列表 -->
<ContentWrap> <ContentWrap>
<el-table v-loading="loading" :data="list" :show-overflow-tooltip="true" @expand-change="handleExpandChange"> <el-table
v-loading="loading"
:data="list"
:show-overflow-tooltip="true"
row-key="id"
@expand-change="handleExpandChange"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" fixed="left" reserve-selection />
<el-table-column type="expand"> <el-table-column type="expand">
<template #default="scope"> <template #default="scope">
<el-table <el-table
@ -148,6 +156,7 @@ const queryParams = reactive({
}) })
const queryFormRef = ref() // const queryFormRef = ref() //
const exportLoading = ref(false) // const exportLoading = ref(false) //
const selectedIds = ref<number[]>([])
const formatValDisplay = (val: any) => { const formatValDisplay = (val: any) => {
if (val === undefined || val === null || val === '') return '' if (val === undefined || val === null || val === '') return ''
@ -205,6 +214,10 @@ const handleDelete = async (id: number) => {
} catch { } } catch { }
} }
const handleSelectionChange = (rows: any[]) => {
selectedIds.value = rows?.map((row) => row.id).filter((id) => id !== undefined) ?? []
}
/** 导出按钮操作 */ /** 导出按钮操作 */
const handleExport = async () => { const handleExport = async () => {
try { try {
@ -212,7 +225,11 @@ const handleExport = async () => {
await message.exportConfirm() await message.exportConfirm()
// //
exportLoading.value = true exportLoading.value = true
const data = await ZjSchemaApi.exportZjSchema(queryParams) const params = {
...queryParams,
ids: selectedIds.value.length ? selectedIds.value.join(',') : undefined,
}
const data = await ZjSchemaApi.exportZjSchema(params)
download.excel(data, '检验方案.xls') download.excel(data, '检验方案.xls')
} catch { } catch {
} finally { } finally {

@ -72,7 +72,15 @@
<!-- 列表 --> <!-- 列表 -->
<ContentWrap> <ContentWrap>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true"> <el-table
v-loading="loading"
:data="list"
:stripe="true"
:show-overflow-tooltip="true"
row-key="id"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" fixed="left" reserve-selection />
<!-- <el-table-column label="ID" align="center" prop="id" /> --> <!-- <el-table-column label="ID" align="center" prop="id" /> -->
<el-table-column label="编码" align="center" prop="code" /> <el-table-column label="编码" align="center" prop="code" />
<el-table-column label="名称" align="center" prop="name" /> <el-table-column label="名称" align="center" prop="name" />
@ -143,6 +151,7 @@ const queryParams = reactive({
}) })
const queryFormRef = ref() // const queryFormRef = ref() //
const exportLoading = ref(false) // const exportLoading = ref(false) //
const selectedIds = ref<number[]>([])
/** 查询列表 */ /** 查询列表 */
const getList = async () => { const getList = async () => {
@ -187,6 +196,10 @@ const handleDelete = async (id: number) => {
} catch {} } catch {}
} }
const handleSelectionChange = (rows: any[]) => {
selectedIds.value = rows?.map((row) => row.id).filter((id) => id !== undefined) ?? []
}
/** 导出按钮操作 */ /** 导出按钮操作 */
const handleExport = async () => { const handleExport = async () => {
try { try {
@ -194,7 +207,11 @@ const handleExport = async () => {
await message.exportConfirm() await message.exportConfirm()
// //
exportLoading.value = true exportLoading.value = true
const data = await ZjTypeApi.exportZjType(queryParams) const params = {
...queryParams,
ids: selectedIds.value.length ? selectedIds.value.join(',') : undefined,
}
const data = await ZjTypeApi.exportZjType(params)
download.excel(data, '质量管理-检验类型.xls') download.excel(data, '质量管理-检验类型.xls')
} catch { } catch {
} finally { } finally {
@ -206,4 +223,4 @@ const handleExport = async () => {
onMounted(() => { onMounted(() => {
getList() getList()
}) })
</script> </script>

Loading…
Cancel
Save