var ie=Object.defineProperty,oe=Object.defineProperties;var ue=Object.getOwnPropertyDescriptors;var $=Object.getOwnPropertySymbols;var se=Object.prototype.hasOwnProperty,de=Object.prototype.propertyIsEnumerable;var Q=(e,c,a)=>c in e?ie(e,c,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[c]=a,b=(e,c)=>{for(var a in c||(c={}))se.call(c,a)&&Q(e,a,c[a]);if($)for(var a of $(c))de.call(c,a)&&Q(e,a,c[a]);return e},O=(e,c)=>oe(e,ue(c));var E=(e,c,a)=>new Promise((v,m)=>{var n=w=>{try{I(a.next(w))}catch(C){m(C)}},g=w=>{try{I(a.throw(w))}catch(C){m(C)}},I=w=>w.done?v(w.value):Promise.resolve(w.value).then(n,g);I((a=a.apply(e,c)).next())});import{d as _,h as V,b as fe,r as j,W as me,n as D,u as ge}from"./vue-vendor-DNhG1Cve.js";import"./BasicTable.vue_vue_type_style_index_0_lang-B9DxrWas.js";import"./TableAction.vue_vue_type_style_index_0_lang-BIWZ0bGo.js";import"./TableImg.vue_vue_type_style_index_0_lang-65ZOQtFn.js";import{u as we}from"./useTable-DbHE4FHE.js";import{bo as he,dx as Y,dy as G,s as ye,dz as Ce,c as xe,d4 as Re,dA as J,dB as Se,dC as ve,dD as Ie,dE as Te}from"./index-X7Y8jykP.js";import{useMethods as Pe}from"./useMethods-D3efiSSd.js";import{u as be}from"./useApprovalSelection-D4wlWO_T.js";let A=null;function Ee(e){return A=e,()=>{A===e&&(A=null)}}function Ue(){if(!A)return null;try{return A()}catch(e){return null}}const Ae={traceProofreadBy:[{title:"校对人",dataIndex:"traceProofreadBy",width:100,align:"center",defaultHidden:!0},{title:"校对时间",dataIndex:"traceProofreadTime",width:165,align:"center",defaultHidden:!0}],traceAuditBy:[{title:"审核人",dataIndex:"traceAuditBy",width:100,align:"center",defaultHidden:!0},{title:"审核时间",dataIndex:"traceAuditTime",width:165,align:"center",defaultHidden:!0}],traceApproveBy:[{title:"批准人",dataIndex:"traceApproveBy",width:100,align:"center",defaultHidden:!0},{title:"批准时间",dataIndex:"traceApproveTime",width:165,align:"center",defaultHidden:!0}]},Le=Object.values(Ae).flat(),{handleExportXls:Oe,handleImportXls:_e}=Pe();function Fe(e){const c=ye();let a={};e.designScope&&(a=he(e.designScope));const v=Z(e.tableProps),m=me(),[,n,{selectedRowKeys:g,selectedRows:I}]=v,{getForm:w,reload:C,setLoading:F,getColumns:L}=n,T=j("");let d=null,P="";_(()=>{d&&(clearTimeout(d),d=null)});const i=be();V(I,r=>i.setSelection(r||[],m.path),{deep:!0}),_(()=>i.clear()),_(Ee(()=>{var t,l,u,o,f;const r=((t=n.getColumns)==null?void 0:t.call(n))||((l=e.tableProps)==null?void 0:l.columns)||[];return ve({title:((u=e.tableProps)==null?void 0:u.title)||"",pagePath:m.fullPath,rowKey:((o=e.tableProps)==null?void 0:o.rowKey)||"id",sourceColumns:r,records:((f=n.getDataSource)==null?void 0:f.call(n))||[]})}));function y(){var r;try{return(r=n.getDataSource)==null||r.call(n),!0}catch(t){return!1}}function R(){var t,l;if(!y())return;const r=((t=e.tableProps)==null?void 0:t.rowKey)||"id";(l=n.setProps)==null||l.call(n,{rowClassName:u=>T.value&&String(u[r])===T.value?"im-record-locate-row":""})}function p(r=3500){return E(this,null,function*(){var l;const t=Date.now();for(;Date.now()-tsetTimeout(o,50));continue}if((((l=n.getDataSource)==null?void 0:l.call(n))||[]).length>0)return!0;yield new Promise(o=>setTimeout(o,100))}return y()})}function M(r){var u,o;const t=((u=e.tableProps)==null?void 0:u.rowKey)||"id";return(((o=n.getDataSource)==null?void 0:o.call(n))||[]).some(f=>String(f[t])===r)}function K(){T.value="",R()}function ee(r=3500){d&&clearTimeout(d),d=setTimeout(()=>{K(),d=null},r)}function te(r){return E(this,null,function*(){T.value=r,R(),yield D(),yield new Promise(t=>requestAnimationFrame(()=>t(void 0))),R(),yield Se(r)})}function B(r){return E(this,null,function*(){if(P!==r){P=r;try{if(!(yield p()))return;if(!M(r)){c.createMessage.warning("当前列表中未找到对应数据"),J();return}yield te(r),ee(),J()}finally{P=""}}})}V(()=>[m.path,m.query[Te]],([r,t])=>{const l=Ie(r,t);l&&D(()=>B(l))},{immediate:!0});function W(r){const t=r.detail;!(t!=null&&t.path)||t.path!==m.path||!t.recordId||D(()=>B(t.recordId))}function k(){d&&(clearTimeout(d),d=null),P="",K()}_(()=>{window.removeEventListener(Y,W),window.removeEventListener(G,k)}),window.addEventListener(Y,W),window.addEventListener(G,k);function re(){return E(this,null,function*(){var o,f,S,s,x,U,X;let{url:r,name:t,params:l}=(o=e==null?void 0:e.exportConfig)!=null?o:{},u=typeof r=="function"?r():r;if(u){let ce=typeof t=="function"?t():t,h={};try{((f=e==null?void 0:e.tableProps)==null?void 0:f.useSearchForm)!==!1&&(h=yield w().validate(),(S=e==null?void 0:e.tableProps)!=null&&S.beforeFetch&&(h=yield(s=e==null?void 0:e.tableProps)==null?void 0:s.beforeFetch(h)))}catch(H){}if(h!=null&&h.column||Object.assign(h,{column:"createTime",order:"desc"}),l){const H=xe(l)?yield l():b({},l||{});Object.keys(H).map(q=>{let z=H[q];z&&(h[q]=ge(z))})}return g.value&&g.value.length>0&&(h.selections=g.value.join(",")),((x=e==null?void 0:e.tableProps)==null?void 0:x.showTableSetting)!==!1&&((X=(U=e==null?void 0:e.tableProps)==null?void 0:U.tableSetting)==null?void 0:X.setting)!==!1&&(yield ae(h)),Oe(ce,u,Re(h))}else return c.createMessage.warn("没有传递 exportConfig.url 参数"),Promise.reject()})}function ae(r){return E(this,null,function*(){var l,u,o;let t=L();if(t&&t.length>0){let f=[],S=!1;for(const s of t)if(s.defaultHidden)S=!0;else{let x=s==null?void 0:s.dataIndex;((u=(l=s==null?void 0:s.dataIndex)==null?void 0:l.toString())==null?void 0:u.indexOf("_dictText"))!==-1&&(x=(o=s==null?void 0:s.dataIndex)==null?void 0:o.toString().replace("_dictText","")),f.push(x)}S&&(r.exportFields=f.join(","))}})}function ne(r){var o;let{url:t,success:l}=(o=e==null?void 0:e.importConfig)!=null?o:{},u=typeof t=="function"?t():t;return u?_e(r,u,l||C):(c.createMessage.warn("没有传递 importConfig.url 参数"),Promise.reject())}function N(r,t){return new Promise((l,u)=>{var f;const o=()=>E(null,null,function*(){var S,s;try{F(!0);const x=yield r();((S=t==null?void 0:t.reload)==null||S)&&C(),((s=t==null?void 0:t.clearSelection)==null||s)&&(g.value=[]),l(x)}catch(x){u(x)}finally{F(!1)}});(f=t==null?void 0:t.confirm)==null||f?c.createConfirm({iconType:"warning",title:"删除",content:"确定要删除吗?",onOk:()=>o(),onCancel:()=>u()}):o()})}function le(r){return N(r,{confirm:!1,clearSelection:!1})}return O(b(b({},a),c),{onExportXls:re,onImportXls:ne,doRequest:N,doDeleteRecord:le,tableContext:v})}function Z(e){var L,T,d,P;const c={xs:24,sm:12,md:12,lg:8,xl:8,xxl:6},a={rowKey:"id",useSearchForm:!0,formConfig:{compact:!0,autoSubmitOnEnter:!0,rowProps:{gutter:8},baseColProps:b({},c),labelCol:{xs:24,sm:8,md:6,lg:8,xl:6,xxl:6},wrapperCol:{},showAdvancedButton:!0,autoAdvancedCol:3,actionColOptions:O(b({},c),{style:{textAlign:"left"}})},striped:!1,canResize:!0,minHeight:300,clickToRowSelect:!1,bordered:!0,showIndexColumn:!1,showTableSetting:!0,tableSetting:{fullScreen:!1},showActionColumn:!0,actionColumn:{width:120,title:"操作",fixed:!1,dataIndex:"action",slots:{customRender:"action"}}};e&&(e.formConfig&&w(e.formConfig),Ce(a,e));function v(i){const y=i.column||i.defSortString||i.order;return Object.assign(y?{}:{column:"createTime",order:"desc"},i)}Object.assign(a,{beforeFetch:v}),typeof e.beforeFetch=="function"&&(a.beforeFetch=function(i){return i=v(i),e.beforeFetch(i),i});const m=j([]),n=j([]),g=(L=e==null?void 0:e.rowSelection)!=null?L:{},I=fe(O(b({},g),{type:(T=g.type)!=null?T:"checkbox",columnWidth:(d=g.columnWidth)!=null?d:50,selectedRows:n,selectedRowKeys:m,onChange(...i){m.value=i[0],n.value=i[1],typeof g.onChange=="function"&&g.onChange(...i)}}));delete a.rowSelection;function w(i){const y=["baseColProps","labelCol"];for(let R of y)if(i&&i[R]){if(a.formConfig){let p=a.formConfig;p[R]=i[R]}i[R]={}}}const C=(P=a.columns)!=null?P:[];return C.some(i=>{var y;return String((y=i.dataIndex)!=null?y:"").startsWith("trace")})||(a.columns=[...C,...Le]),[...we(a),{selectedRows:n,selectedRowKeys:m,rowSelection:I}]}const Xe=Object.freeze(Object.defineProperty({__proto__:null,useListPage:Fe,useListTable:Z},Symbol.toStringTag,{value:"Module"}));export{Z as a,Xe as b,Ue as c,Fe as u};