Răsfoiți Sursa

调整快照查询

cfort 2 ani în urmă
părinte
comite
3c34376345

+ 150 - 135
src/business/platform/bpmn/definition/dialog.vue

@@ -1,140 +1,155 @@
 <template>
-  <ibps-selector-dialog
-    :value="selectedValue"
-    :visible="selectorVisible"
-    v-bind="$props"
-    @input="value => selectedValue = value"
-    @remove-select="setSelectRow"
-    @close="handleClose"
-    @action-event="handleActionEvent"
-  >
-    <template slot-scope="scope">
-      <ibps-selector-panel
-        ref="panel"
-        v-bind="scope"
-        :form-key="formKey"
-        :is-super="isSuper"
-        :is-data-template-use="isDataTemplateUse"
-        @selected="value => selectedValue = value"
-      />
-    </template>
-  </ibps-selector-dialog>
+    <ibps-selector-dialog
+        :value="selectedValue"
+        :visible="selectorVisible"
+        v-bind="$props"
+        @input="value => selectedValue = value"
+        @remove-select="setSelectRow"
+        @close="handleClose"
+        @action-event="handleActionEvent"
+    >
+        <template slot-scope="scope">
+            <ibps-selector-panel
+                ref="panel"
+                v-bind="scope"
+                :form-key="formKey"
+                :is-super="isSuper"
+                :is-data-template-use="isDataTemplateUse"
+                @selected="value => selectedValue = value"
+            />
+        </template>
+    </ibps-selector-dialog>
 </template>
 <script>
-import IbpsSelectorDialog from '@/components/ibps-selector/dialog'
-import IbpsSelectorPanel from './panel'
-export default {
-  components: {
-    IbpsSelectorDialog,
-    IbpsSelectorPanel
-  },
-  props: {
-    visible: Boolean, // 是否可见
-    title: { // 标题
-      type: String,
-      default: '流程定义选择器'
-    },
-    // 是否查询所有
-    isSuper: {
-      type: Boolean,
-      default: false
-    },
-    marginTop: { // Dialog CSS 中的 margin-top 值
-      type: String,
-      default: '5vh'
-    },
-    width: { // 宽
-      type: String,
-      default: '60%'
-    },
-    height: { // 高
-      type: String,
-      default: '415px'
-    },
-    closeOnClickModal: { // 是否可以通过点击 modal 关闭 Dialog
-      type: Boolean,
-      default: false
-    },
-    closeOnPressEscape: { // 是否可以通过按下 ESC 关闭 Dialog
-      type: Boolean,
-      default: false
-    },
-    showClose: { // 是否显示关闭按钮
-      type: Boolean,
-      default: true
-    },
-    isDataTemplateUse: {
-      type: Boolean,
-      default: false
-    },
-    beforeClose: { // 关闭前的回调,会暂停 Dialog 的关闭
-      type: Function
-    },
-    fullscreen: { // 是否为全屏 Dialog
-      type: Boolean,
-      default: false
-    },
-    labelKey: { // 展示的值
-      type: String,
-      default: 'name'
-    },
-    valueKey: { // 唯一存储的值
-      type: String,
-      default: 'id'
-    },
-    formKey: String,
-    value: { // value
-      type: [Object, Array],
-      default() { return this.multiple ? [] : {} }
-    },
-    cleanClose: { // 按钮清空并关闭
-      type: Boolean,
-      default: false
-    },
-    buttons: { // 按钮组
-      type: Array
-    },
-    confirmButtonText: {
-      type: String,
-      default: '选择'
-    },
-    cleanButtonText: String,
-    cancelButtonText: String,
-    multiple: { // 是否多选
-      type: Boolean,
-      default: false
+    import IbpsSelectorDialog from '@/components/ibps-selector/dialog'
+    import IbpsSelectorPanel from './panel'
+    export default {
+        components: {
+            IbpsSelectorDialog,
+            IbpsSelectorPanel
+        },
+        props: {
+            // 是否可见
+            visible: Boolean,
+            // 标题
+            title: {
+                type: String,
+                default: '流程定义选择器'
+            },
+            // 是否查询所有
+            isSuper: {
+                type: Boolean,
+                default: false
+            },
+            // Dialog CSS 中的 margin-top 值
+            marginTop: {
+                type: String,
+                default: '5vh'
+            },
+            width: {
+                type: String,
+                default: '60%'
+            },
+            height: {
+                type: String,
+                default: '415px'
+            },
+            // 是否可以通过点击 modal 关闭 Dialog
+            closeOnClickModal: {
+                type: Boolean,
+                default: false
+            },
+            // 是否可以通过按下 ESC 关闭 Dialog
+            closeOnPressEscape: {
+                type: Boolean,
+                default: false
+            },
+            // 是否显示关闭按钮
+            showClose: {
+                type: Boolean,
+                default: true
+            },
+            isDataTemplateUse: {
+                type: Boolean,
+                default: false
+            },
+            // 关闭前的回调,会暂停 Dialog 的关闭
+            beforeClose: {
+                type: Function
+            },
+            // 是否为全屏 Dialog
+            fullscreen: {
+                type: Boolean,
+                default: false
+            },
+            // 展示的值
+            labelKey: {
+                type: String,
+                default: 'name'
+            },
+            // 唯一存储的值
+            valueKey: {
+                type: String,
+                default: 'id'
+            },
+            formKey: String,
+            value: {
+                type: [Object, Array],
+                default() {
+                    return this.multiple ? [] : {}
+                }
+            },
+            // 按钮清空并关闭
+            cleanClose: {
+                type: Boolean,
+                default: false
+            },
+            // 按钮组
+            buttons: {
+                type: Array
+            },
+            confirmButtonText: {
+                type: String,
+                default: '选择'
+            },
+            cleanButtonText: String,
+            cancelButtonText: String,
+            // 是否多选
+            multiple: {
+                type: Boolean,
+                default: false
+            }
+        },
+        data() {
+            return {
+                selectorVisible: false,
+                selectedValue: this.multiple ? [] : {}
+            }
+        },
+        watch: {
+            visible: {
+                handler: function (val, oldVal) {
+                    this.selectorVisible = this.visible
+                },
+                immediate: true
+            },
+            value() {
+                this.selectedValue = this.value
+            }
+        },
+        methods: {
+            setSelectRow() {
+                this.$refs['panel'].setSelectRow()
+            },
+            handleClose(visible) {
+                this.$emit('close', visible)
+            },
+            handleActionEvent(key, data) {
+                if (key === 'clean') {
+                    this.setSelectRow()
+                }
+                this.$emit('action-event', key, data)
+            }
+        }
     }
-  },
-  data() {
-    return {
-      selectorVisible: false,
-      selectedValue: this.multiple ? [] : {}
-    }
-  },
-  watch: {
-    visible: {
-      handler: function(val, oldVal) {
-        this.selectorVisible = this.visible
-      },
-      immediate: true
-    },
-    value() {
-      this.selectedValue = this.value
-    }
-  },
-  methods: {
-    setSelectRow() {
-      this.$refs['panel'].setSelectRow()
-    },
-    handleClose(visible) {
-      this.$emit('close', visible)
-    },
-    handleActionEvent(key, data) {
-      if (key === 'clean') {
-        this.setSelectRow()
-      }
-      this.$emit('action-event', key, data)
-    }
-  }
-}
 </script>

+ 179 - 171
src/business/platform/bpmn/definition/panel.vue

@@ -1,181 +1,189 @@
 <template>
-  <ibps-crud
-    ref="crud"
-    :height="tableHeight"
-    :data="listData"
-    :inde-row="false"
-    :toolbars="listConfig.toolbars"
-    :search-form="listConfig.searchForm"
-    :pk-key="pkKey"
-    :columns="listConfig.columns"
-    :pagination="pagination"
-    :loading="loading"
-    :selection-type="multiple?'checkbox':'radio'"
-    @selection-change="handleSelectionChange"
-    @action-event="handleAction"
-    @sort-change="handleSortChange"
-    @pagination-change="handlePaginationChange"
-  />
+    <ibps-crud
+        ref="crud"
+        :height="tableHeight"
+        :data="listData"
+        :inde-row="false"
+        :toolbars="listConfig.toolbars"
+        :search-form="listConfig.searchForm"
+        :pk-key="pkKey"
+        :columns="listConfig.columns"
+        :pagination="pagination"
+        :loading="loading"
+        :selection-type="multiple ? 'checkbox' : 'radio'"
+        @selection-change="handleSelectionChange"
+        @action-event="handleAction"
+        @sort-change="handleSortChange"
+        @pagination-change="handlePaginationChange"
+    />
 </template>
 <script>
-import { queryPageList, queryByFormKey } from '@/api/platform/bpmn/bpmDefinition'
-import ActionUtils from '@/utils/action'
-import SelectionMixin from '@/components/ibps-selector/mixins/selection'
+    import { queryPageList, queryByFormKey } from '@/api/platform/bpmn/bpmDefinition'
+    import ActionUtils from '@/utils/action'
+    import SelectionMixin from '@/components/ibps-selector/mixins/selection'
 
-export default {
-  mixins: [SelectionMixin],
-  props: {
-    value: [Object, Array],
-    // 是否查询所有
-    isSuper: {
-      type: Boolean,
-      default: false
-    },
-    button: {
-      type: Boolean,
-      default: false
-    },
-    isDataTemplateUse: {
-      type: Boolean,
-      default: false
-    },
-    formKey: String,
-    multiple: Boolean,
-    height: {
-      type: String,
-      default: '400px'
-    }
-  },
-  data() {
-    return {
-      width: 200,
-      dialogFormVisible: false, // 弹窗
-      editId: '',
+    export default {
+        mixins: [SelectionMixin],
+        props: {
+            value: [Object, Array],
+            // 是否查询所有
+            isSuper: {
+                type: Boolean,
+                default: false
+            },
+            button: {
+                type: Boolean,
+                default: false
+            },
+            isDataTemplateUse: {
+                type: Boolean,
+                default: false
+            },
+            formKey: String,
+            multiple: Boolean,
+            height: {
+                type: String,
+                default: '400px'
+            }
+        },
+        data() {
+            return {
+                width: 200,
+                // 弹窗
+                dialogFormVisible: false,
+                editId: '',
 
-      pkKey: 'id', // 主键  如果主键不是pk需要传主键
-      loading: false,
-      listData: [],
-      listConfig: {
-        // 工具栏
-        toolbars: [
-          { key: 'search' }
-        ],
-        // 查询条件
-        searchForm: {
-          labelWidth: 50,
-          forms: [
-            { prop: 'Q^name_^SL', label: '名称', itemWidth: '200' },
-            {
-              prop: ['Q^CREATE_TIME_^DL', 'Q^CREATE_TIME_^DG'],
-              label: '创建时间',
-              fieldType: 'daterange',
-              labelWidth: 80,
-              itemWidth: 220
+                // 主键  如果主键不是pk需要传主键
+                pkKey: 'id',
+                loading: false,
+                listData: [],
+                listConfig: {
+                    // 工具栏
+                    toolbars: [{ key: 'search' }],
+                    // 查询条件
+                    searchForm: {
+                        labelWidth: 50,
+                        forms: [
+                            {
+                                prop: 'Q^name_^SL',
+                                label: '名称',
+                                itemWidth: '200'
+                            },
+                            {
+                                prop: [
+                                    'Q^CREATE_TIME_^DL',
+                                    'Q^CREATE_TIME_^DG'
+                                ],
+                                label: '创建时间',
+                                fieldType: 'daterange',
+                                labelWidth: 80,
+                                itemWidth: 220
+                            }
+                            // { prop: 'Q^desc_^SL', label: '描述', itemWidth: '200' }
+                        ]
+                    },
+                    // 表格字段配置
+                    columns: [
+                        { prop: 'name', label: '流程名称' },
+                        { prop: 'defKey', label: '流程业务主键' },
+                        { prop: 'createTime', label: '创建时间' }
+                    ]
+                },
+                pagination: {},
+                sorts: { CREATE_TIME_: 'DESC' },
+                moreSearchParams: {}
             }
-            // { prop: 'Q^desc_^SL', label: '描述', itemWidth: '200' }
-          ]
         },
-        // 表格字段配置
-        columns: [
-          { prop: 'name', label: '流程名称' },
-          { prop: 'defKey', label: '流程业务主键' },
-          { prop: 'createTime', label: '创建时间' }
-        ]
-      },
-      pagination: {},
-      sorts: {},
-      moreSearchParams: {}
-    }
-  },
-  computed: {
-    tableHeight() {
-      const h = this.height.substr(0, this.height.length - 2)
-      return parseInt(h)
-    }
-  },
-  created() {
-    this.loadListData()
-  },
-  methods: {
-    /**
-     * 加载数据
-     */
-    loadListData() {
-      this.loading = true
-      if (this.isDataTemplateUse && this.$utils.isEmpty(this.formKey)) {
-        this.$message.error('错误原因:模板未绑定表单!')
-        this.loading = false
-        return
-      }
+        computed: {
+            tableHeight() {
+                const h = this.height.substr(0, this.height.length - 2)
+                return parseInt(h)
+            }
+        },
+        created() {
+            this.loadListData()
+        },
+        methods: {
+            /**
+             * 加载数据
+             */
+            loadListData() {
+                this.loading = true
+                if (this.isDataTemplateUse && this.$utils.isEmpty(this.formKey)) {
+                    this.$message.error('错误原因:模板未绑定表单!')
+                    this.loading = false
+                    return
+                }
 
-      const requestMethod = this.isDataTemplateUse ? queryByFormKey : queryPageList
-      requestMethod(this.getFormatParams()).then(response => {
-        this.loading = false
-        ActionUtils.handleListData(this, response.data)
-        this.setSelectRow()
-      }).catch(() => {
-        this.loading = false
-      })
-    },
-    /**
-     * 获取格式化参数
-     */
-    getFormatParams() {
-      const params = this.$refs['crud'] ? this.$refs['crud'].getSearcFormData() : {}
-      if (this.isDataTemplateUse) {
-        params['Q^status_^S'] = 'deploy'
-        params['formKey'] = this.formKey
-      } else {
-        params['Q^status_^S'] = 'deploy'
-      }
-      if (this.isSuper) {
-        params['isSuper'] = this.isSuper
-      }
-      return ActionUtils.formatParams(
-        params,
-        this.pagination,
-        this.sorts)
-    },
-    /**
-     * 处理分页事件
-     */
-    handlePaginationChange(page) {
-      this.changePageCoreRecordData()
-      ActionUtils.setPagination(this.pagination, page)
-      this.loadListData()
-    },
-    /**
-     * 处理排序
-     */
-    handleSortChange(sort) {
-      ActionUtils.setSorts(this.sorts, sort)
-      this.loadListData()
-    },
-    /**
-     * 查询
-     */
-    search() {
-      this.loadListData()
-    },
-    /**
-     * 重置查询条件
-     */
-    reset() {
-      this.$refs['crud'].handleReset()
-    },
-    /**
-     * 处理按钮事件
-     */
-    handleAction(command, position, selection, data) {
-      switch (command) {
-        case 'search':// 查询
-          ActionUtils.setFirstPagination(this.pagination)
-          this.search()
-          break
-        default:
-          break
-      }
+                const requestMethod = this.isDataTemplateUse ? queryByFormKey : queryPageList
+                requestMethod(this.getFormatParams()).then((response) => {
+                    this.loading = false
+                    ActionUtils.handleListData(this, response.data)
+                    this.setSelectRow()
+                }).catch(() => {
+                    this.loading = false
+                })
+            },
+            /**
+             * 获取格式化参数
+             */
+            getFormatParams() {
+                const params = this.$refs['crud'] ? this.$refs['crud'].getSearcFormData() : {}
+                if (this.isDataTemplateUse) {
+                    params['Q^status_^S'] = 'deploy'
+                    params['formKey'] = this.formKey
+                } else {
+                    params['Q^status_^S'] = 'deploy'
+                }
+                if (this.isSuper) {
+                    params['isSuper'] = this.isSuper
+                }
+                return ActionUtils.formatParams(
+                    params,
+                    this.pagination,
+                    this.sorts
+                )
+            },
+            /**
+             * 处理分页事件
+             */
+            handlePaginationChange(page) {
+                this.changePageCoreRecordData()
+                ActionUtils.setPagination(this.pagination, page)
+                this.loadListData()
+            },
+            /**
+             * 处理排序
+             */
+            handleSortChange(sort) {
+                ActionUtils.setSorts(this.sorts, sort)
+                this.loadListData()
+            },
+            /**
+             * 查询
+             */
+            search() {
+                this.loadListData()
+            },
+            /**
+             * 重置查询条件
+             */
+            reset() {
+                this.$refs['crud'].handleReset()
+            },
+            /**
+             * 处理按钮事件
+             */
+            handleAction(command, position, selection, data) {
+                switch (command) {
+                    case 'search': // 查询
+                        ActionUtils.setFirstPagination(this.pagination)
+                        this.search()
+                        break
+                    default:
+                        break
+                }
+            }
+        }
     }
-  }
-}
 </script>

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

@@ -223,12 +223,12 @@ export default {
             })
             // 1、直接启动
             startFlow(jsonData).then(response => {
-                const { bizKey = '', proInstId = '' } = response.variables || {}
-                this.createSnapshot(bizKey, proInstId)
                 loading.close()
                 this.$alert(`启动成功!`, {
                     showClose: false
                 }).then(() => {
+                    const { bizKey = '', proInstId = '' } = response.variables || {}
+                    this.createSnapshot(bizKey, proInstId)
                     this.startFlowDialogVisible = false
                     // 后置事件
                     this.afterScript(this.actionName, {
@@ -644,12 +644,13 @@ export default {
         async createSnapshot (bizKey, proId) {
             const { code = '', name = '' } = this.getFormEL().formDefData || {}
             const { proInstId = '' } = this.getFormEL().params || {}
+            const instId = proId || proInstId
             const id = bizKey || this.getFormEL().formData.id
             if (!code) {
                 return
             }
             
-            const sql = `select * from t_lcidglbdbb where shi_fou_zi_biao_ = 't_${code}' and ti_jiao_kuai_zhao = '是' and gui_dang_lei_xing = 'process'`
+            const sql = `select * from t_lcidglbdbb where tablekey_ = '${code}' and ti_jiao_kuai_zhao = '是' and gui_dang_lei_xing = 'process' and (liu_cheng_xuan_ze = (select PROC_DEF_KEY_ from ibps_bpm_inst where id_ = '${instId}' limit 1) or liu_cheng_xuan_ze = (select PROC_DEF_KEY_ from ibps_bpm_inst_his where id_ = '${instId}' limit 1))`
             request('sql', sql).then(async res => {
                 const { data = [] } = res.variables || {}
                 // 轮询流程是否结束,流程未结束不生成快照,每2秒查询一次,最多等待10秒钟
@@ -689,7 +690,7 @@ export default {
                     }).catch(() => {
                         // 生成快照接口调用失败时,也需要更新状态为已完成
                         this.$message.error('提交快照生成失败!')
-                        // this.updateState(id, code, '1')
+                        this.updateState(id, code, '1')
                     })
                 }, 300)
             })

+ 9 - 9
src/business/platform/bpmn/setting/bpmn-setting/mixins/addRecord.js

@@ -30,6 +30,10 @@ export default {
             })
         },
         addRecord () {
+            if (!this.boCode) {
+                this.$message.warning('请先绑定业务对象!')
+                return
+            }
             if (this.flag || this.liu_cheng_xuan_ze) return this.updateRecord()
             this.add()
         },
@@ -37,6 +41,7 @@ export default {
             const params = {
                 tableName: 't_lcidglbdbb',
                 paramWhere: [{
+                    tableKey_: this.boCode,
                     bao_biao_lu_jing_: this.bao_biao_lu_jing_,
                     fu_jian_nei_rong_: this.fu_jian_nei_rong_,
                     liu_cheng_xuan_ze: this.data.id,
@@ -49,10 +54,7 @@ export default {
             }
             curdPost('add', params).then(() => {
                 this.flag = true
-                this.$message({
-                    message: '添加成功',
-                    type: 'success'
-                })
+                this.$message.success('添加成功!')
             })
         },
         updateRecord () {
@@ -64,6 +66,7 @@ export default {
                             liu_cheng_xuan_ze: this.liu_cheng_xuan_ze
                         },
                         param: {
+                            tableKey_: this.boCode,
                             bao_biao_lu_jing_: this.bao_biao_lu_jing_,
                             fu_jian_nei_rong_: this.fu_jian_nei_rong_,
                             guan_lian_zi_duan: this.guan_lian_zi_duan,
@@ -74,11 +77,8 @@ export default {
                     }
                 ]
             }
-            curdPost('updatesByWhere', params).then(() => {
-                this.$message({
-                    message: '修改成功',
-                    type: 'warning'
-                })
+            curdPost('update', params).then(() => {
+                this.$message.info('修改成功')
             })
         }
     }