| | |
| | | import {paramLow,callPreEvent, callPostEvent} from '../BaseAction'; |
| | | import {validatenull} from "@/util/validate"; |
| | | import Vue from "vue"; |
| | | import workActionDialog from "@/components/actions/base/startWorkFlow" |
| | | |
| | | |
| | | export const doAction = (options,callback) => { |
| | | //multi 是否开启多选 |
| | | //checknotprocess 是否允许发起流程 |
| | | |
| | | options.sourceData = options.sourceData || {}; |
| | | options.dataStore = options.dataStore || []; |
| | | if (!options.dataStore || options.dataStore.length < 1) { |
| | | Vue.prototype.$message.error("请选择需要发起流程的数据"); |
| | | return false; |
| | | } |
| | | if (!options.paramVOS.multi && options.dataStore.length > 1) { |
| | | Vue.prototype.$message.error("仅能选择一条数据发起流程"); |
| | | return false; |
| | | } |
| | | |
| | | //验证不允许启动的条件 |
| | | if(!validatenull(options.paramVOS.checknotprocess)) { |
| | | let notprocess = options.paramVOS.checknotprocess.split('&'); |
| | | let checknotprocess=false; |
| | | notprocess.forEach((item,i)=>{ |
| | | if (options.dataStore[0][item.split('=')[0]] == item.split('=')[1]) { |
| | | checknotprocess=true; |
| | | return false; |
| | | } |
| | | }) |
| | | if (checknotprocess) { |
| | | Vue.prototype.$message.error(replaceFreeMarker(options.paramVOS.checknotprocessmsg,options.dataStore,{}) || "当前数据不允许发起流程"); |
| | | return false; |
| | | } |
| | | } |
| | | // if (!options.dataStore || options.dataStore.length < 1) { |
| | | // Vue.prototype.$message.error("请选择需要发起流程的数据"); |
| | | // return false; |
| | | // } |
| | | // if (!options.paramVOS.multi && options.dataStore.length > 1) { |
| | | // Vue.prototype.$message.error("仅能选择一条数据发起流程"); |
| | | // return false; |
| | | // } |
| | | // |
| | | // //验证不允许启动的条件 |
| | | // if(!validatenull(options.paramVOS.checknotprocess)) { |
| | | // let notprocess = options.paramVOS.checknotprocess.split('&'); |
| | | // let checknotprocess=false; |
| | | // notprocess.forEach((item,i)=>{ |
| | | // if (options.dataStore[0][item.split('=')[0]] == item.split('=')[1]) { |
| | | // checknotprocess=true; |
| | | // return false; |
| | | // } |
| | | // }) |
| | | // if (checknotprocess) { |
| | | // Vue.prototype.$message.error(replaceFreeMarker(options.paramVOS.checknotprocessmsg,options.dataStore,{}) || "当前数据不允许发起流程"); |
| | | // return false; |
| | | // } |
| | | // } |
| | | |
| | | callPreEvent(options, doBefore, function (options) { |
| | | showStartWindow(options, function () { |
| | |
| | | */ |
| | | export const showStartWindow = (options,callback)=> { |
| | | const paramVOS = options.paramVOS; |
| | | // if (!paramVOS['form'] && !paramVOS['context']) { |
| | | // Vue.prototype.$message.error("按钮配置不正确"); |
| | | // return false; |
| | | // } |
| | | |
| | | const dialogConstructor = Vue.extend(workActionDialog); |
| | | let instance = new dialogConstructor(); |
| | | instance.sourceData = options.sourceData; |
| | | instance.dataStore = options.dataStore; |
| | | instance.paramVOS = paramVOS; |
| | | |
| | | instance.dialogClose = function () { |
| | | vm.visible = false; |
| | | document.body.removeChild(vm.$el); |
| | | instance.$destroy(); |
| | | instance = null; |
| | | }; |
| | | if (callback) { |
| | | instance.saveCallback = callback; |
| | | } |
| | | let vm = instance.$mount(); |
| | | document.body.appendChild(vm.$el); |
| | | instance.visible = true; |
| | | |
| | | } |
| | | /** |