detection.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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 label="模具名称" width="200" sortable>
  33. <template slot-scope="scope">
  34. <a
  35. style="color: #409EFF; cursor: pointer"
  36. @click="toMaintenance(scope.row.id)"
  37. >{{scope.row.modelName}}</a>
  38. </template>
  39. </el-table-column>
  40. <el-table-column prop="equipmentNo" label="云模盒编号" width="120" sortable></el-table-column>
  41. <el-table-column prop="projectName" label="所属项目" width="200" sortable></el-table-column>
  42. <el-table-column prop="factoryName" label="制造工厂" sortable></el-table-column>
  43. <el-table-column prop="area" label="位置" width="200" sortable></el-table-column>
  44. <el-table-column prop="runTimes" label="运行次数" width="100" sortable></el-table-column>
  45. <el-table-column prop="ocCycle" label="每模平均周期" width="140" sortable></el-table-column>
  46. <el-table-column prop="hillNumber" label="电量" width="80" sortable></el-table-column>
  47. <el-table-column prop="state" label="当前状态" width="100" sortable></el-table-column>
  48. <el-table-column label="模具保养" width="100">
  49. <template slot-scope="scope">
  50. <span v-if="scope.row.runTimes > scope.row.initialModulus">需要</span>
  51. <span v-else>不需要</span>
  52. </template>
  53. </el-table-column>
  54. </el-table>
  55. <!--工具条-->
  56. <el-col :span="24" class="toolbar">
  57. <el-pagination
  58. @size-change="handleSizeChange"
  59. @current-change="handleCurrentChange"
  60. :page-sizes="[20 , 50 , 80 , 100 , 200]"
  61. :page-size="20"
  62. layout="total, sizes, prev, pager, next"
  63. :total="total"
  64. style="float:right;"
  65. ></el-pagination>
  66. </el-col>
  67. </section>
  68. </template>
  69. <script>
  70. import util from "../../common/js/util";
  71. export default {
  72. data() {
  73. return {
  74. moulds: [],
  75. filters: {
  76. name: "",
  77. value: "0"
  78. },
  79. listLoading: false,
  80. total: 0,
  81. tableHeight: 0,
  82. page: 1,
  83. size: 20
  84. };
  85. },
  86. methods: {
  87. //分页
  88. handleCurrentChange(val) {
  89. this.page = val;
  90. this.getMoulds();
  91. },
  92. handleSizeChange(val) {
  93. this.size = val;
  94. this.getMoulds();
  95. },
  96. toMaintenance(id) {
  97. this.$router.push("/detection/" + id);
  98. },
  99. getMoulds(keyWord) {
  100. this.listLoading = true;
  101. if (keyWord == null) {
  102. var type = 0;
  103. } else {
  104. var type = this.filters.value;
  105. }
  106. var params = {
  107. pageNum: this.page,
  108. pageSize: this.size,
  109. projectId: -1,
  110. searchType: type,
  111. keyName: keyWord
  112. };
  113. this.http.post(
  114. this.port.mold.molds,
  115. params,
  116. res => {
  117. this.listLoading = false;
  118. if (res.code == "ok") {
  119. this.moulds = res.data.list;
  120. this.total = res.data.total;
  121. } else {
  122. this.$message({
  123. message: res.msg,
  124. type: "error"
  125. });
  126. }
  127. },
  128. error => {
  129. this.listLoading = false;
  130. this.$message({
  131. message: error,
  132. type: "error"
  133. });
  134. }
  135. );
  136. }
  137. },
  138. created() {
  139. let height = window.innerHeight;
  140. this.tableHeight = height - 210;
  141. },
  142. mounted() {
  143. this.getMoulds();
  144. }
  145. };
  146. </script>
  147. <style scoped>
  148. </style>