Blame view

src/views/registerBook/djbFrameall.vue 10.3 KB
1
<!--
yuanbo committed
2
 * @Description:
3 4 5
 * @Autor: renchao
 * @LastEditTime: 2023-07-19 09:52:59
-->
xiaomiao committed
6
<template>
xiaomiao committed
7
  <div class="content loadingtext">
xiaomiao committed
8
    <div class="left">
9 10 11 12 13 14 15 16
      <el-tree
        ref="tree"
        :data="treedata"
        :props="defaultProps"
        @node-click="handleNodeClick"
        :default-expand-all="true"
        :expand-on-click-node="false"
        node-key="id"
“miaofang committed
17 18
        :default-checked-keys="[showTab]"
      >
xiaomiao committed
19
      </el-tree>
20
      <el-collapse v-model="activeName" accordion>
21
        <el-collapse-item
22 23
          class="sfqqq"
          ref="sfq"
24 25
          v-for="(item, index) in sfqdata"
          :key="index"
“miaofang committed
26 27
          :name="index"
        >
28
          <template slot="title">
“miaofang committed
29
            <span class="text" @click="tap(item)">
30 31 32 33 34
              <span>
                {{ item.label }}
              </span>
            </span>
          </template>
35
          <p
36
            v-for="(item, index) in item.children"
“miaofang committed
37
            :re="item"
38
            :key="index"
“miaofang committed
39
            :class="[isActive == index ? activeCls : '', errorCls]"
“miaofang committed
40 41
            @click="taplist(item, index)"
          >
“miaofang committed
42 43 44 45 46 47 48
            <span>
              {{ item.label }}
            </span>
            <span>
              {{ item.zt }}
            </span>
          </p>
49 50
        </el-collapse-item>
      </el-collapse>
xiaomiao committed
51 52
    </div>
    <div class="right">
53 54 55
      <component
        :is="componentTag"
        @getBdcdyh="getBdcdyh"
“miaofang committed
56 57
        v-bind="currentSelectProps"
      />
xiaomiao committed
58 59 60 61
    </div>
  </div>
</template>
<script>
“miaofang committed
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
import { getBdcqljqtsx, getBdcqljqtsxBdcdyh } from "@/api/djbDetail.js";
import { loadTreeData, loadsfqData, getNode } from "./djbFrameData.js";
import { searchTaskToDo } from "@/api/workflow/search.js";
import { leftMenu } from "@/api/workFlow.js";
export default {
  data() {
    return {
      //接收参数
      // propsParam: this.$attrs,
      //左侧目录
      catalog: {},
      //选择加载哪一个组件
      componentTag: "",
      //子组件接收参数
      currentSelectProps: {},
      //左侧树形结构数据
      treedata: [],
      sfqdata: [],
      keyy: "",
      iskey: "",
      activeName: 0,
      // 查询参数
      queryForm: {},
xiaomiao committed
85

“miaofang committed
86 87 88 89 90 91 92 93
      defaultNode: "",
      isActive: "",
      activeCls: "select",
      errorCls: "unselected",
      defaultProps: {
        value: "id",
        children: "children",
        label: "label",
94
      },
“miaofang committed
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
      showTab: "bdcqldjml", // 选中状态,根据表格中权利类型判断
    };
  },
  mounted() {
    this.loadData(this.getCaption(window.location.href));
  },
  methods: {
    // 截取字符的方法
    /**
     * @description: 截取字符的方法
     * @param {*} obj
     * @author: renchao
     */
    getCaption(obj) {
      let index = obj.lastIndexOf("=");
      obj = obj.substring(index + 1, obj.length);
      return obj;
    },
    // 通过不动产业务号获取参数
    /**
     * @description: 通过不动产业务号获取参数
     * @author: renchao
     */
    // getdata () {
    //   this.queryForm = {
    //     bdcdyh: this.getCaption(window.location.href),
    //     currentPage: 1,
    //     djlx: "",
    //     pageSize: 10,
    //     qllx: "",
    //     ywh: "",
    //     ywly: "",
    //   };
    //   if (this.queryForm) {
    //     this.$startLoading();
    //     searchTaskToDo({
    //       ...this.queryForm,
    //     }).then((res) => {
    //       if (res.code === 200) {
    //         let { records } = res.result;
xiaomiao committed
135

“miaofang committed
136 137 138 139 140 141
    //         this.loadBdcdylist(records[0].bsmSlsq, records[0].bestepid);
    //         this.$endLoading();
    //       }
    //     });
    //   }
    // },
xiaomiao committed
142

“miaofang committed
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
    // 获取不动产信息
    /**
     * @description: 获取不动产信息
     * @param {*} a
     * @param {*} b
     * @author: renchao
     */
    // loadBdcdylist (a, b) {
    //   var formdata = new FormData();
    //   formdata.append("bsmSlsq", a);
    //   formdata.append("bestepid", b);
    //   leftMenu(formdata).then((res) => {
    //     if (res.code === 200) {
    //       if (res.result) {
    //         this.currentSelectProps = res.result[0];
    //         this.loadData(this.currentSelectProps.bdcdyh);
    //       }
    //     }
    //   });
    // },
163

“miaofang committed
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189
    /**
     * @description: getBdcdyh
     * @author: miaofang
     * 点击不动产单元号事件
     */
    getBdcdyh(val) {
      this.addloadData(val);
    },
    /**
     * @description: addloadData
     * @author: miaofang
     */
    addloadData(val) {
      getBdcqljqtsx({
        bdcdyid: val.bdcdyid,
        bdcdyh: val.bdcdyh,
      }).then((res) => {
        if (res.code === 200) {
          if (this.sfqdata.some((item) => item.bdcdyid === val.bdcdyid)) {
            let index = this.sfqdata.findIndex((item) => {
              return item.bdcdyid == val.bdcdyid;
            });
            this.activeName = index;
          } else {
            this.sfqdata.push(loadsfqData(res.result, val.bdcdyh, val.bdcdyid));
            this.activeName = this.sfqdata.length - 1;
xiaomiao committed
190
          }
“miaofang committed
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215
        }
      });
      this.currentSelectProps = {
        bdcdyid: val.bdcdyid,
        bdcdyh: val.bdcdyh,
        qllx: this.currentSelectProps.qllx,
        bsmQlxx: this.currentSelectProps.bsmQlxx,
      };
    },
    /**
     * @description: loadData
     * @author: renchao
     */
    loadData(val) {
      getBdcqljqtsxBdcdyh({
        bdcdyh: val,
      }).then((res) => {
        if (res.code === 200) {
          this.treedata = loadTreeData(val);
          this.sfqdata.push(loadsfqData(res.result, val, res.result.bdcdyid));
          this.$nextTick(function () {
            this.defaultNode = getNode(
              res.result.ztqllx,
              { linShi: 0, xianShi: 0, liShi: 0 },
              res.result.bdcdylx || ""
216
            );
“miaofang committed
217 218 219 220 221
            this.sfqdata[0].children.forEach((item, index) => {
              if (item.id == this.defaultNode.id) {
                this.loadComponent(item.form);
                this.isActive = index;
              }
xiaomiao committed
222
            });
“miaofang committed
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237
            this.currentSelectProps = {
              bdcdyid: res.result.bdcdyid,
              bdcdyh: val,
              qllx: res.result.qllx,
              bsmQlxx: this.currentSelectProps.bsmQlxx,
            };
            // this.$refs.tree.setCurrentKey(this.defaultNode.id); //data[0].id为默认选中的节点
            // this.loadComponent(this.defaultNode.form);

            // this.setstyle(0, 0, this.iskey);
          });
        }
      });
    },
    /*
238 239
          点击登记簿菜单
         */
“miaofang committed
240 241 242 243 244 245 246 247
    /**
     * @description: 点击登记簿菜单
     * @param {*} data
     * @author: renchao
     */
    handleNodeClick(data) {
      this.loadComponent(data.form);
    },
248

“miaofang committed
249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291
    /**
     * @description: setstyle
     * @param {*} data
     * @author: renchao
     * 设置样式和点击定位到当前功能
     */
    // setstyle (newindex, index, key) {
    //   if (key != undefined || this.keyy == index) {
    //     if (key != undefined) {
    //       this.keyy = key
    //     }
    //     this.loadComponent(this.$refs.sfq[newindex].$children[this.keyy].$attrs.re.form);
    //     let dpme = this.$refs.sfq[newindex].$children[this.keyy].$el
    //     dpme.style.backgroundColor = "#f5f5f5";
    //     dpme.style.color = "#0079fe";
    //     dpme.style.borderRight = "4px solid #0079fe";
    //   } else {
    //     let dpme = this.$refs.sfq[newindex].$children[this.keyy].$el
    //     dpme.style.backgroundColor = "#ffffff";
    //     dpme.style.color = "black";
    //     dpme.style.border = "none";
    //   }
    // },
    /**
     * @description: tap
     * @param {*} data
     * @author: renchao
     * 新增列表功能
     */
    tap(data, index) {
      this.loadComponent(data.form);
    },
    /**
     * @description: taplist
     * @param {*} data
     * @author: renchao
     * 新增列表功能
     */
    taplist(data, index) {
      this.loadComponent(data.form);
      this.isActive = index;
    },
    /**
292 293 294 295
     * @description: loadComponent
     * @param {*} form
     * @author: renchao
     */
“miaofang committed
296 297 298
    loadComponent(form) {
      this.componentTag = (r) =>
        require.ensure([], () => r(require("@/views/registerBook/" + form)));
xiaomiao committed
299
    },
“miaofang committed
300 301
  },
};
xiaomiao committed
302 303
</script>
<style scoped lang="scss">
“miaofang committed
304 305 306
/deep/.rollTable {
  height: calc(120vh - 254px) !important;
}
307

“miaofang committed
308 309 310 311
.content {
  width: 100%;
  height: 100%;
  display: flex;
xiaomiao committed
312

“miaofang committed
313 314 315 316 317 318
  .left {
    width: 256px;
    height: 100%;
    background-color: #f5f5f5;
    color: #333;
    border: 1px solid rgb(228, 228, 228);
319
  }
xiaomiao committed
320

“miaofang committed
321 322 323 324 325 326
  .right {
    width: calc(100% - 256px);
    height: 100%;
    // overflow-y: scroll;
    overflow: auto;
    background-color: #f5f5f5;
327 328
    border: 1px solid rgb(228, 228, 228);
  }
“miaofang committed
329
}
xiaomiao committed
330

“miaofang committed
331 332 333 334
/deep/ .expanded.el-tree-node__expand-icon,
/deep/ .el-tree-node__expand-icon {
  visibility: hidden;
}
xiaomiao committed
335

“miaofang committed
336 337 338 339 340 341 342 343 344 345
/deep/ .el-tree-node__content {
  border: 1px solid rgb(228, 228, 228);
  height: 45px;
}

/deep/ .el-tree-node:focus > .el-tree-node__content {
  // background-color: #f5f5f5;
  // color: #0079fe;
  // border-right: 4px solid #0079fe;
}
xiaomiao committed
346

“miaofang committed
347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363
/deep/.el-tree-node {
  white-space: pre-wrap;
}

/deep/ .is-current > .el-tree-node__content {
  // background-color: #f5f5f5;
  // color: #0079fe;
  // border-right: 4px solid #0079fe;
}
/deep/.el-collapse-item__header {
  width: 100%;
  cursor: pointer;
  position: relative;
  .el-collapse-item__arrow {
    position: absolute;
    top: 15px;
    right: 0px;
xiaomiao committed
364
  }
“miaofang committed
365 366
  align-items: center;
  .text {
367 368 369 370
    width: 100%;
    height: 45px;
    display: inline-block;
    span {
“miaofang committed
371 372
      margin-left: 60px;
      padding-top: 10px;
373
      display: inline-block;
“miaofang committed
374
      line-height: 15px;
375
    }
xiaomiao committed
376
  }
“miaofang committed
377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402
  height: 45px;
  display: inline-block;
  line-height: 45px;
  border: 1px solid rgb(228, 228, 228);
}
/deep/.el-collapse-item__content {
  padding-bottom: 5px;
}
/deep/.unselected {
  // white-space: wrap;
  border: none;
  cursor: pointer;
  width: 250px;
  height: 45px;
  border: 1px solid rgb(228, 228, 228);
  border-right: 4px solid #f5f5f5;
  margin: auto;
  text-align: center;
  align-items: center;
  span {
    width: 100%;
    display: inline-block;
    justify-content: center;
    align-items: center;
  }
}
“miaofang committed
403

“miaofang committed
404 405 406 407 408 409 410 411 412 413 414 415 416 417 418
.select {
  border: none;
  cursor: pointer;
  width: 250px;
  height: 45px;
  background-color: #f5f5f5;
  color: #0079fe;
  border-right: 4px solid #0079fe;
  margin: auto;
  text-align: center;
  align-items: center;
  span {
    width: 100%;
    display: inline-block;
    justify-content: center;
“miaofang committed
419 420
    align-items: center;
  }
“miaofang committed
421
}
xiaomiao committed
422
</style>