Files
qhmes/web-dist/js/index-COK6bmZk.js
2026-06-16 18:19:57 +08:00

2 lines
4.9 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
var y=(n,r,v)=>new Promise((F,d)=>{var _=t=>{try{l(v.next(t))}catch(u){d(u)}},m=t=>{try{l(v.throw(t))}catch(u){d(u)}},l=t=>t.done?F(t.value):Promise.resolve(t.value).then(_,m);l((v=v.apply(n,r)).next())});import{e as W,p as J,h as X,K as Y,C as z,H as A,c as p,z as c,Q as B,f,A as h,y as T,r as s,F as Z,D as ee,G as ae,u as le,T as te,b as oe}from"./vue-vendor-DNhG1Cve.js";import{d as C,s as ne,a4 as se,F as ue,aB as ie,av as ce,aH as re,M as ve,au as de}from"./index-X7Y8jykP.js";import{j as pe}from"./dingTplBind.api-XLM4Z5wd.js";import{u as fe}from"./useApprovalSelection-D4wlWO_T.js";import"./emoji-mart-vue-fast-R0uJEDq-.js";const me=n=>C.get({url:"/xslmes/approvalLaunch/publishedList",params:n?{routePath:n}:void 0}),he=n=>C.get({url:"/xslmes/approvalLaunch/bizRecords",params:n}),_e=n=>C.post({url:"/xslmes/approvalLaunch/launch",params:n}),ge=n=>C.post({url:"/xslmes/approvalLaunch/launchBatch",params:n}),be={class:"approval-float-batch"},we={class:"approval-float-batch-title"},ye={key:1},ze={key:0,class:"approval-float-tip"},xe=W({name:"ApprovalLaunchFloat",__name:"index",setup(n){const{createMessage:r}=ne(),{currentRoute:v}=J(),F=fe(),d=s(!1),_=s(!1),m=s(!1),l=s(),t=s(),u=s(""),g=s(null),x=s([]),b=s([]),S=s([]),N=oe({right:"24px",bottom:"120px"}),$=p(()=>!!g.value),w=p(()=>x.value),q=p(()=>w.value.map(e=>({label:`${e.flowName}${e.bizTableName||e.bizTable}`,value:e.id}))),H=p(()=>w.value.find(e=>e.id===l.value)),k=p(()=>S.value.length>0),L=p(()=>{var a;const e=(a=H.value)==null?void 0:a.titleField;return S.value.filter(o=>o&&o.id!=null).map(o=>({bizDataId:String(o.id),bizTitle:e&&o[e]!=null?String(o[e]):String(o.id)}))}),D=p(()=>b.value.map(e=>{var a;return{label:(a=e.title)!=null?a:e.id,value:e.id}}));X(()=>{var e;return(e=v.value)==null?void 0:e.path},e=>y(null,null,function*(){if(g.value=null,x.value=[],!(!e||e==="/"||e.startsWith("/login")))try{const a=yield pe(e);g.value=a||null,g.value&&(x.value=(yield me(e))||[])}catch(a){g.value=null,x.value=[]}}),{immediate:!0});function O(){l.value=void 0,t.value=void 0,u.value="",b.value=[],S.value=[]}function U(){return y(this,null,function*(){var e;if(!w.value.length){r.warning("当前页面暂无已发布的 MES 审批流请先在审批流设计中发布");return}d.value=!0,O(),S.value=F.getRowsByPath(((e=v.value)==null?void 0:e.path)||""),w.value.length===1&&(l.value=w.value[0].id),!k.value&&l.value&&(yield I())})}function I(e){return y(this,null,function*(){if(l.value)try{m.value=!0,b.value=(yield he({flowId:l.value,keyword:e}))||[]}finally{m.value=!1}})}function V(){t.value=void 0,u.value="",b.value=[],!k.value&&l.value&&I()}const E=se(e=>{I(e)},350);function j(){var a;const e=b.value.find(o=>o.id===t.value);u.value=e?(a=e.title)!=null?a:e.id:""}function G(){return y(this,null,function*(){if(!l.value){r.warning("请选择审批流");return}try{if(_.value=!0,k.value)yield ge({flowId:l.value,items:L.value}),r.success(`已发起 ${L.value.length} 条审批!`);else{if(!t.value){r.warning("请选择需要发起审批的单据");return}yield _e({flowId:l.value,bizDataId:t.value,bizTitle:u.value}),r.success("发起成功")}d.value=!1}finally{_.value=!1}})}return(e,a)=>{const o=Y("Icon"),M=ce,R=ie,K=re,P=ue,Q=ve;return $.value?(c(),z("div",{key:0,class:"approval-float",style:te(N)},[B("div",{class:"approval-float-btn",title:"发起审批",onClick:U},[f(o,{icon:"ant-design:audit-outlined",size:20}),a[3]||(a[3]=B("span",{class:"approval-float-text"},"发起审批",-1))]),f(Q,{open:d.value,"onUpdate:open":a[2]||(a[2]=i=>d.value=i),title:"发起审批",width:540,confirmLoading:_.value,okText:"发起审批",onOk:G},{default:h(()=>[f(P,{layout:"vertical",style:{"margin-top":"8px"}},{default:h(()=>[f(R,{label:"单据类型审批流",required:""},{default:h(()=>[f(M,{value:l.value,"onUpdate:value":a[0]||(a[0]=i=>l.value=i),placeholder:"请选择审批流",options:q.value,onChange:V,allowClear:""},null,8,["value","options"])]),_:1}),k.value?(c(),T(R,{key:0,label:`已选单据(共 ${L.value.length} 条)`,required:""},{default:h(()=>[B("div",be,[(c(!0),z(Z,null,ee(L.value,i=>(c(),z("div",{key:i.bizDataId,class:"approval-float-batch-item"},[f(o,{icon:"ant-design:file-text-outlined",size:14}),B("span",we,ae(i.bizTitle),1)]))),128))])]),_:1},8,["label"])):(c(),T(R,{key:1,label:"选择单据",required:""},{default:h(()=>[f(M,{value:t.value,"onUpdate:value":a[1]||(a[1]=i=>t.value=i),"show-search":"",placeholder:"请选择需要发起审批的单据","filter-option":!1,options:D.value,disabled:!l.value,onSearch:le(E),onChange:j},{notFoundContent:h(()=>[m.value?(c(),T(K,{key:0,size:"small"})):(c(),z("span",ye,"无单据数据"))]),_:1},8,["value","options","disabled","onSearch"]),l.value&&!D.value.length&&!m.value?(c(),z("div",ze," 该单据暂无数据或审批流未配置单据标题字段 ")):A("",!0)]),_:1}))]),_:1})]),_:1},8,["open","confirmLoading"])],4)):A("",!0)}}}),Ie=de(xe,[["__scopeId","data-v-186eafce"]]);export{Ie as default};