Files
qhmes/web-dist/js/useTableColumns-DkARxJ3d.js

2 lines
6.6 KiB
Java
Raw Normal View History

2026-06-16 18:19:57 +08:00
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\-\.\?\,\'\/\\\+&amp;%\$#_]*)?/,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:!