Blame view

src/views/workflow/mixin/index.js 11 KB
1
/*
xiaomiao committed
2
 * @Description:
3
 * @Autor: renchao
4
 * @LastEditTime: 2023-07-24 14:14:22
5
 */
6
import { getPrintTemplateByCode } from "@/api/print";
7
import { uploadUndo } from "@/api/clxx";
蔡俊立 committed
8
import { getLodop } from "@/utils/LodopFuncs"
任超 committed
9 10 11
import {
  stepExpandInfo,
  record,
任超 committed
12
  completeTask,
任超 committed
13
  getNextLinkInfo,
14 15 16 17 18
  getWorkFlowImage,
  getPrintApplicationInfo,
  deleteFlow,
  unClaimTask
} from "@/api/workFlow.js";
xiaomiao committed
19
import { mapGetters } from 'vuex'
20
import { getZrzbsmList } from "@/api/search.js";
21
import { ywPopupDialog } from "@/utils/popup.js";
任超 committed
22
export default {
23
  data () {
任超 committed
24 25 26 27 28 29 30 31 32 33 34 35 36
    return {
      //是否开启材料分屏
      splitScreen: false,
      //设置表单组件是否刷选值
      fresh: 10,
      //左侧菜单数据集合
      unitData: [],
      //顶部左侧按钮集合
      leftButtonList: [],
      //顶部右侧按钮集合
      rightButtonList: [],
      //批量按钮名称
      batchButtonName: '',
37
      // 受理申请信息
xiaomiao committed
38 39
      slsq: {},
      dqhj:""
任超 committed
40 41
    }
  },
42
  mounted () {
任超 committed
43 44 45 46
    this.flowInitParam();
  },
  methods: {
    //加载流程初始参数
yuanbo committed
47 48 49 50
    /**
     * @description: 加载流程初始参数
     * @author: renchao
     */
51
    flowInitParam () {
任超 committed
52 53 54
      var formdata = new FormData();
      formdata.append("bsmSlsq", this.bsmSlsq);
      formdata.append("bestepid", this.bestepid);
55 56 57
      if (this.type) {
        formdata.append("type", "READ_ONLY");
      }
任超 committed
58 59 60
      stepExpandInfo(formdata).then((res) => {
        if (res.code === 200) {
          this.leftButtonList = res.result.button;
xiaomiao committed
61 62 63
          if (res.result.properties&&res.result.properties.length) {
            this.dqhj = res.result.properties[0].value
          }
任超 committed
64
          this.rightButtonList = res.result.operation;
65
          this.slsq = res.result.slsq
任超 committed
66
        }
67
      })
任超 committed
68 69
    },
    //流程环节操作按钮
yuanbo committed
70 71 72 73 74
    /**
     * @description: 流程环节操作按钮
     * @param {*} item
     * @author: renchao
     */
75
    operation (item) {
任超 committed
76 77 78 79 80
      //按钮 B0:选择不动产单元 B1:流程图 B2:材料分屏 B3:材料导入 B4:登记簿 B5:证书预览 B6:打印申请书 B7:证书领取 B8:楼盘表 B9:登簿
      //操作按钮 登簿:record  转件:transfer  退回:back  退出:signout
      let that = this;
      switch (item.value) {
        case "B0":
81
          // this.openDialog()
82
          this.$alert('此功能正在开发', '提示', {
83 84
            confirmButtonText: '确定',
          })
任超 committed
85 86 87 88
          break;
        case "B1":
          getWorkFlowImage(this.bsmSlsq, this.$route.query.bestepid).then(res => {
            let { result } = res
89
            this.$popupDialog("流程图", "workflow/components/processViewer", {
任超 committed
90 91
              xml: result.xml,
              finishedInfo: {
xiaomiao committed
92 93 94 95
                finishedTaskSet: result.finishedActivityIds,
                unfinishedTaskSet: result.runningActivityIds,
                rejectedTaskSet: {},
                finishedSequenceFlowSet: result.finishedSequenceFlowIds
任超 committed
96
              },
97
              handlinglist: result.runningTasks,
xiaomiao committed
98
              allCommentList: result.finishedTasks
99
            }, '80%', true)
任超 committed
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
          })
          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);
          }
          break;
118 119
        case "B3": //材料导入
          document.getElementById("cldr").click();
120
          break;
任超 committed
121
        case "B4":
122
          this.$popupDialog("登记簿详情", "registerBook/djbFrame", this.currentSelectProps, '80%', true)
任超 committed
123 124
          break;
        case "B5":
125
          this.$popupDialog("证书预览", "workflow/components/dialog/zsyl", {
任超 committed
126 127
            bsmSlsq: this.bsmSlsq,
            entryType: '1'
128
          }, '1210px', true)
任超 committed
129
          break;
蔡俊立 committed
130
        case "B6":
蔡俊立 committed
131
          //根据编号获取对应信息
132 133
          getPrintTemplateByCode({ tmpno: 'dysqs' }).then(res => {
            if (res.code == 200) {
蔡俊立 committed
134
              getPrintApplicationInfo(this.currentSelectProps).then(infoRes => {
135
                if (infoRes.code == 200) {
蔡俊立 committed
136
                  //打开模板设计
137 138
                  let LODOP = getLodop(document.getElementById('LODOP_OB'), document.getElementById('LODOP_EM'));
                  LODOP.ADD_PRINT_DATA("ProgramData", res.result.tmpcontent); //装载模板
蔡俊立 committed
139
                  //todo 调取后端接口获取数据 循环set
140 141
                  for (let key in infoRes.result) {
                    LODOP.SET_PRINT_STYLEA(key, "CONTENT", infoRes.result[key]);
蔡俊立 committed
142
                  }
143 144
                  LODOP.PREVIEW();
                } else {
蔡俊立 committed
145 146
                  this.$message.error(infoRes.message)
                }
147 148
              })
            } else {
蔡俊立 committed
149 150 151
              this.$message.error(res.message)
            }
          })
152
          break;
任超 committed
153
        case "B7":
154 155
          this.$popupDialog("证书领取", "workflow/components/dialog/zslq",
            { bsmSlsq: this.$route.query.bsmSlsq }, '70%', true
156
          )
任超 committed
157
          break;
158
        case "B8":
159
          getZrzbsmList(this.bsmSlsq).then((res) => {
yangwei committed
160 161
            if (res.code === 200) {
              this.$popupDialog('楼盘表', 'lpb/index', {
yangwei committed
162 163 164
                bsm: res.result[0],
                onlyShow:false,
                unitData:window.unitData
yangwei committed
165
              }, '90%', true)
166
            } else {
yangwei committed
167 168 169
              this.$message.error(res.message)
            }
          })
170
            .catch((err) => {
yangwei committed
171
              this.$message.error(err)
172
            });
173
          break;
174 175
        // 图形定位
        case "B-TXDW":
176
          this.$popupDialog('图形定位', 'workflow/components/dialog/txdw', {}, '60%', true)
177
          break;
任超 committed
178
        case "back": //退回按钮
179
          this.$popupDialog("退回", "workflow/components/th", {
180 181
            bsmSlsq: this.bsmSlsq,
            bestepid: this.bestepid
182
          }, '800px', true)
任超 committed
183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198
          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": //终止按钮
199
          this.$popupDialog("终止", "workflow/components/stop", {
任超 committed
200 201
            bsmSlsq: this.bsmSlsq,
            bestepid: this.bestepid,
202
          }, '600px', true)
任超 committed
203 204 205 206 207 208 209 210 211 212 213
          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("请确认是否登簿", "提示", {
214
            iconClass: "el-icon-info", //自定义图标样式
任超 committed
215 216 217 218 219 220 221 222
            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) {
223 224 225 226
                  console.log(res.result, 'res.result');
                  res.result[0].state ? that.$message({
                    message: '登簿成功',
                    type: 'success'
227
                  }) : ywPopupDialog("登簿错误明细", "workflow/components/dialog/dblist", { result: res.result }, '30%', true)
任超 committed
228 229
                }
                else {
230
                  ywPopupDialog("登簿错误明细", "workflow/components/dialog/dblist", { result: res.result }, '30%', true)
任超 committed
231 232
                }
              } else {
233
                that.$message.error(res.message)
任超 committed
234
              }
235 236
            })
          })
任超 committed
237
          break;
赵千 committed
238 239
        case "rm":
          this.del()
240
          break;
任超 committed
241 242
      }
    },
yuanbo committed
243 244 245 246
    /**
     * @description: del
     * @author: renchao
     */
赵千 committed
247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262
    del () {
      let formdata = new FormData();
      formdata.append("bsmSlsq", this.bsmSlsq);
      this.$confirm("确定要删除吗, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          deleteFlow(formdata).then((res) => {
            if (res.code === 200) {
              this.$message({
                type: "success",
                message: "删除成功!",
              });
              window.close();
263
              window.opener.getBpageList();
赵千 committed
264 265 266 267 268 269 270 271 272 273 274 275
            } else {
              this.$message.error(res.message);
            }
          });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除",
          });
        });
    },
xiaomiao committed
276
      //发送下一个环节
yuanbo committed
277 278 279 280 281
    /**
     * @description: 发送下一个环节
     * @param {*} obj
     * @author: renchao
     */
xiaomiao committed
282 283 284 285 286 287
     sendToNext (obj) {
      this.$popupDialog("转出", "djbworkflow/components/zc", {
        obj:obj,
        bsmSlsq: this.bsmSlsq,
        tabList: this.tabList
      }, '800px', true)
任超 committed
288
    },
xiaomiao committed
289
    //转出最后一个流程
yuanbo committed
290
    /**
xiaomiao committed
291
     * @description: 转出最后一个流程
xiaomiao committed
292
     * @param {*} obj
yuanbo committed
293 294
     * @author: renchao
     */
xiaomiao committed
295
     sendToEnd (obj) {
xiaomiao committed
296 297 298 299 300
      this.$popupDialog("转出", "djbworkflow/components/zc", {
        obj:"",
        bsmSlsq: this.bsmSlsq,
        tabList: this.tabList
      }, '800px', true)
蔡俊立 committed
301 302
    },
    //批量操作
yuanbo committed
303 304 305 306
    /**
     * @description: 批量操作
     * @author: renchao
     */
307
    handleBatchDel () {
xiaomiao committed
308
      this.$popupDialog("批量删除", "workflow/components/batchDel", {
蔡俊立 committed
309
        width: "50%",
xiaomiao committed
310 311 312 313
        btnShow: false,
        bsmSlsq: this.bsmSlsq,
        dataList: this.unitData,

蔡俊立 committed
314
      })
315
    },
yuanbo committed
316 317 318 319 320
    /**
     * @description: handleChange
     * @param {*} file
     * @author: renchao
     */
321
    handleChange (file) {
322 323 324 325 326
      var formdata = new FormData();
      formdata.append("file", file.raw);
      formdata.append("bsmSldy", this.currentSelectProps.bsmSldy);
      formdata.append("bsmSlsq", this.bsmSlsq);
      uploadUndo(formdata).then(res => {
327
        if (res.code == 200) {
328
          this.$message.success("导入成功");
329
        } else {
330 331 332
          this.$message.error(res.message)
        }
      })
333
    },
334
    // 上传
yuanbo committed
335 336 337 338 339
    /**
     * @description: 上传
     * @param {*} file
     * @author: renchao
     */
340
    beforeUpload (file) {
341
      return true;
342
    }
任超 committed
343 344
  }
}