(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d21e783"],{d661:function(e,t,n){"use strict";n.r(t);var s=function(){var e=this,t=e._self._c;return t("div",{staticClass:"config-event-wrapper"},[t("a-form-model",{attrs:{"label-col":{span:3},"wrapper-col":{span:21},model:e.eventInfo}},[t("a-form-model-item",{attrs:{label:e.$t("wfDesigner.itemConfig.event.type")}},[t("a-select",{attrs:{"allow-clear":"",options:e.eventOpts},on:{change:e.changeType},model:{value:e.eventInfo.type,callback:function(t){e.$set(e.eventInfo,"type",t)},expression:"eventInfo.type"}})],1),t("event-set",{ref:"eventSetRef",attrs:{type:e.eventInfo.type,disable:e.disabled,itemBaseInfo:e.itemBaseInfo,namespace:e.namespace},on:{clearScript:e.clearScript}})],1)],1)},i=[],a=(n("28eb"),n("0894"),n("6dea")),o=n("a780"),r=n("0fb6"),c=n("cf00"),p={name:"Event",props:["info","readonly","itemBaseInfo","disabled","namespace"],data(){return{eventOpts:[],eventInfo:{type:"",scripts:[]}}},components:{EventSet:o["default"]},methods:{init(){this.eventInfo={type:"",scripts:this.info&&this.info.length>0?this.info.reduce((e,t)=>{const{type:n,available_transition:s}=t;return"workitem_submit_after"===n&&s&&"_all"===s[0]&&(t.available_transition=[this.$t("wfDesigner.scriptBatch.all")]),t.isNative=!0,e[n]?e[n].push(Object(c["a"])(t)):e[n]=[Object(c["a"])(t)],e},{}):[]};let e="edge"===this.itemBaseInfo.type?"Transition":"node"===this.itemBaseInfo.type?this.itemBaseInfo.model.type:"";this.eventOpts="flow"===this.itemBaseInfo.type?Object(a["g"])():Object(a["e"])(e),this.eventInfo.type=this.eventOpts[0].value,this.eventInfo.scripts[this.eventInfo.type]||(this.eventInfo.scripts[this.eventInfo.type]=[]),this.$nextTick(()=>{const e=this.$refs.eventSetRef;e&&(e.gridOptions.data=this.eventInfo.scripts[this.eventInfo.type])})},clearScript(e){this.eventInfo.scripts[e]=[]},changeType(e){this.eventInfo.scripts[e]||(this.eventInfo.scripts[e]=[]);const t=this.$refs.eventSetRef;t&&(t.gridOptions.data=this.eventInfo.scripts[e])},save(){const e=[...Object.keys(this.eventInfo.scripts)].reduce((e,t)=>{const n=this.eventInfo.scripts[t].map(e=>{delete e._XID;let n=e.available_transition;return n&&n[0]===this.$t("wfDesigner.scriptBatch.all")&&(e.available_transition=["_all"]),"workitem_submit_after"!==t||n||(e.available_transition=[]),e});return e.concat(n)},[]);return Object(r["b"])(e,this.info)}},watch:{info:{handler:function(){this.init()},immediate:!0}}},l=p,f=n("2be6"),v=Object(f["a"])(l,s,i,!1,null,null,null);t["default"]=v.exports}}]);