detection.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <template>
  2. <section>
  3. <!--工具条-->
  4. <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
  5. <el-form :inline="true" :model="filters">
  6. <el-col :span="2">
  7. <el-form-item>
  8. <el-select v-model="filters.value" placeholder="请选择">
  9. <el-option label="编号" value="0"></el-option>
  10. <el-option label="名称" value="1"></el-option>
  11. </el-select>
  12. </el-form-item>
  13. </el-col>
  14. <el-form-item>
  15. <el-input v-model="filters.name" placeholder="请输入关键字进行搜索" style="width: 300px;" clearable></el-input>
  16. </el-form-item>
  17. <el-form-item>
  18. <el-button type="primary" @click="getMoulds(filters.name)">查询</el-button>
  19. </el-form-item>
  20. </el-form>
  21. </el-col>
  22. <!--列表-->
  23. <el-table
  24. :data="moulds"
  25. :height="tableHeight"
  26. highlight-current-row
  27. v-loading="listLoading"
  28. style="width: 100%;"
  29. >
  30. <el-table-column type="index" width="60"></el-table-column>
  31. <el-table-column prop="modelNo" label="模具编号" width="100" sortable></el-table-column>
  32. <el-table-column prop="modelName" label="模具名称" width="200" sortable></el-table-column>
  33. <el-table-column prop="equipmentNo" label="云模盒编号" width="120" sortable></el-table-column>
  34. <el-table-column prop="projectName" label="所属项目" width="200" sortable></el-table-column>
  35. <el-table-column prop="factoryName" label="制造工厂" width="200" sortable></el-table-column>
  36. <el-table-column prop="area" label="位置" width="200" sortable></el-table-column>
  37. <el-table-column prop="runTimes" label="运行次数" align="center" width="100" sortable></el-table-column>
  38. <el-table-column prop="ocCycle" label="每模平均周期" align="center" width="140" sortable></el-table-column>
  39. <el-table-column prop="hillNumber" label="电量" align="center" width="80" sortable></el-table-column>
  40. <el-table-column prop="state" label="当前状态" align="center" width="100" sortable></el-table-column>
  41. <el-table-column label="模具保养" align="center" fixed="right" width="100">
  42. <template slot-scope="scope">
  43. <span v-if="scope.row.runTimes > scope.row.initialModulus"><a style="color: #409EFF; cursor: pointer" @click="toMaintenance(scope.row.id)">需要</a></span>
  44. <span v-else><a style="color: #409EFF; cursor: pointer" @click="toMaintenance(scope.row.id)">不需要</a></span>
  45. </template>
  46. </el-table-column>
  47. </el-table>
  48. <!--工具条-->
  49. <el-col :span="24" class="toolbar">
  50. <el-pagination
  51. @size-change="handleSizeChange"
  52. @current-change="handleCurrentChange"
  53. :page-sizes="[20 , 50 , 80 , 100 , 200]"
  54. :page-size="20"
  55. layout="total, sizes, prev, pager, next"
  56. :total="total"
  57. style="float:right;"
  58. ></el-pagination>
  59. </el-col>
  60. </section>
  61. </template>
  62. <script>
  63. import util from "../../common/js/util";
  64. export default {
  65. data() {
  66. return {
  67. moulds: [],
  68. filters: {
  69. name: "",
  70. value: "0"
  71. },
  72. listLoading: false,
  73. total: 0,
  74. tableHeight: 0,
  75. page: 1,
  76. size: 20
  77. };
  78. },
  79. methods: {
  80. //分页
  81. handleCurrentChange(val) {
  82. this.page = val;
  83. this.getMoulds();
  84. },
  85. handleSizeChange(val) {
  86. this.size = val;
  87. this.getMoulds();
  88. },
  89. toMaintenance(id) {
  90. this.$router.push("/detection/" + id);
  91. },
  92. getMoulds(keyWord) {
  93. this.listLoading = true;
  94. if (keyWord == null) {
  95. var type = 0;
  96. } else {
  97. var type = this.filters.value;
  98. }
  99. var params = {
  100. pageNum: this.page,
  101. pageSize: this.size,
  102. projectId: -1,
  103. searchType: type,
  104. keyName: keyWord
  105. };
  106. this.http.post(
  107. this.port.mold.molds,
  108. params,
  109. res => {
  110. this.listLoading = false;
  111. if (res.code == "ok") {
  112. this.moulds = res.data.list;
  113. this.total = res.data.total;
  114. } else {
  115. this.$message({
  116. message: res.msg,
  117. type: "error"
  118. });
  119. }
  120. },
  121. error => {
  122. this.listLoading = false;
  123. this.$message({
  124. message: error,
  125. type: "error"
  126. });
  127. }
  128. );
  129. }
  130. },
  131. created() {
  132. let height = window.innerHeight;
  133. this.tableHeight = height - 210;
  134. },
  135. mounted() {
  136. this.getMoulds();
  137. }
  138. };
  139. </script>
  140. <style scoped>
  141. </style>