Files
aiot-platform-ui/apps/web-antd/dist/js/category-draggable-model-45GfEnV5.js
lzh 24c3dbc8f1
All checks were successful
Web UI CI/CD / build-and-deploy (push) Successful in 8s
chore: build and deploy web-antd
2026-03-23 17:20:54 +08:00

2 lines
16 KiB
JavaScript

var Re=Object.defineProperty,ze=Object.defineProperties;var Fe=Object.getOwnPropertyDescriptors;var le=Object.getOwnPropertySymbols;var Pe=Object.prototype.hasOwnProperty,qe=Object.prototype.propertyIsEnumerable;var oe=(l,f,a)=>f in l?Re(l,f,{enumerable:!0,configurable:!0,writable:!0,value:a}):l[f]=a,de=(l,f)=>{for(var a in f||(f={}))Pe.call(f,a)&&oe(l,a,f[a]);if(le)for(var a of le(f))qe.call(f,a)&&oe(l,a,f[a]);return l},re=(l,f)=>ze(l,Fe(f));var y=(l,f,a)=>new Promise((b,U)=>{var x=m=>{try{W(a.next(m))}catch(E){U(E)}},I=m=>{try{W(a.throw(m))}catch(E){U(E)}},W=m=>m.done?b(m.value):Promise.resolve(m.value).then(x,I);W((a=a.apply(l,f)).next())});import{cw as Ae,ac as he,V as Ge,bv as Ve,bF as Ne,ax as V,an as R,ay as _,ak as Q,by as ue,d as D,am as ce,c5 as fe,az as Y,au as je,a9 as g,$ as me,bG as He}from"./bootstrap-DmcuvVZS.js";import{u as Ke}from"./useSortable-jtnNPDb0-XvV4hVH9.js";import"./vxe-table-CF-Re93B.js";import{d as Qe}from"./index-Bf59__Vu.js";import{b as Ye,d as Je,e as Ze,f as Xe,h as we}from"./index-lsLHpmz7.js";import{_ as et}from"./rename-form.vue_vue_type_script_setup_true_lang-Dw8pataM.js";import{_ as tt}from"./detail.vue_vue_type_script_setup_true_lang-ChAiRVPX.js";import{D as st}from"./dict-enum-CaHgMaDZ.js";import{m as ve,aa as P,b9 as T,dc as at,v as nt,Q as it,aW as lt,bF as ke,ad as h,b2 as d,j as o,u as n,bJ as i,bc as J,ae as C,aQ as ot,bL as pe,ab as $,ac as L,bp as p,aR as Z,I as ye,ai as r,cT as dt,bZ as z,ca as rt}from"../jse/index-index-B6J4axeY.js";import{u as ge}from"./use-modal-BrjqCt0f.js";import{u as ut}from"./use-vxe-grid-DQWlXi-M.js";import{b as X}from"./biz-bpm-enum-DQJBn5Qr.js";import{v as F}from"./AlertBuilder-CxKfA7Bf.js";import"./index-CmA6iyrg.js";import"./dict-tag.vue_vue_type_script_setup_true_lang-D0nJjy4y.js";import"./data-DnbLQzh2.js";import"./rangePickerProps-Ce0Q9Y_E.js";import"./biz-system-enum-Ci18uvnT.js";import"./index-DvGL-SX-.js";import"./helpers-BbxN4rz8.js";import"./index-sZ2vdBuY.js";import"./x-CGHUyQuD.js";import"./circle-check-big-CXTM1Gxe.js";const ct=ve({__name:"ellipsis-text",props:{expand:{type:Boolean,default:!1},line:{default:1},maxWidth:{default:"100%"},placement:{default:"top"},tooltip:{type:Boolean,default:!0},tooltipWhenEllipsis:{type:Boolean,default:!1},ellipsisThreshold:{default:3},tooltipBackgroundColor:{default:""},tooltipColor:{default:""},tooltipFontSize:{default:14},tooltipMaxWidth:{default:void 0},tooltipOverlayStyle:{default:()=>({textAlign:"justify"})}},emits:["expandChange"],setup(l,{emit:f}){const a=l,b=f,U=P(()=>typeof a.maxWidth=="number"?`${a.maxWidth}px`:a.maxWidth),x=T(),I=T(!1),W=T(),m=T(!1),{width:E}=at(x),k=()=>{if(!x.value||!a.tooltipWhenEllipsis)return;const u=x.value;if(!(u.textContent||"").trim()){m.value=!1;return}const j=u.scrollWidth-u.clientWidth,H=u.scrollHeight-u.clientHeight;m.value=a.line===1?j>a.ellipsisThreshold:H>a.ellipsisThreshold};let M=null;nt(()=>{typeof ResizeObserver!="undefined"&&a.tooltipWhenEllipsis&&(M=new ResizeObserver(()=>{k()}),x.value&&M.observe(x.value)),k()}),it(()=>{a.tooltipWhenEllipsis&&k()}),lt(()=>{M&&(M.disconnect(),M=null)}),ke(()=>{var u;a.tooltip&&E.value&&(W.value=(u=a.tooltipMaxWidth)!=null?u:E.value+24)},{flush:"post"});function c(){I.value=!I.value,b("expandChange",I.value),a.tooltipWhenEllipsis&&k()}function S(){a.expand&&c()}return(u,N)=>(d(),h("div",null,[o(n(Ae),{"content-style":re(de({},l.tooltipOverlayStyle),{maxWidth:`${W.value}px`,fontSize:`${l.tooltipFontSize}px`,color:l.tooltipColor,backgroundColor:l.tooltipBackgroundColor}),disabled:!a.tooltip||I.value||a.tooltipWhenEllipsis&&!m.value,side:l.placement},{trigger:i(()=>[C("div",ot({ref_key:"ellipsis",ref:x,class:[{"!cursor-pointer":l.expand,"block truncate":l.line===1,[u.$style.ellipsisMultiLine]:l.line>1},"cursor-text overflow-hidden"],style:{"-webkit-line-clamp":I.value?"":l.line,"max-width":U.value},onClick:S},u.$attrs),[J(u.$slots,"default")],16)]),default:i(()=>[J(u.$slots,"tooltip",{},()=>[J(u.$slots,"default")])]),_:3},8,["content-style","disabled","side"])]))}}),ft="_ellipsisMultiLine_fwtmq_2",mt={ellipsisMultiLine:ft},pt={$style:mt},yt=he(ct,[["__cssModules",pt]]);function gt(){return[{field:"name",title:"流程名称",minWidth:200,slots:{default:"name"}},{field:"startUserIds",title:"可见范围",minWidth:150,slots:{default:"startUserIds"}},{field:"type",title:"流程类型",minWidth:120,cellRender:{name:"CellDict",props:{type:st.BPM_MODEL_TYPE}}},{field:"formType",title:"表单信息",minWidth:150,slots:{default:"formInfo"}},{field:"deploymentTime",title:"最后发布",minWidth:280,slots:{default:"deploymentTime"}},{title:"操作",width:150,fixed:"right",slots:{default:"actions"}}]}const ht={class:"flex h-12 items-center"},vt={class:"flex items-center"},kt={class:"ml-4 mr-2 text-lg font-medium"},Ct={class:"text-gray-500"},bt={class:"flex flex-1 items-center"},xt={class:"flex items-center overflow-hidden"},Mt={key:1,class:"mr-2.5 flex h-9 w-9 flex-shrink-0 items-center justify-center rounded bg-blue-500 text-white"},Dt={class:"text-xs"},$t=["src"],It={class:"min-w-0 overflow-hidden"},St={key:0},_t={key:1},Lt={key:2},Tt={key:3},Wt={key:4},Et={key:2},Bt={class:"flex items-center justify-center"},Ut={key:0,class:"w-36"},Ot={class:"flex items-center space-x-0"},Rt=ve({__name:"category-draggable-model",props:{categoryInfo:{},isCategorySorting:{type:Boolean},isFirst:{type:Boolean}},emits:["success"],setup(l,{emit:f}){var te;const a=l,b=f,[U,x]=ge({connectedComponent:et,destroyOnClose:!0}),[I,W]=ge({connectedComponent:tt,destroyOnClose:!0}),m=Ge(),E=(te=Ve().userInfo)==null?void 0:te.id,k=T(!1),M=T([]),c=T([]),S=T(a.isFirst),u=T(null),N=P(()=>S.value?["1"]:[]),{hasAccessByCodes:q}=Ne(),j=P(()=>q(["bpm:model:update"])),H=P(()=>q(["bpm:model:delete"])),Ce=P(()=>q(["bpm:model:deploy"])),[be,A]=ut({gridOptions:{columns:gt(),data:c.value,keepSource:!0,pagerConfig:{enabled:!1},rowConfig:{keyField:"id",isHover:!0},toolbarConfig:{enabled:!1}}});function xe(){a.categoryInfo.modelList&&a.categoryInfo.modelList.length>0&&(M.value=z(a.categoryInfo.modelList),c.value=z(a.categoryInfo.modelList)),A.setGridOptions({data:c.value}),S.value=!0,k.value=!0,u.value?u.value.option("disabled",!1):(c.value=z(a.categoryInfo.modelList),A.setGridOptions({data:c.value}),u.value=Ke(`.category-${a.categoryInfo.id} .vxe-table .vxe-table--body-wrapper:not(.fixed-right--wrapper) .vxe-table--body tbody`,c.value,{draggable:".vxe-body--row",animation:150,handle:".drag-handle",disabled:!1,onEnd:({newDraggableIndex:s,oldDraggableIndex:e})=>{e!==s&&c.value.splice(s!=null?s:0,0,c.value.splice(e!=null?e:0,1)[0])}}))}function Me(){return y(this,null,function*(){if(!c.value||c.value.length===0){g.error("排序数据异常,请重试");return}const s=g.loading({content:"正在保存排序...",duration:0});try{const e=c.value.map(B=>B.id);yield Ye(e),k.value=!1,g.success("排序模型成功"),b("success")}catch(e){console.error("排序保存失败",e)}finally{s()}})}function De(){M.value&&M.value.length>0&&(c.value=z(M.value),A.setGridOptions({data:c.value})),u.value&&u.value.option("disabled",!0),k.value=!1}function $e(s){s==="renameCategory"?x.setData(a.categoryInfo).open():s==="deleteCategory"&&Ie()}function Ie(){return y(this,null,function*(){if(a.categoryInfo.modelList.length>0){g.warning("该分类下仍有流程定义,不允许删除");return}yield F({beforeClose:e=>y(null,[e],function*({isConfirm:s}){if(!s)return;const B=g.loading({content:`正在删除分类: "${a.categoryInfo.name}"...`,duration:0});try{yield Qe(a.categoryInfo.id)}finally{B()}return!0}),content:`确定要删除[${a.categoryInfo.name}]吗?`,icon:"question"}),g.success(me("ui.actionMessage.deleteSuccess",[a.categoryInfo.name])),b("success")})}function w(s){return y(this,null,function*(){if(s.formType===X.NORMAL){const e={id:s.formId};W.setData(e).open()}else yield m.push({path:s.formCustomCreatePath})})}function O(s){return s.managerUserIds&&s.managerUserIds.includes(E)}function ee(s,e){return y(this,null,function*(){yield m.push({name:"BpmModelUpdate",params:{id:e,type:s}})})}function Se(s){return y(this,null,function*(){yield F({beforeClose:B=>y(null,[B],function*({isConfirm:e}){if(!e)return;const t=g.loading({content:`正在发布流程: "${s.name}"...`,duration:0});try{yield Je(s.id)}finally{t()}return!0}),content:`确认要发布[${s.name}]流程吗?`,icon:"question"}),g.success(`发布[${s.name}]流程成功`),b("success")})}function _e(s,e){switch(s){case"handleChangeState":{Le(e);break}case"handleClean":{Te(e);break}case"handleCopy":{ee("copy",e.id);break}case"handleDefinitionList":{Ee(e);break}case"handleDelete":{We(e);break}case"handleReport":{Be(e);break}}}function Le(s){return y(this,null,function*(){const e=s.processDefinition.suspensionState,B=e===1?2:1,t=e===1?"停用":"启用";yield F({beforeClose:se=>y(null,[se],function*({isConfirm:v}){if(!v)return;const G=g.loading({content:`正在${t}流程: "${s.name}"...`,duration:0});try{yield Ze(s.id,B)}finally{G()}return!0}),content:`确认要${t}流程: "${s.name}" 吗?`,icon:"question"}),g.success(`${t} 流程: "${s.name}" 成功`),b("success")})}function Te(s){return y(this,null,function*(){yield F({beforeClose:B=>y(null,[B],function*({isConfirm:e}){if(!e)return;const t=g.loading({content:`正在清理流程: "${s.name}"...`,duration:0});try{yield Xe(s.id)}finally{t()}return!0}),content:`确认要清理流程: "${s.name}" 吗?`,icon:"question"}),g.success(`清理流程: "${s.name}" 成功`),b("success")})}function We(s){return y(this,null,function*(){yield F({beforeClose:B=>y(null,[B],function*({isConfirm:e}){if(!e)return;const t=g.loading({content:me("ui.actionMessage.deleting",[s.name]),duration:0});try{yield we(s.id)}finally{t()}return!0}),content:`确认要删除流程: "${s.name}" 吗?`,icon:"question"}),g.success(`删除流程: "${s.name}" 成功`),b("success")})}function Ee(s){m.push({name:"BpmProcessDefinition",query:{key:s.key}})}function Be(s){m.push({name:"BpmProcessInstanceReport",query:{processDefinitionId:s.processDefinition.id,processDefinitionKey:s.key}})}const Ue=rt(()=>{const s=a.categoryInfo.modelList;He(c.value,s)||(c.value=z(s),k.value=!1,u.value=null,A.setGridOptions({data:c.value}))},100);ke(()=>{var s;(s=a.categoryInfo)!=null&&s.modelList&&Ue(),a.isCategorySorting&&(S.value=!1)});function Oe(){b("success")}return(s,e)=>(d(),h("div",null,[o(n(je),{"body-style":{padding:0},class:"category-draggable-model mb-5 rounded-lg transition-all duration-300 ease-in-out hover:shadow-xl"},{default:i(()=>{var B;return[C("div",ht,[C("div",vt,[l.isCategorySorting?(d(),$(n(V),{key:0,title:"拖动排序"},{default:i(()=>[o(n(R),{icon:"ic:round-drag-indicator",class:"drag-handle ml-2.5 cursor-move text-2xl text-gray-500"})]),_:1})):L("",!0),C("div",kt,p(l.categoryInfo.name),1),C("div",Ct," ("+p(((B=l.categoryInfo.modelList)==null?void 0:B.length)||0)+") ",1)]),pe(C("div",bt,[l.categoryInfo.modelList.length>0?(d(),h("div",{key:0,class:Z(["ml-3 flex cursor-pointer items-center transition-transform duration-300",S.value?"rotate-180":"rotate-0"]),onClick:e[0]||(e[0]=t=>S.value=!S.value)},[o(n(R),{icon:"lucide:chevron-down",class:"text-3xl text-gray-400"})],2)):L("",!0),C("div",{class:Z(["ml-auto flex items-center",k.value?"mr-4":"mr-8"])},[k.value?(d(),h(ye,{key:1},[o(n(_),{onClick:Q(De,["stop"]),class:"mr-2"},{default:i(()=>[...e[6]||(e[6]=[r(" 取 消 ",-1)])]),_:1}),o(n(_),{type:"primary",onClick:Q(Me,["stop"])},{default:i(()=>[...e[7]||(e[7]=[r(" 保存排序 ",-1)])]),_:1})],64)):(d(),h(ye,{key:0},[l.categoryInfo.modelList.length>0?(d(),$(n(_),{key:0,type:"link",size:"small",class:"flex items-center text-sm",onClick:Q(xe,["stop"])},{icon:i(()=>[o(n(R),{icon:"lucide:align-start-vertical"})]),default:i(()=>[e[2]||(e[2]=r(" 排序 ",-1))]),_:1})):L("",!0),o(n(ue),{placement:"bottom",arrow:""},{overlay:i(()=>[o(n(D),{onClick:e[1]||(e[1]=t=>$e(t.key))},{default:i(()=>[o(n(D).Item,{key:"renameCategory"},{default:i(()=>[...e[4]||(e[4]=[r(" 重命名 ",-1)])]),_:1}),o(n(D).Item,{key:"deleteCategory"},{default:i(()=>[...e[5]||(e[5]=[r(" 删除分类 ",-1)])]),_:1})]),_:1})]),default:i(()=>[o(n(_),{type:"link",size:"small",class:"flex items-center text-sm"},{icon:i(()=>[o(n(R),{icon:"lucide:settings"})]),default:i(()=>[e[3]||(e[3]=r(" 分类 ",-1))]),_:1})]),_:1})],64))],2)],512),[[ce,!l.isCategorySorting]])]),o(n(fe),{"active-key":N.value,bordered:!1,class:"collapse-no-padding bg-transparent"},{default:i(()=>[pe(o(n(fe).Panel,{key:"1","show-arrow":!1,class:"border-0 bg-transparent p-0"},{default:i(()=>[c.value&&c.value.length>0?(d(),$(n(be),{key:0,class:Z(`category-${l.categoryInfo.id}`)},{name:i(({row:t})=>[C("div",xt,[k.value?(d(),$(n(V),{key:0,title:"拖动排序",placement:"left"},{default:i(()=>[o(n(R),{icon:"ic:round-drag-indicator",class:"drag-handle mr-2.5 flex-shrink-0 cursor-move text-2xl text-gray-500"})]),_:1})):L("",!0),t.icon?(d(),h("img",{key:2,src:t.icon,class:"mr-2.5 h-9 w-9 flex-shrink-0 rounded",alt:"图标"},null,8,$t)):(d(),h("div",Mt,[C("span",Dt,p(t.name.substring(0,2)),1)])),C("div",It,[o(n(yt),{"tooltip-when-ellipsis":!0},{default:i(()=>[r(p(t.name),1)]),_:2},1024)])])]),startUserIds:i(({row:t})=>{var v,se,G,ae,ne,ie;return[!((v=t.startUsers)!=null&&v.length)&&!((se=t.startDepts)!=null&&se.length)?(d(),h("span",St," 全部可见 ")):((G=t.startUsers)==null?void 0:G.length)===1?(d(),h("span",_t,p(t.startUsers[0].nickname),1)):((ae=t.startDepts)==null?void 0:ae.length)===1?(d(),h("span",Lt,p(t.startDepts[0].name),1)):((ne=t.startDepts)==null?void 0:ne.length)>1?(d(),h("span",Tt,[o(n(V),{placement:"top",title:t.startDepts.map(K=>K.name).join("、")},{default:i(()=>[r(p(t.startDepts[0].name)+"等 "+p(t.startDepts.length)+" 个部门可见 ",1)]),_:2},1032,["title"])])):((ie=t.startUsers)==null?void 0:ie.length)>1?(d(),h("span",Wt,[o(n(V),{placement:"top",title:t.startUsers.map(K=>K.nickname).join("、")},{default:i(()=>[r(p(t.startUsers[0].nickname)+"等 "+p(t.startUsers.length)+" 人可见 ",1)]),_:2},1032,["title"])])):L("",!0)]}),formInfo:i(({row:t})=>[t.formType===n(X).NORMAL?(d(),$(n(_),{key:0,type:"link",onClick:v=>w(t)},{default:i(()=>[r(p(t.formName),1)]),_:2},1032,["onClick"])):t.formType===n(X).CUSTOM?(d(),$(n(_),{key:1,type:"link",onClick:v=>w(t)},{default:i(()=>[r(p(t.formCustomCreatePath),1)]),_:2},1032,["onClick"])):(d(),h("span",Et,"暂无表单"))]),deploymentTime:i(({row:t})=>{var v;return[C("div",Bt,[t.processDefinition?(d(),h("span",Ut,p(n(dt)(t.processDefinition.deploymentTime)),1)):L("",!0),t.processDefinition?(d(),$(n(Y),{key:1},{default:i(()=>[r(" v"+p(t.processDefinition.version),1)]),_:2},1024)):(d(),$(n(Y),{key:2,color:"warning"},{default:i(()=>[...e[8]||(e[8]=[r("未部署",-1)])]),_:1})),((v=t.processDefinition)==null?void 0:v.suspensionState)===2?(d(),$(n(Y),{key:3,color:"warning",class:"ml-2.5"},{default:i(()=>[...e[9]||(e[9]=[r(" 已停用 ",-1)])]),_:1})):L("",!0)])]}),actions:i(({row:t})=>[C("div",Ot,[o(n(_),{type:"link",size:"small",class:"px-1",onClick:v=>ee("update",t.id),disabled:!O(t)&&!j.value},{default:i(()=>[...e[10]||(e[10]=[r(" 修改 ",-1)])]),_:1},8,["onClick","disabled"]),o(n(_),{type:"link",size:"small",class:"px-1",onClick:v=>Se(t),disabled:!O(t)&&!Ce.value},{default:i(()=>[...e[11]||(e[11]=[r(" 发布 ",-1)])]),_:1},8,["onClick","disabled"]),o(n(ue),{placement:"bottomRight",arrow:""},{overlay:i(()=>[o(n(D),{onClick:v=>_e(v.key,t)},{default:i(()=>[o(n(D).Item,{key:"handleCopy"},{default:i(()=>[...e[13]||(e[13]=[r(" 复制 ",-1)])]),_:1}),o(n(D).Item,{key:"handleDefinitionList"},{default:i(()=>[...e[14]||(e[14]=[r(" 历史 ",-1)])]),_:1}),o(n(D).Item,{key:"handleReport",disabled:!O(t)},{default:i(()=>[...e[15]||(e[15]=[r(" 报表 ",-1)])]),_:1},8,["disabled"]),t.processDefinition?(d(),$(n(D).Item,{key:"handleChangeState",disabled:!O(t)},{default:i(()=>[r(p(t.processDefinition.suspensionState===1?"停用":"启用"),1)]),_:2},1032,["disabled"])):L("",!0),o(n(D).Item,{danger:"",key:"handleClean",disabled:!O(t)},{default:i(()=>[...e[16]||(e[16]=[r(" 清理 ",-1)])]),_:1},8,["disabled"]),o(n(D).Item,{danger:"",key:"handleDelete",disabled:!O(t)&&!H.value},{default:i(()=>[...e[17]||(e[17]=[r(" 删除 ",-1)])]),_:1},8,["disabled"])]),_:2},1032,["onClick"])]),default:i(()=>[o(n(_),{type:"link",size:"small",class:"px-1"},{default:i(()=>[...e[12]||(e[12]=[r("更多",-1)])]),_:1})]),_:2},1024)])]),_:1},8,["class"])):L("",!0)]),_:1},512),[[ce,S.value]])]),_:1},8,["active-key"])]}),_:1}),o(n(U),{onSuccess:Oe}),o(n(I))]))}}),os=he(Rt,[["__scopeId","data-v-c0000920"]]);export{os as default};