Commit df7991a6 authored by liaozan's avatar liaozan 🏀

Change groupId component from input to select to limit the groupId

parent 6f93b455
...@@ -6,16 +6,16 @@ ...@@ -6,16 +6,16 @@
"build": "vite build --mode production" "build": "vite build --mode production"
}, },
"dependencies": { "dependencies": {
"vue": "^3.2.44", "vue": "^3.2.45",
"axios": "^1.1.3", "axios": "^1.2.0",
"ant-design-vue": "^3.2.15", "ant-design-vue": "^3.2.15",
"highlight.js": "^11.6.0", "highlight.js": "^11.6.0",
"@highlightjs/vue-plugin": "^2.1.0" "@highlightjs/vue-plugin": "^2.1.0"
}, },
"devDependencies": { "devDependencies": {
"@vitejs/plugin-vue": "^3.2.0", "@vitejs/plugin-vue": "^3.2.0",
"typescript": "^4.8.4", "typescript": "^4.9.3",
"vite": "^3.2.3", "vite": "^3.2.4",
"vue-tsc": "^1.0.9" "vue-tsc": "^1.0.9"
} }
} }
\ No newline at end of file
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<h3 style="margin-bottom: 20px">项目初始代码生成</h3> <h3 style="margin-bottom: 20px">项目初始代码生成</h3>
<a-form ref="downloadForm" :labelCol="{span: 6}" :model="formState" :rules="formRules" :wrapperCol="{span: 18}" autocomplete="off" class="form-wrapper"> <a-form ref="downloadForm" :labelCol="{span: 6}" :model="formState" :rules="formRules" :wrapperCol="{span: 18}" autocomplete="off" class="form-wrapper">
<a-form-item has-feedback label="GroupId" name="groupId"> <a-form-item has-feedback label="GroupId" name="groupId">
<a-input v-model:value="formState.groupId"/> <a-select v-model:value="formState.groupId" :options="groupOptions"/>
</a-form-item> </a-form-item>
<a-form-item has-feedback label="ArtifactId" name="artifactId"> <a-form-item has-feedback label="ArtifactId" name="artifactId">
<a-input v-model:value="formState.artifactId"/> <a-input v-model:value="formState.artifactId"/>
...@@ -49,6 +49,7 @@ ...@@ -49,6 +49,7 @@
<script lang="ts" setup> <script lang="ts" setup>
import {computed, reactive, ref} from 'vue' import {computed, reactive, ref} from 'vue'
import {SelectProps} from 'ant-design-vue/es/select';
import type {TreeProps} from 'ant-design-vue'; import type {TreeProps} from 'ant-design-vue';
import {FormInstance, message} from "ant-design-vue"; import {FormInstance, message} from "ant-design-vue";
import request, {isLoading} from "../utils/request"; import request, {isLoading} from "../utils/request";
...@@ -91,6 +92,22 @@ const fileExtension = ref<string | null>() ...@@ -91,6 +92,22 @@ const fileExtension = ref<string | null>()
const loading = computed(() => isLoading.value) const loading = computed(() => isLoading.value)
const downloadForm = ref<FormInstance>(); const downloadForm = ref<FormInstance>();
const groupOptions = ref<SelectProps['options']>([
{
"value": "com.schbrain.dg",
"label": "com.schbrain.dg"
},
{
"value": "com.schbrain.kp",
"label": "com.schbrain.kp"
},
{
"value": "com.schbrain.xb",
"label": "com.schbrain.xb"
},
])
const formState = reactive<FormState>({ const formState = reactive<FormState>({
groupId: '', groupId: '',
artifactId: '', artifactId: '',
...@@ -148,7 +165,7 @@ const onPreview = async () => { ...@@ -148,7 +165,7 @@ const onPreview = async () => {
const onDownload = async (id: number) => { const onDownload = async (id: number) => {
let res = await request.get(`/archetype/download/${id}`, {responseType: 'blob'}) let res = await request.get(`/archetype/download/${id}`, {responseType: 'blob'})
const {headers, data} = res const {headers, data} = res
const fileName = headers['content-disposition'].replace(/\w+;\sfilename="(.*)"/, '$1') const fileName = headers?.['content-disposition']?.replace(/\w+;\sfilename="(.*)"/, '$1') || ''
downloadGeneratedProject(data, fileName) downloadGeneratedProject(data, fileName)
} }
...@@ -230,6 +247,7 @@ const createGroupTreeData = (groupNodeList: GroupNode[]): any => { ...@@ -230,6 +247,7 @@ const createGroupTreeData = (groupNodeList: GroupNode[]): any => {
} }
</script> </script>
<!--suppress CssUnusedSymbol -->
<style scoped> <style scoped>
.start-wrapper { .start-wrapper {
width: 500px; width: 500px;
...@@ -250,8 +268,15 @@ const createGroupTreeData = (groupNodeList: GroupNode[]): any => { ...@@ -250,8 +268,15 @@ const createGroupTreeData = (groupNodeList: GroupNode[]): any => {
margin-left: 10px; margin-left: 10px;
} }
/*noinspection CssUnusedSymbol*/
.ant-input, .ant-btn { .ant-input, .ant-btn {
border-radius: 6px; border-radius: 6px;
} }
:deep(.ant-select:not(.ant-select-customize-input) .ant-select-selector) {
border-radius: 6px;
}
.ant-select {
text-align: left;
}
</style> </style>
\ No newline at end of file
...@@ -5,7 +5,6 @@ import {ref} from 'vue' ...@@ -5,7 +5,6 @@ import {ref} from 'vue'
export const isLoading = ref(false) export const isLoading = ref(false)
// @ts-ignore
axios.defaults.baseURL = import.meta.env.VITE_APP_BASE_URL axios.defaults.baseURL = import.meta.env.VITE_APP_BASE_URL
axios.interceptors.request.use((config: AxiosRequestConfig) => { axios.interceptors.request.use((config: AxiosRequestConfig) => {
isLoading.value = true isLoading.value = true
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment