ywsq.vue 6.59 KB
<template>
  <div class="ywsq">
    <div class="ywsq-left">
      <p v-for="(item, index) in leftList" @click="handleleftTitle(index)" :key="index"
        :class="{ 'active': n == index }">{{ item }}</p>
      <el-collapse disabled v-model="activeNames">
        <el-collapse-item title="业务申请" name="1">
          <ul class="item-list">
            <li v-for="(obj, key) in list" :key="key" @click="handleList(list, obj)" :class="obj.check ? 'active' : ''">
              {{ obj.nodename }}</li>
          </ul>
        </el-collapse-item>
      </el-collapse>
    </div>

    <!-- right -->
    <div class="ywsq-right">
      <div class="right-type el-card box-card is-always-shadow" v-if="n == -1">
        <div class="right-title">登记类型</div>
        <ul class="type-content">
          <li :class="item.cselect ? 'cactive' : ''" @click="handleDjlxSelect(item)" v-for="(item, index) in djlxList"
            :key="index">
            <p>
              {{ item.nodename }}
            </p>
            <p v-if="item.sffqlc == 1" :class="item.userCollect==1 ? 'active' : ''"
              @click.stop="handleCollection(item)">
              <i class="el-icon-star-off" :class="item.userCollect==1 ? 'active' : ''"></i>
            </p>
          </li>
        </ul>
      </div>
      <div class="right-situation el-card box-card is-always-shadow">
        <div v-if="n >= 0">
          <div class="right-title">业务列表</div>
          <ul>
            <li v-for="(item, index) in ywList" :key="index" @click="handleSelectYw(item, ywList)"
              :class="item.cselect ? 'cactive' : ''">
              <p>
                {{ item.nodename }}
              </p>
              <p v-if="item.sffqlc == 1" :class="item.userCollect==1 ? 'active' : ''"
                @click.stop="handleCollection(item)">
                <i class="el-icon-star-off" :class="item.userCollect==1 ? 'active' : ''"></i>
              </p>
            </li>
          </ul>
        </div>
        <div v-if="n == -1">
          <div class="right-title">登记情形</div>
          <ul class="registration">
            <li v-for="(item, index) in djqxList" @click="handleSelectYw(item, djqxList)"
              :class="item.cselect ? 'cactive' : ''" :key="index">
              <p>
                {{ item.nodename }}
              </p>
              <p :class="item.userCollect==1 ? 'active' : ''" @click.stop="handleCollection(item)">
                <i class="el-icon-star-off" :class="item.userCollect==1 ? 'active' : ''"></i>
              </p>
            </li>
          </ul>
        </div>
      </div>
      <div class="submit-button">
        <el-button type="primary" :disabled="btnDisabled" @click="bthSelectClick">选择不动产</el-button>
      </div>
    </div>
    <fqsqDialog v-model="isDialog" :djywbm="djywbm" />
  </div>
</template>
<script>
import Cookies from 'js-cookie'
import fqsqDialog from "./slectBdc.vue"
import { getCollectBiz, getleftMenu, getNextNode, addCollectBiz, deleteCollectBiz } from "@/api/ywbl"
export default {
  data () {
    return {
      n: 0,
      activeNames: ['1'],
      leftList: [
        '常办业务', '一并申请', '登记簿补录',
      ],
      list: [],
      djlxList: [],
      ywList: [],
      djqxList: [],
      isDialog: false,
      btnDisabled: true,
      djywbm: ''
    }
  },
  components: {
    fqsqDialog
  },
  created () {
    this.getDataList()
  },
  methods: {
    getDataList () {
      getCollectBiz().then(res => {
        let { result } = res
        this.ywList = result
        this.ywList.forEach(item => {
          this.$set(item, 'cselect', false)
        })
      })
      getleftMenu().then(res => {
        let { result } = res
        this.list = result
      })
    },
    handleleftTitle (index) {
      this.n = index
      this.list.forEach(item => {
        if (item.check) item.check = false
      })
    },
    // 业务-登记情形选择
    handleSelectYw (item, list) {
      list.forEach(item => {
        this.$set(item, 'cselect', false)
      })
      item.cselect = true
      Cookies.set("djqxObj", JSON.stringify({
        'djqxbm': item.nodecode,
        'djqxmc': item.nodename
      }))
      if (item.sffqlc == '1') {
        this.btnDisabled = false
        Cookies.set("bsmSqyw", item.bsmSqyw)
        this.djywbm = item.djywbm
      }
    },
    handleList (list, obj) {
      this.btnDisabled = true
      list.forEach(item => {
        if (item.check) item.check = false
      })
      this.n = -1
      this.$set(obj, 'check', true)
      this.getNextNode(obj.bsmSqyw)
      this.djqxList = []
      this.djlxList = []
    },
    // 获取下个节点类型
    getNextNode (bsmSqyw, type) {
      getNextNode(bsmSqyw).then(res => {
        if (res.result.djqx) this.djqxList = res.result.djqx
        if (res.result.djlx) this.djlxList = res.result.djlx
        if (type) {
          this.djqxList.forEach(item => {
            this.$set(item, 'cselect', false)
          })
          this.djlxList.forEach(item => {
            this.$set(item, 'cselect', false)
          })
        }
      })
    },
    handleCollection (item) {
      let that = this
      if (item.userCollect == '2') {
        addCollectBiz(item.bsmSqyw).then(res => {
          if (res.code == 200) {
            item.userCollect = '1'
            that.$message({
              message: '收藏成功!',
              type: 'success'
            })
            that.getDataList()
          }
        })
      } else {
        deleteCollectBiz(item.bsmSqyw).then(res => {
          if (res.code == 200) {
            item.userCollect = '2'
            that.$message({
              message: '取消收藏成功!',
              type: 'success'
            })
            that.getDataList()
          }
        })
      }
    },
    handleSelect (item) {
      this.busList.forEach(item => {
        item.cselect = false
      })
      item.cselect = !item.cselect
    },
    // 登记类型
    handleDjlxSelect (item) {
      this.btnDisabled = true
      this.djlxList.forEach(item => {
        if (item.cselect) item.cselect = false
      })
      this.$set(item, 'cselect', true)
      if (item.sffqlc == '1') {
        this.btnDisabled = false
        Cookies.set("bsmSqyw", item.bsmSqyw)
        this.djywbm = item.djywbm
      } else {
        this.getNextNode(item.bsmSqyw, false)
      }
      this.djqxList = []
    },
    // 选择不动产信息
    bthSelectClick () {
      this.isDialog = true
    },
    loadView (view) {
      return r => require.ensure([], () => r(require(`./components/${view}/${view}.vue`)))
    },
  }
}
</script>
<style scoped lang='scss'>
@import "~@/styles/mixin.scss";
@import './ywsq.scss';
</style>