ruoyi-nbcio-plus基于vue3的flowable的自定义业务撤回申请组件的升级修改

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

gitee源代码地址

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

演示地址:RuoYi-Nbcio后台管理系统 http://122.227.135.243:9666/

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

gitee源代码地址

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

前端代码:https://gitee.com/nbacheng/nbcio-vue.git

在线演示(包括H5) : http://122.227.135.243:9888

1、原先vue2的ActCancelBtn.vue代码如下:

javascript 复制代码
<style lang="less">
</style>
<template>
  <span>
      <a-button :type="btnType" @click="cancel()" >{{text}}</a-button>
      <a-modal title="确认撤回" v-model="modalCancelVisible" :mask-closable="false" :width="500">
            <a-form ref="delForm" v-model="cancelForm" :label-width="70" v-if="modalCancelVisible">
                <a-form-item label="撤回原因" prop="reason">
                    <a-input type="textarea" v-model="cancelForm.reason" :rows="4" />
                </a-form-item>
            </a-form>
            <div slot="footer">
                <a-button type="text" @click="modalCancelVisible = false">取消</a-button>
                <a-button type="primary" :disabled="submitLoading" @click="handelSubmitCancel">提交</a-button>
            </div>
        </a-modal>
  </span>
</template>

<script>
import {deleteByDataId} from "@/api/workflow/process";

export default {
    name: 'ActCancelBtn',
    components: {},
    props: {
        btnType: { type: String, default: 'link', required: false },
        /**/
        dataId: {
            type: String,
            default: '',
            required: true
        },
        instanceId: {
            type: String,
            default: '',
            required: false
        },
        text: {
            type: String,
            default: '撤回',
            required: false
        }
    },
    data() {
        return {
            modalCancelVisible: false,
            cancelForm: {
                reason: ''
            },
            submitLoading: false,
        };
    },
    created() {
    },
    watch: {
    },
    methods: {
        cancel() {
            this.modalCancelVisible = true;
        },
        handelSubmitCancel() {
            this.submitLoading = true;
          deleteByDataId(this.instanceId, this.cancelForm.reason,this.dataId)
                .then(res => {
                    if (res.success) {
                        this.$message.success('操作成功');
                        this.modalCancelVisible = false;
                        this.$emit('success');
                    } else {
                        this.$message.error(res.message);
                    }
                })
                .finally(() => (this.submitLoading = false));
        }
    }

};
</script>

2、升级到vue3的代码如下:

javascript 复制代码
<template>
  <span>
      <a-button :type="btnType" @click="cancel()" >{{text}}</a-button>
      <a-modal title="确认撤回" v-model="modalCancelVisible" :mask-closable="false" :width="500">
            <a-form ref="delForm" v-model="cancelForm" :label-width="70" v-if="modalCancelVisible">
                <a-form-item label="撤回原因" prop="reason">
                    <a-input type="textarea" v-model="cancelForm.reason" :rows="4" />
                </a-form-item>
            </a-form>
            <div slot="footer">
                <a-button type="primary" @click="modalCancelVisible = false">取消</a-button>
                <a-button type="primary" :disabled="submitLoading" @click="handelSubmitCancel">提交</a-button>
            </div>
        </a-modal>
  </span>
</template>

<script setup lang="ts">
  import {deleteByDataId} from "@/api/workflow/process";

  defineOptions({ name: 'ActCancelBtn' })
  const props = defineProps({
    btnType: {
      type: String,
      default: 'link',
      required: false ,
    },
    dataId: {
        type: String,
        default: '',
        required: true
    },
    instanceId: {
        type: String,
        default: '',
        required: false
    },
    text: {
        type: String,
        default: '撤回',
        required: false
    }
  })

  const emit = defineEmits([
    'success'
  ])
  const { proxy } = getCurrentInstance() as ComponentInternalInstance;
  const modalCancelVisible = ref(false)
  const cancelForm = ref({
      reason: ''
  })
  const submitLoading = ref(false)

  const cancel = () => {
    modalCancelVisible.value = true;
  }
  const handelSubmitCancel = () => {
    submitLoading.value = true;
    deleteByDataId(props.instanceId, cancelForm.value.reason,props.dataId)
      .then(res => {
          if (res.success) {
              proxy?.$modal.msgSuccess('操作成功');
              modalCancelVisible.value = false;
              emit('success');
          } else {
              proxy?.$modal.msgError(res.message);
          }
      })
      .finally(() => (submitLoading.value = false));
  }
</script>

3、目前这个组件按钮被注释掉,暂时也不用,需要的时候也可以用

相关推荐
科技探秘人几秒前
Chrome与傲游浏览器性能与功能的深度对比
前端·chrome
JerryXZR6 分钟前
前端开发中ES6的技术细节二
前端·javascript·es6
七星静香8 分钟前
laravel chunkById 分块查询 使用时的问题
java·前端·laravel
q24985969310 分钟前
前端预览word、excel、ppt
前端·word·excel
小华同学ai16 分钟前
wflow-web:开源啦 ,高仿钉钉、飞书、企业微信的审批流程设计器,轻松打造属于你的工作流设计器
前端·钉钉·飞书
Gavin_91525 分钟前
【JavaScript】模块化开发
前端·javascript·vue.js
懒大王爱吃狼1 小时前
Python教程:python枚举类定义和使用
开发语言·前端·javascript·python·python基础·python编程·python书籍
逐·風6 小时前
unity关于自定义渲染、内存管理、性能调优、复杂物理模拟、并行计算以及插件开发
前端·unity·c#
Devil枫6 小时前
Vue 3 单元测试与E2E测试
前端·vue.js·单元测试
尚梦7 小时前
uni-app 封装刘海状态栏(适用小程序, h5, 头条小程序)
前端·小程序·uni-app