power-review.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <template>
  2. <div class="power-review">
  3. <Row type="flex" justify="center" :align="'middle'">
  4. <!-- 功率复核 PowerLoad -->
  5. <Col v-for="item in PowerLoad" :key="item" :span="6">
  6. <dash-pie-chart :title="item.title" :value="item.value" :max="item.max" height="11.1111vh" @click="openDialog(item.dialogTitle, item.subUrl, item.targetName, item.dialogType)" />
  7. </Col>
  8. </Row>
  9. </div>
  10. </template>
  11. <script>
  12. import Col from "@/components/coms/grid/col.vue";
  13. import Row from "../../../components/coms/grid/row.vue";
  14. import DashPieChart from "../../../components/chart/pie/dash-pie-chart.vue";
  15. export default {
  16. components: {
  17. Row,
  18. Col,
  19. DashPieChart,
  20. },
  21. data () {
  22. return {
  23. // 功率复核数据
  24. PowerLoad: [],
  25. wpId:""
  26. };
  27. },
  28. props: {
  29. data: {
  30. type: Array,
  31. default: () => []
  32. },
  33. id:{
  34. type:String,
  35. defaylt:""
  36. }
  37. },
  38. mounted () {
  39. this.PowerLoad = this.data;
  40. this.wpId = this.id;
  41. },
  42. methods:{
  43. openDialog(dialogTitle, subUrl, targetName, dialogType){
  44. let that = this;
  45. that.API.requestData({
  46. method: "POST",
  47. subUrl,
  48. data: {
  49. id:that.wpId,
  50. targetName
  51. },
  52. success (res) {
  53. let powerLineChartData = {
  54. // 图表所用单位
  55. units: [""],
  56. value: [],
  57. };
  58. res.data.forEach((pEle,pIndex)=>{
  59. powerLineChartData.value.push({
  60. title: pEle[0].name,
  61. yAxisIndex: 0,
  62. value: [],
  63. });
  64. pEle.forEach(cEle=>{
  65. powerLineChartData.value[pIndex].value.push({
  66. text: new Date(cEle.time).formatDate("hh:mm:ss"),
  67. value: cEle.value1
  68. });
  69. });
  70. });
  71. that.$emit("chartClick", { dialogTitle, dialogType, data: powerLineChartData });
  72. }
  73. });
  74. }
  75. },
  76. watch: {
  77. data (res) {
  78. this.PowerLoad = res;
  79. },
  80. id(res){
  81. this.wpId = res;
  82. }
  83. }
  84. };
  85. </script>
  86. <style lang="less" scoped>
  87. .power-review {
  88. padding: 0;
  89. }
  90. .col + .col {
  91. margin-left: 0px;
  92. }
  93. </style>