planImplementation.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <template>
  2. <div>
  3. <el-dialog
  4. :title="generalData.title || '计划进度'"
  5. :visible.sync="generalShow"
  6. width="80%"
  7. top="5vh"
  8. append-to-body
  9. :center="generalData.titleCenter || false"
  10. custom-class="customClass"
  11. @close="close"
  12. >
  13. <div class="stopCenter">
  14. <div v-if="generalData.alertShow" class="tableTop">
  15. <el-alert
  16. :title="generalData.alert.title || ''"
  17. type="success"
  18. :description="generalData.alert.description || ''"
  19. :closable="false"
  20. />
  21. </div>
  22. <el-row>
  23. <el-col :span="6">
  24. <div ref="chart1" class="chart" />
  25. </el-col>
  26. <el-col :span="18">
  27. <div id="chart2" ref="chart2" class="chart2" :style="{ height: height + 'px'}" />
  28. </el-col>
  29. </el-row>
  30. </div>
  31. </el-dialog>
  32. </div>
  33. </template>
  34. <script>
  35. import planImplementationJS from './planImplementationJS'
  36. export default {
  37. mixins: [planImplementationJS],
  38. props: {
  39. show: {
  40. type: Boolean,
  41. default: false
  42. },
  43. generalList: {
  44. type: Array,
  45. default: () => {
  46. return []
  47. }
  48. }
  49. },
  50. data () {
  51. return {
  52. generalShow: this.show,
  53. id: '',
  54. generalData: {
  55. title: '', // 弹出框标题
  56. titleCentr: false, // 弹出框标题是否区中
  57. alertShow: false, // 提示是否显示
  58. alert: {
  59. title: '', // 提示标题
  60. description: '' // 提示内容
  61. },
  62. leftData: {
  63. leftTotal: 0, // 左图数量
  64. title: '' // 左图标题,默认"完成率"
  65. },
  66. rightData: {
  67. title: '人数', // 右图标题
  68. xAxisName: '', // 右图x轴标题
  69. yAxisName: '', // 右图y轴标题
  70. yAxisData: ['金源信通'], // 右图y轴项
  71. series: [{
  72. name: '总数', // 右图x轴项
  73. data: [''] // 右图x轴数量
  74. }],
  75. color: ['rgb(55, 162, 218)', 'rgb(103, 224, 227)', 'rgb(253, 102, 109)'], // 颜色
  76. tooltip: { // 右图弹出框
  77. show: true,
  78. trigger: 'axis'
  79. }
  80. }
  81. },
  82. height: 300
  83. }
  84. },
  85. watch: {
  86. show: {
  87. handler () {
  88. // this.generalShow = this.show
  89. },
  90. deep: true,
  91. immediate: true
  92. }
  93. },
  94. created () {
  95. this.generalData = this.generalList[0]
  96. const height = this.generalData.rightData.yAxisData.length * 100
  97. this.height = height > 300 ? height : 300
  98. setTimeout(() => {
  99. this.getOption(this.generalData.leftData)
  100. this.barDataPlan(this.generalData.rightData)
  101. }, 100)
  102. },
  103. methods: {
  104. close () {
  105. this.$emit('generalClose', false)
  106. }
  107. }
  108. }
  109. </script>
  110. <style scoped>
  111. .stopCenter{
  112. margin: 20px 30px 20px 30px;
  113. }
  114. .tableTop{
  115. margin: 0 0 10px 0;
  116. }
  117. .chart{
  118. width: 100%;
  119. height: 300px;
  120. }
  121. .chart2{
  122. width: 100%;
  123. min-height: 300px;
  124. }
  125. </style>