diff --git a/src/views/device/borrow/components/applyList.vue b/src/views/device/borrow/components/applyList.vue index ec43b86..6e8f81a 100644 --- a/src/views/device/borrow/components/applyList.vue +++ b/src/views/device/borrow/components/applyList.vue @@ -3,6 +3,7 @@ import approveAction from './approvalActionDialog.vue' import { deleteApply, exportApply, getApplyList, submitApply } from '@/api/device/borrow' import type{ searchType } from '@/views/device/borrow/borrow-interface' +import { printJSON } from '@/utils/printUtils' import { exportFile } from '@/utils/exportUtils' import { getDeptTreeList } from '@/api/system/dept' import { toTreeList } from '@/utils/structure' @@ -271,6 +272,26 @@ loading.close() }) } +// 打印 +function printList() { + const selectIds = selectList.value.map(item => item.id) + const properties = columns.value.map((item) => { + return { + field: item.value, + displayName: item.text, + } + }) + if (selectIds.length <= 0 && list.value.length > 0) { + printJSON(list.value, properties, '设备借用申请') + } + else if (selectIds.length > 0) { + const printList = list.value.filter(item => selectIds.includes(item.id)) + printJSON(printList, properties, '设备借用申请') + } + else { + ElMessage('无可打印内容') + } +} const approveRef = ref() // 同意 const agree = (row: any) => { @@ -398,7 +419,7 @@ item.id) + const properties = columns.value.map((item) => { + return { + field: item.value, + displayName: item.text, + } + }) + if (selectIds.length <= 0 && list.value.length > 0) { + printJSON(list.value, properties, '设备借用申请') + } + else if (selectIds.length > 0) { + const printList = list.value.filter(item => selectIds.includes(item.id)) + printJSON(printList, properties, '设备借用申请') + } + else { + ElMessage('无可打印内容') + } +} const approveRef = ref() // 同意 const agree = (row: any) => { @@ -398,7 +419,7 @@ import { ElLoading, ElMessage, ElMessageBox } from 'element-plus' import approveAction from './approvalActionDialog.vue' +import { printJSON } from '@/utils/printUtils' const props = defineProps({ status: { type: String, @@ -63,26 +64,6 @@ align: 'center', }, ]) // 表格 -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 list = ref([]) // 表格数据 const dialogVisible = ref(false) // 添加组件的显示与隐藏 // 获取数据列表 @@ -271,6 +252,26 @@ // loading.close() // }) } +// 打印 +function printList() { + const selectIds = selectList.value.map(item => item.id) + const properties = columns.value.map((item) => { + return { + field: item.value, + displayName: item.text, + } + }) + if (selectIds.length <= 0 && list.value.length > 0) { + printJSON(list.value, properties, '设备借处理') + } + else if (selectIds.length > 0) { + const printList = list.value.filter(item => selectIds.includes(item.id)) + printJSON(printList, properties, '设备借处理') + } + else { + ElMessage('无可打印内容') + } +} const refreshDta = () => { getList() dialogVisible.value = false @@ -323,7 +324,7 @@ item.id) + const properties = columns.value.map((item) => { + return { + field: item.value, + displayName: item.text, + } + }) + if (selectIds.length <= 0 && list.value.length > 0) { + printJSON(list.value, properties, '设备借用申请') + } + else if (selectIds.length > 0) { + const printList = list.value.filter(item => selectIds.includes(item.id)) + printJSON(printList, properties, '设备借用申请') + } + else { + ElMessage('无可打印内容') + } +} const approveRef = ref() // 同意 const agree = (row: any) => { @@ -398,7 +419,7 @@ import { ElLoading, ElMessage, ElMessageBox } from 'element-plus' import approveAction from './approvalActionDialog.vue' +import { printJSON } from '@/utils/printUtils' const props = defineProps({ status: { type: String, @@ -63,26 +64,6 @@ align: 'center', }, ]) // 表格 -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 list = ref([]) // 表格数据 const dialogVisible = ref(false) // 添加组件的显示与隐藏 // 获取数据列表 @@ -271,6 +252,26 @@ // loading.close() // }) } +// 打印 +function printList() { + const selectIds = selectList.value.map(item => item.id) + const properties = columns.value.map((item) => { + return { + field: item.value, + displayName: item.text, + } + }) + if (selectIds.length <= 0 && list.value.length > 0) { + printJSON(list.value, properties, '设备借处理') + } + else if (selectIds.length > 0) { + const printList = list.value.filter(item => selectIds.includes(item.id)) + printJSON(printList, properties, '设备借处理') + } + else { + ElMessage('无可打印内容') + } +} const refreshDta = () => { getList() dialogVisible.value = false @@ -323,7 +324,7 @@ { - // reslove('http://localhost:8080/') - // }, 2000) - // }, - standard: '', - extarCss: '', -}) const list = ref([]) // 表格数据 const dialogVisible = ref(false) // 添加组件的显示与隐藏 const equipmentCategoryList = ref([]) // 设备类别 @@ -182,6 +163,27 @@ const multiSelect = (row: fixedAssetsType[]) => { selectList.value = row } +// 打印列表 +function printList() { + const selectIds: string[] = selectList.value.map((item: fixedAssetsType) => item.id) + // 打印列 + const properties = columns.value.map((item) => { + return { + field: item.value, + displayName: item.text, + } + }) + if (selectIds.length <= 0 && list.value.length > 0) { + printJSON(list.value, properties, '固定资产') + } + else if (selectIds.length > 0) { + const printList = list.value.filter((item: fixedAssetsType) => selectIds.includes(item.id)) + printJSON(printList, properties, '固定资产') + } + else { + ElMessage('无可打印内容') + } +} // 导出 const exportExcelBtn = () => { const loading = ElLoading.service({ @@ -277,7 +279,7 @@ - + item.id) + const properties = columns.value.map((item) => { + return { + field: item.value, + displayName: item.text, + } + }) + if (selectIds.length <= 0 && list.value.length > 0) { + printJSON(list.value, properties, '设备借用申请') + } + else if (selectIds.length > 0) { + const printList = list.value.filter(item => selectIds.includes(item.id)) + printJSON(printList, properties, '设备借用申请') + } + else { + ElMessage('无可打印内容') + } +} const approveRef = ref() // 同意 const agree = (row: any) => { @@ -398,7 +419,7 @@ import { ElLoading, ElMessage, ElMessageBox } from 'element-plus' import approveAction from './approvalActionDialog.vue' +import { printJSON } from '@/utils/printUtils' const props = defineProps({ status: { type: String, @@ -63,26 +64,6 @@ align: 'center', }, ]) // 表格 -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 list = ref([]) // 表格数据 const dialogVisible = ref(false) // 添加组件的显示与隐藏 // 获取数据列表 @@ -271,6 +252,26 @@ // loading.close() // }) } +// 打印 +function printList() { + const selectIds = selectList.value.map(item => item.id) + const properties = columns.value.map((item) => { + return { + field: item.value, + displayName: item.text, + } + }) + if (selectIds.length <= 0 && list.value.length > 0) { + printJSON(list.value, properties, '设备借处理') + } + else if (selectIds.length > 0) { + const printList = list.value.filter(item => selectIds.includes(item.id)) + printJSON(printList, properties, '设备借处理') + } + else { + ElMessage('无可打印内容') + } +} const refreshDta = () => { getList() dialogVisible.value = false @@ -323,7 +324,7 @@ { - // reslove('http://localhost:8080/') - // }, 2000) - // }, - standard: '', - extarCss: '', -}) const list = ref([]) // 表格数据 const dialogVisible = ref(false) // 添加组件的显示与隐藏 const equipmentCategoryList = ref([]) // 设备类别 @@ -182,6 +163,27 @@ const multiSelect = (row: fixedAssetsType[]) => { selectList.value = row } +// 打印列表 +function printList() { + const selectIds: string[] = selectList.value.map((item: fixedAssetsType) => item.id) + // 打印列 + const properties = columns.value.map((item) => { + return { + field: item.value, + displayName: item.text, + } + }) + if (selectIds.length <= 0 && list.value.length > 0) { + printJSON(list.value, properties, '固定资产') + } + else if (selectIds.length > 0) { + const printList = list.value.filter((item: fixedAssetsType) => selectIds.includes(item.id)) + printJSON(printList, properties, '固定资产') + } + else { + ElMessage('无可打印内容') + } +} // 导出 const exportExcelBtn = () => { const loading = ElLoading.service({ @@ -277,7 +279,7 @@ - + { + ruleForm1.value = res.data + }) + } } } onMounted(() => { diff --git a/src/views/device/borrow/components/applyList.vue b/src/views/device/borrow/components/applyList.vue index ec43b86..6e8f81a 100644 --- a/src/views/device/borrow/components/applyList.vue +++ b/src/views/device/borrow/components/applyList.vue @@ -3,6 +3,7 @@ import approveAction from './approvalActionDialog.vue' import { deleteApply, exportApply, getApplyList, submitApply } from '@/api/device/borrow' import type{ searchType } from '@/views/device/borrow/borrow-interface' +import { printJSON } from '@/utils/printUtils' import { exportFile } from '@/utils/exportUtils' import { getDeptTreeList } from '@/api/system/dept' import { toTreeList } from '@/utils/structure' @@ -271,6 +272,26 @@ loading.close() }) } +// 打印 +function printList() { + const selectIds = selectList.value.map(item => item.id) + const properties = columns.value.map((item) => { + return { + field: item.value, + displayName: item.text, + } + }) + if (selectIds.length <= 0 && list.value.length > 0) { + printJSON(list.value, properties, '设备借用申请') + } + else if (selectIds.length > 0) { + const printList = list.value.filter(item => selectIds.includes(item.id)) + printJSON(printList, properties, '设备借用申请') + } + else { + ElMessage('无可打印内容') + } +} const approveRef = ref() // 同意 const agree = (row: any) => { @@ -398,7 +419,7 @@ import { ElLoading, ElMessage, ElMessageBox } from 'element-plus' import approveAction from './approvalActionDialog.vue' +import { printJSON } from '@/utils/printUtils' const props = defineProps({ status: { type: String, @@ -63,26 +64,6 @@ align: 'center', }, ]) // 表格 -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 list = ref([]) // 表格数据 const dialogVisible = ref(false) // 添加组件的显示与隐藏 // 获取数据列表 @@ -271,6 +252,26 @@ // loading.close() // }) } +// 打印 +function printList() { + const selectIds = selectList.value.map(item => item.id) + const properties = columns.value.map((item) => { + return { + field: item.value, + displayName: item.text, + } + }) + if (selectIds.length <= 0 && list.value.length > 0) { + printJSON(list.value, properties, '设备借处理') + } + else if (selectIds.length > 0) { + const printList = list.value.filter(item => selectIds.includes(item.id)) + printJSON(printList, properties, '设备借处理') + } + else { + ElMessage('无可打印内容') + } +} const refreshDta = () => { getList() dialogVisible.value = false @@ -323,7 +324,7 @@ { - // reslove('http://localhost:8080/') - // }, 2000) - // }, - standard: '', - extarCss: '', -}) const list = ref([]) // 表格数据 const dialogVisible = ref(false) // 添加组件的显示与隐藏 const equipmentCategoryList = ref([]) // 设备类别 @@ -182,6 +163,27 @@ const multiSelect = (row: fixedAssetsType[]) => { selectList.value = row } +// 打印列表 +function printList() { + const selectIds: string[] = selectList.value.map((item: fixedAssetsType) => item.id) + // 打印列 + const properties = columns.value.map((item) => { + return { + field: item.value, + displayName: item.text, + } + }) + if (selectIds.length <= 0 && list.value.length > 0) { + printJSON(list.value, properties, '固定资产') + } + else if (selectIds.length > 0) { + const printList = list.value.filter((item: fixedAssetsType) => selectIds.includes(item.id)) + printJSON(printList, properties, '固定资产') + } + else { + ElMessage('无可打印内容') + } +} // 导出 const exportExcelBtn = () => { const loading = ElLoading.service({ @@ -277,7 +279,7 @@ - + { + ruleForm1.value = res.data + }) + } } } onMounted(() => { diff --git a/src/views/device/stateManage/components/templateList.vue b/src/views/device/stateManage/components/templateList.vue index b3c5d1f..c1b20e7 100644 --- a/src/views/device/stateManage/components/templateList.vue +++ b/src/views/device/stateManage/components/templateList.vue @@ -1,9 +1,10 @@