ChengPinRuKuQingKuang.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <template>
  2. <div class="screen-common-component">
  3. <ScreenComHeader :module-id="moduleId" title="成品入库情况" />
  4. <dv-scroll-board
  5. :config="config"
  6. style="width: 100%; height: calc(100% - 32px)"
  7. @mouseover="tableHover"
  8. />
  9. </div>
  10. </template>
  11. <script lang="ts" setup>
  12. import ScreenComHeader from "@/views/screens/configs/screenComHeader.vue";
  13. import { productionPlan, productStorageFinishedSituation } from "@/api/screens";
  14. const config = ref({});
  15. const props = defineProps({
  16. moduleId: {
  17. type: String,
  18. required: true,
  19. },
  20. });
  21. const loadData = async () => {
  22. let res = await productStorageFinishedSituation()
  23. if (res.data.length > 0) {
  24. let dicts = {
  25. workOrderCode: `<span style='font-size:${bigScreenData.value.fontSize * 1.5}px'>批号</span>`,
  26. materialModel: `<span style='font-size:${bigScreenData.value.fontSize * 1.5}px'>产品型号</span>`,
  27. planNum: `<span style='font-size:${bigScreenData.value.fontSize * 1.5}px'>数量</span>`,
  28. inventoryNum: `<span style='font-size:${bigScreenData.value.fontSize * 1.5}px'>入库数</span>`,
  29. };
  30. let bigData: any[] = [];
  31. res.data.forEach((item: any) => {
  32. let row = [
  33. `<span style='font-size:${bigScreenData.value.fontSize * 1.5}px'>${item.workOrderCode}</span>`,
  34. `<span style='font-size:${bigScreenData.value.fontSize * 1.5}px'>${item.materialModel}</span>`,
  35. `<span style='font-size:${bigScreenData.value.fontSize * 1.5}px'>${item.planNum}</span>`,
  36. `<span style='font-size:${bigScreenData.value.fontSize * 1.5}px'>${item.inventoryNum}</span>`,
  37. ];
  38. bigData.push(row);
  39. });
  40. config.value = {
  41. header: Object.values(dicts),
  42. data: bigData,
  43. // index: true,
  44. columnWidth: [125, 200, 70, 70],
  45. align: ["left"],
  46. carousel: "page",
  47. click: (row: any, index: number) => {
  48. console.log("mouseover", row, index);
  49. },
  50. };
  51. }
  52. }
  53. const bigScreenData: any = inject("bigScreenData");
  54. onMounted(async () => {
  55. loadData()
  56. const timer = setInterval(loadData, 60 * 5 * 1000) // 60秒 = 60000毫秒
  57. // 组件卸载时清除定时器
  58. onUnmounted(() => clearInterval(timer))
  59. });
  60. const tableHover = (data: any) => {
  61. // console.log("mouseover", data.row[data.columnIndex]);
  62. };
  63. </script>