Index.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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. // 【产线管理】-API
  55. import areaMgrApi from "@/api/resourceProductMgr/areaMgr"
  56. export default {
  57. name: "oee",
  58. components: {BarChart },
  59. props: {
  60. },
  61. data () {
  62. return {
  63. heightStr: "380px",
  64. productionLines: [],
  65. tableKey: 0,
  66. loading: false,
  67. productionLineId:"",
  68. statisticalDate:"",
  69. barData: {
  70. name: 'OEE',
  71. xData: [],
  72. yData: []
  73. },
  74. }
  75. },
  76. // 实例已经在内存中创建好,此时data和methods已将ok,如果要操作data中的数据或是调用methods中的方法,最早只能在created中操作
  77. created() {
  78. // 加载产线下拉框数据
  79. this.getLineList();
  80. // this.queryProductionLines()
  81. },
  82. computed: {
  83. },
  84. mounted () {
  85. },
  86. methods: {
  87. search() {
  88. this.fetch()
  89. },
  90. reset() {
  91. this.$refs.table.clearSort()
  92. this.$refs.table.clearFilter()
  93. this.search()
  94. },
  95. fetch () {
  96. this.tableKey = !this.tableKey
  97. this.loading = true
  98. console.log(this.productionLineId)
  99. let params = {}
  100. params.statisticalDate = this.statisticalDate
  101. params.productionlineId = this.productionLineId
  102. console.log(params)
  103. productlineAvailabilityApi.queryProductionLineOee(params).then(response => {
  104. const res = response.data
  105. if (res.isSuccess) {
  106. this.barData.xData = res.data.xData
  107. this.barData.yData = res.data.yData
  108. }
  109. }).finally(() => this.loading = false)
  110. },
  111. // 产线下拉数据
  112. getLineList(){
  113. areaMgrApi.getList().then(res => {
  114. res = res.data;
  115. // console.log("产线下拉数据: ", res);
  116. if(res.code == 0) {
  117. this.productionLines = res.data;
  118. }
  119. })
  120. },
  121. // 产线查找
  122. queryProductionLines(){
  123. this.productionLines = []
  124. productionLineMgrApi.getList({}).then(response => {
  125. const res = response.data
  126. if (res.isSuccess) {
  127. this.productionLines = res.data
  128. if(this.productionLines.length > 0){
  129. this.productionLineId = this.productionLines[0].id
  130. }
  131. }
  132. })
  133. }
  134. }
  135. }
  136. </script>
  137. <style lang="scss" scoped></style>