diff --git a/src/views/device/deviceMaintenance/components/listApproval.vue b/src/views/device/deviceMaintenance/components/listApproval.vue index 7bfd090..8fec470 100644 --- a/src/views/device/deviceMaintenance/components/listApproval.vue +++ b/src/views/device/deviceMaintenance/components/listApproval.vue @@ -1,7 +1,8 @@ diff --git a/src/views/device/deviceMaintenance/components/listApproval.vue b/src/views/device/deviceMaintenance/components/listApproval.vue index 7bfd090..8fec470 100644 --- a/src/views/device/deviceMaintenance/components/listApproval.vue +++ b/src/views/device/deviceMaintenance/components/listApproval.vue @@ -1,7 +1,8 @@ diff --git a/src/views/device/deviceMaintenance/components/listMaintenanceApproval.vue b/src/views/device/deviceMaintenance/components/listMaintenanceApproval.vue index 44335a6..4ff3806 100644 --- a/src/views/device/deviceMaintenance/components/listMaintenanceApproval.vue +++ b/src/views/device/deviceMaintenance/components/listMaintenanceApproval.vue @@ -1,5 +1,6 @@ diff --git a/src/views/device/deviceMaintenance/components/listApproval.vue b/src/views/device/deviceMaintenance/components/listApproval.vue index 7bfd090..8fec470 100644 --- a/src/views/device/deviceMaintenance/components/listApproval.vue +++ b/src/views/device/deviceMaintenance/components/listApproval.vue @@ -1,7 +1,8 @@ diff --git a/src/views/device/deviceMaintenance/components/listMaintenanceApproval.vue b/src/views/device/deviceMaintenance/components/listMaintenanceApproval.vue index 44335a6..4ff3806 100644 --- a/src/views/device/deviceMaintenance/components/listMaintenanceApproval.vue +++ b/src/views/device/deviceMaintenance/components/listMaintenanceApproval.vue @@ -1,5 +1,6 @@ diff --git a/src/views/device/deviceMaintenance/components/listPageAdd.vue b/src/views/device/deviceMaintenance/components/listPageAdd.vue index a3129d4..0a3dd34 100644 --- a/src/views/device/deviceMaintenance/components/listPageAdd.vue +++ b/src/views/device/deviceMaintenance/components/listPageAdd.vue @@ -567,7 +567,8 @@ import type { PropType, Ref } from 'vue' +import { getCurrentInstance, ref } from 'vue' import { ElLoading, ElMessage, ElMessageBox, buttonEmits } from 'element-plus' -import type { IButton, ISupplier, IlistType, IlistTypes, supplierExportQuery } from '@views/measure/source/list_interface' +import type { IButton, ISupplier, IlistTypes, supplierExportQuery } from '@views/measure/source/list_interface' import type { IOptions } from '../checkList_interface' import type { TableColumn } from '@/components/NormalTable/table_interface' import { getApprovalDelete, getDeptTree, getListSubmit, getapprovalList } from '@/api/system/plan' @@ -9,6 +10,7 @@ import ApprovalDialog from '@/components/Approval/ApprovalDialog.vue' import { SCHEDULE } from '@/utils/scheduleDict' import { submitApproval } from '@/api/approval' +import { printJSON } from '@/utils/printUtils' const props = defineProps({ status: { type: String, @@ -21,9 +23,12 @@ }) const emit = defineEmits(['setData']) // 关闭 +// 获取权限 +const { proxy } = getCurrentInstance() as any + // 操作列宽度-计算属性 const operationWidth = computed(() => { - return props.buttons.length * 32 + 24 + return props.buttons.length * 40 + 24 }) // 查询条件 @@ -98,10 +103,14 @@ const deleteId = ref('') // 详情id const infoId = ref('0') +// 装载时间数组 +const checkTime = ref('') // 点击按钮 const buttonType = ref('') const loadingTable = ref(false) const fetchData = (isNowPage: boolean) => { + listQuery.value.checkStartDate = checkTime.value[0] || '' + listQuery.value.checkEndDate = checkTime.value[1] || '' loadingTable.value = true if (!isNowPage) { // 是否显示当前页,否则跳转第一页 @@ -191,8 +200,6 @@ const cancelEvent = () => { console.log('cancel!') } -// 装载时间数组 -const checkTimeArr = ref([listQuery.value.checkStartDate, listQuery.value.checkEndDate]) // 点击重置 const clearList = () => { listQuery.value = { @@ -211,7 +218,7 @@ offset: 1, limit: 20, } - checkTimeArr.value = [] + checkTime.value = '' } // 点击跳转 const add = () => { @@ -339,15 +346,30 @@ fetchData(false) }, { immediate: true }) -// 打印 -const printObj = ref({ - id: 'print', // 需要打印元素的id - popTitle: '设备检修保养验收单', // 打印配置页上方的标题 - extraHead: '', // 最上方的头部文字,附加在head标签上的额外标签,使用逗号分割 - preview: false, // 是否启动预览模式,默认是false - standard: '', - extarCss: '', -}) +// 导出id类型 +interface ISupplierTable { + id: never +} +// 打印列表 +function printList() { + // 打印列 + const properties = columns.value.map((item: TableColumn) => { + 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: ISupplierTable) => checkoutList.value.includes(item.id)) + printJSON(printList, properties, '设备检修列表') + } + else { + ElMessage.warning('无可打印内容') + } +} diff --git a/src/views/device/deviceMaintenance/components/listMaintenanceApproval.vue b/src/views/device/deviceMaintenance/components/listMaintenanceApproval.vue index 44335a6..4ff3806 100644 --- a/src/views/device/deviceMaintenance/components/listMaintenanceApproval.vue +++ b/src/views/device/deviceMaintenance/components/listMaintenanceApproval.vue @@ -1,5 +1,6 @@ diff --git a/src/views/device/deviceMaintenance/components/listPageAdd.vue b/src/views/device/deviceMaintenance/components/listPageAdd.vue index a3129d4..0a3dd34 100644 --- a/src/views/device/deviceMaintenance/components/listPageAdd.vue +++ b/src/views/device/deviceMaintenance/components/listPageAdd.vue @@ -567,7 +567,8 @@ import type { PropType, Ref } from 'vue' +import { getCurrentInstance, ref } from 'vue' import { ElLoading, ElMessage, ElMessageBox, buttonEmits } from 'element-plus' -import type { IButton, ISupplier, IlistType, IlistTypes, supplierExportQuery } from '@views/measure/source/list_interface' +import type { IButton, ISupplier, IlistTypes, supplierExportQuery } from '@views/measure/source/list_interface' import type { IOptions } from '../checkList_interface' import type { TableColumn } from '@/components/NormalTable/table_interface' import { getApprovalDelete, getDeptTree, getListSubmit, getapprovalList } from '@/api/system/plan' @@ -9,6 +10,7 @@ import ApprovalDialog from '@/components/Approval/ApprovalDialog.vue' import { SCHEDULE } from '@/utils/scheduleDict' import { submitApproval } from '@/api/approval' +import { printJSON } from '@/utils/printUtils' const props = defineProps({ status: { type: String, @@ -21,9 +23,12 @@ }) const emit = defineEmits(['setData']) // 关闭 +// 获取权限 +const { proxy } = getCurrentInstance() as any + // 操作列宽度-计算属性 const operationWidth = computed(() => { - return props.buttons.length * 32 + 24 + return props.buttons.length * 40 + 24 }) // 查询条件 @@ -98,10 +103,14 @@ const deleteId = ref('') // 详情id const infoId = ref('0') +// 装载时间数组 +const checkTime = ref('') // 点击按钮 const buttonType = ref('') const loadingTable = ref(false) const fetchData = (isNowPage: boolean) => { + listQuery.value.checkStartDate = checkTime.value[0] || '' + listQuery.value.checkEndDate = checkTime.value[1] || '' loadingTable.value = true if (!isNowPage) { // 是否显示当前页,否则跳转第一页 @@ -191,8 +200,6 @@ const cancelEvent = () => { console.log('cancel!') } -// 装载时间数组 -const checkTimeArr = ref([listQuery.value.checkStartDate, listQuery.value.checkEndDate]) // 点击重置 const clearList = () => { listQuery.value = { @@ -211,7 +218,7 @@ offset: 1, limit: 20, } - checkTimeArr.value = [] + checkTime.value = '' } // 点击跳转 const add = () => { @@ -339,15 +346,30 @@ fetchData(false) }, { immediate: true }) -// 打印 -const printObj = ref({ - id: 'print', // 需要打印元素的id - popTitle: '设备检修保养验收单', // 打印配置页上方的标题 - extraHead: '', // 最上方的头部文字,附加在head标签上的额外标签,使用逗号分割 - preview: false, // 是否启动预览模式,默认是false - standard: '', - extarCss: '', -}) +// 导出id类型 +interface ISupplierTable { + id: never +} +// 打印列表 +function printList() { + // 打印列 + const properties = columns.value.map((item: TableColumn) => { + 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: ISupplierTable) => checkoutList.value.includes(item.id)) + printJSON(printList, properties, '设备检修列表') + } + else { + ElMessage.warning('无可打印内容') + } +} diff --git a/src/views/device/deviceMaintenance/components/listMaintenanceApproval.vue b/src/views/device/deviceMaintenance/components/listMaintenanceApproval.vue index 44335a6..4ff3806 100644 --- a/src/views/device/deviceMaintenance/components/listMaintenanceApproval.vue +++ b/src/views/device/deviceMaintenance/components/listMaintenanceApproval.vue @@ -1,5 +1,6 @@ diff --git a/src/views/device/deviceMaintenance/components/listPageAdd.vue b/src/views/device/deviceMaintenance/components/listPageAdd.vue index a3129d4..0a3dd34 100644 --- a/src/views/device/deviceMaintenance/components/listPageAdd.vue +++ b/src/views/device/deviceMaintenance/components/listPageAdd.vue @@ -567,7 +567,8 @@ import type { PropType, Ref } from 'vue' +import { getCurrentInstance, ref } from 'vue' import { ElLoading, ElMessage, ElMessageBox, buttonEmits } from 'element-plus' -import type { IButton, ISupplier, IlistType, IlistTypes, supplierExportQuery } from '@views/measure/source/list_interface' +import type { IButton, ISupplier, IlistTypes, supplierExportQuery } from '@views/measure/source/list_interface' import type { IOptions } from '../checkList_interface' import type { TableColumn } from '@/components/NormalTable/table_interface' import { getApprovalDelete, getDeptTree, getListSubmit, getapprovalList } from '@/api/system/plan' @@ -9,6 +10,7 @@ import ApprovalDialog from '@/components/Approval/ApprovalDialog.vue' import { SCHEDULE } from '@/utils/scheduleDict' import { submitApproval } from '@/api/approval' +import { printJSON } from '@/utils/printUtils' const props = defineProps({ status: { type: String, @@ -21,9 +23,12 @@ }) const emit = defineEmits(['setData']) // 关闭 +// 获取权限 +const { proxy } = getCurrentInstance() as any + // 操作列宽度-计算属性 const operationWidth = computed(() => { - return props.buttons.length * 32 + 24 + return props.buttons.length * 40 + 24 }) // 查询条件 @@ -98,10 +103,14 @@ const deleteId = ref('') // 详情id const infoId = ref('0') +// 装载时间数组 +const checkTime = ref('') // 点击按钮 const buttonType = ref('') const loadingTable = ref(false) const fetchData = (isNowPage: boolean) => { + listQuery.value.checkStartDate = checkTime.value[0] || '' + listQuery.value.checkEndDate = checkTime.value[1] || '' loadingTable.value = true if (!isNowPage) { // 是否显示当前页,否则跳转第一页 @@ -191,8 +200,6 @@ const cancelEvent = () => { console.log('cancel!') } -// 装载时间数组 -const checkTimeArr = ref([listQuery.value.checkStartDate, listQuery.value.checkEndDate]) // 点击重置 const clearList = () => { listQuery.value = { @@ -211,7 +218,7 @@ offset: 1, limit: 20, } - checkTimeArr.value = [] + checkTime.value = '' } // 点击跳转 const add = () => { @@ -339,15 +346,30 @@ fetchData(false) }, { immediate: true }) -// 打印 -const printObj = ref({ - id: 'print', // 需要打印元素的id - popTitle: '设备检修保养验收单', // 打印配置页上方的标题 - extraHead: '', // 最上方的头部文字,附加在head标签上的额外标签,使用逗号分割 - preview: false, // 是否启动预览模式,默认是false - standard: '', - extarCss: '', -}) +// 导出id类型 +interface ISupplierTable { + id: never +} +// 打印列表 +function printList() { + // 打印列 + const properties = columns.value.map((item: TableColumn) => { + 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: ISupplierTable) => checkoutList.value.includes(item.id)) + printJSON(printList, properties, '设备检修列表') + } + else { + ElMessage.warning('无可打印内容') + } +} diff --git a/src/views/device/deviceMaintenance/components/listMaintenanceApproval.vue b/src/views/device/deviceMaintenance/components/listMaintenanceApproval.vue index 44335a6..4ff3806 100644 --- a/src/views/device/deviceMaintenance/components/listMaintenanceApproval.vue +++ b/src/views/device/deviceMaintenance/components/listMaintenanceApproval.vue @@ -1,5 +1,6 @@ diff --git a/src/views/device/deviceMaintenance/components/listPageAdd.vue b/src/views/device/deviceMaintenance/components/listPageAdd.vue index a3129d4..0a3dd34 100644 --- a/src/views/device/deviceMaintenance/components/listPageAdd.vue +++ b/src/views/device/deviceMaintenance/components/listPageAdd.vue @@ -567,7 +567,8 @@ import type { PropType, Ref } from 'vue' +import { getCurrentInstance, ref } from 'vue' import { ElLoading, ElMessage, ElMessageBox, buttonEmits } from 'element-plus' -import type { IButton, ISupplier, IlistType, IlistTypes, supplierExportQuery } from '@views/measure/source/list_interface' +import type { IButton, ISupplier, IlistTypes, supplierExportQuery } from '@views/measure/source/list_interface' import type { IOptions } from '../checkList_interface' import type { TableColumn } from '@/components/NormalTable/table_interface' import { getApprovalDelete, getDeptTree, getListSubmit, getapprovalList } from '@/api/system/plan' @@ -9,6 +10,7 @@ import ApprovalDialog from '@/components/Approval/ApprovalDialog.vue' import { SCHEDULE } from '@/utils/scheduleDict' import { submitApproval } from '@/api/approval' +import { printJSON } from '@/utils/printUtils' const props = defineProps({ status: { type: String, @@ -21,9 +23,12 @@ }) const emit = defineEmits(['setData']) // 关闭 +// 获取权限 +const { proxy } = getCurrentInstance() as any + // 操作列宽度-计算属性 const operationWidth = computed(() => { - return props.buttons.length * 32 + 24 + return props.buttons.length * 40 + 24 }) // 查询条件 @@ -98,10 +103,14 @@ const deleteId = ref('') // 详情id const infoId = ref('0') +// 装载时间数组 +const checkTime = ref('') // 点击按钮 const buttonType = ref('') const loadingTable = ref(false) const fetchData = (isNowPage: boolean) => { + listQuery.value.checkStartDate = checkTime.value[0] || '' + listQuery.value.checkEndDate = checkTime.value[1] || '' loadingTable.value = true if (!isNowPage) { // 是否显示当前页,否则跳转第一页 @@ -191,8 +200,6 @@ const cancelEvent = () => { console.log('cancel!') } -// 装载时间数组 -const checkTimeArr = ref([listQuery.value.checkStartDate, listQuery.value.checkEndDate]) // 点击重置 const clearList = () => { listQuery.value = { @@ -211,7 +218,7 @@ offset: 1, limit: 20, } - checkTimeArr.value = [] + checkTime.value = '' } // 点击跳转 const add = () => { @@ -339,15 +346,30 @@ fetchData(false) }, { immediate: true }) -// 打印 -const printObj = ref({ - id: 'print', // 需要打印元素的id - popTitle: '设备检修保养验收单', // 打印配置页上方的标题 - extraHead: '', // 最上方的头部文字,附加在head标签上的额外标签,使用逗号分割 - preview: false, // 是否启动预览模式,默认是false - standard: '', - extarCss: '', -}) +// 导出id类型 +interface ISupplierTable { + id: never +} +// 打印列表 +function printList() { + // 打印列 + const properties = columns.value.map((item: TableColumn) => { + 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: ISupplierTable) => checkoutList.value.includes(item.id)) + printJSON(printList, properties, '设备检修列表') + } + else { + ElMessage.warning('无可打印内容') + } +} diff --git a/src/views/device/deviceMaintenance/components/listMaintenanceApproval.vue b/src/views/device/deviceMaintenance/components/listMaintenanceApproval.vue index 44335a6..4ff3806 100644 --- a/src/views/device/deviceMaintenance/components/listMaintenanceApproval.vue +++ b/src/views/device/deviceMaintenance/components/listMaintenanceApproval.vue @@ -1,5 +1,6 @@ diff --git a/src/views/device/deviceMaintenance/components/listPageAdd.vue b/src/views/device/deviceMaintenance/components/listPageAdd.vue index a3129d4..0a3dd34 100644 --- a/src/views/device/deviceMaintenance/components/listPageAdd.vue +++ b/src/views/device/deviceMaintenance/components/listPageAdd.vue @@ -567,7 +567,8 @@ ([]) +// 获取权限 const { proxy } = getCurrentInstance() as any // 总数 const total = ref(0) @@ -254,11 +255,11 @@ - 查看 + 详情 import type { PropType, Ref } from 'vue' +import { getCurrentInstance, ref } from 'vue' import { ElLoading, ElMessage, ElMessageBox, buttonEmits } from 'element-plus' -import type { IButton, ISupplier, IlistType, IlistTypes, supplierExportQuery } from '@views/measure/source/list_interface' +import type { IButton, ISupplier, IlistTypes, supplierExportQuery } from '@views/measure/source/list_interface' import type { IOptions } from '../checkList_interface' import type { TableColumn } from '@/components/NormalTable/table_interface' import { getApprovalDelete, getDeptTree, getListSubmit, getapprovalList } from '@/api/system/plan' @@ -9,6 +10,7 @@ import ApprovalDialog from '@/components/Approval/ApprovalDialog.vue' import { SCHEDULE } from '@/utils/scheduleDict' import { submitApproval } from '@/api/approval' +import { printJSON } from '@/utils/printUtils' const props = defineProps({ status: { type: String, @@ -21,9 +23,12 @@ }) const emit = defineEmits(['setData']) // 关闭 +// 获取权限 +const { proxy } = getCurrentInstance() as any + // 操作列宽度-计算属性 const operationWidth = computed(() => { - return props.buttons.length * 32 + 24 + return props.buttons.length * 40 + 24 }) // 查询条件 @@ -98,10 +103,14 @@ const deleteId = ref('') // 详情id const infoId = ref('0') +// 装载时间数组 +const checkTime = ref('') // 点击按钮 const buttonType = ref('') const loadingTable = ref(false) const fetchData = (isNowPage: boolean) => { + listQuery.value.checkStartDate = checkTime.value[0] || '' + listQuery.value.checkEndDate = checkTime.value[1] || '' loadingTable.value = true if (!isNowPage) { // 是否显示当前页,否则跳转第一页 @@ -191,8 +200,6 @@ const cancelEvent = () => { console.log('cancel!') } -// 装载时间数组 -const checkTimeArr = ref([listQuery.value.checkStartDate, listQuery.value.checkEndDate]) // 点击重置 const clearList = () => { listQuery.value = { @@ -211,7 +218,7 @@ offset: 1, limit: 20, } - checkTimeArr.value = [] + checkTime.value = '' } // 点击跳转 const add = () => { @@ -339,15 +346,30 @@ fetchData(false) }, { immediate: true }) -// 打印 -const printObj = ref({ - id: 'print', // 需要打印元素的id - popTitle: '设备检修保养验收单', // 打印配置页上方的标题 - extraHead: '', // 最上方的头部文字,附加在head标签上的额外标签,使用逗号分割 - preview: false, // 是否启动预览模式,默认是false - standard: '', - extarCss: '', -}) +// 导出id类型 +interface ISupplierTable { + id: never +} +// 打印列表 +function printList() { + // 打印列 + const properties = columns.value.map((item: TableColumn) => { + 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: ISupplierTable) => checkoutList.value.includes(item.id)) + printJSON(printList, properties, '设备检修列表') + } + else { + ElMessage.warning('无可打印内容') + } +} diff --git a/src/views/device/deviceMaintenance/components/listMaintenanceApproval.vue b/src/views/device/deviceMaintenance/components/listMaintenanceApproval.vue index 44335a6..4ff3806 100644 --- a/src/views/device/deviceMaintenance/components/listMaintenanceApproval.vue +++ b/src/views/device/deviceMaintenance/components/listMaintenanceApproval.vue @@ -1,5 +1,6 @@ diff --git a/src/views/device/deviceMaintenance/components/listPageAdd.vue b/src/views/device/deviceMaintenance/components/listPageAdd.vue index a3129d4..0a3dd34 100644 --- a/src/views/device/deviceMaintenance/components/listPageAdd.vue +++ b/src/views/device/deviceMaintenance/components/listPageAdd.vue @@ -567,7 +567,8 @@ ([]) +// 获取权限 const { proxy } = getCurrentInstance() as any // 总数 const total = ref(0) @@ -254,11 +255,11 @@ - 查看 + 详情 import { reactive, ref } from 'vue' -import type { Ref } from 'vue' +import type { PropType, Ref } from 'vue' import { ElLoading, ElMessage, ElMessageBox } from 'element-plus' -import type { IOptions, IlistQuery, IlistTypes } from '../../standard_interface' +import type { IOptions, Ibuttoms, IlistQuery, IlistTypes } from '../../standard_interface' import ListSourceAdd from './listPageAdd.vue' +import type { TableColumn } from '@/components/NormalTable/table_interface' import ApprovalDialog from '@/components/Approval/ApprovalDialog.vue' import { getStandardLisdelete, getUsersDept, getstandardEquipmentApplyList, submitStandardEquipmentApply } from '@/api/device/standard' import { uploadApi } from '@/api/system/notice' import { exportExcel } from '@/utils/exportXlsx' +import { printJSON } from '@/utils/printUtils' import { submitApproval } from '@/api/approval' const props = defineProps({ name: { @@ -19,7 +21,7 @@ default: '', }, buttoms: { - type: Array, + type: Array as PropType, default: () => [], }, applyType: { @@ -41,6 +43,7 @@ createUser: '', equipmentNo: '', organizeNo: '', + formId: props.schedule, standardName: '', standardNo: '', limit: 20, @@ -55,7 +58,7 @@ // 总数 const total = ref(0) // 表头 -const columns = ref([ +const columns = ref([ { text: '申请编号', value: 'applyNo', @@ -132,12 +135,6 @@ const fileRef = ref() // 审批弹窗开关 const applyShow = ref(false) -// 删除id -const deleteId = ref('') -// 详情id -const infoId = ref('0') -// 点击按钮 -const buttonType = ref('') const loadingTable = ref(false) // 获取部门信息参数 const DeptParams = ref({ @@ -313,6 +310,7 @@ applyStatus: '', applyType: props.applyType, approvalStatus: props.approvalStatus, + formId: props.schedule, createUser: '', equipmentNo: '', organizeNo: '', @@ -386,9 +384,11 @@ } fetchData(true) } +// 上传功能 const upload = () => { fileRef.value.click() } +// 上传 const uploadAll = () => { upload() } @@ -407,6 +407,7 @@ }, }) } +// 导出 const exportAll = () => { exportExcelBtn() } @@ -415,15 +416,30 @@ emit('setData', newVal) }, { deep: true, immediate: true }) -// 打印 -const printObj = ref({ - id: 'print', // 需要打印元素的id - popTitle: '溯源供方编号模板', // 打印配置页上方的标题 - extraHead: '', // 最上方的头部文字,附加在head标签上的额外标签,使用逗号分割 - preview: false, // 是否启动预览模式,默认是false - standard: '', - extarCss: '', -}) +// 导出id类型 +interface ISupplier { + id: never +} +// 打印列表 +function printList() { + // 打印列 + const properties = columns.value.map((item: TableColumn) => { + 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: ISupplier) => checkoutList.value.includes(item.id)) + printJSON(printList, properties, '标准装置申请列表') + } + else { + ElMessage.warning('无可打印内容') + } +} // 审批弹窗的提交 const applyListSubmit = () => { console.log(applyList.value) @@ -489,7 +505,7 @@ import type { PropType, Ref } from 'vue' +import { getCurrentInstance, ref } from 'vue' import { ElLoading, ElMessage, ElMessageBox, buttonEmits } from 'element-plus' -import type { IButton, ISupplier, IlistType, IlistTypes, supplierExportQuery } from '@views/measure/source/list_interface' +import type { IButton, ISupplier, IlistTypes, supplierExportQuery } from '@views/measure/source/list_interface' import type { IOptions } from '../checkList_interface' import type { TableColumn } from '@/components/NormalTable/table_interface' import { getApprovalDelete, getDeptTree, getListSubmit, getapprovalList } from '@/api/system/plan' @@ -9,6 +10,7 @@ import ApprovalDialog from '@/components/Approval/ApprovalDialog.vue' import { SCHEDULE } from '@/utils/scheduleDict' import { submitApproval } from '@/api/approval' +import { printJSON } from '@/utils/printUtils' const props = defineProps({ status: { type: String, @@ -21,9 +23,12 @@ }) const emit = defineEmits(['setData']) // 关闭 +// 获取权限 +const { proxy } = getCurrentInstance() as any + // 操作列宽度-计算属性 const operationWidth = computed(() => { - return props.buttons.length * 32 + 24 + return props.buttons.length * 40 + 24 }) // 查询条件 @@ -98,10 +103,14 @@ const deleteId = ref('') // 详情id const infoId = ref('0') +// 装载时间数组 +const checkTime = ref('') // 点击按钮 const buttonType = ref('') const loadingTable = ref(false) const fetchData = (isNowPage: boolean) => { + listQuery.value.checkStartDate = checkTime.value[0] || '' + listQuery.value.checkEndDate = checkTime.value[1] || '' loadingTable.value = true if (!isNowPage) { // 是否显示当前页,否则跳转第一页 @@ -191,8 +200,6 @@ const cancelEvent = () => { console.log('cancel!') } -// 装载时间数组 -const checkTimeArr = ref([listQuery.value.checkStartDate, listQuery.value.checkEndDate]) // 点击重置 const clearList = () => { listQuery.value = { @@ -211,7 +218,7 @@ offset: 1, limit: 20, } - checkTimeArr.value = [] + checkTime.value = '' } // 点击跳转 const add = () => { @@ -339,15 +346,30 @@ fetchData(false) }, { immediate: true }) -// 打印 -const printObj = ref({ - id: 'print', // 需要打印元素的id - popTitle: '设备检修保养验收单', // 打印配置页上方的标题 - extraHead: '', // 最上方的头部文字,附加在head标签上的额外标签,使用逗号分割 - preview: false, // 是否启动预览模式,默认是false - standard: '', - extarCss: '', -}) +// 导出id类型 +interface ISupplierTable { + id: never +} +// 打印列表 +function printList() { + // 打印列 + const properties = columns.value.map((item: TableColumn) => { + 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: ISupplierTable) => checkoutList.value.includes(item.id)) + printJSON(printList, properties, '设备检修列表') + } + else { + ElMessage.warning('无可打印内容') + } +} diff --git a/src/views/device/deviceMaintenance/components/listMaintenanceApproval.vue b/src/views/device/deviceMaintenance/components/listMaintenanceApproval.vue index 44335a6..4ff3806 100644 --- a/src/views/device/deviceMaintenance/components/listMaintenanceApproval.vue +++ b/src/views/device/deviceMaintenance/components/listMaintenanceApproval.vue @@ -1,5 +1,6 @@ diff --git a/src/views/device/deviceMaintenance/components/listPageAdd.vue b/src/views/device/deviceMaintenance/components/listPageAdd.vue index a3129d4..0a3dd34 100644 --- a/src/views/device/deviceMaintenance/components/listPageAdd.vue +++ b/src/views/device/deviceMaintenance/components/listPageAdd.vue @@ -567,7 +567,8 @@ ([]) +// 获取权限 const { proxy } = getCurrentInstance() as any // 总数 const total = ref(0) @@ -254,11 +255,11 @@ - 查看 + 详情 import { reactive, ref } from 'vue' -import type { Ref } from 'vue' +import type { PropType, Ref } from 'vue' import { ElLoading, ElMessage, ElMessageBox } from 'element-plus' -import type { IOptions, IlistQuery, IlistTypes } from '../../standard_interface' +import type { IOptions, Ibuttoms, IlistQuery, IlistTypes } from '../../standard_interface' import ListSourceAdd from './listPageAdd.vue' +import type { TableColumn } from '@/components/NormalTable/table_interface' import ApprovalDialog from '@/components/Approval/ApprovalDialog.vue' import { getStandardLisdelete, getUsersDept, getstandardEquipmentApplyList, submitStandardEquipmentApply } from '@/api/device/standard' import { uploadApi } from '@/api/system/notice' import { exportExcel } from '@/utils/exportXlsx' +import { printJSON } from '@/utils/printUtils' import { submitApproval } from '@/api/approval' const props = defineProps({ name: { @@ -19,7 +21,7 @@ default: '', }, buttoms: { - type: Array, + type: Array as PropType, default: () => [], }, applyType: { @@ -41,6 +43,7 @@ createUser: '', equipmentNo: '', organizeNo: '', + formId: props.schedule, standardName: '', standardNo: '', limit: 20, @@ -55,7 +58,7 @@ // 总数 const total = ref(0) // 表头 -const columns = ref([ +const columns = ref([ { text: '申请编号', value: 'applyNo', @@ -132,12 +135,6 @@ const fileRef = ref() // 审批弹窗开关 const applyShow = ref(false) -// 删除id -const deleteId = ref('') -// 详情id -const infoId = ref('0') -// 点击按钮 -const buttonType = ref('') const loadingTable = ref(false) // 获取部门信息参数 const DeptParams = ref({ @@ -313,6 +310,7 @@ applyStatus: '', applyType: props.applyType, approvalStatus: props.approvalStatus, + formId: props.schedule, createUser: '', equipmentNo: '', organizeNo: '', @@ -386,9 +384,11 @@ } fetchData(true) } +// 上传功能 const upload = () => { fileRef.value.click() } +// 上传 const uploadAll = () => { upload() } @@ -407,6 +407,7 @@ }, }) } +// 导出 const exportAll = () => { exportExcelBtn() } @@ -415,15 +416,30 @@ emit('setData', newVal) }, { deep: true, immediate: true }) -// 打印 -const printObj = ref({ - id: 'print', // 需要打印元素的id - popTitle: '溯源供方编号模板', // 打印配置页上方的标题 - extraHead: '', // 最上方的头部文字,附加在head标签上的额外标签,使用逗号分割 - preview: false, // 是否启动预览模式,默认是false - standard: '', - extarCss: '', -}) +// 导出id类型 +interface ISupplier { + id: never +} +// 打印列表 +function printList() { + // 打印列 + const properties = columns.value.map((item: TableColumn) => { + 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: ISupplier) => checkoutList.value.includes(item.id)) + printJSON(printList, properties, '标准装置申请列表') + } + else { + ElMessage.warning('无可打印内容') + } +} // 审批弹窗的提交 const applyListSubmit = () => { console.log(applyList.value) @@ -489,7 +505,7 @@ {{ item }} - + 关闭 @@ -1099,26 +1100,6 @@ - @@ -1135,9 +1116,6 @@