diff --git a/src/api/system/process.ts b/src/api/system/process.ts index 7c4270c..f1f5e7b 100644 --- a/src/api/system/process.ts +++ b/src/api/system/process.ts @@ -1,5 +1,6 @@ // 流程管理接口 import request from '../index' +// import type { IlistQuery } from '@/views/system/process/process' const prefix = '/system/flow' // 列表 @@ -87,3 +88,24 @@ params: { userId }, }) } + +// 导出列表 +export function exportProcessList(data: { + deploymentId: string + suspensionState: string + number: string + name: string + business: string + person: string + beginTime: string + endTime: string + status: string + ids: string[] +}) { + return request({ + url: `${prefix}/listExport`, + method: 'post', + responseType: 'blob', + data, + }) +} diff --git a/src/api/system/process.ts b/src/api/system/process.ts index 7c4270c..f1f5e7b 100644 --- a/src/api/system/process.ts +++ b/src/api/system/process.ts @@ -1,5 +1,6 @@ // 流程管理接口 import request from '../index' +// import type { IlistQuery } from '@/views/system/process/process' const prefix = '/system/flow' // 列表 @@ -87,3 +88,24 @@ params: { userId }, }) } + +// 导出列表 +export function exportProcessList(data: { + deploymentId: string + suspensionState: string + number: string + name: string + business: string + person: string + beginTime: string + endTime: string + status: string + ids: string[] +}) { + return request({ + url: `${prefix}/listExport`, + method: 'post', + responseType: 'blob', + data, + }) +} diff --git a/src/router/modules/customer.ts b/src/router/modules/customer.ts index 389d4ee..4d133d0 100644 --- a/src/router/modules/customer.ts +++ b/src/router/modules/customer.ts @@ -61,30 +61,6 @@ activeMenu: '/sample/list', }, }, - // { - // path: 'edit', - // name: 'SampleEdit', - // component: () => import('@/views/customer/sample/list/edit.vue'), - // meta: { - // title: '编辑样品', - // icon: 'ep:key', - // sidebar: false, - // breadcrumb: true, - // activeMenu: '/sample/list', - // }, - // }, - // { - // path: 'detail', - // name: 'SampleDetail', - // component: () => import('@/views/customer/sample/list/detail.vue'), - // meta: { - // title: '样品详情', - // icon: 'ep:key', - // sidebar: false, - // breadcrumb: true, - // activeMenu: '/sample/list', - // }, - // }, { path: 'overtime', name: 'OvertimeSample', diff --git a/src/api/system/process.ts b/src/api/system/process.ts index 7c4270c..f1f5e7b 100644 --- a/src/api/system/process.ts +++ b/src/api/system/process.ts @@ -1,5 +1,6 @@ // 流程管理接口 import request from '../index' +// import type { IlistQuery } from '@/views/system/process/process' const prefix = '/system/flow' // 列表 @@ -87,3 +88,24 @@ params: { userId }, }) } + +// 导出列表 +export function exportProcessList(data: { + deploymentId: string + suspensionState: string + number: string + name: string + business: string + person: string + beginTime: string + endTime: string + status: string + ids: string[] +}) { + return request({ + url: `${prefix}/listExport`, + method: 'post', + responseType: 'blob', + data, + }) +} diff --git a/src/router/modules/customer.ts b/src/router/modules/customer.ts index 389d4ee..4d133d0 100644 --- a/src/router/modules/customer.ts +++ b/src/router/modules/customer.ts @@ -61,30 +61,6 @@ activeMenu: '/sample/list', }, }, - // { - // path: 'edit', - // name: 'SampleEdit', - // component: () => import('@/views/customer/sample/list/edit.vue'), - // meta: { - // title: '编辑样品', - // icon: 'ep:key', - // sidebar: false, - // breadcrumb: true, - // activeMenu: '/sample/list', - // }, - // }, - // { - // path: 'detail', - // name: 'SampleDetail', - // component: () => import('@/views/customer/sample/list/detail.vue'), - // meta: { - // title: '样品详情', - // icon: 'ep:key', - // sidebar: false, - // breadcrumb: true, - // activeMenu: '/sample/list', - // }, - // }, { path: 'overtime', name: 'OvertimeSample', diff --git a/src/views/customer/bench/bench.vue b/src/views/customer/bench/bench.vue index 2ed942e..dc9216e 100644 --- a/src/views/customer/bench/bench.vue +++ b/src/views/customer/bench/bench.vue @@ -188,7 +188,7 @@ diff --git a/src/api/system/process.ts b/src/api/system/process.ts index 7c4270c..f1f5e7b 100644 --- a/src/api/system/process.ts +++ b/src/api/system/process.ts @@ -1,5 +1,6 @@ // 流程管理接口 import request from '../index' +// import type { IlistQuery } from '@/views/system/process/process' const prefix = '/system/flow' // 列表 @@ -87,3 +88,24 @@ params: { userId }, }) } + +// 导出列表 +export function exportProcessList(data: { + deploymentId: string + suspensionState: string + number: string + name: string + business: string + person: string + beginTime: string + endTime: string + status: string + ids: string[] +}) { + return request({ + url: `${prefix}/listExport`, + method: 'post', + responseType: 'blob', + data, + }) +} diff --git a/src/router/modules/customer.ts b/src/router/modules/customer.ts index 389d4ee..4d133d0 100644 --- a/src/router/modules/customer.ts +++ b/src/router/modules/customer.ts @@ -61,30 +61,6 @@ activeMenu: '/sample/list', }, }, - // { - // path: 'edit', - // name: 'SampleEdit', - // component: () => import('@/views/customer/sample/list/edit.vue'), - // meta: { - // title: '编辑样品', - // icon: 'ep:key', - // sidebar: false, - // breadcrumb: true, - // activeMenu: '/sample/list', - // }, - // }, - // { - // path: 'detail', - // name: 'SampleDetail', - // component: () => import('@/views/customer/sample/list/detail.vue'), - // meta: { - // title: '样品详情', - // icon: 'ep:key', - // sidebar: false, - // breadcrumb: true, - // activeMenu: '/sample/list', - // }, - // }, { path: 'overtime', name: 'OvertimeSample', diff --git a/src/views/customer/bench/bench.vue b/src/views/customer/bench/bench.vue index 2ed942e..dc9216e 100644 --- a/src/views/customer/bench/bench.vue +++ b/src/views/customer/bench/bench.vue @@ -188,7 +188,7 @@ diff --git a/src/views/system/process/process.vue b/src/views/system/process/process.vue index a40536d..1be7c1d 100644 --- a/src/views/system/process/process.vue +++ b/src/views/system/process/process.vue @@ -7,8 +7,10 @@ import type { IlistQuery } from './process' import EditProcess from './editProcess.vue' import DetailProcess from './detailProcess.vue' -import { delProcessList, getBusinessList, getProcessList, updateState } from '@/api/system/process' +import { delProcessList, exportProcessList, getBusinessList, getProcessList, updateState } from '@/api/system/process' import { exportExcel } from '@/utils/exportXlsx' +import { exportFile } from '@/utils/exportUtils' +import { printJSON } from '@/utils/printUtils' const { proxy } = getCurrentInstance() as any const active = ref('main') @@ -90,7 +92,7 @@ const listLoading = ref(false) const dialogFormVisible = ref(false) const dialogStatus = ref('') -const multiSelectData = ref([]) // 多选选中结果 +const checkoutList = ref([]) // 多选选中结果 // 获取流程列表 const fetchData = async (isNowPage: boolean) => { listLoading.value = true @@ -187,93 +189,62 @@ const close = () => { active.value = 'main' } + // 导出 -const exportExcelBtn = async () => { +const exportAll = () => { const loading = ElLoading.service({ lock: true, - text: 'Loading', + text: '下载中请稍后', background: 'rgba(255, 255, 255, 0.8)', }) - if (multiSelectData.value.length <= 0) { - const param = { - category: '', // 流程分类 - deploymentTime: '', // 部署时间 - directorId: '', // 流程负责人id - flowKey: '', // 流程key - formId: '', // 配置表单id - formName: '', // 配置表单名称 - id: '', // 流程id - name: '', // 流程名称 - suspensionState: '', // 流程状态 - offset: 1, - limit: 9999999, + if (list.value.length > 0) { + const params = { + deploymentId: '', // 流程部署id + suspensionState: '', // 状态流程 1激活 2废止 + number: '', // 编号 + name: '', // 名称 + business: '', // 关联业务 + person: '', // 负责人 + beginTime: '', // 开始时间 + endTime: '', // 结束时间 + status: '', // 当前流程状态, + ids: checkoutList.value, } - const res = await getProcessList(param) - if (res.code === 200) { - exportExcel({ - json: res.data.rows.map((item: any, index: number) => ({ - index: index + 1, - number: item.id, - name: item.name, - business: item.formName, - status: item.suspensionState === 1 ? '激活' : '废止', - person: item.directorName, - time: item.deploymentTime, - describe: item.formDesc, - })), - name: '流程管理列表', - titleArr: ['序号', '流程编号', '流程名称', '关联业务', '当前流程状态', '流程负责人', '创建时间', '流程描述'], - sheetName: 'sheet1', - }) - } - loading.close() + exportProcessList(params).then((res) => { + const blob = new Blob([res.data]) + exportFile(blob, '流程管理列表.xlsx') + }) } else { - exportExcel({ - json: multiSelectData.value.map((item: IlistQuery, index: number) => ( - { - index: index + 1, - number: item.number, - name: item.name, - business: item.business, - status: item.status, - person: item.person, - time: item.time, - describe: item.describe, - } - )), - name: '流程管理列表', - titleArr: ['序号', '流程编号', '流程名称', '关联业务', '当前流程状态', '流程负责人', '创建时间', '流程描述'], - sheetName: 'sheet1', - }) - loading.close() + ElMessage.warning('无数据可导出数据') + } + loading.close() +} +// 打印列表 +function printList() { + // 打印列 + const properties = columns.value.map((item) => { + return { + field: item.value, + displayName: item.text, + } + }) + if (checkoutList.value.length <= 0 && list.value.length > 0) { + printJSON(list.value, properties, '流程管理列表') + } + else if (checkoutList.value.length > 0) { + // const printList = list.value.filter((item: any) => checkoutList.value.includes(item.id)) + const printList = checkoutList.value + printJSON(printList, properties, '流程管理列表') + } + else { + ElMessage.warning('无可打印内容') } } -// 打印 -const printObj = ref({ - id: 'print', // 需要打印元素的id - popTitle: '流程管理', // 打印配置页上方的标题 - extraHead: '', // 最上方的头部文字,附加在head标签上的额外标签,使用逗号分割 - preview: false, // 是否启动预览模式,默认是false - previewBeforeOpenCallback() { console.log('正在加载预览窗口!') }, // 预览窗口打开之前的callback - previewOpenCallback() { console.log('已经加载完预览窗口,预览打开了!') }, // 预览窗口打开时的callback - beforeOpenCallback() { console.log('开始打印之前!') }, // 开始打印之前的callback - openCallback() { console.log('执行打印了!') }, // 调用打印时的callback - closeCallback() { console.log('关闭了打印工具!') }, // 关闭打印的callback(无法区分确认or取消) - clickMounted() { console.log('点击v-print绑定的按钮了!') }, - // url: 'http://localhost:8080/', // 打印指定的URL,确保同源策略相同 - // asyncUrl (reslove) { - // setTimeout(() => { - // reslove('http://localhost:8080/') - // }, 2000) - // }, - standard: '', - extarCss: '', -}) // 多选选中 const selectionChange = (val: any) => { - multiSelectData.value = val + checkoutList.value = val } // 获取关联业务列表 @@ -362,8 +333,9 @@