Index.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <template>
  2. <div class="app-container">
  3. <el-row class="rowCls">
  4. <!-- 搜索模块 -->
  5. <div class="filter-container">
  6. <span style="margin-left: 15px;">
  7. <span>{{$t("statisticalAnalysis.searchForm.oee.productlineName")}}:</span>
  8. <el-select v-model="productionLineId" :placeholder='$t("common.pleaseSelect")' size="medium" style="width: 150px;">
  9. <el-option
  10. v-for="item in productionLines"
  11. :key="item.id"
  12. :label="item.name"
  13. :value="item.id">
  14. </el-option>
  15. </el-select>
  16. </span>
  17. <span style="margin-left: 15px;">
  18. <span>{{$t("statisticalAnalysis.searchForm.oee.statisticalDate")}}:</span>
  19. <el-date-picker
  20. v-model="statisticalDate"
  21. type="datetime"
  22. format="yyyy-MM"
  23. value-format="yyyy-MM"
  24. style="width: 20%;"
  25. />
  26. </span>
  27. <span style="margin-left: 15px;">
  28. <el-button plain type="primary" icon="el-icon-search" size="medium" @click="search">
  29. {{ $t("table.search") }}
  30. </el-button>
  31. <el-button plain type="warning" icon="el-icon-refresh" size="medium" @click="reset">
  32. {{ $t("table.reset") }}
  33. </el-button>
  34. </span>
  35. </div>
  36. </el-row>
  37. <!-- OEE柱状图 -->
  38. <el-row class="rowCls">
  39. <div class="bottomDiv">
  40. <!-- 标题 -->
  41. <div class="modelTitle marginBottom15">本月设备OEE</div>
  42. <!-- 柱状图数据 -->
  43. <div class="chart-wrapper">
  44. <bar-chart :barData="barData" :height="heightStr"/>
  45. </div>
  46. </div>
  47. </el-row>
  48. </div>
  49. </template>
  50. <script>
  51. import productionLineMgrApi from "@/api/runManageCenter/productionLineMgr"
  52. import productlineAvailabilityApi from "@/api/statisticalAnalysis/productlineAvailability"
  53. import BarChart from '@/components/Charts/BarChart'
  54. export default {
  55. name: "oee",
  56. components: {BarChart },
  57. props: {
  58. },
  59. data () {
  60. return {
  61. heightStr: "380px",
  62. productionLines: [],
  63. tableKey: 0,
  64. loading: false,
  65. productionLineId:"",
  66. statisticalDate:"",
  67. barData: {
  68. name: 'OEE',
  69. xData: [],
  70. yData: []
  71. },
  72. }
  73. },
  74. // 实例已经在内存中创建好,此时data和methods已将ok,如果要操作data中的数据或是调用methods中的方法,最早只能在created中操作
  75. created() {
  76. // 加载产线下拉框数据
  77. this.queryProductionLines()
  78. },
  79. computed: {
  80. },
  81. mounted () {
  82. },
  83. methods: {
  84. search() {
  85. this.fetch()
  86. },
  87. reset() {
  88. this.$refs.table.clearSort()
  89. this.$refs.table.clearFilter()
  90. this.search()
  91. },
  92. fetch () {
  93. this.tableKey = !this.tableKey
  94. this.loading = true
  95. console.log(this.productionLineId)
  96. let params = {}
  97. params.statisticalDate = this.statisticalDate
  98. params.productionlineId = this.productionLineId
  99. console.log(params)
  100. productlineAvailabilityApi.queryProductionLineOee(params).then(response => {
  101. const res = response.data
  102. if (res.isSuccess) {
  103. this.barData.xData = res.data.xData
  104. this.barData.yData = res.data.yData
  105. }
  106. }).finally(() => this.loading = false)
  107. },
  108. // 产线查找
  109. queryProductionLines(){
  110. this.productionLines = []
  111. productionLineMgrApi.getList({}).then(response => {
  112. const res = response.data
  113. if (res.isSuccess) {
  114. this.productionLines = res.data
  115. if(this.productionLines.length > 0){
  116. this.productionLineId = this.productionLines[0].id
  117. }
  118. }
  119. })
  120. }
  121. }
  122. }
  123. </script>
  124. <style lang="scss" scoped></style>