summary.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766
  1. <script setup lang="ts">
  2. import dayjs from 'dayjs'
  3. import { IotRyDailyReportApi } from '@/api/pms/iotrydailyreport'
  4. import { useDebounceFn } from '@vueuse/core'
  5. import CountTo from '@/components/count-to1.vue'
  6. import * as echarts from 'echarts'
  7. import UnfilledReportDialog from './UnfilledReportDialog.vue'
  8. import { Motion, AnimatePresence } from 'motion-v'
  9. import { rangeShortcuts } from '@/utils/formatTime'
  10. import download from '@/utils/download'
  11. import { useUserStore } from '@/store/modules/user'
  12. const deptId = useUserStore().getUser.deptId
  13. interface Query {
  14. pageNo: number
  15. pageSize: number
  16. deptId: number
  17. contractName?: string
  18. taskName?: string
  19. createTime: string[]
  20. projectClassification: 1 | 2
  21. }
  22. const id = deptId
  23. const query = ref<Query>({
  24. pageNo: 1,
  25. pageSize: 10,
  26. deptId: deptId,
  27. createTime: [
  28. ...rangeShortcuts[1].value().map((item) => dayjs(item).format('YYYY-MM-DD HH:mm:ss'))
  29. ],
  30. projectClassification: 1
  31. })
  32. const totalWorkKeys: [string, string, string, string, number][] = [
  33. ['totalFootage', 'M', '累计进尺', 'i-solar:ruler-bold text-sky', 2],
  34. [
  35. 'utilizationRate',
  36. '%',
  37. '设备利用率',
  38. 'i-material-symbols:check-circle-outline-rounded text-emerald',
  39. 0
  40. ],
  41. [
  42. 'totalPowerConsumption',
  43. 'MWh',
  44. '累计用电量',
  45. 'i-material-symbols:electric-bolt-outline-rounded text-sky',
  46. 2
  47. ],
  48. [
  49. 'totalFuelConsumption',
  50. '升',
  51. '累计油耗',
  52. 'i-material-symbols:directions-car-outline-rounded text-sky',
  53. 2
  54. ],
  55. [
  56. 'averageFuelConsumption',
  57. '升',
  58. '平均油耗',
  59. 'i-material-symbols:directions-car-outline-rounded text-sky',
  60. 2
  61. ],
  62. ['totalCount', '个', '总数', 'i-tabler:report-analytics text-sky', 0],
  63. [
  64. 'alreadyReported',
  65. '个',
  66. '已填报',
  67. 'i-material-symbols:check-circle-outline-rounded text-emerald',
  68. 0
  69. ],
  70. ['notReported', '个', '未填报', 'i-material-symbols:cancel-outline-rounded text-rose', 0]
  71. ]
  72. const totalWork = ref({
  73. totalCount: 0,
  74. alreadyReported: 0,
  75. notReported: 0,
  76. totalFuelConsumption: 0,
  77. totalPowerConsumption: 0,
  78. totalFootage: 0,
  79. averageFuelConsumption: 0,
  80. utilizationRate: 0
  81. })
  82. const totalLoading = ref(false)
  83. const getTotal = useDebounceFn(async () => {
  84. totalLoading.value = true
  85. const { pageNo, pageSize, ...other } = query.value
  86. try {
  87. let res1: any[]
  88. if (query.value.createTime && query.value.createTime.length === 2) {
  89. res1 = await IotRyDailyReportApi.ryDailyReportStatistics({
  90. createTime: query.value.createTime,
  91. projectClassification: query.value.projectClassification
  92. })
  93. totalWork.value.totalCount = res1[0].count
  94. totalWork.value.alreadyReported = res1[1].count
  95. totalWork.value.notReported = res1[2].count
  96. }
  97. const res2 = await IotRyDailyReportApi.totalWorkload(other)
  98. totalWork.value = {
  99. ...totalWork.value,
  100. totalFootage: 0,
  101. ...res2,
  102. totalPowerConsumption: (res2.totalPowerConsumption || 0) / 1000,
  103. totalGasInjection: (res2.totalGasInjection || 0) / 10000,
  104. totalFuelConsumption: res2.totalFuelConsumption || 0,
  105. averageFuelConsumption: res2.averageFuelConsumption || 0,
  106. utilizationRate: Number(((res2.utilizationRate || 0) * 100).toFixed(2))
  107. }
  108. } finally {
  109. totalLoading.value = false
  110. }
  111. }, 1000)
  112. interface List {
  113. id: number | null
  114. name: string | null
  115. type: '1' | '2' | '3'
  116. cumulativeGasInjection: number | null
  117. cumulativeWaterInjection: number | null
  118. cumulativePowerConsumption: number | null
  119. cumulativeFuelConsumption: number | null
  120. transitTime: number | null
  121. nonProductiveTime: number | null
  122. averageFuelConsumption: number | null
  123. utilizationRate: number | null
  124. }
  125. const list = ref<List[]>([])
  126. const type = ref('2')
  127. const columns = (type: string) => {
  128. return [
  129. {
  130. label: type === '2' ? '项目部' : '队伍',
  131. prop: 'name'
  132. },
  133. {
  134. label: '累计进尺(M)',
  135. prop: 'cumulativeFootage'
  136. },
  137. {
  138. label: '累计用电量(MWh)',
  139. prop: 'cumulativePowerConsumption'
  140. },
  141. {
  142. label: '累计油耗(升)',
  143. prop: 'cumulativeFuelConsumption'
  144. },
  145. {
  146. label: '平均油耗(升)',
  147. prop: 'averageFuelConsumption'
  148. },
  149. {
  150. label: '平均时效(%)',
  151. prop: 'transitTime'
  152. },
  153. {
  154. label: '非生产时效(%)',
  155. prop: 'nonProductiveTime'
  156. },
  157. {
  158. label: '设备利用率(%)',
  159. prop: 'utilizationRate',
  160. action: true
  161. }
  162. ]
  163. }
  164. const listLoading = ref(false)
  165. const formatter = (row: List, column: any) => {
  166. if (column.property === 'transitTime') {
  167. return (Number(row.transitTime ?? 0) * 100).toFixed(2) + '%'
  168. } else if (column.property === 'nonProductiveTime') {
  169. return (Number(row.nonProductiveTime ?? 0) * 100).toFixed(2) + '%'
  170. } else if (column.property === 'utilizationRate') {
  171. return (Number(row.utilizationRate ?? 0) * 100).toFixed(2) + '%'
  172. } else return row[column.property] ?? 0
  173. }
  174. const getList = useDebounceFn(async () => {
  175. listLoading.value = true
  176. try {
  177. const res = await IotRyDailyReportApi.getIotRyDailyReportSummary(query.value)
  178. const { list: reslist } = res
  179. type.value = reslist[0]?.type || '2'
  180. list.value = reslist.map(
  181. ({ id, projectDeptId, projectDeptName, teamId, teamName, sort, taskId, type, ...other }) => ({
  182. id: type === '2' ? projectDeptId : teamId,
  183. name: type === '2' ? projectDeptName : teamName,
  184. ...other,
  185. cumulativePowerConsumption: ((other.cumulativePowerConsumption || 0) / 1000).toFixed(2),
  186. cumulativeFuelConsumption: (other.cumulativeFuelConsumption || 0).toFixed(2),
  187. averageFuelConsumption: (other.averageFuelConsumption || 0).toFixed(2),
  188. utilizationRate: other.utilizationRate || 0
  189. })
  190. )
  191. } finally {
  192. listLoading.value = false
  193. }
  194. }, 1000)
  195. const tab = ref<'表格' | '看板'>('表格')
  196. const currentTab = ref<'表格' | '看板'>('表格')
  197. const deptName = ref('瑞鹰国际钻井')
  198. const direction = ref<'left' | 'right'>('right')
  199. const handleSelectTab = (val: '表格' | '看板') => {
  200. tab.value = val
  201. direction.value = val === '看板' ? 'right' : 'left'
  202. nextTick(() => {
  203. currentTab.value = val
  204. setTimeout(() => {
  205. render()
  206. })
  207. })
  208. }
  209. const chartRef = ref<HTMLDivElement | null>(null)
  210. let chart: echarts.ECharts | null = null
  211. let chartContainerEl: HTMLDivElement | null = null
  212. const xAxisData = ref<string[]>([])
  213. const legend = ref<string[][]>([
  214. // ['累计油耗 (万升)', 'cumulativeFuelConsumption'],
  215. ['油耗 (升)', 'cumulativeFuelConsumption'],
  216. ['进尺 (M)', 'cumulativeFootage'],
  217. ['用电量 (KWh)', 'cumulativePowerConsumption'],
  218. // ['累计用电量 (MWh)', 'cumulativePowerConsumption'],
  219. ['平均时效 (%)', 'transitTime'],
  220. ['设备利用率 (%)', 'utilizationRate']
  221. ])
  222. const chartData = ref<Record<string, number[]>>({
  223. cumulativeFuelConsumption: [],
  224. cumulativeFootage: [],
  225. cumulativePowerConsumption: [],
  226. transitTime: [],
  227. utilizationRate: []
  228. })
  229. let chartLoading = ref(false)
  230. const getChart = useDebounceFn(async () => {
  231. chartLoading.value = true
  232. try {
  233. // 创建查询参数,如果 createTime 为空则不传
  234. const params: any = {
  235. deptId: query.value.deptId,
  236. projectClassification: query.value.projectClassification
  237. }
  238. // 只有 createTime 有值时才添加
  239. if (query.value.createTime && query.value.createTime.length === 2) {
  240. params.createTime = query.value.createTime
  241. }
  242. const res = await IotRyDailyReportApi.getIotRyDailyReportSummaryPolyline(query.value)
  243. chartData.value = {
  244. cumulativeFuelConsumption: res.map((item) => item.cumulativeFuelConsumption || 0),
  245. // cumulativeFuelConsumption: res.map((item) => (item.cumulativeFuelConsumption || 0) / 10000),
  246. cumulativeFootage: res.map((item) => item.cumulativeFootage || 0),
  247. cumulativePowerConsumption: res.map((item) => item.cumulativePowerConsumption || 0),
  248. // cumulativePowerConsumption: res.map((item) => (item.cumulativePowerConsumption || 0) / 1000),
  249. transitTime: res.map((item) => (item.transitTime || 0) * 100),
  250. utilizationRate: res.map((item) => Number(((item.utilizationRate || 0) * 100).toFixed(2)))
  251. }
  252. xAxisData.value = res.map((item) => item.reportDate || '')
  253. } finally {
  254. chartLoading.value = false
  255. }
  256. }, 1000)
  257. const resizer = () => {
  258. chart?.resize()
  259. }
  260. onUnmounted(() => {
  261. window.removeEventListener('resize', resizer)
  262. chart?.dispose()
  263. chart = null
  264. chartContainerEl = null
  265. })
  266. const selectedLegends = ref<Record<string, boolean>>({})
  267. const intervalArr = ref<number[]>([])
  268. const maxInterval = ref(0)
  269. const minInterval = ref(0)
  270. const calcIntervals = () => {
  271. let maxVal = -Infinity
  272. let minVal = Infinity
  273. let hasData = false
  274. for (const [name, key] of legend.value) {
  275. if (selectedLegends.value[name] !== false) {
  276. const dataset = chartData.value[key] || []
  277. if (dataset.length > 0) {
  278. hasData = true
  279. for (const val of dataset) {
  280. if (val > maxVal) maxVal = val
  281. if (val < minVal) minVal = val
  282. }
  283. }
  284. }
  285. }
  286. if (!hasData) {
  287. maxVal = 10000
  288. minVal = 0
  289. } else {
  290. minVal = minVal > 0 ? 0 : minVal
  291. }
  292. const maxDigits = (Math.floor(maxVal) + '').length
  293. const minDigits = minVal === 0 ? 0 : (Math.floor(Math.abs(minVal)) + '').length
  294. const interval = Math.max(maxDigits, minDigits)
  295. maxInterval.value = interval
  296. minInterval.value = minDigits
  297. const arr = [0]
  298. for (let i = 1; i <= interval; i++) {
  299. arr.push(Math.pow(10, i))
  300. }
  301. intervalArr.value = arr
  302. }
  303. const mapDataValue = (value: number) => {
  304. if (value === 0) return 0
  305. const isPositive = value > 0
  306. const absItem = Math.abs(value)
  307. if (!intervalArr.value.length) return value
  308. const min_value = Math.max(...intervalArr.value.filter((v) => v <= absItem))
  309. const min_index = intervalArr.value.findIndex((v) => v === min_value)
  310. const denominator =
  311. min_index < intervalArr.value.length - 1
  312. ? intervalArr.value[min_index + 1] - intervalArr.value[min_index]
  313. : intervalArr.value[min_index] || 1
  314. const new_value = (absItem - min_value) / denominator + min_index
  315. return isPositive ? new_value : -new_value
  316. }
  317. const getSeries = () => {
  318. return legend.value.map(([name, key]) => ({
  319. name,
  320. type: 'line',
  321. smooth: true,
  322. showSymbol: true,
  323. data: chartData.value[key].map((value) => mapDataValue(value))
  324. }))
  325. }
  326. const initChart = () => {
  327. if (!chartRef.value) return
  328. if (chart && chartContainerEl === chartRef.value) {
  329. return
  330. }
  331. chart?.dispose()
  332. chart = echarts.init(chartRef.value, undefined, { renderer: 'canvas' })
  333. chartContainerEl = chartRef.value
  334. window.addEventListener('resize', resizer)
  335. chart.on('legendselectchanged', (params: any) => {
  336. selectedLegends.value = params.selected
  337. calcIntervals()
  338. chart?.setOption({
  339. yAxis: {
  340. min: -minInterval.value,
  341. max: maxInterval.value
  342. },
  343. series: getSeries()
  344. })
  345. })
  346. }
  347. const render = () => {
  348. if (!chartRef.value) return
  349. initChart()
  350. legend.value.forEach(([name]) => {
  351. selectedLegends.value[name] = true
  352. })
  353. calcIntervals()
  354. chart?.setOption(
  355. {
  356. tooltip: {
  357. trigger: 'axis',
  358. axisPointer: { type: 'line' },
  359. formatter: (params: any) => {
  360. let d = `${params[0].axisValueLabel}<br>`
  361. let item = params.map((el: any) => {
  362. const realValue = chartData.value[legend.value[el.componentIndex][1]][el.dataIndex]
  363. return `<div class="flex items-center justify-between mt-1 gap-1">
  364. <span>${el.marker} ${el.seriesName}</span>
  365. <span>${realValue.toFixed(2)} ${el.seriesName.split(' ')[1] || ''}</span>
  366. </div>`
  367. })
  368. return d + item.join('')
  369. }
  370. },
  371. legend: {
  372. data: legend.value.map(([name]) => name),
  373. selected: selectedLegends.value,
  374. show: true
  375. },
  376. xAxis: {
  377. type: 'category',
  378. data: xAxisData.value
  379. },
  380. yAxis: {
  381. type: 'value',
  382. min: -minInterval.value,
  383. max: maxInterval.value,
  384. interval: 1,
  385. axisLabel: {
  386. formatter: (v: number) => {
  387. const num = v === 0 ? 0 : v > 0 ? Math.pow(10, v) : -Math.pow(10, -v)
  388. return num.toLocaleString()
  389. }
  390. }
  391. },
  392. series: getSeries()
  393. },
  394. true
  395. )
  396. }
  397. const handleDeptNodeClick = (node: any) => {
  398. deptName.value = node.name
  399. handleQuery()
  400. }
  401. const handleQuery = (setPage = true) => {
  402. if (setPage) {
  403. query.value.pageNo = 1
  404. }
  405. getChart().then(() => {
  406. render()
  407. })
  408. getList()
  409. getTotal()
  410. }
  411. const resetQuery = () => {
  412. query.value = {
  413. pageNo: 1,
  414. pageSize: 10,
  415. deptId: deptId,
  416. createTime: [
  417. ...rangeShortcuts[1].value().map((item) => dayjs(item).format('YYYY-MM-DD HH:mm:ss'))
  418. ],
  419. projectClassification: 1
  420. }
  421. handleQuery()
  422. }
  423. watch(
  424. () => query.value.createTime,
  425. (val) => {
  426. if (!val) {
  427. totalWork.value.totalCount = 0
  428. totalWork.value.notReported = 0
  429. totalWork.value.alreadyReported = 0
  430. }
  431. handleQuery(false)
  432. }
  433. )
  434. onMounted(() => {
  435. handleQuery()
  436. })
  437. const exportChart = () => {
  438. if (!chart) return
  439. let img = new Image()
  440. img.src = chart.getDataURL({
  441. type: 'png',
  442. pixelRatio: 1,
  443. backgroundColor: '#fff'
  444. })
  445. img.onload = function () {
  446. let canvas = document.createElement('canvas')
  447. canvas.width = img.width
  448. canvas.height = img.height
  449. let ctx = canvas.getContext('2d')
  450. ctx?.drawImage(img, 0, 0)
  451. let dataURL = canvas.toDataURL('image/png')
  452. let a = document.createElement('a')
  453. let event = new MouseEvent('click')
  454. a.href = dataURL
  455. a.download = `瑞鹰钻井日报统计数据.png`
  456. a.dispatchEvent(event)
  457. }
  458. }
  459. const exportData = async () => {
  460. const res = await IotRyDailyReportApi.exportRyDailyReportStatistics(query.value)
  461. download.excel(res, '瑞鹰钻井日报统计数据.xlsx')
  462. }
  463. const exportAll = async () => {
  464. if (tab.value === '看板') exportChart()
  465. else exportData()
  466. }
  467. const message = useMessage()
  468. const unfilledDialogRef = ref()
  469. const openUnfilledDialog = () => {
  470. // 检查是否选择了创建时间
  471. if (!query.value.createTime || query.value.createTime.length === 0) {
  472. message.warning('请先选择创建时间范围')
  473. return
  474. }
  475. // 打开弹窗
  476. unfilledDialogRef.value?.open()
  477. }
  478. const router = useRouter()
  479. const tolist = (id: number, non: boolean = false) => {
  480. const { pageNo, pageSize, ...rest } = query.value
  481. router.push({
  482. path: '/iotdayilyreport/IotRyDailyReport',
  483. query: {
  484. ...rest,
  485. deptId: id,
  486. ...(non ? { nonProductFlag: 'Y' } : {})
  487. }
  488. })
  489. }
  490. </script>
  491. <template>
  492. <div
  493. class="grid grid-cols-[auto_1fr] grid-rows-[62px_128px_1fr] gap-4 h-[calc(100vh-20px-var(--top-tool-height)-var(--tags-view-height)-var(--app-footer-height))]"
  494. >
  495. <DeptTreeSelect
  496. :deptId="id"
  497. :top-id="158"
  498. v-model="query.deptId"
  499. @node-click="handleDeptNodeClick"
  500. class="row-span-3"
  501. />
  502. <!-- <div class="p-4 bg-white dark:bg-[#1d1e1f] shadow rounded-lg row-span-3"> </div> -->
  503. <el-form
  504. size="default"
  505. class="bg-white dark:bg-[#1d1e1f] rounded-lg shadow px-8 gap-8 flex items-center justify-between"
  506. >
  507. <div class="flex items-center gap-8">
  508. <el-form-item label="项目">
  509. <el-input
  510. v-model="query.contractName"
  511. placeholder="请输入项目"
  512. clearable
  513. @keyup.enter="handleQuery()"
  514. class="!w-240px"
  515. />
  516. </el-form-item>
  517. <el-form-item label="任务">
  518. <el-input
  519. v-model="query.taskName"
  520. placeholder="请输入任务"
  521. clearable
  522. @keyup.enter="handleQuery()"
  523. class="!w-240px"
  524. />
  525. </el-form-item>
  526. <el-form-item label="创建时间">
  527. <el-date-picker
  528. v-model="query.createTime"
  529. value-format="YYYY-MM-DD HH:mm:ss"
  530. type="daterange"
  531. start-placeholder="开始日期"
  532. end-placeholder="结束日期"
  533. :shortcuts="rangeShortcuts"
  534. class="!w-220px"
  535. :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
  536. />
  537. </el-form-item>
  538. </div>
  539. <el-form-item>
  540. <el-button type="primary" @click="handleQuery()">
  541. <Icon icon="ep:search" class="mr-5px" /> 搜索
  542. </el-button>
  543. <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
  544. </el-form-item>
  545. </el-form>
  546. <div class="grid grid-cols-8 gap-8">
  547. <div
  548. v-for="info in totalWorkKeys"
  549. :key="info[0]"
  550. class="bg-white dark:bg-[#1d1e1f] rounded-lg shadow p-4 flex flex-col items-center justify-center gap-2"
  551. >
  552. <div class="size-7.5" :class="info[3]"></div>
  553. <count-to
  554. class="text-2xl font-medium"
  555. :start-val="0"
  556. :end-val="totalWork[info[0]]"
  557. :decimals="info[4]"
  558. @click="info[2] === '未填报' ? openUnfilledDialog() : ''"
  559. >
  560. <span class="text-xs leading-8 text-[var(--el-text-color-regular)]">暂无数据</span>
  561. </count-to>
  562. <div class="text-sm font-medium text-[var(--el-text-color-regular)] whitespace-nowrap">
  563. {{ info[1] ? info[2] + '(' + info[1] + ')' : info[2] }}
  564. </div>
  565. </div>
  566. </div>
  567. <div class="bg-white dark:bg-[#1d1e1f] rounded-lg shadow flex flex-col p-4 gap-2">
  568. <div class="flex h-12 items-center justify-between">
  569. <el-button-group>
  570. <el-button
  571. size="default"
  572. :type="tab === '表格' ? 'primary' : 'default'"
  573. @click="handleSelectTab('表格')"
  574. >表格
  575. </el-button>
  576. <el-button
  577. size="default"
  578. :type="tab === '看板' ? 'primary' : 'default'"
  579. @click="handleSelectTab('看板')"
  580. >看板
  581. </el-button>
  582. </el-button-group>
  583. <h3 class="text-xl font-medium">{{ `${deptName}-${tab}` }}</h3>
  584. <el-button size="default" type="primary" @click="exportAll">导出</el-button>
  585. </div>
  586. <div class="flex-1 relative">
  587. <el-auto-resizer class="absolute">
  588. <template #default="{ height }">
  589. <Motion
  590. as="div"
  591. :style="{ position: 'relative', overflow: 'hidden' }"
  592. :animate="{ height: `${height}px`, width: `100%` }"
  593. :transition="{ type: 'spring', stiffness: 200, damping: 25, duration: 0.3 }"
  594. >
  595. <AnimatePresence :initial="false" mode="sync">
  596. <Motion
  597. :key="currentTab"
  598. as="div"
  599. :initial="{ x: direction === 'left' ? '-100%' : '100%', opacity: 0 }"
  600. :animate="{ x: '0%', opacity: 1 }"
  601. :exit="{ x: direction === 'left' ? '50%' : '-50%', opacity: 0 }"
  602. :transition="{ type: 'tween', stiffness: 300, damping: 30, duration: 0.3 }"
  603. :style="{ position: 'absolute', left: 0, right: 0, top: 0 }"
  604. >
  605. <div :style="{ width: `100%`, height: `${height}px` }">
  606. <zm-table
  607. v-if="currentTab === '表格'"
  608. :loading="listLoading"
  609. :data="list"
  610. :height="height"
  611. show-border
  612. >
  613. <template v-for="item in columns(type)" :key="item.prop">
  614. <zm-table-column
  615. v-if="item.prop !== 'name' && item.prop !== 'nonProductiveTime'"
  616. :label="item.label"
  617. :prop="item.prop"
  618. :formatter="formatter"
  619. :action="item.action"
  620. />
  621. <zm-table-column
  622. v-else-if="item.prop === 'name'"
  623. :label="item.label"
  624. :prop="item.prop"
  625. >
  626. <template #default="{ row }">
  627. <el-button text type="primary" @click.prevent="tolist(row.id)">{{
  628. row.name
  629. }}</el-button>
  630. </template>
  631. </zm-table-column>
  632. <zm-table-column v-else :label="item.label" :prop="item.prop">
  633. <template #default="{ row }">
  634. <el-button
  635. v-if="row.nonProductiveTime > 0"
  636. text
  637. type="primary"
  638. @click.prevent="tolist(row.id, true)"
  639. >
  640. {{ (Number(row.nonProductiveTime ?? 0) * 100).toFixed(2) + '%' }}
  641. </el-button>
  642. <span v-else>
  643. {{ (Number(row.nonProductiveTime ?? 0) * 100).toFixed(2) + '%' }}
  644. </span>
  645. </template>
  646. </zm-table-column>
  647. </template>
  648. </zm-table>
  649. <div
  650. ref="chartRef"
  651. v-loading="chartLoading"
  652. :key="dayjs().valueOf()"
  653. v-else
  654. :style="{ width: `100%`, height: `${height}px` }"
  655. >
  656. </div>
  657. </div>
  658. </Motion>
  659. </AnimatePresence>
  660. </Motion>
  661. </template>
  662. </el-auto-resizer>
  663. </div>
  664. </div>
  665. </div>
  666. <UnfilledReportDialog ref="unfilledDialogRef" :query-params="query" />
  667. </template>
  668. <style scoped>
  669. :deep(.el-form-item) {
  670. margin-bottom: 0;
  671. }
  672. </style>