index.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. <template>
  2. <div class="knowledge-1">
  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-select
  9. v-model="processType"
  10. clearable
  11. placeholder="请选择"
  12. popper-class="select"
  13. @change="getWidgetArray"
  14. >
  15. <el-option
  16. v-for="item in processTypeArray"
  17. :key="item.category"
  18. :label="item.name"
  19. :value="item.category"
  20. >
  21. </el-option>
  22. </el-select>
  23. </div>
  24. </div>
  25. <div class="query-item">
  26. <div class="lable">故障类型:</div>
  27. <div class="search-input">
  28. <el-select
  29. v-model="WidgetType"
  30. clearable
  31. placeholder="请选择"
  32. popper-class="select"
  33. @change="getTableData"
  34. >
  35. <el-option
  36. v-for="item in WidgetArray"
  37. :key="item.code"
  38. :label="item.widget"
  39. :value="item.code"
  40. >
  41. </el-option>
  42. </el-select>
  43. </div>
  44. </div>
  45. </div>
  46. <div class="query-actions">
  47. <button class="btn green" @click="getTableData">搜索</button>
  48. </div>
  49. </div>
  50. <div class="table-box">
  51. <ComTable :data="tableData" height="85vh"></ComTable>
  52. </div>
  53. <div class="dialog-box">
  54. <el-dialog
  55. title="详细信息"
  56. v-model="showDetails"
  57. custom-class="modal"
  58. :close-on-click-modal="false"
  59. >
  60. <know-info :data="infoData"></know-info>
  61. </el-dialog>
  62. </div>
  63. </div>
  64. </template>
  65. <script>
  66. import ComTable from "@com/coms/table/table.vue";
  67. import KnowInfo from "./knowinfo.vue";
  68. export default {
  69. components: { ComTable, KnowInfo },
  70. data() {
  71. const that = this;
  72. return {
  73. processTypeArray: [],
  74. processType: "",
  75. WidgetArray: [],
  76. WidgetType: "",
  77. nameArray: [],
  78. nameType: "",
  79. showDetails: false,
  80. infoData: [],
  81. tableData: {
  82. column: [
  83. {
  84. name: "故障分类",
  85. field: "widget",
  86. width: '200px',
  87. is_num: false,
  88. is_light: false,
  89. },
  90. {
  91. name: "故障名称",
  92. field: "name",
  93. width: '350px',
  94. is_num: false,
  95. is_light: false,
  96. },
  97. {
  98. name: "故障原因",
  99. field: "cause",
  100. width: '500px',
  101. is_num: false,
  102. is_light: false,
  103. },
  104. {
  105. name: "处理方法",
  106. field: "process",
  107. is_num: false,
  108. is_light: false,
  109. },
  110. {
  111. name: "操作",
  112. field: "",
  113. width: '200px',
  114. is_num: false,
  115. is_light: false,
  116. template() {
  117. return "<el-button type='text' style='cursor: pointer;'>查看详情</el-button>";
  118. },
  119. click(e, row) {
  120. that.getDetails(row);
  121. },
  122. },
  123. ],
  124. data: [],
  125. },
  126. };
  127. },
  128. created() {
  129. this.getProcessType();
  130. },
  131. methods: {
  132. getProcessType() {
  133. const that = this;
  134. that.API.requestData({
  135. method: "GET",
  136. baseURL: "http://192.168.1.18:9002/",
  137. subUrl: "know/process/type",
  138. data: {},
  139. success(res) {
  140. that.processTypeArray = res.data;
  141. that.processType = res?.data[0]?.category;
  142. that.getWidgetArray();
  143. },
  144. });
  145. },
  146. getWidgetArray() {
  147. const that = this;
  148. that.WidgetType = [];
  149. if (that.processType) {
  150. that.API.requestData({
  151. method: "GET",
  152. baseURL: "http://192.168.1.18:9002/",
  153. subUrl: "know/process/widget/list",
  154. data: {
  155. category: that.processType,
  156. },
  157. success(res) {
  158. that.WidgetArray = res.data;
  159. that.WidgetType = res?.data[0]?.code;
  160. that.getTableData();
  161. },
  162. });
  163. }
  164. },
  165. getTableData() {
  166. const that = this;
  167. that.API.requestData({
  168. method: "GET",
  169. baseURL: "http://192.168.1.18:9002/",
  170. subUrl: "know/process/name/list",
  171. data: {
  172. category: that.processType,
  173. code: that.WidgetType,
  174. },
  175. success(res) {
  176. that.tableData.data = res.data;
  177. },
  178. });
  179. },
  180. getDetails(row) {
  181. const that = this;
  182. that.API.requestData({
  183. method: "GET",
  184. baseURL: "http://192.168.1.18:9002/",
  185. subUrl: "know/process/list",
  186. data: {
  187. id: row.id,
  188. },
  189. success(res) {
  190. console.log(111, res.data);
  191. if (res.data?.length) {
  192. that.infoData = res.data;
  193. that.showDetails = true;
  194. } else {
  195. that.BASE.showMsg({
  196. msg: "暂无数据",
  197. });
  198. }
  199. },
  200. });
  201. },
  202. },
  203. };
  204. </script>
  205. <style lang="less" scope>
  206. @titleGray: #9ca5a8;
  207. @rowGray: #606769;
  208. @darkBack: #536268;
  209. .knowledge-1 {
  210. .el-select {
  211. width: 200px;
  212. }
  213. .el-input {
  214. width: 200px;
  215. }
  216. .dialog-box {
  217. height: 100%;
  218. display: flex;
  219. justify-content: center;
  220. align-items: center;
  221. }
  222. .el-dialog {
  223. min-width: 500px;
  224. min-height: 500px;
  225. }
  226. }
  227. </style>