popupForm-fd4f1ba1.js 17 KB

1
  1. import{h as le,y as te,r as q,p as u,l as _,q as o,N as n,a6 as y,W as j,V as S,k as l,o as v,M as p,m as oe,a0 as ae,a4 as V,T as F,U as h,an as ne,t as x,a7 as N,X as de,Y as re}from"./vue-a39e6937.js";import{f as ie,g as K,_ as me}from"./index-ba596ae9.js";import{F as c}from"./index-f0d8af94.js";import{b as U}from"./validate-4ecec794.js";import{d as D}from"./dataexport-120e1788.js";import"./index-434d719f.js";import"./controllerUrls-941681c3.js";import"./index-7e56a0fa.js";const J=C=>(de("data-v-6cdc1543"),C=C(),re(),C),ue={class:"title"},se={key:0},fe={key:0},pe=J(()=>v("div",{class:"form-hr"},null,-1)),ce={key:0},be={key:0},_e=J(()=>v("div",{class:"form-hr"},null,-1)),xe=le({__name:"popupForm",setup(C,{expose:R}){const O=te(),e=ne("baTable"),{t:m}=ie(),I=q({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 s in a.data.fields)i.push(s),r[s]=a.data.fields[s].name+(a.data.fields[s].title?" - "+a.data.fields[s].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 s in i.data.fields)r[s]=i.data.fields[s].name+(i.data.fields[s].title?" - "+i.data.fields[s].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})},A=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)for(const r in e.form.extend.joinTableFieldSelectOpt[i])a[e.form.items.joinTableAsName[i]+"."+r]=e.form.items.joinTableAsName[i]+"."+e.form.extend.joinTableFieldSelectOpt[i][r];e.form.extend.allTableField=a,e.form.extend.fieldLoading=!1,e.form.extend.allTableFieldKey=K()}},B=()=>{const b=[];for(const a in e.form.items.where_field){let i="",r="=";for(const s in e.form.items.where)if(e.form.items.where[s].field==e.form.items.where_field[a]){i=e.form.items.where[s].value,r=e.form.items.where[s].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},W=q({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 f in e.form.items.joinTableFields)r+=e.form.items.joinTableFields[f].length;if(r<=0)return i(new Error("请先在基础配置中选择导出字段"));const s=r*e.form.items.xls_max_number/1024;return s>=e.form.items.memory_limit?i(new Error("预计需要更多内存 > "+(s+50).toFixed(0)+"MB")):i()},trigger:"blur"}],fields:[U({name:"required",message:m("Please select field",{field:"导出字段"})})]});return R({onTableChange:E,onJoinTableChange:P}),(b,a)=>{const i=x("el-tooltip"),r=x("el-col"),s=x("el-input"),f=x("el-option"),k=x("el-select"),w=x("el-row"),L=x("el-tab-pane"),$=x("el-form-item"),G=x("el-tabs"),H=x("el-form"),X=x("el-scrollbar"),M=x("el-button"),Y=x("el-dialog"),Q=N("drag"),Z=N("zoom"),T=N("loading"),ee=N("blur");return u(),_("div",null,[o(Y,{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(),_("div",ue,[j(S(l(e).form.operate?l(m)(l(e).form.operate):""),1)])),[[Q,[".ba-operate-dialog",".el-dialog__header"]],[Z,".ba-operate-dialog"]])]),footer:n(()=>[v("div",{style:oe("width: calc(100% - "+l(e).form.labelWidth/1.8+"px)")},[o(M,{onClick:a[12]||(a[12]=t=>l(e).toggleForm(""))},{default:n(()=>[j(S(l(m)("Cancel")),1)]),_:1}),y((u(),p(M,{loading:l(e).form.submitLoading,onClick:a[13]||(a[13]=t=>l(e).onSubmit(O.value)),type:"primary"},{default:n(()=>[j(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(X,{class:"ba-table-form-scrollbar"},{default:n(()=>[l(e).form.loading?V("",!0):(u(),p(H,{key:0,ref_key:"formRef",ref:O,onKeyup:a[11]||(a[11]=ae(t=>l(e).onSubmit(O.value),["enter"])),model:l(e).form.items,"label-position":"top",rules:W},{default:n(()=>[o(G,{class:"config-tabs",onTabChange:A,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),_(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(()=>[v("div",null,S(l(e).form.extend.fieldSelect[t].name)+":",1)]),_:2},1032,["content"])]),_:2},1024),o(r,{span:4},{default:n(()=>[o(s,{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(()=>[j("数据识别:")]),_:1}),o(r,{span:4},{default:n(()=>[o(k,{modelValue:l(e).form.extend.fieldSelect[t].discern,"onUpdate:modelValue":d=>l(e).form.extend.fieldSelect[t].discern=d},{default:n(()=>[o(f,{label:"文本",value:"text"}),o(f,{label:"数字",value:"int"}),o(f,{label:"时间日期",value:"time"}),o(f,{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(),_("div",se,"替换方案:")):V("",!0)]),_:2},1024),o(r,{span:6},{default:n(()=>[l(e).form.extend.fieldSelect[t].discern=="valuation"?(u(),_("div",fe,[o(s,{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),_(F,null,h(l(e).form.items.joinTableNumber,t=>(u(),_("div",{key:t,class:"join-table-item"},[pe,o($,{label:"关联表"+t},{default:n(()=>[y((u(),p(k,{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),_(F,null,h(l(e).form.extend.tables,(d,g)=>(u(),p(f,{label:d,value:g},null,8,["label","value"]))),256))]),_: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),_(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(()=>[v("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(s,{type:"text",placeholder:"字段标题",modelValue:l(e).form.extend.joinTableFieldSelect[t-1][d].title,"onUpdate:modelValue":g=>l(e).form.extend.joinTableFieldSelect[t-1][d].title=g,class:"field-title-input"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1024),o(r,{span:3,class:"field-title-input-title"},{default:n(()=>[j("数据识别:")]),_:1}),o(r,{span:4},{default:n(()=>[o(k,{modelValue:l(e).form.extend.joinTableFieldSelect[t-1][d].discern,"onUpdate:modelValue":g=>l(e).form.extend.joinTableFieldSelect[t-1][d].discern=g},{default:n(()=>[o(f,{label:"文本",value:"text"}),o(f,{label:"数字",value:"int"}),o(f,{label:"时间日期",value:"time"}),o(f,{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(),_("div",ce," 替换方案: ")):V("",!0)]),_:2},1024),o(r,{span:6},{default:n(()=>[l(e).form.extend.joinTableFieldSelect[t-1][d].discern=="valuation"?(u(),_("div",be,[o(s,{type:"text",placeholder:"值替换方案",modelValue:l(e).form.extend.joinTableFieldSelect[t-1][d].comment,"onUpdate:modelValue":g=>l(e).form.extend.joinTableFieldSelect[t-1][d].comment=g,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:B}},null,8,["modelValue","data","input-attr"])),[[T,l(e).form.extend.fieldLoading]]):V("",!0),(u(!0),_(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(()=>[v("div",null,S(t.field)+":",1)]),_:2},1032,["content"])]),_:2},1024),o(r,{span:6},{default:n(()=>[o(k,{modelValue:t.operator,"onUpdate:modelValue":d=>t.operator=d},{default:n(()=>[o(f,{label:"等于",value:"="}),o(f,{label:"不等于",value:"<>"}),o(f,{label:"大于",value:">"}),o(f,{label:"大于等于",value:">="}),o(f,{label:"小于",value:"<"}),o(f,{label:"小于等于",value:"<="}),o(f,{label:"LIKE",value:"LIKE"}),o(f,{label:"NOT LIKE",value:"NOT LIKE"}),o(f,{label:"IN",value:"IN"}),o(f,{label:"NOT IN",value:"NOT IN"})]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1024),o(r,{span:10},{default:n(()=>[v("div",null,[o(s,{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),_(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(()=>[v("div",null,S(t.field)+":",1)]),_:2},1032,["content"])]),_:2},1024),o(r,{span:6},{default:n(()=>[o(k,{modelValue:t.value,"onUpdate:modelValue":d=>t.value=d},{default:n(()=>[o(f,{label:"倒序(从大到小)",value:"DESC"}),o(f,{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"])])}}});const ke=me(xe,[["__scopeId","data-v-6cdc1543"]]);export{ke as default};