preview.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <!--
  2. * @Descripttion: 大屏设置器
  3. * @version:
  4. * @Author: qianlishi
  5. * @Date: 2022-03-14 14:05:15
  6. * @LastEditors: qianlishi
  7. * @LastEditTime: 2022-04-28 12:23:34
  8. -->
  9. <template>
  10. <div class="layout">
  11. <div :style="bigScreenStyle">
  12. <widget
  13. v-for="(widget, index) in widgets"
  14. :key="index"
  15. v-model="widget.value"
  16. :type="widget.type"
  17. />
  18. </div>
  19. </div>
  20. </template>
  21. <script>
  22. import widget from "./components/temp";
  23. import { detailDashboard } from "@/api/bigscreen";
  24. export default {
  25. name: "Login",
  26. components: {
  27. widget
  28. },
  29. data() {
  30. return {
  31. bigScreenStyle: {},
  32. widgets: []
  33. };
  34. },
  35. mounted() {
  36. this.getData();
  37. },
  38. methods: {
  39. async getData() {
  40. const reportCode = this.$route.query.reportCode;
  41. const { code, data } = await detailDashboard(reportCode);
  42. if (code != 200) return;
  43. const equipment = document.body.clientWidth;
  44. const ratioEquipment = equipment / data.dashboard.width;
  45. this.bigScreenStyle = {
  46. width: data.dashboard.width + "px",
  47. height: data.dashboard.height + "px",
  48. "background-color": data.dashboard.backgroundColor,
  49. "background-image": "url(" + data.dashboard.backgroundImage + ")",
  50. "background-position": "0% 0%",
  51. "background-size": "100% 100%",
  52. "background-repeat": "initial",
  53. "background-attachment": "initial",
  54. "background-origin": "initial",
  55. "background-clip": "initial",
  56. transform: `scale(${ratioEquipment}, ${ratioEquipment})`,
  57. "transform-origin": "0 0"
  58. };
  59. this.widgets = data.dashboard.widgets;
  60. }
  61. }
  62. };
  63. </script>
  64. <style scoped lang="scss">
  65. .layout {
  66. width: 100%;
  67. height: 100%;
  68. text-align: center;
  69. }
  70. .bottom-text {
  71. width: 100%;
  72. color: #a0a0a0;
  73. position: fixed;
  74. bottom: 16px;
  75. z-index: 9999;
  76. }
  77. </style>