hn-workflow-components 1.0.7 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -37755,7 +37755,7 @@ function pz({ id: e, value: t, onChange: n }) {
|
|
|
37755
37755
|
(async () => {
|
|
37756
37756
|
var f, m;
|
|
37757
37757
|
if (r) {
|
|
37758
|
-
const g = await r(
|
|
37758
|
+
const g = await r();
|
|
37759
37759
|
i(g);
|
|
37760
37760
|
return;
|
|
37761
37761
|
}
|
|
@@ -37787,7 +37787,7 @@ function Zf({ id: e, value: t, onChange: n }) {
|
|
|
37787
37787
|
(async () => {
|
|
37788
37788
|
var f, m;
|
|
37789
37789
|
if (r) {
|
|
37790
|
-
const g = await r(
|
|
37790
|
+
const g = await r();
|
|
37791
37791
|
i(g);
|
|
37792
37792
|
return;
|
|
37793
37793
|
}
|
|
@@ -38782,7 +38782,8 @@ const Jx = {
|
|
|
38782
38782
|
value: {
|
|
38783
38783
|
onSave: o.onSave,
|
|
38784
38784
|
onPublish: o.onPublish,
|
|
38785
|
-
onSelectMembers: o.onSelectMembers
|
|
38785
|
+
onSelectMembers: o.onSelectMembers,
|
|
38786
|
+
onSelectRoles: o.onSelectRoles
|
|
38786
38787
|
},
|
|
38787
38788
|
children: /* @__PURE__ */ I(
|
|
38788
38789
|
_L,
|
|
@@ -38835,8 +38836,7 @@ const rF = Ye((e) => {
|
|
|
38835
38836
|
tF,
|
|
38836
38837
|
{
|
|
38837
38838
|
materialUis: Jx,
|
|
38838
|
-
|
|
38839
|
-
processName: e.processName
|
|
38839
|
+
...e
|
|
38840
38840
|
}
|
|
38841
38841
|
) }))), PF = Ye((e) => (kx({
|
|
38842
38842
|
baseURL: e.baseUrl,
|
|
@@ -1323,7 +1323,7 @@ See https://styled-components.com/docs/faqs#why-am-i-getting-a-warning-about-sev
|
|
|
1323
1323
|
bottom: 0;
|
|
1324
1324
|
background: ${e=>{var t;return(t=e.theme.token)==null?void 0:t.colorPrimary}};
|
|
1325
1325
|
height: 2px;
|
|
1326
|
-
`,vL=C.memo(e=>{var s,l;const{value:t,options:n,onChange:r}=e,[o,a]=C.useState(t||((l=(s=e.options)==null?void 0:s[0])==null?void 0:l.key));C.useEffect(()=>{a(t)},[t]);const i=C.useCallback(c=>{a(c),r==null||r(c)},[r]);return $.jsx(pL,{children:n.map(c=>$.jsx(C.Fragment,{children:$.jsxs(mL,{className:o===c.key?"active":void 0,onClick:()=>i(c.key),children:[c.label,o===c.key&&$.jsx(gL,{})]})},c.key))})}),hL={display:"grid",marginTop:"10px"};function bL({form:e}){const t=e.getFieldValue("actions"),n=(t==null?void 0:t.map(g=>g.code))||[],[r,o]=C.useState(n),[a,i]=C.useState(jD),s={wrapperCol:{span:24}},l=()=>{a.forEach(g=>{t.length&&t.forEach(h=>{h.code===g.code&&(g.button=h.button)})}),i(a)};C.useEffect(()=>{l()},[t]);const c=g=>{o(g);const h=[];a.forEach(v=>{v.code&&g.includes(v.code)&&h.push(v)}),e.setFieldValue("actions",h)},d=g=>{const h=JSON.parse(JSON.stringify(a));h.forEach(v=>{v.code===g.code&&(v.edit=!v.edit)}),i(h)},f=(g,h)=>{const v=JSON.parse(JSON.stringify(a));v.forEach(m=>{m.code===h.code&&(m.button=g.target.value)}),i(v)},p=g=>{const h=JSON.parse(JSON.stringify(a)),v=[];h.forEach(m=>{m.code===g.code&&(m.edit=!m.edit),r.includes(m.code)&&v.push(m)}),i(h),e.setFieldValue("actions",v)};return $.jsxs($.Fragment,{children:[$.jsxs(wo,{children:[$.jsx(Xt,{span:12,style:{fontWeight:"bold"},children:"权限名字"}),$.jsx(Xt,{span:12,style:{fontWeight:"bold"},children:"按钮名字"})]}),$.jsx(ts.Group,{style:hL,value:r,onChange:c,children:$.jsx($.Fragment,{children:a.map(g=>$.jsxs(wo,{children:[$.jsx(Xt,{span:12,children:$.jsx(ts,{value:g.code,style:{lineHeight:"32px"},children:g.name})}),!g.edit&&$.jsxs(Xt,{span:12,children:[g.button," ",$.jsx(Ep,{onClick:()=>d(g)})]}),g.edit&&$.jsx(Xt,{span:12,children:$.jsx(Zt,{placeholder:"按钮名字",value:g.button,onChange:h=>f(h,g),onBlur:()=>p(g)})})]},g.code))})}),$.jsx("div",{style:{display:"none"},children:$.jsx(Me.List,{name:"actions",children:g=>$.jsx($.Fragment,{children:g.map((h,v)=>C.createElement(Me.Item,{...s,required:!1,key:v},$.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[$.jsx(Me.Item,{name:[h.name,"code"],noStyle:!0,children:$.jsx(Zt,{placeholder:"权限"})}),$.jsx(Me.Item,{name:[h.name,"name"],noStyle:!0,children:$.jsx(Zt,{placeholder:"权限名字"})}),$.jsx(Me.Item,{name:[h.name,"button"],noStyle:!0,children:$.jsx(Zt,{placeholder:"按钮名字"})})]})))})})})]})}const $x=C.createContext({}),qc=()=>C.useContext($x);function yL({id:e,value:t,onChange:n}){const{onSelectRoles:r}=qc(),[o,a]=C.useState([]),[i,s]=C.useState();C.useEffect(()=>{(async()=>{var f,p;if(r){const g=await r([]);a(g);return}const d=await hx();a(((p=(f=d.data)==null?void 0:f.data)==null?void 0:p.roleList)||[])})()},[]),C.useEffect(()=>{const c=t!=null&&t.ids?t.ids.split(","):[];s(c==null?void 0:c[0])},[t]);const l=c=>{const d=o.find(f=>f.value===c);d?(n==null||n({ids:d.value,names:d.label}),s(d.value)):(n==null||n(void 0),s(void 0))};return $.jsx("div",{id:e,children:$.jsx(Dn,{value:i,options:o,placeholder:"请选择角色",allowClear:!0,showSearch:!0,filterOption:(c,d)=>((d==null?void 0:d.label)??"").toLowerCase().includes(c.toLowerCase()),onChange:l})})}function mm({id:e,value:t,onChange:n}){const{onSelectMembers:r}=qc(),[o,a]=C.useState([]),[i,s]=C.useState([]);C.useEffect(()=>{(async()=>{var f,p;if(r){const g=await r([]);a(g);return}const d=await hx();a(((p=(f=d.data)==null?void 0:f.data)==null?void 0:p.userList)||[])})()},[]),C.useEffect(()=>{const c=t!=null&&t.ids?t.ids.split(","):[];s(c)},[t]);const l=c=>{const d=o.filter(f=>c==null?void 0:c.includes(f.value));if(d&&d.length){const f=d.map(g=>g.value),p=d.map(g=>g.label);n==null||n({ids:f.join(","),names:p.join(",")||""}),s(f)}else n==null||n(void 0),s([])};return $.jsx("div",{id:e,children:$.jsx(Dn,{mode:"multiple",value:i,options:o,placeholder:"请选择成员",onChange:l,filterOption:(c,d)=>((d==null?void 0:d.label)??"").toLowerCase().includes(c.toLowerCase())})})}const gm="userId",Ox="initiator",CL="initiatorDirectManager",SL="initiatorDepartmentManager",vm="role",Nx=[{value:gm,label:"指定成员"},{value:Ox,label:"发起人自己"},{value:CL,label:"发起⼈的直属主管"},{value:SL,label:"发起⼈的部⻔主管"},{value:vm,label:"指定角色"}],xL={display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:8};function hm({form:e,applyType:t="approver"}){const[n,r]=C.useState(e.getFieldValue("groupType")||"userId"),o=C.useMemo(()=>t==="message"?"通知人员":"成员选择",[t]),a=C.useMemo(()=>t==="message"?"通知角色":"角色选择",[t]),i=C.useCallback(()=>{e.setFieldsValue({assignee:void 0,role:void 0})},[e]);return C.useEffect(()=>{e.getFieldValue("groupType")||e.setFieldsValue({groupType:n})},[]),$.jsxs($.Fragment,{children:[$.jsx(Me.Item,{label:"用户类型",name:"groupType",required:!0,children:$.jsx(Rt.Group,{style:xL,onChange:s=>{const l=s.target.value;r(l),i()},children:Nx.map(s=>$.jsx(Rt,{value:s.value,children:s.label},s.value))})}),n==="userId"&&$.jsx($.Fragment,{children:$.jsx(Me.Item,{label:o,name:"assignee",required:!0,rules:[{required:!0,message:`请选择${o}`}],children:$.jsx(mm,{})})}),n==="role"&&$.jsx($.Fragment,{children:$.jsx(Me.Item,{label:a,name:"role",required:!0,rules:[{required:!0,message:`请选择${a}`}],children:$.jsx(yL,{})})})]})}const Ix=[{label:"会签",description:"默认需要所有审批人同意",value:"countersign",needConfig:!0,text:{configTitle:"会签配置",ratioTitle:"会签审核通过比例(%)",numTitle:"会签审核通过数量"}},{label:"或签",description:"一名审批人同意即可通过",value:"orSign",needConfig:!0,text:{configTitle:"或签配置",ratioTitle:"或签审核拒绝比例(%)",numTitle:"或签审核拒绝数量"}},{label:"并签",description:"同时审批通过",value:"andSign",needConfig:!0,text:{configTitle:"并签配置",ratioTitle:"并签审核通过比例(%)",numTitle:"并签审核通过数量"}},{label:"依次审批",description:"按审批顺序依次审批",value:"serialSign",needConfig:!1}],wL={display:"flex",flexDirection:"column",gap:8},Px={display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:8};function EL({form:e}){var c,d,f;const[t,n]=C.useState(),[r,o]=C.useState(e.getFieldValue("signConfig.useRatio")||!0),a=Me.useWatch("groupType",e),i=Me.useWatch(["approver_is_empty","type"],e),s=Me.useWatch(["comment_setting","type"],e),l=p=>{const g=Ix.find(h=>h.value===p);n(g)};return C.useEffect(()=>{l(e.getFieldValue("approverType")||"countersign")},[e]),$.jsxs($.Fragment,{children:[$.jsx(hm,{form:e}),a!==Ox&&$.jsxs($.Fragment,{children:[$.jsx(Me.Item,{label:"多人审批时采用的审批方式",name:"approverType",required:!0,children:$.jsx(Rt.Group,{style:wL,onChange:p=>{l(p.target.value)},children:Ix.map(p=>$.jsxs(Rt,{value:p.value,children:[p.label,"(",p.description,")"]},p.value))})}),(t==null?void 0:t.needConfig)&&$.jsxs($.Fragment,{children:[$.jsx("p",{children:(c=t==null?void 0:t.text)==null?void 0:c.configTitle}),$.jsx(Me.Item,{layout:"horizontal",label:"类型",name:["signConfig","useRatio"],rules:[{required:!0}],children:$.jsx(is,{checkedChildren:"按比例",unCheckedChildren:"按数量",onChange:o})}),r&&$.jsx(Me.Item,{layout:"horizontal",label:(d=t==null?void 0:t.text)==null?void 0:d.ratioTitle,name:["signConfig","ratio"],rules:[{required:!0,message:"请输入比例"}],children:$.jsx(ns,{min:1,max:100,step:1,precision:2})}),!r&&$.jsx(Me.Item,{layout:"horizontal",label:(f=t==null?void 0:t.text)==null?void 0:f.numTitle,name:["signConfig","num"],rules:[{required:!0,message:"请输入数量"}],children:$.jsx(ns,{min:1,step:1,precision:0})})]})]}),$.jsx(Me.Item,{label:"审批人包含发起人时",name:["initiator_is_included","type"],required:!0,children:$.jsxs(Rt.Group,{style:Px,children:[$.jsx(Rt,{value:"require_process",children:"发起人继续处理"}),$.jsx(Rt,{value:"auto_pass",children:"发起人不用处理"}),$.jsx(Rt,{value:"forward_initiatorDirectManager",children:"转交给发起人直属主管处理"}),$.jsx(Rt,{value:"forward_initiatorDepartmentManager",children:"转交给发起人部门主管处理"})]})}),$.jsx(Me.Item,{label:"审批人为空时",name:["approver_is_empty","type"],required:!0,children:$.jsxs(Rt.Group,{style:Px,children:[$.jsx(Rt,{value:"auto_pass",children:"自动通过"}),$.jsx(Rt,{value:"auto_refuse",children:"自动拒绝"}),$.jsx(Rt,{value:"assign_approver",children:"指定人员"}),$.jsx(Rt,{value:"prompt_error",children:"报错提醒"})]})}),i==="assign_approver"&&$.jsx($.Fragment,{children:$.jsx(Me.Item,{label:"指定人员",name:["approver_is_empty","user"],required:!0,rules:[{required:!0,message:"请选择指定人员"}],children:$.jsx(mm,{})})}),$.jsx(Me.Item,{label:"审批被拒绝时",name:["approval_is_refused","type"],required:!0,rules:[{required:!0,message:"请选择审批被拒绝时的操作"}],children:$.jsxs(Rt.Group,{children:[$.jsx(Rt,{value:"end_process",children:"直接结束流程"}),$.jsx(Rt,{value:"back_to_initiator",children:"退回到发起人"})]})}),$.jsx(Me.Item,{label:"审批意⻅设置",name:["comment_setting","type"],required:!0,rules:[{required:!0,message:"请选择审批被拒绝时的操作"}],children:$.jsxs(Rt.Group,{children:[$.jsx(Rt,{value:"everyone",children:"所有人可见"}),$.jsx(Rt,{value:"assign_approver",children:"指定人员可见"})]})}),s==="assign_approver"&&$.jsx($.Fragment,{children:$.jsx(Me.Item,{label:"指定人员",name:["comment_setting","user"],required:!0,rules:[{required:!0,message:"请选择指定人员"}],children:$.jsx(mm,{})})})]})}function $L(){const e={labelCol:{xs:{span:24},sm:{span:5}},wrapperCol:{xs:{span:24},sm:{span:24}}};return $.jsx(Me.List,{name:"extended",children:(t,{add:n,remove:r},{errors:o})=>$.jsxs($.Fragment,{children:[t.map((a,i)=>C.createElement(Me.Item,{...e,required:!1,key:i},$.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[$.jsx(Me.Item,{name:[a.name,"name"],noStyle:!0,children:$.jsx(Zt,{placeholder:"扩展名"})}),$.jsx(Me.Item,{name:[a.name,"code"],noStyle:!0,children:$.jsx(Zt,{placeholder:"扩展值"})}),$.jsx(xc,{onClick:()=>{r(a.name)}})]}))),$.jsxs(Me.Item,{children:[$.jsx(Nt,{type:"dashed",onClick:()=>n(),style:{width:"100%"},icon:$.jsx(oo,{}),children:"添加扩展"}),$.jsx(Me.ErrorList,{errors:o})]})]})})}function OL(){const e={labelCol:{xs:{span:24},sm:{span:5}},wrapperCol:{xs:{span:24},sm:{span:24}}};return $.jsxs("div",{children:[$.jsxs(wo,{gutter:10,style:{marginBottom:"20px",background:"#fafafa",lineHeight:"40px"},children:[$.jsx(Xt,{span:12,style:{paddingLeft:"10px",fontWeight:"bold"},children:"表单字段"}),$.jsx(Xt,{span:12,style:{fontWeight:"bold"},children:"操作"})]}),$.jsx(Me.List,{name:"formConfig",children:(t,{add:n,remove:r},{errors:o})=>$.jsxs($.Fragment,{children:[t.map((a,i)=>C.createElement(Me.Item,{...e,required:!1,key:i},$.jsxs(wo,{gutter:10,children:[$.jsx(Xt,{span:12,children:$.jsx(Me.Item,{name:[a.name,"name"],noStyle:!0,children:$.jsx(Zt,{placeholder:"字段名"})})}),$.jsx(Xt,{span:10,children:$.jsx(Me.Item,{name:[a.name,"operate"],noStyle:!0,children:$.jsxs(Rt.Group,{defaultValue:"1",children:[$.jsx(Rt,{value:"1",children:"只读"}),$.jsx(Rt,{value:"2",children:"编辑"}),$.jsx(Rt,{value:"3",children:"隐藏"})]})})}),$.jsx(Xt,{span:2,children:$.jsx(xc,{onClick:()=>{r(a.name)}})})]}))),$.jsxs(Me.Item,{children:[$.jsx(Nt,{type:"dashed",onClick:()=>n(),style:{width:"100%"},icon:$.jsx(oo,{}),children:"添加字段"}),$.jsx(Me.ErrorList,{errors:o})]})]})})]})}function _x({name:e}){return $.jsxs($.Fragment,{children:[$.jsx(Me.Item,{label:"请求地址",required:!0,name:[...e,"api_request_url"],rules:[{required:!0,message:"请输入请求地址"},{type:"url",message:"请输入正确的URL地址"}],children:$.jsx(Zt,{placeholder:"请输入请求地址"})}),$.jsx(Me.Item,{label:"请求头",tooltip:"请求头格式为JSON字符串",name:[...e,"api_request_headers"],children:$.jsx(Zt.TextArea,{autoSize:{minRows:4,maxRows:6},placeholder:"请输入请求头"})}),$.jsx(Me.Item,{label:"请求体",tooltip:"请求体格式为JSON字符串",name:[...e,"api_request_body"],children:$.jsx(Zt.TextArea,{autoSize:{minRows:4,maxRows:6},placeholder:"请输入请求体"})})]})}function NL({form:e}){const t=Me.useWatch(["listeners","task_create","open"],e),n=Me.useWatch(["listeners","task_finish","open"],e);return $.jsxs($.Fragment,{children:[$.jsx(Me.Item,{label:"创建任务",name:["listeners","task_create","open"],children:$.jsx(is,{checkedChildren:"开启",unCheckedChildren:"关闭"})}),t&&$.jsx(_x,{name:["listeners","task_create"]}),$.jsx(Me.Item,{label:"任务完成",name:["listeners","task_finish","open"],children:$.jsx(is,{checkedChildren:"开启",unCheckedChildren:"关闭"})}),n&&$.jsx(_x,{name:["listeners","task_finish"]})]})}const IL=C.memo(C.forwardRef((e,t)=>{const[n]=Me.useForm(),[r,o]=C.useState("assignee");return C.useImperativeHandle(t,()=>({getValue:()=>n.getFieldsValue(),validateFields:()=>n.validateFields()}),[n]),$.jsxs(Me,{form:n,layout:"vertical",colon:!1,initialValues:e.value,children:[$.jsx(vL,{options:[{key:"assignee",label:"审批人"},{key:"actions",label:"操作权限"},{key:"listeners",label:"监听器"}],value:r,onChange:o}),$.jsx("div",{style:{display:r==="assignee"?"block":"none"},children:$.jsx(EL,{form:n})}),$.jsx("div",{style:{display:r==="actions"?"block":"none"},children:$.jsx(bL,{form:n})}),$.jsx("div",{style:{display:r==="formConfig"?"block":"none"},children:$.jsx(OL,{})}),$.jsx("div",{style:{display:r==="extended"?"block":"none"},children:$.jsx($L,{})}),$.jsx("div",{style:{display:r==="listeners"?"block":"none"},children:$.jsx(NL,{form:n})})]})}));function PL(){return $.jsxs(wo,{gutter:10,style:{marginBottom:20,background:"#fafafa",lineHeight:"40px"},children:[$.jsx(Xt,{span:3,style:{paddingLeft:10,fontWeight:"bold"},children:"关系"}),$.jsx(Xt,{span:9,style:{fontWeight:"bold"},children:"字段"}),$.jsx(Xt,{span:6,style:{fontWeight:"bold"},children:"条件"}),$.jsx(Xt,{span:4,style:{fontWeight:"bold"},children:"条件值"}),$.jsx(Xt,{span:2,style:{fontWeight:"bold"},children:"操作"})]})}const _L=[{label:"且",value:"and"},{label:"或",value:"or"}],TL={and:"&&",or:"||"},Tx={eq:"等于",ne:"不等于",gt:"大于",ge:"大于等于",lt:"小于",le:"小于等于",like:"包含",like_start:"开头包含",like_end:"结尾包含",empty:"为空",not_empty:"不为空"},ML={eq:"=",ne:"!=",gt:">",ge:">=",lt:"<",le:"<=",like:"contains",like_start:"startsWith",like_end:"endsWith",empty:"is empty",not_empty:"is not empty"},DL=["eq","ne"],AL=["eq","ne","gt","ge","lt","le"],jL={text:DL.map(e=>({label:Tx[e],value:e})),number:AL.map(e=>({label:Tx[e],value:e}))},zL={relation:"and",field:"",fieldType:"text",operator:"eq",value:""};function LL(e){const{item:t,fields:n,operatorOptionsByType:r,valueControls:o,onChange:a,onRemove:i}=e,s=C.useMemo(()=>n.map(v=>({label:v.label,value:v.value})),[n]),l=C.useMemo(()=>r[t.fieldType]||[],[r,t.fieldType]),c=t.operator!=="empty"&&t.operator!=="not_empty",d=o[t.fieldType],f=C.useCallback(v=>a({...t,relation:v}),[t,a]),p=C.useCallback(v=>{const m=n.find(w=>w.value===v),b=m?m.type:t.fieldType,y=r[b].map(w=>w.value),x=y.includes(t.operator)?t.operator:y[0];a({...t,field:v,fieldType:b,operator:x,value:x==="empty"||x==="not_empty"?void 0:b==="number"?0:""})},[n,t,a,r]),g=C.useCallback(v=>{const m=v==="empty"||v==="not_empty"?void 0:t.fieldType==="number"?typeof t.value=="number"?t.value:0:typeof t.value=="string"?t.value:"";a({...t,operator:v,value:m})},[t,a]),h=C.useCallback(v=>a({...t,value:v}),[t,a]);return $.jsxs(wo,{gutter:10,style:{marginBottom:8},children:[$.jsx(Xt,{span:3,children:$.jsx(Dn,{placeholder:"关系",options:_L,value:t.relation,onChange:f,style:{width:"100%"}})}),$.jsx(Xt,{span:9,children:$.jsx(Dn,{placeholder:"字段",options:s,value:t.field,onChange:p,style:{width:"100%"}})}),$.jsx(Xt,{span:6,children:$.jsx(Dn,{placeholder:"条件",options:l,value:t.operator,onChange:g,style:{width:"100%"}})}),$.jsx(Xt,{span:4,children:c&&d?$.jsx(d,{value:t.value,onChange:h}):null}),$.jsx(Xt,{span:2,style:{display:"flex",alignItems:"center"},children:$.jsx(xc,{onClick:i})})]})}function FL(e){const{value:t,onChange:n,fields:r,defaultCondition:o,operatorOptionsByType:a,valueControls:i}=e,s=C.useCallback(()=>n([...t||[],o]),[n,t,o]),l=C.useCallback(d=>{const f=[...t];f.splice(d,1),n(f)},[n,t]),c=C.useCallback((d,f)=>{const p=[...t];p[d]=f,n(p)},[n,t]);return $.jsxs($.Fragment,{children:[(t||[]).map((d,f)=>$.jsx(LL,{item:d,fields:r,operatorOptionsByType:a,valueControls:i,onChange:p=>c(f,p),onRemove:()=>l(f)},f)),$.jsx(Nt,{type:"dashed",onClick:s,style:{width:"100%"},icon:$.jsx(oo,{}),children:"添加条件"})]})}const kL={text:({value:e,onChange:t})=>{const n=typeof e=="string"?e:"";return $.jsx(Zt,{value:n,onChange:r=>t(r.target.value),placeholder:"条件值"})},number:({value:e,onChange:t})=>{const n=typeof e=="number"?e:void 0;return $.jsx(ns,{style:{width:"100%"},value:n,onChange:r=>t(typeof r=="number"?r:void 0)})}};function RL(e){const t=["empty","not_empty"];function n(i,s){return i===0||!s?"":` ${TL[s]||""} `}function r(i){let s="";return t.includes(i.operator)||!i.value?"":(i.fieldType==="text"?s=`'${i.value}'`:s=i.value.toString(),` ${s}`)}function o(i){if(!i.field||!i.operator)return"";const s=r(i);if(!t.includes(i.operator)&&!s)return"";const l=ML[i.operator]||"";return`${i.field} ${l}${s}`}if(!e)return"";let a="";return e.forEach((i,s)=>{a+=n(s,i.relation),a+=o(i)}),a?`\${${a}}`:""}function BL(e){const[t,n]=C.useState([]),[r,o]=C.useState([]),a="value"in e,i=C.useMemo(()=>a?e.value||[]:t,[a,e.value,t]),s=C.useCallback(d=>{a||n(d),e.onChange&&e.onChange(d)},[a,e]),l=C.useCallback(d=>s(d),[s]),c=C.useCallback(async d=>{var f,p;try{const g=await Mz(d);o(((p=(f=g.data)==null?void 0:f.data)==null?void 0:p.bizFormJson)||[])}catch(g){console.error("[海牛工作流SDK}] 获取条件单字段失败",g)}},[]);return C.useEffect(()=>{const d=Pz();c(d.key||"")},[c]),$.jsxs("div",{children:[$.jsx(PL,{}),$.jsx(FL,{value:i,onChange:l,fields:r,defaultCondition:zL,operatorOptionsByType:jL,valueControls:kL})]})}const VL=C.memo(C.forwardRef((e,t)=>{const[n]=Me.useForm();return C.useImperativeHandle(t,()=>({getValue:()=>n.getFieldsValue(),validateFields:()=>n.validateFields()}),[n]),$.jsxs(Me,{form:n,layout:"vertical",colon:!1,initialValues:e.value,children:[$.jsx(Me.Item,{name:"conditions",noStyle:!0,children:$.jsx(BL,{onChange:r=>n.setFieldValue("condition",RL(r))})}),$.jsx(Me.Item,{hidden:!0,name:"condition"})]})})),Mx={approverType:"orSign",actions:[{code:"addSigner",name:"加签",button:"加签"}]},HL=C.forwardRef((e,t)=>{const{value:n}=e,[r]=Me.useForm();return C.useImperativeHandle(t,()=>({getValue:()=>r.getFieldsValue(),validateFields:()=>(console.log("validate dispatcher panel",r.getFieldsValue()),r.validateFields())}),[r]),C.useEffect(()=>{r.setFieldsValue({...Mx,...n})},[n,r]),$.jsxs(Me,{form:r,layout:"vertical",colon:!1,initialValues:{...Mx,...n},children:[$.jsx(hm,{form:r}),$.jsx(Me.Item,{label:"多人审批时采用的审批方式",name:"approverType",required:!0,hidden:!0,children:$.jsx(Zt,{})}),$.jsx(Me.Item,{label:"默认操作权限",name:"actions",required:!0,hidden:!0,children:$.jsx(Zt,{})})]})}),WL=C.memo(C.forwardRef((e,t)=>{const[n]=Me.useForm();return C.useImperativeHandle(t,()=>({getValue:()=>n.getFieldsValue(),validateFields:()=>n.validateFields()}),[n]),$.jsx(Me,{form:n,layout:"vertical",colon:!1,initialValues:e.value,children:$.jsx(hm,{form:n})})})),qL=C.memo(C.forwardRef((e,t)=>{const[n]=Me.useForm();return C.useImperativeHandle(t,()=>({getValue:()=>n.getFieldsValue(),validateFields:()=>n.validateFields()}),[n]),$.jsx(Me,{form:n,layout:"vertical",colon:!1,initialValues:e.value,children:$.jsx(Me.Item,{label:"发起人",name:"initiator",children:$.jsx(Zt,{})})})})),UL=[{value:"scrap_apply",label:"报废申请"},{value:"dept_approve",label:"部门审批"},{value:"tech_eval",label:"技术评估"},{value:"asset_approve",label:"资产管理审批"},{value:"finance_approve",label:"财务审批"}],GL=C.memo(C.forwardRef((e,t)=>{const[n]=Me.useForm(),r=(o,a)=>{n.setFieldValue("subProcessName",a.label)};return C.useImperativeHandle(t,()=>({getValue:()=>n.getFieldsValue(),validateFields:()=>n.validateFields()}),[n]),$.jsxs(Me,{form:n,layout:"vertical",colon:!1,initialValues:e.value,children:[$.jsx(tc,{label:"子流程",name:"subProcessId",children:$.jsx(Dn,{placeholder:"请选择子流程",options:UL,onChange:r})}),$.jsx(tc,{hidden:!0,name:"subProcessName",children:$.jsx(Zt,{})})]})}));function bm(e){var n,r,o,a,i;const t=(n=e.config)==null?void 0:n.groupType;return t?t===gm?!!(((o=(r=e.config)==null?void 0:r.assignee)==null?void 0:o.ids)||""):t===vm?!!(((i=(a=e.config)==null?void 0:a.role)==null?void 0:i.ids)||""):!0:!1}function ym(e){var r,o;if(!e)return"";const t=e==null?void 0:e.groupType;let n;if(t){const a=Nx.find(i=>i.value===t);if(a)switch(a.value){case gm:n=((r=e==null?void 0:e.assignee)==null?void 0:r.names)||"";break;case vm:n=((o=e==null?void 0:e.role)==null?void 0:o.names)||"";break;default:n=a.label;break}}return n}const Dx={[ut.approver]:{viewContent:e=>{const t=ym(e.config);return $.jsx(Qa,{secondary:!t,text:t||"选择审批人"})},settersPanel:IL,validate:e=>bm(e)?!0:"未选择审批人"},[ut.condition]:{viewContent:e=>{var n;const t=((n=e.config)==null?void 0:n.conditions)||[];return $.jsx(Qa,{secondary:!t.length,text:t.length?"已配置":"请配置条件"})},settersPanel:VL,validate:e=>e.config?!0:`${e.name}未设置条件`},[ut.notifier]:{viewContent:e=>{const t=ym(e.config);return $.jsx(Qa,{secondary:!t,text:t||"选择抄送人"})},settersPanel:WL,validate:e=>bm(e)?!0:"未选择抄送人"},[ut.start]:{viewContent:e=>{var t;return $.jsx(Qa,{text:`${(t=e.config)==null?void 0:t.initiator}`})},settersPanel:qL},[ut.subProcess]:{viewContent:e=>{var t;return $.jsx(Qa,{text:`${((t=e.config)==null?void 0:t.subProcessName)||"选择子流程"}`})},validate:e=>{var t;return(t=e.config)!=null&&t.subProcessId?!0:"未选择子流程"},settersPanel:GL},[ut.dispatcher]:{viewContent:e=>{const t=ym(e.config);return $.jsx(Qa,{secondary:!t,text:t||"选择分发人"})},settersPanel:HL,validate:e=>(console.log("validate dispatcher",e),bm(e)?!0:"未选择分发人")}},KL=be.div`
|
|
1326
|
+
`,vL=C.memo(e=>{var s,l;const{value:t,options:n,onChange:r}=e,[o,a]=C.useState(t||((l=(s=e.options)==null?void 0:s[0])==null?void 0:l.key));C.useEffect(()=>{a(t)},[t]);const i=C.useCallback(c=>{a(c),r==null||r(c)},[r]);return $.jsx(pL,{children:n.map(c=>$.jsx(C.Fragment,{children:$.jsxs(mL,{className:o===c.key?"active":void 0,onClick:()=>i(c.key),children:[c.label,o===c.key&&$.jsx(gL,{})]})},c.key))})}),hL={display:"grid",marginTop:"10px"};function bL({form:e}){const t=e.getFieldValue("actions"),n=(t==null?void 0:t.map(g=>g.code))||[],[r,o]=C.useState(n),[a,i]=C.useState(jD),s={wrapperCol:{span:24}},l=()=>{a.forEach(g=>{t.length&&t.forEach(h=>{h.code===g.code&&(g.button=h.button)})}),i(a)};C.useEffect(()=>{l()},[t]);const c=g=>{o(g);const h=[];a.forEach(v=>{v.code&&g.includes(v.code)&&h.push(v)}),e.setFieldValue("actions",h)},d=g=>{const h=JSON.parse(JSON.stringify(a));h.forEach(v=>{v.code===g.code&&(v.edit=!v.edit)}),i(h)},f=(g,h)=>{const v=JSON.parse(JSON.stringify(a));v.forEach(m=>{m.code===h.code&&(m.button=g.target.value)}),i(v)},p=g=>{const h=JSON.parse(JSON.stringify(a)),v=[];h.forEach(m=>{m.code===g.code&&(m.edit=!m.edit),r.includes(m.code)&&v.push(m)}),i(h),e.setFieldValue("actions",v)};return $.jsxs($.Fragment,{children:[$.jsxs(wo,{children:[$.jsx(Xt,{span:12,style:{fontWeight:"bold"},children:"权限名字"}),$.jsx(Xt,{span:12,style:{fontWeight:"bold"},children:"按钮名字"})]}),$.jsx(ts.Group,{style:hL,value:r,onChange:c,children:$.jsx($.Fragment,{children:a.map(g=>$.jsxs(wo,{children:[$.jsx(Xt,{span:12,children:$.jsx(ts,{value:g.code,style:{lineHeight:"32px"},children:g.name})}),!g.edit&&$.jsxs(Xt,{span:12,children:[g.button," ",$.jsx(Ep,{onClick:()=>d(g)})]}),g.edit&&$.jsx(Xt,{span:12,children:$.jsx(Zt,{placeholder:"按钮名字",value:g.button,onChange:h=>f(h,g),onBlur:()=>p(g)})})]},g.code))})}),$.jsx("div",{style:{display:"none"},children:$.jsx(Me.List,{name:"actions",children:g=>$.jsx($.Fragment,{children:g.map((h,v)=>C.createElement(Me.Item,{...s,required:!1,key:v},$.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[$.jsx(Me.Item,{name:[h.name,"code"],noStyle:!0,children:$.jsx(Zt,{placeholder:"权限"})}),$.jsx(Me.Item,{name:[h.name,"name"],noStyle:!0,children:$.jsx(Zt,{placeholder:"权限名字"})}),$.jsx(Me.Item,{name:[h.name,"button"],noStyle:!0,children:$.jsx(Zt,{placeholder:"按钮名字"})})]})))})})})]})}const $x=C.createContext({}),qc=()=>C.useContext($x);function yL({id:e,value:t,onChange:n}){const{onSelectRoles:r}=qc(),[o,a]=C.useState([]),[i,s]=C.useState();C.useEffect(()=>{(async()=>{var f,p;if(r){const g=await r();a(g);return}const d=await hx();a(((p=(f=d.data)==null?void 0:f.data)==null?void 0:p.roleList)||[])})()},[]),C.useEffect(()=>{const c=t!=null&&t.ids?t.ids.split(","):[];s(c==null?void 0:c[0])},[t]);const l=c=>{const d=o.find(f=>f.value===c);d?(n==null||n({ids:d.value,names:d.label}),s(d.value)):(n==null||n(void 0),s(void 0))};return $.jsx("div",{id:e,children:$.jsx(Dn,{value:i,options:o,placeholder:"请选择角色",allowClear:!0,showSearch:!0,filterOption:(c,d)=>((d==null?void 0:d.label)??"").toLowerCase().includes(c.toLowerCase()),onChange:l})})}function mm({id:e,value:t,onChange:n}){const{onSelectMembers:r}=qc(),[o,a]=C.useState([]),[i,s]=C.useState([]);C.useEffect(()=>{(async()=>{var f,p;if(r){const g=await r();a(g);return}const d=await hx();a(((p=(f=d.data)==null?void 0:f.data)==null?void 0:p.userList)||[])})()},[]),C.useEffect(()=>{const c=t!=null&&t.ids?t.ids.split(","):[];s(c)},[t]);const l=c=>{const d=o.filter(f=>c==null?void 0:c.includes(f.value));if(d&&d.length){const f=d.map(g=>g.value),p=d.map(g=>g.label);n==null||n({ids:f.join(","),names:p.join(",")||""}),s(f)}else n==null||n(void 0),s([])};return $.jsx("div",{id:e,children:$.jsx(Dn,{mode:"multiple",value:i,options:o,placeholder:"请选择成员",onChange:l,filterOption:(c,d)=>((d==null?void 0:d.label)??"").toLowerCase().includes(c.toLowerCase())})})}const gm="userId",Ox="initiator",CL="initiatorDirectManager",SL="initiatorDepartmentManager",vm="role",Nx=[{value:gm,label:"指定成员"},{value:Ox,label:"发起人自己"},{value:CL,label:"发起⼈的直属主管"},{value:SL,label:"发起⼈的部⻔主管"},{value:vm,label:"指定角色"}],xL={display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:8};function hm({form:e,applyType:t="approver"}){const[n,r]=C.useState(e.getFieldValue("groupType")||"userId"),o=C.useMemo(()=>t==="message"?"通知人员":"成员选择",[t]),a=C.useMemo(()=>t==="message"?"通知角色":"角色选择",[t]),i=C.useCallback(()=>{e.setFieldsValue({assignee:void 0,role:void 0})},[e]);return C.useEffect(()=>{e.getFieldValue("groupType")||e.setFieldsValue({groupType:n})},[]),$.jsxs($.Fragment,{children:[$.jsx(Me.Item,{label:"用户类型",name:"groupType",required:!0,children:$.jsx(Rt.Group,{style:xL,onChange:s=>{const l=s.target.value;r(l),i()},children:Nx.map(s=>$.jsx(Rt,{value:s.value,children:s.label},s.value))})}),n==="userId"&&$.jsx($.Fragment,{children:$.jsx(Me.Item,{label:o,name:"assignee",required:!0,rules:[{required:!0,message:`请选择${o}`}],children:$.jsx(mm,{})})}),n==="role"&&$.jsx($.Fragment,{children:$.jsx(Me.Item,{label:a,name:"role",required:!0,rules:[{required:!0,message:`请选择${a}`}],children:$.jsx(yL,{})})})]})}const Ix=[{label:"会签",description:"默认需要所有审批人同意",value:"countersign",needConfig:!0,text:{configTitle:"会签配置",ratioTitle:"会签审核通过比例(%)",numTitle:"会签审核通过数量"}},{label:"或签",description:"一名审批人同意即可通过",value:"orSign",needConfig:!0,text:{configTitle:"或签配置",ratioTitle:"或签审核拒绝比例(%)",numTitle:"或签审核拒绝数量"}},{label:"并签",description:"同时审批通过",value:"andSign",needConfig:!0,text:{configTitle:"并签配置",ratioTitle:"并签审核通过比例(%)",numTitle:"并签审核通过数量"}},{label:"依次审批",description:"按审批顺序依次审批",value:"serialSign",needConfig:!1}],wL={display:"flex",flexDirection:"column",gap:8},Px={display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:8};function EL({form:e}){var c,d,f;const[t,n]=C.useState(),[r,o]=C.useState(e.getFieldValue("signConfig.useRatio")||!0),a=Me.useWatch("groupType",e),i=Me.useWatch(["approver_is_empty","type"],e),s=Me.useWatch(["comment_setting","type"],e),l=p=>{const g=Ix.find(h=>h.value===p);n(g)};return C.useEffect(()=>{l(e.getFieldValue("approverType")||"countersign")},[e]),$.jsxs($.Fragment,{children:[$.jsx(hm,{form:e}),a!==Ox&&$.jsxs($.Fragment,{children:[$.jsx(Me.Item,{label:"多人审批时采用的审批方式",name:"approverType",required:!0,children:$.jsx(Rt.Group,{style:wL,onChange:p=>{l(p.target.value)},children:Ix.map(p=>$.jsxs(Rt,{value:p.value,children:[p.label,"(",p.description,")"]},p.value))})}),(t==null?void 0:t.needConfig)&&$.jsxs($.Fragment,{children:[$.jsx("p",{children:(c=t==null?void 0:t.text)==null?void 0:c.configTitle}),$.jsx(Me.Item,{layout:"horizontal",label:"类型",name:["signConfig","useRatio"],rules:[{required:!0}],children:$.jsx(is,{checkedChildren:"按比例",unCheckedChildren:"按数量",onChange:o})}),r&&$.jsx(Me.Item,{layout:"horizontal",label:(d=t==null?void 0:t.text)==null?void 0:d.ratioTitle,name:["signConfig","ratio"],rules:[{required:!0,message:"请输入比例"}],children:$.jsx(ns,{min:1,max:100,step:1,precision:2})}),!r&&$.jsx(Me.Item,{layout:"horizontal",label:(f=t==null?void 0:t.text)==null?void 0:f.numTitle,name:["signConfig","num"],rules:[{required:!0,message:"请输入数量"}],children:$.jsx(ns,{min:1,step:1,precision:0})})]})]}),$.jsx(Me.Item,{label:"审批人包含发起人时",name:["initiator_is_included","type"],required:!0,children:$.jsxs(Rt.Group,{style:Px,children:[$.jsx(Rt,{value:"require_process",children:"发起人继续处理"}),$.jsx(Rt,{value:"auto_pass",children:"发起人不用处理"}),$.jsx(Rt,{value:"forward_initiatorDirectManager",children:"转交给发起人直属主管处理"}),$.jsx(Rt,{value:"forward_initiatorDepartmentManager",children:"转交给发起人部门主管处理"})]})}),$.jsx(Me.Item,{label:"审批人为空时",name:["approver_is_empty","type"],required:!0,children:$.jsxs(Rt.Group,{style:Px,children:[$.jsx(Rt,{value:"auto_pass",children:"自动通过"}),$.jsx(Rt,{value:"auto_refuse",children:"自动拒绝"}),$.jsx(Rt,{value:"assign_approver",children:"指定人员"}),$.jsx(Rt,{value:"prompt_error",children:"报错提醒"})]})}),i==="assign_approver"&&$.jsx($.Fragment,{children:$.jsx(Me.Item,{label:"指定人员",name:["approver_is_empty","user"],required:!0,rules:[{required:!0,message:"请选择指定人员"}],children:$.jsx(mm,{})})}),$.jsx(Me.Item,{label:"审批被拒绝时",name:["approval_is_refused","type"],required:!0,rules:[{required:!0,message:"请选择审批被拒绝时的操作"}],children:$.jsxs(Rt.Group,{children:[$.jsx(Rt,{value:"end_process",children:"直接结束流程"}),$.jsx(Rt,{value:"back_to_initiator",children:"退回到发起人"})]})}),$.jsx(Me.Item,{label:"审批意⻅设置",name:["comment_setting","type"],required:!0,rules:[{required:!0,message:"请选择审批被拒绝时的操作"}],children:$.jsxs(Rt.Group,{children:[$.jsx(Rt,{value:"everyone",children:"所有人可见"}),$.jsx(Rt,{value:"assign_approver",children:"指定人员可见"})]})}),s==="assign_approver"&&$.jsx($.Fragment,{children:$.jsx(Me.Item,{label:"指定人员",name:["comment_setting","user"],required:!0,rules:[{required:!0,message:"请选择指定人员"}],children:$.jsx(mm,{})})})]})}function $L(){const e={labelCol:{xs:{span:24},sm:{span:5}},wrapperCol:{xs:{span:24},sm:{span:24}}};return $.jsx(Me.List,{name:"extended",children:(t,{add:n,remove:r},{errors:o})=>$.jsxs($.Fragment,{children:[t.map((a,i)=>C.createElement(Me.Item,{...e,required:!1,key:i},$.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[$.jsx(Me.Item,{name:[a.name,"name"],noStyle:!0,children:$.jsx(Zt,{placeholder:"扩展名"})}),$.jsx(Me.Item,{name:[a.name,"code"],noStyle:!0,children:$.jsx(Zt,{placeholder:"扩展值"})}),$.jsx(xc,{onClick:()=>{r(a.name)}})]}))),$.jsxs(Me.Item,{children:[$.jsx(Nt,{type:"dashed",onClick:()=>n(),style:{width:"100%"},icon:$.jsx(oo,{}),children:"添加扩展"}),$.jsx(Me.ErrorList,{errors:o})]})]})})}function OL(){const e={labelCol:{xs:{span:24},sm:{span:5}},wrapperCol:{xs:{span:24},sm:{span:24}}};return $.jsxs("div",{children:[$.jsxs(wo,{gutter:10,style:{marginBottom:"20px",background:"#fafafa",lineHeight:"40px"},children:[$.jsx(Xt,{span:12,style:{paddingLeft:"10px",fontWeight:"bold"},children:"表单字段"}),$.jsx(Xt,{span:12,style:{fontWeight:"bold"},children:"操作"})]}),$.jsx(Me.List,{name:"formConfig",children:(t,{add:n,remove:r},{errors:o})=>$.jsxs($.Fragment,{children:[t.map((a,i)=>C.createElement(Me.Item,{...e,required:!1,key:i},$.jsxs(wo,{gutter:10,children:[$.jsx(Xt,{span:12,children:$.jsx(Me.Item,{name:[a.name,"name"],noStyle:!0,children:$.jsx(Zt,{placeholder:"字段名"})})}),$.jsx(Xt,{span:10,children:$.jsx(Me.Item,{name:[a.name,"operate"],noStyle:!0,children:$.jsxs(Rt.Group,{defaultValue:"1",children:[$.jsx(Rt,{value:"1",children:"只读"}),$.jsx(Rt,{value:"2",children:"编辑"}),$.jsx(Rt,{value:"3",children:"隐藏"})]})})}),$.jsx(Xt,{span:2,children:$.jsx(xc,{onClick:()=>{r(a.name)}})})]}))),$.jsxs(Me.Item,{children:[$.jsx(Nt,{type:"dashed",onClick:()=>n(),style:{width:"100%"},icon:$.jsx(oo,{}),children:"添加字段"}),$.jsx(Me.ErrorList,{errors:o})]})]})})]})}function _x({name:e}){return $.jsxs($.Fragment,{children:[$.jsx(Me.Item,{label:"请求地址",required:!0,name:[...e,"api_request_url"],rules:[{required:!0,message:"请输入请求地址"},{type:"url",message:"请输入正确的URL地址"}],children:$.jsx(Zt,{placeholder:"请输入请求地址"})}),$.jsx(Me.Item,{label:"请求头",tooltip:"请求头格式为JSON字符串",name:[...e,"api_request_headers"],children:$.jsx(Zt.TextArea,{autoSize:{minRows:4,maxRows:6},placeholder:"请输入请求头"})}),$.jsx(Me.Item,{label:"请求体",tooltip:"请求体格式为JSON字符串",name:[...e,"api_request_body"],children:$.jsx(Zt.TextArea,{autoSize:{minRows:4,maxRows:6},placeholder:"请输入请求体"})})]})}function NL({form:e}){const t=Me.useWatch(["listeners","task_create","open"],e),n=Me.useWatch(["listeners","task_finish","open"],e);return $.jsxs($.Fragment,{children:[$.jsx(Me.Item,{label:"创建任务",name:["listeners","task_create","open"],children:$.jsx(is,{checkedChildren:"开启",unCheckedChildren:"关闭"})}),t&&$.jsx(_x,{name:["listeners","task_create"]}),$.jsx(Me.Item,{label:"任务完成",name:["listeners","task_finish","open"],children:$.jsx(is,{checkedChildren:"开启",unCheckedChildren:"关闭"})}),n&&$.jsx(_x,{name:["listeners","task_finish"]})]})}const IL=C.memo(C.forwardRef((e,t)=>{const[n]=Me.useForm(),[r,o]=C.useState("assignee");return C.useImperativeHandle(t,()=>({getValue:()=>n.getFieldsValue(),validateFields:()=>n.validateFields()}),[n]),$.jsxs(Me,{form:n,layout:"vertical",colon:!1,initialValues:e.value,children:[$.jsx(vL,{options:[{key:"assignee",label:"审批人"},{key:"actions",label:"操作权限"},{key:"listeners",label:"监听器"}],value:r,onChange:o}),$.jsx("div",{style:{display:r==="assignee"?"block":"none"},children:$.jsx(EL,{form:n})}),$.jsx("div",{style:{display:r==="actions"?"block":"none"},children:$.jsx(bL,{form:n})}),$.jsx("div",{style:{display:r==="formConfig"?"block":"none"},children:$.jsx(OL,{})}),$.jsx("div",{style:{display:r==="extended"?"block":"none"},children:$.jsx($L,{})}),$.jsx("div",{style:{display:r==="listeners"?"block":"none"},children:$.jsx(NL,{form:n})})]})}));function PL(){return $.jsxs(wo,{gutter:10,style:{marginBottom:20,background:"#fafafa",lineHeight:"40px"},children:[$.jsx(Xt,{span:3,style:{paddingLeft:10,fontWeight:"bold"},children:"关系"}),$.jsx(Xt,{span:9,style:{fontWeight:"bold"},children:"字段"}),$.jsx(Xt,{span:6,style:{fontWeight:"bold"},children:"条件"}),$.jsx(Xt,{span:4,style:{fontWeight:"bold"},children:"条件值"}),$.jsx(Xt,{span:2,style:{fontWeight:"bold"},children:"操作"})]})}const _L=[{label:"且",value:"and"},{label:"或",value:"or"}],TL={and:"&&",or:"||"},Tx={eq:"等于",ne:"不等于",gt:"大于",ge:"大于等于",lt:"小于",le:"小于等于",like:"包含",like_start:"开头包含",like_end:"结尾包含",empty:"为空",not_empty:"不为空"},ML={eq:"=",ne:"!=",gt:">",ge:">=",lt:"<",le:"<=",like:"contains",like_start:"startsWith",like_end:"endsWith",empty:"is empty",not_empty:"is not empty"},DL=["eq","ne"],AL=["eq","ne","gt","ge","lt","le"],jL={text:DL.map(e=>({label:Tx[e],value:e})),number:AL.map(e=>({label:Tx[e],value:e}))},zL={relation:"and",field:"",fieldType:"text",operator:"eq",value:""};function LL(e){const{item:t,fields:n,operatorOptionsByType:r,valueControls:o,onChange:a,onRemove:i}=e,s=C.useMemo(()=>n.map(v=>({label:v.label,value:v.value})),[n]),l=C.useMemo(()=>r[t.fieldType]||[],[r,t.fieldType]),c=t.operator!=="empty"&&t.operator!=="not_empty",d=o[t.fieldType],f=C.useCallback(v=>a({...t,relation:v}),[t,a]),p=C.useCallback(v=>{const m=n.find(w=>w.value===v),b=m?m.type:t.fieldType,y=r[b].map(w=>w.value),x=y.includes(t.operator)?t.operator:y[0];a({...t,field:v,fieldType:b,operator:x,value:x==="empty"||x==="not_empty"?void 0:b==="number"?0:""})},[n,t,a,r]),g=C.useCallback(v=>{const m=v==="empty"||v==="not_empty"?void 0:t.fieldType==="number"?typeof t.value=="number"?t.value:0:typeof t.value=="string"?t.value:"";a({...t,operator:v,value:m})},[t,a]),h=C.useCallback(v=>a({...t,value:v}),[t,a]);return $.jsxs(wo,{gutter:10,style:{marginBottom:8},children:[$.jsx(Xt,{span:3,children:$.jsx(Dn,{placeholder:"关系",options:_L,value:t.relation,onChange:f,style:{width:"100%"}})}),$.jsx(Xt,{span:9,children:$.jsx(Dn,{placeholder:"字段",options:s,value:t.field,onChange:p,style:{width:"100%"}})}),$.jsx(Xt,{span:6,children:$.jsx(Dn,{placeholder:"条件",options:l,value:t.operator,onChange:g,style:{width:"100%"}})}),$.jsx(Xt,{span:4,children:c&&d?$.jsx(d,{value:t.value,onChange:h}):null}),$.jsx(Xt,{span:2,style:{display:"flex",alignItems:"center"},children:$.jsx(xc,{onClick:i})})]})}function FL(e){const{value:t,onChange:n,fields:r,defaultCondition:o,operatorOptionsByType:a,valueControls:i}=e,s=C.useCallback(()=>n([...t||[],o]),[n,t,o]),l=C.useCallback(d=>{const f=[...t];f.splice(d,1),n(f)},[n,t]),c=C.useCallback((d,f)=>{const p=[...t];p[d]=f,n(p)},[n,t]);return $.jsxs($.Fragment,{children:[(t||[]).map((d,f)=>$.jsx(LL,{item:d,fields:r,operatorOptionsByType:a,valueControls:i,onChange:p=>c(f,p),onRemove:()=>l(f)},f)),$.jsx(Nt,{type:"dashed",onClick:s,style:{width:"100%"},icon:$.jsx(oo,{}),children:"添加条件"})]})}const kL={text:({value:e,onChange:t})=>{const n=typeof e=="string"?e:"";return $.jsx(Zt,{value:n,onChange:r=>t(r.target.value),placeholder:"条件值"})},number:({value:e,onChange:t})=>{const n=typeof e=="number"?e:void 0;return $.jsx(ns,{style:{width:"100%"},value:n,onChange:r=>t(typeof r=="number"?r:void 0)})}};function RL(e){const t=["empty","not_empty"];function n(i,s){return i===0||!s?"":` ${TL[s]||""} `}function r(i){let s="";return t.includes(i.operator)||!i.value?"":(i.fieldType==="text"?s=`'${i.value}'`:s=i.value.toString(),` ${s}`)}function o(i){if(!i.field||!i.operator)return"";const s=r(i);if(!t.includes(i.operator)&&!s)return"";const l=ML[i.operator]||"";return`${i.field} ${l}${s}`}if(!e)return"";let a="";return e.forEach((i,s)=>{a+=n(s,i.relation),a+=o(i)}),a?`\${${a}}`:""}function BL(e){const[t,n]=C.useState([]),[r,o]=C.useState([]),a="value"in e,i=C.useMemo(()=>a?e.value||[]:t,[a,e.value,t]),s=C.useCallback(d=>{a||n(d),e.onChange&&e.onChange(d)},[a,e]),l=C.useCallback(d=>s(d),[s]),c=C.useCallback(async d=>{var f,p;try{const g=await Mz(d);o(((p=(f=g.data)==null?void 0:f.data)==null?void 0:p.bizFormJson)||[])}catch(g){console.error("[海牛工作流SDK}] 获取条件单字段失败",g)}},[]);return C.useEffect(()=>{const d=Pz();c(d.key||"")},[c]),$.jsxs("div",{children:[$.jsx(PL,{}),$.jsx(FL,{value:i,onChange:l,fields:r,defaultCondition:zL,operatorOptionsByType:jL,valueControls:kL})]})}const VL=C.memo(C.forwardRef((e,t)=>{const[n]=Me.useForm();return C.useImperativeHandle(t,()=>({getValue:()=>n.getFieldsValue(),validateFields:()=>n.validateFields()}),[n]),$.jsxs(Me,{form:n,layout:"vertical",colon:!1,initialValues:e.value,children:[$.jsx(Me.Item,{name:"conditions",noStyle:!0,children:$.jsx(BL,{onChange:r=>n.setFieldValue("condition",RL(r))})}),$.jsx(Me.Item,{hidden:!0,name:"condition"})]})})),Mx={approverType:"orSign",actions:[{code:"addSigner",name:"加签",button:"加签"}]},HL=C.forwardRef((e,t)=>{const{value:n}=e,[r]=Me.useForm();return C.useImperativeHandle(t,()=>({getValue:()=>r.getFieldsValue(),validateFields:()=>(console.log("validate dispatcher panel",r.getFieldsValue()),r.validateFields())}),[r]),C.useEffect(()=>{r.setFieldsValue({...Mx,...n})},[n,r]),$.jsxs(Me,{form:r,layout:"vertical",colon:!1,initialValues:{...Mx,...n},children:[$.jsx(hm,{form:r}),$.jsx(Me.Item,{label:"多人审批时采用的审批方式",name:"approverType",required:!0,hidden:!0,children:$.jsx(Zt,{})}),$.jsx(Me.Item,{label:"默认操作权限",name:"actions",required:!0,hidden:!0,children:$.jsx(Zt,{})})]})}),WL=C.memo(C.forwardRef((e,t)=>{const[n]=Me.useForm();return C.useImperativeHandle(t,()=>({getValue:()=>n.getFieldsValue(),validateFields:()=>n.validateFields()}),[n]),$.jsx(Me,{form:n,layout:"vertical",colon:!1,initialValues:e.value,children:$.jsx(hm,{form:n})})})),qL=C.memo(C.forwardRef((e,t)=>{const[n]=Me.useForm();return C.useImperativeHandle(t,()=>({getValue:()=>n.getFieldsValue(),validateFields:()=>n.validateFields()}),[n]),$.jsx(Me,{form:n,layout:"vertical",colon:!1,initialValues:e.value,children:$.jsx(Me.Item,{label:"发起人",name:"initiator",children:$.jsx(Zt,{})})})})),UL=[{value:"scrap_apply",label:"报废申请"},{value:"dept_approve",label:"部门审批"},{value:"tech_eval",label:"技术评估"},{value:"asset_approve",label:"资产管理审批"},{value:"finance_approve",label:"财务审批"}],GL=C.memo(C.forwardRef((e,t)=>{const[n]=Me.useForm(),r=(o,a)=>{n.setFieldValue("subProcessName",a.label)};return C.useImperativeHandle(t,()=>({getValue:()=>n.getFieldsValue(),validateFields:()=>n.validateFields()}),[n]),$.jsxs(Me,{form:n,layout:"vertical",colon:!1,initialValues:e.value,children:[$.jsx(tc,{label:"子流程",name:"subProcessId",children:$.jsx(Dn,{placeholder:"请选择子流程",options:UL,onChange:r})}),$.jsx(tc,{hidden:!0,name:"subProcessName",children:$.jsx(Zt,{})})]})}));function bm(e){var n,r,o,a,i;const t=(n=e.config)==null?void 0:n.groupType;return t?t===gm?!!(((o=(r=e.config)==null?void 0:r.assignee)==null?void 0:o.ids)||""):t===vm?!!(((i=(a=e.config)==null?void 0:a.role)==null?void 0:i.ids)||""):!0:!1}function ym(e){var r,o;if(!e)return"";const t=e==null?void 0:e.groupType;let n;if(t){const a=Nx.find(i=>i.value===t);if(a)switch(a.value){case gm:n=((r=e==null?void 0:e.assignee)==null?void 0:r.names)||"";break;case vm:n=((o=e==null?void 0:e.role)==null?void 0:o.names)||"";break;default:n=a.label;break}}return n}const Dx={[ut.approver]:{viewContent:e=>{const t=ym(e.config);return $.jsx(Qa,{secondary:!t,text:t||"选择审批人"})},settersPanel:IL,validate:e=>bm(e)?!0:"未选择审批人"},[ut.condition]:{viewContent:e=>{var n;const t=((n=e.config)==null?void 0:n.conditions)||[];return $.jsx(Qa,{secondary:!t.length,text:t.length?"已配置":"请配置条件"})},settersPanel:VL,validate:e=>e.config?!0:`${e.name}未设置条件`},[ut.notifier]:{viewContent:e=>{const t=ym(e.config);return $.jsx(Qa,{secondary:!t,text:t||"选择抄送人"})},settersPanel:WL,validate:e=>bm(e)?!0:"未选择抄送人"},[ut.start]:{viewContent:e=>{var t;return $.jsx(Qa,{text:`${(t=e.config)==null?void 0:t.initiator}`})},settersPanel:qL},[ut.subProcess]:{viewContent:e=>{var t;return $.jsx(Qa,{text:`${((t=e.config)==null?void 0:t.subProcessName)||"选择子流程"}`})},validate:e=>{var t;return(t=e.config)!=null&&t.subProcessId?!0:"未选择子流程"},settersPanel:GL},[ut.dispatcher]:{viewContent:e=>{const t=ym(e.config);return $.jsx(Qa,{secondary:!t,text:t||"选择分发人"})},settersPanel:HL,validate:e=>(console.log("validate dispatcher",e),bm(e)?!0:"未选择分发人")}},KL=be.div`
|
|
1327
1327
|
width: 100%;
|
|
1328
1328
|
height: 100vh;
|
|
1329
1329
|
display: flex;
|
|
@@ -1358,4 +1358,4 @@ See https://styled-components.com/docs/faqs#why-am-i-getting-a-warning-about-sev
|
|
|
1358
1358
|
background-color: ${e=>{var t;return(t=e.theme.token)==null?void 0:t.colorBgBase}};
|
|
1359
1359
|
color: ${e=>{var t;return(t=e.theme.token)==null?void 0:t.colorText}};
|
|
1360
1360
|
height: 0;
|
|
1361
|
-
`,rF=C.memo(e=>{const{onSave:t}=qc(),{className:n,processKey:r,processName:o,...a}=e,i=wc(),s=FD(),l=RD(),[c,d]=C.useState(!1),f=C.useMemo(()=>[{label:"导入",key:"import",icon:$.jsx(bS,{}),onClick:l},{label:"导出",key:"export",icon:$.jsx(hS,{}),onClick:s}],[s,l]),p=async()=>{if(c)return!1;d(!0);const g={jsonBpmn:JSON.stringify(i),name:o,pic:"",processKey:r};if(t){await t(g),d(!1);return}try{const v=(await Dz(JSON.stringify(g))).data;v.errorCode===0?(localStorage.setItem("startNode",JSON.stringify(i)),zr.success("保存成功")):zr.error(v.msg)}catch{zr.error("保存失败")}finally{d(!1)}};return $.jsxs(nF,{className:K("workflow-editor",n||""),...a,children:[$.jsx(yD,{title:$.jsx(Or,{children:o}),actions:$.jsxs(Or,{children:[$.jsx(Nt,{type:"text",loading:c,icon:$.jsx(CS,{}),onClick:p,children:"保存"}),$.jsx(tF,{processKey:r,processName:o}),$.jsx(vp,{menu:{items:f},trigger:["click"],children:$.jsx(Nt,{icon:$.jsx(ql,{})})})]})}),$.jsx(HA,{})]})}),oF=C.memo(e=>{const{materialUis:t,processKey:n,processName:r,...o}=e;return $.jsx($x.Provider,{value:{onSave:o.onSave,onPublish:o.onPublish,onSelectMembers:o.onSelectMembers},children:$.jsx(zz,{materialUis:t,processKey:n,children:$.jsx(rF,{...o,processKey:n,processName:r})})})});function aF(e){var n,r,o;const t={};return(n=e.completedNode)==null||n.forEach(a=>t[a]="completed"),(r=e.activityNode)==null||r.forEach(a=>t[a]="processing"),(o=e.pendingNode)==null||o.forEach(a=>t[a]="pending"),t}const iF=C.memo(e=>{const{materialUis:t}=e,[n,r]=C.useState({}),[o,a]=C.useState({});return C.useEffect(()=>{Tz({processInstanceId:e.processKey}).then(i=>{const{jsonBpmn:s,taskNodeStatusInfo:l}=i.data.data;a(aF(l)),r(s)})},[]),$.jsx("div",{style:{width:"100vw",height:"100vh",boxSizing:"border-box"},children:$.jsx(fL,{workflowData:n,nodeStatuses:o,statusColors:{completed:"#52c41a",processing:"#faad14",...e.statusColors},materials:[],materialUis:t,defaultZoom:1,style:{height:"100%"}})})}),sF=C.memo(e=>(gx({baseURL:e.baseUrl,headers:e.customHeaders}),vx({key:e.processKey,name:e.processName}),$.jsx(Ax,{children:$.jsx(oF,{materialUis:Dx
|
|
1361
|
+
`,rF=C.memo(e=>{const{onSave:t}=qc(),{className:n,processKey:r,processName:o,...a}=e,i=wc(),s=FD(),l=RD(),[c,d]=C.useState(!1),f=C.useMemo(()=>[{label:"导入",key:"import",icon:$.jsx(bS,{}),onClick:l},{label:"导出",key:"export",icon:$.jsx(hS,{}),onClick:s}],[s,l]),p=async()=>{if(c)return!1;d(!0);const g={jsonBpmn:JSON.stringify(i),name:o,pic:"",processKey:r};if(t){await t(g),d(!1);return}try{const v=(await Dz(JSON.stringify(g))).data;v.errorCode===0?(localStorage.setItem("startNode",JSON.stringify(i)),zr.success("保存成功")):zr.error(v.msg)}catch{zr.error("保存失败")}finally{d(!1)}};return $.jsxs(nF,{className:K("workflow-editor",n||""),...a,children:[$.jsx(yD,{title:$.jsx(Or,{children:o}),actions:$.jsxs(Or,{children:[$.jsx(Nt,{type:"text",loading:c,icon:$.jsx(CS,{}),onClick:p,children:"保存"}),$.jsx(tF,{processKey:r,processName:o}),$.jsx(vp,{menu:{items:f},trigger:["click"],children:$.jsx(Nt,{icon:$.jsx(ql,{})})})]})}),$.jsx(HA,{})]})}),oF=C.memo(e=>{const{materialUis:t,processKey:n,processName:r,...o}=e;return $.jsx($x.Provider,{value:{onSave:o.onSave,onPublish:o.onPublish,onSelectMembers:o.onSelectMembers,onSelectRoles:o.onSelectRoles},children:$.jsx(zz,{materialUis:t,processKey:n,children:$.jsx(rF,{...o,processKey:n,processName:r})})})});function aF(e){var n,r,o;const t={};return(n=e.completedNode)==null||n.forEach(a=>t[a]="completed"),(r=e.activityNode)==null||r.forEach(a=>t[a]="processing"),(o=e.pendingNode)==null||o.forEach(a=>t[a]="pending"),t}const iF=C.memo(e=>{const{materialUis:t}=e,[n,r]=C.useState({}),[o,a]=C.useState({});return C.useEffect(()=>{Tz({processInstanceId:e.processKey}).then(i=>{const{jsonBpmn:s,taskNodeStatusInfo:l}=i.data.data;a(aF(l)),r(s)})},[]),$.jsx("div",{style:{width:"100vw",height:"100vh",boxSizing:"border-box"},children:$.jsx(fL,{workflowData:n,nodeStatuses:o,statusColors:{completed:"#52c41a",processing:"#faad14",...e.statusColors},materials:[],materialUis:t,defaultZoom:1,style:{height:"100%"}})})}),sF=C.memo(e=>(gx({baseURL:e.baseUrl,headers:e.customHeaders}),vx({key:e.processKey,name:e.processName}),$.jsx(Ax,{children:$.jsx(oF,{materialUis:Dx,...e})}))),lF=C.memo(e=>(gx({baseURL:e.baseUrl,headers:e.customHeaders}),vx({key:e.processKey}),$.jsx(Ax,{children:$.jsx(iF,{materialUis:Dx,statusColors:e.statusColors,...e})})));$n.WorkflowComponents=sF,$n.WorkflowViewerComponents=lF,Object.defineProperty($n,Symbol.toStringTag,{value:"Module"})}));
|