ruoyi-nbcio-plus基于vue3的flowable收回任务后重新进行提交表单的处理

简介: ruoyi-nbcio-plus基于vue3的flowable收回任务后重新进行提交表单的处理

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

gitee源代码地址

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

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

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

gitee源代码地址

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

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

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

1、后端的处理

     因为这个收回审批的提交跟原先的VForm表单提交不一样了,如下界面,这个是可以表单信息里进行修改了,修改后要能提交保存起来,因为原先肯定没有考虑这些

      因为原先提交的时候保存起来,在变量里面,所以用下面的formConf.setFormData(variables);就可以了,但这个variables需求前端进行重新设置修改后的值。

FormConf formConf = new FormConf();
                Map<String, Object> formModel = JsonUtils.parseObject(formInfo.getContent(), Map.class);
                if (null != formModel && !formModel.isEmpty()) {
                    formConf.setTitle(title);
                    formConf.setDisabled(true);
                    formConf.setFormBtns(false);
                    formConf.setFormModel(formModel);
                    formConf.setFormData(variables);
                    procFormList.add(formConf);
                }

2、前端的处理

判断是否是退回到第一个节点

taskFormVisible.value = data.existTaskForm;
      if (taskFormVisible.value) {
        taskFormData.value = data.taskFormData;
      }
      if(data.startUserNode) {
        startUserForm.value.isStartUserNode = true;
      }
      formVisible.value = true;
      nextTick(() => {
        processFormList.value.forEach((item: any, index: any) => {
          if (item.disabled && !startUserForm.value.isStartUserNode) {
            vFormRenderRef.value[index].disableForm();
          }
        })
      })

是的话,不要disable了,可以进行编辑,

同时通过任务修改如下:

/** 通过任务 */
  const handleComplete = () => {
    const isExistTaskForm = taskFormRef !== undefined;
    // 校验表单
    taskFormRef.value?.validate(async (valid: boolean) => {
      if (valid) {
        if (isExistTaskForm) {
          const data = await vFormRenderRef.value[0]?.getFormData();
          const Widgetlist = await vFormRenderRef.value[0]?.getFieldWidgets();
          //替换文件上传成功后的文件名称与url,以便后面回显用
          let fileUpload = Widgetlist?.filter(item => item.type === "file-upload");
          fileUpload?.forEach((fileitem) => {
            data[`${fileitem.name}`]?.forEach((dataitem,index) => {
              data[`${fileitem.name}`][index].name = data[`${fileitem.name}`][index].response.data?.newFileName;
              data[`${fileitem.name}`][index].url = data[`${fileitem.name}`][index].response.data?.url;
            })
          })
          //替换图片上传成功后的文件名称与url,以便后面回显用
          let picUpload = Widgetlist?.filter(item => item.type === "picture-upload");
          picUpload?.forEach((picitem) => {
            data[`${picitem.name}`]?.forEach((dataitem,index) => {
              data[`${picitem.name}`][index].name = data[`${picitem.name}`][index].response.data?.newFileName;
              data[`${picitem.name}`][index].url = data[`${picitem.name}`][index].response.data?.url;
            })
          })
          const variables = data;
          taskFormData.formValue = data;
          variables.variables = taskFormData;
          taskForm.variables = variables;
        }
        console.log("handleComplete taskForm",taskForm)
        const res = await complete(taskForm)
        proxy?.$modal.msgSuccess(res.msg);
        goBack();
      }
    });
  }

3、效果图如下:


相关文章
|
1天前
vue3【实战】语义化首页布局
vue3【实战】语义化首页布局
8 2
|
1天前
|
存储 容器
vue3【实战】来回拖拽放置图片
vue3【实战】来回拖拽放置图片
7 2
|
1天前
|
JavaScript 开发工具 开发者
vue3【提效】使用 VueUse 高效开发(工具库 @vueuse/core + 新增的组件库 @vueuse/components)
vue3【提效】使用 VueUse 高效开发(工具库 @vueuse/core + 新增的组件库 @vueuse/components)
8 1
|
1天前
|
API
Pinia 实用教程【Vue3 状态管理】状态持久化 pinia-plugin-persistedstate,异步Action,storeToRefs(),修改State的 $patch,$reset
Pinia 实用教程【Vue3 状态管理】状态持久化 pinia-plugin-persistedstate,异步Action,storeToRefs(),修改State的 $patch,$reset
9 1
|
1天前
|
JavaScript
vue3 【提效】自动注册组件 unplugin-vue-components 实用教程
vue3 【提效】自动注册组件 unplugin-vue-components 实用教程
5 1
|
1天前
vue3 【提效】自动导入框架方法 unplugin-auto-import 实用教程
vue3 【提效】自动导入框架方法 unplugin-auto-import 实用教程
4 0
|
1天前
vue3 【提效】全局布局 vite-plugin-vue-layouts 实用教程
vue3 【提效】全局布局 vite-plugin-vue-layouts 实用教程
6 0
|
1天前
|
数据采集 JavaScript 前端开发
Vue框架的优缺点是什么
【7月更文挑战第5天】 Vue框架:组件化开发利于重用与扩展,响应式数据绑定简化状态管理;学习曲线平缓,生态系统丰富,集成便捷,且具性能优化手段。缺点包括社区规模相对小,类型支持不足(Vue 3.x改善),路由和状态管理需额外配置,SEO支持有限。随着发展,部分缺点正被克服。
7 1
|
1天前
|
JavaScript
Vue卸载eslint的写法,单独安装eslint,单独卸载eslint
Vue卸载eslint的写法,单独安装eslint,单独卸载eslint
|
1天前
|
JavaScript
青戈大佬安装Vue,无Eslint安装版,vue2安装,vue2无eslint,最简单配置Vue安装资料
青戈大佬安装Vue,无Eslint安装版,vue2安装,vue2无eslint,最简单配置Vue安装资料