import{d as x,f as n,U as r,a2 as S,ad as R,af as C,a4 as y,k as h}from"./vue-vendor-CxLCUzY4.js";import{bp as e,h as V,u as E}from"./index-CYriLmQo.js";import"./antd-vue-vendor-CDWW6V_M.js";import"./vxe-table-vendor-B5h3MVdD.js";const U={style:{"margin-bottom":"8px"}};const $=x({__name:"SocketReload",setup(B){const{createMessage:u}=E(),p=n(),d=n(!0),c=n(!1),f=n([]),w=n([{key:"num",title:"序号",width:80},{key:"enabled",title:"启用",width:80,type:e.checkbox},{key:"ship_name",title:"船名",width:180,type:e.input},{key:"call",title:"呼叫",width:80,type:e.input},{key:"len",title:"长",width:80,type:e.input},{key:"ton",title:"吨",width:120,type:e.input},{key:"payer",title:"付款方",width:120,type:e.input},{key:"count",title:"数",width:40},{key:"company",title:"公司",minWidth:180,type:e.input},{key:"trend",title:"动向",width:120,type:e.input}]);_();function _(){c.value=!0,V.get({url:"/mock/vxe/getData",params:{pageNo:1,pageSize:200}}).then(t=>{f.value=t.records}).finally(()=>{c.value=!1})}function g(t){switch(t.type){case e.radio:case e.checkbox:m(t);break}}function v(t){m(t)}function m(t){let{$table:a,row:o,column:l}=t,i=l.property;a.isUpdateByRow(o,i)&&a.validate(o).then(s=>{if(!s){let b=u.loading(`正在保存"${l.title}"`,0);setTimeout(()=>{var k;b(),u.success(`"${l.title}"保存成功！`),a.reloadRow(o,null,i),(k=p.value)==null||k.socketSendUpdateRow(o)},555)}})}return(t,a)=>{const o=r("a-switch"),l=r("JVxeTable"),i=r("a-card");return S(),R(i,{title:"无痕刷新示例",bordered:!1},{default:C(()=>[y("div",U,[a[1]||(a[1]=y("span",null,"启用数据变动特效：",-1)),h(o,{checked:d.value,"onUpdate:checked":a[0]||(a[0]=s=>d.value=s)},null,8,["checked"])]),h(l,{ref_key:"tableRef",ref:p,rowNumber:"",rowSelection:"",keepSource:"",socketReload:"",socketKey:"demo-socket-reload",reloadEffect:d.value,height:340,loading:c.value,columns:w.value,dataSource:f.value,onValueChange:g,onEditClosed:v},null,8,["reloadEffect","loading","columns","dataSource"])]),_:1})}}});export{$ as default};
