|
|
@@ -984,6 +984,25 @@ export default {
|
|
|
callback(true)
|
|
|
}
|
|
|
},
|
|
|
+ /**
|
|
|
+ * 根据defId获取当前流程主版本的defId
|
|
|
+ * @param {String} defId 流程ID
|
|
|
+ */
|
|
|
+ getMainDefId (defId) {
|
|
|
+ const sql = `select def_id_, def_key_ from ibps_bpm_def where def_key_ in (select def_key_ from ibps_bpm_def where def_id_ = '${defId}') and is_main_ = 'Y'`
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ this.$common.request('sql', sql).then(res => {
|
|
|
+ const { data = [] } = res.variables || {}
|
|
|
+ if (data.length) {
|
|
|
+ resolve(data[0].def_id_)
|
|
|
+ } else {
|
|
|
+ resolve(null)
|
|
|
+ }
|
|
|
+ }).catch(error => {
|
|
|
+ reject(error)
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
/**
|
|
|
* 根据defId获取当前流程最新的已暂存数据
|
|
|
* @param {String} defId 流程ID
|
|
|
@@ -1064,12 +1083,11 @@ export default {
|
|
|
case 'custom': // 自定义按钮
|
|
|
break
|
|
|
case 'openTask': // 编制,开启对应流程
|
|
|
- // console.log(button)
|
|
|
if (!button.deflow) {
|
|
|
- this.$message.warning('请先配置对应流程!')
|
|
|
- return
|
|
|
+ return this.$message.warning('请先配置对应流程!')
|
|
|
}
|
|
|
- this.defId = button.deflow
|
|
|
+ // 改进:通过主版本defId启动流程(适用流程升版的情况)
|
|
|
+ this.defId = await this.getMainDefId(button.deflow)
|
|
|
// 补充逻辑,带入已有暂存数据
|
|
|
this.proInstId = await this.getProInstId(button.deflow, userId, button.isEditOnHis)
|
|
|
this.addDataCont = button.initAddDataCont
|
|
|
@@ -1083,27 +1101,28 @@ export default {
|
|
|
this.$refs.snapshot.handleActionEvent('preview', 0)
|
|
|
}, 500)
|
|
|
} else {
|
|
|
- if (this.handleVerify(button.reportPath, selection, data)) {
|
|
|
- src = this.$reportPath.replace('show', 'pdf') + button.reportPath.split('&')[0] + `&` + this.getReportParams(button.reportPath, selection, data)
|
|
|
- this.$common.preview(this, src)
|
|
|
+ if (!button.reportPath) {
|
|
|
+ return this.$message.warning('请先配置对应报表路径!')
|
|
|
}
|
|
|
+ src = this.$reportPath.replace('show', 'pdf') + button.reportPath.split('&')[0] + `&` + this.getReportParams(button.reportPath, selection, data)
|
|
|
+ this.$common.preview(this, src)
|
|
|
}
|
|
|
break
|
|
|
case 'download': // 下载记录
|
|
|
- if (this.handleVerify(button.reportPath, selection, data)) {
|
|
|
- this.$common.snapshoot({
|
|
|
- url: this.$getReportFile(button.reportPath.split('&')[0], this.getReportParams(button.reportPath, selection, data)),
|
|
|
- name: selection,
|
|
|
- type: 'pdf'
|
|
|
- }).then((res) => {
|
|
|
- if (!res.data || !res.data.id) {
|
|
|
- this.$message.error('生成文件失败,请重试!')
|
|
|
- return
|
|
|
- }
|
|
|
- this.$common.download(res.data)
|
|
|
- })
|
|
|
+ if (!button.reportPath) {
|
|
|
+ return this.$message.warning('请先配置对应报表路径!')
|
|
|
}
|
|
|
-
|
|
|
+ this.$common.snapshoot({
|
|
|
+ url: this.$getReportFile(button.reportPath.split('&')[0], this.getReportParams(button.reportPath, selection, data)),
|
|
|
+ name: selection,
|
|
|
+ type: 'pdf'
|
|
|
+ }).then((res) => {
|
|
|
+ if (!res.data || !res.data.id) {
|
|
|
+ this.$message.error('生成文件失败,请重试!')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.$common.download(res.data)
|
|
|
+ })
|
|
|
break
|
|
|
case 'print': // 打印
|
|
|
ActionUtils.selectedRecord(selection).then((id) => {
|
|
|
@@ -2048,18 +2067,6 @@ export default {
|
|
|
// 如果是没有传参,还是原报表路径
|
|
|
return str + `${selection}`
|
|
|
}
|
|
|
- },
|
|
|
- handleVerify (path, selection, data) {
|
|
|
- let state = true
|
|
|
- if (Array.isArray(selection) || Array.isArray(data)) {
|
|
|
- this.$message.error('表单按钮请放到管理列~')
|
|
|
- state = false
|
|
|
- }
|
|
|
- if (!path) {
|
|
|
- this.$message.warning('请先配置对应报表路径~')
|
|
|
- state = false
|
|
|
- }
|
|
|
- return state
|
|
|
}
|
|
|
}
|
|
|
}
|