start-gweKduLA.js 6.2 KB

1
  1. import{d as j,a2 as M,a as V,r as L,K as m,aq as Q,e as p,f as R,i as r,t as a,u as e,j as i,L as d,m as c,y as f,C as b,n as z,am as q,ac as k,ae as $,F as E,Z as H,p as J,l as O}from"./vue-A59npLRR.js";import{e as w,s as n,g as Y,j as Z}from"./crud-4sem2PUY.js";import{F as A}from"./index-r6iTpmP6.js";import{b as G}from"./validate-_EUdkMt3.js";import{_ as W}from"./log.vue_vue_type_style_index_0_lang-8Klqdj30.js";import{_ as X}from"./index-EwE51S_X.js";import"./index-K8IR974I.js";import"./baTable-MdxYOkAk.js";import"./index-XALue448.js";import"./echarts-cxb9vJr1.js";const ee=_=>(J("data-v-956e4104"),_=_(),O(),_),te={class:"default-main"},se={class:"crud-title"},ae={class:"start-opt"},re={class:"start-item-title"},oe={class:"start-item-remark"},le={class:"start-item suspension"},de={class:"start-item-title"},ce={class:"start-item-remark"},ie={class:"start-item suspension"},ne={class:"start-item-title"},ue={class:"start-item-remark"},pe={target:"_blank",href:"https://wonderful-code.gitee.io/guide/other/developerMustSee.html",rel:"noopener noreferrer"},me=ee(()=>r("code",null,"test_build",-1)),fe={target:"_blank",href:"https://wonderful-code.gitee.io/guide/other/developerMustSee.html",rel:"noopener noreferrer"},_e=j({__name:"start",setup(_){const{t}=M(),x=V(),v=V(),o=L({dialog:{type:"",visible:!1,dbList:[]},showLog:!1,loading:!1,successRecord:0}),I=u=>{o.dialog.type=u,o.dialog.visible=!0,u=="sql"?setTimeout(()=>{x.value.focus()},200):u=="db"&&(o.successRecord=0,n.startData.db="",Y().then(s=>{o.dialog.dbList=s.data.dbs}))},N=L({db:[G({name:"required",message:t("crud.crud.Please select a data table")})]}),h=()=>{if(v.value){if(o.dialog.type=="sql"&&!n.startData.sql){H({type:"error",message:t("crud.crud.Please enter the table creation SQL")});return}v.value.validate(u=>{u&&w(o.dialog.type)})}},U=()=>{n.startData.db&&(o.loading=!0,Z(n.startData.db).then(u=>{o.successRecord=u.data.id}).finally(()=>{o.loading=!1}))},F=()=>{o.successRecord&&(n.startData.logId=o.successRecord.toString(),w("log"))},P=()=>!1;return(u,s)=>{const g=m("el-col"),D=m("el-row"),S=m("el-alert"),B=m("el-input"),K=m("el-form"),y=m("el-button"),T=m("el-dialog"),C=Q("blur");return p(),R("div",te,[r("div",se,a(e(t)("crud.crud.start")),1),r("div",ae,[i(D,{gutter:20},{default:d(()=>[i(g,{xs:24,span:8},{default:d(()=>[r("div",{onClick:s[0]||(s[0]=l=>e(w)("create")),class:"start-item suspension"},[r("div",re,a(e(t)("crud.crud.create")),1),r("div",oe,a(e(t)("crud.crud.New background CRUD from zero")),1)])]),_:1}),i(g,{onClick:s[1]||(s[1]=l=>I("db")),xs:24,span:8},{default:d(()=>[r("div",le,[r("div",de,a(e(t)("crud.crud.Select Data Table")),1),r("div",ce,a(e(t)("crud.crud.Select a designed data table from the database")),1)])]),_:1}),i(g,{onClick:s[2]||(s[2]=l=>o.showLog=!0),xs:24,span:8},{default:d(()=>[r("div",ie,[r("div",ne,a(e(t)("crud.crud.CRUD record")),1),r("div",ue,a(e(t)("crud.crud.Start with previously generated CRUD code")),1)])]),_:1})]),_:1}),i(D,{justify:"center"},{default:d(()=>[i(g,{span:20,class:"ba-markdown crud-tips suspension"},{default:d(()=>[r("b",null,a(e(t)("crud.crud.Fast experience")),1),r("ol",null,[r("li",null,[c(a(e(t)("crud.crud.experience 1 1"))+" ",1),r("a",pe,a(e(t)("crud.crud.experience 1 2")),1),c(" "+a(e(t)("crud.crud.experience 1 3")),1)]),r("li",null,[c(a(e(t)("crud.crud.experience 2 1"))+" ",1),r("code",null,a(e(t)("crud.crud.experience 2 2")),1),c(" "+a(e(t)("crud.crud.experience 2 3")),1),me,c(a(e(t)("crud.crud.data sheet")),1)]),r("li",null,[c(a(e(t)("crud.crud.experience 3 1")),1),r("code",null,a(e(t)("crud.crud.experience 3 2")),1),c(" "+a(e(t)("crud.crud.experience 3 3"))+" ",1),r("code",null,a(e(t)("crud.crud.experience 3 4")),1)])]),P()?b("",!0):(p(),f(S,{key:0,class:"no-dev",type:"warning","show-icon":!0,closable:!1},{title:d(()=>[r("span",null,a(e(t)("crud.crud.experience 4 1")),1),r("a",fe,a(e(t)("crud.crud.experience 4 2")),1),r("span",null,[c(a(e(t)("crud.crud.experience 4 3")),1),r("code",null,a(e(t)("crud.crud.experience 4 4")),1)])]),_:1}))]),_:1})]),_:1}),i(T,{class:"ba-operate-dialog select-db-dialog",modelValue:o.dialog.visible,"onUpdate:modelValue":s[10]||(s[10]=l=>o.dialog.visible=l),title:o.dialog.type=="sql"?e(t)("crud.crud.Please enter SQL"):e(t)("crud.crud.Please select a data table"),"destroy-on-close":!0},{footer:d(()=>[r("div",{style:z({width:"calc(100% * 0.9)"})},[i(y,{onClick:s[8]||(s[8]=l=>o.dialog.visible=!1)},{default:d(()=>[c(a(u.$t("Cancel")),1)]),_:1}),q((p(),f(y,{loading:o.loading,onClick:s[9]||(s[9]=l=>h()),type:"primary"},{default:d(()=>[c(a(e(t)("Confirm")),1)]),_:1},8,["loading"])),[[C]]),o.successRecord?q((p(),f(y,{key:0,onClick:F,type:"success"},{default:d(()=>[c(a(e(t)("crud.crud.Start with the historical record")),1)]),_:1})),[[C]]):b("",!0)],4)]),default:d(()=>[i(K,{"label-width":140,onKeyup:s[7]||(s[7]=k(l=>h(),["enter"])),class:"select-db-form",ref_key:"formRef",ref:v,model:e(n).startData,rules:N},{default:d(()=>[o.dialog.type=="sql"?(p(),f(B,{key:0,class:"sql-input",prop:"sql",ref_key:"sqlInputRef",ref:x,modelValue:e(n).startData.sql,"onUpdate:modelValue":s[3]||(s[3]=l=>e(n).startData.sql=l),type:"textarea",placeholder:e(t)("crud.crud.table create SQL"),rows:10,onKeyup:[s[4]||(s[4]=k($(()=>{},["stop"]),["enter"])),s[5]||(s[5]=k($(l=>h(),["ctrl"]),["enter"]))]},null,8,["modelValue","placeholder"])):o.dialog.type=="db"?(p(),R(E,{key:1},[(p(),f(A,{label:e(t)("crud.crud.data sheet"),class:"select-db",modelValue:e(n).startData.db,"onUpdate:modelValue":s[6]||(s[6]=l=>e(n).startData.db=l),type:"select",key:JSON.stringify(o.dialog.dbList),placeholder:e(t)("crud.crud.Please select a data table"),data:{content:o.dialog.dbList},attr:{blockHelp:e(t)("crud.crud.data sheet help")},"input-attr":{onChange:U},prop:"db"},null,8,["label","modelValue","placeholder","data","attr","input-attr"])),o.successRecord?(p(),f(S,{key:0,class:"success-record-alert",title:e(t)("crud.crud.The selected table has already generated records You are advised to start with historical records"),"show-icon":!0,closable:!1,type:"warning"},null,8,["title"])):b("",!0)],64)):b("",!0)]),_:1},8,["model","rules"])]),_:1},8,["modelValue","title"]),i(W,{modelValue:o.showLog,"onUpdate:modelValue":s[11]||(s[11]=l=>o.showLog=l)},null,8,["modelValue"])])])}}}),Ce=X(_e,[["__scopeId","data-v-956e4104"]]);export{Ce as default};