index.js 12.6 KB
/*
 * @Description:workFramezu.vue组件的方法  头部按钮弹框方法
 * @Autor: miaofang
 * @LastEditTime: 2023-07-31 10:03:23
 */
import { getPrintTemplateByCode } from "@/api/print";
import { getQllxByBdcdyid } from "@/api/djbDetail.js";
import { uploadUndo } from "@/api/clxx";
import { deleteFlow } from "@/api/djbRepair";
import { getLodop } from "@/utils/LodopFuncs"
import {
  stepExpandInfo,
  record,
  completeTask,
  getNextLinkInfo,
  getWorkFlowImage,
  getPrintApplicationInfo,
  unClaimTask
} from "@/api/workFlow.js";
export default {
  data () {
    return {
      //是否开启材料分屏
      splitScreen: false,
      //设置表单组件是否刷选值
      fresh: 10,
      //左侧菜单数据集合
      unitData: [],
      //顶部左侧按钮集合
      leftButtonList: [],
      //顶部右侧按钮集合
      rightButtonList: [],
      //批量按钮名称
      batchButtonName: '',
      // 受理申请信息
      slsq: {},
      ableOperation: true,
      showidea: false

    }
  },
  mounted () {
    this.flowInitParam();
  },
  methods: {
    //加载流程初始参数
    /**
     * @description: 加载流程初始参数
     * @author: renchao
     */
    flowInitParam () {
      var formdata = new FormData();

      formdata.append("bsmSlsq", this.bsmSlsq);
      formdata.append("bestepid", this.bestepid);
      if (this.type) {
        formdata.append("type", "READ_ONLY");
      }
      stepExpandInfo(formdata).then((res) => {
        if (res.code === 200) {
          this.leftButtonList = res.result.button;
          if (res.result.properties && res.result.properties.length) {
            this.showidea = res.result.properties[0].value
          }

          this.rightButtonList = res.result.operation;
          let arr = this.rightButtonList.filter((item) => {
            return item.name == "删除"
          })
          this.$refs.Menu.getleftMenubl();
          if (!arr.length) {
            this.isEdit = false
          }
        }
      })
    },
    //流程环节操作按钮
    /**
     * @description: 流程环节操作按钮
     * @param {*} item
     * @author: renchao
     */
    operation (item) {
      //按钮 B0:选择不动产单元 B1:流程图 B2:材料分屏 B3:材料导入 B4:登记簿 B5:证书预览 B6:打印申请书 B7:证书领取 B8:楼盘表 B9:登簿
      //操作按钮 登簿:record  转件:transfer  退回:back  退出:signout
      let that = this;
      switch (item.value) {
        case "B0":
          // this.openDialog()
          this.$alert('此功能正在开发', '提示', {
            confirmButtonText: '确定',
          })
          break;
        case "B1":
          getWorkFlowImage(this.bsmSlsq, this.$route.query.bestepid).then(res => {
            let { result } = res
            this.$popupDialog("流程图", "workflow/components/processViewer", {
              xml: result.xml,
              finishedInfo: {
                finishedTaskSet: result.finishedActivityIds,
                unfinishedTaskSet: result.runningActivityIds,
                rejectedTaskSet: {},
                finishedSequenceFlowSet: result.finishedSequenceFlowIds
              },
              handlinglist: result.runningTasks,
              allCommentList: result.finishedTasks
            }, '80%', true)
          })
          break;
        case "B2": //材料分屏按钮
          this.splitScreen = this.splitScreen ? false : true;
          this.$store.dispatch("app/settScreen", this.splitScreen);
          if (this.splitScreen) {

            //如果当前选项卡为材料信息内容,递减到上一个选项卡内容
            if (this.tabName == this.clxxTab.value) {
              this.tabName = this.tabList[this.clxxIndex - 1].value;
              this.getFromRouter(this.tabList[this.clxxIndex - 1].value);
            }
            //删除材料信息选项卡数据
            this.tabList.splice(this.clxxIndex, 1);
          } else {
            //新增材料信息选项卡数据
            this.tabList.splice(this.clxxIndex, 0, this.clxxTab);
          }
          // this.closefp()

          // if (this.splitScreen) {
          //   //如果当前选项卡为材料信息内容,递减到上一个选项卡内容
          //   if (this.tabName == this.clxxTab.value) {
          //     this.tabName = this.tabList[0].value;
          //     this.getFromRouter(this.tabList[0].value);
          //   }
          // }
          break;
        case "B3": //材料导入
          document.getElementById("cldr").click();
          break;
        case "B4":
          this.$popupDialog("登记簿详情", "registerBook/djbFrame", this.currentSelectProps, '80%', true)
          break;
        // case "B5":
        //   const h = this.$createElement;
        //   this.$msgbox({
        //     title: '请选择新增权利类型',
        //     message: h('p', null, [
        //       h('span', null, '内容可以是 '),
        //       h('el-button', { style: 'color: teal' }, 'VNode'),
        //       h('i', { style: 'color: teal' }, 'VNode')
        //     ]),
        //     showCancelButton: true,
        //     confirmButtonText: '确定',
        //     cancelButtonText: '取消',
        //     beforeClose: (action, instance, done) => {
        //       if (action === 'confirm') {
        //         instance.confirmButtonLoading = true;
        //         instance.confirmButtonText = '执行中...';
        //         setTimeout(() => {
        //           done();
        //           setTimeout(() => {
        //             instance.confirmButtonLoading = false;
        //           }, 300);
        //         }, 3000);
        //       } else {
        //         done();
        //       }
        //     }
        //   }).then(action => {
        //     this.addRepairRecord()
        //     this.$message({
        //       type: 'info',
        //       message: 'action: ' + action
        //     });
        //   });

        //   break;
        case "B5":
          if (this.currentSelectProps.bdcdyid) {
            getQllxByBdcdyid({ bdcdyid: this.currentSelectProps.bdcdyid }).then(
              (res) => {
                if (res.code === 200) {
                  this.$refs.qllxlist.qllxlistdata = res.result;
                  this.$refs.qllxlist.dialogVisible = true;
                }
              }
            );
          }
          // this.$refs.Menu.loadBdcdylist("add")
          // this.$popupDialog("选择新增权力类型", "djbworkflow/djbBook/components/qllxcloseDailog", this.currentSelectProps, '50%', true)


          break;
        case "B6":
          //根据编号获取对应信息
          getPrintTemplateByCode({ tmpno: 'dysqs' }).then(res => {
            if (res.code == 200) {
              getPrintApplicationInfo(this.currentSelectProps).then(infoRes => {
                if (infoRes.code == 200) {
                  //打开模板设计
                  let LODOP = getLodop(document.getElementById('LODOP_OB'), document.getElementById('LODOP_EM'));
                  LODOP.ADD_PRINT_DATA("ProgramData", res.result.tmpcontent); //装载模板
                  //todo 调取后端接口获取数据 循环set
                  for (let key in infoRes.result) {
                    LODOP.SET_PRINT_STYLEA(key, "CONTENT", infoRes.result[key]);
                  }
                  LODOP.PREVIEW();
                } else {
                  this.$message.error(infoRes.message)
                }
              })
            } else {
              this.$message.error(res.message)
            }
          })
          break;
        case "B7":
          this.$popupDialog("证书领取", "workflow/components/dialog/zslq",
            { bsmSlsq: this.$route.query.bsmSlsq }, '70%', true
          )
          break;
        case "B8":
          this.$popupDialog('楼盘表', 'lpb/index', {
            bsm: ''
          }, '90%', true)
          break;
        case "back": //退回按钮
          this.$popupDialog("退回", "workflow/components/th", {
            bsmSlsq: this.bsmSlsq,
            bestepid: this.bestepid
          }, '800px', true)
          break;
        case "transfer": //转件按钮
          getNextLinkInfo({
            bsmSlsq: this.bsmSlsq,
            bestepid: this.bestepid,
          }).then((res) => {
            if (res.code === 200) {
              if (res.result) {
                this.sendToNext(res.result);
              } else {
                this.sendToEnd();
              }
            }
          });
          break;
        case "stop": //终止按钮
          this.$popupDialog("终止", "workflow/components/stop", {
            bsmSlsq: this.bsmSlsq,
            bestepid: this.bestepid,
          }, '600px', true)
          break;
        case "signout":
          window.close();
          //取消认领
          unClaimTask(this.bsmSlsq, this.bestepid)
          break;
        case "B9":
          var formdata = new FormData();
          formdata.append("bsmSlsq", this.bsmSlsq);
          formdata.append("bestepid", this.bestepid);
          this.$confirm("请确认是否登簿", "提示", {
            iconClass: "el-icon-question", //自定义图标样式
            confirmButtonText: "确认", //确认按钮文字更换
            cancelButtonText: "取消", //取消按钮文字更换
            showClose: true, //是否显示右上角关闭按钮
            type: "warning", //提示类型  success/info/warning/error
          }).then(function () {
            record(formdata).then((res) => {
              if (res.code === 200) {
                if (res.result.length === 1) {
                  res.result[0].state ? that.$alert("登簿成功!") : that.$alert(res.result[0].msg);;
                }
                else {
                  that.$alert('<div>' + res.result[0].ywh + ',' + res.result[0].msg + '</div>', '登簿明细', {
                    dangerouslyUseHTMLString: true
                  });
                }
              } else {
                that.$alert(res.message);
              }
            });
          });
          break;
        case "rm":
          this.del()
          break;
      }
    },
    /**
     * @description: del
     * @author: renchao
     */
    del () {
      let formdata = new FormData();
      formdata.append("bsmSlsq", this.bsmSlsq);
      this.$confirm("确定要删除吗, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          deleteFlow(this.bsmSlsq).then((res) => {
            if (res.code === 200) {
              this.$message({
                type: "success",
                message: "删除成功!",
              });
              window.close();
              window.opener.getBpageList();
            } else {
              this.$message.error(res.message);
            }
          });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除",
          });
        });
    },
    //发送下一个环节
    /**
     * @description: 发送下一个环节
     * @param {*} obj
     * @author: renchao
     */
    sendToNext (obj) {
      this.$popupDialog("转出", "djbworkflow/components/zc", {
        obj: obj,
        bsmSlsq: this.bsmSlsq,
        tabList: this.tabList,
        tshowidea: this.showidea
      }, '600px', true)
    },
    //转出最后一个流程
    /**
     * @description: 转出最后一个流程
     * @author: renchao
     */
    sendToEnd () {
      this.$popupDialog("转出", "djbworkflow/components/zc", {
        obj: "",
        bsmSlsq: this.bsmSlsq,
        tabList: this.tabList,
        showidea: this.showidea

      }, '600px', true)
    },

    //批量操作
    /**
     * @description: 批量操作
     * @author: renchao
     */
    handleBatchDel () {
      this.$popupDialog("批量删除", "workflow/components/batchDel", {
        width: "50%",
        btnShow: false,
        bsmSlsq: this.bsmSlsq,
        dataList: this.unitData,

      })
    },
    /**
     * @description: handleChange
     * @param {*} file
     * @author: renchao
     */
    handleChange (file) {
      var formdata = new FormData();
      formdata.append("file", file.raw);
      formdata.append("bsmSldy", this.currentSelectProps.bsmSldy);
      formdata.append("bsmSlsq", this.bsmSlsq);
      uploadUndo(formdata).then(res => {
        if (res.code == 200) {
          this.$message.success("导入成功");
        } else {
          this.$message.error(res.message)
        }
      })
    },
    // 上传
    /**
     * @description: 上传
     * @param {*} file
     * @author: renchao
     */
    beforeUpload (file) {
      return true;
    }
  }
}