detection.vue 4.6 KB

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