mirror of
https://github.com/cool-team-official/cool-admin-vue.git
synced 2025-12-14 14:52:49 +00:00
解决ai编码字段空的问题
This commit is contained in:
parent
ba0525f559
commit
cd1cd39a7a
@ -448,6 +448,9 @@ const code = reactive({
|
|||||||
// 生成中
|
// 生成中
|
||||||
loading: false,
|
loading: false,
|
||||||
|
|
||||||
|
// 请求
|
||||||
|
req: null as Promise<any> | null,
|
||||||
|
|
||||||
// 获取字段
|
// 获取字段
|
||||||
async getColumns() {
|
async getColumns() {
|
||||||
return ai
|
return ai
|
||||||
@ -465,6 +468,8 @@ const code = reactive({
|
|||||||
clear() {
|
clear() {
|
||||||
code.list = [];
|
code.list = [];
|
||||||
code.logs = [];
|
code.logs = [];
|
||||||
|
code.req = null;
|
||||||
|
code.loading = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
// 提示
|
// 提示
|
||||||
@ -504,6 +509,7 @@ const code = reactive({
|
|||||||
code.data.prefix = entityData.path;
|
code.data.prefix = entityData.path;
|
||||||
code.data.fileName = entityData.fileName;
|
code.data.fileName = entityData.fileName;
|
||||||
|
|
||||||
|
// 解析字段
|
||||||
code.parseColumn();
|
code.parseColumn();
|
||||||
|
|
||||||
code.tips("Service 代码生成中");
|
code.tips("Service 代码生成中");
|
||||||
@ -568,6 +574,7 @@ const code = reactive({
|
|||||||
code.data.prefix = entityData.path;
|
code.data.prefix = entityData.path;
|
||||||
code.data.fileName = entityData.fileName;
|
code.data.fileName = entityData.fileName;
|
||||||
|
|
||||||
|
// 解析字段
|
||||||
code.parseColumn();
|
code.parseColumn();
|
||||||
|
|
||||||
code.tips("Mapper 代码生成中");
|
code.tips("Mapper 代码生成中");
|
||||||
@ -655,7 +662,7 @@ const code = reactive({
|
|||||||
|
|
||||||
await code[`create${lang.value}`]();
|
await code[`create${lang.value}`]();
|
||||||
|
|
||||||
await code.createVue(false);
|
await code.createVue();
|
||||||
|
|
||||||
code.tips("编码完成");
|
code.tips("编码完成");
|
||||||
|
|
||||||
@ -684,7 +691,7 @@ const code = reactive({
|
|||||||
entity: code.getContent(`${lang.value}-entity`)
|
entity: code.getContent(`${lang.value}-entity`)
|
||||||
});
|
});
|
||||||
|
|
||||||
await Promise.all([a, b]).then((res) => {
|
code.req = Promise.all([a, b]).then((res) => {
|
||||||
if (res[0]?.columns) {
|
if (res[0]?.columns) {
|
||||||
code.data.columns = res[0].columns.map((e: EpsColumn) => {
|
code.data.columns = res[0].columns.map((e: EpsColumn) => {
|
||||||
if (res[1]?.columns) {
|
if (res[1]?.columns) {
|
||||||
@ -715,7 +722,7 @@ const code = reactive({
|
|||||||
},
|
},
|
||||||
|
|
||||||
// 创建vue
|
// 创建vue
|
||||||
async createVue(isParse: boolean = true) {
|
async createVue() {
|
||||||
const item = code.add("Vue 页面", "vue");
|
const item = code.add("Vue 页面", "vue");
|
||||||
|
|
||||||
item.content = "";
|
item.content = "";
|
||||||
@ -724,11 +731,14 @@ const code = reactive({
|
|||||||
|
|
||||||
code.tips("Vue 代码开始生成");
|
code.tips("Vue 代码开始生成");
|
||||||
|
|
||||||
if (isParse) {
|
if (!code.req) {
|
||||||
code.tips("AI 分析中");
|
code.parseColumn();
|
||||||
await code.parseColumn();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
code.tips("AI 分析中");
|
||||||
|
|
||||||
|
await code.req;
|
||||||
|
|
||||||
// 生成内容
|
// 生成内容
|
||||||
item.content = menu.createVue({
|
item.content = menu.createVue({
|
||||||
...code.data,
|
...code.data,
|
||||||
@ -840,6 +850,7 @@ const code = reactive({
|
|||||||
// 重新生成
|
// 重新生成
|
||||||
async refresh() {
|
async refresh() {
|
||||||
code.loading = true;
|
code.loading = true;
|
||||||
|
code.req = null;
|
||||||
await code.createVue();
|
await code.createVue();
|
||||||
code.loading = false;
|
code.loading = false;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user