Blame view

src/views/workflow/components/leftmenu/segmentMenu.vue 8.28 KB
1 2 3
<!--
 * @Description: workFrame左侧菜单列表-分割
 * @Autor: renchao
4
 * @LastEditTime: 2023-07-25 14:52:40
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
-->
<template>
  <div class="leftmenu" :class="{ 'animation-map-drawer': isShowdrawer }">
    <el-menu :default-active="activeIndex" @select="batchUnitClick" class="title-batch" v-if="showBatch">
      <el-menu-item index="-1" key="-1" class="menus">
        <div>{{ batchButtonName }}</div>
      </el-menu-item>
    </el-menu>
    <div v-if="this.isShowdrawer">
      <!-- 变更前单元 -->
      <div class="title">
        <b>变更前单元</b>/申请单元列表({{ aroundUnitData.length }})
      </div>
      <el-menu :default-active="activeIndex" @select="unitClick">
        <el-menu-item v-for="(item, index) in aroundUnitData" :index="index.toString()" :key="index">
          <div>
            <p>{{ item.bdcdyh }}</p>
            <p class="title-detail">{{ item.zl }}</p>
          </div>
          <i class="el-icon-delete" v-if="aroundUnitData.length > 1" @click.stop="handleDel(item)"></i>
        </el-menu-item>
      </el-menu>
      <!-- 变更后单元 -->
      <div class="title">
        <b>变更后单元</b>/申请单元列表({{ afterUnitData.length }})
      </div>
      <el-menu :default-active="activeHIndex" @select="handleAfterunitClick">
        <el-menu-item v-for="(item, index) in afterUnitData" :index="index.toString()" :key="index">
33
          <span class="dot" v-if="item.issave == '0'"></span>
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
          <div>
            <p>{{ item.bdcdyh }}</p>
            <p class="title-detail">{{ item.zl }}</p>
          </div>
          <i class="el-icon-delete" v-if="afterUnitData.length > 1" @click.stop="handleDel(item)"></i>
        </el-menu-item>
      </el-menu>
    </div>
    <div class="map-drawer-click map-drawer" v-if="!isShowdrawer" @click="
          () => {
            this.isShowdrawer = !this.isShowdrawer;
          }
        "></div>
    <div class="map-drawer-expand map-drawer" v-else @click="
          () => {
            this.isShowdrawer = !this.isShowdrawer;
          }
        "></div>
  </div>
</template>
<script>
55
  import { mapGetters } from 'vuex'
56
  import { leftMenu, deleteFlow, jdcxLeftMenu } from "@/api/workFlow.js"
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
  export default {
    data () {
      return {
        //受理申请标识码
        bsmSlsq: this.$route.query.bsmSlsq,
        //当前流程所在环节
        bestepid: this.$route.query.bestepid,
        // 变更前单元默认选中
        activeIndex: '0',
        // 变更后单元默认选中
        activeHIndex: '-1',
        // 折叠
        isShowdrawer: true,
        // 批量操作
        showBatch: false,
        //批量操作按钮名称
        batchButtonName: '',
        //左侧菜单数据集合-变更前单元
        aroundUnitData: [],
        //左侧菜单数据集合-变更后单元
        afterUnitData: [],
        // 设置表单传递数据
        currentSelectProps: {}
      }
    },
    mounted () {
      this.loadBdcdylist();
    },
85 86 87 88 89 90 91
    computed: {
      ...mapGetters(['isRefresh'])
    },
    watch: {
      isRefresh: {
        handler (newVal, oldVal) {
          if (newVal) this.loadBdcdylist()
92 93
        },
        immediate: true
94 95
      }
    },
96 97
    methods: {
      //读取申请单元信息
yuanbo committed
98 99 100 101
      /**
       * @description: 读取申请单元信息
       * @author: renchao
       */
102 103 104
      loadBdcdylist () {
        var formdata = new FormData();
        formdata.append("bsmSlsq", this.bsmSlsq);
105 106 107
        if (this.$route.query.bestepid) {
          formdata.append("bestepid", this.bestepid);
        }
108 109 110
        if (this.$route.query.bsmBusiness) {
          formdata.append("bsmBusiness", this.$route.query.bsmBusiness);
        }
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125
        if (this.$route.query.type == 'jdcx') {
          jdcxLeftMenu(formdata).then((res) => {
            if (res.code === 200 && res.result) {
              this.aroundUnitData = res.result.filter(item => item.bglx == '1')
              this.afterUnitData = res.result.filter(item => item.bglx == '2')
              this.currentSelectProps = res.result[0];
              this.$emit('getCurrentSelectProps', this.currentSelectProps);
              this.judgeBatchShow();
              if (this.showBatch) {
                //满足批量查封/批量抵押按钮出现 即先展示批量表单
                this.batchUnitClick();
              } else {
                //默认选择单元列表第一个
                this.unitClick(0);
              }
126
            }
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
          })
        } else {
          leftMenu(formdata).then((res) => {
            if (res.code === 200 && res.result) {
              this.aroundUnitData = res.result.filter(item => item.bglx == '1')
              this.afterUnitData = res.result.filter(item => item.bglx == '2')
              this.currentSelectProps = res.result[0];
              this.$emit('getCurrentSelectProps', this.currentSelectProps);
              this.judgeBatchShow();
              if (this.showBatch) {
                //满足批量查封/批量抵押按钮出现 即先展示批量表单
                this.batchUnitClick();
              } else {
                //默认选择单元列表第一个
                this.unitClick(0);
              }
            }
          })
        }
146 147
      },
      //批量按钮判断
yuanbo committed
148 149 150 151
      /**
       * @description: 批量按钮判断
       * @author: renchao
       */
152 153 154
      judgeBatchShow () {
        this.showBatch = false;
        if (this.afterUnitData.length > 1) {
155
          let qllx = this.$route.query?.sqywbm?.substring(0, 3);
156 157 158 159 160 161 162 163 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 190 191 192 193 194 195 196 197 198 199 200
          switch (qllx) {
            case 'B39':
              this.showBatch = true;
              this.batchButtonName = '批量查封清单信息';
              break;
            case 'A37':
              this.showBatch = true;
              this.batchButtonName = '批量抵押';
              break;
            default:
              this.batchButtonName = '批量操作';
          }
        }
      },
      /**
       * @description: 删除左侧列表
       * @param {*} item
       * @author: renchao
       */
      handleDel (item) {
        this.$confirm("确定要删除吗, 是否继续?", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        })
          .then(() => {
            var formdata = new FormData();
            formdata.append("bsmSldyList", item.bsmSldy.split(","));
            formdata.append("bsmSlsq", this.bsmSlsq);
            deleteFlow(formdata).then((res) => {
              if (res.code == 200) {
                this.$message.success("删除成功");
                this.$parent.updateDialog();
              } else {
                this.$message.error(res.message);
              }
            });
          })
          .catch(() => {
            this.$message({
              type: "info",
              message: "已取消删除",
            });
          });
      },
xiaomiao committed
201

202
      //批量按钮点击事件
yuanbo committed
203 204 205 206
      /**
       * @description: 批量按钮点击事件
       * @author: renchao
       */
207 208
      batchUnitClick () {
        this.currentSelectProps.batchOperation = true;
xiaomiao committed
209 210 211
        // this.activeIndex = "-1";
        this.$parent.stepForm(0);

212 213
      },
      //申请单元点击事件
yuanbo committed
214 215 216 217 218
      /**
       * @description: 申请单元点击事件
       * @param {*} index
       * @author: renchao
       */
219 220 221
      unitClick (index) {
        this.activeHIndex = '-1'
        this.currentSelectProps = this.aroundUnitData[index];
222
        this.currentSelectProps.issave = '1'
223 224
        this.currentSelectProps.batchOperation = false;
        this.activeIndex = index.toString();
225 226
        //选中表单传递数据
        this.$emit('getCurrentSelectProps', this.currentSelectProps);
227 228
        this.$parent.stepForm(index);
      },
yuanbo committed
229 230 231 232 233
      /**
       * @description: handleAfterunitClick
       * @param {*} index
       * @author: renchao
       */
234 235 236 237 238
      handleAfterunitClick (index) {
        this.activeIndex = '-1'
        this.currentSelectProps = this.afterUnitData[index];
        this.currentSelectProps.batchOperation = false;
        this.activeHIndex = index.toString();
239 240
        //选中表单传递数据
        this.$emit('getCurrentSelectProps', this.currentSelectProps);
241
        this.$parent.stepForm(index);
242
        this.$store.dispatch('user/refreshPage', false);
243 244 245 246 247 248 249
      }
    }
  }
</script>
<style scoped lang='scss'>
  @import "~@/styles/mixin.scss";
  @import "../../workFrame.scss";
250
</style>