Przeglądaj źródła

数据模板编制按钮增加编制暂存功能

cfort 2 lat temu
rodzic
commit
d77574c13c

+ 13 - 0
src/business/platform/data/templatebuilder/right-aside/editors/editor-button.vue

@@ -98,6 +98,19 @@
         >
         >
             <el-input v-model="formData.initAddDataCont" placeholder="a:1&b:2(原template.addDataCont.a = '1')" />
             <el-input v-model="formData.initAddDataCont" placeholder="a:1&b:2(原template.addDataCont.a = '1')" />
         </el-form-item>
         </el-form-item>
+        <el-form-item v-if="formData && ['openTask'].includes(formData.button_type)" prop="isEditOnHis">
+            <template slot="label">
+                编制暂存
+                <el-tooltip effect="dark" content="如开启,在点击编制按钮时将带出当前用户最新已暂存的数据" placement="top">
+                    <i class="el-icon-question question-icon" />
+                </el-tooltip>
+            </template>
+            <el-switch
+                v-model="formData.isEditOnHis"
+                active-value="Y"
+                inactive-value="N"
+            />
+        </el-form-item>
         <export-column
         <export-column
             :visible="exportFieldDialogVisible"
             :visible="exportFieldDialogVisible"
             :data="template"
             :data="template"

+ 29 - 1
src/business/platform/data/templaterender/templates/list.vue

@@ -242,6 +242,7 @@
         <bpmn-formrender
         <bpmn-formrender
             :visible="npmDialogFormVisible"
             :visible="npmDialogFormVisible"
             :def-id="defId"
             :def-id="defId"
+            :pro-inst-id="proInstId"
             :instance-id="instanceId"
             :instance-id="instanceId"
             :task-id="taskId"
             :task-id="taskId"
             :add-data-cont="addDataCont"
             :add-data-cont="addDataCont"
@@ -393,6 +394,7 @@ export default {
         return {
         return {
             npmDialogFormVisible: false, // 弹窗
             npmDialogFormVisible: false, // 弹窗
             defId: '', // 编辑dialog需要使用
             defId: '', // 编辑dialog需要使用
+            proInstId: '', // 编制暂存数据
             instanceId: '', // 流程查看办理详情
             instanceId: '', // 流程查看办理详情
             taskId: '', // 流程进入当前任务
             taskId: '', // 流程进入当前任务
 
 
@@ -965,6 +967,29 @@ export default {
                 callback(true)
                 callback(true)
             }
             }
         },
         },
+        /**
+         * 根据defId获取当前流程最新的已暂存数据
+         * @param {String} defId 流程ID
+         * @param {Boolean} isOpen 是否开启编制暂存数据功能
+         */
+        getProInstId (defId, isOpen) {
+            if (!isOpen) {
+                return null
+            }
+            const sql = `select proc_inst_id_, businesskey_ from ibps_bpm_bus_rel where def_id_ = '${defId}' order by create_date_ desc limit 1`
+            return new Promise((resolve, reject) => {
+                this.$common.request('sql', sql).then(res => {
+                    const { data = [] } = res.variables || {}
+                    if (data.length) {
+                        resolve(data[0].proc_inst_id_)
+                    } else {
+                        resolve(null)
+                    }
+                }).catch(error => {
+                    reject(error)
+                })
+            })
+        },
         handleAction (command, position, selection, data, index, button) {
         handleAction (command, position, selection, data, index, button) {
             const buttonType = button.button_type || button.key
             const buttonType = button.button_type || button.key
             this.action = buttonType
             this.action = buttonType
@@ -972,7 +997,7 @@ export default {
             // this.selection = selection
             // this.selection = selection
             this.selection = data
             this.selection = data
             // 前置事件
             // 前置事件
-            this.beforeScript(command, position, selection, data, () => {
+            this.beforeScript(command, position, selection, data, async () => {
                 let src = ''
                 let src = ''
                 this.readonly = false
                 this.readonly = false
                 const { first = '', second = '' } = this.$store.getters.level || {}
                 const { first = '', second = '' } = this.$store.getters.level || {}
@@ -1028,6 +1053,8 @@ export default {
                             return
                             return
                         }
                         }
                         this.defId = button.deflow
                         this.defId = button.deflow
+                        // 补充逻辑,带入已有暂存数据
+                        this.proInstId = await this.getProInstId(button.deflow, button.isEditOnHis)
                         this.addDataCont = button.initAddDataCont
                         this.addDataCont = button.initAddDataCont
                         this.npmDialogFormVisible = true
                         this.npmDialogFormVisible = true
                         break
                         break
@@ -1453,6 +1480,7 @@ export default {
                 icon: rf.icon ? 'ibps-icon-' + rf.icon : defaultButton.icon,
                 icon: rf.icon ? 'ibps-icon-' + rf.icon : defaultButton.icon,
                 type: rf.style || defaultButton.type,
                 type: rf.style || defaultButton.type,
                 deflow: rf.deflow || null,
                 deflow: rf.deflow || null,
+                isEditOnHis: rf.isEditOnHis === 'Y',
                 // eslint-disable-next-line no-eval
                 // eslint-disable-next-line no-eval
                 initAddDataCont: rf.initAddDataCont ? obj : null,
                 initAddDataCont: rf.initAddDataCont ? obj : null,
                 reportPath: rf.reportPath,
                 reportPath: rf.reportPath,