@yuku123/z-wf-frontend-component 0.2.2 → 0.2.3

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.
@@ -33517,7 +33517,6 @@ Object.fromEntries(e6.map((t) => [t.type, t]));
33517
33517
  const { Option: K$ } = bn;
33518
33518
  nn.TextArea, nn.TextArea;
33519
33519
  const { Text: q$, Paragraph: Z$ } = en, { TextArea: Q$ } = nn, { TextArea: J$ } = nn, { Text: eH, Paragraph: tH } = en, { TextArea: nH } = nn, { Text: rH, Paragraph: iH } = en, { Text: oH } = en, { Text: aH } = en, { TextArea: sH } = nn, { Text: lH, Paragraph: uH } = en, { Text: cH } = en, { Text: dH } = en, { Text: fH } = en, { Text: hH } = en;
33520
- common;
33521
33520
  function FE(t) {
33522
33521
  return {
33523
33522
  list: (e) => na.get(`/${t}/list`, { params: e }).then((n) => n.data),
@@ -140,4 +140,4 @@ React keys must be passed directly to JSX without using spread:
140
140
  `);return o===-1?"":r.stack.slice(o+1)})();try{if(!n.stack)n.stack=i;else if(i){const o=i.indexOf(`
141
141
  `),a=o===-1?-1:i.indexOf(`
142
142
  `,o+1),s=a===-1?"":i.slice(a+1);String(n.stack).endsWith(s)||(n.stack+=`
143
- `+i)}}catch{}}throw n}}_request(t,e){typeof t=="string"?(e=e||{},e.url=t):e=t||{},e=Oo(this.defaults,e);const{transitional:n,paramsSerializer:r,headers:i}=e;n!==void 0&&Ic.assertOptions(n,{silentJSONParsing:En.transitional(En.boolean),forcedJSONParsing:En.transitional(En.boolean),clarifyTimeoutError:En.transitional(En.boolean),legacyInterceptorReqResOrdering:En.transitional(En.boolean),advertiseZstdAcceptEncoding:En.transitional(En.boolean),validateStatusUndefinedResolves:En.transitional(En.boolean)},!1),r!=null&&(B.isFunction(r)?e.paramsSerializer={serialize:r}:Ic.assertOptions(r,{encode:En.function,serialize:En.function},!0)),e.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?e.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:e.allowAbsoluteUrls=!0),Ic.assertOptions(e,{baseUrl:En.spelling("baseURL"),withXsrfToken:En.spelling("withXSRFToken")},!0),e.method=(e.method||this.defaults.method||"get").toLowerCase();let o=i&&B.merge(i.common,i[e.method]);i&&B.forEach(["delete","get","head","post","put","patch","query","common"],h=>{delete i[h]}),e.headers=xn.concat(o,i);const a=[];let s=!0;this.interceptors.request.forEach(function(h){if(typeof h.runWhen=="function"&&h.runWhen(e)===!1)return;s=s&&h.synchronous;const p=e.transitional||sp;p&&p.legacyInterceptorReqResOrdering?a.unshift(h.fulfilled,h.rejected):a.push(h.fulfilled,h.rejected)});const l=[];this.interceptors.response.forEach(function(h){l.push(h.fulfilled,h.rejected)});let u,c=0,d;if(!s){const h=[oE.bind(this),void 0];for(h.unshift(...a),h.push(...l),d=h.length,u=Promise.resolve(e);c<d;)u=u.then(h[c++],h[c++]);return u}d=a.length;let f=e;for(;c<d;){const h=a[c++],p=a[c++];try{f=h(f)}catch(v){p.call(this,v);break}}try{u=oE.call(this,f)}catch(h){return Promise.reject(h)}for(c=0,d=l.length;c<d;)u=u.then(l[c++],l[c++]);return u}getUri(t){t=Oo(this.defaults,t);const e=Kx(t.baseURL,t.url,t.allowAbsoluteUrls,t);return Fx(e,t.params,t.paramsSerializer)}};B.forEach(["delete","get","head","options"],function(t){Ao.prototype[t]=function(e,n){return this.request(Oo(n||{},{method:t,url:e,data:n&&B.hasOwnProp(n,"data")?n.data:void 0}))}}),B.forEach(["post","put","patch","query"],function(t){function e(n){return function(r,i,o){return this.request(Oo(o||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:r,data:i}))}}Ao.prototype[t]=e(),t!=="query"&&(Ao.prototype[t+"Form"]=e(!0))});let o9=class SE{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});const r=this;this.promise.then(i=>{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](i);r._listeners=null}),this.promise.then=i=>{let o;const a=new Promise(s=>{r.subscribe(s),o=s}).then(i);return a.cancel=function(){r.unsubscribe(o)},a},e(function(i,o,a){r.reason||(r.reason=new Ys(i,o,a),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const e=new AbortController,n=r=>{e.abort(r)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new SE(function(n){e=n}),cancel:e}}};function a9(t){return function(e){return t.apply(null,e)}}function s9(t){return B.isObject(t)&&t.isAxiosError===!0}const pp={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(pp).forEach(([t,e])=>{pp[e]=t});function sE(t){const e=new Ao(t),n=Ex(Ao.prototype.request,e);return B.extend(n,Ao.prototype,e,{allOwnKeys:!0}),B.extend(n,e,null,{allOwnKeys:!0}),n.create=function(r){return sE(Oo(t,r))},n}const Kt=sE(Gs);Kt.Axios=Ao,Kt.CanceledError=Ys,Kt.CancelToken=o9,Kt.isCancel=Ux,Kt.VERSION=dp,Kt.toFormData=Pc,Kt.AxiosError=_e,Kt.Cancel=Kt.CanceledError,Kt.all=function(t){return Promise.all(t)},Kt.spread=a9,Kt.isAxiosError=s9,Kt.mergeConfig=Oo,Kt.AxiosHeaders=xn,Kt.formToJSON=t=>Wx(B.isHTMLForm(t)?new FormData(t):t),Kt.getAdapter=iE.getAdapter,Kt.HttpStatusCode=pp,Kt.default=Kt;const{Axios:P9,AxiosError:D9,CanceledError:R9,isCancel:L9,CancelToken:j9,VERSION:I9,all:k9,Cancel:B9,isAxiosError:F9,spread:$9,toFormData:H9,AxiosHeaders:z9,HttpStatusCode:W9,formToJSON:U9,getAdapter:X9,mergeConfig:G9,create:Y9}=Kt;function l9(t){if(t&&typeof t=="object"&&"code"in t&&"data"in t){const e=t;return e.code!==200?Promise.reject(new Error(e.message||"请求失败")):e.data}return t}function u9(t,e={}){const{tokenKey:n="token",userInfoKey:r="userInfo",unauthorizedRedirect:i="/login"}=e;t.interceptors.request.use(o=>{const a=localStorage.getItem(n);return a&&(o.headers.Authorization=`Bearer ${a}`),o}),t.interceptors.response.use(o=>l9(o.data),o=>{var a,s,l;return((a=o.response)==null?void 0:a.status)===401?(localStorage.removeItem(n),localStorage.removeItem(r),window.location.href=i):((s=o.response)==null?void 0:s.status)===403?console.error("没有权限访问该资源"):((l=o.response)==null?void 0:l.status)===500&&console.error("服务器内部错误"),Promise.reject(o)})}function lE(t={}){const e=Kt.create({baseURL:t.baseURL??"/api",timeout:t.timeout??1e4});return u9(e,{tokenKey:t.tokenKey,userInfoKey:t.userInfoKey,unauthorizedRedirect:t.unauthorizedRedirect}),e}const Na=lE();lE();class V9 extends je.Component{constructor(e){super(e),a7(this,"handleReset",()=>{this.setState({hasError:!1,error:null,errorInfo:null}),typeof this.props.onReset=="function"&&this.props.onReset()}),this.state={hasError:!1,error:null,errorInfo:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,n){console.error("[ErrorBoundary] caught error:",e,n),this.setState({errorInfo:n})}render(){if(!this.state.hasError)return this.props.children;const{fallbackTitle:e="组件加载失败",fallbackDescription:n,showReload:r=!0}=this.props,i=this.state.error&&(this.state.error.message||String(this.state.error))||"未知错误";return mr.jsxs("div",{style:{padding:24,background:"#fff2f0",border:"1px solid #ffccc7",borderRadius:8,minHeight:200},children:[mr.jsx(P.Alert,{type:"error",showIcon:!0,icon:mr.jsx(Ee.BugOutlined,{}),message:e,description:mr.jsxs("div",{children:[mr.jsx("div",{style:{marginBottom:8},children:n||"当前组件发生了异常,已被错误边界捕获。其他功能仍可正常使用。"}),mr.jsx("div",{style:{fontFamily:"Menlo, Monaco, Consolas, monospace",fontSize:12,color:"#cf1322",background:"#fff",padding:8,borderRadius:4,border:"1px solid #ffccc7",wordBreak:"break-word",whiteSpace:"pre-wrap"},children:i})]})}),r&&mr.jsx(P.Space,{style:{marginTop:16},children:mr.jsx(P.Button,{icon:mr.jsx(Ee.ReloadOutlined,{}),onClick:this.handleReset,children:"重试"})})]})}}const{Title:K9,Text:q9,Paragraph:Z9}=P.Typography;let c9="/api";function uE(){return Kt.create({baseURL:c9,timeout:15e3})}const d9=uE();uE(),d9.interceptors.request.use(t=>{const e=localStorage.getItem("token");return e&&(t.headers.Authorization=`Bearer ${e}`),t});const{Header:Q9,Sider:J9,Content:e6}=P.Layout,{Text:t6}=P.Typography,{Title:n6,Text:r6}=P.Typography,{Option:i6}=P.Select,{TextArea:o6}=P.Input,f9=[{type:"STRING",label:"字符串",icon:mr.jsx(Ee.FileTextOutlined,{}),color:"#1677ff",desc:"短文本 (默认 VARCHAR 255)"},{type:"TEXT",label:"长文本",icon:mr.jsx(Ee.FileTextOutlined,{}),color:"#13c2c2",desc:"TEXT 类型, 无长度限制"},{type:"INT",label:"整数",icon:"#",color:"#722ed1",desc:"INT 整数"},{type:"LONG",label:"长整数",icon:"#",color:"#722ed1",desc:"BIGINT 长整数"},{type:"DECIMAL",label:"小数",icon:"0.00",color:"#eb2f96",desc:"DECIMAL 精确小数"},{type:"BOOLEAN",label:"布尔",icon:mr.jsx(Ee.CheckCircleOutlined,{}),color:"#52c41a",desc:"TINYINT(1) 是/否"},{type:"DATE",label:"日期",icon:"📅",color:"#fa8c16",desc:"DATE yyyy-MM-dd"},{type:"DATETIME",label:"日期时间",icon:"🕐",color:"#fa8c16",desc:"DATETIME yyyy-MM-dd HH:mm:ss"},{type:"JSON",label:"JSON",icon:"{}",color:"#2f54eb",desc:"JSON 字符串"},{type:"REF",label:"引用",icon:"🔗",color:"#8c8c8c",desc:"外键引用 BIGINT"}];Object.fromEntries(f9.map(t=>[t.type,t]));const{Option:a6}=P.Select;P.Input.TextArea,P.Input.TextArea;const{Text:s6,Paragraph:l6}=P.Typography,{TextArea:u6}=P.Input,{TextArea:c6}=P.Input,{Text:d6,Paragraph:f6}=P.Typography,{TextArea:h6}=P.Input,{Text:p6,Paragraph:v6}=P.Typography,{Text:g6}=P.Typography,{Text:y6}=P.Typography,{TextArea:m6}=P.Input,{Text:_6,Paragraph:b6}=P.Typography,{Text:x6}=P.Typography,{Text:E6}=P.Typography,{Text:w6}=P.Typography,{Text:S6}=P.Typography;common;function cE(t){return{list:e=>Na.get(`/${t}/list`,{params:e}).then(n=>n.data),page:e=>Na.get(`/${t}/page`,{params:e}).then(n=>n.data),get:e=>Na.get(`/${t}/${e}`).then(n=>n.data),create:e=>Na.post(`/${t}`,e).then(n=>n.data),update:(e,n)=>Na.put(`/${t}/${e}`,n).then(r=>r.data),delete:e=>Na.delete(`/${t}/${e}`).then(n=>n.data)}}const si=cE("approval"),Vs=cE("designer"),zn={dashboard:{padding:24},statsRow:{marginBottom:24},statCard:{marginBottom:16},todoIcon:{color:"#1677ff"},doneIcon:{color:"#52c41a"},initiatedIcon:{color:"#722ed1"},statFooter:{textAlign:"right",marginTop:8},todoCard:{marginTop:16},taskTitle:{display:"flex",justifyContent:"space-between",alignItems:"center"},taskDesc:{fontSize:12,color:"#888"}},dE=()=>{const t=Rt.useNavigate(),[e,n]=je.useState(!0),[r,i]=je.useState({todoCount:0,doneCount:0,initiatedCount:0,todoList:[]}),o=async()=>{try{n(!0);const l=await si.getDashboardStats("admin");i({...l,todoList:l.todoList||[]})}catch(l){console.error("获取仪表盘数据失败:",l)}finally{n(!1)}};je.useEffect(()=>{o()},[]);const a=l=>l>=80?"red":l>=50?"orange":"default",s=l=>l>=80?"紧急":l>=50?"高":"普通";return _.jsxs("div",{className:zn.dashboard,children:[_.jsxs(P.Row,{gutter:16,className:zn.statsRow,children:[_.jsx(P.Col,{xs:24,sm:8,children:_.jsxs(P.Card,{loading:e,className:zn.statCard,children:[_.jsx(P.Statistic,{title:"待办任务",value:r.todoCount,prefix:_.jsx(Ee.ClockCircleOutlined,{className:zn.todoIcon}),valueStyle:{color:"#1677ff"}}),_.jsx("div",{className:zn.statFooter,children:_.jsxs(Rt.Link,{to:"/workflow/todo",children:["去处理 ",_.jsx(Ee.RightOutlined,{})]})})]})}),_.jsx(P.Col,{xs:24,sm:8,children:_.jsxs(P.Card,{loading:e,className:zn.statCard,children:[_.jsx(P.Statistic,{title:"已办任务",value:r.doneCount,prefix:_.jsx(Ee.CheckCircleOutlined,{className:zn.doneIcon}),valueStyle:{color:"#52c41a"}}),_.jsx("div",{className:zn.statFooter,children:_.jsxs(Rt.Link,{to:"/workflow/done",children:["查看全部 ",_.jsx(Ee.RightOutlined,{})]})})]})}),_.jsx(P.Col,{xs:24,sm:8,children:_.jsxs(P.Card,{loading:e,className:zn.statCard,children:[_.jsx(P.Statistic,{title:"我发起的",value:r.initiatedCount,prefix:_.jsx(Ee.FileTextOutlined,{className:zn.initiatedIcon}),valueStyle:{color:"#722ed1"}}),_.jsx("div",{className:zn.statFooter,children:_.jsxs(Rt.Link,{to:"/workflow/my-processes",children:["查看全部 ",_.jsx(Ee.RightOutlined,{})]})})]})})]}),_.jsx(P.Card,{title:_.jsxs("span",{children:[_.jsx(Ee.ExclamationCircleOutlined,{style:{color:"#faad14",marginRight:8}}),"待办任务"]}),extra:_.jsx(Rt.Link,{to:"/workflow/todo",children:"查看更多"}),loading:e,className:zn.todoCard,children:r.todoList.length>0?_.jsx(P.List,{dataSource:r.todoList.slice(0,5),renderItem:l=>_.jsx(P.List.Item,{actions:[_.jsx(P.Button,{type:"primary",size:"small",onClick:()=>t(`/workflow/task/${l.id}`),children:"处理"})],children:_.jsx(P.List.Item.Meta,{title:_.jsxs("div",{className:zn.taskTitle,children:[_.jsx("span",{children:l.name}),_.jsx(P.Tag,{color:a(l.priority),children:s(l.priority)})]}),description:_.jsxs("div",{className:zn.taskDesc,children:[_.jsxs("span",{children:["流程: ",l.processDefinitionName]}),_.jsxs("span",{children:["创建时间: ",l.createTime]})]})})})}):_.jsx(P.Empty,{description:"暂无待办任务"})})]})},zr={container:"_container_1nmlu_1",card:"_card_1nmlu_5",header:"_header_1nmlu_9",titleSection:"_titleSection_1nmlu_16",title:"_title_1nmlu_16",titleIcon:"_titleIcon_1nmlu_29",subtitle:"_subtitle_1nmlu_33",taskName:"_taskName_1nmlu_38",name:"_name_1nmlu_44",overdue:"_overdue_1nmlu_57"},{Title:h9}=P.Typography,fE=()=>{const t=Rt.useNavigate(),[e,n]=je.useState(!1),[r,i]=je.useState({list:[],total:0,pageNum:1,pageSize:10,pages:0}),[o,a]=je.useState(""),s=async(f=1,h=10)=>{try{n(!0);const p=await si.getTodoList("admin",f,h);i(p)}catch(p){console.error("获取待办列表失败:",p)}finally{n(!1)}};je.useEffect(()=>{s()},[]);const l=f=>f>=80?"紧急":f>=50?"高":"普通",u=f=>{if(!f)return!1;const h=Jt(f),p=Jt(),v=h.diff(p,"hour");return v>=0&&v<=24},c=f=>f?Jt(f).isBefore(Jt()):!1,d=[{title:"任务名称",dataIndex:"name",key:"name",render:(f,h)=>_.jsxs("div",{className:zr.taskName,children:[_.jsx("span",{className:zr.name,children:f}),c(h.dueTime)&&_.jsx(P.Tag,{color:"red",size:"small",children:"已逾期"}),u(h.dueTime)&&!c(h.dueTime)&&_.jsx(P.Tag,{color:"orange",size:"small",children:"即将到期"})]})},{title:"所属流程",dataIndex:"processDefinitionName",key:"processDefinitionName",render:f=>_.jsx(P.Tooltip,{title:f,children:_.jsx("span",{className:zr.ellipsis,children:f})})},{title:"优先级",dataIndex:"priority",key:"priority",width:100,render:f=>_.jsx(P.Badge,{status:f>=80?"error":f>=50?"warning":"default",text:l(f)})},{title:"创建时间",dataIndex:"createTime",key:"createTime",width:180,render:f=>Jt(f).format("YYYY-MM-DD HH:mm")},{title:"到期时间",dataIndex:"dueTime",key:"dueTime",width:180,render:f=>{if(!f)return"-";const h=Jt(f),p=Jt(),v=h.isBefore(p);return _.jsx("span",{className:v?zr.overdue:"",children:Jt(f).format("YYYY-MM-DD HH:mm")})}},{title:"操作",key:"action",width:120,fixed:"right",render:(f,h)=>_.jsx(P.Space,{size:"small",children:_.jsx(P.Button,{type:"primary",size:"small",icon:_.jsx(Ee.CheckCircleOutlined,{}),onClick:()=>t(`/workflow/task/${h.id}`),children:"审批"})})}];return _.jsx("div",{className:zr.container,children:_.jsxs(P.Card,{className:zr.card,children:[_.jsxs("div",{className:zr.header,children:[_.jsxs("div",{className:zr.titleSection,children:[_.jsxs(h9,{level:4,className:zr.title,children:[_.jsx(Ee.ClockCircleOutlined,{className:zr.titleIcon}),"待办任务"]}),_.jsxs("span",{className:zr.subtitle,children:["共 ",_.jsx("strong",{children:r.total})," 条待办"]})]}),_.jsxs(P.Space,{children:[_.jsx(P.Input,{placeholder:"搜索任务名称",prefix:_.jsx(Ee.SearchOutlined,{}),value:o,onChange:f=>a(f.target.value),style:{width:240},allowClear:!0}),_.jsx(P.Button,{icon:_.jsx(Ee.ReloadOutlined,{}),onClick:()=>s(r.pageNum,r.pageSize),children:"刷新"})]})]}),_.jsx(P.Table,{columns:d,dataSource:r.list,rowKey:"id",loading:e,pagination:{current:r.pageNum,pageSize:r.pageSize,total:r.total,showSizeChanger:!0,showQuickJumper:!0,showTotal:f=>`共 ${f} 条`},onChange:f=>{s(f.current,f.pageSize)},scroll:{x:1400},locale:{emptyText:_.jsx(P.Empty,{image:P.Empty.PRESENTED_IMAGE_SIMPLE,description:"暂无待办任务"})}})]})})},wi={container:"_container_9q4zo_1",card:"_card_9q4zo_5",header:"_header_9q4zo_9",titleSection:"_titleSection_9q4zo_16",title:"_title_9q4zo_16",titleIcon:"_titleIcon_9q4zo_29",subtitle:"_subtitle_9q4zo_33",taskName:"_taskName_9q4zo_38",ellipsis:"_ellipsis_9q4zo_43"},{Title:p9}=P.Typography,hE=()=>{const t=Rt.useNavigate(),[e,n]=je.useState(!1),[r,i]=je.useState({list:[],total:0,pageNum:1,pageSize:10,pages:0}),[o,a]=je.useState(""),s=async(u=1,c=10)=>{try{n(!0);const d=await si.getDoneList("admin",u,c);i(d)}catch(d){console.error("获取已办列表失败:",d)}finally{n(!1)}};je.useEffect(()=>{s()},[]);const l=[{title:"任务名称",dataIndex:"name",key:"name",render:u=>_.jsx("span",{className:wi.taskName,children:u})},{title:"所属流程",dataIndex:"processDefinitionName",key:"processDefinitionName",render:u=>_.jsx(P.Tooltip,{title:u,children:_.jsx("span",{className:wi.ellipsis,children:u})})},{title:"处理结果",dataIndex:"action",key:"action",width:120,render:u=>_.jsx(P.Tag,{color:u==="approve"?"success":"error",children:u==="approve"?"已通过":"已驳回"})},{title:"处理时间",dataIndex:"endTime",key:"endTime",width:180,render:u=>Jt(u).format("YYYY-MM-DD HH:mm:ss")},{title:"操作",key:"action",width:120,fixed:"right",render:(u,c)=>_.jsx(P.Space,{size:"small",children:_.jsx(P.Button,{type:"text",icon:_.jsx(Ee.EyeOutlined,{}),onClick:()=>t(`/workflow/task/${c.id}`),children:"查看"})})}];return _.jsx("div",{className:wi.container,children:_.jsxs(P.Card,{className:wi.card,children:[_.jsxs("div",{className:wi.header,children:[_.jsxs("div",{className:wi.titleSection,children:[_.jsxs(p9,{level:4,className:wi.title,children:[_.jsx(Ee.HistoryOutlined,{className:wi.titleIcon}),"已办任务"]}),_.jsxs("span",{className:wi.subtitle,children:["共 ",_.jsx("strong",{children:r.total})," 条记录"]})]}),_.jsxs(P.Space,{children:[_.jsx(P.Input,{placeholder:"搜索任务名称",prefix:_.jsx(Ee.SearchOutlined,{}),value:o,onChange:u=>a(u.target.value),style:{width:240},allowClear:!0}),_.jsx(P.Button,{icon:_.jsx(Ee.ReloadOutlined,{}),onClick:()=>s(r.pageNum,r.pageSize),children:"刷新"})]})]}),_.jsx(P.Table,{columns:l,dataSource:r.list,rowKey:"id",loading:e,pagination:{current:r.pageNum,pageSize:r.pageSize,total:r.total,showSizeChanger:!0,showQuickJumper:!0,showTotal:u=>`共 ${u} 条`},onChange:u=>{s(u.current,u.pageSize)},locale:{emptyText:_.jsx(P.Empty,{image:P.Empty.PRESENTED_IMAGE_SIMPLE,description:"暂无已办任务"})}})]})})},li={container:"_container_120ju_1",card:"_card_120ju_5",header:"_header_120ju_9",titleSection:"_titleSection_120ju_16",title:"_title_120ju_16",titleIcon:"_titleIcon_120ju_29",subtitle:"_subtitle_120ju_33",processName:"_processName_120ju_38",processIcon:"_processIcon_120ju_44",name:"_name_120ju_49"},{Title:v9}=P.Typography,{confirm:g9}=P.Modal,pE=()=>{const t=Rt.useNavigate(),[e,n]=je.useState(!1),[r,i]=je.useState({list:[],total:0,pageNum:1,pageSize:10,pages:0}),[o,a]=je.useState(""),s=async(d=1,f=10)=>{try{n(!0);const h=await si.getMyProcesses("admin",d,f);i(h)}catch(h){console.error("获取我的流程失败:",h)}finally{n(!1)}};je.useEffect(()=>{s()},[]);const l=d=>{g9({title:"确认删除",icon:_.jsx(Ee.ExclamationCircleOutlined,{}),content:`确定要删除流程实例 "${d.processDefinitionName}" 吗?此操作不可恢复。`,okText:"删除",okType:"danger",cancelText:"取消",onOk:async()=>{try{await si.deleteProcessInstance(d.id),message.success("删除成功"),s()}catch{message.error("删除失败")}}})},u=d=>{switch(d){case"running":return _.jsx(P.Badge,{status:"processing",text:"运行中"});case"completed":return _.jsx(P.Badge,{status:"success",text:"已完成"});case"suspended":return _.jsx(P.Badge,{status:"warning",text:"已暂停"});case"terminated":return _.jsx(P.Badge,{status:"error",text:"已终止"});default:return _.jsx(P.Badge,{status:"default",text:"未知"})}},c=[{title:"流程名称",dataIndex:"processDefinitionName",key:"processDefinitionName",render:d=>_.jsxs("div",{className:li.processName,children:[_.jsx(Ee.FileTextOutlined,{className:li.processIcon}),_.jsx("span",{className:li.name,children:d})]})},{title:"业务标识",dataIndex:"businessKey",key:"businessKey",render:d=>d||"-"},{title:"状态",dataIndex:"status",key:"status",width:100,render:d=>u(d)},{title:"发起人",dataIndex:"startUserName",key:"startUserName",width:120,render:d=>d||"系统"},{title:"启动时间",dataIndex:"startTime",key:"startTime",width:180,render:d=>Jt(d).format("YYYY-MM-DD HH:mm:ss")},{title:"结束时间",dataIndex:"endTime",key:"endTime",width:180,render:d=>d?Jt(d).format("YYYY-MM-DD HH:mm:ss"):"-"},{title:"耗时",dataIndex:"duration",key:"duration",width:120,render:d=>{if(!d)return"-";const f=Math.floor(d/36e5),h=Math.floor(d%36e5/6e4);return f>0?`${f}小时${h}分钟`:`${h}分钟`}},{title:"操作",key:"action",width:150,fixed:"right",render:(d,f)=>_.jsxs(P.Space,{size:"small",children:[_.jsx(P.Button,{type:"primary",size:"small",icon:_.jsx(Ee.EyeOutlined,{}),onClick:()=>t(`/workflow/process/${f.id}`),children:"详情"}),f.status!=="completed"&&f.status!=="terminated"&&_.jsx(P.Button,{size:"small",danger:!0,icon:_.jsx(Ee.DeleteOutlined,{}),onClick:()=>l(f),children:"终止"})]})}];return _.jsx("div",{className:li.container,children:_.jsxs(P.Card,{className:li.card,children:[_.jsxs("div",{className:li.header,children:[_.jsxs("div",{className:li.titleSection,children:[_.jsxs(v9,{level:4,className:li.title,children:[_.jsx(Ee.FileTextOutlined,{className:li.titleIcon}),"我发起的流程"]}),_.jsxs("span",{className:li.subtitle,children:["共 ",_.jsx("strong",{children:r.total})," 个流程实例"]})]}),_.jsxs(P.Space,{children:[_.jsx(P.Input,{placeholder:"搜索流程名称",prefix:_.jsx(Ee.SearchOutlined,{}),value:o,onChange:d=>a(d.target.value),style:{width:240},allowClear:!0}),_.jsx(P.Button,{icon:_.jsx(Ee.ReloadOutlined,{}),onClick:()=>s(r.pageNum,r.pageSize),children:"刷新"})]})]}),_.jsx(P.Table,{columns:c,dataSource:r.list,rowKey:"id",loading:e,pagination:{current:r.pageNum,pageSize:r.pageSize,total:r.total,showSizeChanger:!0,showQuickJumper:!0,showTotal:d=>`共 ${d} 条`},onChange:d=>{s(d.current,d.pageSize)},scroll:{x:1800},locale:{emptyText:_.jsx(P.Empty,{image:P.Empty.PRESENTED_IMAGE_SIMPLE,description:"暂无流程实例"})}})]})})},_r={container:"_container_qprrv_1",card:"_card_qprrv_5",header:"_header_qprrv_9",titleSection:"_titleSection_qprrv_16",title:"_title_qprrv_16",titleIcon:"_titleIcon_qprrv_29",subtitle:"_subtitle_qprrv_33",processName:"_processName_qprrv_38",processIcon:"_processIcon_qprrv_44",nameInfo:"_nameInfo_qprrv_49",name:"_name_qprrv_49",key:"_key_qprrv_61"},{Title:y9}=P.Typography,{confirm:m9}=P.Modal,vE=()=>{const t=Rt.useNavigate(),[e]=P.Form.useForm(),[n,r]=je.useState(!1),[i,o]=je.useState([]),[a,s]=je.useState(""),[l,u]=je.useState(!1),[c,d]=je.useState(null),f=async()=>{try{r(!0);const b=await si.getProcessDefinitions();o(b)}catch(b){console.error("获取流程列表失败:",b)}finally{r(!1)}};je.useEffect(()=>{f()},[]);const h=()=>{d(null),e.resetFields(),u(!0)},p=b=>{d(b),e.setFieldsValue({name:b.name,key:b.key,description:b.description,category:b.category}),u(!0)},v=b=>{m9({title:"确认删除",icon:_.jsx(Ee.ExclamationCircleOutlined,{}),content:`确定要删除流程 "${b.name}" 吗?此操作不可恢复。`,okText:"删除",okType:"danger",cancelText:"取消",onOk:async()=>{try{P.message.success("删除成功"),f()}catch{P.message.error("删除失败")}}})},y=async b=>{try{c?P.message.success("更新成功"):P.message.success("创建成功"),u(!1),f()}catch{P.message.error("保存失败")}},g=b=>{switch(b){case"active":return _.jsx(P.Badge,{status:"processing",text:"已部署"});case"suspended":return _.jsx(P.Badge,{status:"warning",text:"已暂停"});default:return _.jsx(P.Badge,{status:"default",text:"草稿"})}},m=[{title:"流程名称",dataIndex:"name",key:"name",render:(b,A)=>_.jsxs("div",{className:_r.processName,children:[_.jsx(Ee.BranchesOutlined,{className:_r.processIcon}),_.jsxs("div",{className:_r.nameInfo,children:[_.jsx("span",{className:_r.name,children:b}),_.jsx("span",{className:_r.key,children:A.key})]})]})},{title:"版本",dataIndex:"version",key:"version",width:80,render:b=>_.jsxs(P.Tag,{color:"blue",children:["v",b]})},{title:"分类",dataIndex:"category",key:"category",width:120,render:b=>b||"-"},{title:"状态",dataIndex:"status",key:"status",width:100,render:b=>g(b)},{title:"更新时间",dataIndex:"updateTime",key:"updateTime",width:180,render:b=>Jt(b).format("YYYY-MM-DD HH:mm:ss")},{title:"操作",key:"action",width:180,fixed:"right",render:(b,A)=>_.jsxs(P.Space,{size:"small",children:[_.jsx(P.Button,{type:"primary",size:"small",icon:_.jsx(Ee.EditOutlined,{}),onClick:()=>t(`/workflow/designer/${A.id}`),children:"设计"}),_.jsx(P.Dropdown,{menu:{items:[{key:"edit",icon:_.jsx(Ee.EditOutlined,{}),label:"编辑信息",onClick:()=>p(A)},{key:"copy",icon:_.jsx(Ee.CopyOutlined,{}),label:"复制"},{type:"divider"},{key:"delete",icon:_.jsx(Ee.DeleteOutlined,{}),label:"删除",danger:!0,onClick:()=>v(A)}]},children:_.jsx(P.Button,{size:"small",children:_.jsx(Ee.MoreOutlined,{})})})]})}];return _.jsxs("div",{className:_r.container,children:[_.jsxs(P.Card,{className:_r.card,children:[_.jsxs("div",{className:_r.header,children:[_.jsxs("div",{className:_r.titleSection,children:[_.jsxs(y9,{level:4,className:_r.title,children:[_.jsx(Ee.BranchesOutlined,{className:_r.titleIcon}),"流程设计"]}),_.jsxs("span",{className:_r.subtitle,children:["共 ",_.jsx("strong",{children:i.length})," 个流程"]})]}),_.jsxs(P.Space,{children:[_.jsx(P.Input,{placeholder:"搜索流程名称",prefix:_.jsx(Ee.SearchOutlined,{}),value:a,onChange:b=>s(b.target.value),style:{width:240},allowClear:!0}),_.jsx(P.Button,{icon:_.jsx(Ee.ReloadOutlined,{}),onClick:f,children:"刷新"}),_.jsx(P.Button,{type:"primary",icon:_.jsx(Ee.PlusOutlined,{}),onClick:h,children:"新建流程"})]})]}),_.jsx(P.Table,{columns:m,dataSource:i,rowKey:"id",loading:n,pagination:!1,scroll:{x:1400},locale:{emptyText:_.jsx(P.Empty,{image:P.Empty.PRESENTED_IMAGE_SIMPLE,description:"暂无流程定义",children:_.jsx(P.Button,{type:"primary",icon:_.jsx(Ee.PlusOutlined,{}),onClick:h,children:"新建流程"})})}})]}),_.jsx(P.Modal,{title:c?"编辑流程":"新建流程",open:l,onOk:()=>e.submit(),onCancel:()=>u(!1),width:600,children:_.jsxs(P.Form,{form:e,layout:"vertical",onFinish:y,children:[_.jsx(P.Form.Item,{label:"流程名称",name:"name",rules:[{required:!0,message:"请输入流程名称"}],children:_.jsx(P.Input,{placeholder:"请输入流程名称"})}),_.jsx(P.Form.Item,{label:"流程标识",name:"key",rules:[{required:!0,message:"请输入流程标识"},{pattern:/^[a-z0-9_]+$/,message:"只能包含小写字母、数字和下划线"}],children:_.jsx(P.Input,{placeholder:"请输入流程标识,如:leave_process",disabled:!!c})}),_.jsx(P.Form.Item,{label:"分类",name:"category",children:_.jsxs(P.Select,{placeholder:"请选择分类",allowClear:!0,children:[_.jsx(P.Select.Option,{value:"人事",children:"人事"}),_.jsx(P.Select.Option,{value:"财务",children:"财务"}),_.jsx(P.Select.Option,{value:"行政",children:"行政"}),_.jsx(P.Select.Option,{value:"业务",children:"业务"}),_.jsx(P.Select.Option,{value:"IT",children:"IT"})]})}),_.jsx(P.Form.Item,{label:"描述",name:"description",children:_.jsx(P.Input.TextArea,{rows:4,placeholder:"请输入流程描述"})})]})})]})},Si={designerPage:"_designerPage_1qi53_1",toolbar:"_toolbar_1qi53_8",toolbarLeft:"_toolbarLeft_1qi53_18",toolbarCenter:"_toolbarCenter_1qi53_24",toolbarRight:"_toolbarRight_1qi53_30",processInfo:"_processInfo_1qi53_36",processName:"_processName_1qi53_42",processVersion:"_processVersion_1qi53_48",designerContainer:"_designerContainer_1qi53_56"},{Option:xF}=P.Select,{TextArea:EF}=P.Input,gE=()=>{const{processDefinitionId:t}=Rt.useParams(),e=Rt.useNavigate(),n=je.useRef(null),[r]=P.Form.useForm(),[i,o]=je.useState(!1),[a,s]=je.useState(!1),[l,u]=je.useState(!1),[c,d]=je.useState(null),[f,h]=je.useState(null),[p,v]=je.useState(!1),[y,g]=je.useState(null);je.useEffect(()=>{t&&m()},[t]);const m=async()=>{try{o(!0);const R=(await si.getProcessDefinitions()).find(Q=>Q.id===t);R&&d(R);const $=await Vs.getFlowGraph(t);g($)}catch(w){console.error("加载流程定义失败:",w),P.message.error("加载流程定义失败")}finally{o(!1)}},b=async()=>{if(n.current)try{s(!0);const w=n.current.getGraphData();await Vs.saveFlowGraph(t,w),P.message.success("保存成功")}catch(w){console.error("保存失败:",w),P.message.error("保存失败")}finally{s(!1)}},A=async()=>{try{u(!0),await Vs.deployProcess(t),P.message.success("部署成功")}catch(w){console.error("部署失败:",w),P.message.error("部署失败")}finally{u(!1)}},M=w=>{n.current&&n.current.exportImage(w)},N=w=>{f&&(f.setText(w.name),f.properties={...f.properties,...w},P.message.success("属性保存成功"),v(!1))};return _.jsxs("div",{className:Si.designerPage,children:[_.jsxs("div",{className:Si.toolbar,children:[_.jsxs("div",{className:Si.toolbarLeft,children:[_.jsx(P.Button,{icon:_.jsx(Ee.ArrowLeftOutlined,{}),onClick:()=>e("/workflow/processes"),children:"返回"}),_.jsx(P.Divider,{type:"vertical"}),c&&_.jsxs("div",{className:Si.processInfo,children:[_.jsx("span",{className:Si.processName,children:c.name}),_.jsxs("span",{className:Si.processVersion,children:["v",c.version]})]})]}),_.jsxs("div",{className:Si.toolbarCenter,children:[_.jsx(P.Button,{icon:_.jsx(Ee.UndoOutlined,{}),title:"撤销"}),_.jsx(P.Button,{icon:_.jsx(Ee.RedoOutlined,{}),title:"重做"}),_.jsx(P.Divider,{type:"vertical"}),_.jsx(P.Button,{icon:_.jsx(Ee.ZoomOutOutlined,{}),title:"缩小"}),_.jsx(P.Button,{icon:_.jsx(Ee.ZoomInOutlined,{}),title:"放大"}),_.jsx(P.Divider,{type:"vertical"}),_.jsx(P.Button,{icon:_.jsx(Ee.DeleteOutlined,{}),title:"删除",danger:!0})]}),_.jsxs("div",{className:Si.toolbarRight,children:[_.jsx(P.Button,{icon:_.jsx(Ee.DownloadOutlined,{}),onClick:()=>M("png"),children:"导出图片"}),_.jsx(P.Button,{icon:_.jsx(Ee.SaveOutlined,{}),loading:a,onClick:b,children:"保存"}),_.jsx(P.Popconfirm,{title:"部署流程",description:"部署后新的流程实例将使用此版本,确定部署吗?",onConfirm:A,okText:"确定",cancelText:"取消",children:_.jsx(P.Button,{type:"primary",icon:_.jsx(Ee.PlayCircleOutlined,{}),loading:l,children:"部署"})})]})]}),_.jsx("div",{className:Si.designerContainer,children:_.jsx(mx,{ref:n,processDefinitionId:t,initialData:y,readOnly:!1})}),_.jsx(P.Drawer,{title:"节点属性",placement:"right",width:400,onClose:()=>v(!1),open:p,children:_.jsxs(P.Form,{form:r,layout:"vertical",onFinish:N,children:[_.jsx(P.Form.Item,{label:"节点名称",name:"name",rules:[{required:!0,message:"请输入节点名称"}],children:_.jsx(P.Input,{placeholder:"请输入节点名称"})}),_.jsx(P.Form.Item,{label:"审批人类型",name:"approverType",children:_.jsxs(P.Select,{placeholder:"请选择审批人类型",children:[_.jsx(P.Select.Option,{value:"direct_leader",children:"直属上级"}),_.jsx(P.Select.Option,{value:"specify_user",children:"指定人员"}),_.jsx(P.Select.Option,{value:"role",children:"角色"}),_.jsx(P.Select.Option,{value:"dept_leader",children:"部门负责人"})]})}),_.jsx(P.Form.Item,{label:"指定审批人",name:"approver",children:_.jsx(P.Select,{mode:"multiple",placeholder:"请选择审批人",allowClear:!0})}),_.jsx(P.Form.Item,{label:"多人审批方式",name:"multipleApproval",children:_.jsxs(P.Radio.Group,{children:[_.jsx(P.Radio,{value:"sequential",children:"依次审批"}),_.jsx(P.Radio,{value:"parallel",children:"会签(同时审批)"}),_.jsx(P.Radio,{value:"any",children:"或签(任一人审批)"})]})}),_.jsx(P.Form.Item,{label:"允许转交",name:"allowTransfer",valuePropName:"checked",children:_.jsxs(P.Radio.Group,{children:[_.jsx(P.Radio,{value:!0,children:"是"}),_.jsx(P.Radio,{value:!1,children:"否"})]})}),_.jsx(P.Form.Item,{label:"允许加签",name:"allowAddSign",valuePropName:"checked",children:_.jsxs(P.Radio.Group,{children:[_.jsx(P.Radio,{value:!0,children:"是"}),_.jsx(P.Radio,{value:!1,children:"否"})]})}),_.jsx(P.Form.Item,{label:"节点说明",name:"description",children:_.jsx(P.Input.TextArea,{rows:4,placeholder:"请输入节点说明"})}),_.jsx(P.Form.Item,{children:_.jsx(P.Button,{type:"primary",htmlType:"submit",block:!0,children:"保存"})})]})})]})},Xt={container:"_container_r735y_1",card:"_card_r735y_5",loadingContainer:"_loadingContainer_r735y_9",emptyContainer:"_emptyContainer_r735y_10",header:"_header_r735y_18",title:"_title_r735y_25",titleIcon:"_titleIcon_r735y_32",headerActions:"_headerActions_r735y_36",descriptions:"_descriptions_r735y_55",timelineSection:"_timelineSection_r735y_59",timeline:"_timeline_r735y_59",timelineItem:"_timelineItem_r735y_67",timelineHeader:"_timelineHeader_r735y_71",timelineAction:"_timelineAction_r735y_78",timelineTask:"_timelineTask_r735y_83",timelineContent:"_timelineContent_r735y_91",timelineUser:"_timelineUser_r735y_97",timelineTime:"_timelineTime_r735y_105",timelineDuration:"_timelineDuration_r735y_113",timelineComment:"_timelineComment_r735y_121",startIcon:"_startIcon_r735y_131",completeIcon:"_completeIcon_r735y_135",rejectIcon:"_rejectIcon_r735y_139",terminateIcon:"_terminateIcon_r735y_147"},{Title:yE,Text:YF}=P.Typography,{Step:VF}=P.Steps,mE=()=>{const{processInstanceId:t}=Rt.useParams(),e=Rt.useNavigate(),[n,r]=je.useState(!1),[i,o]=je.useState(null),[a,s]=je.useState([]),[l,u]=je.useState(0),c=async()=>{if(t)try{r(!0);const[p,v]=await Promise.all([si.getProcessDetail(t),Vs.getApprovalHistory(t)]);o(p),s(v);const y=v.filter(g=>g.action==="complete").length;u(y)}catch(p){console.error("获取流程详情失败:",p)}finally{r(!1)}};je.useEffect(()=>{c()},[t]);const d=p=>{switch(p){case"running":return _.jsx(P.Badge,{status:"processing",text:"运行中"});case"completed":return _.jsx(P.Badge,{status:"success",text:"已完成"});case"suspended":return _.jsx(P.Badge,{status:"warning",text:"已暂停"});case"terminated":return _.jsx(P.Badge,{status:"error",text:"已终止"});default:return _.jsx(P.Badge,{status:"default",text:"未知"})}},f=p=>{switch(p){case"start":return _.jsx(PlayCircleOutlined,{className:Xt.startIcon});case"complete":return _.jsx(Ee.CheckCircleOutlined,{className:Xt.completeIcon});case"reject":return _.jsx(Ee.CloseCircleOutlined,{className:Xt.rejectIcon});case"terminate":return _.jsx(Ee.ExclamationCircleOutlined,{className:Xt.terminateIcon});default:return _.jsx(Ee.ClockCircleOutlined,{})}},h=p=>{switch(p){case"start":return"发起流程";case"complete":return"审批通过";case"reject":return"审批驳回";case"transfer":return"转交";case"delegate":return"委托";case"terminate":return"终止流程";default:return p}};return n?_.jsx("div",{className:Xt.loadingContainer,children:_.jsx(P.Spin,{size:"large",tip:"加载中..."})}):i?_.jsx("div",{className:Xt.container,children:_.jsxs(P.Card,{className:Xt.card,children:[_.jsxs("div",{className:Xt.header,children:[_.jsx(P.Button,{icon:_.jsx(Ee.ArrowLeftOutlined,{}),onClick:()=>e(-1),children:"返回"}),_.jsxs(yE,{level:4,className:Xt.title,children:[_.jsx(Ee.FileTextOutlined,{className:Xt.titleIcon}),"流程详情"]}),_.jsx("div",{className:Xt.headerActions,children:d(i.status)})]}),_.jsx(P.Divider,{}),_.jsxs(P.Descriptions,{title:"基本信息",bordered:!0,column:2,className:Xt.descriptions,children:[_.jsx(P.Descriptions.Item,{label:"流程名称",children:i.processDefinitionName}),_.jsx(P.Descriptions.Item,{label:"流程实例ID",children:i.id}),_.jsx(P.Descriptions.Item,{label:"业务标识",children:i.businessKey||"-"}),_.jsx(P.Descriptions.Item,{label:"状态",children:d(i.status)}),_.jsx(P.Descriptions.Item,{label:"发起人",children:i.startUserName||"系统"}),_.jsx(P.Descriptions.Item,{label:"发起时间",children:Jt(i.startTime).format("YYYY-MM-DD HH:mm:ss")}),i.endTime&&_.jsxs(_.Fragment,{children:[_.jsx(P.Descriptions.Item,{label:"结束时间",children:Jt(i.endTime).format("YYYY-MM-DD HH:mm:ss")}),_.jsx(P.Descriptions.Item,{label:"总耗时",children:(()=>{const p=i.duration||0,v=Math.floor(p/864e5),y=Math.floor(p%864e5/36e5),g=Math.floor(p%36e5/6e4);return v>0?`${v}天${y}小时`:y>0?`${y}小时${g}分钟`:`${g}分钟`})()})]})]}),_.jsx(P.Divider,{}),_.jsxs("div",{className:Xt.timelineSection,children:[_.jsx(yE,{level:5,children:"审批历史"}),a.length>0?_.jsx(P.Timeline,{mode:"left",className:Xt.timeline,children:a.map((p,v)=>_.jsx(P.Timeline.Item,{dot:f(p.action),color:p.action==="complete"?"green":p.action==="reject"||p.action==="terminate"?"red":"blue",children:_.jsxs("div",{className:Xt.timelineItem,children:[_.jsxs("div",{className:Xt.timelineHeader,children:[_.jsx("span",{className:Xt.timelineAction,children:h(p.action)}),_.jsx("span",{className:Xt.timelineTask,children:p.taskName})]}),_.jsxs("div",{className:Xt.timelineContent,children:[_.jsxs("span",{className:Xt.timelineUser,children:[_.jsx(Ee.UserOutlined,{})," ",p.assigneeName||p.assignee]}),_.jsxs("span",{className:Xt.timelineTime,children:[_.jsx(Ee.ClockCircleOutlined,{})," ",Jt(p.createTime).format("YYYY-MM-DD HH:mm:ss")]}),p.duration&&_.jsxs("span",{className:Xt.timelineDuration,children:["耗时: ",Math.floor(p.duration/1e3/60),"分钟"]})]}),p.comment&&_.jsxs("div",{className:Xt.timelineComment,children:["审批意见: ",p.comment]})]})},p.id))}):_.jsx(P.Empty,{description:"暂无审批历史"})]})]})}):_.jsxs("div",{className:Xt.emptyContainer,children:[_.jsx(P.Empty,{description:"流程实例不存在或已被删除"}),_.jsx(P.Button,{type:"primary",onClick:()=>e(-1),style:{marginTop:16},children:"返回"})]})},Dt={container:"_container_1wfr0_1",card:"_card_1wfr0_5",loadingContainer:"_loadingContainer_1wfr0_9",emptyContainer:"_emptyContainer_1wfr0_10",header:"_header_1wfr0_18",title:"_title_1wfr0_25",titleIcon:"_titleIcon_1wfr0_32",headerActions:"_headerActions_1wfr0_36",content:"_content_1wfr0_42",leftPanel:"_leftPanel_1wfr0_47",rightPanel:"_rightPanel_1wfr0_51",descriptions:"_descriptions_1wfr0_55",approvalSection:"_approvalSection_1wfr0_59",approvalForm:"_approvalForm_1wfr0_66",formActions:"_formActions_1wfr0_70",historyCard:"_historyCard_1wfr0_76",historyTimeline:"_historyTimeline_1wfr0_80",historyItem:"_historyItem_1wfr0_85",historyHeader:"_historyHeader_1wfr0_89",historyAction:"_historyAction_1wfr0_96",historyTime:"_historyTime_1wfr0_80",historyContent:"_historyContent_1wfr0_106",historyUser:"_historyUser_1wfr0_112",historyComment:"_historyComment_1wfr0_118",startIcon:"_startIcon_1wfr0_128",completeIcon:"_completeIcon_1wfr0_132",rejectIcon:"_rejectIcon_1wfr0_136",transferIcon:"_transferIcon_1wfr0_140"},{Title:_E,Text:w$}=P.Typography,{TextArea:_9}=P.Input,{confirm:b9}=P.Modal,bE=()=>{const{taskId:t}=Rt.useParams(),e=Rt.useNavigate(),[n]=P.Form.useForm(),[r,i]=je.useState(!1),[o,a]=je.useState(!1),[s,l]=je.useState(null),[u,c]=je.useState([]),[d,f]=je.useState("approve"),h=async()=>{if(t)try{i(!0);const[m,b]=await Promise.all([si.getTaskDetail(t),Vs.getApprovalHistory(t)]);l(m),c(b)}catch(m){console.error("获取任务详情失败:",m),P.message.error("获取任务详情失败")}finally{i(!1)}};je.useEffect(()=>{h()},[t]);const p=async m=>{if(t)try{a(!0),await si.completeTask(t,{action:m.action,comment:m.comment,formData:m.formData}),P.message.success("审批操作成功"),e("/workflow/todo")}catch(b){console.error("审批操作失败:",b),P.message.error("审批操作失败")}finally{a(!1)}},v=()=>{b9({title:"转交任务",icon:_.jsx(Ee.ExclamationCircleOutlined,{}),content:_.jsx("div",{style:{marginTop:16},children:_.jsx(P.Select,{showSearch:!0,placeholder:"选择转交人",style:{width:"100%"},options:[]})}),onOk:()=>{P.message.success("转交成功")}})},y=m=>{switch(m){case"start":return _.jsx(PlayCircleOutlined,{className:Dt.startIcon});case"complete":return _.jsx(Ee.CheckCircleOutlined,{className:Dt.completeIcon});case"reject":return _.jsx(Ee.CloseCircleOutlined,{className:Dt.rejectIcon});case"transfer":return _.jsx(Ee.UserOutlined,{className:Dt.transferIcon});default:return _.jsx(Ee.ClockCircleOutlined,{})}},g=m=>{switch(m){case"start":return"发起流程";case"complete":return"审批通过";case"reject":return"审批驳回";case"transfer":return"转交他人";case"delegate":return"委托处理";default:return m}};return r?_.jsx("div",{className:Dt.loadingContainer,children:_.jsx(P.Spin,{size:"large",tip:"加载中..."})}):s?_.jsx("div",{className:Dt.container,children:_.jsxs(P.Card,{className:Dt.card,children:[_.jsxs("div",{className:Dt.header,children:[_.jsx(P.Button,{icon:_.jsx(Ee.ArrowLeftOutlined,{}),onClick:()=>e(-1),children:"返回"}),_.jsxs(_E,{level:4,className:Dt.title,children:[_.jsx(Ee.FileTextOutlined,{className:Dt.titleIcon}),"任务详情"]}),_.jsxs("div",{className:Dt.headerActions,children:[s.status==="pending"&&_.jsx(Badge,{status:"processing",text:"待处理"}),s.status==="claimed"&&_.jsx(Badge,{status:"warning",text:"处理中"}),s.status==="completed"&&_.jsx(Badge,{status:"success",text:"已完成"})]})]}),_.jsx(P.Divider,{}),_.jsxs("div",{className:Dt.content,children:[_.jsxs("div",{className:Dt.leftPanel,children:[_.jsxs(P.Descriptions,{title:"任务信息",bordered:!0,column:1,className:Dt.descriptions,children:[_.jsx(P.Descriptions.Item,{label:"任务名称",children:s.name}),_.jsx(P.Descriptions.Item,{label:"任务ID",children:s.id}),_.jsx(P.Descriptions.Item,{label:"所属流程",children:s.processDefinitionName}),_.jsx(P.Descriptions.Item,{label:"流程实例ID",children:s.processInstanceId}),_.jsx(P.Descriptions.Item,{label:"当前处理人",children:s.assigneeName||s.assignee||"-"}),_.jsxs(P.Descriptions.Item,{label:"任务状态",children:[s.status==="pending"&&_.jsx(P.Tag,{color:"blue",children:"待处理"}),s.status==="claimed"&&_.jsx(P.Tag,{color:"orange",children:"处理中"}),s.status==="completed"&&_.jsx(P.Tag,{color:"green",children:"已完成"})]}),_.jsx(P.Descriptions.Item,{label:"创建时间",children:Jt(s.createTime).format("YYYY-MM-DD HH:mm:ss")}),_.jsx(P.Descriptions.Item,{label:"认领时间",children:s.claimTime?Jt(s.claimTime).format("YYYY-MM-DD HH:mm:ss"):"-"}),s.dueTime&&_.jsx(P.Descriptions.Item,{label:"到期时间",children:Jt(s.dueTime).format("YYYY-MM-DD HH:mm:ss")}),_.jsx(P.Descriptions.Item,{label:"优先级",children:_.jsx(P.Tag,{color:s.priority>=80?"red":s.priority>=50?"orange":"default",children:s.priority>=80?"紧急":s.priority>=50?"高":"普通"})})]}),s.status==="pending"&&_.jsxs(_.Fragment,{children:[_.jsx(P.Divider,{}),_.jsxs("div",{className:Dt.approvalSection,children:[_.jsx(_E,{level:5,children:"审批操作"}),_.jsxs(P.Form,{form:n,layout:"vertical",onFinish:p,className:Dt.approvalForm,children:[_.jsx(P.Form.Item,{name:"action",label:"审批意见",initialValue:"approve",children:_.jsxs(P.Radio.Group,{onChange:m=>f(m.target.value),buttonStyle:"solid",children:[_.jsxs(P.Radio.Button,{value:"approve",children:[_.jsx(Ee.CheckOutlined,{})," 通过"]}),_.jsxs(P.Radio.Button,{value:"reject",children:[_.jsx(Ee.CloseOutlined,{})," 驳回"]})]})}),_.jsx(P.Form.Item,{name:"comment",label:"审批意见",rules:[{required:d==="reject",message:"驳回时必须填写审批意见"}],children:_.jsx(_9,{rows:4,placeholder:"请输入审批意见...",showCount:!0,maxLength:500})}),_.jsx(P.Form.Item,{className:Dt.formActions,children:_.jsxs(P.Space,{children:[_.jsx(P.Button,{type:"primary",htmlType:"submit",loading:o,icon:_.jsx(Ee.CheckCircleOutlined,{}),children:"提交"}),_.jsx(P.Button,{onClick:v,icon:_.jsx(Ee.UserOutlined,{}),children:"转交"}),_.jsx(P.Button,{onClick:()=>e(-1),children:"取消"})]})})]})]})]})]}),_.jsx("div",{className:Dt.rightPanel,children:_.jsx(P.Card,{title:"审批历史",className:Dt.historyCard,children:u.length>0?_.jsx(P.Timeline,{mode:"left",className:Dt.historyTimeline,children:u.map(m=>_.jsx(P.Timeline.Item,{dot:y(m.action),color:m.action==="complete"?"green":m.action==="reject"||m.action==="terminate"?"red":"blue",children:_.jsxs("div",{className:Dt.historyItem,children:[_.jsxs("div",{className:Dt.historyHeader,children:[_.jsx("span",{className:Dt.historyAction,children:g(m.action)}),_.jsx("span",{className:Dt.historyTime,children:Jt(m.createTime).format("MM-DD HH:mm")})]}),_.jsx("div",{className:Dt.historyContent,children:_.jsxs("span",{className:Dt.historyUser,children:[_.jsx(Ee.UserOutlined,{})," ",m.assigneeName||m.assignee]})}),m.comment&&_.jsx("div",{className:Dt.historyComment,children:m.comment})]})},m.id))}):_.jsx(P.Empty,{description:"暂无审批历史",image:P.Empty.PRESENTED_IMAGE_SIMPLE})})})]})]})}):_.jsxs("div",{className:Dt.emptyContainer,children:[_.jsx(P.Empty,{description:"任务不存在或已被处理"}),_.jsx(P.Button,{type:"primary",onClick:()=>e(-1),style:{marginTop:16},children:"返回"})]})};function x9(){return _.jsxs(Rt.Routes,{children:[_.jsx(Rt.Route,{index:!0,element:_.jsx(Rt.Navigate,{to:"dashboard",replace:!0})}),_.jsx(Rt.Route,{path:"dashboard",element:_.jsx(dE,{})}),_.jsx(Rt.Route,{path:"todo",element:_.jsx(fE,{})}),_.jsx(Rt.Route,{path:"done",element:_.jsx(hE,{})}),_.jsx(Rt.Route,{path:"my-processes",element:_.jsx(pE,{})}),_.jsx(Rt.Route,{path:"processes",element:_.jsx(vE,{})}),_.jsx(Rt.Route,{path:"designer/:id",element:_.jsx(gE,{})}),_.jsx(Rt.Route,{path:"process/:processInstanceId",element:_.jsx(mE,{})}),_.jsx(Rt.Route,{path:"task/:taskId",element:_.jsx(bE,{})})]})}mt.DoneList=hE,mt.FlowDesigner=mx,mt.MyProcesses=pE,mt.ProcessDesigner=gE,mt.ProcessDetail=mE,mt.ProcessList=vE,mt.TaskDetail=bE,mt.TodoList=fE,mt.WorkflowApp=x9,mt.WorkflowDashboard=dE,Object.defineProperty(mt,Symbol.toStringTag,{value:"Module"})}));
143
+ `+i)}}catch{}}throw n}}_request(t,e){typeof t=="string"?(e=e||{},e.url=t):e=t||{},e=Oo(this.defaults,e);const{transitional:n,paramsSerializer:r,headers:i}=e;n!==void 0&&Ic.assertOptions(n,{silentJSONParsing:En.transitional(En.boolean),forcedJSONParsing:En.transitional(En.boolean),clarifyTimeoutError:En.transitional(En.boolean),legacyInterceptorReqResOrdering:En.transitional(En.boolean),advertiseZstdAcceptEncoding:En.transitional(En.boolean),validateStatusUndefinedResolves:En.transitional(En.boolean)},!1),r!=null&&(B.isFunction(r)?e.paramsSerializer={serialize:r}:Ic.assertOptions(r,{encode:En.function,serialize:En.function},!0)),e.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?e.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:e.allowAbsoluteUrls=!0),Ic.assertOptions(e,{baseUrl:En.spelling("baseURL"),withXsrfToken:En.spelling("withXSRFToken")},!0),e.method=(e.method||this.defaults.method||"get").toLowerCase();let o=i&&B.merge(i.common,i[e.method]);i&&B.forEach(["delete","get","head","post","put","patch","query","common"],h=>{delete i[h]}),e.headers=xn.concat(o,i);const a=[];let s=!0;this.interceptors.request.forEach(function(h){if(typeof h.runWhen=="function"&&h.runWhen(e)===!1)return;s=s&&h.synchronous;const p=e.transitional||sp;p&&p.legacyInterceptorReqResOrdering?a.unshift(h.fulfilled,h.rejected):a.push(h.fulfilled,h.rejected)});const l=[];this.interceptors.response.forEach(function(h){l.push(h.fulfilled,h.rejected)});let u,c=0,d;if(!s){const h=[oE.bind(this),void 0];for(h.unshift(...a),h.push(...l),d=h.length,u=Promise.resolve(e);c<d;)u=u.then(h[c++],h[c++]);return u}d=a.length;let f=e;for(;c<d;){const h=a[c++],p=a[c++];try{f=h(f)}catch(v){p.call(this,v);break}}try{u=oE.call(this,f)}catch(h){return Promise.reject(h)}for(c=0,d=l.length;c<d;)u=u.then(l[c++],l[c++]);return u}getUri(t){t=Oo(this.defaults,t);const e=Kx(t.baseURL,t.url,t.allowAbsoluteUrls,t);return Fx(e,t.params,t.paramsSerializer)}};B.forEach(["delete","get","head","options"],function(t){Ao.prototype[t]=function(e,n){return this.request(Oo(n||{},{method:t,url:e,data:n&&B.hasOwnProp(n,"data")?n.data:void 0}))}}),B.forEach(["post","put","patch","query"],function(t){function e(n){return function(r,i,o){return this.request(Oo(o||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:r,data:i}))}}Ao.prototype[t]=e(),t!=="query"&&(Ao.prototype[t+"Form"]=e(!0))});let o9=class SE{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});const r=this;this.promise.then(i=>{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](i);r._listeners=null}),this.promise.then=i=>{let o;const a=new Promise(s=>{r.subscribe(s),o=s}).then(i);return a.cancel=function(){r.unsubscribe(o)},a},e(function(i,o,a){r.reason||(r.reason=new Ys(i,o,a),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const e=new AbortController,n=r=>{e.abort(r)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new SE(function(n){e=n}),cancel:e}}};function a9(t){return function(e){return t.apply(null,e)}}function s9(t){return B.isObject(t)&&t.isAxiosError===!0}const pp={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(pp).forEach(([t,e])=>{pp[e]=t});function sE(t){const e=new Ao(t),n=Ex(Ao.prototype.request,e);return B.extend(n,Ao.prototype,e,{allOwnKeys:!0}),B.extend(n,e,null,{allOwnKeys:!0}),n.create=function(r){return sE(Oo(t,r))},n}const Kt=sE(Gs);Kt.Axios=Ao,Kt.CanceledError=Ys,Kt.CancelToken=o9,Kt.isCancel=Ux,Kt.VERSION=dp,Kt.toFormData=Pc,Kt.AxiosError=_e,Kt.Cancel=Kt.CanceledError,Kt.all=function(t){return Promise.all(t)},Kt.spread=a9,Kt.isAxiosError=s9,Kt.mergeConfig=Oo,Kt.AxiosHeaders=xn,Kt.formToJSON=t=>Wx(B.isHTMLForm(t)?new FormData(t):t),Kt.getAdapter=iE.getAdapter,Kt.HttpStatusCode=pp,Kt.default=Kt;const{Axios:P9,AxiosError:D9,CanceledError:R9,isCancel:L9,CancelToken:j9,VERSION:I9,all:k9,Cancel:B9,isAxiosError:F9,spread:$9,toFormData:H9,AxiosHeaders:z9,HttpStatusCode:W9,formToJSON:U9,getAdapter:X9,mergeConfig:G9,create:Y9}=Kt;function l9(t){if(t&&typeof t=="object"&&"code"in t&&"data"in t){const e=t;return e.code!==200?Promise.reject(new Error(e.message||"请求失败")):e.data}return t}function u9(t,e={}){const{tokenKey:n="token",userInfoKey:r="userInfo",unauthorizedRedirect:i="/login"}=e;t.interceptors.request.use(o=>{const a=localStorage.getItem(n);return a&&(o.headers.Authorization=`Bearer ${a}`),o}),t.interceptors.response.use(o=>l9(o.data),o=>{var a,s,l;return((a=o.response)==null?void 0:a.status)===401?(localStorage.removeItem(n),localStorage.removeItem(r),window.location.href=i):((s=o.response)==null?void 0:s.status)===403?console.error("没有权限访问该资源"):((l=o.response)==null?void 0:l.status)===500&&console.error("服务器内部错误"),Promise.reject(o)})}function lE(t={}){const e=Kt.create({baseURL:t.baseURL??"/api",timeout:t.timeout??1e4});return u9(e,{tokenKey:t.tokenKey,userInfoKey:t.userInfoKey,unauthorizedRedirect:t.unauthorizedRedirect}),e}const Na=lE();lE();class V9 extends je.Component{constructor(e){super(e),a7(this,"handleReset",()=>{this.setState({hasError:!1,error:null,errorInfo:null}),typeof this.props.onReset=="function"&&this.props.onReset()}),this.state={hasError:!1,error:null,errorInfo:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,n){console.error("[ErrorBoundary] caught error:",e,n),this.setState({errorInfo:n})}render(){if(!this.state.hasError)return this.props.children;const{fallbackTitle:e="组件加载失败",fallbackDescription:n,showReload:r=!0}=this.props,i=this.state.error&&(this.state.error.message||String(this.state.error))||"未知错误";return mr.jsxs("div",{style:{padding:24,background:"#fff2f0",border:"1px solid #ffccc7",borderRadius:8,minHeight:200},children:[mr.jsx(P.Alert,{type:"error",showIcon:!0,icon:mr.jsx(Ee.BugOutlined,{}),message:e,description:mr.jsxs("div",{children:[mr.jsx("div",{style:{marginBottom:8},children:n||"当前组件发生了异常,已被错误边界捕获。其他功能仍可正常使用。"}),mr.jsx("div",{style:{fontFamily:"Menlo, Monaco, Consolas, monospace",fontSize:12,color:"#cf1322",background:"#fff",padding:8,borderRadius:4,border:"1px solid #ffccc7",wordBreak:"break-word",whiteSpace:"pre-wrap"},children:i})]})}),r&&mr.jsx(P.Space,{style:{marginTop:16},children:mr.jsx(P.Button,{icon:mr.jsx(Ee.ReloadOutlined,{}),onClick:this.handleReset,children:"重试"})})]})}}const{Title:K9,Text:q9,Paragraph:Z9}=P.Typography;let c9="/api";function uE(){return Kt.create({baseURL:c9,timeout:15e3})}const d9=uE();uE(),d9.interceptors.request.use(t=>{const e=localStorage.getItem("token");return e&&(t.headers.Authorization=`Bearer ${e}`),t});const{Header:Q9,Sider:J9,Content:e6}=P.Layout,{Text:t6}=P.Typography,{Title:n6,Text:r6}=P.Typography,{Option:i6}=P.Select,{TextArea:o6}=P.Input,f9=[{type:"STRING",label:"字符串",icon:mr.jsx(Ee.FileTextOutlined,{}),color:"#1677ff",desc:"短文本 (默认 VARCHAR 255)"},{type:"TEXT",label:"长文本",icon:mr.jsx(Ee.FileTextOutlined,{}),color:"#13c2c2",desc:"TEXT 类型, 无长度限制"},{type:"INT",label:"整数",icon:"#",color:"#722ed1",desc:"INT 整数"},{type:"LONG",label:"长整数",icon:"#",color:"#722ed1",desc:"BIGINT 长整数"},{type:"DECIMAL",label:"小数",icon:"0.00",color:"#eb2f96",desc:"DECIMAL 精确小数"},{type:"BOOLEAN",label:"布尔",icon:mr.jsx(Ee.CheckCircleOutlined,{}),color:"#52c41a",desc:"TINYINT(1) 是/否"},{type:"DATE",label:"日期",icon:"📅",color:"#fa8c16",desc:"DATE yyyy-MM-dd"},{type:"DATETIME",label:"日期时间",icon:"🕐",color:"#fa8c16",desc:"DATETIME yyyy-MM-dd HH:mm:ss"},{type:"JSON",label:"JSON",icon:"{}",color:"#2f54eb",desc:"JSON 字符串"},{type:"REF",label:"引用",icon:"🔗",color:"#8c8c8c",desc:"外键引用 BIGINT"}];Object.fromEntries(f9.map(t=>[t.type,t]));const{Option:a6}=P.Select;P.Input.TextArea,P.Input.TextArea;const{Text:s6,Paragraph:l6}=P.Typography,{TextArea:u6}=P.Input,{TextArea:c6}=P.Input,{Text:d6,Paragraph:f6}=P.Typography,{TextArea:h6}=P.Input,{Text:p6,Paragraph:v6}=P.Typography,{Text:g6}=P.Typography,{Text:y6}=P.Typography,{TextArea:m6}=P.Input,{Text:_6,Paragraph:b6}=P.Typography,{Text:x6}=P.Typography,{Text:E6}=P.Typography,{Text:w6}=P.Typography,{Text:S6}=P.Typography;function cE(t){return{list:e=>Na.get(`/${t}/list`,{params:e}).then(n=>n.data),page:e=>Na.get(`/${t}/page`,{params:e}).then(n=>n.data),get:e=>Na.get(`/${t}/${e}`).then(n=>n.data),create:e=>Na.post(`/${t}`,e).then(n=>n.data),update:(e,n)=>Na.put(`/${t}/${e}`,n).then(r=>r.data),delete:e=>Na.delete(`/${t}/${e}`).then(n=>n.data)}}const si=cE("approval"),Vs=cE("designer"),zn={dashboard:{padding:24},statsRow:{marginBottom:24},statCard:{marginBottom:16},todoIcon:{color:"#1677ff"},doneIcon:{color:"#52c41a"},initiatedIcon:{color:"#722ed1"},statFooter:{textAlign:"right",marginTop:8},todoCard:{marginTop:16},taskTitle:{display:"flex",justifyContent:"space-between",alignItems:"center"},taskDesc:{fontSize:12,color:"#888"}},dE=()=>{const t=Rt.useNavigate(),[e,n]=je.useState(!0),[r,i]=je.useState({todoCount:0,doneCount:0,initiatedCount:0,todoList:[]}),o=async()=>{try{n(!0);const l=await si.getDashboardStats("admin");i({...l,todoList:l.todoList||[]})}catch(l){console.error("获取仪表盘数据失败:",l)}finally{n(!1)}};je.useEffect(()=>{o()},[]);const a=l=>l>=80?"red":l>=50?"orange":"default",s=l=>l>=80?"紧急":l>=50?"高":"普通";return _.jsxs("div",{className:zn.dashboard,children:[_.jsxs(P.Row,{gutter:16,className:zn.statsRow,children:[_.jsx(P.Col,{xs:24,sm:8,children:_.jsxs(P.Card,{loading:e,className:zn.statCard,children:[_.jsx(P.Statistic,{title:"待办任务",value:r.todoCount,prefix:_.jsx(Ee.ClockCircleOutlined,{className:zn.todoIcon}),valueStyle:{color:"#1677ff"}}),_.jsx("div",{className:zn.statFooter,children:_.jsxs(Rt.Link,{to:"/workflow/todo",children:["去处理 ",_.jsx(Ee.RightOutlined,{})]})})]})}),_.jsx(P.Col,{xs:24,sm:8,children:_.jsxs(P.Card,{loading:e,className:zn.statCard,children:[_.jsx(P.Statistic,{title:"已办任务",value:r.doneCount,prefix:_.jsx(Ee.CheckCircleOutlined,{className:zn.doneIcon}),valueStyle:{color:"#52c41a"}}),_.jsx("div",{className:zn.statFooter,children:_.jsxs(Rt.Link,{to:"/workflow/done",children:["查看全部 ",_.jsx(Ee.RightOutlined,{})]})})]})}),_.jsx(P.Col,{xs:24,sm:8,children:_.jsxs(P.Card,{loading:e,className:zn.statCard,children:[_.jsx(P.Statistic,{title:"我发起的",value:r.initiatedCount,prefix:_.jsx(Ee.FileTextOutlined,{className:zn.initiatedIcon}),valueStyle:{color:"#722ed1"}}),_.jsx("div",{className:zn.statFooter,children:_.jsxs(Rt.Link,{to:"/workflow/my-processes",children:["查看全部 ",_.jsx(Ee.RightOutlined,{})]})})]})})]}),_.jsx(P.Card,{title:_.jsxs("span",{children:[_.jsx(Ee.ExclamationCircleOutlined,{style:{color:"#faad14",marginRight:8}}),"待办任务"]}),extra:_.jsx(Rt.Link,{to:"/workflow/todo",children:"查看更多"}),loading:e,className:zn.todoCard,children:r.todoList.length>0?_.jsx(P.List,{dataSource:r.todoList.slice(0,5),renderItem:l=>_.jsx(P.List.Item,{actions:[_.jsx(P.Button,{type:"primary",size:"small",onClick:()=>t(`/workflow/task/${l.id}`),children:"处理"})],children:_.jsx(P.List.Item.Meta,{title:_.jsxs("div",{className:zn.taskTitle,children:[_.jsx("span",{children:l.name}),_.jsx(P.Tag,{color:a(l.priority),children:s(l.priority)})]}),description:_.jsxs("div",{className:zn.taskDesc,children:[_.jsxs("span",{children:["流程: ",l.processDefinitionName]}),_.jsxs("span",{children:["创建时间: ",l.createTime]})]})})})}):_.jsx(P.Empty,{description:"暂无待办任务"})})]})},zr={container:"_container_1nmlu_1",card:"_card_1nmlu_5",header:"_header_1nmlu_9",titleSection:"_titleSection_1nmlu_16",title:"_title_1nmlu_16",titleIcon:"_titleIcon_1nmlu_29",subtitle:"_subtitle_1nmlu_33",taskName:"_taskName_1nmlu_38",name:"_name_1nmlu_44",overdue:"_overdue_1nmlu_57"},{Title:h9}=P.Typography,fE=()=>{const t=Rt.useNavigate(),[e,n]=je.useState(!1),[r,i]=je.useState({list:[],total:0,pageNum:1,pageSize:10,pages:0}),[o,a]=je.useState(""),s=async(f=1,h=10)=>{try{n(!0);const p=await si.getTodoList("admin",f,h);i(p)}catch(p){console.error("获取待办列表失败:",p)}finally{n(!1)}};je.useEffect(()=>{s()},[]);const l=f=>f>=80?"紧急":f>=50?"高":"普通",u=f=>{if(!f)return!1;const h=Jt(f),p=Jt(),v=h.diff(p,"hour");return v>=0&&v<=24},c=f=>f?Jt(f).isBefore(Jt()):!1,d=[{title:"任务名称",dataIndex:"name",key:"name",render:(f,h)=>_.jsxs("div",{className:zr.taskName,children:[_.jsx("span",{className:zr.name,children:f}),c(h.dueTime)&&_.jsx(P.Tag,{color:"red",size:"small",children:"已逾期"}),u(h.dueTime)&&!c(h.dueTime)&&_.jsx(P.Tag,{color:"orange",size:"small",children:"即将到期"})]})},{title:"所属流程",dataIndex:"processDefinitionName",key:"processDefinitionName",render:f=>_.jsx(P.Tooltip,{title:f,children:_.jsx("span",{className:zr.ellipsis,children:f})})},{title:"优先级",dataIndex:"priority",key:"priority",width:100,render:f=>_.jsx(P.Badge,{status:f>=80?"error":f>=50?"warning":"default",text:l(f)})},{title:"创建时间",dataIndex:"createTime",key:"createTime",width:180,render:f=>Jt(f).format("YYYY-MM-DD HH:mm")},{title:"到期时间",dataIndex:"dueTime",key:"dueTime",width:180,render:f=>{if(!f)return"-";const h=Jt(f),p=Jt(),v=h.isBefore(p);return _.jsx("span",{className:v?zr.overdue:"",children:Jt(f).format("YYYY-MM-DD HH:mm")})}},{title:"操作",key:"action",width:120,fixed:"right",render:(f,h)=>_.jsx(P.Space,{size:"small",children:_.jsx(P.Button,{type:"primary",size:"small",icon:_.jsx(Ee.CheckCircleOutlined,{}),onClick:()=>t(`/workflow/task/${h.id}`),children:"审批"})})}];return _.jsx("div",{className:zr.container,children:_.jsxs(P.Card,{className:zr.card,children:[_.jsxs("div",{className:zr.header,children:[_.jsxs("div",{className:zr.titleSection,children:[_.jsxs(h9,{level:4,className:zr.title,children:[_.jsx(Ee.ClockCircleOutlined,{className:zr.titleIcon}),"待办任务"]}),_.jsxs("span",{className:zr.subtitle,children:["共 ",_.jsx("strong",{children:r.total})," 条待办"]})]}),_.jsxs(P.Space,{children:[_.jsx(P.Input,{placeholder:"搜索任务名称",prefix:_.jsx(Ee.SearchOutlined,{}),value:o,onChange:f=>a(f.target.value),style:{width:240},allowClear:!0}),_.jsx(P.Button,{icon:_.jsx(Ee.ReloadOutlined,{}),onClick:()=>s(r.pageNum,r.pageSize),children:"刷新"})]})]}),_.jsx(P.Table,{columns:d,dataSource:r.list,rowKey:"id",loading:e,pagination:{current:r.pageNum,pageSize:r.pageSize,total:r.total,showSizeChanger:!0,showQuickJumper:!0,showTotal:f=>`共 ${f} 条`},onChange:f=>{s(f.current,f.pageSize)},scroll:{x:1400},locale:{emptyText:_.jsx(P.Empty,{image:P.Empty.PRESENTED_IMAGE_SIMPLE,description:"暂无待办任务"})}})]})})},wi={container:"_container_9q4zo_1",card:"_card_9q4zo_5",header:"_header_9q4zo_9",titleSection:"_titleSection_9q4zo_16",title:"_title_9q4zo_16",titleIcon:"_titleIcon_9q4zo_29",subtitle:"_subtitle_9q4zo_33",taskName:"_taskName_9q4zo_38",ellipsis:"_ellipsis_9q4zo_43"},{Title:p9}=P.Typography,hE=()=>{const t=Rt.useNavigate(),[e,n]=je.useState(!1),[r,i]=je.useState({list:[],total:0,pageNum:1,pageSize:10,pages:0}),[o,a]=je.useState(""),s=async(u=1,c=10)=>{try{n(!0);const d=await si.getDoneList("admin",u,c);i(d)}catch(d){console.error("获取已办列表失败:",d)}finally{n(!1)}};je.useEffect(()=>{s()},[]);const l=[{title:"任务名称",dataIndex:"name",key:"name",render:u=>_.jsx("span",{className:wi.taskName,children:u})},{title:"所属流程",dataIndex:"processDefinitionName",key:"processDefinitionName",render:u=>_.jsx(P.Tooltip,{title:u,children:_.jsx("span",{className:wi.ellipsis,children:u})})},{title:"处理结果",dataIndex:"action",key:"action",width:120,render:u=>_.jsx(P.Tag,{color:u==="approve"?"success":"error",children:u==="approve"?"已通过":"已驳回"})},{title:"处理时间",dataIndex:"endTime",key:"endTime",width:180,render:u=>Jt(u).format("YYYY-MM-DD HH:mm:ss")},{title:"操作",key:"action",width:120,fixed:"right",render:(u,c)=>_.jsx(P.Space,{size:"small",children:_.jsx(P.Button,{type:"text",icon:_.jsx(Ee.EyeOutlined,{}),onClick:()=>t(`/workflow/task/${c.id}`),children:"查看"})})}];return _.jsx("div",{className:wi.container,children:_.jsxs(P.Card,{className:wi.card,children:[_.jsxs("div",{className:wi.header,children:[_.jsxs("div",{className:wi.titleSection,children:[_.jsxs(p9,{level:4,className:wi.title,children:[_.jsx(Ee.HistoryOutlined,{className:wi.titleIcon}),"已办任务"]}),_.jsxs("span",{className:wi.subtitle,children:["共 ",_.jsx("strong",{children:r.total})," 条记录"]})]}),_.jsxs(P.Space,{children:[_.jsx(P.Input,{placeholder:"搜索任务名称",prefix:_.jsx(Ee.SearchOutlined,{}),value:o,onChange:u=>a(u.target.value),style:{width:240},allowClear:!0}),_.jsx(P.Button,{icon:_.jsx(Ee.ReloadOutlined,{}),onClick:()=>s(r.pageNum,r.pageSize),children:"刷新"})]})]}),_.jsx(P.Table,{columns:l,dataSource:r.list,rowKey:"id",loading:e,pagination:{current:r.pageNum,pageSize:r.pageSize,total:r.total,showSizeChanger:!0,showQuickJumper:!0,showTotal:u=>`共 ${u} 条`},onChange:u=>{s(u.current,u.pageSize)},locale:{emptyText:_.jsx(P.Empty,{image:P.Empty.PRESENTED_IMAGE_SIMPLE,description:"暂无已办任务"})}})]})})},li={container:"_container_120ju_1",card:"_card_120ju_5",header:"_header_120ju_9",titleSection:"_titleSection_120ju_16",title:"_title_120ju_16",titleIcon:"_titleIcon_120ju_29",subtitle:"_subtitle_120ju_33",processName:"_processName_120ju_38",processIcon:"_processIcon_120ju_44",name:"_name_120ju_49"},{Title:v9}=P.Typography,{confirm:g9}=P.Modal,pE=()=>{const t=Rt.useNavigate(),[e,n]=je.useState(!1),[r,i]=je.useState({list:[],total:0,pageNum:1,pageSize:10,pages:0}),[o,a]=je.useState(""),s=async(d=1,f=10)=>{try{n(!0);const h=await si.getMyProcesses("admin",d,f);i(h)}catch(h){console.error("获取我的流程失败:",h)}finally{n(!1)}};je.useEffect(()=>{s()},[]);const l=d=>{g9({title:"确认删除",icon:_.jsx(Ee.ExclamationCircleOutlined,{}),content:`确定要删除流程实例 "${d.processDefinitionName}" 吗?此操作不可恢复。`,okText:"删除",okType:"danger",cancelText:"取消",onOk:async()=>{try{await si.deleteProcessInstance(d.id),message.success("删除成功"),s()}catch{message.error("删除失败")}}})},u=d=>{switch(d){case"running":return _.jsx(P.Badge,{status:"processing",text:"运行中"});case"completed":return _.jsx(P.Badge,{status:"success",text:"已完成"});case"suspended":return _.jsx(P.Badge,{status:"warning",text:"已暂停"});case"terminated":return _.jsx(P.Badge,{status:"error",text:"已终止"});default:return _.jsx(P.Badge,{status:"default",text:"未知"})}},c=[{title:"流程名称",dataIndex:"processDefinitionName",key:"processDefinitionName",render:d=>_.jsxs("div",{className:li.processName,children:[_.jsx(Ee.FileTextOutlined,{className:li.processIcon}),_.jsx("span",{className:li.name,children:d})]})},{title:"业务标识",dataIndex:"businessKey",key:"businessKey",render:d=>d||"-"},{title:"状态",dataIndex:"status",key:"status",width:100,render:d=>u(d)},{title:"发起人",dataIndex:"startUserName",key:"startUserName",width:120,render:d=>d||"系统"},{title:"启动时间",dataIndex:"startTime",key:"startTime",width:180,render:d=>Jt(d).format("YYYY-MM-DD HH:mm:ss")},{title:"结束时间",dataIndex:"endTime",key:"endTime",width:180,render:d=>d?Jt(d).format("YYYY-MM-DD HH:mm:ss"):"-"},{title:"耗时",dataIndex:"duration",key:"duration",width:120,render:d=>{if(!d)return"-";const f=Math.floor(d/36e5),h=Math.floor(d%36e5/6e4);return f>0?`${f}小时${h}分钟`:`${h}分钟`}},{title:"操作",key:"action",width:150,fixed:"right",render:(d,f)=>_.jsxs(P.Space,{size:"small",children:[_.jsx(P.Button,{type:"primary",size:"small",icon:_.jsx(Ee.EyeOutlined,{}),onClick:()=>t(`/workflow/process/${f.id}`),children:"详情"}),f.status!=="completed"&&f.status!=="terminated"&&_.jsx(P.Button,{size:"small",danger:!0,icon:_.jsx(Ee.DeleteOutlined,{}),onClick:()=>l(f),children:"终止"})]})}];return _.jsx("div",{className:li.container,children:_.jsxs(P.Card,{className:li.card,children:[_.jsxs("div",{className:li.header,children:[_.jsxs("div",{className:li.titleSection,children:[_.jsxs(v9,{level:4,className:li.title,children:[_.jsx(Ee.FileTextOutlined,{className:li.titleIcon}),"我发起的流程"]}),_.jsxs("span",{className:li.subtitle,children:["共 ",_.jsx("strong",{children:r.total})," 个流程实例"]})]}),_.jsxs(P.Space,{children:[_.jsx(P.Input,{placeholder:"搜索流程名称",prefix:_.jsx(Ee.SearchOutlined,{}),value:o,onChange:d=>a(d.target.value),style:{width:240},allowClear:!0}),_.jsx(P.Button,{icon:_.jsx(Ee.ReloadOutlined,{}),onClick:()=>s(r.pageNum,r.pageSize),children:"刷新"})]})]}),_.jsx(P.Table,{columns:c,dataSource:r.list,rowKey:"id",loading:e,pagination:{current:r.pageNum,pageSize:r.pageSize,total:r.total,showSizeChanger:!0,showQuickJumper:!0,showTotal:d=>`共 ${d} 条`},onChange:d=>{s(d.current,d.pageSize)},scroll:{x:1800},locale:{emptyText:_.jsx(P.Empty,{image:P.Empty.PRESENTED_IMAGE_SIMPLE,description:"暂无流程实例"})}})]})})},_r={container:"_container_qprrv_1",card:"_card_qprrv_5",header:"_header_qprrv_9",titleSection:"_titleSection_qprrv_16",title:"_title_qprrv_16",titleIcon:"_titleIcon_qprrv_29",subtitle:"_subtitle_qprrv_33",processName:"_processName_qprrv_38",processIcon:"_processIcon_qprrv_44",nameInfo:"_nameInfo_qprrv_49",name:"_name_qprrv_49",key:"_key_qprrv_61"},{Title:y9}=P.Typography,{confirm:m9}=P.Modal,vE=()=>{const t=Rt.useNavigate(),[e]=P.Form.useForm(),[n,r]=je.useState(!1),[i,o]=je.useState([]),[a,s]=je.useState(""),[l,u]=je.useState(!1),[c,d]=je.useState(null),f=async()=>{try{r(!0);const b=await si.getProcessDefinitions();o(b)}catch(b){console.error("获取流程列表失败:",b)}finally{r(!1)}};je.useEffect(()=>{f()},[]);const h=()=>{d(null),e.resetFields(),u(!0)},p=b=>{d(b),e.setFieldsValue({name:b.name,key:b.key,description:b.description,category:b.category}),u(!0)},v=b=>{m9({title:"确认删除",icon:_.jsx(Ee.ExclamationCircleOutlined,{}),content:`确定要删除流程 "${b.name}" 吗?此操作不可恢复。`,okText:"删除",okType:"danger",cancelText:"取消",onOk:async()=>{try{P.message.success("删除成功"),f()}catch{P.message.error("删除失败")}}})},y=async b=>{try{c?P.message.success("更新成功"):P.message.success("创建成功"),u(!1),f()}catch{P.message.error("保存失败")}},g=b=>{switch(b){case"active":return _.jsx(P.Badge,{status:"processing",text:"已部署"});case"suspended":return _.jsx(P.Badge,{status:"warning",text:"已暂停"});default:return _.jsx(P.Badge,{status:"default",text:"草稿"})}},m=[{title:"流程名称",dataIndex:"name",key:"name",render:(b,A)=>_.jsxs("div",{className:_r.processName,children:[_.jsx(Ee.BranchesOutlined,{className:_r.processIcon}),_.jsxs("div",{className:_r.nameInfo,children:[_.jsx("span",{className:_r.name,children:b}),_.jsx("span",{className:_r.key,children:A.key})]})]})},{title:"版本",dataIndex:"version",key:"version",width:80,render:b=>_.jsxs(P.Tag,{color:"blue",children:["v",b]})},{title:"分类",dataIndex:"category",key:"category",width:120,render:b=>b||"-"},{title:"状态",dataIndex:"status",key:"status",width:100,render:b=>g(b)},{title:"更新时间",dataIndex:"updateTime",key:"updateTime",width:180,render:b=>Jt(b).format("YYYY-MM-DD HH:mm:ss")},{title:"操作",key:"action",width:180,fixed:"right",render:(b,A)=>_.jsxs(P.Space,{size:"small",children:[_.jsx(P.Button,{type:"primary",size:"small",icon:_.jsx(Ee.EditOutlined,{}),onClick:()=>t(`/workflow/designer/${A.id}`),children:"设计"}),_.jsx(P.Dropdown,{menu:{items:[{key:"edit",icon:_.jsx(Ee.EditOutlined,{}),label:"编辑信息",onClick:()=>p(A)},{key:"copy",icon:_.jsx(Ee.CopyOutlined,{}),label:"复制"},{type:"divider"},{key:"delete",icon:_.jsx(Ee.DeleteOutlined,{}),label:"删除",danger:!0,onClick:()=>v(A)}]},children:_.jsx(P.Button,{size:"small",children:_.jsx(Ee.MoreOutlined,{})})})]})}];return _.jsxs("div",{className:_r.container,children:[_.jsxs(P.Card,{className:_r.card,children:[_.jsxs("div",{className:_r.header,children:[_.jsxs("div",{className:_r.titleSection,children:[_.jsxs(y9,{level:4,className:_r.title,children:[_.jsx(Ee.BranchesOutlined,{className:_r.titleIcon}),"流程设计"]}),_.jsxs("span",{className:_r.subtitle,children:["共 ",_.jsx("strong",{children:i.length})," 个流程"]})]}),_.jsxs(P.Space,{children:[_.jsx(P.Input,{placeholder:"搜索流程名称",prefix:_.jsx(Ee.SearchOutlined,{}),value:a,onChange:b=>s(b.target.value),style:{width:240},allowClear:!0}),_.jsx(P.Button,{icon:_.jsx(Ee.ReloadOutlined,{}),onClick:f,children:"刷新"}),_.jsx(P.Button,{type:"primary",icon:_.jsx(Ee.PlusOutlined,{}),onClick:h,children:"新建流程"})]})]}),_.jsx(P.Table,{columns:m,dataSource:i,rowKey:"id",loading:n,pagination:!1,scroll:{x:1400},locale:{emptyText:_.jsx(P.Empty,{image:P.Empty.PRESENTED_IMAGE_SIMPLE,description:"暂无流程定义",children:_.jsx(P.Button,{type:"primary",icon:_.jsx(Ee.PlusOutlined,{}),onClick:h,children:"新建流程"})})}})]}),_.jsx(P.Modal,{title:c?"编辑流程":"新建流程",open:l,onOk:()=>e.submit(),onCancel:()=>u(!1),width:600,children:_.jsxs(P.Form,{form:e,layout:"vertical",onFinish:y,children:[_.jsx(P.Form.Item,{label:"流程名称",name:"name",rules:[{required:!0,message:"请输入流程名称"}],children:_.jsx(P.Input,{placeholder:"请输入流程名称"})}),_.jsx(P.Form.Item,{label:"流程标识",name:"key",rules:[{required:!0,message:"请输入流程标识"},{pattern:/^[a-z0-9_]+$/,message:"只能包含小写字母、数字和下划线"}],children:_.jsx(P.Input,{placeholder:"请输入流程标识,如:leave_process",disabled:!!c})}),_.jsx(P.Form.Item,{label:"分类",name:"category",children:_.jsxs(P.Select,{placeholder:"请选择分类",allowClear:!0,children:[_.jsx(P.Select.Option,{value:"人事",children:"人事"}),_.jsx(P.Select.Option,{value:"财务",children:"财务"}),_.jsx(P.Select.Option,{value:"行政",children:"行政"}),_.jsx(P.Select.Option,{value:"业务",children:"业务"}),_.jsx(P.Select.Option,{value:"IT",children:"IT"})]})}),_.jsx(P.Form.Item,{label:"描述",name:"description",children:_.jsx(P.Input.TextArea,{rows:4,placeholder:"请输入流程描述"})})]})})]})},Si={designerPage:"_designerPage_1qi53_1",toolbar:"_toolbar_1qi53_8",toolbarLeft:"_toolbarLeft_1qi53_18",toolbarCenter:"_toolbarCenter_1qi53_24",toolbarRight:"_toolbarRight_1qi53_30",processInfo:"_processInfo_1qi53_36",processName:"_processName_1qi53_42",processVersion:"_processVersion_1qi53_48",designerContainer:"_designerContainer_1qi53_56"},{Option:xF}=P.Select,{TextArea:EF}=P.Input,gE=()=>{const{processDefinitionId:t}=Rt.useParams(),e=Rt.useNavigate(),n=je.useRef(null),[r]=P.Form.useForm(),[i,o]=je.useState(!1),[a,s]=je.useState(!1),[l,u]=je.useState(!1),[c,d]=je.useState(null),[f,h]=je.useState(null),[p,v]=je.useState(!1),[y,g]=je.useState(null);je.useEffect(()=>{t&&m()},[t]);const m=async()=>{try{o(!0);const R=(await si.getProcessDefinitions()).find(Q=>Q.id===t);R&&d(R);const $=await Vs.getFlowGraph(t);g($)}catch(w){console.error("加载流程定义失败:",w),P.message.error("加载流程定义失败")}finally{o(!1)}},b=async()=>{if(n.current)try{s(!0);const w=n.current.getGraphData();await Vs.saveFlowGraph(t,w),P.message.success("保存成功")}catch(w){console.error("保存失败:",w),P.message.error("保存失败")}finally{s(!1)}},A=async()=>{try{u(!0),await Vs.deployProcess(t),P.message.success("部署成功")}catch(w){console.error("部署失败:",w),P.message.error("部署失败")}finally{u(!1)}},M=w=>{n.current&&n.current.exportImage(w)},N=w=>{f&&(f.setText(w.name),f.properties={...f.properties,...w},P.message.success("属性保存成功"),v(!1))};return _.jsxs("div",{className:Si.designerPage,children:[_.jsxs("div",{className:Si.toolbar,children:[_.jsxs("div",{className:Si.toolbarLeft,children:[_.jsx(P.Button,{icon:_.jsx(Ee.ArrowLeftOutlined,{}),onClick:()=>e("/workflow/processes"),children:"返回"}),_.jsx(P.Divider,{type:"vertical"}),c&&_.jsxs("div",{className:Si.processInfo,children:[_.jsx("span",{className:Si.processName,children:c.name}),_.jsxs("span",{className:Si.processVersion,children:["v",c.version]})]})]}),_.jsxs("div",{className:Si.toolbarCenter,children:[_.jsx(P.Button,{icon:_.jsx(Ee.UndoOutlined,{}),title:"撤销"}),_.jsx(P.Button,{icon:_.jsx(Ee.RedoOutlined,{}),title:"重做"}),_.jsx(P.Divider,{type:"vertical"}),_.jsx(P.Button,{icon:_.jsx(Ee.ZoomOutOutlined,{}),title:"缩小"}),_.jsx(P.Button,{icon:_.jsx(Ee.ZoomInOutlined,{}),title:"放大"}),_.jsx(P.Divider,{type:"vertical"}),_.jsx(P.Button,{icon:_.jsx(Ee.DeleteOutlined,{}),title:"删除",danger:!0})]}),_.jsxs("div",{className:Si.toolbarRight,children:[_.jsx(P.Button,{icon:_.jsx(Ee.DownloadOutlined,{}),onClick:()=>M("png"),children:"导出图片"}),_.jsx(P.Button,{icon:_.jsx(Ee.SaveOutlined,{}),loading:a,onClick:b,children:"保存"}),_.jsx(P.Popconfirm,{title:"部署流程",description:"部署后新的流程实例将使用此版本,确定部署吗?",onConfirm:A,okText:"确定",cancelText:"取消",children:_.jsx(P.Button,{type:"primary",icon:_.jsx(Ee.PlayCircleOutlined,{}),loading:l,children:"部署"})})]})]}),_.jsx("div",{className:Si.designerContainer,children:_.jsx(mx,{ref:n,processDefinitionId:t,initialData:y,readOnly:!1})}),_.jsx(P.Drawer,{title:"节点属性",placement:"right",width:400,onClose:()=>v(!1),open:p,children:_.jsxs(P.Form,{form:r,layout:"vertical",onFinish:N,children:[_.jsx(P.Form.Item,{label:"节点名称",name:"name",rules:[{required:!0,message:"请输入节点名称"}],children:_.jsx(P.Input,{placeholder:"请输入节点名称"})}),_.jsx(P.Form.Item,{label:"审批人类型",name:"approverType",children:_.jsxs(P.Select,{placeholder:"请选择审批人类型",children:[_.jsx(P.Select.Option,{value:"direct_leader",children:"直属上级"}),_.jsx(P.Select.Option,{value:"specify_user",children:"指定人员"}),_.jsx(P.Select.Option,{value:"role",children:"角色"}),_.jsx(P.Select.Option,{value:"dept_leader",children:"部门负责人"})]})}),_.jsx(P.Form.Item,{label:"指定审批人",name:"approver",children:_.jsx(P.Select,{mode:"multiple",placeholder:"请选择审批人",allowClear:!0})}),_.jsx(P.Form.Item,{label:"多人审批方式",name:"multipleApproval",children:_.jsxs(P.Radio.Group,{children:[_.jsx(P.Radio,{value:"sequential",children:"依次审批"}),_.jsx(P.Radio,{value:"parallel",children:"会签(同时审批)"}),_.jsx(P.Radio,{value:"any",children:"或签(任一人审批)"})]})}),_.jsx(P.Form.Item,{label:"允许转交",name:"allowTransfer",valuePropName:"checked",children:_.jsxs(P.Radio.Group,{children:[_.jsx(P.Radio,{value:!0,children:"是"}),_.jsx(P.Radio,{value:!1,children:"否"})]})}),_.jsx(P.Form.Item,{label:"允许加签",name:"allowAddSign",valuePropName:"checked",children:_.jsxs(P.Radio.Group,{children:[_.jsx(P.Radio,{value:!0,children:"是"}),_.jsx(P.Radio,{value:!1,children:"否"})]})}),_.jsx(P.Form.Item,{label:"节点说明",name:"description",children:_.jsx(P.Input.TextArea,{rows:4,placeholder:"请输入节点说明"})}),_.jsx(P.Form.Item,{children:_.jsx(P.Button,{type:"primary",htmlType:"submit",block:!0,children:"保存"})})]})})]})},Xt={container:"_container_r735y_1",card:"_card_r735y_5",loadingContainer:"_loadingContainer_r735y_9",emptyContainer:"_emptyContainer_r735y_10",header:"_header_r735y_18",title:"_title_r735y_25",titleIcon:"_titleIcon_r735y_32",headerActions:"_headerActions_r735y_36",descriptions:"_descriptions_r735y_55",timelineSection:"_timelineSection_r735y_59",timeline:"_timeline_r735y_59",timelineItem:"_timelineItem_r735y_67",timelineHeader:"_timelineHeader_r735y_71",timelineAction:"_timelineAction_r735y_78",timelineTask:"_timelineTask_r735y_83",timelineContent:"_timelineContent_r735y_91",timelineUser:"_timelineUser_r735y_97",timelineTime:"_timelineTime_r735y_105",timelineDuration:"_timelineDuration_r735y_113",timelineComment:"_timelineComment_r735y_121",startIcon:"_startIcon_r735y_131",completeIcon:"_completeIcon_r735y_135",rejectIcon:"_rejectIcon_r735y_139",terminateIcon:"_terminateIcon_r735y_147"},{Title:yE,Text:YF}=P.Typography,{Step:VF}=P.Steps,mE=()=>{const{processInstanceId:t}=Rt.useParams(),e=Rt.useNavigate(),[n,r]=je.useState(!1),[i,o]=je.useState(null),[a,s]=je.useState([]),[l,u]=je.useState(0),c=async()=>{if(t)try{r(!0);const[p,v]=await Promise.all([si.getProcessDetail(t),Vs.getApprovalHistory(t)]);o(p),s(v);const y=v.filter(g=>g.action==="complete").length;u(y)}catch(p){console.error("获取流程详情失败:",p)}finally{r(!1)}};je.useEffect(()=>{c()},[t]);const d=p=>{switch(p){case"running":return _.jsx(P.Badge,{status:"processing",text:"运行中"});case"completed":return _.jsx(P.Badge,{status:"success",text:"已完成"});case"suspended":return _.jsx(P.Badge,{status:"warning",text:"已暂停"});case"terminated":return _.jsx(P.Badge,{status:"error",text:"已终止"});default:return _.jsx(P.Badge,{status:"default",text:"未知"})}},f=p=>{switch(p){case"start":return _.jsx(PlayCircleOutlined,{className:Xt.startIcon});case"complete":return _.jsx(Ee.CheckCircleOutlined,{className:Xt.completeIcon});case"reject":return _.jsx(Ee.CloseCircleOutlined,{className:Xt.rejectIcon});case"terminate":return _.jsx(Ee.ExclamationCircleOutlined,{className:Xt.terminateIcon});default:return _.jsx(Ee.ClockCircleOutlined,{})}},h=p=>{switch(p){case"start":return"发起流程";case"complete":return"审批通过";case"reject":return"审批驳回";case"transfer":return"转交";case"delegate":return"委托";case"terminate":return"终止流程";default:return p}};return n?_.jsx("div",{className:Xt.loadingContainer,children:_.jsx(P.Spin,{size:"large",tip:"加载中..."})}):i?_.jsx("div",{className:Xt.container,children:_.jsxs(P.Card,{className:Xt.card,children:[_.jsxs("div",{className:Xt.header,children:[_.jsx(P.Button,{icon:_.jsx(Ee.ArrowLeftOutlined,{}),onClick:()=>e(-1),children:"返回"}),_.jsxs(yE,{level:4,className:Xt.title,children:[_.jsx(Ee.FileTextOutlined,{className:Xt.titleIcon}),"流程详情"]}),_.jsx("div",{className:Xt.headerActions,children:d(i.status)})]}),_.jsx(P.Divider,{}),_.jsxs(P.Descriptions,{title:"基本信息",bordered:!0,column:2,className:Xt.descriptions,children:[_.jsx(P.Descriptions.Item,{label:"流程名称",children:i.processDefinitionName}),_.jsx(P.Descriptions.Item,{label:"流程实例ID",children:i.id}),_.jsx(P.Descriptions.Item,{label:"业务标识",children:i.businessKey||"-"}),_.jsx(P.Descriptions.Item,{label:"状态",children:d(i.status)}),_.jsx(P.Descriptions.Item,{label:"发起人",children:i.startUserName||"系统"}),_.jsx(P.Descriptions.Item,{label:"发起时间",children:Jt(i.startTime).format("YYYY-MM-DD HH:mm:ss")}),i.endTime&&_.jsxs(_.Fragment,{children:[_.jsx(P.Descriptions.Item,{label:"结束时间",children:Jt(i.endTime).format("YYYY-MM-DD HH:mm:ss")}),_.jsx(P.Descriptions.Item,{label:"总耗时",children:(()=>{const p=i.duration||0,v=Math.floor(p/864e5),y=Math.floor(p%864e5/36e5),g=Math.floor(p%36e5/6e4);return v>0?`${v}天${y}小时`:y>0?`${y}小时${g}分钟`:`${g}分钟`})()})]})]}),_.jsx(P.Divider,{}),_.jsxs("div",{className:Xt.timelineSection,children:[_.jsx(yE,{level:5,children:"审批历史"}),a.length>0?_.jsx(P.Timeline,{mode:"left",className:Xt.timeline,children:a.map((p,v)=>_.jsx(P.Timeline.Item,{dot:f(p.action),color:p.action==="complete"?"green":p.action==="reject"||p.action==="terminate"?"red":"blue",children:_.jsxs("div",{className:Xt.timelineItem,children:[_.jsxs("div",{className:Xt.timelineHeader,children:[_.jsx("span",{className:Xt.timelineAction,children:h(p.action)}),_.jsx("span",{className:Xt.timelineTask,children:p.taskName})]}),_.jsxs("div",{className:Xt.timelineContent,children:[_.jsxs("span",{className:Xt.timelineUser,children:[_.jsx(Ee.UserOutlined,{})," ",p.assigneeName||p.assignee]}),_.jsxs("span",{className:Xt.timelineTime,children:[_.jsx(Ee.ClockCircleOutlined,{})," ",Jt(p.createTime).format("YYYY-MM-DD HH:mm:ss")]}),p.duration&&_.jsxs("span",{className:Xt.timelineDuration,children:["耗时: ",Math.floor(p.duration/1e3/60),"分钟"]})]}),p.comment&&_.jsxs("div",{className:Xt.timelineComment,children:["审批意见: ",p.comment]})]})},p.id))}):_.jsx(P.Empty,{description:"暂无审批历史"})]})]})}):_.jsxs("div",{className:Xt.emptyContainer,children:[_.jsx(P.Empty,{description:"流程实例不存在或已被删除"}),_.jsx(P.Button,{type:"primary",onClick:()=>e(-1),style:{marginTop:16},children:"返回"})]})},Dt={container:"_container_1wfr0_1",card:"_card_1wfr0_5",loadingContainer:"_loadingContainer_1wfr0_9",emptyContainer:"_emptyContainer_1wfr0_10",header:"_header_1wfr0_18",title:"_title_1wfr0_25",titleIcon:"_titleIcon_1wfr0_32",headerActions:"_headerActions_1wfr0_36",content:"_content_1wfr0_42",leftPanel:"_leftPanel_1wfr0_47",rightPanel:"_rightPanel_1wfr0_51",descriptions:"_descriptions_1wfr0_55",approvalSection:"_approvalSection_1wfr0_59",approvalForm:"_approvalForm_1wfr0_66",formActions:"_formActions_1wfr0_70",historyCard:"_historyCard_1wfr0_76",historyTimeline:"_historyTimeline_1wfr0_80",historyItem:"_historyItem_1wfr0_85",historyHeader:"_historyHeader_1wfr0_89",historyAction:"_historyAction_1wfr0_96",historyTime:"_historyTime_1wfr0_80",historyContent:"_historyContent_1wfr0_106",historyUser:"_historyUser_1wfr0_112",historyComment:"_historyComment_1wfr0_118",startIcon:"_startIcon_1wfr0_128",completeIcon:"_completeIcon_1wfr0_132",rejectIcon:"_rejectIcon_1wfr0_136",transferIcon:"_transferIcon_1wfr0_140"},{Title:_E,Text:w$}=P.Typography,{TextArea:_9}=P.Input,{confirm:b9}=P.Modal,bE=()=>{const{taskId:t}=Rt.useParams(),e=Rt.useNavigate(),[n]=P.Form.useForm(),[r,i]=je.useState(!1),[o,a]=je.useState(!1),[s,l]=je.useState(null),[u,c]=je.useState([]),[d,f]=je.useState("approve"),h=async()=>{if(t)try{i(!0);const[m,b]=await Promise.all([si.getTaskDetail(t),Vs.getApprovalHistory(t)]);l(m),c(b)}catch(m){console.error("获取任务详情失败:",m),P.message.error("获取任务详情失败")}finally{i(!1)}};je.useEffect(()=>{h()},[t]);const p=async m=>{if(t)try{a(!0),await si.completeTask(t,{action:m.action,comment:m.comment,formData:m.formData}),P.message.success("审批操作成功"),e("/workflow/todo")}catch(b){console.error("审批操作失败:",b),P.message.error("审批操作失败")}finally{a(!1)}},v=()=>{b9({title:"转交任务",icon:_.jsx(Ee.ExclamationCircleOutlined,{}),content:_.jsx("div",{style:{marginTop:16},children:_.jsx(P.Select,{showSearch:!0,placeholder:"选择转交人",style:{width:"100%"},options:[]})}),onOk:()=>{P.message.success("转交成功")}})},y=m=>{switch(m){case"start":return _.jsx(PlayCircleOutlined,{className:Dt.startIcon});case"complete":return _.jsx(Ee.CheckCircleOutlined,{className:Dt.completeIcon});case"reject":return _.jsx(Ee.CloseCircleOutlined,{className:Dt.rejectIcon});case"transfer":return _.jsx(Ee.UserOutlined,{className:Dt.transferIcon});default:return _.jsx(Ee.ClockCircleOutlined,{})}},g=m=>{switch(m){case"start":return"发起流程";case"complete":return"审批通过";case"reject":return"审批驳回";case"transfer":return"转交他人";case"delegate":return"委托处理";default:return m}};return r?_.jsx("div",{className:Dt.loadingContainer,children:_.jsx(P.Spin,{size:"large",tip:"加载中..."})}):s?_.jsx("div",{className:Dt.container,children:_.jsxs(P.Card,{className:Dt.card,children:[_.jsxs("div",{className:Dt.header,children:[_.jsx(P.Button,{icon:_.jsx(Ee.ArrowLeftOutlined,{}),onClick:()=>e(-1),children:"返回"}),_.jsxs(_E,{level:4,className:Dt.title,children:[_.jsx(Ee.FileTextOutlined,{className:Dt.titleIcon}),"任务详情"]}),_.jsxs("div",{className:Dt.headerActions,children:[s.status==="pending"&&_.jsx(Badge,{status:"processing",text:"待处理"}),s.status==="claimed"&&_.jsx(Badge,{status:"warning",text:"处理中"}),s.status==="completed"&&_.jsx(Badge,{status:"success",text:"已完成"})]})]}),_.jsx(P.Divider,{}),_.jsxs("div",{className:Dt.content,children:[_.jsxs("div",{className:Dt.leftPanel,children:[_.jsxs(P.Descriptions,{title:"任务信息",bordered:!0,column:1,className:Dt.descriptions,children:[_.jsx(P.Descriptions.Item,{label:"任务名称",children:s.name}),_.jsx(P.Descriptions.Item,{label:"任务ID",children:s.id}),_.jsx(P.Descriptions.Item,{label:"所属流程",children:s.processDefinitionName}),_.jsx(P.Descriptions.Item,{label:"流程实例ID",children:s.processInstanceId}),_.jsx(P.Descriptions.Item,{label:"当前处理人",children:s.assigneeName||s.assignee||"-"}),_.jsxs(P.Descriptions.Item,{label:"任务状态",children:[s.status==="pending"&&_.jsx(P.Tag,{color:"blue",children:"待处理"}),s.status==="claimed"&&_.jsx(P.Tag,{color:"orange",children:"处理中"}),s.status==="completed"&&_.jsx(P.Tag,{color:"green",children:"已完成"})]}),_.jsx(P.Descriptions.Item,{label:"创建时间",children:Jt(s.createTime).format("YYYY-MM-DD HH:mm:ss")}),_.jsx(P.Descriptions.Item,{label:"认领时间",children:s.claimTime?Jt(s.claimTime).format("YYYY-MM-DD HH:mm:ss"):"-"}),s.dueTime&&_.jsx(P.Descriptions.Item,{label:"到期时间",children:Jt(s.dueTime).format("YYYY-MM-DD HH:mm:ss")}),_.jsx(P.Descriptions.Item,{label:"优先级",children:_.jsx(P.Tag,{color:s.priority>=80?"red":s.priority>=50?"orange":"default",children:s.priority>=80?"紧急":s.priority>=50?"高":"普通"})})]}),s.status==="pending"&&_.jsxs(_.Fragment,{children:[_.jsx(P.Divider,{}),_.jsxs("div",{className:Dt.approvalSection,children:[_.jsx(_E,{level:5,children:"审批操作"}),_.jsxs(P.Form,{form:n,layout:"vertical",onFinish:p,className:Dt.approvalForm,children:[_.jsx(P.Form.Item,{name:"action",label:"审批意见",initialValue:"approve",children:_.jsxs(P.Radio.Group,{onChange:m=>f(m.target.value),buttonStyle:"solid",children:[_.jsxs(P.Radio.Button,{value:"approve",children:[_.jsx(Ee.CheckOutlined,{})," 通过"]}),_.jsxs(P.Radio.Button,{value:"reject",children:[_.jsx(Ee.CloseOutlined,{})," 驳回"]})]})}),_.jsx(P.Form.Item,{name:"comment",label:"审批意见",rules:[{required:d==="reject",message:"驳回时必须填写审批意见"}],children:_.jsx(_9,{rows:4,placeholder:"请输入审批意见...",showCount:!0,maxLength:500})}),_.jsx(P.Form.Item,{className:Dt.formActions,children:_.jsxs(P.Space,{children:[_.jsx(P.Button,{type:"primary",htmlType:"submit",loading:o,icon:_.jsx(Ee.CheckCircleOutlined,{}),children:"提交"}),_.jsx(P.Button,{onClick:v,icon:_.jsx(Ee.UserOutlined,{}),children:"转交"}),_.jsx(P.Button,{onClick:()=>e(-1),children:"取消"})]})})]})]})]})]}),_.jsx("div",{className:Dt.rightPanel,children:_.jsx(P.Card,{title:"审批历史",className:Dt.historyCard,children:u.length>0?_.jsx(P.Timeline,{mode:"left",className:Dt.historyTimeline,children:u.map(m=>_.jsx(P.Timeline.Item,{dot:y(m.action),color:m.action==="complete"?"green":m.action==="reject"||m.action==="terminate"?"red":"blue",children:_.jsxs("div",{className:Dt.historyItem,children:[_.jsxs("div",{className:Dt.historyHeader,children:[_.jsx("span",{className:Dt.historyAction,children:g(m.action)}),_.jsx("span",{className:Dt.historyTime,children:Jt(m.createTime).format("MM-DD HH:mm")})]}),_.jsx("div",{className:Dt.historyContent,children:_.jsxs("span",{className:Dt.historyUser,children:[_.jsx(Ee.UserOutlined,{})," ",m.assigneeName||m.assignee]})}),m.comment&&_.jsx("div",{className:Dt.historyComment,children:m.comment})]})},m.id))}):_.jsx(P.Empty,{description:"暂无审批历史",image:P.Empty.PRESENTED_IMAGE_SIMPLE})})})]})]})}):_.jsxs("div",{className:Dt.emptyContainer,children:[_.jsx(P.Empty,{description:"任务不存在或已被处理"}),_.jsx(P.Button,{type:"primary",onClick:()=>e(-1),style:{marginTop:16},children:"返回"})]})};function x9(){return _.jsxs(Rt.Routes,{children:[_.jsx(Rt.Route,{index:!0,element:_.jsx(Rt.Navigate,{to:"dashboard",replace:!0})}),_.jsx(Rt.Route,{path:"dashboard",element:_.jsx(dE,{})}),_.jsx(Rt.Route,{path:"todo",element:_.jsx(fE,{})}),_.jsx(Rt.Route,{path:"done",element:_.jsx(hE,{})}),_.jsx(Rt.Route,{path:"my-processes",element:_.jsx(pE,{})}),_.jsx(Rt.Route,{path:"processes",element:_.jsx(vE,{})}),_.jsx(Rt.Route,{path:"designer/:id",element:_.jsx(gE,{})}),_.jsx(Rt.Route,{path:"process/:processInstanceId",element:_.jsx(mE,{})}),_.jsx(Rt.Route,{path:"task/:taskId",element:_.jsx(bE,{})})]})}mt.DoneList=hE,mt.FlowDesigner=mx,mt.MyProcesses=pE,mt.ProcessDesigner=gE,mt.ProcessDetail=mE,mt.ProcessList=vE,mt.TaskDetail=bE,mt.TodoList=fE,mt.WorkflowApp=x9,mt.WorkflowDashboard=dE,Object.defineProperty(mt,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuku123/z-wf-frontend-component",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "private": false,
5
5
  "description": "z-wf FlowDesigner 组件包 - LogicFlow 驱动的可视化流程设计器",
6
6
  "keywords": [