Knowledge2.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <template>
  2. <div class="knowledge-2">
  3. <div class="query mg-b-8">
  4. <div class="query-items">
  5. <div class="query-item">
  6. <div class="lable">查询内容:</div>
  7. <div class="search-input">
  8. <el-input v-model="content" placeholder="请输入查询内容"></el-input>
  9. </div>
  10. </div>
  11. </div>
  12. <div class="query-actions">
  13. <button class="btn green" @click="onClickSearch">搜索</button>
  14. </div>
  15. </div>
  16. <div>
  17. <ComTable :data="tableData" height="85vh"></ComTable>
  18. </div>
  19. </div>
  20. </template>
  21. <script>
  22. import ComTable from "@com/coms/table/table.vue";
  23. import api from "@api/maintenance/expertKnowledge/index.js";
  24. export default {
  25. components: { ComTable },
  26. data() {
  27. return {
  28. content: "",
  29. tableData: {
  30. column: [
  31. {
  32. name: "序号",
  33. field: "id",
  34. is_num: true,
  35. is_light: false,
  36. },
  37. {
  38. name: "按错内容",
  39. field: "safecontent",
  40. is_num: false,
  41. is_light: false,
  42. },
  43. {
  44. name: "故障按错内容描述",
  45. field: "describe",
  46. is_num: false,
  47. is_light: false,
  48. },
  49. {
  50. name: "负责人",
  51. field: "principal",
  52. is_num: false,
  53. is_light: false,
  54. },
  55. {
  56. name: "添加时间",
  57. field: "addtime",
  58. is_num: false,
  59. is_light: false,
  60. },
  61. {
  62. name: "类型",
  63. field: "type",
  64. is_num: false,
  65. is_light: false,
  66. },
  67. {
  68. name: "其他",
  69. field: "other",
  70. is_num: false,
  71. is_light: false,
  72. },
  73. ],
  74. data: [],
  75. },
  76. };
  77. },
  78. created() {
  79. this.requestSafeList();
  80. },
  81. methods: {
  82. // 搜索按钮
  83. onClickSearch() {
  84. this.requestSafeList();
  85. },
  86. // 获取按错内容
  87. requestSafeList() {
  88. api.safeMeasureKnowledge({
  89. name: this.content,
  90. pageNum: 1,
  91. pageSize: 1000,
  92. }).then(res =>{
  93. if (res.code == 200) {
  94. this.tableData.data = [];
  95. let data = res.data;
  96. for (var i = 0; i < data.length; i++) {
  97. let obj = {
  98. id: i + 1,
  99. safecontent: data[i].safecontent,
  100. describe: data[i].describe,
  101. principal: data[i].principal,
  102. addtime: new Date(data[i].addtime).formatDate("yyyy-MM-dd"),
  103. type: data[i].type,
  104. other: data[i].other,
  105. };
  106. this.tableData.data.push(obj);
  107. }
  108. }
  109. })
  110. },
  111. },
  112. };
  113. </script>
  114. <style lang="less" scope>
  115. @titleGray: #9ca5a8;
  116. @rowGray: #606769;
  117. @darkBack: #536268;
  118. .knowledge-2 {
  119. .el-select {
  120. width: 200px;
  121. }
  122. .el-input {
  123. width: 200px;
  124. }
  125. }
  126. </style>