summary.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <script setup lang="ts">
  2. import dayjs from 'dayjs'
  3. import { rangeShortcuts } from '@/utils/formatTime'
  4. import { useUserStore } from '@/store/modules/user'
  5. import DailyStatistics from './components/DailyStatistics.vue'
  6. import NonProductionEfficiency from './components/NonProductionEfficiency.vue'
  7. defineOptions({
  8. name: 'IotRyDailyReportSummary'
  9. })
  10. const deptId = useUserStore().getUser.deptId
  11. interface Query {
  12. pageNo: number
  13. pageSize: number
  14. deptId: number
  15. contractName?: string
  16. taskName?: string
  17. createTime: string[]
  18. projectClassification: 1
  19. }
  20. const id = deptId
  21. const createDefaultQuery = (): Query => ({
  22. pageNo: 1,
  23. pageSize: 10,
  24. deptId: deptId,
  25. contractName: '',
  26. taskName: '',
  27. createTime: [
  28. ...rangeShortcuts[1].value().map((item) => dayjs(item).format('YYYY-MM-DD HH:mm:ss'))
  29. ],
  30. projectClassification: 1
  31. })
  32. const query = ref<Query>(createDefaultQuery())
  33. const activeTab = ref<'日报统计' | '非生产时效'>('日报统计')
  34. const deptName = ref('瑞鹰国际钻井')
  35. const refreshKey = ref(0)
  36. const handleDeptNodeClick = (node: any) => {
  37. deptName.value = node.name
  38. handleQuery()
  39. }
  40. const handleQuery = () => {
  41. query.value.pageNo = 1
  42. refreshKey.value += 1
  43. }
  44. const resetQuery = () => {
  45. query.value = createDefaultQuery()
  46. deptName.value = '瑞鹰国际钻井'
  47. handleQuery()
  48. }
  49. </script>
  50. <template>
  51. <div
  52. class="grid grid-cols-[auto_1fr] grid-rows-[62px_48px_1fr] gap-4 h-[calc(100vh-20px-var(--top-tool-height)-var(--tags-view-height)-var(--app-footer-height))]">
  53. <DeptTreeSelect
  54. :deptId="id"
  55. :top-id="158"
  56. v-model="query.deptId"
  57. @node-click="handleDeptNodeClick"
  58. class="row-span-3" />
  59. <el-form
  60. size="default"
  61. class="bg-white dark:bg-[#1d1e1f] rounded-lg shadow px-8 gap-8 flex items-center justify-between">
  62. <div class="flex items-center gap-8">
  63. <el-form-item label="项目">
  64. <el-input
  65. v-model="query.contractName"
  66. placeholder="请输入项目"
  67. clearable
  68. @keyup.enter="handleQuery()"
  69. class="!w-240px" />
  70. </el-form-item>
  71. <el-form-item label="任务">
  72. <el-input
  73. v-model="query.taskName"
  74. placeholder="请输入任务"
  75. clearable
  76. @keyup.enter="handleQuery()"
  77. class="!w-240px" />
  78. </el-form-item>
  79. <el-form-item label="创建时间">
  80. <el-date-picker
  81. v-model="query.createTime"
  82. value-format="YYYY-MM-DD HH:mm:ss"
  83. type="daterange"
  84. start-placeholder="开始日期"
  85. end-placeholder="结束日期"
  86. :shortcuts="rangeShortcuts"
  87. :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
  88. class="!w-220px" />
  89. </el-form-item>
  90. </div>
  91. <el-form-item>
  92. <el-button type="primary" @click="handleQuery()">
  93. <Icon icon="ep:search" class="mr-5px" /> 搜索
  94. </el-button>
  95. <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
  96. </el-form-item>
  97. </el-form>
  98. <el-button-group class="justify-self-start self-center">
  99. <el-button
  100. size="default"
  101. :type="activeTab === '日报统计' ? 'primary' : 'default'"
  102. @click="activeTab = '日报统计'">
  103. 日报统计
  104. </el-button>
  105. <el-button
  106. size="default"
  107. :type="activeTab === '非生产时效' ? 'primary' : 'default'"
  108. @click="activeTab = '非生产时效'">
  109. 非生产时效
  110. </el-button>
  111. </el-button-group>
  112. <DailyStatistics
  113. v-if="activeTab === '日报统计'"
  114. :query="query"
  115. :dept-name="deptName"
  116. :refresh-key="refreshKey" />
  117. <NonProductionEfficiency
  118. v-else
  119. :query="query"
  120. :dept-name="deptName"
  121. :refresh-key="refreshKey" />
  122. </div>
  123. </template>
  124. <style scoped>
  125. :deep(.el-form-item) {
  126. margin-bottom: 0;
  127. }
  128. </style>