import{h as Re,y as se,r as ce,B as xe,ar as T,J,n as me,ax as ue,p as n,l as p,o as u,q as d,N as s,k as i,a6 as _,M as b,W as k,V as F,T as h,U as V,a4 as C,ae as Ne,a2 as fe,$ as q,i as I,m as pe,a0 as Ke,ah as Ae,t as v,a7 as be,X as Ge,Y as je,a5 as qe}from"./vue-a39e6937.js";import{S as ge,B as ye}from"./index-434d719f.js";import{F as f}from"./index-f0d8af94.js";import{f as R,d as Fe,t as U,g as Me,a as H,b as $e,c as Be,e as ve,h as ze,s as w,p as Ee,i as Oe}from"./crud-68282d37.js";import{f as Je,G as He,W,ak as he,_ as We}from"./index-ba596ae9.js";import{b as x,a as Ye}from"./validate-4ecec794.js";import"./controllerUrls-941681c3.js";import"./index-7e56a0fa.js";const Qe=N=>(Ge("data-v-3b0df174"),N=N(),je(),N),Xe={class:"default-main"},Ze={class:"header-config-box"},el={class:"header"},ll={class:"header-item-box"},tl={class:"header-right"},al={key:0,class:"header-senior-config-box"},ol={class:"header-senior-config-form"},il={class:"default-sort-field-box"},rl=["onClick","data-id"],dl={class:"design-field"},nl={class:"design-field"},sl={class:"design-field-right"},cl={key:0,class:"design-field-empty"},ml={class:"field-config ba-scroll-style"},ul={key:0,class:"design-field-empty"},fl={class:"field-inline"},pl={class:"field-inline"},bl={class:"field-inline"},gl={class:"confirm-generate-dialog-body"},yl=Qe(()=>u("br",null,null,-1)),Fl={class:"confirm-generate-dialog-footer"},vl=Re({__name:"design",setup(N){const{t:o}=Je(),Se=qe(),Y=se(),M=se(),K=He();let Q=1;const e=ce({loading:{init:!1,generate:!1,remoteSelect:!1},table:{name:"",comment:"",quickSearchField:[],defaultSortField:"",formFields:[],columnFields:[],defaultSortType:"desc",generateRelativePath:"",isCommonModel:0,modelFile:"",controllerFile:"",validateFile:"",webViewsDir:""},fields:[],activateField:-1,fieldCollapseName:["common","base","senior"],remoteSelectPre:{show:!1,index:-1,dbList:[],fieldList:[],modelFileList:[],controllerFileList:[],loading:!1,hideDelField:!1,form:{table:"",pk:"",label:"",joinField:[],modelFile:"",controllerFile:""}},showHeaderSeniorConfig:!1,confirmGenerate:{show:!1,table:!1,controller:!1}}),Ve=a=>{e.activateField=a},Pe=()=>{const a=T(e.fields[e.activateField]);for(const l in a.table)a.table[l]=a.table[l].value;for(const l in a.form)a.form[l]=a.form[l].value;e.fields[e.activateField]=A(a)},X=a=>{for(const l in U)for(const r in e.table[U[l]])W(e.fields,"name",e.table[U[l]][r])||(e.table[U[l]][r]=a);e.table.defaultSortField&&(W(e.fields,"name",e.table.defaultSortField)||(e.table.defaultSortField=a))},Z=a=>{if(e.fields[a]){e.activateField=-1,e.fields[a].name==e.table.defaultSortField&&(e.table.defaultSortField="");for(const l in U){const r=e.table[U[l]].findIndex(m=>m==e.fields[a].name);r!=-1&&e.table[U[l]].splice(r,1)}e.fields.splice(a,1)}},ee=(a,l=!1)=>{e.remoteSelectPre.show=!0,e.remoteSelectPre.loading=!0,e.remoteSelectPre.index=a,e.remoteSelectPre.hideDelField=l,Me().then(r=>{e.remoteSelectPre.dbList=r.data.dbs,e.fields[a]&&e.fields[a].form["remote-table"].value&&(e.remoteSelectPre.form.table=e.fields[a].form["remote-table"].value,e.remoteSelectPre.form.pk=e.fields[a].form["remote-pk"].value,e.remoteSelectPre.form.label=e.fields[a].form["remote-field"].value,e.remoteSelectPre.form.controllerFile=e.fields[a].form["remote-controller"].value,e.remoteSelectPre.form.modelFile=e.fields[a].form["remote-model"].value,e.remoteSelectPre.form.joinField=e.fields[a].form["relation-fields"].value.split(","),I(e.remoteSelectPre.fieldList)&&he(e.fields[a].form["remote-table"].value).then(m=>{const y={};for(const S in m.data.fieldList)y[S]=(S?S+" - ":"")+m.data.fieldList[S];e.remoteSelectPre.fieldList=y}),(I(e.remoteSelectPre.modelFileList)||I(e.remoteSelectPre.controllerFileList))&&H(e.fields[a].form["remote-table"].value).then(m=>{e.remoteSelectPre.modelFileList=m.data.modelFileList,e.remoteSelectPre.controllerFileList=m.data.controllerFileList}))}).finally(()=>{e.remoteSelectPre.loading=!1})},ke=(a,l)=>{if(["remoteSelect","remoteSelects"].includes(l.designType))return ee(a)},$=()=>{e.confirmGenerate.show=!1},le=()=>{e.loading.generate=!0;const a=T(e.fields);for(const l in a){for(const r in a[l].table)a[l].table[r]=a[l].table[r].value;for(const r in a[l].form)a[l].form[r]=a[l].form[r].value}$e({table:e.table,fields:a}).then(()=>{Se.go(0)}).finally(()=>{e.loading.generate=!1,$()})},we=()=>{let a="";if(e.fields.find(r=>{if(!Ye(r.name))return a=o("crud.crud.Field name is invalid It starts with a letter or underscore and cannot contain any character other than letters, digits, or underscores",{field:r.name}),!0}),e.fields.findIndex(r=>r.primaryKey)===-1&&(a=o("crud.crud.Please design the primary key field!")),e.table.name||(a=o("crud.crud.Please enter the data table name!")),a){J({type:"error",message:a});return}e.loading.generate=!0,Be({table:e.table.name,controllerFile:e.table.controllerFile}).then(()=>{le()}).catch(r=>{e.loading.generate=!1,r.code==-1?(e.confirmGenerate.show=!0,e.confirmGenerate.table=r.data.table,e.confirmGenerate.controller=r.data.controller):J({type:"error",message:r.msg})})},_e=()=>{if(!e.table.name&&!e.table.comment&&!e.fields.length)return ve("start");Ae.confirm(o("crud.crud.It is irreversible to give up the design Are you sure you want to give up?"),o("Reminder"),{confirmButtonText:o("crud.crud.give up"),cancelButtonText:o("Cancel"),type:"warning"}).then(()=>{ve("start")}).catch(()=>{})},A=a=>{const l=T(Fe[a.designType]);for(const r in a.form)l.form[r]&&(l.form[r].value=a.form[r]),r=="image-multi"&&a.form[r]&&(l.table.render=ze("render","images"));for(const r in a.table)l.table[r]&&(l.table[r].value=a.table[r]);return a.form=l.form,a.table=l.table,a},Ce=a=>{if(["enum","set"].includes(e.fields[e.activateField].type)){if(!a){e.fields[e.activateField].dataType=`${e.fields[e.activateField].type}()`;return}a=a.replaceAll(":",":"),a=a.replaceAll(",",",");let l=a.split(":");l[1]&&(l=l[1].split(","),l=l.map(r=>{if(!r)return"";let m=r.split("=");return m[0]&&m[1]?`'${m[0]}'`:""}).filter(r=>r!=""),e.fields[e.activateField].dataType=`${e.fields[e.activateField].type}(${l.join(",")})`)}},Ue=()=>{if(["db","sql","log"].includes(w.type)){if(e.loading.init=!0,w.type=="log"){Ee(parseInt(w.startData.logId)).then(a=>{e.table=a.data.table,e.table.isCommonModel=parseInt(a.data.table.isCommonModel);const l=a.data.fields;for(const r in l){const m=A(T(l[r]));e.fields.push(m)}}).finally(()=>{e.loading.init=!1});return}Oe(w.type,w.startData.db,w.startData.sql).then(a=>{let l=[];for(const r in a.data.columns){const m=A(a.data.columns[r]);["id","update_time","create_time","updatetime","createtime"].includes(m.name)||e.table.formFields.push(m.name),["textarea","file","files","editor","password","array"].includes(m.designType)||e.table.columnFields.push(m.name),m.designType=="pk"&&(e.table.defaultSortField=m.name,e.table.quickSearchField.push(m.name)),m.designType=="weigh"&&(e.table.defaultSortField=m.name),l.push(m)}e.fields=l,e.table.comment=a.data.comment,w.type=="db"&&w.startData.db&&(e.table.name=w.startData.db,G(w.startData.db))}).finally(()=>{e.loading.init=!1})}};xe(()=>{Ue();const a=ge.create(Y.value,{group:"design-field",animation:200,filter:".design-field-empty",onAdd:l=>{var y,S;const r=(S=(y=l.originalEvent)==null?void 0:y.dataTransfer)==null?void 0:S.getData("name"),m=R[r];if(m&&m[l.oldIndex]){const g=A(T(m[l.oldIndex]));if(g.primaryKey==!0){if(e.fields.find(D=>D.primaryKey))return J({type:"error",message:o("crud.crud.There can only be one primary key field")}),l.item.remove();e.table.defaultSortField=g.name,e.table.quickSearchField.push(g.name)}g.designType=="weigh"&&(e.table.defaultSortField=g.name),W(e.fields,"name",g.name)&&(g.name=g.name+Q,Q++),e.fields.splice(l.newIndex,0,g),["remoteSelect","remoteSelects"].includes(g.designType)&&ee(l.newIndex,!0),g.formBuildExclude||e.table.formFields.push(g.name),g.tableBuildExclude||e.table.columnFields.push(g.name)}l.item.remove(),me(()=>{a.sort(ue(e.fields.length).map(g=>g.toString()))})},onEnd:l=>{const r=e.fields[l.oldIndex];e.fields.splice(l.oldIndex,1),e.fields.splice(l.newIndex,0,r),me(()=>{a.sort(ue(e.fields.length).map(m=>m.toString()))})}});K.value.forEach((l,r)=>{ge.create(l,{sort:!1,group:{name:"design-field",pull:"clone",put:!1},animation:200,setData:m=>{m.setData("name",Object.keys(R)[r])}})})});const G=a=>{a&&H(a,e.table.isCommonModel).then(l=>{e.table.modelFile=l.data.modelFile,e.table.controllerFile=l.data.controllerFile,e.table.validateFile=l.data.validateFile,e.table.webViewsDir=l.data.webViewsDir,e.table.generateRelativePath=a.replaceAll("/","\\")})},Le=()=>{G(e.table.generateRelativePath)},De=a=>{a&&(B(),e.remoteSelectPre.form.table=a,e.loading.remoteSelect=!0,he(a).then(l=>{e.remoteSelectPre.form.pk=l.data.pk;const r=["name","title","username","nickname"];for(const y in l.data.fieldList)if(r.includes(y)){e.remoteSelectPre.form.label=y,e.remoteSelectPre.form.joinField.push(y);break}const m={};for(const y in l.data.fieldList)m[y]=(y?y+" - ":"")+l.data.fieldList[y];e.remoteSelectPre.fieldList=m}).finally(()=>{e.loading.remoteSelect=!1}),H(a).then(l=>{e.remoteSelectPre.modelFileList=l.data.modelFileList,e.remoteSelectPre.controllerFileList=l.data.controllerFileList,Object.keys(l.data.modelFileList).includes(l.data.modelFile)&&(e.remoteSelectPre.form.modelFile=l.data.modelFile),Object.keys(l.data.controllerFileList).includes(l.data.controllerFile)&&(e.remoteSelectPre.form.controllerFile=l.data.controllerFile)}))},te=()=>{const a=()=>{e.fields[e.remoteSelectPre.index].form["remote-table"].value=e.remoteSelectPre.form.table,e.fields[e.remoteSelectPre.index].form["remote-pk"].value=e.remoteSelectPre.form.pk,e.fields[e.remoteSelectPre.index].form["remote-field"].value=e.remoteSelectPre.form.label,e.fields[e.remoteSelectPre.index].form["remote-controller"].value=e.remoteSelectPre.form.controllerFile,e.fields[e.remoteSelectPre.index].form["remote-model"].value=e.remoteSelectPre.form.modelFile,e.fields[e.remoteSelectPre.index].form["relation-fields"].value=e.remoteSelectPre.form.joinField.join(","),e.remoteSelectPre.index=-1,e.remoteSelectPre.show=!1,B()};M.value&&M.value.validate(l=>{l&&a()})},ae=()=>{e.remoteSelectPre.show=!1,B(),e.remoteSelectPre.index!==-1&&e.remoteSelectPre.hideDelField&&Z(e.remoteSelectPre.index)},B=()=>{for(const a in e.remoteSelectPre.form)a=="joinField"?e.remoteSelectPre.form[a]=[]:e.remoteSelectPre.form[a]=""},Te=ce({table:[x({name:"required",title:o("crud.crud.remote-table")})],pk:[x({name:"required",title:o("crud.crud.Drop down value field")})],label:[x({name:"required",title:o("crud.crud.Drop down label field")})],joinField:[x({name:"required",title:o("crud.crud.Fields displayed in the table")})],controllerFile:[x({name:"required",title:o("crud.crud.Controller position")})]});return(a,l)=>{const r=v("el-button"),m=v("el-row"),y=v("el-option"),S=v("el-select"),g=v("el-form-item"),oe=v("el-checkbox"),ie=v("el-input"),D=v("Icon"),z=v("el-collapse-item"),Ie=v("el-collapse"),E=v("el-col"),j=v("el-divider"),re=v("el-form"),de=v("el-dialog"),ne=v("el-alert"),L=be("blur"),O=be("loading");return n(),p("div",Xe,[u("div",Ze,[d(m,{class:"header-box"},{default:s(()=>[u("div",el,[u("div",ll,[d(f,{class:"mr-20 table-name-item",label:i(o)("crud.log.table_name"),modelValue:e.table.name,"onUpdate:modelValue":l[0]||(l[0]=t=>e.table.name=t),type:"string",placeholder:i(o)("crud.crud.Name of the data table"),"input-attr":{onChange:G}},null,8,["label","modelValue","placeholder","input-attr"]),d(f,{class:"table-comment-item",label:i(o)("crud.crud.Data Table Notes"),modelValue:e.table.comment,"onUpdate:modelValue":l[1]||(l[1]=t=>e.table.comment=t),type:"string",placeholder:i(o)("crud.crud.For example: `user table` will be generated into `user management`")},null,8,["label","modelValue","placeholder"])]),u("div",tl,[_((n(),b(r,{type:"primary",loading:e.loading.generate,onClick:we},{default:s(()=>[k(F(i(o)("crud.crud.Generate CRUD code")),1)]),_:1},8,["loading"])),[[L]]),_((n(),b(r,{onClick:_e,type:"danger"},{default:s(()=>[k(F(i(o)("crud.crud.give up")),1)]),_:1})),[[L]])])])]),_:1}),d(Ne,{name:e.showHeaderSeniorConfig?"el-zoom-in-top":"el-zoom-in-bottom"},{default:s(()=>[e.showHeaderSeniorConfig?(n(),p("div",al,[u("div",ol,[d(g,{"label-width":140,label:i(o)("crud.crud.Table Quick Search Fields")},{default:s(()=>[d(S,{clearable:!0,multiple:!0,class:"w100",modelValue:e.table.quickSearchField,"onUpdate:modelValue":l[2]||(l[2]=t=>e.table.quickSearchField=t),placement:"bottom"},{default:s(()=>[(n(!0),p(h,null,V(e.fields,(t,c)=>(n(),b(y,{key:c,label:t.name+(t.title?"-"+t.title:""),value:t.name},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"]),u("div",il,[d(g,{"label-width":140,class:"default-sort-field",label:i(o)("crud.crud.Table Default Sort Fields")},{default:s(()=>[d(S,{clearable:!0,modelValue:e.table.defaultSortField,"onUpdate:modelValue":l[3]||(l[3]=t=>e.table.defaultSortField=t),placement:"bottom"},{default:s(()=>[(n(!0),p(h,null,V(e.fields,(t,c)=>(n(),b(y,{key:c,label:t.name+(t.title?"-"+t.title:""),value:t.name},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"]),d(f,{class:"default-sort-field-type",label:i(o)("crud.crud.sort order"),modelValue:e.table.defaultSortType,"onUpdate:modelValue":l[4]||(l[4]=t=>e.table.defaultSortType=t),type:"select",data:{content:{desc:i(o)("crud.crud.sort order desc"),asc:i(o)("crud.crud.sort order asc")}}},null,8,["label","modelValue","data"])]),d(g,{"label-width":140,label:i(o)("crud.crud.Fields as Table Columns")},{default:s(()=>[d(S,{clearable:!0,multiple:!0,class:"w100",modelValue:e.table.columnFields,"onUpdate:modelValue":l[5]||(l[5]=t=>e.table.columnFields=t),placement:"bottom"},{default:s(()=>[(n(!0),p(h,null,V(e.fields,(t,c)=>(n(),b(y,{key:c,label:t.name+(t.title?"-"+t.title:""),value:t.name},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"]),d(g,{"label-width":140,label:i(o)("crud.crud.Fields as form items")},{default:s(()=>[d(S,{clearable:!0,multiple:!0,class:"w100",modelValue:e.table.formFields,"onUpdate:modelValue":l[6]||(l[6]=t=>e.table.formFields=t),placement:"bottom"},{default:s(()=>[(n(!0),p(h,null,V(e.fields,(t,c)=>(n(),b(y,{key:c,label:t.name+(t.title?"-"+t.title:""),value:t.name},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"]),d(f,{label:i(o)("crud.crud.The relative path to the generated code"),modelValue:e.table.generateRelativePath,"onUpdate:modelValue":l[7]||(l[7]=t=>e.table.generateRelativePath=t),type:"string",attr:{"label-width":140,"block-help":i(o)("crud.crud.For quick combination code generation location, please fill in the relative path")},"input-attr":{onChange:G}},null,8,["label","modelValue","attr","input-attr"]),d(f,{label:i(o)("crud.crud.Generated Controller Location"),modelValue:e.table.controllerFile,"onUpdate:modelValue":l[8]||(l[8]=t=>e.table.controllerFile=t),type:"string",attr:{"label-width":140}},null,8,["label","modelValue"]),d(g,{label:i(o)("crud.crud.Generated Data Model Location"),"label-width":140},{default:s(()=>[d(ie,{modelValue:e.table.modelFile,"onUpdate:modelValue":l[10]||(l[10]=t=>e.table.modelFile=t),type:"string"},{append:s(()=>[d(oe,{onChange:Le,modelValue:e.table.isCommonModel,"onUpdate:modelValue":l[9]||(l[9]=t=>e.table.isCommonModel=t),label:i(o)("crud.crud.Common model"),size:"small","true-label":1,"false-label":0},null,8,["modelValue","label"])]),_:1},8,["modelValue"])]),_:1},8,["label"]),d(f,{label:i(o)("crud.crud.Generated Validator Location"),modelValue:e.table.validateFile,"onUpdate:modelValue":l[11]||(l[11]=t=>e.table.validateFile=t),type:"string",attr:{"label-width":140}},null,8,["label","modelValue"]),d(f,{label:i(o)("crud.crud.WEB end view directory"),modelValue:e.table.webViewsDir,"onUpdate:modelValue":l[12]||(l[12]=t=>e.table.webViewsDir=t),type:"string",attr:{"label-width":140}},null,8,["label","modelValue"])])])):C("",!0)]),_:1},8,["name"]),u("div",{onClick:l[13]||(l[13]=t=>e.showHeaderSeniorConfig=!e.showHeaderSeniorConfig),class:"header-senior-config"},[u("span",null,F(i(o)("crud.crud.Advanced Configuration")),1),d(D,{class:"senior-config-arrow-icon",size:"14",color:"var(--el-color-info)",name:e.showHeaderSeniorConfig?"el-icon-ArrowUp":"el-icon-ArrowDown"},null,8,["name"])])]),_((n(),b(m,{class:"fields-box",gutter:20},{default:s(()=>[d(E,{xs:24,span:6},{default:s(()=>[d(Ie,{class:"field-collapse",modelValue:e.fieldCollapseName,"onUpdate:modelValue":l[14]||(l[14]=t=>e.fieldCollapseName=t)},{default:s(()=>[d(z,{title:i(o)("crud.crud.Common Fields"),name:"common"},{default:s(()=>[u("div",{class:"field-box",ref:i(K).set},[(n(!0),p(h,null,V(i(R).common,(t,c)=>(n(),p("div",{key:c,class:"field-item"},[u("span",null,F(t.title),1)]))),128))],512)]),_:1},8,["title"]),d(z,{title:i(o)("crud.crud.Base Fields"),name:"base"},{default:s(()=>[u("div",{class:"field-box",ref:i(K).set},[(n(!0),p(h,null,V(i(R).base,(t,c)=>(n(),p("div",{key:c,class:"field-item"},[u("span",null,F(t.title),1)]))),128))],512)]),_:1},8,["title"]),d(z,{title:i(o)("crud.crud.Advanced Fields"),name:"senior"},{default:s(()=>[u("div",{class:"field-box",ref:i(K).set},[(n(!0),p(h,null,V(i(R).senior,(t,c)=>(n(),p("div",{key:c,class:"field-item"},[u("span",null,F(t.title),1)]))),128))],512)]),_:1},8,["title"])]),_:1},8,["modelValue"])]),_:1}),d(E,{xs:24,span:12},{default:s(()=>[u("div",{ref_key:"designWindowRef",ref:Y,class:fe(["design-window ba-scroll-style",e.fields.length?"":"design-window-empty"])},[(n(!0),p(h,null,V(e.fields,(t,c)=>(n(),p("div",{key:c,class:fe([c===e.activateField?"activate":"","design-field-box"]),onClick:P=>Ve(c),"data-id":c},[u("div",dl,[u("span",null,F(i(o)("crud.crud.Field Name"))+":",1),d(ye,{onPointerdown:l[15]||(l[15]=q(()=>{},["stop"])),class:"design-field-name-input",modelValue:t.name,"onUpdate:modelValue":P=>t.name=P,type:"string",attr:{size:"small",onChange:X}},null,8,["modelValue","onUpdate:modelValue","attr"])]),u("div",nl,[u("span",null,F(i(o)("crud.crud.field comment"))+":",1),d(ye,{onPointerdown:l[16]||(l[16]=q(()=>{},["stop"])),class:"design-field-name-comment",modelValue:t.comment,"onUpdate:modelValue":P=>t.comment=P,type:"string",attr:{size:"small"}},null,8,["modelValue","onUpdate:modelValue"])]),u("div",sl,[["remoteSelect","remoteSelects"].includes(t.designType)?_((n(),b(r,{key:0,onClick:q(P=>ke(c,t),["stop"]),type:"primary",size:"small",circle:""},{default:s(()=>[d(D,{color:"var(--el-color-white)",size:"15",name:"fa fa-pencil icon"})]),_:2},1032,["onClick"])),[[L]]):C("",!0),_((n(),b(r,{onClick:q(P=>Z(c),["stop"]),type:"danger",size:"small",circle:""},{default:s(()=>[d(D,{color:"var(--el-color-white)",size:"15",name:"fa fa-trash"})]),_:2},1032,["onClick"])),[[L]])])],10,rl))),128)),e.fields.length?C("",!0):(n(),p("div",cl,F(i(o)("crud.crud.Drag the left element here to start designing CRUD")),1))],2)]),_:1}),d(E,{xs:24,span:6},{default:s(()=>[u("div",ml,[e.activateField===-1?(n(),p("div",ul,F(i(o)("crud.crud.Please select a field from the left first")),1)):(n(),p("div",{key:"activate-field-"+e.activateField},[d(re,{"label-position":"top"},{default:s(()=>[d(j,{"content-position":"left"},{default:s(()=>[k(F(i(o)("crud.crud.Common")),1)]),_:1}),d(g,{label:i(o)("crud.crud.generate")},{default:s(()=>[d(S,{onChange:Pe,class:"w100",modelValue:e.fields[e.activateField].designType,"onUpdate:modelValue":l[17]||(l[17]=t=>e.fields[e.activateField].designType=t),placement:"bottom"},{default:s(()=>[(n(!0),p(h,null,V(i(Fe),(t,c)=>(n(),b(y,{key:c,label:t.name,value:c},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"]),d(f,{label:i(o)("crud.crud.Field comments (CRUD dictionary)"),type:"textarea","input-attr":{rows:2,onChange:Ce},placeholder:i(o)("crud.crud.The field comment will be used as the CRUD dictionary, and will be identified as the field title before the colon, and as the data dictionary after the colon"),modelValue:e.fields[e.activateField].comment,"onUpdate:modelValue":l[18]||(l[18]=t=>e.fields[e.activateField].comment=t)},null,8,["label","input-attr","placeholder","modelValue"]),d(j,{"content-position":"left"},{default:s(()=>[k(F(i(o)("crud.crud.Field Properties")),1)]),_:1}),d(f,{label:i(o)("crud.crud.Field Name"),type:"string",modelValue:e.fields[e.activateField].name,"onUpdate:modelValue":l[19]||(l[19]=t=>e.fields[e.activateField].name=t),"input-attr":{onChange:X}},null,8,["label","modelValue","input-attr"]),e.fields[e.activateField].dataType?(n(),b(f,{key:0,label:i(o)("crud.crud.Field Type"),type:"textarea",modelValue:e.fields[e.activateField].dataType,"onUpdate:modelValue":l[20]||(l[20]=t=>e.fields[e.activateField].dataType=t)},null,8,["label","modelValue"])):(n(),p(h,{key:1},[d(f,{label:i(o)("crud.crud.Field Type"),type:"string",modelValue:e.fields[e.activateField].type,"onUpdate:modelValue":l[21]||(l[21]=t=>e.fields[e.activateField].type=t)},null,8,["label","modelValue"]),u("div",fl,[d(f,{label:i(o)("crud.crud.length"),type:"number",modelValue:e.fields[e.activateField].length,"onUpdate:modelValue":l[22]||(l[22]=t=>e.fields[e.activateField].length=t),modelModifiers:{number:!0}},null,8,["label","modelValue"]),d(f,{label:i(o)("crud.crud.decimal point"),type:"number",modelValue:e.fields[e.activateField].precision,"onUpdate:modelValue":l[23]||(l[23]=t=>e.fields[e.activateField].precision=t),modelModifiers:{number:!0}},null,8,["label","modelValue"])])],64)),d(f,{label:i(o)("crud.crud.Field Defaults"),placeholder:i(o)("crud.crud.You can directly enter null, 0, empty string"),type:"string",modelValue:e.fields[e.activateField].default,"onUpdate:modelValue":l[24]||(l[24]=t=>e.fields[e.activateField].default=t)},null,8,["label","placeholder","modelValue"]),u("div",pl,[d(f,{class:"form-item-position-right",label:i(o)("crud.state.Primary key"),type:"switch",modelValue:e.fields[e.activateField].primaryKey,"onUpdate:modelValue":l[25]||(l[25]=t=>e.fields[e.activateField].primaryKey=t)},null,8,["label","modelValue"]),d(f,{class:"form-item-position-right",label:i(o)("crud.crud.Auto increment"),type:"switch",modelValue:e.fields[e.activateField].autoIncrement,"onUpdate:modelValue":l[26]||(l[26]=t=>e.fields[e.activateField].autoIncrement=t)},null,8,["label","modelValue"])]),u("div",bl,[d(f,{class:"form-item-position-right",label:i(o)("crud.crud.Unsigned"),type:"switch",modelValue:e.fields[e.activateField].unsigned,"onUpdate:modelValue":l[27]||(l[27]=t=>e.fields[e.activateField].unsigned=t)},null,8,["label","modelValue"]),d(f,{class:"form-item-position-right",label:i(o)("crud.crud.Allow NULL"),type:"switch",modelValue:e.fields[e.activateField].null,"onUpdate:modelValue":l[28]||(l[28]=t=>e.fields[e.activateField].null=t)},null,8,["label","modelValue"])]),i(I)(e.fields[e.activateField].table)?C("",!0):(n(),p(h,{key:2},[d(j,{"content-position":"left"},{default:s(()=>[k(F(i(o)("crud.crud.Field Table Properties")),1)]),_:1}),(n(!0),p(h,null,V(e.fields[e.activateField].table,(t,c)=>(n(),b(f,{key:c,label:a.$t("crud.crud."+c),type:t.type,modelValue:e.fields[e.activateField].table[c].value,"onUpdate:modelValue":P=>e.fields[e.activateField].table[c].value=P,placeholder:e.fields[e.activateField].table[c].placeholder??"",data:{content:e.fields[e.activateField].table[c].options??{}},"input-attr":e.fields[e.activateField].table[c].attr??{}},null,8,["label","type","modelValue","onUpdate:modelValue","placeholder","data","input-attr"]))),128))],64)),i(I)(e.fields[e.activateField].form)?C("",!0):(n(),p(h,{key:3},[d(j,{"content-position":"left"},{default:s(()=>[k(F(i(o)("crud.crud.Field Form Properties")),1)]),_:1}),(n(!0),p(h,null,V(e.fields[e.activateField].form,(t,c)=>(n(),b(f,{key:c,label:a.$t("crud.crud."+c),type:t.type,modelValue:e.fields[e.activateField].form[c].value,"onUpdate:modelValue":P=>e.fields[e.activateField].form[c].value=P,placeholder:e.fields[e.activateField].form[c].placeholder??"",data:{content:e.fields[e.activateField].form[c].options??{}},"input-attr":e.fields[e.activateField].form[c].attr??{}},null,8,["label","type","modelValue","onUpdate:modelValue","placeholder","data","input-attr"]))),128))],64))]),_:1})]))])]),_:1})]),_:1})),[[O,e.loading.init]]),d(de,{onClose:ae,class:"ba-operate-dialog","model-value":e.remoteSelectPre.show,title:i(o)("crud.crud.Remote drop-down association information"),"close-on-click-modal":!1,onKeyup:Ke(te,["enter"])},{footer:s(()=>[u("div",{style:pe("width: calc(100% - 88px)")},[d(r,{onClick:ae},{default:s(()=>[k(F(a.$t("Cancel")),1)]),_:1}),_((n(),b(r,{onClick:te,type:"primary"},{default:s(()=>[k(F(a.$t("Save")),1)]),_:1})),[[L]])],4)]),default:s(()=>[u("div",{class:"ba-operate-form",style:pe("width: calc(100% - 80px)")},[_((n(),b(re,{ref_key:"formRef",ref:M,model:e.remoteSelectPre.form,rules:Te,"label-position":"right","label-width":"160px","destroy-on-close":!0},{default:s(()=>[(n(),b(f,{prop:"table",type:"select",label:i(o)("crud.crud.Associated Data Table"),modelValue:e.remoteSelectPre.form.table,"onUpdate:modelValue":l[29]||(l[29]=t=>e.remoteSelectPre.form.table=t),key:JSON.stringify(e.remoteSelectPre.dbList),data:{content:e.remoteSelectPre.dbList},"input-attr":{onChange:De}},null,8,["label","modelValue","data","input-attr"])),_((n(),p("div",null,[(n(),b(f,{prop:"pk",type:"select",label:i(o)("crud.crud.Drop down value field"),modelValue:e.remoteSelectPre.form.pk,"onUpdate:modelValue":l[30]||(l[30]=t=>e.remoteSelectPre.form.pk=t),placeholder:i(o)("crud.crud.Please select the value field of the select component"),key:"select-value"+JSON.stringify(e.remoteSelectPre.fieldList),data:{content:e.remoteSelectPre.fieldList}},null,8,["label","modelValue","placeholder","data"])),(n(),b(f,{prop:"label",type:"select",label:i(o)("crud.crud.Drop down label field"),modelValue:e.remoteSelectPre.form.label,"onUpdate:modelValue":l[31]||(l[31]=t=>e.remoteSelectPre.form.label=t),placeholder:i(o)("crud.crud.Please select the label field of the select component"),key:"select-label"+JSON.stringify(e.remoteSelectPre.fieldList),data:{content:e.remoteSelectPre.fieldList}},null,8,["label","modelValue","placeholder","data"])),(n(),b(f,{prop:"joinField",type:"selects",label:i(o)("crud.crud.Fields displayed in the table"),modelValue:e.remoteSelectPre.form.joinField,"onUpdate:modelValue":l[32]||(l[32]=t=>e.remoteSelectPre.form.joinField=t),placeholder:i(o)("crud.crud.Please select the fields displayed in the table"),key:"join-field"+JSON.stringify(e.remoteSelectPre.fieldList),data:{content:e.remoteSelectPre.fieldList}},null,8,["label","modelValue","placeholder","data"])),(n(),b(f,{prop:"controllerFile",type:"select",label:i(o)("crud.crud.Controller position"),modelValue:e.remoteSelectPre.form.controllerFile,"onUpdate:modelValue":l[33]||(l[33]=t=>e.remoteSelectPre.form.controllerFile=t),placeholder:i(o)("crud.crud.Please select the controller of the data table"),key:"controller-file"+JSON.stringify(e.remoteSelectPre.controllerFileList),data:{content:e.remoteSelectPre.controllerFileList},attr:{"block-help":i(o)("crud.crud.The remote pull-down will request the corresponding controller to obtain data, so it is recommended that you create the CRUD of the associated table")}},null,8,["label","modelValue","placeholder","data","attr"])),(n(),b(f,{type:"select",label:i(o)("crud.crud.Data Model Location"),modelValue:e.remoteSelectPre.form.modelFile,"onUpdate:modelValue":l[34]||(l[34]=t=>e.remoteSelectPre.form.modelFile=t),placeholder:i(o)("crud.crud.Please select the data model location of the data table"),key:"model-file"+JSON.stringify(e.remoteSelectPre.modelFileList),data:{content:e.remoteSelectPre.modelFileList},attr:{"block-help":i(o)("crud.crud.If it is left blank, the model of the associated table will be generated automatically If the table already has a model, it is recommended to select it to avoid repeated generation")}},null,8,["label","modelValue","placeholder","data","attr"]))])),[[O,e.loading.remoteSelect]])]),_:1},8,["model","rules"])),[[O,e.remoteSelectPre.loading]])],4)]),_:1},8,["model-value","title","onKeyup"]),d(de,{onClose:$,class:"ba-operate-dialog confirm-generate-dialog","model-value":e.confirmGenerate.show,title:i(o)("crud.crud.Confirm CRUD code generation")},{footer:s(()=>[u("div",Fl,[d(r,{onClick:$},{default:s(()=>[k(F(a.$t("Cancel")),1)]),_:1}),_((n(),b(r,{loading:e.loading.generate,onClick:le,type:"primary"},{default:s(()=>[k(F(i(o)("crud.crud.Continue building")),1)]),_:1},8,["loading"])),[[L]])])]),default:s(()=>[u("div",gl,[e.confirmGenerate.controller?(n(),b(ne,{key:0,title:i(o)("crud.crud.The controller already exists Continuing to generate will automatically overwrite the existing code!"),center:"",type:"error"},null,8,["title"])):C("",!0),yl,e.confirmGenerate.table?(n(),b(ne,{key:1,title:i(o)("crud.crud.The data table already exists Continuing to generate will automatically delete the original table and create a new one!"),center:"",type:"error"},null,8,["title"])):C("",!0)])]),_:1},8,["model-value","title"])])}}});const Ul=We(vl,[["__scopeId","data-v-3b0df174"]]);export{Ul as default};