2 lines
10 KiB
JavaScript
2 lines
10 KiB
JavaScript
|
|
var e=Object.defineProperty,t=(t,a,l)=>(((t,a,l)=>{a in t?e(t,a,{enumerable:!0,configurable:!0,writable:!0,value:l}):t[a]=l})(t,"symbol"!=typeof a?a+"":a,l),l);import{d as a,as as l,t as s,a as o,r,M as i,ad as n,at as d,b as c,w as u,aj as p,o as h,e as g,au as f,j as w,l as y,i as m,U as b,V as S,av as v,S as A,A as M,am as _,y as C,aw as k,ap as R,v as U,f as x,ag as T,aq as D,ar as $,O as z,E,I as N,ax as P,ay as O,az as H,aA as q,aB as F,z as I,aC as j,aD as B}from"../.pnpm/.pnpm.66cdfca9.js";import{C as V,_ as J,R as K}from"../../assets/index.eb4846d5.js";const L=a({components:{Draggable:l},props:{toModel:{default:null,type:Object},toUrl:{default:"",type:String},showModal:{default:!1,type:Boolean},tableTitle:{default:[],type:Array},attribute:{type:Array,default:[]},selectRowArr:{type:Array,default:[]}},setup(e,t){const a=s("reload"),l=o();let c=r(""),u=r({}),p=r(!1),h=r(l.getters["tableStore/getSelectDragArr"]),g=r([]);c.value=e.toUrl,u.value=e.toModel,p.value=e.showModal,i((()=>e.showModal),(e=>{p.value=e})),i((()=>e.selectRowArr),(e=>{g.value=e}));const f=V.Encrypt(e.toUrl),w=n({animation:200,group:"description",disabled:!1,ghostClass:"ghost"});let y=n({drag:!1,dragArr:[]});return i((()=>e.tableTitle),((e,t)=>{const a=[];e.forEach((e=>{a.push(e.prop)})),h.value=a})),i(p,(e=>{if(e){let e=window.localStorage.getItem(f);if(e&&(e=JSON.parse(e),e&&e.dragArr.length>0)){const t=[];e.dragArr.forEach((e=>{t.push(e.prop)})),h.value=t,y.dragArr=e.dragArr}}t.emit("update:showModal",e)})),i((()=>h.value),((t,a)=>{const l=d(t,a),s=d(a,t);e.attribute.forEach((e=>{l.forEach((t=>{e.prop==t&&y.dragArr.push(e)}))})),s.forEach((e=>{y.dragArr.forEach(((t,a)=>{e==t.prop&&y.dragArr.splice(a,1)}))}))})),{name:f,toUrl:c,toModel:u,showModal:p,loading:r(!1),dragOptions:w,dragData:y,selectColumnArr:h,selectRowArray:g,deleteMsgModel:r({}),reload:a}},methods:{async onSubmit(){const e={dragArr:this.dragData.dragArr},t=JSON.stringify(e);window.localStorage.setItem(this.name,t),this.$emit("updateSelect",this.dragData.dragArr),this.showModal=!1},close(){if(this.loading)return!1;this.showModal=!1},async exportSelectRow(){var e;if(!this.plzSelectRow())return;this.loading=!0;const t=null==(e=this.$parent)?void 0:e.$parent,a=this.$store.getters["adminNavStore/getCurrentTab"],l={tableHeader:this.dragData.dragArr,search:t.search,selectRows:this.selectRowArray,uid:t.sqlUid,fileName:a.title};await this.$http.download("POST","admin/api/export/select",null,l),this.showModal=!1},async exportAll(){var e;this.loading=!0;const t=null==(e=this.$parent)?void 0:e.$parent,a=this.$store.getters["adminNavStore/getCurrentTab"],l={tableHeader:this.dragData.dragArr,search:t.search,selectRows:this.selectRowArray,uid:t.sqlUid,fileName:a.title};await this.$http.download("POST","admin/api/export/all",null,l),this.showModal=!1},async deleteSelectRows(){var e;if(!this.deleteMsgModel.show)return;if(!this.plzSelectRow())return;this.loading=!0;const t=null==(e=this.$parent)?void 0:e.$parent,a={list:this.selectRowArray,uid:t.sqlUid,deleteMsgModel:this.deleteMsgModel};this.loading=!1;const{msg:l}=await this.$http.post("admin/api/delete/select",a);window.$message.success(l),this.showModal=!1,this.reload()},plzSelectRow(){return!(this.selectRowArray.length<=0)||(window.$message.warning("请选择数据后重试"),!1)}}}),X={class:"custom-card"},G={key:0,class:"mt-2"};const Q=J(L,[["render",function(e,t,a,l,s,o){const r=_,i=C,n=k,d=R,z=U,E=x("draggable"),N=T,P=D,O=$,H=p;return h(),c(H,{show:e.showModal,"onUpdate:show":t[6]||(t[6]=t=>e.showModal=t),placement:"left",width:"268"},{default:u((()=>[g(O,{title:"筛选"},{footer:u((()=>[f(e.$slots,"footer",{},(()=>[g(i,null,{default:u((()=>[g(z,{onClick:e.close,strong:"",secondary:""},{default:u((()=>[w("取消")])),_:1},8,["onClick"]),g(z,{type:"primary",onClick:e.onSubmit,loading:e.loading,strong:"",secondary:""},{default:u((()=>[w("确定")])),_:1},8,["onClick","loading"])])),_:1})]),!0)])),default:u((()=>[y("div",X,[g(P,{"arrow-placement":"right"},{default:u((()=>[g(d,{title:"自选择列",name:"1"},{default:u((()=>[g(n,{value:e.selec
|