b50e0fc8f753b68cb54d152a93b39c36f0fdc16f.svn-base 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <template>
  2. <el-container>
  3. <el-main style="padding: 10px 10px;" class="problem_view">
  4. <el-row :gutter="10">
  5. <el-col :span="10">
  6. <el-input clearable placeholder="输入关键字搜索" v-model="filterText"></el-input>
  7. <el-tree
  8. v-loading="showTree"
  9. :highlight-current="true"
  10. class="filter_tree"
  11. icon-class="el-icon-document"
  12. :data="treeDataLists"
  13. :props="defaultProps"
  14. :default-expand-all="true"
  15. :filter-node-method="filterNode"
  16. @node-click="treeNodeClickHandler"
  17. ref="tree"
  18. ></el-tree>
  19. </el-col>
  20. <el-col :span="14">
  21. <div class="read_wrapper">
  22. <p>
  23. <span>问题序号:</span>
  24. {{sn}}
  25. </p>
  26. <p>
  27. <span>问题描述:</span>
  28. {{pblmDesc}}
  29. </p>
  30. <p>
  31. <span>严重程度:</span>
  32. {{inspPblmCateWord}}
  33. </p>
  34. </div>
  35. </el-col>
  36. </el-row>
  37. </el-main>
  38. </el-container>
  39. </template>
  40. <script>
  41. import request from "@util/gw_ajax_request.js";
  42. export default {
  43. data() {
  44. return {
  45. showTree: true,
  46. treeDataLists: [],
  47. // 修改el-tree 的默认属性
  48. defaultProps: {
  49. children: "children",
  50. label: "name"
  51. },
  52. filterText: "",
  53. pblmDesc: "",
  54. sn: "", //问题序号
  55. objSubjectList: "",
  56. cateObjList: "",
  57. inspPblmCate: "", //严重程度
  58. inspPblmCateWord: "",
  59. firstNode: null
  60. };
  61. },
  62. mounted() {
  63. this.getTreeData();
  64. setTimeout(() => {
  65. this.showTree = false;
  66. }, 5000);
  67. },
  68. methods: {
  69. getTreeData() {
  70. let params = { type: 1 };
  71. // request.get('/dc/insp/pblms/getObjInspPblmsTree'+params.type,{}
  72. request.post("/dc/insp/pblms/getObjInspPblmsTree", params).then(res => {
  73. if (res.success) {
  74. this.treeDataLists = res.data;
  75. this.firstNode = this.treeDataLists[0].children[0].children[0].children[0];
  76. this.treeNodeClickHandler(this.firstNode);
  77. } else {
  78. this.$message.error(res.message);
  79. }
  80. });
  81. },
  82. //树的过滤方法
  83. filterNode(value, data) {
  84. if (!value) return true;
  85. //console.log(data.name.indexOf(value))
  86. if (data.name) {
  87. return data.name.indexOf(value) !== -1;
  88. }
  89. },
  90. treeNodeClickHandler(data) {
  91. request.get(`/dc/insp/pblms/${data.id}`).then(res => {
  92. if (res.success) {
  93. this.pblmDesc = res.data.pblmDesc;
  94. this.sn = res.data.sn;
  95. this.inspPblmCate = res.data.inspPblmCate;
  96. if (this.inspPblmCate == 1) {
  97. this.inspPblmCateWord = "一般";
  98. } else if (this.inspPblmCate == 2) {
  99. this.inspPblmCateWord = "较重";
  100. } else if (this.inspPblmCate == 2) {
  101. this.inspPblmCateWord = "严重";
  102. } else {
  103. this.inspPblmCateWord = "特别严重";
  104. }
  105. } else {
  106. this.$message.error(res.message);
  107. }
  108. });
  109. }
  110. },
  111. watch: {
  112. filterText(val) {
  113. this.$refs.tree.filter(val);
  114. }
  115. }
  116. };
  117. </script>
  118. <style lang="scss">
  119. .filter_tree {
  120. height: calc(100vh - 140px);
  121. overflow: auto;
  122. }
  123. .read_wrapper {
  124. height: calc(100vh - 140px);
  125. overflow: auto;
  126. padding: 10px;
  127. margin-top: 30px;
  128. line-height: 40px;
  129. color: #333;
  130. span {
  131. font-weight: bold;
  132. color: #444;
  133. }
  134. }
  135. .problem_view .el-tree-node__expand-icon.expanded {
  136. -webkit-transform: rotate(0deg);
  137. transform: rotate(0deg);
  138. }
  139. </style>