1 |
- import{d as le,a as te,az as oe,a2 as ae,r as B,K as _,aq as N,e as u,f as x,j as o,L as n,u as l,t as S,m as k,am as y,n as ne,y as p,i as g,ac as de,C as V,F,B as h,p as re,l as ie}from"./vue-A59npLRR.js";import{F as c}from"./index-r6iTpmP6.js";import{b as U}from"./validate-_EUdkMt3.js";import{d as D}from"./dataexport-ejJtIN-s.js";import{b as K,_ as me}from"./index-EwE51S_X.js";import"./index-K8IR974I.js";import"./baTable-MdxYOkAk.js";import"./index-XALue448.js";import"./echarts-cxb9vJr1.js";const J=C=>(re("data-v-d315b28c"),C=C(),ie(),C),ue={class:"title"},fe={key:0},se={key:0},pe=J(()=>g("div",{class:"form-hr"},null,-1)),ce={key:0},be={key:0},_e=J(()=>g("div",{class:"form-hr"},null,-1)),xe=le({__name:"popupForm",setup(C,{expose:M}){const O=te(),e=oe("baTable"),{t:m}=ae(),I=B({tab:"base"}),E=b=>{e.form.extend.fieldLoading=!0,D(b).then(a=>{e.form.extend.fieldSelect=a.data.fields;const i=[],r=[];for(const f in a.data.fields)i.push(f),r[f]=a.data.fields[f].name+(a.data.fields[f].title?" - "+a.data.fields[f].title:"");e.form.extend.fieldSelectOpt=r,e.form.extend.fieldSelectKey=K(),e.form.items.fields=i,typeof e.form.extend.onTableChangeCallback=="function"&&(e.form.extend.onTableChangeCallback(),e.form.extend.onTableChangeCallback=null)}).finally(()=>{e.form.extend.fieldLoading=!1})},P=(b,a)=>{e.form.extend.fieldLoading=!0,D(b).then(i=>{typeof e.form.extend.joinTableFieldSelect>"u"&&(e.form.extend.joinTableFieldSelect=[],e.form.extend.joinTableFieldSelectOpt=[],e.form.extend.joinTableFieldSelectKey=[]),e.form.extend.joinTableFieldSelect[a]=i.data.fields;const r=[];for(const f in i.data.fields)r[f]=i.data.fields[f].name+(i.data.fields[f].title?" - "+i.data.fields[f].title:"");e.form.extend.joinTableFieldSelectOpt[a]=r,e.form.extend.joinTableFieldSelectKey[a]=K(),e.form.items.onJoinTableChangeCallback&&e.form.items.onJoinTableChangeCallback[a]&&typeof e.form.items.onJoinTableChangeCallback[a]=="function"&&(e.form.items.onJoinTableChangeCallback[a](),e.form.items.onJoinTableChangeCallback[a]=null)}).finally(()=>{e.form.extend.fieldLoading=!1})},R=b=>{if(b=="where"){e.form.extend.fieldLoading=!0;const a=[];for(const i in e.form.extend.fieldSelectOpt)a[e.form.items.main_table+"."+i]=e.form.items.main_table+"."+e.form.extend.fieldSelectOpt[i];for(const i in e.form.items.joinTable){const r=e.form.items.joinTableAsName[i]?e.form.items.joinTableAsName[i]:e.form.items.joinTable[i];for(const f in e.form.extend.joinTableFieldSelectOpt[i])a[r+"."+f]=r+"."+e.form.extend.joinTableFieldSelectOpt[i][f]}e.form.extend.allTableField=a,e.form.extend.fieldLoading=!1,e.form.extend.allTableFieldKey=K()}},A=()=>{const b=[];for(const a in e.form.items.where_field){let i="",r="=";for(const f in e.form.items.where)if(e.form.items.where[f].field==e.form.items.where_field[a]){i=e.form.items.where[f].value,r=e.form.items.where[f].operator;break}b[a]={operator:r,value:i,field:e.form.items.where_field[a]}}e.form.items.where=b},z=()=>{const b=[];for(const a in e.form.items.order_field){let i="DESC";for(const r in e.form.items.order)if(e.form.items.order[r].field==e.form.items.order_field[a]){i=e.form.items.order[r].value;break}b[a]={value:i,field:e.form.items.order_field[a]}}e.form.items.order=b},$=B({name:[U({name:"required",title:m("routine.dataexport.name")})],main_table:[U({name:"required",message:m("Please select field",{field:m("routine.dataexport.main_table")})})],concurrent_create_xls:[U({name:"required",title:m("routine.dataexport.concurrent_create_xls")})],memory_limit:[U({name:"required",title:m("routine.dataexport.memory_limit")}),{validator:(b,a,i)=>{let r=(e.form.items.fields&&e.form.items.fields.length)??0;for(const s in e.form.items.joinTableFields)r+=e.form.items.joinTableFields[s].length;if(r<=0)return i(new Error("请先在基础配置中选择导出字段"));const f=r*e.form.items.xls_max_number/1024;return f>=e.form.items.memory_limit?i(new Error("预计需要更多内存 > "+(f+50).toFixed(0)+"MB")):i()},trigger:"blur"}],fields:[U({name:"required",message:m("Please select field",{field:"导出字段"})})]});return M({onTableChange:E,onJoinTableChange:P}),(b,a)=>{const i=_("el-tooltip"),r=_("el-col"),f=_("el-input"),s=_("el-option"),j=_("el-select"),w=_("el-row"),L=_("el-tab-pane"),G=_("el-form-item"),H=_("el-tabs"),W=_("el-form"),Q=_("el-scrollbar"),q=_("el-button"),X=_("el-dialog"),Y=N("drag"),Z=N("zoom"),T=N("loading"),ee=N("blur");return u(),x("div",null,[o(X,{class:"ba-operate-dialog","close-on-click-modal":!1,"model-value":!!l(e).form.operate,onClose:l(e).toggleForm,"destroy-on-close":!0},{header:n(()=>[y((u(),x("div",ue,[k(S(l(e).form.operate?l(m)(l(e).form.operate):""),1)])),[[Y,[".ba-operate-dialog",".el-dialog__header"]],[Z,".ba-operate-dialog"]])]),footer:n(()=>[g("div",{style:ne("width: calc(100% - "+l(e).form.labelWidth/1.8+"px)")},[o(q,{onClick:a[12]||(a[12]=t=>l(e).toggleForm(""))},{default:n(()=>[k(S(l(m)("Cancel")),1)]),_:1}),y((u(),p(q,{loading:l(e).form.submitLoading,onClick:a[13]||(a[13]=t=>l(e).onSubmit(O.value)),type:"primary"},{default:n(()=>[k(S(l(e).form.operateIds&&l(e).form.operateIds.length>1?l(m)("Save and edit next item"):l(m)("Save")),1)]),_:1},8,["loading"])),[[ee]])],4)]),default:n(()=>[y((u(),p(Q,{class:"ba-table-form-scrollbar"},{default:n(()=>[l(e).form.loading?V("",!0):(u(),p(W,{key:0,ref_key:"formRef",ref:O,onKeyup:a[11]||(a[11]=de(t=>l(e).onSubmit(O.value),["enter"])),model:l(e).form.items,"label-position":"top",rules:$},{default:n(()=>[o(H,{class:"config-tabs",onTabChange:R,modelValue:I.tab,"onUpdate:modelValue":a[10]||(a[10]=t=>I.tab=t)},{default:n(()=>[o(L,{label:"基础配置",name:"base"},{default:n(()=>[o(c,{label:l(m)("routine.dataexport.name"),type:"string",modelValue:l(e).form.items.name,"onUpdate:modelValue":a[0]||(a[0]=t=>l(e).form.items.name=t),prop:"name","input-attr":{placeholder:l(m)("Please input field",{field:l(m)("routine.dataexport.name")})}},null,8,["label","modelValue","input-attr"]),y(o(c,{label:l(m)("routine.dataexport.main_table"),type:"select",modelValue:l(e).form.items.main_table,"onUpdate:modelValue":a[1]||(a[1]=t=>l(e).form.items.main_table=t),prop:"main_table",data:{content:l(e).form.extend.tables},"input-attr":{placeholder:l(m)("Please select field",{field:l(m)("routine.dataexport.main_table")}),onChange:E}},null,8,["label","modelValue","data","input-attr"]),[[T,l(e).form.extend.fieldLoading]]),l(e).form.extend.fieldSelectOpt?y((u(),p(c,{label:"导出字段",type:"selects",modelValue:l(e).form.items.fields,"onUpdate:modelValue":a[2]||(a[2]=t=>l(e).form.items.fields=t),key:l(e).form.extend.fieldSelectKey,prop:"fields",placeholder:"请先选择导出数据源表,随后在此选择导出字段",data:{content:l(e).form.extend.fieldSelectOpt}},null,8,["modelValue","data"])),[[T,l(e).form.extend.fieldLoading]]):V("",!0),(u(!0),x(F,null,h(l(e).form.items.fields,t=>(u(),p(w,{key:t,class:"field-row"},{default:n(()=>[o(r,{span:4,class:"field-title"},{default:n(()=>[o(i,{placement:"top",content:l(e).form.extend.fieldSelect[t].name},{default:n(()=>[g("div",null,S(l(e).form.extend.fieldSelect[t].name)+":",1)]),_:2},1032,["content"])]),_:2},1024),o(r,{span:4},{default:n(()=>[o(f,{type:"text",placeholder:"字段标题",modelValue:l(e).form.extend.fieldSelect[t].title,"onUpdate:modelValue":d=>l(e).form.extend.fieldSelect[t].title=d,class:"field-title-input"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1024),o(r,{span:3,class:"field-title-input-title"},{default:n(()=>[k("数据识别:")]),_:1}),o(r,{span:4},{default:n(()=>[o(j,{modelValue:l(e).form.extend.fieldSelect[t].discern,"onUpdate:modelValue":d=>l(e).form.extend.fieldSelect[t].discern=d},{default:n(()=>[o(s,{label:"文本",value:"text"}),o(s,{label:"数字",value:"int"}),o(s,{label:"时间日期",value:"time"}),o(s,{label:"值替换",value:"valuation"})]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1024),o(r,{span:3,class:"field-title-input-title"},{default:n(()=>[l(e).form.extend.fieldSelect[t].discern=="valuation"?(u(),x("div",fe,"替换方案:")):V("",!0)]),_:2},1024),o(r,{span:6},{default:n(()=>[l(e).form.extend.fieldSelect[t].discern=="valuation"?(u(),x("div",se,[o(f,{type:"text",placeholder:"值替换方案",modelValue:l(e).form.extend.fieldSelect[t].comment,"onUpdate:modelValue":d=>l(e).form.extend.fieldSelect[t].comment=d,class:"field-title-input"},null,8,["modelValue","onUpdate:modelValue"])])):V("",!0)]),_:2},1024)]),_:2},1024))),128))]),_:1}),o(L,{label:"关联表配置",name:"join"},{default:n(()=>[o(c,{label:"关联表数量",type:"number",modelValue:l(e).form.items.joinTableNumber,"onUpdate:modelValue":a[3]||(a[3]=t=>l(e).form.items.joinTableNumber=t),modelModifiers:{number:!0}},null,8,["modelValue"]),(u(!0),x(F,null,h(l(e).form.items.joinTableNumber,t=>(u(),x("div",{key:t,class:"join-table-item"},[pe,o(G,{label:"关联表"+t},{default:n(()=>[y((u(),p(j,{class:"w100",placeholder:l(m)("Please select field",{field:"关联表"+t}),modelValue:l(e).form.items.joinTable[t-1],"onUpdate:modelValue":d=>l(e).form.items.joinTable[t-1]=d,onChange:d=>P(d,t-1)},{default:n(()=>[(u(!0),x(F,null,h(l(e).form.extend.tables,(d,v)=>(u(),p(s,{label:d,value:v,key:v},null,8,["label","value"]))),128))]),_:2},1032,["placeholder","modelValue","onUpdate:modelValue","onChange"])),[[T,l(e).form.extend.fieldLoading]])]),_:2},1032,["label"]),o(c,{type:"string",placeholder:"非必填,设置别名后则源表可与关联表相同",label:"关联表别名",modelValue:l(e).form.items.joinTableAsName[t-1],"onUpdate:modelValue":d=>l(e).form.items.joinTableAsName[t-1]=d},null,8,["modelValue","onUpdate:modelValue"]),l(e).form.extend.fieldSelectOpt?y((u(),p(c,{label:"关联外键",type:"select",modelValue:l(e).form.items.joinTableFk[t-1],"onUpdate:modelValue":d=>l(e).form.items.joinTableFk[t-1]=d,key:l(e).form.extend.fieldSelectKey+"fk",placeholder:"请先选择源表,随后在此关联外键",data:{content:l(e).form.extend.fieldSelectOpt}},null,8,["modelValue","onUpdate:modelValue","data"])),[[T,l(e).form.extend.fieldLoading]]):V("",!0),l(e).form.extend.joinTableFieldSelectOpt&&l(e).form.extend.joinTableFieldSelectOpt[t-1]?y((u(),p(c,{label:"关联主键",type:"select",modelValue:l(e).form.items.joinTablePk[t-1],"onUpdate:modelValue":d=>l(e).form.items.joinTablePk[t-1]=d,key:l(e).form.extend.joinTableFieldSelectKey[t-1]+"pk",placeholder:"请先选择关联表"+t+",随后在此选择关联主键",data:{content:l(e).form.extend.joinTableFieldSelectOpt[t-1]}},null,8,["modelValue","onUpdate:modelValue","placeholder","data"])),[[T,l(e).form.extend.fieldLoading]]):V("",!0),o(c,{label:"关联类型",type:"select",modelValue:l(e).form.items.joinTableType[t-1],"onUpdate:modelValue":d=>l(e).form.items.joinTableType[t-1]=d,placeholder:"请选择关联类型",data:{content:{INNER:"INNER - 至少一个匹配",LEFT:"LEFT - 从左表返回所有行",RIGHT:"RIGHT - 从右表返回所有行",FULL:"FULL - 返回所有行"}}},null,8,["modelValue","onUpdate:modelValue"]),l(e).form.extend.joinTableFieldSelectOpt&&l(e).form.extend.joinTableFieldSelectOpt[t-1]?y((u(),p(c,{label:"导出字段",type:"selects",modelValue:l(e).form.items.joinTableFields[t-1],"onUpdate:modelValue":d=>l(e).form.items.joinTableFields[t-1]=d,key:l(e).form.extend.joinTableFieldSelectKey[t-1],placeholder:"请先选择关联表"+t+",随后在此选择该表的导出字段",data:{content:l(e).form.extend.joinTableFieldSelectOpt[t-1]}},null,8,["modelValue","onUpdate:modelValue","placeholder","data"])),[[T,l(e).form.extend.fieldLoading]]):V("",!0),l(e).form.items.joinTableFields&&l(e).form.items.joinTableFields[t-1]?(u(!0),x(F,{key:3},h(l(e).form.items.joinTableFields[t-1],d=>(u(),p(w,{key:d,class:"field-row"},{default:n(()=>[o(r,{span:4,class:"field-title"},{default:n(()=>[o(i,{placement:"top",content:l(e).form.extend.joinTableFieldSelect[t-1][d].name},{default:n(()=>[g("div",null,S(l(e).form.extend.joinTableFieldSelect[t-1][d].name)+":",1)]),_:2},1032,["content"])]),_:2},1024),o(r,{span:4},{default:n(()=>[o(f,{type:"text",placeholder:"字段标题",modelValue:l(e).form.extend.joinTableFieldSelect[t-1][d].title,"onUpdate:modelValue":v=>l(e).form.extend.joinTableFieldSelect[t-1][d].title=v,class:"field-title-input"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1024),o(r,{span:3,class:"field-title-input-title"},{default:n(()=>[k("数据识别:")]),_:1}),o(r,{span:4},{default:n(()=>[o(j,{modelValue:l(e).form.extend.joinTableFieldSelect[t-1][d].discern,"onUpdate:modelValue":v=>l(e).form.extend.joinTableFieldSelect[t-1][d].discern=v},{default:n(()=>[o(s,{label:"文本",value:"text"}),o(s,{label:"数字",value:"int"}),o(s,{label:"时间日期",value:"time"}),o(s,{label:"值替换",value:"valuation"})]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1024),o(r,{span:3,class:"field-title-input-title"},{default:n(()=>[l(e).form.extend.joinTableFieldSelect[t-1][d].discern=="valuation"?(u(),x("div",ce," 替换方案: ")):V("",!0)]),_:2},1024),o(r,{span:6},{default:n(()=>[l(e).form.extend.joinTableFieldSelect[t-1][d].discern=="valuation"?(u(),x("div",be,[o(f,{type:"text",placeholder:"值替换方案",modelValue:l(e).form.extend.joinTableFieldSelect[t-1][d].comment,"onUpdate:modelValue":v=>l(e).form.extend.joinTableFieldSelect[t-1][d].comment=v,class:"field-title-input"},null,8,["modelValue","onUpdate:modelValue"])])):V("",!0)]),_:2},1024)]),_:2},1024))),128)):V("",!0)]))),128))]),_:1}),o(L,{label:"数据筛选配置",name:"where"},{default:n(()=>[l(e).form.extend.allTableField?y((u(),p(c,{label:"筛选字段",type:"selects",modelValue:l(e).form.items.where_field,"onUpdate:modelValue":a[4]||(a[4]=t=>l(e).form.items.where_field=t),placeholder:"请先选择源表和关联表,随后在此选择数据筛选字段",data:{content:l(e).form.extend.allTableField},key:l(e).form.extend.allTableFieldKey,"input-attr":{onChange:A}},null,8,["modelValue","data","input-attr"])),[[T,l(e).form.extend.fieldLoading]]):V("",!0),(u(!0),x(F,null,h(l(e).form.items.where,t=>(u(),p(w,{key:t,gutter:10,class:"field-row"},{default:n(()=>[o(r,{span:6,class:"field-title"},{default:n(()=>[o(i,{placement:"top",content:t.field},{default:n(()=>[g("div",null,S(t.field)+":",1)]),_:2},1032,["content"])]),_:2},1024),o(r,{span:6},{default:n(()=>[o(j,{modelValue:t.operator,"onUpdate:modelValue":d=>t.operator=d},{default:n(()=>[o(s,{label:"等于",value:"="}),o(s,{label:"不等于",value:"<>"}),o(s,{label:"大于",value:">"}),o(s,{label:"大于等于",value:">="}),o(s,{label:"小于",value:"<"}),o(s,{label:"小于等于",value:"<="}),o(s,{label:"LIKE",value:"LIKE"}),o(s,{label:"NOT LIKE",value:"NOT LIKE"}),o(s,{label:"IN",value:"IN"}),o(s,{label:"NOT IN",value:"NOT IN"})]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1024),o(r,{span:10},{default:n(()=>[g("div",null,[o(f,{type:"text",placeholder:"筛选值",modelValue:t.value,"onUpdate:modelValue":d=>t.value=d,class:"field-title-input"},null,8,["modelValue","onUpdate:modelValue"])])]),_:2},1024)]),_:2},1024))),128)),_e,l(e).form.extend.allTableField?y((u(),p(c,{label:"排序字段",type:"selects",modelValue:l(e).form.items.order_field,"onUpdate:modelValue":a[5]||(a[5]=t=>l(e).form.items.order_field=t),placeholder:"请先选择源表和关联表,随后在此选择数据排序字段",data:{content:l(e).form.extend.allTableField},key:l(e).form.extend.allTableFieldKey+"order","input-attr":{onChange:z}},null,8,["modelValue","data","input-attr"])),[[T,l(e).form.extend.fieldLoading]]):V("",!0),(u(!0),x(F,null,h(l(e).form.items.order,t=>(u(),p(w,{key:t,gutter:10,class:"field-row"},{default:n(()=>[o(r,{span:6,class:"field-title"},{default:n(()=>[o(i,{placement:"top",content:t.field},{default:n(()=>[g("div",null,S(t.field)+":",1)]),_:2},1032,["content"])]),_:2},1024),o(r,{span:6},{default:n(()=>[o(j,{modelValue:t.value,"onUpdate:modelValue":d=>t.value=d},{default:n(()=>[o(s,{label:"倒序(从大到小)",value:"DESC"}),o(s,{label:"正序(从小到大)",value:"ASC"})]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1024)]),_:2},1024))),128))]),_:1}),o(L,{label:"其他配置",name:"other"},{default:n(()=>[o(c,{label:l(m)("routine.dataexport.xls_max_number"),type:"number",prop:"xls_max_number",modelValue:l(e).form.items.xls_max_number,"onUpdate:modelValue":a[6]||(a[6]=t=>l(e).form.items.xls_max_number=t),modelModifiers:{number:!0},"input-attr":{step:"1",placeholder:l(m)("Please input field",{field:l(m)("routine.dataexport.xls_max_number")})}},null,8,["label","modelValue","input-attr"]),o(c,{label:l(m)("routine.dataexport.concurrent_create_xls"),type:"number",prop:"concurrent_create_xls",modelValue:l(e).form.items.concurrent_create_xls,"onUpdate:modelValue":a[7]||(a[7]=t=>l(e).form.items.concurrent_create_xls=t),modelModifiers:{number:!0},"input-attr":{step:"1",placeholder:l(m)("Please input field",{field:l(m)("routine.dataexport.concurrent_create_xls")})}},null,8,["label","modelValue","input-attr"]),o(c,{label:l(m)("routine.dataexport.memory_limit"),type:"number",prop:"memory_limit",modelValue:l(e).form.items.memory_limit,"onUpdate:modelValue":a[8]||(a[8]=t=>l(e).form.items.memory_limit=t),modelModifiers:{number:!0},"input-attr":{step:"1",placeholder:l(m)("Please input field",{field:l(m)("routine.dataexport.memory_limit")})}},null,8,["label","modelValue","input-attr"]),o(c,{label:l(m)("routine.dataexport.export_number"),type:"number",prop:"export_number",modelValue:l(e).form.items.export_number,"onUpdate:modelValue":a[9]||(a[9]=t=>l(e).form.items.export_number=t),modelModifiers:{number:!0},"input-attr":{step:"1",placeholder:l(m)("Please input field",{field:l(m)("routine.dataexport.export_number")})+",留空或输入 0 则导出全部"}},null,8,["label","modelValue","input-attr"])]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["model","rules"]))]),_:1})),[[T,l(e).form.loading]])]),_:1},8,["model-value","onClose"])])}}}),ke=me(xe,[["__scopeId","data-v-d315b28c"]]);export{ke as default};
|