소스 검색

运行记录统计优化

yuanchao 1 개월 전
부모
커밋
4fec6ec68f

+ 22 - 12
src/router/modules/remaining.ts

@@ -166,17 +166,18 @@ const remainingRouter: AppRouteRecordRaw[] = [
     ]
   },
   {
-    path: '/fillOrderInfo',
+    path: '/FillOrderInfo2',
     component: Layout,
-    name: 'FillOrderInfo',
+    name: 'FillOrderInfo2',
     meta: {
       hidden: true
     },
     children: [
       {
-        path: 'template/detail/:id',
-        component: () => import('@/views/pms/iotopeationfill/index1.vue'),
-        name: 'FillOrderInfo',
+        path: 'template/detail/:deptId/:isFill/:createTime*',
+        component: () => import('@/views/pms/iotopeationfill/StatisticsForm.vue' +
+        ''),
+        name: 'FillOrderInfo2',
         meta: {
           title: t('rem.FillInInformation'),
           noCache: false,
@@ -185,10 +186,20 @@ const remainingRouter: AppRouteRecordRaw[] = [
           activeMenu: '/template/info'
         }
       },
+    ]
+  },
+  {
+    path: '/fillOrderInfo',
+    component: Layout,
+    name: 'FillOrderInfo',
+    meta: {
+      hidden: true
+    },
+    children: [
       {
-        path: 'template/detail/:deptId/:orderStatus/:createTime*',
-        component: () => import('@/views/pms/iotopeationfill/index.vue'),
-        name: 'FillOrderInfo1',
+        path: 'template/detail/:id',
+        component: () => import('@/views/pms/iotopeationfill/index1.vue'),
+        name: 'FillOrderInfo',
         meta: {
           title: t('rem.FillInInformation'),
           noCache: false,
@@ -198,10 +209,9 @@ const remainingRouter: AppRouteRecordRaw[] = [
         }
       },
       {
-        path: 'template/detail/:deptId/:isFill/:createTime*',
-        component: () => import('@/views/pms/iotopeationfill/StatisticsForm.vue' +
-        ''),
-        name: 'FillOrderInfo2',
+        path: 'template/detail/:deptId/:orderStatus/:createTime*',
+        component: () => import('@/views/pms/iotopeationfill/index.vue'),
+        name: 'IotOpeationFill1',
         meta: {
           title: t('rem.FillInInformation'),
           noCache: false,

+ 1 - 1
src/views/pms/device/record/RecordInfo.vue

@@ -87,7 +87,7 @@ import moment from 'moment';
 import { format } from 'date-fns';
 import {cx} from "@fullcalendar/core/internal-common";
 /** 运行记录填报 列表 */
-defineOptions({ name: 'IotOpeationFill' })
+defineOptions({ name: 'IotOpeationFilll' })
 
 const message = useMessage() // 消息弹窗
 const { t } = useI18n() // 国际化

+ 1 - 1
src/views/pms/iotopeationfill/StatisticsForm.vue

@@ -104,7 +104,7 @@ import DeptTree from "@/views/system/user/DeptTree.vue";
 import {useUserStore} from "@/store/modules/user";
 import {DICT_TYPE, getStrDictOptions} from "@/utils/dict";
 /** 运行记录填报 列表 */
-defineOptions({ name: 'StatisticsForm' })
+defineOptions({ name: 'FillOrderInfo2' })
 const deptList = ref<DeptTreeItem[]>([]) // 树形结构部门列表
 const message = useMessage() // 消息弹窗
 const { t } = useI18n() // 国际化

+ 1 - 2
src/views/pms/iotopeationfill/index.vue

@@ -172,7 +172,7 @@ const deptId= params.deptId;
 const orderStatus = params.orderStatus;
 const createTime = params.createTime;
 /** 巡检工单 列表 */
-defineOptions({ name: 'IotOpeationFill' })
+defineOptions({ name: 'IotOpeationFill1' })
 
 const message = useMessage() // 消息弹窗
 const { t } = useI18n() // 国际化
@@ -280,7 +280,6 @@ const handleExport = async () => {
 /** 初始化 **/
 onMounted(() => {
   if(deptId != null){
-
     queryParams.deptId = deptId;
   }
   if(orderStatus === 3){

+ 1 - 1
src/views/pms/iotopeationfill/index1.vue

@@ -104,7 +104,7 @@ import moment from 'moment';
 import { format } from 'date-fns';
 import {cx} from "@fullcalendar/core/internal-common";
 /** 运行记录填报 列表 */
-defineOptions({ name: 'IotOpeationFill' })
+defineOptions({ name: 'FillOrderInfo' })
 
 const message = useMessage() // 消息弹窗
 const { t } = useI18n() // 国际化

+ 21 - 10
src/views/pms/iotopeationfill/statistics.vue

@@ -117,7 +117,7 @@
           <el-col :span="6" class="flex flex-col items-center" @click="openForm(queryParams.deptId,0,queryParams.createTime)">
             <div ref="transOrderChartRef1" class="h-[160px] w-full"></div>
             <div class="text-center mt-2">
-              <span class="text-sm text-gray-600">填写</span>
+              <span class="text-sm text-gray-600">填写</span>
             </div>
           </el-col>
         </el-row>
@@ -228,7 +228,7 @@ const openForm = (deptId?:string,isFill?:string,createTime?:[]) => {
   push({ name: 'FillOrderInfo2',params:{deptId,isFill,createTime}})
 }
 const openFill = (deptId?:string,orderStatus?:string,createTime?:[]) => {
-  push({ name: 'FillOrderInfo1',params:{deptId,orderStatus,createTime}})
+  push({ name: 'IotOpeationFill1',params:{deptId,orderStatus,createTime}})
 }
 
 
@@ -394,23 +394,23 @@ const initCharts = () => {
   initGaugeChart(
     dealFinishedChartRef.value,
     firstStatus.filledCount === undefined ? 0 : firstStatus.filledCount,
-    '#f50'
+    '#05b'
   )
   initGaugeChart(
     dealFinishedChartRef1.value,
     firstStatus1.filledCount === undefined ? 0 : firstStatus1.filledCount,
-    '#f50'
+    '#05b'
   )
   // 转工单
   initGaugeChart(
     transOrderChartRef.value,
     firstStatus.unfilledCount === undefined ? 0 : firstStatus.unfilledCount,
-    '#05b'
+    '#f50'
   )
   initGaugeChart(
     transOrderChartRef1.value,
     firstStatus1.unfilledCount === undefined ? 0 : firstStatus1.unfilledCount,
-    '#05b'
+    '#f50'
   )
   // 待填写
   initGaugeChart(
@@ -594,6 +594,20 @@ const initChart = () => {
 const handleResize = () => {
   chartInstance?.resize()
 }
+const router = useRouter()
+const route = useRoute()
+// 监听路由变化
+const removeBeforeEach = router.beforeEach((to, from, next) => {
+  // 如果是从FillOrderInfo1页面返回
+  if (from.name === 'FillOrderInfo1' && to.name === route.name) {
+    // 恢复查询参数
+    Object.assign(queryParams, initialQueryParams)
+    // 阻止刷新,使用replace而不是push
+    next({ ...to, replace: true })
+  } else {
+    next()
+  }
+})
 
 /** 初始化 */
 onMounted(async () => {
@@ -601,12 +615,9 @@ onMounted(async () => {
   getStats()
   getDevStats();
   deptList.value = handleTree(await DeptApi.getSimpleDeptList())
-})
 
-onUnmounted(() => {
-  chartInstance?.dispose()
-  window.removeEventListener('resize', handleResize)
 })
+
 </script>
 
 <style lang="scss" scoped>