import{d as ze,v as He,a2 as Oe,a as he,r as Fe,o as Je,aC as I,Z as U,D as ve,aH as Se,K as F,aq as re,e as s,f,i as u,j as n,L as c,u as i,t as h,m as k,y as g,C as P,am as N,F as v,B as V,ao as We,G as Ye,ae as B,N as $,n as Ce,ac as Qe,at as ke,as as Ze,p as Xe,l as el}from"./vue-A59npLRR.js";import{B as we}from"./index-K8IR974I.js";import{F as p}from"./index-r6iTpmP6.js";import{S as Ve}from"./baTable-MdxYOkAk.js";import{C as ll,Y as tl,aj as _e,_ as al}from"./index-EwE51S_X.js";import{f as R,s as C,d as Pe,t as T,g as ol,a as ie,b as rl,c as il,e as Ne,h as dl,p as nl,i as sl}from"./crud-4sem2PUY.js";import{b as E,a as cl}from"./validate-_EUdkMt3.js";import"./index-XALue448.js";import"./echarts-cxb9vJr1.js";const ml=M=>(Xe("data-v-0b8debdb"),M=M(),el(),M),ul={class:"default-main"},fl={class:"header-config-box"},pl={class:"header"},bl={class:"header-item-box"},gl={class:"header-right"},yl={key:0,class:"header-senior-config-box"},hl={class:"header-senior-config-form"},Fl={class:"default-sort-field-box"},vl=["onClick","data-id"],Sl={class:"design-field"},Cl={class:"design-field"},kl={class:"design-field-right"},wl={key:0,class:"design-field-empty"},Vl={class:"field-config ba-scroll-style"},_l={key:0,class:"design-field-empty"},Pl={class:"field-inline"},Nl={class:"field-inline"},Dl={class:"field-inline"},Tl={class:"block-help"},Ll={class:"confirm-generate-dialog-body"},Ul=ml(()=>u("br",null,null,-1)),xl={class:"confirm-generate-dialog-footer"},Il={class:"design-timeline-box"},Rl={class:"design-change-tips"},El={key:1,class:"design-change-tips"},Ml={class:"confirm-generate-dialog-footer"},Al=ze({__name:"design",setup(M){He(t=>({"50f1517f":e.error.tableName?"70px":"60px","01109e48":e.draggingField?"1px dashed var(--el-color-primary)":e.fields.length?"none":"1px dashed var(--el-border-color)"}));const{t:o}=Oe(),de=he(),q=he(),A=ll();let ne=1;const e=Fe({loading:{init:!1,generate:!1,remoteSelect:!1},table:{name:"",comment:"",quickSearchField:[],defaultSortField:"",formFields:[],columnFields:[],defaultSortType:"desc",generateRelativePath:"",isCommonModel:0,modelFile:"",controllerFile:"",validateFile:"",webViewsDir:"",designChange:[],rebuild:"No"},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},draggingField:!1,showDesignChangeLog:!1,error:{tableName:"",fieldName:null,fieldNameDuplication:null}}),De=t=>{e.activateField=t},Te=()=>{const t=I(e.fields[e.activateField]);for(const l in t.table)t.table[l]=t.table[l].value;for(const l in t.form)t.form[l]=t.form[l].value;e.fields[e.activateField]=K(t)},z=(t,l)=>{const r=e.fields[l].name;e.fields[l].name=t;for(const d in T)for(const b in e.table[T[d]])e.table[T[d]][b]==r&&(e.table[T[d]][b]=t);e.table.defaultSortField&&e.table.defaultSortField==r&&(e.table.defaultSortField=t),x({type:"change-field-name",index:e.activateField,oldName:r,newName:t}),H("ElMessage"),O("ElMessage")},H=t=>{e.error.fieldName&&(e.error.fieldName.close(),e.error.fieldName=null);for(const l in e.fields)if(!cl(e.fields[l].name)){let r=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:e.fields[l].name});return t=="ElMessage"?e.error.fieldName=ke({message:r,type:"error",duration:0}):U({type:"error",message:r}),!1}return!0},O=t=>{e.error.fieldNameDuplication&&(e.error.fieldNameDuplication.close(),e.error.fieldNameDuplication=null);for(const l in e.fields){let r=0;for(const d in e.fields)if(e.fields[l].name==e.fields[d].name&&r++,r>1){let b=o("crud.crud.Field name duplication",{field:e.fields[l].name});return t=="ElMessage"?e.error.fieldNameDuplication=ke({message:b,type:"error",duration:0}):U({type:"error",message:b}),!1}}return!0},_=()=>{x({type:"change-field-attr",index:e.activateField,oldName:e.fields[e.activateField].name,newName:""})},se=t=>{if(e.fields[t]){e.activateField=-1,e.fields[t].name==e.table.defaultSortField&&(e.table.defaultSortField=""),x({type:"del-field",oldName:e.fields[t].name,newName:""});for(const l in T){const r=e.table[T[l]].findIndex(d=>d==e.fields[t].name);r!=-1&&e.table[T[l]].splice(r,1)}e.fields.splice(t,1),H("ElMessage"),O("ElMessage")}},ce=(t,l=!1)=>{e.remoteSelectPre.show=!0,e.remoteSelectPre.loading=!0,e.remoteSelectPre.index=t,e.remoteSelectPre.hideDelField=l,ol().then(r=>{e.remoteSelectPre.dbList=r.data.dbs,e.fields[t]&&e.fields[t].form["remote-table"].value&&(e.remoteSelectPre.form.table=e.fields[t].form["remote-table"].value,e.remoteSelectPre.form.pk=e.fields[t].form["remote-pk"].value,e.remoteSelectPre.form.label=e.fields[t].form["remote-field"].value,e.remoteSelectPre.form.controllerFile=e.fields[t].form["remote-controller"].value,e.remoteSelectPre.form.modelFile=e.fields[t].form["remote-model"].value,e.remoteSelectPre.form.joinField=e.fields[t].form["relation-fields"].value.split(","),_e(e.fields[t].form["remote-table"].value).then(d=>{const b={};for(const S in d.data.fieldList)b[S]=(S?S+" - ":"")+d.data.fieldList[S];e.remoteSelectPre.fieldList=b}),($(e.remoteSelectPre.modelFileList)||$(e.remoteSelectPre.controllerFileList))&&ie(e.fields[t].form["remote-table"].value).then(d=>{e.remoteSelectPre.modelFileList=d.data.modelFileList,e.remoteSelectPre.controllerFileList=d.data.controllerFileList}))}).finally(()=>{e.remoteSelectPre.loading=!1})},Le=(t,l)=>{if(["remoteSelect","remoteSelects"].includes(l.designType))return ce(t)},J=()=>{e.confirmGenerate.show=!1},W=()=>{e.loading.generate=!0;const t=I(e.fields);for(const l in t){for(const r in t[l].table)t[l].table[r]=t[l].table[r].value;for(const r in t[l].form)t[l].form[r]=t[l].form[r].value}rl({type:C.type,table:e.table,fields:t}).then(()=>{setTimeout(()=>{U({type:"error",message:o("crud.crud.Vite hot warning")})},1e3)}).finally(()=>{e.loading.generate=!1,J()})},Ue=()=>{if(!H("ElNotification")||!O("ElNotification"))return;let t="";if(e.fields.findIndex(r=>r.primaryKey)===-1&&(t=o("crud.crud.Please design the primary key field!")),e.table.name||(t=o("crud.crud.Please enter the data table name!")),e.error.tableName&&(t=o("crud.crud.Please enter the correct table name!")),t){U({type:"error",message:t});return}e.loading.generate=!0,il({table:e.table.name,controllerFile:e.table.controllerFile}).then(()=>{W()}).catch(r=>{e.loading.generate=!1,r.code==-1?(e.confirmGenerate.table=r.data.table,e.confirmGenerate.controller=r.data.controller,me()||e.confirmGenerate.controller?e.confirmGenerate.show=!0:W()):U({type:"error",message:r.msg})})},me=()=>e.confirmGenerate.table&&(C.type=="create"||e.table.rebuild=="Yes"),xe=()=>{if(!e.table.name&&!e.table.comment&&!e.fields.length)return Ne("start");Ze.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(()=>{Ne("start")}).catch(()=>{})},K=t=>{const l=I(Pe[t.designType]);for(const r in t.form)l.form[r]&&(l.form[r].value=t.form[r]),r=="image-multi"&&t.form[r]&&(l.table.render=dl("render","images"));for(const r in t.table)l.table[r]&&(l.table[r].value=t.table[r]);return t.form=l.form,t.table=l.table,t},ue=t=>{if(_(),["enum","set"].includes(e.fields[e.activateField].type)){if(!t){e.fields[e.activateField].dataType=`${e.fields[e.activateField].type}()`;return}t=t.replaceAll(":",":"),t=t.replaceAll(",",",");let l=t.split(":");l[1]&&(l=l[1].split(","),l=l.map(r=>{if(!r)return"";let d=r.split("=");return d[0]&&d[1]?`'${d[0]}'`:""}).filter(r=>r!=""),e.fields[e.activateField].dataType=`${e.fields[e.activateField].type}(${l.join(",")})`)}},Ie=()=>{if(Y(),!!["db","sql","log"].includes(C.type)){if(e.loading.init=!0,C.type=="log"){nl(parseInt(C.startData.logId)).then(t=>{e.table=t.data.table,Y(),t.data.table.empty&&(e.table.rebuild="Yes"),e.table.isCommonModel=parseInt(t.data.table.isCommonModel);const l=t.data.fields;for(const r in l){const d=K(I(l[r]));e.fields.push(d)}}).finally(()=>{e.loading.init=!1});return}sl(C.type,C.startData.db,C.startData.sql).then(t=>{let l=[];for(const r in t.data.columns){const d=K(t.data.columns[r]);["id","update_time","create_time","updatetime","createtime"].includes(d.name)||e.table.formFields.push(d.name),["textarea","file","files","editor","password","array"].includes(d.designType)||e.table.columnFields.push(d.name),d.designType=="pk"&&(e.table.defaultSortField=d.name,e.table.quickSearchField.push(d.name)),d.designType=="weigh"&&(e.table.defaultSortField=d.name),l.push(d)}e.fields=l,e.table.comment=t.data.comment,t.data.empty&&(e.table.rebuild="Yes"),C.type=="db"&&C.startData.db&&(e.table.name=C.startData.db,G(C.startData.db))}).finally(()=>{e.loading.init=!1})}};Je(()=>{Ie();const t=Ve.create(de.value,{group:"design-field",animation:200,filter:".design-field-empty",onAdd:l=>{var b,S;const r=(S=(b=l.originalEvent)==null?void 0:b.dataTransfer)==null?void 0:S.getData("name"),d=R[r];if(d&&d[l.oldIndex]){const y=K(I(d[l.oldIndex]));if(y.primaryKey==!0){if(e.fields.find(X=>X.primaryKey))return U({type:"error",message:o("crud.crud.There can only be one primary key field")}),l.item.remove();e.table.defaultSortField=y.name,e.table.quickSearchField.push(y.name)}y.designType=="weigh"&&(e.table.defaultSortField=y.name),tl(e.fields,"name",y.name)&&(y.name=y.name+ne,ne++),e.fields.splice(l.newIndex,0,y),x({type:"add-field",index:l.newIndex,newName:y.name,oldName:"",after:l.newIndex===0?"FIRST FIELD":e.fields[l.newIndex-1].name}),["remoteSelect","remoteSelects"].includes(y.designType)&&ce(l.newIndex,!0),y.formBuildExclude||e.table.formFields.push(y.name),y.tableBuildExclude||e.table.columnFields.push(y.name)}l.item.remove(),ve(()=>{t.sort(Se(e.fields.length).map(y=>y.toString()))})},onEnd:l=>{const r=e.fields[l.oldIndex];e.fields.splice(l.oldIndex,1),e.fields.splice(l.newIndex,0,r),x({type:"change-field-order",index:l.newIndex,newName:"",oldName:r.name,after:l.newIndex===0?"FIRST FIELD":e.fields[l.newIndex-1].name}),ve(()=>{t.sort(Se(e.fields.length).map(d=>d.toString()))})}});A.value.forEach((l,r)=>{Ve.create(l,{sort:!1,group:{name:"design-field",pull:"clone",put:!1},animation:200,setData:d=>{d.setData("name",Object.keys(R)[r])},onStart:()=>{e.draggingField=!0},onEnd:()=>{e.draggingField=!1}})})});const Re=t=>{if(!t)return e.error.tableName="";/^[a-z_][a-z0-9_]*$/.test(t)?(e.error.tableName="",G(t)):e.error.tableName=o("crud.crud.Use lower case underlined for table names"),Y()},Y=()=>{e.table.rebuild="No",e.table.designChange=[]},G=t=>{t&&ie(t,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=t.replaceAll("/","\\")})},Ee=()=>{G(e.table.generateRelativePath)},Me=t=>{t&&(Q(),e.remoteSelectPre.form.table=t,e.loading.remoteSelect=!0,_e(t).then(l=>{e.remoteSelectPre.form.pk=l.data.pk;const r=["name","title","username","nickname"];for(const b in l.data.fieldList)if(r.includes(b)){e.remoteSelectPre.form.label=b,e.remoteSelectPre.form.joinField.push(b);break}const d={};for(const b in l.data.fieldList)d[b]=(b?b+" - ":"")+l.data.fieldList[b];e.remoteSelectPre.fieldList=d}).finally(()=>{e.loading.remoteSelect=!1}),ie(t).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)}))},fe=()=>{const t=()=>{if(e.fields[e.remoteSelectPre.index].name=="remote_select"){const l=e.remoteSelectPre.form.table+(e.fields[e.remoteSelectPre.index].designType=="remoteSelect"?"_id":"_ids");z(l,e.remoteSelectPre.index)}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.fields[e.remoteSelectPre.index].designType=="remoteSelect"?e.remoteSelectPre.form.joinField.join(","):e.remoteSelectPre.form.label,e.remoteSelectPre.index=-1,e.remoteSelectPre.show=!1,Q()};q.value&&q.value.validate(l=>{l&&t()})},pe=()=>{e.remoteSelectPre.show=!1,Q(),e.remoteSelectPre.index!==-1&&e.remoteSelectPre.hideDelField&&se(e.remoteSelectPre.index)},Q=()=>{for(const t in e.remoteSelectPre.form)t=="joinField"?e.remoteSelectPre.form[t]=[]:e.remoteSelectPre.form[t]=""},Ae=Fe({table:[E({name:"required",title:o("crud.crud.remote-table")})],pk:[E({name:"required",title:o("crud.crud.Drop down value field")})],label:[E({name:"required",title:o("crud.crud.Drop down label field")})],joinField:[E({name:"required",title:o("crud.crud.Fields displayed in the table")})],controllerFile:[E({name:"required",title:o("crud.crud.Controller position")})]}),x=t=>{if(C.type=="create")return;let l=!0;if(t.type=="change-field-name"){for(const r in e.table.designChange)e.table.designChange[r].type=="change-field-attr"&&t.oldName==e.table.designChange[r].oldName&&(e.table.designChange[r].oldName=t.newName),e.table.designChange[r].type=="change-field-order"&&t.oldName==e.table.designChange[r].oldName&&(e.table.designChange[r].oldName=t.newName),e.table.designChange[r].after==t.oldName&&(e.table.designChange[r].after=t.newName);for(const r in e.table.designChange){if(e.table.designChange[r].type=="add-field"&&e.table.designChange[r].newName==t.oldName){e.table.designChange[r].newName=t.newName,l=!1;break}if(e.table.designChange[r].type=="change-field-name"&&e.table.designChange[r].newName==t.oldName){t.oldName=e.table.designChange[r].oldName,e.table.designChange[r]=t,e.table.designChange[r].newName==e.table.designChange[r].oldName&&e.table.designChange.splice(r,1),l=!1;break}}}else if(t.type=="del-field"){let r=!1;e.table.designChange=e.table.designChange.filter(d=>{r=d.type=="add-field"&&d.newName==t.oldName;const b=d.type=="change-field-name"&&d.newName==t.oldName,S=d.type=="change-field-attr"&&d.oldName==t.oldName,y=d.type=="change-field-order"&&d.oldName==t.oldName;return b&&(t.oldName=d.oldName),!r&&!b&&!S&&!y}),r&&(l=!1);for(const d in e.table.designChange)if(e.table.designChange[d].type=="del-field"&&e.table.designChange[d].oldName==t.oldName){l=!1;break}}else if(t.type=="change-field-attr")for(const r in e.table.designChange){if(e.table.designChange[r].type=="change-field-attr"&&e.table.designChange[r].oldName==t.oldName){l=!1;break}if(e.table.designChange[r].type=="add-field"&&e.table.designChange[r].newName==t.oldName){l=!1;break}}else if(t.type=="change-field-order")for(const r in e.table.designChange){if(e.table.designChange[r].type=="add-field"&&e.table.designChange[r].newName==t.oldName){e.table.designChange[r].after=t.after,l=!1;break}if(e.table.designChange[r].type=="change-field-order"&&e.table.designChange[r].oldName==t.oldName){e.table.designChange[r]=t,l=!1;break}}t.sync=!0,l&&e.table.designChange.push(t)},Ke=t=>{switch(t.type){case"add-field":return o("crud.crud.Add field")+" "+t.newName;case"change-field-attr":return o("crud.crud.Modify field properties")+" "+t.oldName;case"change-field-name":return o("crud.crud.Modify field name")+" "+t.oldName+" => "+t.newName;case"del-field":return o("crud.crud.Delete field")+" "+t.oldName;case"change-field-order":return o("crud.crud.Modify field order")+" "+t.oldName+" => "+(t.after=="FIRST FIELD"?o("crud.crud.First field"):t.after+" "+o("crud.crud.After"));default:return o("Unknown")}},Ge=t=>{let l="";switch(t){case"change-field-name":l="warning";break;case"del-field":l="danger";break;case"add-field":l="primary";break;case"change-field-attr":l="success";break;case"change-field-order":l="info";break;default:l="success";break}return l};return(t,l)=>{const r=F("el-link"),d=F("el-button"),b=F("el-row"),S=F("el-option"),y=F("el-select"),D=F("el-form-item"),Z=F("el-checkbox"),X=F("el-input"),ee=F("Icon"),le=F("el-collapse-item"),je=F("el-collapse"),te=F("el-col"),j=F("el-divider"),be=F("el-form"),ge=F("el-scrollbar"),ae=F("el-dialog"),ye=F("el-alert"),Be=F("el-timeline-item"),$e=F("el-timeline"),L=re("blur"),oe=re("loading"),qe=re("drag");return s(),f("div",ul,[u("div",fl,[n(b,{class:"header-box"},{default:c(()=>[u("div",pl,[u("div",bl,[n(p,{class:"mr-20 table-name-item",label:i(o)("crud.log.table_name"),modelValue:e.table.name,"onUpdate:modelValue":l[0]||(l[0]=a=>e.table.name=a),type:"string",placeholder:i(o)("crud.crud.Name of the data table"),"input-attr":{onChange:Re},error:e.error.tableName},null,8,["label","modelValue","placeholder","input-attr","error"]),n(p,{class:"table-comment-item",label:i(o)("crud.crud.Data Table Notes"),modelValue:e.table.comment,"onUpdate:modelValue":l[1]||(l[1]=a=>e.table.comment=a),type:"string",placeholder:i(o)("crud.crud.For example: `user table` will be generated into `user management`")},null,8,["label","modelValue","placeholder"])]),u("div",gl,[i(C).type!="create"?(s(),g(r,{key:0,onClick:l[2]||(l[2]=a=>e.showDesignChangeLog=!0),class:"design-change-log",type:"primary"},{default:c(()=>[k(h(i(o)("crud.crud.Table design change")),1)]),_:1})):P("",!0),N((s(),g(d,{type:"primary",loading:e.loading.generate,onClick:Ue},{default:c(()=>[k(h(i(o)("crud.crud.Generate CRUD code")),1)]),_:1},8,["loading"])),[[L]]),N((s(),g(d,{onClick:xe,type:"danger"},{default:c(()=>[k(h(i(o)("crud.crud.give up")),1)]),_:1})),[[L]])])])]),_:1}),n(We,{name:e.showHeaderSeniorConfig?"el-zoom-in-top":"el-zoom-in-bottom"},{default:c(()=>[e.showHeaderSeniorConfig?(s(),f("div",yl,[u("div",hl,[n(D,{"label-width":140,label:i(o)("crud.crud.Table Quick Search Fields")},{default:c(()=>[n(y,{clearable:!0,multiple:!0,class:"w100",modelValue:e.table.quickSearchField,"onUpdate:modelValue":l[3]||(l[3]=a=>e.table.quickSearchField=a),placement:"bottom"},{default:c(()=>[(s(!0),f(v,null,V(e.fields,(a,m)=>(s(),g(S,{key:m,label:a.name+(a.comment?"-"+a.comment:a.title),value:a.name},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"]),u("div",Fl,[n(D,{"label-width":140,class:"default-sort-field",label:i(o)("crud.crud.Table Default Sort Fields")},{default:c(()=>[n(y,{clearable:!0,modelValue:e.table.defaultSortField,"onUpdate:modelValue":l[4]||(l[4]=a=>e.table.defaultSortField=a),placement:"bottom"},{default:c(()=>[(s(!0),f(v,null,V(e.fields,(a,m)=>(s(),g(S,{key:m,label:a.name+(a.comment?"-"+a.comment:a.title),value:a.name},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"]),n(p,{class:"default-sort-field-type",label:i(o)("crud.crud.sort order"),modelValue:e.table.defaultSortType,"onUpdate:modelValue":l[5]||(l[5]=a=>e.table.defaultSortType=a),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"])]),n(D,{"label-width":140,label:i(o)("crud.crud.Fields as Table Columns")},{default:c(()=>[n(y,{clearable:!0,multiple:!0,class:"w100",modelValue:e.table.columnFields,"onUpdate:modelValue":l[6]||(l[6]=a=>e.table.columnFields=a),placement:"bottom"},{default:c(()=>[(s(!0),f(v,null,V(e.fields,(a,m)=>(s(),g(S,{key:m,label:a.name+(a.comment?"-"+a.comment:a.title),value:a.name},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"]),n(D,{"label-width":140,label:i(o)("crud.crud.Fields as form items")},{default:c(()=>[n(y,{clearable:!0,multiple:!0,class:"w100",modelValue:e.table.formFields,"onUpdate:modelValue":l[7]||(l[7]=a=>e.table.formFields=a),placement:"bottom"},{default:c(()=>[(s(!0),f(v,null,V(e.fields,(a,m)=>(s(),g(S,{key:m,label:a.name+(a.comment?"-"+a.comment:a.title),value:a.name},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"]),n(p,{label:i(o)("crud.crud.The relative path to the generated code"),modelValue:e.table.generateRelativePath,"onUpdate:modelValue":l[8]||(l[8]=a=>e.table.generateRelativePath=a),type:"string",attr:{labelWidth:140,blockHelp: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"]),n(p,{label:i(o)("crud.crud.Generated Controller Location"),modelValue:e.table.controllerFile,"onUpdate:modelValue":l[9]||(l[9]=a=>e.table.controllerFile=a),type:"string",attr:{labelWidth:140}},null,8,["label","modelValue"]),n(D,{label:i(o)("crud.crud.Generated Data Model Location"),"label-width":140},{default:c(()=>[n(X,{modelValue:e.table.modelFile,"onUpdate:modelValue":l[11]||(l[11]=a=>e.table.modelFile=a),type:"string"},{append:c(()=>[n(Z,{onChange:Ee,modelValue:e.table.isCommonModel,"onUpdate:modelValue":l[10]||(l[10]=a=>e.table.isCommonModel=a),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"]),n(p,{label:i(o)("crud.crud.Generated Validator Location"),modelValue:e.table.validateFile,"onUpdate:modelValue":l[12]||(l[12]=a=>e.table.validateFile=a),type:"string",attr:{labelWidth:140}},null,8,["label","modelValue"]),n(p,{label:i(o)("crud.crud.WEB end view directory"),modelValue:e.table.webViewsDir,"onUpdate:modelValue":l[13]||(l[13]=a=>e.table.webViewsDir=a),type:"string",attr:{labelWidth:140}},null,8,["label","modelValue"])])])):P("",!0)]),_:1},8,["name"]),u("div",{onClick:l[14]||(l[14]=a=>e.showHeaderSeniorConfig=!e.showHeaderSeniorConfig),class:"header-senior-config"},[u("span",null,h(i(o)("crud.crud.Advanced Configuration")),1),n(ee,{class:"senior-config-arrow-icon",size:"14",color:"var(--el-text-color-primary)",name:e.showHeaderSeniorConfig?"el-icon-ArrowUp":"el-icon-ArrowDown"},null,8,["name"])])]),N((s(),g(b,{class:"fields-box",gutter:20},{default:c(()=>[n(te,{xs:24,span:6},{default:c(()=>[n(je,{class:"field-collapse",modelValue:e.fieldCollapseName,"onUpdate:modelValue":l[15]||(l[15]=a=>e.fieldCollapseName=a)},{default:c(()=>[n(le,{title:i(o)("crud.crud.Common Fields"),name:"common"},{default:c(()=>[u("div",{class:"field-box",ref:i(A).set},[(s(!0),f(v,null,V(i(R).common,(a,m)=>(s(),f("div",{key:m,class:"field-item"},[u("span",null,h(a.title),1)]))),128))],512)]),_:1},8,["title"]),n(le,{title:i(o)("crud.crud.Base Fields"),name:"base"},{default:c(()=>[u("div",{class:"field-box",ref:i(A).set},[(s(!0),f(v,null,V(i(R).base,(a,m)=>(s(),f("div",{key:m,class:"field-item"},[u("span",null,h(a.title),1)]))),128))],512)]),_:1},8,["title"]),n(le,{title:i(o)("crud.crud.Advanced Fields"),name:"senior"},{default:c(()=>[u("div",{class:"field-box",ref:i(A).set},[(s(!0),f(v,null,V(i(R).senior,(a,m)=>(s(),f("div",{key:m,class:"field-item"},[u("span",null,h(a.title),1)]))),128))],512)]),_:1},8,["title"])]),_:1},8,["modelValue"])]),_:1}),n(te,{xs:24,span:12},{default:c(()=>[u("div",{ref_key:"designWindowRef",ref:de,class:"design-window ba-scroll-style"},[(s(!0),f(v,null,V(e.fields,(a,m)=>(s(),f("div",{key:m,class:Ye([m===e.activateField?"activate":"","design-field-box"]),onClick:w=>De(m),"data-id":m},[u("div",Sl,[u("span",null,h(i(o)("crud.crud.Field Name"))+":",1),n(we,{onPointerdown:l[16]||(l[16]=B(()=>{},["stop"])),class:"design-field-name-input","model-value":a.name,type:"string",attr:{size:"small",onInput:w=>z(w,m)}},null,8,["model-value","attr"])]),u("div",Cl,[u("span",null,h(i(o)("crud.crud.field comment"))+":",1),n(we,{onPointerdown:l[17]||(l[17]=B(()=>{},["stop"])),class:"design-field-name-comment",modelValue:a.comment,"onUpdate:modelValue":w=>a.comment=w,type:"string",attr:{size:"small",onChange:ue}},null,8,["modelValue","onUpdate:modelValue","attr"])]),u("div",kl,[["remoteSelect","remoteSelects"].includes(a.designType)?N((s(),g(d,{key:0,onClick:B(w=>Le(m,a),["stop"]),type:"primary",size:"small",circle:""},{default:c(()=>[n(ee,{color:"var(--el-color-white)",size:"15",name:"fa fa-pencil icon"})]),_:2},1032,["onClick"])),[[L]]):P("",!0),N((s(),g(d,{onClick:B(w=>se(m),["stop"]),type:"danger",size:"small",circle:""},{default:c(()=>[n(ee,{color:"var(--el-color-white)",size:"15",name:"fa fa-trash"})]),_:2},1032,["onClick"])),[[L]])])],10,vl))),128)),!e.fields.length&&!e.draggingField?(s(),f("div",wl,h(i(o)("crud.crud.Drag the left element here to start designing CRUD")),1)):P("",!0)],512)]),_:1}),n(te,{xs:24,span:6},{default:c(()=>[u("div",Vl,[e.activateField===-1?(s(),f("div",_l,h(i(o)("crud.crud.Please select a field from the left first")),1)):(s(),f("div",{key:"activate-field-"+e.activateField},[n(be,{"label-position":"top"},{default:c(()=>[n(j,{"content-position":"left"},{default:c(()=>[k(h(i(o)("crud.crud.Common")),1)]),_:1}),n(D,{label:i(o)("crud.crud.generate")},{default:c(()=>[n(y,{onChange:Te,class:"w100",modelValue:e.fields[e.activateField].designType,"onUpdate:modelValue":l[18]||(l[18]=a=>e.fields[e.activateField].designType=a),placement:"bottom"},{default:c(()=>[(s(!0),f(v,null,V(i(Pe),(a,m)=>(s(),g(S,{key:m,label:a.name,value:m},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"]),n(p,{label:i(o)("crud.crud.Field comments (CRUD dictionary)"),type:"textarea","input-attr":{rows:2,onChange:ue},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[19]||(l[19]=a=>e.fields[e.activateField].comment=a)},null,8,["label","input-attr","placeholder","modelValue"]),n(j,{"content-position":"left"},{default:c(()=>[k(h(i(o)("crud.crud.Field Properties")),1)]),_:1}),n(p,{label:i(o)("crud.crud.Field Name"),type:"string","model-value":e.fields[e.activateField].name,"input-attr":{onInput:a=>z(a,e.activateField)}},null,8,["label","model-value","input-attr"]),e.fields[e.activateField].dataType?(s(),g(p,{key:0,label:i(o)("crud.crud.Field Type"),"input-attr":{onChange:_},type:"textarea",modelValue:e.fields[e.activateField].dataType,"onUpdate:modelValue":l[20]||(l[20]=a=>e.fields[e.activateField].dataType=a)},null,8,["label","input-attr","modelValue"])):(s(),f(v,{key:1},[n(p,{label:i(o)("crud.crud.Field Type"),"input-attr":{onChange:_},type:"string",modelValue:e.fields[e.activateField].type,"onUpdate:modelValue":l[21]||(l[21]=a=>e.fields[e.activateField].type=a)},null,8,["label","input-attr","modelValue"]),u("div",Pl,[n(p,{label:i(o)("crud.crud.length"),type:"number",modelValue:e.fields[e.activateField].length,"onUpdate:modelValue":l[22]||(l[22]=a=>e.fields[e.activateField].length=a),modelModifiers:{number:!0},"input-attr":{onChange:_}},null,8,["label","modelValue","input-attr"]),n(p,{label:i(o)("crud.crud.decimal point"),type:"number",modelValue:e.fields[e.activateField].precision,"onUpdate:modelValue":l[23]||(l[23]=a=>e.fields[e.activateField].precision=a),modelModifiers:{number:!0},"input-attr":{onChange:_}},null,8,["label","modelValue","input-attr"])])],64)),n(p,{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]=a=>e.fields[e.activateField].default=a),"input-attr":{onChange:_}},null,8,["label","placeholder","modelValue","input-attr"]),u("div",Nl,[n(p,{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]=a=>e.fields[e.activateField].primaryKey=a),"input-attr":{onChange:_}},null,8,["label","modelValue","input-attr"]),n(p,{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]=a=>e.fields[e.activateField].autoIncrement=a),"input-attr":{onChange:_}},null,8,["label","modelValue","input-attr"])]),u("div",Dl,[n(p,{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]=a=>e.fields[e.activateField].unsigned=a),"input-attr":{onChange:_}},null,8,["label","modelValue","input-attr"]),n(p,{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]=a=>e.fields[e.activateField].null=a),"input-attr":{onChange:_}},null,8,["label","modelValue","input-attr"])]),i($)(e.fields[e.activateField].table)?P("",!0):(s(),f(v,{key:2},[n(j,{"content-position":"left"},{default:c(()=>[k(h(i(o)("crud.crud.Field Table Properties")),1)]),_:1}),(s(!0),f(v,null,V(e.fields[e.activateField].table,(a,m)=>(s(),g(p,{key:m,label:t.$t("crud.crud."+m),type:a.type,modelValue:e.fields[e.activateField].table[m].value,"onUpdate:modelValue":w=>e.fields[e.activateField].table[m].value=w,placeholder:e.fields[e.activateField].table[m].placeholder??"",data:{content:e.fields[e.activateField].table[m].options??{}},"input-attr":e.fields[e.activateField].table[m].attr??{}},null,8,["label","type","modelValue","onUpdate:modelValue","placeholder","data","input-attr"]))),128))],64)),i($)(e.fields[e.activateField].form)?P("",!0):(s(),f(v,{key:3},[n(j,{"content-position":"left"},{default:c(()=>[k(h(i(o)("crud.crud.Field Form Properties")),1)]),_:1}),(s(!0),f(v,null,V(e.fields[e.activateField].form,(a,m)=>(s(),g(p,{key:m,label:t.$t("crud.crud."+m),type:a.type,modelValue:e.fields[e.activateField].form[m].value,"onUpdate:modelValue":w=>e.fields[e.activateField].form[m].value=w,placeholder:e.fields[e.activateField].form[m].placeholder??"",data:{content:e.fields[e.activateField].form[m].options??{}},"input-attr":e.fields[e.activateField].form[m].attr??{}},null,8,["label","type","modelValue","onUpdate:modelValue","placeholder","data","input-attr"]))),128))],64))]),_:1})]))])]),_:1})]),_:1})),[[oe,e.loading.init]]),n(ae,{onClose:pe,class:"ba-operate-dialog","model-value":e.remoteSelectPre.show,title:i(o)("crud.crud.Remote drop-down association information"),"close-on-click-modal":!1,"destroy-on-close":!0,onKeyup:Qe(fe,["enter"])},{footer:c(()=>[u("div",{style:Ce("width: calc(100% - 88px)")},[n(d,{onClick:pe},{default:c(()=>[k(h(t.$t("Cancel")),1)]),_:1}),N((s(),g(d,{onClick:fe,type:"primary"},{default:c(()=>[k(h(t.$t("Save")),1)]),_:1})),[[L]])],4)]),default:c(()=>[n(ge,{"max-height":"60vh"},{default:c(()=>[u("div",{class:"ba-operate-form",style:Ce("width: calc(100% - 80px)")},[e.remoteSelectPre.index!=-1&&e.fields[e.remoteSelectPre.index]?N((s(),g(be,{key:0,ref_key:"formRef",ref:q,model:e.remoteSelectPre.form,rules:Ae,"label-position":"right","label-width":"160px"},{default:c(()=>[(s(),g(p,{prop:"table",type:"select",label:i(o)("crud.crud.Associated Data Table"),modelValue:e.remoteSelectPre.form.table,"onUpdate:modelValue":l[29]||(l[29]=a=>e.remoteSelectPre.form.table=a),key:JSON.stringify(e.remoteSelectPre.dbList),data:{content:e.remoteSelectPre.dbList},"input-attr":{onChange:Me}},null,8,["label","modelValue","data","input-attr"])),N((s(),f("div",null,[(s(),g(p,{prop:"pk",type:"select",label:i(o)("crud.crud.Drop down value field"),modelValue:e.remoteSelectPre.form.pk,"onUpdate:modelValue":l[30]||(l[30]=a=>e.remoteSelectPre.form.pk=a),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"])),(s(),g(p,{prop:"label",type:"select",label:i(o)("crud.crud.Drop down label field"),modelValue:e.remoteSelectPre.form.label,"onUpdate:modelValue":l[31]||(l[31]=a=>e.remoteSelectPre.form.label=a),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"])),e.fields[e.remoteSelectPre.index].designType=="remoteSelect"?(s(),g(p,{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]=a=>e.remoteSelectPre.form.joinField=a),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"])):P("",!0),(s(),g(p,{prop:"controllerFile",type:"select",label:i(o)("crud.crud.Controller position"),modelValue:e.remoteSelectPre.form.controllerFile,"onUpdate:modelValue":l[33]||(l[33]=a=>e.remoteSelectPre.form.controllerFile=a),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:{blockHelp: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"])),(s(),g(p,{type:"select",label:i(o)("crud.crud.Data Model Location"),modelValue:e.remoteSelectPre.form.modelFile,"onUpdate:modelValue":l[34]||(l[34]=a=>e.remoteSelectPre.form.modelFile=a),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:{blockHelp: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"])),n(D,{label:i(o)("Reminder")},{default:c(()=>[u("div",Tl,h(i(o)("crud.crud.Design remote select tips")),1)]),_:1},8,["label"])])),[[oe,e.loading.remoteSelect]])]),_:1},8,["model","rules"])),[[oe,e.remoteSelectPre.loading]]):P("",!0)],4)]),_:1})]),_:1},8,["model-value","title"]),n(ae,{onClose:J,class:"ba-operate-dialog confirm-generate-dialog","model-value":e.confirmGenerate.show,title:i(o)("crud.crud.Confirm CRUD code generation")},{footer:c(()=>[u("div",xl,[n(d,{onClick:J},{default:c(()=>[k(h(t.$t("Cancel")),1)]),_:1}),N((s(),g(d,{loading:e.loading.generate,onClick:W,type:"primary"},{default:c(()=>[k(h(i(o)("crud.crud.Continue building")),1)]),_:1},8,["loading"])),[[L]])])]),default:c(()=>[u("div",Ll,[e.confirmGenerate.controller?(s(),g(ye,{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"])):P("",!0),Ul,me()?(s(),g(ye,{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"])):P("",!0)])]),_:1},8,["model-value","title"]),n(ae,{class:"ba-operate-dialog design-change-log-dialog",width:"20%",modelValue:e.showDesignChangeLog,"onUpdate:modelValue":l[37]||(l[37]=a=>e.showDesignChangeLog=a)},{header:c(()=>[N((s(),f("div",null,[k(h(i(o)("crud.crud.Data table design changes preview")),1)])),[[qe,[".design-change-log-dialog",".el-dialog__header"]]])]),footer:c(()=>[u("div",Ml,[n(d,{onClick:l[36]||(l[36]=a=>e.showDesignChangeLog=!1)},{default:c(()=>[k(h(i(o)("Confirm")),1)]),_:1})])]),default:c(()=>[n(ge,{"max-height":"400px"},{default:c(()=>[e.table.designChange.length?(s(),f(v,{key:0},[n($e,{class:"design-change-log-timeline"},{default:c(()=>[(s(!0),f(v,null,V(e.table.designChange,(a,m)=>(s(),g(Be,{key:m,type:Ge(a.type),hollow:!0,"hide-timestamp":!0},{default:c(()=>[u("div",Il,[n(Z,{modelValue:a.sync,"onUpdate:modelValue":w=>a.sync=w,label:Ke(a),size:"small"},null,8,["modelValue","onUpdate:modelValue","label"])])]),_:2},1032,["type"]))),128))]),_:1}),u("span",Rl,h(i(o)("crud.crud.designChangeTips")),1)],64)):(s(),f("div",El,"暂无表设计变更")),n(p,{label:i(o)("crud.crud.tableReBuild"),class:"rebuild-form-item",modelValue:e.table.rebuild,"onUpdate:modelValue":l[35]||(l[35]=a=>e.table.rebuild=a),type:"radio",data:{content:{No:i(o)("crud.crud.No"),Yes:i(o)("crud.crud.Yes")},childrenAttr:{border:!0}},attr:{blockHelp:i(o)("crud.crud.tableReBuildBlockHelp")}},null,8,["label","modelValue","data","attr"])]),_:1})]),_:1},8,["modelValue"])])}}}),Jl=al(Al,[["__scopeId","data-v-0b8debdb"]]);export{Jl as default};