Blame view

src/views/workflow/top/back/index.vue 4.26 KB
1 2 3 4 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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 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 85 86 87 88 89 90 91 92 93 94 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 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174
<!--
 * @Description:
 * @Autor: renchao
 * @LastEditTime: 2023-08-02 14:24:20
-->
<template>
  <div class="from-clues">
    <!-- 表单部分 -->
    <div class="from-clues-header">
      <div class="title">请选择要退回到的环节:</div>
      <el-form ref="queryForm" label-width="90px">
        <ul style="margin-bottom: 15px">
          <li
            v-for="(item, index) in dataList"
            class="listDetail"
            :key="index"
            @click="changeSelectItem(item)">
            <p class="icon">
              <el-radio
                v-model="selectActivity"
                :label="item.activityId"
                @change="changeSelectItem(item)"></el-radio>
            </p>
            <p>{{ item.activityName }}</p>
            <p v-for="(child, childIndex) in item.assignee" :key="childIndex">
              {{ child.name }}
            </p>
          </li>
        </ul>
        <div class="title">退回意见:</div>
        <el-form-item>
          <el-input
            class="textArea"
            type="textarea"
            v-model="outstepopinion"
            placeholder="请输入退回意见"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button style="float:right" @click="cancelBack">取消</el-button>
          <el-button type="primary" @click="onSubmit" style="float:right">退回</el-button>
        </el-form-item>
      </el-form>
    </div>
  </div>
</template>

<script>

  import { getTaskBackNode, sendBackTask } from "@/api/workFlow.js"
  import { popupCacel } from "@/utils/popup.js";

  export default {
    props: {
      formData: {
        type: Object,
        default: {},
      },
    },
    data () {
      return {
        selectActivity: "",
        dataList: [],
        outstepopinion: "",
        selectItem: {},
      };
    },
    created () {
      this.getBackNode();
    },
    methods: {
      /**
       * @description: onSubmit
       * @author: renchao
       */
      onSubmit () {
        if (!this.outstepopinion) {
          this.$message.error("请填写退回意见");
        } else {
          sendBackTask({
            bsmSlsq: this.formData.bsmSlsq,
            backNodeList: [this.selectItem],
            message: this.outstepopinion
          }).then((res) => {
            if (res.code == 200) {
              this.$message.success("退回成功");
              setTimeout(() => {
                if (window.opener && window.opener.getBpageList) {
                  window.opener.getBpageList();
                } else {
                  window.opener.frames[0].getBpageList();
                }
                window.close();
                this.$emit("input", false);
              }, 1000);
            } else {
              this.$message.error(res.message);
            }
          });
        }
      },
      /**
       * @description: changeSelectItem
       * @param {*} item
       * @author: renchao
       */
      changeSelectItem (item) {
        this.selectItem = item;
        this.selectActivity = item.activityId;
      },
      //获取可回退环节信息
      /**
       * @description: 获取可回退环节信息
       * @author: renchao
       */
      getBackNode () {
        getTaskBackNode(this.formData).then((res) => {
          if (res.code == 200) {
            this.dataList = res.result;
            console.log("this.dataList", this.dataList);
            if (res.result) {
              this.selectActivity = res.result[0].activityId;
              this.selectItem = res.result[0];
            }
          }
        });
      },

      /**
       * @description: cancelBack
       * @author: renchao
       */
      cancelBack () {
        popupCacel();
      }
    }
  }
</script>
<style scoped lang="scss">
  @import "~@/styles/mixin.scss";

  .listDetail {
    display: flex;
    align-items: center;
    width: 100%;

    p {
      line-height: 30px;
      height: 30px;
      @include flex-center;
      flex: 1;
      width: 100%;
      border: 1px solid rgb(233, 235, 237);
      margin-top: -1px;
      margin-left: -1px;
    }

    .icon {
      flex: 0 0 60px;
    }
  }

  .title {
    margin-bottom: 10px;
  }

  .textArea {
    /deep/.el-textarea__inner {
      min-height: 90px !important;
    }
  }
  /deep/.el-radio .el-radio__label {
    display: none;
  }
</style>