style: 代码生成预览样式调整

This commit is contained in:
KAI
2024-06-12 14:14:33 +00:00
committed by Charles7c
parent cc0840e2ae
commit 5601092f66
8 changed files with 35 additions and 9 deletions

View File

@@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1718188609387" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="8734" width="32" height="32" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M558.08 472.064c48.128 53.248-13.312 103.424-13.312 103.424s119.808-61.44 65.536-139.264c-51.2-71.68-91.136-107.52 122.88-232.448 0 1.024-335.872 86.016-175.104 268.288" fill="#FF0000" p-id="8735"></path><path d="M610.304 5.12s101.376 101.376-96.256 258.048C356.352 389.12 478.208 460.8 514.048 543.744 420.864 459.776 354.304 386.048 399.36 317.44 463.872 216.064 651.264 166.912 610.304 5.12" fill="#FF0000" p-id="8736"></path><path d="M720.896 757.76c183.296-95.232 98.304-188.416 39.936-175.104-15.36 3.072-21.504 5.12-21.504 5.12s5.12-8.192 16.384-11.264c117.76-40.96 207.872 120.832-37.888 186.368-1.024 0 2.048-3.072 3.072-5.12m-337.92 38.912s-37.888 21.504 26.624 29.696c76.8 8.192 117.76 8.192 202.752-8.192 0 0 23.552 15.36 53.248 26.624-191.488 80.896-433.152-5.12-282.624-48.128m-23.552-106.496s-43.008 31.744 23.552 37.888c82.944 8.192 149.504 10.24 261.12-13.312 0 0 16.384 16.384 40.96 24.576-231.424 68.608-490.496 5.12-325.632-49.152" fill="#6699FF" p-id="8737"></path><path d="M811.008 876.544s27.648 23.552-31.744 40.96c-111.616 34.816-460.8 45.056-558.08 2.048-34.816-15.36 31.744-35.84 51.2-40.96 21.504-5.12 34.816-3.072 34.816-3.072-38.912-28.672-251.904 52.224-107.52 75.776 390.144 62.464 712.704-28.672 611.328-74.752M400.384 578.56s-178.176 43.008-63.488 56.32c49.152 6.144 146.432 5.12 235.52-3.072 73.728-6.144 147.456-19.456 147.456-19.456s-26.624 11.264-45.056 24.576c-181.248 48.128-530.432 26.624-430.08-23.552 88.064-39.936 155.648-34.816 155.648-34.816" fill="#6699FF" p-id="8738"></path><path d="M418.816 1015.808c176.128 11.264 446.464-6.144 453.632-90.112 0 0-13.312 31.744-146.432 56.32-150.528 27.648-336.896 24.576-446.464 6.144 2.048 1.024 24.576 20.48 139.264 27.648" fill="#6699FF" p-id="8739"></path></svg>

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1718198141833" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1501" width="32" height="32" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M238.592 155.648H399.36v450.56C399.36 809.984 302.08 880.64 146.432 880.64c-37.888 0-87.04-6.144-118.784-17.408l18.432-130.048c22.528 7.168 51.2 12.288 82.944 12.288 67.584 0 110.592-30.72 110.592-141.312V155.648h-1.024z m301.056 547.84c41.984 22.528 110.592 44.032 179.2 44.032 73.728 0 113.664-30.72 113.664-78.848 0-43.008-33.792-69.632-119.808-99.328-118.784-40.96-197.632-107.52-197.632-211.968C515.072 235.52 617.472 143.36 785.408 143.36c81.92 0 139.264 16.384 182.272 35.84L931.84 308.224c-27.648-13.312-79.872-33.792-148.48-33.792-69.632 0-103.424 32.768-103.424 68.608 0 45.056 38.912 65.536 132.096 101.376 125.952 46.08 184.32 112.64 184.32 214.016 0 119.808-91.136 221.184-286.72 221.184-81.92 0-161.792-22.528-201.728-44.032l31.744-132.096z" fill="#F4DE51" p-id="1502"></path></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1718198196448" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1559" width="32" height="32" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M172.0576 206.4128L51.2 810.2656h165.9392l75.4176-404.352s65.3568-57.0112 115.6352-51.84c50.2784 5.1968 50.2784 57.472 50.2784 57.472L388.096 810.752h166.016l80.384-404.8128s55.296-57.0112 110.592-51.84c55.3216 5.1968 45.2608 62.6688 45.2608 62.6688l-75.4176 393.5232h170.9568l85.4784-460.928c10.0608-73.0112-33.024-136.192-90.496-142.9248-57.472-6.7072-115.6608 7.68-165.9392 39.2448-50.2784 31.5648-80.4608 72.576-80.4608 72.576S608.512 213.12 528.896 206.4128c-79.6416-6.7072-115.6608 12.8768-150.8352 33.6128a208.8192 208.8192 0 0 0-55.296 47.104l13.824-80.7168z" fill="#389FD6" p-id="1560"></path></svg>

After

Width:  |  Height:  |  Size: 939 B

View File

@@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1718198445579" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6888" width="32" height="32" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M847.872 240.128v688c0 26.56-21.408 48-48 48h-576c-26.56 0-48-21.44-48-48v-832c0-26.592 21.44-48 48-48h432z" fill="#E9EDED" p-id="6889"></path><path d="M160 768.128v160c0 35.456 28.544 64 64 64h576c35.456 0 64-28.544 64-64v-160H160z" fill="#F8B84E" p-id="6890"></path><path d="M847.872 240.128h-144c-26.56 0-48-21.44-48-48v-144" fill="#F8B84E" p-id="6891"></path><path d="M336 288v48H288v32h48V416h32v-48H416v-32h-48V288h-32z m96 96c-13.344 0-24.8 6.176-33.312 14.688-8.512 8.512-14.688 19.968-14.688 33.312v32c0 12.704 5.664 23.616 13.568 32-7.904 8.384-13.568 19.296-13.568 32v32c0 12.704 5.664 23.616 13.568 32-7.904 8.384-13.568 19.296-13.568 32v32c0 13.344 6.176 24.8 14.688 33.312 8.512 8.512 19.968 14.688 33.312 14.688h160c13.344 0 24.8-6.176 33.312-14.688 8.512-8.512 14.688-19.968 14.688-33.312v-32c0-12.704-5.664-23.616-13.568-32 7.904-8.384 13.568-19.296 13.568-32v-32c0-12.704-5.664-23.616-13.568-32 7.904-8.384 13.568-19.296 13.568-32v-32c0-13.344-6.176-24.8-14.688-33.312-8.512-8.512-19.968-14.688-33.312-14.688h-160z m0 32h160c2.656 0 7.2 1.824 10.688 5.312 3.488 3.488 5.312 8 5.312 10.688v32a17.44 17.44 0 0 1-5.312 10.688 17.408 17.408 0 0 1-10.688 5.312h-160a17.408 17.408 0 0 1-10.688-5.312A17.408 17.408 0 0 1 416 464v-32c0-2.656 1.824-7.2 5.312-10.688A17.408 17.408 0 0 1 432 416z m0 96h160c2.656 0 7.2 1.824 10.688 5.312 3.488 3.488 5.312 8 5.312 10.688v32a17.44 17.44 0 0 1-5.312 10.688 17.408 17.408 0 0 1-10.688 5.312h-160a17.408 17.408 0 0 1-10.688-5.312A17.408 17.408 0 0 1 416 560v-32c0-2.656 1.824-7.2 5.312-10.688A17.408 17.408 0 0 1 432 512z m0 96h160c2.656 0 7.2 1.824 10.688 5.312 3.488 3.488 5.312 8 5.312 10.688v32a17.44 17.44 0 0 1-5.312 10.688 17.408 17.408 0 0 1-10.688 5.312h-160a17.408 17.408 0 0 1-10.688-5.312A17.408 17.408 0 0 1 416 656v-32c0-2.656 1.824-7.2 5.312-10.688A17.408 17.408 0 0 1 432 608z" fill="#F8B84E" p-id="6892"></path><path d="M623.872 799.936a16 16 0 0 0-15.744 16.256v126.432a16 16 0 0 0 0.256 4.32 16 16 0 0 0 0 0.064 16 16 0 0 0 0.352 1.44 16 16 0 0 0 0 0.064 16 16 0 0 0 0.128 0.416 16 16 0 0 0 0.448 1.12 16 16 0 0 0 0.864 1.824 16 16 0 0 0 0.64 0.992 16 16 0 0 0 1.76 2.144 16 16 0 0 0 0.352 0.416 16 16 0 0 0 0.192 0.192 16 16 0 0 0 1.056 0.896 16 16 0 0 0 0.384 0.32 16 16 0 0 0 1.12 0.736 16 16 0 0 0 2.432 1.248 16 16 0 0 0 0.896 0.32 16 16 0 0 0 5.376 0.864H688a16 16 0 1 0 0-32h-47.872v-111.808a16 16 0 0 0-16.256-16.256zM496.128 800a80.256 80.256 0 0 0-80 80c0 44 36 80 80 80 16.224 0 31.296-4.992 43.936-13.376l8.576 8.576a16 16 0 1 0 22.624-22.624l-8.512-8.512c8.416-12.672 13.376-27.808 13.376-44.064 0-44-36-80-80-80z m-193.6 0.128a16 16 0 0 0-2.016 0.384c-24.64 1.92-44.384 22.528-44.384 47.616 0 25.28 20.064 46.08 44.992 47.68a16 16 0 0 0 3.008 0.32h32c9.152 0 16 6.848 16 16 0 9.152-6.848 16-16 16h-64a16 16 0 1 0 0 32h64a16 16 0 0 0 3.296-0.384 48.096 48.096 0 0 0 44.704-47.616c0-25.152-19.84-45.888-44.576-47.68a16 16 0 0 0-3.424-0.32h-30.88a16 16 0 0 0-1.12 0 15.616 15.616 0 0 1-16-16c0-9.152 6.848-16 16-16h64a16 16 0 1 0 0-32H305.248a16 16 0 0 0-1.12 0 16 16 0 0 0-1.6 0z m193.6 31.872a47.776 47.776 0 0 1 43.2 68.672 16 16 0 0 0-11.2-4.672 16 16 0 0 0-11.456 27.264 47.744 47.744 0 0 1-68.576-43.264c0-26.688 21.344-48 48-48z" fill="#E9EDED" p-id="6893"></path></svg>

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

@@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1718188583912" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6620" width="32" height="32" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M94.208 94.208v835.584h835.584V94.208H94.208z m634.92096 405.85216v0.012288c8.011776 0.024576 17.119232 0.436224 23.967744 1.179648 27.891712 3.016704 49.6128 15.050752 68.091904 37.715968 9.201664 11.290624 12.34944 16.2304 11.679744 18.343936-0.432128 1.363968-6.746112 5.885952-26.820608 19.21024-19.720192 13.092864-26.07104 17.014784-27.5456 17.014784-1.497088 0-4.614144-3.207168-9.105408-9.365504-8.6528-11.855872-17.485824-17.266688-31.13984-19.070976-14.68416-1.9456-27.856896 2.68288-34.308096 12.058624-5.515264 8.011776-6.3488 20.901888-1.96608 30.26944 5.07904 10.848256 14.270464 16.846848 49.494016 32.290816 40.624128 17.813504 61.210624 30.005248 76.204032 45.13792 16.146432 16.293888 24.326144 35.106816 26.83904 61.718528 1.226752 12.972032-0.272384 28.34432-3.98336 40.843264-9.10336 30.640128-33.66912 53.075968-69.67296 63.635456-9.95328 2.9184-19.214336 4.661248-28.37504 5.332992-13.985792 1.030144-34.002944 0.462848-46.051328-1.29024-30.482432-4.442112-64.892928-22.17984-82.051072-42.2912-8.423424-9.873408-19.177472-26.12224-19.177472-28.9792 0-1.380352 0.684032-2.164736 3.391488-3.885056 8.032256-5.103616 54.054912-31.412224 54.94784-31.412224 0.540672 0 2.945024 2.832384 5.341184 6.295552 5.429248 7.839744 18.78016 21.313536 25.567232 25.808896 5.543936 3.672064 12.634112 6.619136 21.051392 8.747008 4.820992 1.202176 7.3728 1.417216 17.891328 1.417216 10.747904-0.004096 12.951552-0.18432 17.760256-1.476608 12.71808-3.422208 22.644736-10.50624 26.851328-19.156992 1.8432-3.7376 1.880064-4.204544 1.880064-13.27104v-9.40032l-2.260992-4.48512c-5.474304-10.866688-17.270784-18.323456-54.56896-34.47808-17.13152-7.421952-38.11328-17.885184-46.30528-23.0912-18.696192-11.880448-31.653888-25.462784-40.157184-42.088448-8.45824-16.533504-9.71776-22.687744-9.73824-47.548416-0.02048-19.462144-0.053248-19.222528 3.975168-31.643648 3.65568-11.272192 11.139072-23.863296 19.400704-32.64512 16.4864-17.524736 40.577024-28.788736 66.367488-31.029248 3.29728-0.313344 7.716864-0.434176 12.52352-0.41984z m-221.92128 3.844096h0.008192c49.670144 0.024576 78.143488 0.196608 78.600192 0.483328 0.86016 0.53248 0.968704 4.855808 0.968704 32.444416v31.827968l-49.563648 0.180224-49.563648 0.180224v140.724224c0 77.400064-0.157696 141.185024-0.372736 141.748224-0.350208 0.948224-4.163584 1.019904-36.41344 1.019904h-36.018176l-0.372736-1.45408c-0.239616-0.79872-0.415744-64.587776-0.41984-141.750272l-0.012288-140.296192-49.5616-0.176128-49.565696-0.180224v-31.451136c0-24.94464 0.172032-31.625216 0.837632-32.288768 0.681984-0.702464 25.976832-0.882688 134.967296-0.991232 21.01248-0.02048 39.92576-0.03072 56.48384-0.02048z" fill="#0288D1" p-id="6621"></path></svg>

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1718188596978" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7659" width="32" height="32" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M615.6 123.6h165.5L512 589.7 242.9 123.6H63.5L512 900.4l448.5-776.9z" fill="#41B883" p-id="7660"></path><path d="M781.1 123.6H615.6L512 303 408.4 123.6H242.9L512 589.7z" fill="#34495E" p-id="7661"></path></svg>

After

Width:  |  Height:  |  Size: 541 B

View File

@@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1718198382067" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3842" width="32" height="32" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M590.222222 73.955556L859.022222 342.254933V876.088889c0 37.700267-30.5664 68.266667-68.266666 68.266667H233.244444c-37.700267 0-68.266667-30.5664-68.266666-68.266667V142.222222c0-37.700267 30.5664-68.266667 68.266666-68.266666h356.977778z m-11.764622 28.444444H233.244444a39.822222 39.822222 0 0 0-39.799466 38.456889L193.422222 142.222222v733.866667a39.822222 39.822222 0 0 0 38.456889 39.799467L233.244444 915.911111h557.511112a39.822222 39.822222 0 0 0 39.799466-38.456889L830.577778 876.088889V354.053689L578.4576 102.4z" fill="#FFC069" p-id="3843"></path><path d="M854.755556 370.648178h-215.1424c-45.528178 0-82.551467-36.431644-83.5072-81.737956l-0.017067-1.792V73.955556h28.444444v213.162666c0 29.895111 23.819378 54.232178 53.515378 55.062756l1.564445 0.022755h215.1424v28.444445z" fill="#FFC069" p-id="3844"></path><path d="M56.888889 489.244444m28.444444 0l853.333334 0q28.444444 0 28.444444 28.444445l0 284.444444q0 28.444444-28.444444 28.444445l-853.333334 0q-28.444444 0-28.444444-28.444445l0-284.444444q0-28.444444 28.444444-28.444445Z" fill="#FFC069" p-id="3845"></path><path d="M293.916444 756.622222l16.384-37.12c4.352-9.984 8.704-19.968 13.056-31.744h1.024c5.12 11.776 9.472 21.76 14.08 31.744L356.124444 756.622222h50.944l-52.48-96 49.152-94.72h-48.384l-13.824 34.304a503.443911 503.443911 0 0 0-12.288 31.232h-1.024c-5.376-12.288-9.472-22.272-13.824-31.232l-15.36-34.304H248.092444l49.408 92.672L245.276444 756.622222h48.64z m179.2 0v-65.28c0-18.944-3.584-47.36-5.888-66.048h1.024l15.36 45.568 25.856 69.632h25.088l25.6-69.632 15.872-45.568h1.28c-2.56 18.688-6.144 47.104-6.144 66.048V756.622222h41.728V565.902222h-49.664l-29.184 82.432c-3.584 11.008-6.656 23.04-10.496 34.56h-1.28c-3.584-11.52-6.656-23.552-10.496-34.56l-30.208-82.432h-49.408V756.622222h40.96z m303.616 0v-38.4h-74.24V565.902222h-45.824V756.622222h120.064z" fill="#FFFFFF" p-id="3846"></path></svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@@ -4,19 +4,30 @@
:title="`生成 ${previewTableName} 表预览`"
:mask-closable="false"
:esc-to-close="false"
width="100%"
width="90%"
draggable
:footer="false"
>
<div class="preview-content">
<a-layout :has-sider="true">
<a-layout-sider theme="dark" style="max-width:600px;height: 700px" :resize-directions="['right']" :width="580">
<a-tree class="selectPreview" :data="treeData" :show-line="false" @select="onSelectPreview">
<a-layout-sider theme="dark" style="max-width:600px;height: 700px" :resize-directions="['right']" :width="500">
<a-tree ref="treeRef" class="selectPreview"
:data="treeData"
default-expand-all
@select="onSelectPreview"
>
<template #icon=" node ">
<GiSvgIcon v-if="!node.isLeaf && !node.expanded" :size="16" name="directory-blue" />
<GiSvgIcon v-if="!node.isLeaf && node.expanded" :size="16" name="directory-open-blue" />
<GiSvgIcon v-if="node.isLeaf" :size="16" name="drive-file" />
</template>
<GiSvgIcon v-if="node.isLeaf && checkFileType(node.node.title, '.java')" :size="16" name="file-java" />
<GiSvgIcon v-if="node.isLeaf && checkFileType(node.node.title, '.vue')" :size="16" name="file-vue" />
<GiSvgIcon v-if="node.isLeaf && checkFileType(node.node.title, '.ts')" :size="16" name="file-typescript" />
<GiSvgIcon v-if="node.isLeaf && checkFileType(node.node.title, '.js')" :size="16" name="file-javascript" />
<GiSvgIcon v-if="node.isLeaf && checkFileType(node.node.title, '.json')" :size="16" name="file-json" />
<GiSvgIcon v-if="node.isLeaf && checkFileType(node.node.title, 'pom.xml')" :size="16" name="file-maven" />
<GiSvgIcon v-if="node.isLeaf && checkFileType(node.node.title, '.xml') && !checkFileType(node.node.title, 'pom.xml')" :size="16" name="file-xml" />
<GiSvgIcon v-if="node.isLeaf && checkFileType(node.node.title, '.sql')" :size="16" name="file-sql" />
</template>
</a-tree>
</a-layout-sider>
<a-layout-content>
@@ -63,8 +74,8 @@ const genPreviewList = ref<GeneratePreviewResp[]>([])
const visible = ref(false)
const treeData = ref<TreeNodeData[]>([])
const previewTableName = ref<string>('')
const mergeDir = (parent: TreeNodeData) => {
const treeRef = ref()
const mergeDir = async (parent: TreeNodeData) => {
// 合并目录
if (parent.children?.length === 1 && typeof parent.children[0].key === 'number') {
const mergeTitle = mergeDir(parent.children[0])
@@ -80,9 +91,13 @@ const mergeDir = (parent: TreeNodeData) => {
mergeDir(child)
}
}
await nextTick(() => {
treeRef.value?.expandAll(true)
})
return ''
}
const expandKeys = ref<any[]>([])
const pushDir = (children: TreeNodeData[] | undefined, treeNode: TreeNodeData) => {
if (children) {
for (const child of children) {
@@ -92,6 +107,7 @@ const pushDir = (children: TreeNodeData[] | undefined, treeNode: TreeNodeData) =
}
}
children?.push(treeNode)
expandKeys.value.push(treeNode.key)
return treeNode.children
}
@@ -143,10 +159,13 @@ watch(copied, () => {
Message.success('复制成功')
}
})
const gen = () => {
emit('generate', [previewTableName.value])
}
// 校验文件类型
const checkFileType = (title: string, type: string) => {
return title.endsWith(type)
}
defineExpose({ onPreview })
</script>