index-c3a5e84c.js 6.7 KB

1
  1. import{b as w,T as g,a as y}from"./index-434d719f.js";import{f as C,ai as F,a4 as S}from"./index-ba596ae9.js";import N from"./popupForm-fd4f1ba1.js";import{g as B,b as T,a as A,c as R}from"./dataexport-120e1788.js";import{h as j,y as h,af as p,J as I,B as q,p as x,l as v,k as d,M as E,a4 as P,q as u,a5 as G,t as J,as as L}from"./vue-a39e6937.js";import"./controllerUrls-941681c3.js";import"./index-7e56a0fa.js";import"./index-f0d8af94.js";import"./validate-4ecec794.js";const D={class:"default-main ba-table-box"},O=j({name:"routine/dataexport"}),Y=j({...O,setup(H){const{t:r}=C(),f=h(),_=h(),k=G();let c=[{render:"confirmButton",name:"test",title:"routine.dataexport.test",text:"",type:"primary",icon:"fa fa-wrench",class:"table-row-test",popconfirm:{confirmButtonText:r("Confirm"),cancelButtonText:r("Cancel"),confirmButtonType:"primary",width:"180px",title:"将导出前10条数据,请目检数据是否正常且完整"},disabledTip:!1,click:t=>{B(t.id).then(n=>{window.location.href=T(n.data.taskId)})}},{render:"confirmButton",name:"export",title:"routine.dataexport.export",text:"",type:"danger",icon:"fa fa-play-circle",class:"table-row-export",popconfirm:{confirmButtonText:r("Confirm"),cancelButtonText:r("Cancel"),confirmButtonType:"danger",width:"200px",title:"导出为高磁盘I/O操作,大数据导出任务请在闲时执行,确认开始导出任务吗?"},disabledTip:!1,click:t=>{A(t.id).then(n=>{n.data.download?window.location.href=T(n.data.id):k.push({name:"routine/dataexport/taskControl",params:{id:n.data.id}})})}}];c=c.concat(F(["edit","delete"]));const e=new w(new S("/admin/routine.dataexport/"),{pk:"id",column:[{type:"selection",align:"center",operator:!1},{label:r("routine.dataexport.id"),prop:"id",align:"center",width:70,sortable:"custom",operator:"RANGE"},{label:r("routine.dataexport.admin_id"),prop:"admin.nickname",operator:"LIKE",align:"center"},{label:r("routine.dataexport.name"),prop:"name",align:"center"},{label:r("routine.dataexport.main_table"),prop:"main_table",align:"center"},{label:r("routine.dataexport.lastprogress"),prop:"lastprogress",align:"center",operator:"RANGE"},{label:r("routine.dataexport.lastexporttime"),prop:"lastexporttime",align:"center",render:"datetime",sortable:"custom",operator:"RANGE",width:160},{label:r("routine.dataexport.lastfile"),prop:"lastfile",align:"center",operator:!1,render:"url"},{label:r("routine.dataexport.createtime"),prop:"createtime",align:"center",render:"datetime",sortable:"custom",operator:"RANGE",width:160},{label:r("operate"),align:"center",width:160,render:"buttons",buttons:c,operator:!1}],dblClickNotEditColumn:[void 0],defaultOrder:{prop:"id",order:"desc"}},{defaultItems:{xls_max_number:"10000",concurrent_create_xls:"3",memory_limit:"128",lastprogress:"0"}},{toggleForm:({operate:t})=>{t=="add"&&(e.form.loading=!0,R().then(n=>{e.form.extend.tables=n.data.tables,e.form.loading=!1,e.form.items.joinTableNumber=0,e.form.items.joinTable=[],e.form.items.joinTableAsName=[],e.form.items.joinTableFields=[],e.form.items.joinTablePk=[],e.form.items.joinTableFk=[],e.form.items.joinTableType=[]}))},onSubmit:({formEl:t,operate:n,items:i})=>{const o=[];for(const a in i.fields)o.push(e.form.extend.fieldSelect[i.fields[a]]);const l=[];for(const a in i.joinTable){if(a==e.form.items.joinTableNumber)break;const s=[];for(const b in i.joinTableFields[a])s.push(p(e.form.extend.joinTableFieldSelect[a][i.joinTableFields[a][b]]));l[a]={table:i.joinTable[a],pk:i.joinTablePk[a],fk:i.joinTableFk[a],asname:i.joinTableAsName[a],fields:s,type:i.joinTableType[a]}}const m=()=>{e.form.submitLoading=!0,e.api.postData(n,{id:e.form.items.id,name:e.form.items.name,main_table:e.form.items.main_table,field_config:o,join_table:l,where_field:p(e.form.items.where),order_field:p(e.form.items.order),xls_max_number:e.form.items.xls_max_number,concurrent_create_xls:e.form.items.concurrent_create_xls,memory_limit:e.form.items.memory_limit,export_number:e.form.items.export_number}).then(a=>{var s;e.onTableHeaderAction("refresh",{}),e.form.submitLoading=!1,(s=e.form.operateIds)==null||s.shift(),e.form.operateIds.length>0?e.toggleForm("edit",e.form.operateIds):e.toggleForm(),e.runAfter("onSubmit",{res:a})}).catch(()=>{e.form.submitLoading=!1})};return t?(e.form.ref=t,t.validate((a,s)=>{if(a)m();else for(const b in s)I({message:s[b][0].message,type:"error"})})):m(),!1}},{requestEdit:({res:t})=>{e.form.extend.tables=t.data.tables,e.form.extend.onTableChangeCallback=()=>{const o=[];for(const l in t.data.row.field_config){o.push(t.data.row.field_config[l].name);for(const m in e.form.extend.fieldSelect)e.form.extend.fieldSelect[m].name==t.data.row.field_config[l].name&&(e.form.extend.fieldSelect[m]=t.data.row.field_config[l])}e.form.items.fields=o},f.value.onTableChange(t.data.row.main_table),e.form.items.joinTableNumber=t.data.row.join_table.length,e.form.items.joinTable=[],e.form.items.joinTableAsName=[],e.form.items.joinTableFields=[],e.form.items.joinTablePk=[],e.form.items.joinTableFk=[],e.form.items.joinTableType=[],e.form.items.onJoinTableChangeCallback=[];for(const o in t.data.row.join_table)e.form.items.joinTable.push(t.data.row.join_table[o].table),e.form.items.joinTableAsName.push(t.data.row.join_table[o].asname),e.form.items.joinTablePk.push(t.data.row.join_table[o].pk),e.form.items.joinTableFk.push(t.data.row.join_table[o].fk),e.form.items.joinTableType.push(t.data.row.join_table[o].type),f.value.onJoinTableChange(t.data.row.join_table[o].table,o),e.form.items.onJoinTableChangeCallback[o]=()=>{const l=[];for(const m in t.data.row.join_table[o].fields){l.push(t.data.row.join_table[o].fields[m].name);for(const a in e.form.extend.joinTableFieldSelect[o])e.form.extend.joinTableFieldSelect[o][a].name==t.data.row.join_table[o].fields[m].name&&(e.form.extend.joinTableFieldSelect[o][a]=t.data.row.join_table[o].fields[m])}e.form.items.joinTableFields[o]=l};e.form.items.where=t.data.row.where_field;const n=[];for(const o in e.form.items.where)n.push(e.form.items.where[o].field);e.form.items.where_field=n,e.form.items.order=t.data.row.order_field;const i=[];for(const o in e.form.items.order)i.push(e.form.items.order[o].field);e.form.items.order_field=i}});return L("baTable",e),q(()=>{var t;e.table.ref=_.value,e.mount(),(t=e.getIndex())==null||t.then(()=>{e.initSort(),e.dragSort()})}),(t,n)=>{const i=J("el-alert");return x(),v("div",D,[d(e).table.remark?(x(),E(i,{key:0,class:"ba-table-alert",title:d(e).table.remark,type:"info","show-icon":""},null,8,["title"])):P("",!0),u(g,{buttons:["refresh","add","edit","delete","comSearch","quickSearch","columnDisplay"],"quick-search-placeholder":d(r)("quick Search Placeholder",{fields:d(r)("routine.dataexport.quick Search Fields")})},null,8,["quick-search-placeholder"]),u(y,{ref_key:"tableRef",ref:_},null,512),u(N,{ref_key:"formRef",ref:f},null,512)])}}});export{Y as default};