| 1 |
- import{s as U,A as S}from"./index-d440db34.js";import{u as I}from"./vue-router-1718324d.js";import{u as $}from"./base-7b609da9.js";import{_ as H}from"./_plugin-vue_export-helper-c27b6911.js";import{a as u,o as L,f as T,U as K,V as y,W as b,R as x,j as z,X as R,a7 as V,u as C}from"./vue-48eb72c4.js";const W={key:0,style:{"min-width":"100px"}},X={key:1,style:{display:"inline-block",padding:"0 10px"}},F={__name:"index",props:{columns:Array,param:Object,hideBorder:Boolean,size:String,tableid:Number,rowKey:String,filterMultiple:Boolean,loadOverHandle:{type:Boolean,default:()=>!0},sequence:{type:Boolean,default:()=>!1}},emits:["onSelect","listData","handleList"],setup(i,{expose:D,emit:d}){const e=i,B=$();let{tableRecord:r}=U(B);I();const q=u(e.columns),p=u([]),v=u([]),_=u(0),k=(t,s)=>{v.value=t},N=(t,s,o,{currentDataSource:n})=>{v.value=r.value.map(a=>a.itemid),e.param.content.pageNumber=t.current,e.param.content.pageSize=t.pageSize,w()},f=u(!1),w=async(t,s)=>{f.value=!0,e.param.content.tableid=e.tableid;const o=await S.requested(e.param);d("handleList",o),p.value=o.data,_.value=o.total,f.value=!1,d("listData",p.value)},O=async(t,s,o,n)=>{s?r.value.push(t):r.value=r.value.filter(a=>a[e.rowKey]!==t[e.rowKey]),d("onSelect",r.value)},P=()=>{v.value=[],r.value=[],d("onSelect",r.value)},j=(t,s)=>{e.param.content.pageNumber=1,e.param.content.where.tablefilter=e.param.content.where.tablefilter?e.param.content.where.tablefilter:{},e.param.content.where.tablefilter[dataIndex]=s};let m=u({}),g=u({}),A=()=>{},E=(t,s)=>(console.log(t,s),{style:{cursor:"move"},onMouseenter:o=>{var n=o||window.event;n.target.draggable=!0},onDragstart:o=>{var n=o||window.event;n.stopPropagation(),m.value=t},onDragover:o=>{var n=o||window.event;n.preventDefault()},onDrop:async o=>{var n=o||window.event;n.stopPropagation(),g.value=t;const a=p.value;a[g.value.weight]=m.value,a[m.value.weight]=g.value;let l,h;a.forEach((c,M)=>{c.weight=M,m.value[e.rowKey]==c[e.rowKey]&&(l=c),g.value[e.rowKey]==c[e.rowKey]&&(h=c)}),await S.requested({id:"20221201134901",content:{ownertable:e.rowKey.substring(0,e.rowKey.indexOf("id")),sequencesorts:[{ownerid:l[e.rowKey],sequence:e.param.content.pageSize*(e.param.content.pageNumber-1)+l.weight},{ownerid:h[e.rowKey],sequence:e.param.content.pageSize*(e.param.content.pageNumber-1)+h.weight}]}})}});return L(()=>{e.loadOverHandle&&w()}),T(()=>{r.value=[]}),D({listData:w,reloadSelect:P,tableRecord:r}),(t,s)=>{const o=K("a-input"),n=K("a-table");return y(),b("div",null,[x(t.$slots,"operation",{},void 0,!0),z(n,{loading:f.value,class:"ant-table-striped","row-selection":{type:e.filterMultiple?"radio":"checkbox",selectedRowKeys:v.value,onChange:k,fixed:!0,onSelect:O,hideSelectAll:!0},rowKey:i.rowKey,"keep-selection":!0,columns:q.value,"data-source":p.value,scroll:{x:"max-content"},pagination:{showSizeChanger:!0,defaultPageSize:e.param.content.pageSize,total:_.value,current:e.param.content.pageNumber},onChange:N,size:i.size,bordered:!i.hideBorder,"row-class-name":(a,l)=>l%2===1?"table-striped":null,customRow:i.sequence?C(E):C(A)},{headerCell:R(({column:a})=>[a.filter==1||a.filter==2?(y(),b("div",W,[z(o,{value:a.value,"onUpdate:value":l=>a.value=l,placeholder:a.title,onChange:l=>j(a.dataIndex,a.value),onPressEnter:w},null,8,["value","onUpdate:value","placeholder","onChange"])])):(y(),b("span",X,V(a.title),1))]),bodyCell:R(({column:a,record:l})=>[x(t.$slots,"tb_cell",{data:{column:a,record:l}},void 0,!0)]),_:3},8,["loading","row-selection","rowKey","columns","data-source","pagination","size","bordered","row-class-name","customRow"])])}}},ee=H(F,[["__scopeId","data-v-8157a882"]]);export{ee as n};
|