| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- <template>
- <el-container>
- <el-main style="padding: 10px 10px;" class="problem_view">
- <el-row :gutter="10">
- <el-col :span="10">
- <el-input clearable placeholder="输入关键字搜索" v-model="filterText"></el-input>
- <el-tree
- v-loading="showTree"
- :highlight-current="true"
- class="filter_tree"
- icon-class="el-icon-document"
- :data="treeDataLists"
- :props="defaultProps"
- :default-expand-all="true"
- :filter-node-method="filterNode"
- @node-click="treeNodeClickHandler"
- ref="tree"
- ></el-tree>
- </el-col>
- <el-col :span="14">
- <div class="read_wrapper">
- <p>
- <span>问题序号:</span>
- {{sn}}
- </p>
- <p>
- <span>问题描述:</span>
- {{pblmDesc}}
- </p>
- <p>
- <span>严重程度:</span>
- {{inspPblmCateWord}}
- </p>
- </div>
- </el-col>
- </el-row>
- </el-main>
- </el-container>
- </template>
- <script>
- import request from "@util/gw_ajax_request.js";
- export default {
- data() {
- return {
- showTree: true,
- treeDataLists: [],
- // 修改el-tree 的默认属性
- defaultProps: {
- children: "children",
- label: "name"
- },
- filterText: "",
- pblmDesc: "",
- sn: "", //问题序号
- objSubjectList: "",
- cateObjList: "",
- inspPblmCate: "", //严重程度
- inspPblmCateWord: "",
- firstNode: null
- };
- },
- mounted() {
- this.getTreeData();
- setTimeout(() => {
- this.showTree = false;
- }, 5000);
- },
- methods: {
- getTreeData() {
- let params = { type: 1 };
- // request.get('/dc/insp/pblms/getObjInspPblmsTree'+params.type,{}
- request.post("/dc/insp/pblms/getObjInspPblmsTree", params).then(res => {
- if (res.success) {
- this.treeDataLists = res.data;
- this.firstNode = this.treeDataLists[0].children[0].children[0].children[0];
- this.treeNodeClickHandler(this.firstNode);
- } else {
- this.$message.error(res.message);
- }
- });
- },
- //树的过滤方法
- filterNode(value, data) {
- if (!value) return true;
- //console.log(data.name.indexOf(value))
- if (data.name) {
- return data.name.indexOf(value) !== -1;
- }
- },
- treeNodeClickHandler(data) {
- request.get(`/dc/insp/pblms/${data.id}`).then(res => {
- if (res.success) {
- this.pblmDesc = res.data.pblmDesc;
- this.sn = res.data.sn;
- this.inspPblmCate = res.data.inspPblmCate;
- if (this.inspPblmCate == 1) {
- this.inspPblmCateWord = "一般";
- } else if (this.inspPblmCate == 2) {
- this.inspPblmCateWord = "较重";
- } else if (this.inspPblmCate == 2) {
- this.inspPblmCateWord = "严重";
- } else {
- this.inspPblmCateWord = "特别严重";
- }
- } else {
- this.$message.error(res.message);
- }
- });
- }
- },
- watch: {
- filterText(val) {
- this.$refs.tree.filter(val);
- }
- }
- };
- </script>
- <style lang="scss">
- .filter_tree {
- height: calc(100vh - 140px);
- overflow: auto;
- }
- .read_wrapper {
- height: calc(100vh - 140px);
- overflow: auto;
- padding: 10px;
- margin-top: 30px;
- line-height: 40px;
- color: #333;
- span {
- font-weight: bold;
- color: #444;
- }
- }
- .problem_view .el-tree-node__expand-icon.expanded {
- -webkit-transform: rotate(0deg);
- transform: rotate(0deg);
- }
- </style>
|