diff --git a/src/components/TableModel2/index.vue b/src/components/TableModel2/index.vue index 145ddec..1f6958d 100644 --- a/src/components/TableModel2/index.vue +++ b/src/components/TableModel2/index.vue @@ -453,6 +453,18 @@ export default { item.dateType.length === 2 ) { delete queryParams[item.f_model] + // 对于日期时间范围选择器,查询时给开始时间添加 :00 秒,结束时间添加 :59 秒 + if (item.f_type === 'dateTimeRange') { + const [startTimeKey, endTimeKey] = item.dateType + // 开始时间添加 :00 秒 + if (queryParams[startTimeKey] && queryParams[startTimeKey].length === 16) { + queryParams[startTimeKey] = queryParams[startTimeKey] + ':00' + } + // 结束时间添加 :59 秒 + if (queryParams[endTimeKey] && queryParams[endTimeKey].length === 16) { + queryParams[endTimeKey] = queryParams[endTimeKey] + ':59' + } + } } }) // console.log( diff --git a/src/router/index.js b/src/router/index.js index 8c05efd..ff857a1 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -162,540 +162,6 @@ export const dynamicRoutes = [ } ] }, - - { - path: '/enterpriseAdd', - component: Layout, - hidden: true, - permissions: ['enterpriseLibrary:enterprise:add'], - children: [ - { - path: 'index', - component: () => import('@/views/enterpriseLibrary/enterprise/components/EnterpriseForm'), - name: 'EnterpriseForm', - meta: { title: '新增主体信息', activeMenu: '/enterpriseLibrary/enterprise', noCache: true } - } - ] - }, - { - path: '/enterpriseEdit', - component: Layout, - hidden: true, - permissions: ['enterpriseLibrary:enterprise:edit'], - children: [ - { - path: 'index', - component: () => import('@/views/enterpriseLibrary/enterprise/components/EnterpriseForm'), - name: 'EnterpriseEditForm', - meta: { title: '编辑主体信息', activeMenu: '/enterpriseLibrary/enterprise', noCache: true } - } - ] - }, - { - path: '/enterpriseDetail', - component: Layout, - hidden: true, - permissions: ['enterpriseLibrary:enterprise:detail'], - children: [ - { - path: 'index', - component: () => import('@/views/enterpriseLibrary/enterprise/components/EnterpriseDetail'), - name: 'EnterpriseDetail', - meta: { title: '主体信息详情', activeMenu: '/enterpriseLibrary/enterprise', noCache: true } - } - ] - }, - { - path: '/enterpriseKnowledge', - component: Layout, - hidden: true, - permissions: ['enterpriseLibrary:enterprise:EnterpriseKnowledge'], - children: [ - { - path: 'index', - component: () => import('@/views/enterpriseLibrary/enterprise/components/EnterpriseKnowledge'), - name: 'EnterpriseKnowledge', - meta: { title: '企业知识库', activeMenu: '/enterpriseLibrary/enterprise', noCache: true } - } - ] - }, - { - path: '/personnel', - component: Layout, - hidden: true, - permissions: ['enterpriseLibrary:personnel:list'], - children: [ - { - path: 'index', - component: () => import('@/views/enterpriseLibrary/personnel/index'), - name: 'Personnel', - meta: { title: '人员库', activeMenu: '/enterpriseLibrary/enterprise', noCache: true } - } - ] - }, - { - path: '/personnelAdd/', - component: Layout, - hidden: true, - permissions: ['enterpriseLibrary:personnel:add'], - children: [ - { - path: 'index', - component: () => import('@/views/enterpriseLibrary/personnel/components/PersonnelForm'), - name: 'PersonnelForm', - meta: { title: '新增人员', activeMenu: '/enterpriseLibrary/enterprise', noCache: true } - } - ] - }, - { - path: '/personnelEdit/', - component: Layout, - hidden: true, - permissions: ['enterpriseLibrary:personnel:edit'], - children: [ - { - path: 'index', - component: () => import('@/views/enterpriseLibrary/personnel/components/PersonnelForm'), - name: 'PersonnelEditForm', - meta: { title: '编辑人员', activeMenu: '/enterpriseLibrary/enterprise', noCache: true } - } - ] - }, - { - path: '/personnelDetail/', - component: Layout, - hidden: true, - permissions: ['enterpriseLibrary:personnel:detail'], - children: [ - { - path: 'index', - component: () => import('@/views/enterpriseLibrary/personnel/components/PersonnelDetail'), - name: 'PersonnelDetail', - meta: { title: '人员详情', activeMenu: '/enterpriseLibrary/enterprise', noCache: true } - } - ] - }, - { - path: '/technical', - component: Layout, - hidden: true, - permissions: ['enterpriseLibrary:technical:list'], - children: [ - { - path: 'index', - component: () => import('@/views/enterpriseLibrary/technical/index'), - name: 'Technical', - meta: { title: '技术方案库', activeMenu: '/enterpriseLibrary/enterprise', noCache: true } - } - ] - }, - { - path: '/technicalAdd', - component: Layout, - hidden: true, - permissions: ['enterpriseLibrary:technical:add'], - children: [ - { - path: 'index', - component: () => import('@/views/enterpriseLibrary/technical/components/TechnicalForm'), - name: 'TechnicalAdd', - meta: { title: '新增方案', activeMenu: '/enterpriseLibrary/enterprise', noCache: true } - } - ] - }, - { - path: '/technicalEdit', - component: Layout, - hidden: true, - permissions: ['enterpriseLibrary:technical:edit'], - children: [ - { - path: 'index', - component: () => import('@/views/enterpriseLibrary/technical/components/TechnicalForm'), - name: 'TechnicalEdit', - meta: { title: '修改方案', activeMenu: '/enterpriseLibrary/enterprise', noCache: true } - } - ] - }, - { - path: '/technicalDetail', - component: Layout, - hidden: true, - permissions: ['enterpriseLibrary:technical:detail'], - children: [ - { - path: 'index', - component: () => import('@/views/enterpriseLibrary/technical/components/TechnicalDetail'), - name: 'TechnicalDetail', - meta: { title: '方案详情', activeMenu: '/enterpriseLibrary/enterprise', noCache: true } - } - ] - }, - { - path: '/tools', - component: Layout, - hidden: true, - permissions: ['enterpriseLibrary:tool:list'], - children: [ - { - path: 'index', - component: () => import('@/views/enterpriseLibrary/tool/index'), - name: 'Tools', - meta: { title: '工器具库', activeMenu: '/enterpriseLibrary/enterprise', noCache: true } - } - ] - }, - { - path: '/performanceList', - component: Layout, - hidden: true, - permissions: ['enterpriseLibrary:performance:list'], - children: [ - { - path: 'index', - component: () => import('@/views/enterpriseLibrary/performance/index'), - name: 'Performance', - meta: { title: '业绩库列表', activeMenu: '/enterpriseLibrary/performance', noCache: true } - } - ] - }, - { - path: '/performanceForm', - component: Layout, - hidden: true, - permissions: ['enterpriseLibrary:performance:add'], - children: [ - { - path: 'index', - component: () => import('@/views/enterpriseLibrary/performance/components/PerformanceForm'), - name: 'PerformanceForm', - meta: { title: '新增业绩库', activeMenu: '/enterpriseLibrary/performance', noCache: true } - } - ] - }, - { - path: '/performanceDetail', - component: Layout, - hidden: true, - permissions: ['enterpriseLibrary:performance:detail'], - children: [ - { - path: 'index', - component: () => import('@/views/enterpriseLibrary/performance/components/PerformanceDetail'), - name: 'PerformanceDetail', - meta: { title: '业绩库详情', activeMenu: '/enterpriseLibrary/performance', noCache: true } - } - ] - }, - { - path: '/performanceEdit', - component: Layout, - hidden: true, - permissions: ['enterpriseLibrary:performance:edit'], - children: [ - { - path: 'index', - component: () => import('@/views/enterpriseLibrary/performance/components/PerformanceEdit'), - name: 'PerformanceEdit', - meta: { title: '编辑业绩库', activeMenu: '/enterpriseLibrary/performance', noCache: true } - } - ] - }, - { - path: '/financeList', - component: Layout, - hidden: true, - permissions: ['enterpriseLibrary:finance:list'], - children: [ - { - path: 'index', - component: () => import('@/views/enterpriseLibrary/finance/index'), - name: 'Financial', - meta: { title: '财务库列表', activeMenu: '/enterpriseLibrary/performance', noCache: true } - } - ] - }, - { - path: '/financeForm', - component: Layout, - hidden: true, - permissions: ['enterpriseLibrary:finance:add'], - children: [ - { - path: 'index', - component: () => import('@/views/enterpriseLibrary/finance/components/FinanceForm'), - name: 'FinanceForm', - meta: { title: '新增财务库', activeMenu: '/enterpriseLibrary/finance', noCache: true } - } - ] - }, - { - path: '/financeEdit', - component: Layout, - hidden: true, - permissions: ['enterpriseLibrary:finance:edit'], - children: [ - { - path: 'index', - component: () => import('@/views/enterpriseLibrary/finance/components/FinanceForm'), - name: 'FinanceEdit', - meta: { title: '编辑财务库', activeMenu: '/enterpriseLibrary/finance', noCache: true } - } - ] - }, - { - path: '/financeForm', - component: Layout, - hidden: true, - permissions: ['enterpriseLibrary:finance:detail'], - children: [ - { - path: 'index', - component: () => import('@/views/enterpriseLibrary/finance/components/FinanceDetail'), - name: 'FinanceDetail', - meta: { title: '财务库详情', activeMenu: '/enterpriseLibrary/finance', noCache: true } - } - ] - }, - { - path: '/qualificationList', - component: Layout, - hidden: true, - permissions: ['enterpriseLibrary:qualification:list'], - children: [ - { - path: 'index', - component: () => import('@/views/enterpriseLibrary/qualification/index'), - name: 'Qualification', - meta: { title: '资质库列表', activeMenu: '/enterpriseLibrary/qualification', noCache: true } - } - ] - }, - { - path: '/qualificationForm', - component: Layout, - hidden: true, - permissions: ['enterpriseLibrary:qualification:add'], - children: [ - { - path: 'index', - component: () => import('@/views/enterpriseLibrary/qualification/components/QualificationForm'), - name: 'QualificationForm', - meta: { title: '新增资质库', activeMenu: '/enterpriseLibrary/qualification', noCache: true } - } - ] - }, - { - path: '/rejectionItemList', - component: Layout, - hidden: true, - permissions: ['enterpriseLibrary:rejectionItem:list'], - children: [ - { - path: 'index', - component: () => import('@/views/enterpriseLibrary/rejectionItem/index'), - name: 'Rejection', - meta: { title: '废标项列表', activeMenu: '/enterpriseLibrary/rejection', noCache: true } - } - ] - }, - { - path: '/analysisDetail', - component: Layout, - hidden: true, - permissions: ['enterpriseLibrary:analysis:detail'], - children: [ - { - path: 'index', - component: () => import('@/views/analysis/components/AnalysisDetail'), - name: 'AnalysisDetail', - meta: { title: '项目解析结果', activeMenu: '/analysis', noCache: true } - } - ] - }, - { - path: '/analysisBidDetail', - component: Layout, - hidden: true, - permissions: ['enterpriseLibrary:analysis:detail'], - children: [ - { - path: 'index', - component: () => import('@/views/analysis/components/AnalysisBidDetail'), - name: 'AnalysisBidDetail', - meta: { title: '项目标段', activeMenu: '/analysis', noCache: true } - } - ] - }, - { - path: '/analysisBid', - component: Layout, - hidden: true, - permissions: ['enterpriseLibrary:analysis:detail'], - children: [ - { - path: 'index', - component: () => import('@/views/analysis/components/AnalysisBidIndex'), - name: 'AnalysisBidIndex', - meta: { title: '标段信息', activeMenu: '/analysis', noCache: true } - } - ] - }, - { - path: '/analysisBidView', - component: Layout, - hidden: true, - permissions: ['enterpriseLibrary:analysis:detail'], - children: [ - { - path: 'index', - component: () => import('@/views/analysis/components/AnalysisBidView'), - name: 'AnalysisBidView', - meta: { title: '解析结果', activeMenu: '/analysis', noCache: true } - } - ] - }, - { - path: '/testOnlyOffice', - component: Layout, - hidden: true, - permissions: ['enterpriseLibrary:analysis:detail'], - children: [ - { - path: 'index', - component: () => import('@/views/analysis/components/TestOnlyOffice'), - name: 'TestOnlyOffice', - meta: { title: '预览文档', activeMenu: '/analysis', noCache: true } - } - ] - }, - { - path: '/documentSearch', - component: Layout, - hidden: true, - permissions: ['enterpriseLibrary:analysis:detail'], - children: [ - { - path: 'index', - component: () => import('@/views/common/DocumentSearch'), - name: 'DocumentSearch', - meta: { title: '文档搜索', activeMenu: '/analysis', noCache: true } - } - ] - }, - { - path: '/documentSearchWord', - component: Layout, - hidden: true, - permissions: ['enterpriseLibrary:analysis:detail'], - children: [ - { - path: 'index', - component: () => import('@/views/common/DocumentSearchWord'), - name: 'DocumentSearchWord', - meta: { title: 'Word文档搜索', activeMenu: '/analysis', noCache: true } - } - ] - }, - { - path: '/documentExcel', - component: Layout, - hidden: true, - permissions: ['enterpriseLibrary:analysis:detail'], - children: [ - { - path: 'index', - component: () => import('@/views/common/DocumentExcel'), - name: 'DocumentExcel', - meta: { title: 'Excel文档查看', activeMenu: '/analysis', noCache: true } - } - ] - }, - { - path: '/analysisLabel', - component: Layout, - hidden: true, - permissions: ['analysis:label:list'], - children: [ - { - path: 'index', - component: () => import('@/views/template/analysisLabel/index'), - name: 'AnalysisLabel', - meta: { title: '解析结果标签', activeMenu: '/template', noCache: true } - } - ] - }, - { - path: '/analysisLabelItem', - component: Layout, - hidden: true, - permissions: ['analysis:labelItem:list'], - children: [ - { - path: 'index', - component: () => import('@/views/template/analysisLabel/components/AnalysisLabelItem'), - name: 'AnalysisLabelItem', - meta: { title: '解析结果标签项', activeMenu: '/template', noCache: true } - } - ] - }, - { - path: '/templateInfo', - component: Layout, - hidden: true, - permissions: ['template:info:list'], - children: [ - { - path: 'index', - component: () => import('@/views/template/templateInfo/index'), - name: 'TemplateInfo', - meta: { title: '模板信息', activeMenu: '/template', noCache: true } - } - ] - }, - { - path: '/templateForm', - component: Layout, - hidden: true, - permissions: ['template:info:add'], - children: [ - { - path: 'index', - component: () => import('@/views/template/templateInfo/components/TemplateForm'), - name: 'TemplateForm', - meta: { title: '新增模板', activeMenu: '/template', noCache: true } - } - ] - }, - { - path: '/analysisRule', - component: Layout, - hidden: true, - permissions: ['analysis:rule:list'], - children: [ - { - path: 'index', - component: () => import('@/views/template/templateInfo/components/AnalysisRule'), - name: 'AnalysisRule', - meta: { title: '解析规则', activeMenu: '/template', noCache: true } - } - ] - }, - - { - path: '/templateHistory', - component: Layout, - hidden: true, - permissions: ['analysis:rule:list'], - children: [ - { - path: 'index', - component: () => import('@/views/template/templateInfo/components/TemplateHistory'), - name: 'TemplateHistory', - meta: { title: '模板历史详情', activeMenu: '/template', noCache: true } - } - ] - }, ] // 防止连续点击多次路由报错 diff --git a/src/views/device/data-recognition/index.vue b/src/views/device/data-recognition/index.vue index 656dc3c..e274c73 100644 --- a/src/views/device/data-recognition/index.vue +++ b/src/views/device/data-recognition/index.vue @@ -32,7 +32,7 @@
+ :showSearch="false" :sendParams="queryParams"> @@ -66,6 +66,27 @@ export default { TableModel, }, data() { + // 获取当天的开始和结束时间 + const getDefaultTimeRange = () => { + const now = new Date() + const todayStart = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 0, 0, 0) + const todayEnd = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 59) + const formatTime = (date) => { + const year = date.getFullYear() + const month = String(date.getMonth() + 1).padStart(2, '0') + const day = String(date.getDate()).padStart(2, '0') + const hours = String(date.getHours()).padStart(2, '0') + const minutes = String(date.getMinutes()).padStart(2, '0') + const seconds = String(date.getSeconds()).padStart(2, '0') + return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}` + } + return { + startTime: formatTime(todayStart), + endTime: formatTime(todayEnd) + } + } + const defaultTime = getDefaultTimeRange() + return { showSearch: true, columnsList, @@ -81,10 +102,8 @@ export default { { label: '新能源车流量(PCU/h)', value: '0' }, ], queryParams: { - pageNum: 1, - pageSize: 10, - startTime: '', - endTime: '', + startTime: defaultTime.startTime, + endTime: defaultTime.endTime, }, } }, @@ -112,8 +131,8 @@ export default { /** 初始化默认时间范围 */ initDefaultTimeRange() { const now = new Date() - const todayStart = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 0, 0) - const todayEnd = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 23, 59) + const todayStart = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 0, 0, 0) + const todayEnd = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 59) const formatTime = (date) => { const year = date.getFullYear() const month = String(date.getMonth() + 1).padStart(2, '0') @@ -122,10 +141,20 @@ export default { const minutes = String(date.getMinutes()).padStart(2, '0') return `${year}-${month}-${day} ${hours}:${minutes}` } + const formatTimeWithSeconds = (date) => { + const year = date.getFullYear() + const month = String(date.getMonth() + 1).padStart(2, '0') + const day = String(date.getDate()).padStart(2, '0') + const hours = String(date.getHours()).padStart(2, '0') + const minutes = String(date.getMinutes()).padStart(2, '0') + const seconds = String(date.getSeconds()).padStart(2, '0') + return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}` + } const defaultTimeRange = [formatTime(todayStart), formatTime(todayEnd)] this.timeRange = defaultTimeRange - this.queryParams.startTime = defaultTimeRange[0] - this.queryParams.endTime = defaultTimeRange[1] + // queryParams 使用带秒数的格式 + this.queryParams.startTime = formatTimeWithSeconds(todayStart) + this.queryParams.endTime = formatTimeWithSeconds(todayEnd) }, /** 获取统计数据 */ @@ -135,6 +164,13 @@ export default { startTime: this.queryParams.startTime, endTime: this.queryParams.endTime, } + // 查询时给开始时间添加 :00 秒,结束时间添加 :59 秒 + if (params.startTime && params.startTime.length === 16) { + params.startTime = params.startTime + ':00' + } + if (params.endTime && params.endTime.length === 16) { + params.endTime = params.endTime + ':59' + } const res = await dataRecognitionDetailAPI(params) if (res.code === 200 && res.data) { // 将返回的数据映射到 statistics 数组 @@ -179,7 +215,15 @@ export default { this.getStatistics() if (this.$refs.dataRecognitionTableRef) { // 合并查询参数 - Object.assign(this.$refs.dataRecognitionTableRef.queryParams, this.queryParams) + const queryParams = { ...this.queryParams } + // 查询时给开始时间添加 :00 秒,结束时间添加 :59 秒 + if (queryParams.startTime && queryParams.startTime.length === 16) { + queryParams.startTime = queryParams.startTime + ':00' + } + if (queryParams.endTime && queryParams.endTime.length === 16) { + queryParams.endTime = queryParams.endTime + ':59' + } + Object.assign(this.$refs.dataRecognitionTableRef.queryParams, queryParams) this.$refs.dataRecognitionTableRef.queryParams.pageNum = 1 this.$refs.dataRecognitionTableRef.getTableList() } @@ -202,6 +246,13 @@ export default { async handleExport() { try { const params = { ...this.queryParams } + // 导出时给开始时间添加 :00 秒,结束时间添加 :59 秒 + if (params.startTime && params.startTime.length === 16) { + params.startTime = params.startTime + ':00' + } + if (params.endTime && params.endTime.length === 16) { + params.endTime = params.endTime + ':59' + } const res = await exportDataRecognitionAPI(params) if (res.code === 200) { // 处理文件下载 diff --git a/src/views/device/image-recognition/index.vue b/src/views/device/image-recognition/index.vue index 7127235..9f597fa 100644 --- a/src/views/device/image-recognition/index.vue +++ b/src/views/device/image-recognition/index.vue @@ -169,6 +169,14 @@ export default { try { this.loading = true const params = { ...this.queryParams } + + // 查询时给开始时间添加 :00 秒,结束时间添加 :59 秒 + if (params.startTime && params.startTime.length === 16) { + params.startTime = params.startTime + ':00' + } + if (params.endTime && params.endTime.length === 16) { + params.endTime = params.endTime + ':59' + } const res = await imageRecognitionListAPI(params) if (res.code === 200) { @@ -232,6 +240,15 @@ export default { try { this.loading = true const params = { ...this.queryParams } + + // 导出时给开始时间添加 :00 秒,结束时间添加 :59 秒 + if (params.startTime && params.startTime.length === 16) { + params.startTime = params.startTime + ':00' + } + if (params.endTime && params.endTime.length === 16) { + params.endTime = params.endTime + ':59' + } + const res = await exportImageRecognitionAPI(params) if (res.code === 200) { // 处理文件下载