基于若依的ruoyi-nbcio流程管理系统增加仿钉钉流程设计(五)

简介: 基于若依的ruoyi-nbcio流程管理系统增加仿钉钉流程设计(五)

更多ruoyi-nbcio功能请看演示系统

gitee源代码地址

前后端代码: https://gitee.com/nbacheng/ruoyi-nbcio

演示地址:RuoYi-Nbcio后台管理系统

     今天这部分主要是增加json与xml的浏览功能,目前暂时只支持json的格式,以后增加转换成flowable流程的xml格式。

   1、增加浏览页面

<el-dialog title="预览" width="60%" :visible.sync="previewModelVisible" append-to-body destroy-on-close>
      <highlightjs :language="previewType" :code="previewResult" style="height: 60vh" />
    </el-dialog>

2、增加的方法如下:

preview() {
      const getCmpData = name => this.$refs[name].getData()
      // processDesign 返回的是Promise 因为要做校验
      console.log("publish getCmpData",getCmpData)
      const p3 = getCmpData('processDesign')
      console.log("publish p3",p3)
      Promise.all([p3])
      .then(res => {
        const param = {
          processData: res[0].formData
        }
        this.previewResult = JSON.stringify(param, null, 2);//json格式化
        this.previewType = "json";
        this.previewModelVisible = true;
      })
      .catch(err => {
        err.target && (this.activeStep = err.target)
        err.msg && this.$message.warning(err.msg)
      })
    },

3、完整的代码如下:

<template>
  <div class="page">
    <section class="page__content" v-if="mockData">
      <Process
        ref="processDesign"
        :conf="mockData.processData"
        tabName="processDesign"
        @startNodeChange="onStartChange"/>
    </section>
    <div class="publish">
      <el-button size="mini" type="primary" @click="preview"><i class="el-icon-view"></i>预览</el-button>
      <el-button size="mini" type="primary" @click="publish"><i class="el-icon-s-promotion"></i>发布</el-button>
    </div>
    <el-dialog title="预览" width="60%" :visible.sync="previewModelVisible" append-to-body destroy-on-close>
      <highlightjs :language="previewType" :code="previewResult" style="height: 60vh" />
    </el-dialog>
  </div>
</template>
<script>
// @ is an alias to /src
import Vue from 'vue';
import Process from "./components/Process";
import { GET_MOCK_CONF } from '@/api/workflow/imdd'
import { vuePlugin } from '@/plugins/package/highlight';
import 'highlight.js/styles/atom-one-dark-reasonable.css';
Vue.use(vuePlugin);
const beforeUnload = function (e) {
  var confirmationMessage = '离开网站可能会丢失您编辑得内容';
  (e || window.event).returnValue = confirmationMessage;     // Gecko and Trident
  return confirmationMessage;                                // Gecko and WebKit
}
export default {
  name: "Home",
  props: {
    title: {
      type: String,
      default: '补卡申请'
    }
  },
  data() {
    return {
      mockData: null, // 可选择诸如 $route.param,Ajax获取数据等方式自行注入
      previewModelVisible: false,
      activeStep: "processDesign", // 激活的步骤面板
      previewResult: "",
      previewType: "xml",
      steps: [
        { label: "流程设计", key: "processDesign" }
      ]
    };
  },
  beforeRouteEnter(to, from, next){
    window.addEventListener('beforeunload', beforeUnload)
    next()
  },
  beforeRouteLeave(to, from, next){
    window.removeEventListener('beforeunload', beforeUnload)
    next()
  },
  computed:{
    translateX () {
      return `translateX(${this.steps.findIndex(t => t.key === this.activeStep) * 100}%)`
    }
  },
  mounted() {
    GET_MOCK_CONF().then(data => this.mockData = data);
  },
  methods: {
    changeSteps(item) {
      this.activeStep = item.key;
    },
    preview() {
      const getCmpData = name => this.$refs[name].getData()
      // processDesign 返回的是Promise 因为要做校验
      console.log("publish getCmpData",getCmpData)
      const p3 = getCmpData('processDesign')
      console.log("publish p3",p3)
      Promise.all([p3])
      .then(res => {
        const param = {
          processData: res[0].formData
        }
        this.previewResult = JSON.stringify(param, null, 2);//json格式化
        this.previewType = "json";
        this.previewModelVisible = true;
      })
      .catch(err => {
        err.target && (this.activeStep = err.target)
        err.msg && this.$message.warning(err.msg)
      })
    },
    publish() {
      const getCmpData = name => this.$refs[name].getData()
      // processDesign 返回的是Promise 因为要做校验
      console.log("publish getCmpData",getCmpData)
      const p3 = getCmpData('processDesign')
      console.log("publish p3",p3)
      Promise.all([p3])
      .then(res => {
        const param = {
          processData: res[0].formData
        }
        this.sendToServer(param)
      })
      .catch(err => {
        err.target && (this.activeStep = err.target)
        err.msg && this.$message.warning(err.msg)
      })
    },
    sendToServer(param){
      this.$notify({
        title: '数据已整合完成',
        message: '请在控制台中查看数据输出',
        position: 'bottom-right'
      });
      console.log('配置数据', param)
    },
    exit() {
      this.$confirm('离开此页面您得修改将会丢失, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.$message({
            type: 'success',
            message: '模拟返回!'
          });
        }).catch(() => { });
    },
    /**
     * 同步基础设置发起人和流程节点发起人
     */
    onInitiatorChange (val, labels) {
      const processCmp = this.$refs.processDesign
      const startNode = processCmp.data
      startNode.properties.initiator = val['dep&user']
      startNode.content =  labels  || '所有人'
      processCmp.forceUpdate()
    },
    /**
     * 监听 流程节点发起人改变 并同步到基础设置 发起人数据
     */
    onStartChange(node){
      const basicSetting = this.$refs.basicSetting
      basicSetting.formData.initiator = { 'dep&user': node.properties.initiator }
    }
  },
  components: {
    Process,
  }
};
</script>
<style lang="stylus" scoped>
.publish {
    position: absolute;
    top: 15px;
    right: 20px;
    z-index: 1000;
    i {
      margin-right: 6px;
    }
    button {
      border-radius: 15px;
    }
  }
</style>

4、效果图如下:

相关文章
|
5月前
|
XML JSON 前端开发
基于若依的ruoyi-nbcio流程管理系统仿钉钉流程json转bpmn的flowable的xml格式(支持并行网关)
基于若依的ruoyi-nbcio流程管理系统仿钉钉流程json转bpmn的flowable的xml格式(支持并行网关)
254 3
|
2月前
|
存储 安全 API
"解锁企业级黑科技!用阿里云视觉智能打造钉钉级人脸打卡系统,安全高效,让考勤管理秒变智能范儿!"
【8月更文挑战第14天】随着数字化办公的发展,人脸打卡成为企业考勤的新标准。利用阿里云视觉智能开放平台构建类似钉钉的人脸打卡系统,其关键在于:高精度人脸识别API支持复杂场景下的快速检测与比对;活体检测技术防止非生物特征欺骗,确保安全性;云端存储与计算能力满足大数据处理需求;丰富的SDK与API简化集成过程,实现高效、安全的考勤管理。
60 2
|
2月前
|
XML 算法 API
访问者模式问题之钉钉审批流程配置为什么适合使用访问者模式
访问者模式问题之钉钉审批流程配置为什么适合使用访问者模式
|
4月前
|
人工智能 移动开发 IDE
安利几款与钉钉平台无缝集成打通账号认证的企业文档管理系统
钉钉是很多中小企业都爱用的产品,开通账号就能直接使用了,应用生态非常丰富,尤其是AI技术的应用,走在行业前列。但仍有很多企业对于全面拥抱SaaS服务充满了顾虑,尤其在内部资料的管理这块,即使钉钉在线文档已经提供了非常优秀的协作体验,不少客户仍更偏爱私有部署在局域网里面的企业文档管理系统。那么能将企业内部部署的文档管理系统集成到钉钉平台上面,和钉钉文档并行使用呢?市面上又有哪些企业文档管理系统软件支持与钉钉的集成呢?这也是很多企业客户的疑问。
安利几款与钉钉平台无缝集成打通账号认证的企业文档管理系统
|
5月前
|
XML 移动开发 前端开发
基于若依的ruoyi-nbcio流程管理系统里修正仿钉钉流程部门主管与多实例转xml的bug
基于若依的ruoyi-nbcio流程管理系统里修正仿钉钉流程部门主管与多实例转xml的bug
40 1
|
5月前
|
前端开发
基于若依的ruoyi-nbcio流程管理系统仿钉钉流程初步完成转bpmn设计(还有bug,以后再修改)
基于若依的ruoyi-nbcio流程管理系统仿钉钉流程初步完成转bpmn设计(还有bug,以后再修改)
71 0
|
存储 弹性计算 安全
成功案例-钉钉 | 学习笔记
快速学习 成功案例-钉钉
384 0
|
移动开发 物联网 Go
SAP Business ByDesign 和支付宝与钉钉集成的一个原型开发案例
SAP Business ByDesign 和支付宝与钉钉集成的一个原型开发案例
SAP Business ByDesign 和支付宝与钉钉集成的一个原型开发案例
|
移动开发 物联网 智能硬件
SAP Business ByDesign 和支付宝与钉钉集成的一个原型开发案例
SAP Business ByDesign 和支付宝与钉钉集成的一个原型开发案例
246 0
SAP Business ByDesign 和支付宝与钉钉集成的一个原型开发案例

热门文章

最新文章

下一篇
无影云桌面