2 lines
6.6 KiB
Java
2 lines
6.6 KiB
Java
var B=(f,n,b)=>new Promise((R,O)=>{var F=p=>{try{w(b.next(p))}catch(L){O(L)}},m=p=>{try{w(b.throw(p))}catch(L){O(L)}},w=p=>p.done?R(p.value):Promise.resolve(p.value).then(F,m);w((b=b.apply(f,n)).next())});import{filterMultiDictObjs as re}from"./JDictSelectUtil-DwVTEDM5.js";import{h as U,r as S,b as V,c as ae,p as se,t as P,a0 as de,q as oe,i as _,u as ne}from"./vue-vendor-DNhG1Cve.js";import{ai as fe,ba as ue,bh as W,v as M,bi as pe,bj as ce,bk as he,bl as me}from"./index-X7Y8jykP.js";import{g as ve}from"./Area-CONPDlNK.js";import"./index-BDvqZ5j4.js";import ge from"./LinkTableListPiece-DoOFTrC_.js";import{getItemColor as Se}from"./DictColors-Cn4yPqfS.js";import{u as Z}from"./useModal-DaJ3Bflg.js";import{T as we}from"./index-J2mOtM3w.js";function Ne(f,n){let b=se();const R=S([]);function O(e){e.forEach(l=>{l.width||(l.fieldType==="date"||l.fieldType==="Date"?l.width=120:l.fieldType==="link_table"?l.width=180:l.width=150),l.resizable=!0})}const F=S({}),m=S([]),w=S(null);let p=S(!0),L=ae(()=>{if(p.value!=!0)return{x:!1}});const[x,{openModal:A}]=Z(),E=S(""),[Y,{openModal:j}]=Z(),H=S("");function q(e,l="checkbox"){F.value=e.dictOptions,e.checkboxFlag=="Y"?w.value={selectedRowKeys:m,onChange:z,type:l}:w.value=null,p.value=e.scrollFlag==1;let i=e.columns;i.forEach(a=>{var r,o;if(((r=n==null?void 0:n.value)==null?void 0:r.canResizeColumn)===1&&O([a]),a.fieldExtendJson&&JSON.parse(a.fieldExtendJson).isFixed&&(a.fixed="left"),a.hrefSlotName&&a.scopedSlots){const u=(o=e.fieldHrefSlots)==null?void 0:o.find(g=>g.slotName===a.hrefSlotName);u&&(a.fieldHref=u)}Object.keys(a).map(u=>{a[u]==null&&delete a[u]})});let t=e.fieldHrefSlots;const d={};t.forEach(a=>d[a.slotName]=a);let s=[];if(s=Q(i,d),G(s),f.isTree()===!0){let a=e.textField,r=-1;for(let o=0;o<s.length;o++)if(s[o].dataIndex==a){r=o;break}if(r>0){let o=s.splice(r,1);s.unshift(o[0])}s.length>0&&(s[0].align="left")}R.value=s,f.reloadTable()}function z(e,l){m.value=e,f.selectedRows=P(l),f.selectedRowKeys=P(e)}function Q(e,l){var i;for(let t of e){let{customRender:d,hrefSlotName:s,fieldType:a}=t;if(a=="date"||a=="Date")t.customRender=({text:r})=>r?r.length>10?r.substring(0,10):r:"";else if(a=="link_table"){const r=(i=t.fieldExtendJson)!=null?i:"{}",o=JSON.parse(r);t.customRender=({text:u,record:g})=>{if(!u)return"";if(f.isPopList===!0)return g[t.dataIndex+"_dictText"];{let c=(u+"").split(","),k=[];g[t.dataIndex+"_dictText"]&&(k=g[t.dataIndex+"_dictText"].split(","));let I=[];for(let h=0;h<c.length;h++){let y=_(ge,{id:c[h],text:k[h],onTab:T=>ie(T,s,o.isListReadOnly)});I.push(y)}return I.length==0?"":_("div",{style:{overflow:"hidden"}},I)}}}else if(a==="popup_dict")t.customRender=({text:r,record:o})=>o[t.dataIndex+"_dictText"]!=null?o[t.dataIndex+"_dictText"]:r;else{if(!s&&t.scopedSlots&&t.scopedSlots.customRender&&l.hasOwnProperty(t.scopedSlots.customRender)&&(s=t.scopedSlots.customRender),d||s){let r=d,o="_replace_text_";t.ellipsis=!0,t.customRender=({text:u,record:g})=>{let c=u;const k=[],I=()=>k.length?k:c;if(r)if(r.startsWith(o)){let h=r.replace(o,"");c=g[h]}else c=re(ne(F)[r],u).map(y=>{if(y.hasColor){const T=Se(y.color);k.push(_(we,{color:y.color,style:{color:T,"margin-left":"5px"}},()=>y.text))}return y.text}).join(",");if(t.showLength&&c&&c.length>t.showLength&&(c=c.substr(0,t.showLength)+"..."),s){let h=l[s];if(h)return _("a",{onClick:()=>$(h,g)},I())}return _("span",{},I())}}if(t.scopedSlots){t.ellipsis=!0;let r=t.scopedSlots;t.slots=r,delete t.scopedSlots}}}return e}function $(e,l){let i=e.href,t=/(ht|f)tp(s?)\:\/\/[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*(:(0-9)*)*(\/?)([a-zA-Z0-9\-\.\?\,\'\/\\\+&%\$#_]*)?/,d=/\.vue(\?.*)?$/,s=/{{([^}]+)}}/g;if(typeof i=="string")if(i.startsWith("ONLINE:")){let a=i.split(":");E.value=a[1];let r=a[2];A(!0,{isUpdate:!0,disableSubmit:!0,hideSub:!0,record:{id:l[r]}})}else i=i.trim().replace(/\${([^}]+)?}/g,(a,r)=>l[r]),s.test(i)&&(i=i.replace(s,function(a,r){try{return r.trim()==="ACCESS_TOKEN"?fe():ue(r)}catch(o){return a}})),t.test(i)?window.open(i,"_blank"):d.test(i)?X(i):b.push(i)}const v=V({model:{title:"",okText:"关闭",width:"100%",open:!1,destroyOnClose:!0,style:{top:0,left:0,height:"100%",margin:0,padding:0},bodyStyle:{padding:"8px",height:"calc(100vh - 108px)",overflow:"auto",overflowX:"hidden"},cancelButtonProps:{style:{display:"none"}}},on:{ok:()=>v.model.open=!1,cancel:()=>v.model.open=!1},is:null,params:{}});function X(e){let l=e.indexOf("?"),i=e;if(l!==-1){i=e.substring(0,l);let d=e.substring(l+1,e.length).split("&"),s={};d.forEach(a=>{let r=a.split("=");s[r[0]]=r[1]}),v.params=s}else v.params={};v.model.open=!0,v.model.title="操作",v.is=de(oe(()=>me(i)))}let D="right";f.isTree()&&(D="right");const N=V({title:"操作",dataIndex:"action",slots:{customRender:"action"},fixed:D,align:"center",width:150});U(()=>n==null?void 0:n.value,()=>{var e,l,i;((e=n==null?void 0:n.value)==null?void 0:e.tableFixedAction)===1&&(N.fixed=((l=n==null?void 0:n.value)==null?void 0:l.tableFixedActionType)||"right",f.isTree()&&(N.fixed="right")),((i=n==null?void 0:n.value)==null?void 0:i.canResizeColumn)===1&&R.value.length>0&&(O(R.value),f.reloadTable())});function G(e){let l=!1;for(let i=0;i<e.length;i++)if(e[i].dataIndex.toLowerCase()=="bpm_status"){l=!0;break}return f.hasBpmStatus=l,l}function C(e,l,i,t){if(e)if(e.indexOf(",")>0)he(`/online/cgform/field/download/${t}/${l.id}/${i.dataIndex}`,`文件_${l.id}.zip`);else{const d=M(e);window.open(d)}}function J(e){return e&&e.indexOf(",")>0&&(e=W(e)[0]),M(e)}function ee(e,l){if(!e)return"";let i=!0,t=l==null?void 0:l.fieldExtendJson,d=3;return t&&(t=JSON.parse(t),["province","city","region"].includes(t.displayLevel)&&(t.displayLevel==="province"?d=1:t.displayLevel==="city"?d=2:t.displayLevel==="region"&&(d=3),i=!1)),ve(e,i,d)}function te(e,l){if(!e)return"";let i=e;i.length>10&&(i=i.substring(0,10));let t=l==null?void 0:l.fieldExtendJson;return t&&(t=JSON.parse(t),t.picker&&t.picker!="default")?ce(i)[t.picker]:i}U(m,()=>{f.selectedRowKeys=P(m.value)}),f.clearSelectedRow=()=>{m.value=[],f.selectedRows=[],f.selectedRowKeys=[]};function le(e){if(e){let l=[];const i=W(e);for(let t of i)t&&l.push(M(t));pe({imageList:l})}}const K=S();function ie(e,l,i){return B(this,null,function*(){H.value=l,(yield K.value.getFormStatus())==!0?(E.value=l,A(!0,{isUpdate:!0,disableSubmit:!0,hideSub:!0,record:{id:e}})):j(!0,{isUpdate:!0,disableSubmit:!!i,record:{id:e}})})}return{columns:R,actionColumn:N,selectedKeys:m,rowSelection:w,enableScrollBar:p,tableScroll:L,downloadRowFile:C,getImgView:J,getPcaText:ee,getFormatDate:te,handleColumnResult:q,onSelectChange:z,hrefComponent:v,viewOnlineCellImage:le,hrefMainTableId:E,registerOnlineHrefModal:x,registerPopModal:Y,openPopModal:j,openOnlineHrefModal:A,onlinePopModalRef:K,popTableId:H,handleClickFieldHref:$}}export{Ne as u};
|