diff --git a/src/views/productionProcessParameterQuery/index.vue b/src/views/productionProcessParameterQuery/index.vue index 8fab714..a6aa24b 100644 --- a/src/views/productionProcessParameterQuery/index.vue +++ b/src/views/productionProcessParameterQuery/index.vue @@ -1,6 +1,22 @@ --> - + - + @@ -140,11 +158,11 @@ - + @@ -158,7 +176,7 @@ - + @@ -682,11 +700,20 @@ import { listPlcProductionData, updatePlcProductionData,getPlcProductionData, } from '@/api/mes/plcproductiondata.js' +import { start } from 'nprogress'; const { proxy } = getCurrentInstance() const ids = ref([]) const loading = ref(false) const showSearch = ref(true) +function getCurrentDate() { + const now = new Date(); + const year = now.getFullYear(); + const month = String(now.getMonth() + 1).padStart(2, '0'); + const day = String(now.getDate()).padStart(2, '0'); + return new Date(`${year}-${month}-${day}`); +} const queryParams = reactive({ + timeRange: [getCurrentDate(), getCurrentDate()], pageNum: 1, pageSize: 10, sort: '', @@ -790,10 +817,28 @@ const defaultTime = ref([new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, var dictParams = [ ] +function getList() { + const formatDateTime = (date) => { + if (!date) return ''; + const d = new Date(date); + const year = d.getFullYear(); + const month = String(d.getMonth() + 1).padStart(2, '0'); + const day = String(d.getDate()).padStart(2, '0'); + + return `${year}-${month}-${day}`; + }; -function getList(){ - loading.value = true - listPlcProductionData(queryParams).then(res => { + let params = { + ...queryParams, + startTime: queryParams.timeRange && queryParams.timeRange[0] ? formatDateTime(queryParams.timeRange[0]) : '', + endTime: queryParams.timeRange && queryParams.timeRange[1] ? formatDateTime(queryParams.timeRange[1]) : '' + }; + + delete params.timeRange; + + loading.value = true, + + listPlcProductionData(params).then(res => { const { code, data } = res if (code == 200) { dataList.value = data.result @@ -802,7 +847,6 @@ function getList(){ } }) } - // 查询 function handleQuery() { queryParams.pageNum = 1