Explorar el Código

撤回重启发起功能

cyy hace 3 meses
padre
commit
54fb6edfe2

+ 12 - 0
src/api/platform/bpmn/bpmInstHis.js

@@ -78,6 +78,18 @@ export function remove(params) {
     params: params
   })
 }
+/**
+ * 作废状态更新
+ * @param {*} params
+ */
+export function modifyData(params) {
+  return request({
+    url: BPMN_URL() + '/bpm/task/modifyData',
+    method: 'post',
+    isLoading: true,
+    params: params
+  })
+}
 
 /**
  * 正常审批通过并通过流程key、发起人过滤,排序-结束时间降序

+ 13 - 0
src/api/platform/bpmn/bpmTask.js

@@ -79,6 +79,19 @@ export function complete(params) {
   })
 }
 
+/**
+ * 流程撤回
+ * @param {*} params
+ */
+export function revocation(params) {
+  return request({
+    url: BPMN_URL() + '/bpm/task/recall',
+    method: 'post',
+    isLoading: true,
+    data: params
+  })
+}
+
 /**
  * 终止流程
  * @param  {[type]} params 参数对象

+ 143 - 4
src/business/platform/bpmn/form/action.js

@@ -16,11 +16,13 @@ import {
   bpmTaskSave
 } from '@/api/platform/bpmn/bpmTask'
 import { startFlow, saveDraft } from '@/api/platform/bpmn/bpmInst'
-import { saveFormData } from '@/api/platform/data/dataTemplate'
+import { removeFormData, saveFormData } from '@/api/platform/data/dataTemplate'
 import {
   changeCompleteTime,
-  replenishSnapshot
+  replenishSnapshot,
+  modifyData
 } from '@/api/platform/bpmn/bpmInstHis'
+import { revocation } from '@/api/platform/bpmn/bpmTask'
 import Print from '@/utils/print'
 
 export default {
@@ -178,6 +180,12 @@ export default {
         case 'timeModification': // 节点按钮设置-修改时间
           this.handleTimeModification()
 
+          break
+        case 'revocation': // 节点按钮设置-撤回
+          this.handleRevocation()
+          break
+        case 'restart': // 节点按钮设置-重新发起
+          this.handleRestart()
           break
         default:
           break
@@ -249,19 +257,51 @@ export default {
         this.saveStartFlow()
       }
     },
+    /**
+     * 处理重新发起数据
+     */
+    dealReStartData(data, type) {
+      if (type === 'obj') {
+        for (const key in data) {
+          if (key === 'id') {
+            data.id = ''
+          } else if (key === 'shiFouGuoShen') {
+            data.shiFouGuoShen = ''
+          } else if (key === 'tenantId') {
+            data.tenantId = ''
+          } else if (key === 'parentId') {
+            data.parentId = ''
+          } else if (Array.isArray(data[key]) && data[key].length > 0) {
+            this.dealReStartData(data[key], 'arr')
+          }
+        }
+      } else if (type === 'arr') {
+        data.forEach((e) => {
+          this.dealReStartData(e, 'obj')
+        })
+      }
+    },
     /**
      * 保存启动流程
      * @param {*}
      */
     saveStartFlow(params = {}) {
       const formData = this.getFormData()
+      const {
+        formData: oldFormData,
+        formDefData,
+        params: oldParams
+      } = this.getFormEL() || {}
       if (!formData) return
+      if (this.reSign && this.reSign === 'reStart') {
+        this.dealReStartData(formData, 'obj')
+      }
       // 暂存后直接提交,已有数据ID
       if (this.$utils.isNotEmpty(this.bizKey)) {
         formData.id = this.bizKey || ''
       }
       const jsonData = {
-        defId: this.defId,
+        defId: this.defId || this.redefId,
         version: this.version || '0',
         data: JSON.stringify(this.$common.replaceNullWithEmpty(formData))
       }
@@ -286,6 +326,31 @@ export default {
           const { bizKey = '', proInstId = '' } = response.variables || {}
           // this.createSnapshot(bizKey, proInstId)
           this.startFlowDialogVisible = false
+          // 重新启动历史数据处理
+          if (
+            this.reSign &&
+            this.reSign === 'reStart' &&
+            this.decision &&
+            this.decision === 'confirm'
+          ) {
+            modifyData({
+              instId: oldParams.instanceId
+            })
+              .then((responserfd) => {})
+              .catch(() => {})
+          } else if (
+            this.reSign &&
+            this.reSign === 'reStart' &&
+            this.decision &&
+            this.decision === 'cancel'
+          ) {
+            removeFormData({
+              formKey: formDefData.key,
+              ids: oldFormData.id
+            })
+              .then((responserfd) => {})
+              .catch(() => {})
+          }
           // 后置事件
           this.afterScript(
             this.actionName,
@@ -925,8 +990,82 @@ export default {
       }
       this.$common.request('update', params)
     },
+    // 流程撤回按钮
+    async handleRevocation() {
+      const currentFormData = this.$common.replaceNullWithEmpty(
+        this.getFormData()
+      )
+      const { instanceId = '' } = this.getFormEL().params || {}
+      currentFormData.shiFouGuoShen = '已撤回'
+      let param = {
+        data: JSON.stringify(currentFormData),
+        taskId: instanceId,
+        backHandMode: 'normal',
+        destination: '',
+        opinion: '撤回修改',
+        rejectMode: 'reject'
+      }
+      try {
+        const response = await revocation(param)
+        if (response.state === 200) {
+          const params = {
+            tableName: `IBPS_BPM_APPROVAL`,
+            updList: [
+              {
+                where: {
+                  TASK_ID_: response.variables.data,
+                  PROC_INST_ID_: instanceId
+                },
+                param: {
+                  STATUS_: 'recall'
+                }
+              }
+            ]
+          }
+          this.$common.request('update', params).then((r) => {
+            this.$message.success('撤回成功!')
+            this.callbackPage()
+          })
+        } else {
+          this.$message.error(response.message)
+        }
+      } catch (error) {
+        console.error('撤回失败:', error)
+      }
+    },
+    // 重新发起
+    async handleRestart() {
+      if (!this.timeModification_) {
+        this.timeModification_ = true
+        return
+      }
+      const { code = '', name = '' } = this.getFormEL().formDefData || {}
+      const currentFormData = this.$common.replaceNullWithEmpty(
+        this.getFormData()
+      )
+      const { instanceId = '' } = this.getFormEL().params || {}
+      let redefIdData = await this.$common.request('query', {
+        key: 'getReDefId',
+        params: [instanceId]
+      })
+      this.redefId = redefIdData.variables.data[0].PROC_DEF_ID_
+      this.$confirm('是否保留历史数据?', '提示', {
+        type: 'warning',
+        confirmButtonText: '是',
+        cancelButtonText: '否'
+      })
+        .then(() => {
+          this.reSign = 'reStart'
+          this.decision = 'confirm'
+          this.handleStartFlow()
+        })
+        .catch(() => {
+          this.reSign = 'reStart'
+          this.decision = 'cancel'
+          this.handleStartFlow()
+        })
+    },
     // 修改流程时间
-
     async handleTimeModification() {
       // 获取表单数据
       const { code = '', name = '' } = this.getFormEL().formDefData || {}

+ 18 - 0
src/business/platform/bpmn/form/button.js

@@ -71,6 +71,8 @@ BpmnButton.BUTTON_TYPES = [
   'flowImage',
   'timeModification',
   'timeModificationNo',
+  'revocation',
+  'restart',
   'approvalHistory',
   'opposeTrans',
   'agreeTrans',
@@ -408,6 +410,22 @@ BpmnButton.Models.ResponseButtonSave = BpmnButton.Models.ResponseButton.extend({
     this.handleActionEvent(btn.getAlias(), btn)
   }
 })
+//流程实例重新提交
+BpmnButton.Models.ResponseButtonRestart =
+  BpmnButton.Models.ResponseButton.extend({
+    icon: 'ibps-icon-rotate-left',
+    action: function (btn) {
+      this.handleActionEvent(btn.getAlias(), btn)
+    }
+  })
+// 流程实例撤回
+BpmnButton.Models.ResponseButtonRevocation =
+  BpmnButton.Models.ResponseButton.extend({
+    icon: 'ibps-icon-mail-reply',
+    action: function (btn) {
+      this.handleActionEvent(btn.getAlias(), btn)
+    }
+  })
 // 流程实例修改
 BpmnButton.Models.ResponseButtonTimeModification =
   BpmnButton.Models.ResponseButton.extend({

+ 6 - 0
src/business/platform/bpmn/form/dialog.vue

@@ -25,6 +25,7 @@
       :task-change-id="taskChangeId"
       :copy-flow="copyFlow"
       :add-data-cont="addDataCont"
+      :extraBtn="extraBtn"
       @close="closeDialog"
       @callback="handleCallback"
     />
@@ -91,6 +92,11 @@ export default {
       // 新增参数
       type: String
     },
+    extraBtn: {
+      // 新增额外按钮参数
+      type: String,
+      default: ''
+    },
     previousDataTemplate: {
       type: Object
     },

+ 34 - 1
src/business/platform/bpmn/form/index.vue

@@ -12,6 +12,7 @@
         :data="formData"
         :params="formParams"
         :readonly="readonly"
+        :extraBtn="extraBtn"
         :time-modification="timeModification_"
         :add-data-cont="addDataCont"
         @action-event="(actionKey, args) => emitEventHandler(actionKey, args)"
@@ -184,6 +185,7 @@ import FormPrintTemplate from '@/business/platform/form/form-print/template'
 
 const _import = require('@/utils/util.import.' + process.env.NODE_ENV)
 import { SHOW_TIMT_MODIFICATION } from '@/constant'
+import { getSetting } from '@/utils/query'
 
 export default {
   components: {
@@ -249,6 +251,11 @@ export default {
       type: Boolean,
       default: false
     },
+    extraBtn: {
+      // 新增额外按钮参数
+      type: String,
+      default: ''
+    },
     flowName: {
       type: String
     },
@@ -307,7 +314,8 @@ export default {
       instanceId_: this.instanceId,
       responseData: {},
       formDataBF: '',
-      opinionListBF: ''
+      opinionListBF: '',
+      revocationRestart: false
     }
   },
   watch: {
@@ -332,6 +340,11 @@ export default {
       }
     }
   },
+  async created() {
+    const res = await getSetting()
+    const revocationRestart = res.revocationRestart || false
+    this.revocationRestart = revocationRestart
+  },
   methods: {
     // 获取数据
     loadFormData() {
@@ -662,6 +675,26 @@ export default {
           name: this.timeModification_ ? '保存修改' : '修改数据'
         })
       }
+      console.log(
+        this.revocationRestart,
+        'this.revocationRestartthis.revocationRestart'
+      )
+      if (this.extraBtn === 'revocation' && this.revocationRestart) {
+        toolbars.push({
+          alias: 'revocation',
+          name: '撤回'
+        })
+      }
+      if (this.extraBtn === 'restart' && this.revocationRestart) {
+        toolbars.push({
+          alias: 'restart',
+          icon: this.timeModification_
+            ? 'ibps-icon-check-square-o'
+            : 'ibps-icon-rotate-left',
+          type: this.timeModification_ ? 'success' : 'info',
+          name: this.timeModification_ ? '提交' : '重新发起'
+        })
+      }
       // if (this.timeModificationbtn) {
       //     toolbars.push({
       //         'alias': 'timeModificationNo',

+ 3 - 0
src/business/platform/form/formrender/dynamic-form/components/approval-opinion/index.vue

@@ -36,6 +36,9 @@
                 <span v-else-if="row[options[2].value] == '驳回到发起人'">
                   <span style="color: red">退回、重新编辑</span>
                 </span>
+                <span v-else-if="row[options[2].value] == '撤回'">
+                  <span style="color: grey">撤回</span>
+                </span>
                 <span v-else-if="row[options[2].value] !== '反对'">
                   {{ row[options[2].value] }}
                 </span>

+ 12 - 1
src/business/platform/form/formrender/dynamic-form/dynamic-form.vue

@@ -71,7 +71,13 @@
           />
           <!--其他类型-->
           <ibps-dynamic-form-item
-            v-else
+            v-else-if="
+              !item.name.includes('approval_opinion_') ||
+              (item.name.includes('approval_opinion_') &&
+                extraBtn === 'restart' &&
+                timeModification === false) ||
+              (item.name.includes('approval_opinion_') && extraBtn === '')
+            "
             :ref="'formItem' + item.name"
             :key="index"
             :models.sync="models"
@@ -157,6 +163,11 @@ export default {
       type: Boolean,
       default: false
     },
+    extraBtn: {
+      // 新增额外按钮参数
+      type: String,
+      default: ''
+    },
     permissions: {
       type: Object
     },

+ 6 - 0
src/business/platform/form/formrender/index.vue

@@ -60,6 +60,7 @@
           :initialization="initialization"
           :cur-active-step.sync="curActiveStep"
           :is-dialog="isDialog"
+          :extraBtn="extraBtn"
           class="form-container"
           :style="{ marginTop: hasActions ? marginTop + 'px' : '0' }"
           :time-modification="timeModification"
@@ -116,6 +117,11 @@ export default {
     data: {
       type: Object
     },
+    extraBtn: {
+      // 新增额外按钮参数
+      type: String,
+      default: ''
+    },
     /**
      * @description 工具栏
      */

+ 6 - 0
src/views/component/sjzlpjjhx/sjzlpjjhx.vue

@@ -330,6 +330,12 @@ export default {
         this.$emit('change-data', 'sjzlpjjhzbX', value)
       },
       deep: true
+    },
+    readonly: {
+      handler(value, old) {
+        this.isRead = value
+      },
+      deep: true
     }
   },
   mounted() {

+ 1 - 0
src/views/platform/office/bpmInitiatedProcess/myRequest.vue

@@ -61,6 +61,7 @@
       :instance-id="instanceId"
       :pro-inst-id="proInstId"
       :def-id="defId"
+      :extraBtn="'revocation'"
       :copy-flow="copyFlow"
       @callback="search"
       @close="(visible) => (dialogFormVisible = visible)"

+ 1 - 0
src/views/platform/office/bpmReceivedProcess/completed.vue

@@ -54,6 +54,7 @@
     <bpmn-formrender
       :visible="dialogFormVisible"
       :instance-id="instanceId"
+      :extraBtn="'restart'"
       @callback="search"
       @close="(visible) => (dialogFormVisible = visible)"
     />