(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d2248a6"],{e126:function(e,t,i){"use strict";i.r(t);var n=function(){var e=this,t=e._self._c;return t("div",{staticClass:"initor-wrapper"},[t("div",[t("a-space",{attrs:{size:e.GLOBAL.spaceDefault}},[t("span",{attrs:{type:"link"}},[e._v(" "+e._s(e.$t("wfDesigner.itemConfig.initor.label"))+" ")]),t("c-popover",{directives:[{name:"show",rawName:"v-show",value:!e.disabled,expression:"!disabled"}],attrs:{placement:"left",visible:e.isSelectShow,trigger:"click",footerButtons:e.footerButtons},on:{visibleChange:e.visibleChange,close:()=>e.isSelectShow=!1}},[t("template",{slot:"content"},[e.isSelectShow?t("UnitSelect",{ref:"unitSelect",attrs:{cacheUnit:e.checkedData,tempKey:e.currTempKey,type:"initor"},on:{sureSelect:e.afterSelect,changeLoading:e.changeLoading}}):e._e()],1),t("span",{on:{click:e.addInitor}},[t("plm-icon",{staticClass:"plm-icon-btn",attrs:{"icon-class":"op_edit"}})],1)],2)],1)],1),t("vxe-table",{ref:"initorTableRef",attrs:{size:e.GLOBAL.tableSize,"empty-text":e.$t("wfDesigner.itemConfig.initor.empty"),"auto-resize":!0,"keep-source":!0,border:!0,"show-overflow":"tooltip","edit-config":{trigger:"click",mode:"cell"},data:e.initorData}},[t("vxe-column",{attrs:{field:"name",title:e.$t("wfDesigner.itemConfig.initor.name"),width:e.disabled?200:150}}),t("vxe-column",{attrs:{field:"typeName",title:e.$t("wfDesigner.itemConfig.initor.type")}}),e.disabled?e._e():t("vxe-column",{attrs:{title:e.$t("wfDesigner.itemConfig.initor.operation"),width:"95"},scopedSlots:e._u([{key:"default",fn:function({rowIndex:i}){return[t("a-space",{attrs:{size:e.GLOBAL.spaceSmall}},[t("span",{staticClass:"plm-table-btn",on:{click:function(t){return e.removeInitor(i)}}},[e._v(" "+e._s(e.$t("wfDesigner.itemConfig.initor.delBtn"))+" ")])])]}}],null,!1,4226926103)})],1)],1)},a=[],r=(i("28eb"),i("b5c4")),o=i("4815"),s=i("9d03"),l=i("0fb6"),c=i("c976"),p={name:"Initor",mixins:[c["a"]],props:["info","disabled","namespace"],components:{UnitSelect:r["a"]},data(){return{footerButtons:[{name:"wfDesigner.unitSelect.sureBtn",type:"primary",loading:!1,event:()=>{this.$refs.unitSelect.sureSelect()}}],checkedData:{person:[],role:[],org:[]},isSelectShow:!1,initorData:[],allMember:[],typeObj:{person:this.$t("wfDesigner.configMapper.partiTypeMap.person"),department:this.$t("wfDesigner.configMapper.partiTypeMap.department"),role:this.$t("wfDesigner.configMapper.partiTypeMap.role")}}},methods:{changeLoading(e){this.footerButtons[0].loading=e},visibleChange(e){this.isSelectShow=e},async init(){let e=this.info?this.info.map(({participant_id:e,entity:t})=>({participant_id:e,...t})):[];if(this.initorData=e.map(e=>Object(s["c"])(e)),this.info&&0!==this.info.length)try{const{existence:e}=await Object(o["b"])({keys:this.info.map(e=>e.entity),strategy:{}});this.handleInitor(e)}catch(t){console.info("获取模板参与者 e",t)}},addInitor(){this.checkedData={person:this.initorData.filter(e=>"person"===e.internal_name),role:this.initorData.filter(e=>"role"===e.internal_name),org:this.initorData.filter(e=>"department"===e.internal_name)},this.isSelectShow=!0},afterSelect(e){let t=e.map(({internal_name:e,object_id:t,participant_id:i,name:n})=>({internal_name:e,object_id:t,participant_id:i,name:n,typeName:this.typeObj[e]}));this.initorData=this.initorData.concat(t),this.isSelectShow=!1},removeInitor(e){this.initorData.splice(e,1)},handleInitor(e){if(!e||0===e.length)return;let t=e.reduce((e,t)=>{let i=`${t.internal_name}-${t.object_id}`;return e[i]=t,e},{});this.initorData.forEach(e=>{let i=`${e.internal_name}-${e.object_id}`;const n=t[i];e.name=n.name,e.typeName=this.typeObj[e.internal_name]});const i=this.$refs.initorTableRef;i&&i.updateData()},save(){let e=Object(l["c"])(this.initorData,this.info);return e.map(e=>({participant_id:e.participant_id,op_type:e.op_type}))}},watch:{info:{handler:function(e){this.init()},immediate:!0}}},d=p,h=i("2be6"),f=Object(h["a"])(d,n,a,!1,null,null,null);t["default"]=f.exports}}]);