diff --git a/src/views/processParameterTraceability/index.vue b/src/views/processParameterTraceability/index.vue index f065a0e..eac6e99 100644 --- a/src/views/processParameterTraceability/index.vue +++ b/src/views/processParameterTraceability/index.vue @@ -75,7 +75,20 @@
- + + + + + + + + + @@ -126,17 +139,44 @@ function getList() { } }) } +//导出参数 +const exportDialog = reactive({ + open: false, + title: '', + url: '/mes/ProcessParameter/export' +}) //导出 function handleDownload() { - proxy - .$confirm('是否确定要导出数据吗?', '警告', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning' - }) - .then(async () => { - await proxy.downFile('/mes/MaterialInfo/export', { ...queryParams }) - }) + exportDialog.open = true + const today = new Date(); + dateRange.value = [today, today]; +} +function handleCloseWorkOrder() { + exportDialog.open = false + + const today = new Date(); + dateRange.value = [today, today]; +} +// 初始化日期格式化函数 +function formatDate(date) { + const year = date.getFullYear(); + const month = String(date.getMonth() + 1).padStart(2, '0'); + const day = String(date.getDate()).padStart(2, '0'); + return `${year}-${month}-${day}`; +} + +function submitExport() { + if (!dateRange.value || dateRange.value.length !== 2) { + ElMessage.warning('请选择完整的日期范围') + return + } + const [startDate, endDate] = dateRange.value + const startTime = formatDate(startDate) + const endTime = formatDate(endDate) + console.log(import.meta.env.VITE_APP_BASE_API, '请求地址'); + const exportUrl = `${exportDialog.url}?pageNum=${queryParams.pageNum}&pageSize=${queryParams.pageSize}&startTime=${startTime}&endTime=${endTime}` + proxy.download(exportUrl, '工单数据.xlsx') + handleCloseWorkOrder() } // 列配置 const columns = ref([ @@ -177,7 +217,17 @@ function resetQuery() { queryParams.pageSize = 10 handleQuery() } +// 初始化日期范围为当天 +const dateRange = ref([ + new Date(), + new Date() +]) +// 页面加载时初始化日期范围 +onMounted(() => { + const today = new Date(); + dateRange.value = [today, today]; +}) // 自定义排序 function sortChange(column) { // 在实际应用中实现排序逻辑 diff --git a/src/views/ticketInquiry/index.vue b/src/views/ticketInquiry/index.vue index aef489f..f814c55 100644 --- a/src/views/ticketInquiry/index.vue +++ b/src/views/ticketInquiry/index.vue @@ -23,30 +23,19 @@ - - 导出 - - - @@ -72,9 +61,6 @@ + + + + + + + + + @@ -188,13 +188,13 @@ import { ElMessageBox, ElMessage } from 'element-plus' import { getProcessInfoList, getProcessInfoById, addProcessInfo, updateProcessInfo, delProcessInfo, getLineName } from "@/api/ticketInquiry/index" import useUserStore from '@/store/modules/user' -import { getToken } from '@/utils/auth' const dialogTableVisible = ref(false) const userStore = useUserStore() const userId = userStore.userId const userName = userStore.userName console.log(userStore.userId, 'userStore.userId') -import { ref, reactive, getCurrentInstance, watch, toRefs } from 'vue'; +import { ref, reactive, getCurrentInstance, watch, toRefs, onMounted } from 'vue'; +import { start } from 'nprogress'; // 使用ref和reactive初始化响应式数据 const { proxy } = getCurrentInstance() const ids = ref([]) @@ -202,12 +202,11 @@ const loading = ref(false) const showSearch = ref(true) const show = ref(false) const dataList = ref([]) +import { getToken } from '@/utils/auth' // 查询参数 const queryParams = reactive({ pageNum: 1, pageSize: 10, - // materialCode: '', - // materialName: '', }) //详情请求参数 const queryParamsDetail = reactive({ @@ -222,8 +221,6 @@ const upload = reactive({ open: false, title: '导入数据', isUploading: false, - // updateSupport: 0, - // uploadType: 1, headers: { Authorization: 'Bearer ' + getToken() }, url: import.meta.env.VITE_APP_BASE_API + `/mes/MaterialInfo/ImportMaterialInfo?userId=${userStore.userId}&userName=${userStore.userName}` }) @@ -245,7 +242,6 @@ function getList() { dataList.value = res.data.result total.value = res.data.totalNum } - }) } @@ -276,10 +272,6 @@ const handleFileSuccess = (response, file, fileList) => { show.value = false upload.isUploading = false proxy.$refs['uploadRef'].clearFiles() - // dialogVisibleActualAssembly.value = true - // proxy.$alert("
" + `导入成功:${data}条` + '
', '导入结果', { - // dangerouslyUseHTMLString: true - // }) if (code == 200) { ElMessage({ message: '导入成功', @@ -296,6 +288,26 @@ const handleFileError = (error, file, fileList) => { return } } + +//导出参数 +const exportDialog = reactive({ + open: false, + title: '', + url: '/mes/WorkOrder/export' +}) + +// 初始化日期范围为当天 +const dateRange = ref([ + new Date(), + new Date() +]) + +// 页面加载时初始化日期范围 +onMounted(() => { + const today = new Date(); + dateRange.value = [today, today]; +}) + //文件上传按钮 function submitFileForm() { proxy.$refs['uploadRef'].submit() @@ -322,20 +334,42 @@ function handleImport() { function importTemplate() { proxy.download('/mes/MaterialInfo/importTemplate', '导入模板') } + //导出 function handleDownload() { - proxy - .$confirm('是否确定要导出数据吗?', '警告', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning' - }) - .then(async () => { - await proxy.downFile('/mes/MaterialInfo/export', { ...queryParams }) - }) + exportDialog.open = true + const today = new Date(); + dateRange.value = [today, today]; } +function handleCloseWorkOrder() { + exportDialog.open = false + + const today = new Date(); + dateRange.value = [today, today]; +} +// 初始化日期格式化函数 +function formatDate(date) { + const year = date.getFullYear(); + const month = String(date.getMonth() + 1).padStart(2, '0'); + const day = String(date.getDate()).padStart(2, '0'); + return `${year}-${month}-${day}`; +} + +function submitExport() { + if (!dateRange.value || dateRange.value.length !== 2) { + ElMessage.warning('请选择完整的日期范围') + return + } + const [startDate, endDate] = dateRange.value + const startTime = formatDate(startDate) + const endTime = formatDate(endDate) + console.log(import.meta.env.VITE_APP_BASE_API, '请求地址'); + const exportUrl = `${exportDialog.url}?pageNum=${queryParams.pageNum}&pageSize=${queryParams.pageSize}&startTime=${startTime}&endTime=${endTime}` + proxy.download(exportUrl, '工单数据.xlsx') + handleCloseWorkOrder() +} // 查询 function handleQuery() { @@ -346,8 +380,9 @@ function handleQuery() { // 重置查询 function resetQuery() { proxy.resetForm('queryRef') - queryParams.materialCode = null - queryParams.materialName = null + queryParams.workOrderCode = null + queryParams.lineName = null + queryParams.lineCode = null queryParams.orderDate = null queryParams.pageSize = 10 handleQuery() @@ -355,7 +390,6 @@ function resetQuery() { // 自定义排序 function sortChange(column) { - // 在实际应用中实现排序逻辑 console.log('排序字段:', column.prop, '排序方式:', column.order) } @@ -390,17 +424,7 @@ const ticketStatusoptions = ref([ { label: '已取消', value: 3 } ]) const { form, rules } = toRefs(state) -//监听下拉 -// watch(() => form.value.processName, (newLineName) => { -// if (newLineName) { -// const selectedLine = productionLine.value.find(item => item.label === newLineName); -// if (selectedLine) { -// form.value.processCode = selectedLine.value; -// } -// } else { -// form.value.processCode = ''; -// } -// }); + // 关闭弹窗 function cancel() { open.value = false @@ -411,21 +435,17 @@ function cancel() { function reset() { form.value = { id: null, - materialCode: '', - materialName: '', - materialModel: '', - materialType: '', - parameter: '', - brand: '', - supplier: '', - deviceId: '', - feature: '', - remark: '', - processName: '', - processCode: '', - lineCode: '', + workOrderCode: '', lineName: '', - orderDate: new Date().toISOString().split('T')[0], + lineCode: '', + orderDate: new Date(), + productCode: '', + productName: '', + totalQty: '', + okQty: '', + ngQty: '', + defectReason: '', + orderStatus: '' } proxy.resetForm('formRef') } @@ -488,7 +508,6 @@ function submitForm() { }) } open.value = false - } }) } diff --git a/src/views/workOrderDetails/index.vue b/src/views/workOrderDetails/index.vue index 31b29cf..b82a55b 100644 --- a/src/views/workOrderDetails/index.vue +++ b/src/views/workOrderDetails/index.vue @@ -68,7 +68,19 @@
- + + + + + + + + @@ -125,15 +137,53 @@ function getList() { } //导出 function handleDownload() { - proxy - .$confirm('是否确定要导出数据吗?', '警告', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning' - }) - .then(async () => { - await proxy.downFile('/mes/MaterialInfo/export', { ...queryParams }) - }) + exportDialog.open = true + const today = new Date(); + dateRange.value = [today, today]; +} +//导出参数 +const exportDialog = reactive({ + open: false, + title: '', + url: '/mes/WorkOrderItem/export' +}) + +// 初始化日期范围为当天 +const dateRange = ref([ + new Date(), + new Date() +]) + +// 页面加载时初始化日期范围 +onMounted(() => { + const today = new Date(); + dateRange.value = [today, today]; +}) +// 初始化日期格式化函数 +function formatDate(date) { + const year = date.getFullYear(); + const month = String(date.getMonth() + 1).padStart(2, '0'); + const day = String(date.getDate()).padStart(2, '0'); + return `${year}-${month}-${day}`; +} +function handleCloseWorkOrder() { + exportDialog.open = false + + const today = new Date(); + dateRange.value = [today, today]; +} +function submitExport() { + if (!dateRange.value || dateRange.value.length !== 2) { + ElMessage.warning('请选择完整的日期范围') + return + } + const [startDate, endDate] = dateRange.value + const startTime = formatDate(startDate) + const endTime = formatDate(endDate) + console.log(import.meta.env.VITE_APP_BASE_API, '请求地址'); + const exportUrl = `${exportDialog.url}?pageNum=${queryParams.pageNum}&pageSize=${queryParams.pageSize}&startTime=${startTime}&endTime=${endTime}` + proxy.download(exportUrl, '工单数据.xlsx') + handleCloseWorkOrder() } // 列配置 const columns = ref([