工业互联网平台脚手架前端代码
houzhongjian
2024-09-18 23db5e5c6bfcbd7030a4003cd4ea18fbb920024f
1
import{H as ce,r as O,o as s,c as r,C as i,k as P,B as G,a as C,I as H,aw as pe,E as fe,G as ge,ax as Ce,ay as ue,az as Ne,ad as w,b as he,w as _,aA as ve,a1 as me,aB as ye,D as b,F as U,P as q,aC as K,h,O as ke,n as Q,i as be,g as X,d as we}from"./index-BP6bNRoi.js";const L=e=>(fe("data-v-df1f3d16"),e=e(),ge(),e),Le={class:"add-node-btn-box"},Pe={class:"add-node-btn"},Ue={class:"add-node-popover-body"},xe=[L(()=>i("div",{class:"item-wrapper"},[i("span",{class:"iconfont"},"\uE8EF")],-1)),L(()=>i("p",null,"\u5BA1\u6279\u4EBA",-1))],De=[L(()=>i("div",{class:"item-wrapper"},[i("span",{class:"iconfont"},"\uE93B")],-1)),L(()=>i("p",null,"\u6284\u9001\u4EBA",-1))],Se=[L(()=>i("div",{class:"item-wrapper"},[i("span",{class:"iconfont"},"\uE9BE")],-1)),L(()=>i("p",null,"\u6761\u4EF6\u5206\u652F",-1))],Oe=L(()=>i("button",{class:"btn",type:"button"},[i("span",{class:"iconfont"},"\uE95B")],-1)),V=ce({__name:"addNode",props:{childNodeP:{type:Object,default:()=>({})}},emits:["update:childNodeP"],setup(e,{emit:c}){let a=e,o=c,l=O(!1);const u=v=>{var p;l.value=!1,v!=4?(v==1?p={nodeName:"\u5BA1\u6838\u4EBA",error:!0,type:1,settype:1,selectMode:0,selectRange:0,directorLevel:1,examineMode:1,noHanderAction:1,examineEndDirectorLevel:0,childNode:a.childNodeP,nodeUserList:[]}:v==2&&(p={nodeName:"\u6284\u9001\u4EBA",type:2,ccSelfSelectFlag:1,childNode:a.childNodeP,nodeUserList:[]}),o("update:childNodeP",p)):o("update:childNodeP",{nodeName:"\u8DEF\u7531",type:4,childNode:null,conditionNodes:[{nodeName:"\u6761\u4EF61",error:!0,type:3,priorityLevel:1,conditionList:[],nodeUserList:[],childNode:a.childNodeP},{nodeName:"\u6761\u4EF62",type:3,priorityLevel:2,conditionList:[],nodeUserList:[],childNode:null}]})};return(v,p)=>{const y=pe;return s(),r("div",Le,[i("div",Pe,[P(y,{placement:"right-start",modelValue:C(l),"onUpdate:modelValue":p[3]||(p[3]=f=>H(l)?l.value=f:l=f),width:"auto"},{reference:G(()=>[Oe]),default:G(()=>[i("div",Ue,[i("a",{class:"add-node-popover-item approver",onClick:p[0]||(p[0]=f=>u(1))},xe),i("a",{class:"add-node-popover-item notifier",onClick:p[1]||(p[1]=f=>u(2))},De),i("a",{class:"add-node-popover-item condition",onClick:p[2]||(p[2]=f=>u(4))},Se)])]),_:1},8,["modelValue"])])])}}},[["__scopeId","data-v-df1f3d16"]]),A=e=>{if(e)return e.map(c=>c.name).toString()},Y=e=>{if(e.settype==1){if(e.nodeUserList.length==1)return e.nodeUserList[0].name;if(e.nodeUserList.length>1){if(e.examineMode==1)return A(e.nodeUserList);if(e.examineMode==2)return e.nodeUserList.length+"\u4EBA\u4F1A\u7B7E"}}else if(e.settype==2){const c=e.directorLevel==1?"\u76F4\u63A5\u4E3B\u7BA1":"\u7B2C"+e.directorLevel+"\u7EA7\u4E3B\u7BA1";if(e.examineMode==1)return c;if(e.examineMode==2)return c+"\u4F1A\u7B7E"}else{if(e.settype==4)return e.selectRange==1?"\u53D1\u8D77\u4EBA\u81EA\u9009":e.nodeUserList.length>0?e.selectRange==2?"\u53D1\u8D77\u4EBA\u81EA\u9009":"\u53D1\u8D77\u4EBA\u4ECE"+e.nodeUserList[0].name+"\u4E2D\u81EA\u9009":"";if(e.settype==5)return"\u53D1\u8D77\u4EBA\u81EA\u5DF1";if(e.settype==7)return"\u4ECE\u76F4\u63A5\u4E3B\u7BA1\u5230\u901A\u8BAF\u5F55\u4E2D\u7EA7\u522B\u6700\u9AD8\u7684\u7B2C"+e.examineEndDirectorLevel+"\u4E2A\u5C42\u7EA7\u4E3B\u7BA1"}},Z=e=>e.nodeUserList.length!=0?A(e.nodeUserList):e.ccSelfSelectFlag==1?"\u53D1\u8D77\u4EBA\u81EA\u9009":void 0,ee=(e,c)=>{const{conditionList:a,nodeUserList:o}=e.conditionNodes[c];if(a.length==0)return c==e.conditionNodes.length-1&&e.conditionNodes[0].conditionList.length!=0?"\u5176\u4ED6\u6761\u4EF6\u8FDB\u5165\u6B64\u6D41\u7A0B":"\u8BF7\u8BBE\u7F6E\u6761\u4EF6";{let l="";for(let u=0;u<a.length;u++){const{columnId:v,columnType:p,showType:y,showName:f,optType:m,zdy1:k,opt1:T,zdy2:x,opt2:$,fixedDownBoxValue:j}=a[u];v==0&&o.length!=0&&(l+="\u53D1\u8D77\u4EBA\u5C5E\u4E8E\uFF1A",l+=o.map(F=>F.name).join("\u6216")+" \u5E76\u4E14 "),p=="String"&&y=="3"&&k&&(l+=f+"\u5C5E\u4E8E\uFF1A"+_e(k,JSON.parse(j))+" \u5E76\u4E14 "),p=="Double"&&(m!=6&&k?l+=`${f} ${["","<",">","\u2264","=","\u2265"][m]} ${k} \u5E76\u4E14 `:m==6&&k&&x&&(l+=`${k} ${T} ${f} ${$} ${x} \u5E76\u4E14 `))}return l?l.substring(0,l.length-4):"\u8BF7\u8BBE\u7F6E\u6761\u4EF6"}},_e=(e,c)=>{const a=[],o=e.split(",");for(const l in c)o.map(u=>{u==l&&a.push(c[l].value)});return a.join("\u6216")},Te=["87, 106, 149","255, 148, 62","50, 150, 250"],$e=["\u53D1\u8D77\u4EBA","\u5BA1\u6838\u4EBA","\u6284\u9001\u4EBA"],je=ue("simpleWorkflow",{state:()=>({tableId:"",isTried:!1,promoterDrawer:!1,flowPermission1:{},approverDrawer:!1,approverConfig1:{},copyerDrawer:!1,copyerConfig1:{},conditionDrawer:!1,conditionsConfig1:{conditionNodes:[]}}),actions:{setTableId(e){this.tableId=e},setIsTried(e){this.isTried=e},setPromoter(e){this.promoterDrawer=e},setFlowPermission(e){this.flowPermission1=e},setApprover(e){this.approverDrawer=e},setApproverConfig(e){this.approverConfig1=e},setCopyer(e){this.copyerDrawer=e},setCopyerConfig(e){this.copyerConfig1=e},setCondition(e){this.conditionDrawer=e},setConditionsConfig(e){this.conditionsConfig1=e}}}),Fe=()=>je(Ce),Ie={key:0,class:"node-wrap"},Je={key:0},Ve={class:"iconfont"},Ae=["placeholder"],Be={class:"text"},Me={key:0,class:"placeholder"},ze=i("i",{class:"anticon anticon-right arrow"},null,-1),Ee={key:0,class:"error_tip"},We=[i("i",{class:"anticon anticon-exclamation-circle"},null,-1)],Re={key:1,class:"branch-wrap"},Ge={class:"branch-box-wrap"},He={class:"branch-box"},qe={class:"condition-node"},Ke={class:"condition-node-box"},Qe=["onClick"],Xe={class:"title-wrapper"},Ye=["onBlur","onUpdate:modelValue"],Ze=["onClick"],eo=["onClick"],oo=["onClick"],no=["onClick"],io=["onClick"],to={key:2,class:"error_tip"},lo=[i("i",{class:"anticon anticon-exclamation-circle"},null,-1)],so=i("div",{class:"top-left-cover-line"},null,-1),ao=i("div",{class:"bottom-left-cover-line"},null,-1),ro=i("div",{class:"top-right-cover-line"},null,-1),co=i("div",{class:"bottom-right-cover-line"},null,-1),po={__name:"nodeWrap",props:{nodeConfig:{type:Object,default:()=>({})},flowPermission:{type:Object,default:()=>[]}},emits:["update:flowPermission","update:nodeConfig"],setup(e,{emit:c}){let a=Ne().uid,o=e,l=w(()=>$e[o.nodeConfig.type]),u=w(()=>o.nodeConfig.type==0?A(o.flowPermission)||"\u6240\u6709\u4EBA":o.nodeConfig.type==1?Y(o.nodeConfig):Z(o.nodeConfig)),v=O([]),p=O(!1);const y=()=>{for(var n=0;n<o.nodeConfig.conditionNodes.length;n++)o.nodeConfig.conditionNodes[n].error=ee(o.nodeConfig,n)=="\u8BF7\u8BBE\u7F6E\u6761\u4EF6"&&n!=o.nodeConfig.conditionNodes.length-1};he(()=>{o.nodeConfig.type==1?o.nodeConfig.error=!Y(o.nodeConfig):o.nodeConfig.type==2?o.nodeConfig.error=!Z(o.nodeConfig):o.nodeConfig.type==4&&y()});let f=c,m=Fe(),{setPromoter:k,setApprover:T,setCopyer:x,setCondition:$,setFlowPermission:j,setApproverConfig:F,setCopyerConfig:oe,setConditionsConfig:ne}=m,D=w(()=>m.isTried),ie=w(()=>m.flowPermission1),de=w(()=>m.approverConfig1),te=w(()=>m.copyerConfig1),le=w(()=>m.conditionsConfig1);_(ie,n=>{n.flag&&n.id===a&&f("update:flowPermission",n.value)}),_(de,n=>{n.flag&&n.id===a&&f("update:nodeConfig",n.value)}),_(te,n=>{n.flag&&n.id===a&&f("update:nodeConfig",n.value)}),_(le,n=>{n.flag&&n.id===a&&f("update:nodeConfig",n.value)});const B=n=>{n||n===0?v.value[n]=!0:p.value=!0},M=n=>{n||n===0?(v.value[n]=!1,o.nodeConfig.conditionNodes[n].nodeName=o.nodeConfig.conditionNodes[n].nodeName||"\u6761\u4EF6"):(p.value=!1,o.nodeConfig.nodeName=o.nodeConfig.nodeName||l)},se=()=>{f("update:nodeConfig",o.nodeConfig.childNode)},ae=()=>{let n=o.nodeConfig.conditionNodes.length+1;o.nodeConfig.conditionNodes.push({nodeName:"\u6761\u4EF6"+n,type:3,priorityLevel:n,conditionList:[],nodeUserList:[],childNode:null}),y(),f("update:nodeConfig",o.nodeConfig)},z=(n,d)=>{n.childNode?z(n.childNode,d):n.childNode=d},I=n=>{var{type:d}=o.nodeConfig;d==0?(k(!0),j({value:o.flowPermission,flag:!1,id:a})):d==1?(T(!0),F({value:{...JSON.parse(JSON.stringify(o.nodeConfig)),settype:o.nodeConfig.settype?o.nodeConfig.settype:1},flag:!1,id:a})):d==2?(x(!0),oe({value:JSON.parse(JSON.stringify(o.nodeConfig)),flag:!1,id:a})):($(!0),ne({value:JSON.parse(JSON.stringify(o.nodeConfig)),priorityLevel:n,flag:!1,id:a}))},E=(n,d=1)=>{o.nodeConfig.conditionNodes[n]=o.nodeConfig.conditionNodes.splice(n+d,1,o.nodeConfig.conditionNodes[n])[0],o.nodeConfig.conditionNodes.map((S,J)=>{S.priorityLevel=J+1}),y(),f("update:nodeConfig",o.nodeConfig)};return(n,d)=>{const S=ve("nodeWrap",!0),J=me("focus");return s(),r(U,null,[e.nodeConfig.type<3?(s(),r("div",Ie,[i("div",{class:Q(["node-wrap-box",(e.nodeConfig.type==0?"start-node ":"")+(C(D)&&e.nodeConfig.error?"active error":"")])},[i("div",{class:"title",style:ye(`background: rgb(${C(Te)[e.nodeConfig.type]});`)},[e.nodeConfig.type==0?(s(),r("span",Je,b(e.nodeConfig.nodeName),1)):(s(),r(U,{key:1},[i("span",Ve,b(e.nodeConfig.type==1?"\uE8EF":"\uE93B"),1),C(p)?q((s(),r("input",{key:0,type:"text",class:"ant-input editable-title-input",onBlur:d[0]||(d[0]=t=>M()),onFocus:d[1]||(d[1]=t=>t.currentTarget.select()),"onUpdate:modelValue":d[2]||(d[2]=t=>e.nodeConfig.nodeName=t),placeholder:C(l)},null,40,Ae)),[[J],[K,e.nodeConfig.nodeName]]):(s(),r("span",{key:1,class:"editable-title",onClick:d[3]||(d[3]=t=>B())},b(e.nodeConfig.nodeName),1)),i("i",{class:"anticon anticon-close close",onClick:se})],64))],4),i("div",{class:"content",onClick:I},[i("div",Be,[C(u)?h("",!0):(s(),r("span",Me,"\u8BF7\u9009\u62E9"+b(C(l)),1)),ke(" "+b(C(u)),1)]),ze]),C(D)&&e.nodeConfig.error?(s(),r("div",Ee,We)):h("",!0)],2),P(V,{childNodeP:e.nodeConfig.childNode,"onUpdate:childNodeP":d[4]||(d[4]=t=>e.nodeConfig.childNode=t)},null,8,["childNodeP"])])):h("",!0),e.nodeConfig.type==4?(s(),r("div",Re,[i("div",Ge,[i("div",He,[i("button",{class:"add-branch",onClick:ae},"\u6DFB\u52A0\u6761\u4EF6"),(s(!0),r(U,null,be(e.nodeConfig.conditionNodes,(t,N)=>(s(),r("div",{class:"col-box",key:N},[i("div",qe,[i("div",Ke,[i("div",{class:Q(["auto-judge",C(D)&&t.error?"error active":""])},[N!=0?(s(),r("div",{key:0,class:"sort-left",onClick:g=>E(N,-1)},"<",8,Qe)):h("",!0),i("div",Xe,[C(v)[N]?q((s(),r("input",{key:0,type:"text",class:"ant-input editable-title-input",onBlur:g=>M(N),onFocus:d[5]||(d[5]=g=>g.currentTarget.select()),"onUpdate:modelValue":g=>t.nodeName=g},null,40,Ye)),[[K,t.nodeName]]):(s(),r("span",{key:1,class:"editable-title",onClick:g=>B(N)},b(t.nodeName),9,Ze)),i("span",{class:"priority-title",onClick:g=>I(t.priorityLevel)},"\u4F18\u5148\u7EA7"+b(t.priorityLevel),9,eo),i("i",{class:"anticon anticon-close close",onClick:g=>(re=>{o.nodeConfig.conditionNodes.splice(re,1),o.nodeConfig.conditionNodes.map((W,R)=>{W.priorityLevel=R+1,W.nodeName=`\u6761\u4EF6${R+1}`}),y(),f("update:nodeConfig",o.nodeConfig),o.nodeConfig.conditionNodes.length==1&&(o.nodeConfig.childNode&&(o.nodeConfig.conditionNodes[0].childNode?z(o.nodeConfig.conditionNodes[0].childNode,o.nodeConfig.childNode):o.nodeConfig.conditionNodes[0].childNode=o.nodeConfig.childNode),f("update:nodeConfig",o.nodeConfig.conditionNodes[0].childNode))})(N)},null,8,oo)]),N!=e.nodeConfig.conditionNodes.length-1?(s(),r("div",{key:1,class:"sort-right",onClick:g=>E(N)},">",8,no)):h("",!0),i("div",{class:"content",onClick:g=>I(t.priorityLevel)},b(C(ee)(e.nodeConfig,N)),9,io),C(D)&&t.error?(s(),r("div",to,lo)):h("",!0)],2),P(V,{childNodeP:t.childNode,"onUpdate:childNodeP":g=>t.childNode=g},null,8,["childNodeP","onUpdate:childNodeP"])])]),t.childNode?(s(),X(S,{key:0,nodeConfig:t.childNode,"onUpdate:nodeConfig":g=>t.childNode=g},null,8,["nodeConfig","onUpdate:nodeConfig"])):h("",!0),N==0?(s(),r(U,{key:1},[so,ao],64)):h("",!0),N==e.nodeConfig.conditionNodes.length-1?(s(),r(U,{key:2},[ro,co],64)):h("",!0)]))),128))]),P(V,{childNodeP:e.nodeConfig.childNode,"onUpdate:childNodeP":d[6]||(d[6]=t=>e.nodeConfig.childNode=t)},null,8,["childNodeP"])])])):h("",!0),e.nodeConfig.childNode?(s(),X(S,{key:2,nodeConfig:e.nodeConfig.childNode,"onUpdate:nodeConfig":d[7]||(d[7]=t=>e.nodeConfig.childNode=t)},null,8,["nodeConfig"])):h("",!0)],64)}}},fo={class:"dingflow-design"},go={class:"box-scale"},Co=i("div",{class:"end-node"},[i("div",{class:"end-node-circle"}),i("div",{class:"end-node-text"},"\u6D41\u7A0B\u7ED3\u675F")],-1),uo=we({name:"SimpleWorkflowDesignEditor",__name:"index",setup(e){let c=O({nodeName:"\u53D1\u8D77\u4EBA",type:0,id:"root",formPerms:{},nodeUserList:[],childNode:{}});return(a,o)=>(s(),r("div",null,[i("section",fo,[i("div",go,[P(po,{nodeConfig:C(c),"onUpdate:nodeConfig":o[0]||(o[0]=l=>H(c)?c.value=l:c=l)},null,8,["nodeConfig"]),Co])])]))}});export{uo as default};