Merge remote-tracking branch 'origin/main' into dev2.7.7
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
|
||||
|
||||
<script setup>
|
||||
import { onMounted, ref } from "vue";
|
||||
import { onMounted, ref, watch } from "vue";
|
||||
import pathInfo from "@/pathInfo.json";
|
||||
|
||||
const props = defineProps({
|
||||
@@ -84,6 +84,11 @@ function convertToCascaderOptions(data) {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
watch(() => props.component, (value) => {
|
||||
initCascader(value)
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
pathOptions.value = convertToCascaderOptions(pathInfo)
|
||||
initCascader(props.component)
|
||||
|
||||
@@ -35,8 +35,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive } from 'vue'
|
||||
import config from '@/core/config'
|
||||
import { reactive } from 'vue'
|
||||
|
||||
defineOptions({
|
||||
name: 'Icon',
|
||||
|
||||
@@ -158,7 +158,7 @@
|
||||
prop="structName"
|
||||
class="w-full"
|
||||
>
|
||||
<div class="flex gap-2">
|
||||
<div class="flex gap-2 w-full">
|
||||
<el-input
|
||||
v-model="form.structName"
|
||||
placeholder="首字母自动转换大写"
|
||||
@@ -1220,6 +1220,20 @@ const enterForm = async(isPreview) => {
|
||||
return false
|
||||
}
|
||||
form.value.humpPackageName = toSQLLine(form.value.packageName)
|
||||
|
||||
form.value.fields.forEach(item => {
|
||||
if(item.fieldType === 'enum'){
|
||||
// 判断一下 item.dataTypeLong 按照,切割后的每个元素是否都使用 '' 包裹,如果没包 则修改为包裹起来的 然后再转为字符串赋值给 item.dataTypeLong
|
||||
const arr = item.dataTypeLong.split(',')
|
||||
arr.forEach((ele, index) => {
|
||||
if(ele.indexOf("'") === -1){
|
||||
arr[index] = `'${ele}'`
|
||||
}
|
||||
})
|
||||
item.dataTypeLong = arr.join(',')
|
||||
}
|
||||
})
|
||||
|
||||
delete form.value.primaryField
|
||||
if (isPreview) {
|
||||
const data = await preview({...form.value,isAdd:!!isAdd.value,fields:form.value.fields.filter(item => !item.disabled)})
|
||||
|
||||
@@ -249,6 +249,25 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item
|
||||
label="需用到的表"
|
||||
prop="tables"
|
||||
>
|
||||
<el-select
|
||||
multiple
|
||||
v-model="tables"
|
||||
clearable
|
||||
placeholder="使用AI的情况下请选择"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in tableOptions"
|
||||
:key="item.tableName"
|
||||
:label="item.tableName"
|
||||
:value="item.tableName"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item
|
||||
label="AI帮写:"
|
||||
prop="ai"
|
||||
@@ -488,6 +507,7 @@ const formData = ref({
|
||||
})
|
||||
|
||||
const prompt = ref('')
|
||||
const tables = ref([])
|
||||
|
||||
const typeSearchOptions = ref([
|
||||
{
|
||||
@@ -614,11 +634,33 @@ const dbList = ref([])
|
||||
const tableOptions = ref([])
|
||||
const aiLoading = ref(false)
|
||||
|
||||
const getTablesCloumn = async() => {
|
||||
const tablesMap = {}
|
||||
const promises = tables.value.map(async item => {
|
||||
const res = await getColumn({
|
||||
businessDB: formData.value.dbName,
|
||||
tableName: item
|
||||
})
|
||||
if(res.code === 0) {
|
||||
tablesMap[item] = res.data.columns
|
||||
}
|
||||
})
|
||||
await Promise.all(promises)
|
||||
return tablesMap
|
||||
}
|
||||
|
||||
|
||||
const autoExport = async () => {
|
||||
if (tables.value.length === 0) {
|
||||
ElMessage({
|
||||
type: 'error',
|
||||
message: '请先选择需要参与导出的表'
|
||||
})
|
||||
return
|
||||
}
|
||||
aiLoading.value = true
|
||||
const tables = tableOptions.value.map(item => item.tableName)
|
||||
const aiRes = await butler({prompt:prompt.value,businessDB: formData.value.dbName||"",tables:tables,command:'autoExportTemplate'})
|
||||
const tableMap = await getTablesCloumn()
|
||||
const aiRes = await butler({prompt:prompt.value,businessDB: formData.value.dbName||"",tableMap:tableMap,command:'autoExportTemplate'})
|
||||
aiLoading.value = false
|
||||
if (aiRes.code === 0) {
|
||||
const aiData = JSON.parse(aiRes.data)
|
||||
@@ -643,6 +685,7 @@ getDbFunc()
|
||||
const dbNameChange = () => {
|
||||
formData.value.tableName = ''
|
||||
formData.value.templateInfo = ''
|
||||
tables.value = []
|
||||
getTableFunc()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user