meirihejiantongji.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <template>
  2. <el-dialog
  3. :model-value="props.isShow"
  4. title="核检废品日统计"
  5. fullscreen
  6. destroy-on-close
  7. @close="handleExit"
  8. >
  9. <el-container>
  10. <!-- 按钮部分 -->
  11. <el-header>
  12. <el-button
  13. type="primary"
  14. size="large"
  15. @click="handleExcel"
  16. >导出到Excel
  17. </el-button>
  18. <el-button
  19. type="primary"
  20. size="large"
  21. @click="handleExit"
  22. >退出
  23. </el-button>
  24. </el-header>
  25. <el-main>
  26. <el-date-picker
  27. v-model="date"
  28. type="daterange"
  29. range-separator="--"
  30. start-placeholder="开始日期"
  31. end-placeholder="结束日期"
  32. value-format="YYYY-MM-DD"
  33. style="margin-bottom: 10px;"
  34. />
  35. <el-button
  36. type="primary"
  37. :loading="isLoading"
  38. style="margin-bottom: 10px; margin-left: 5px;"
  39. @click="handleSearch"
  40. >刷新
  41. </el-button>
  42. <el-table
  43. ref="multipleTable"
  44. width="100%"
  45. height="70vh"
  46. :data="tableData"
  47. row-key="ID"
  48. highlight-current-row
  49. border
  50. show-overflow-tooltip
  51. :row-style="{ height: '20px' }"
  52. :cell-style="{ padding: '0px' }"
  53. :header-row-style="{ height: '20px' }"
  54. :header-cell-style="{ padding: '0px' }"
  55. >
  56. <!-- 循环渲染表格列 -->
  57. <el-table-column
  58. v-for="column in tableColumns"
  59. :key="column.prop"
  60. :prop="column.prop"
  61. :label="column.label"
  62. :width="column.width"
  63. />
  64. </el-table>
  65. </el-main>
  66. </el-container>
  67. </el-dialog>
  68. </template>
  69. <script>
  70. export default {
  71. name: 'Meirihejiantongji',
  72. }
  73. // 6核检废品日统计
  74. import service from '@/utils/request'
  75. const getDaysWast = (params) => {
  76. return service({
  77. url: '/mes_server/work_order_verification/getDaysWast',
  78. method: 'get',
  79. params
  80. })
  81. }
  82. </script>
  83. <script setup>
  84. import { ref, reactive, defineProps, defineEmits } from 'vue'
  85. const props = defineProps(['isShow'])
  86. const emits = defineEmits(['myClose'])
  87. const tableColumns = reactive([
  88. { label: '日期', prop: 'qczl_rq', width: '150' },
  89. { label: '废品类别', prop: 'fp_lb', width: '150' },
  90. { label: 'A班员工编号', prop: 'fp_bh', width: '150' },
  91. { label: 'A班员工姓名', prop: 'fp_name', width: '150' },
  92. { label: 'A班数量', prop: 'fp_sl', width: '150' },
  93. { label: 'B班员工编号', prop: 'fp_bh_b', width: '150' },
  94. { label: 'B班员工姓名', prop: 'fp_name_b', width: '150' },
  95. { label: 'B班数量', prop: 'fp_sl_b', width: '150' },
  96. ])
  97. const tableData = reactive([])
  98. const date = ref()
  99. const isLoading = ref(false)
  100. const handleExit = () => {
  101. emits('myClose')
  102. }
  103. const handleExcel = () => {
  104. }
  105. const handleSearch = async() => {
  106. const start_date = date?.value?.[0]
  107. const end_date = date?.value?.[1]
  108. if (!start_date || !end_date) { return }
  109. const params = {
  110. start_date,
  111. end_date
  112. }
  113. isLoading.value = true
  114. const res = await getDaysWast(params)
  115. isLoading.value = false
  116. if (res.code === 0) {
  117. const { data } = res
  118. const val = data.map(item => {
  119. const formatDate = item.qczl_rq?.split(' ')[0]
  120. if (item.fp_bz === 'B班') {
  121. return {
  122. qczl_rq: formatDate,
  123. fp_lb: item.fp_lb,
  124. fp_bh_b: item.fp_bh,
  125. fp_name_b: item.fp_name,
  126. fp_sl_b: item.fp_sl,
  127. }
  128. }
  129. return { ...item, qczl_rq: formatDate }
  130. })
  131. console.log(val)
  132. tableData.splice(0, tableData.length, ...val)
  133. }
  134. }
  135. </script>
  136. <style scoped>
  137. :deep(.el-table td .cell) {
  138. line-height: 30px !important;
  139. }
  140. </style>