神仙 1 ano atrás
pai
commit
e439a723c8

+ 1 - 0
src/modules/helper/static/svg/arrow-down.svg

@@ -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="1719536095395" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2583" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M61.44 512C61.44 263.168 263.168 61.44 512 61.44s450.56 201.728 450.56 450.56-201.728 450.56-450.56 450.56S61.44 760.832 61.44 512z m397.312 180.85888c29.61408 31.92832 76.88192 31.92832 106.496 0l199.63904-215.28576 0.90112-1.00352c17.01888-19.456 16.52736-50.44224-1.10592-69.2224-19.29216-20.52096-48.82432-23.81824-71.4752-7.96672l-150.58944 105.49248c-18.67776 13.1072-42.55744 13.1072-61.2352 0L330.1376 398.9504c-22.26176-15.5648-51.3024-12.34944-70.26688 7.84384l-0.55296 0.57344a46.8992 46.8992 0 0 0-0.90112 1.024c-17.14176 19.31264-16.83456 50.29888 0.69632 69.2224l199.65952 215.26528z" p-id="2584"></path></svg>

+ 8 - 1
src/modules/helper/types/index.d.ts

@@ -30,7 +30,14 @@ export declare interface EpsData {
 	[key: string]: EpsModule[];
 }
 
-export declare type CodeType = "entity" | "controller" | "vue";
+export declare type CodeType = "node-entity" | "node-controller" | "node-service" | "vue";
+
+export interface CodeItem {
+	label: string;
+	value: CodeType;
+	content: string;
+	[key: string]: any;
+}
 
 export declare interface PropRule {
 	value?: string;

+ 51 - 66
src/modules/helper/views/ai-code.vue

@@ -78,13 +78,7 @@
 								</el-tooltip>
 							</div>
 
-							<el-input v-model="form.entity" maxlength="20" placeholder="请输入">
-								<template #prefix>
-									<el-icon>
-										<arrow-right-bold />
-									</el-icon>
-								</template>
-							</el-input>
+							<el-input v-model="form.entity" maxlength="20" placeholder="请输入" />
 						</div>
 
 						<div class="row module">
@@ -101,41 +95,38 @@
 								</el-tooltip>
 							</div>
 
-							<el-input v-model="form.module" maxlength="20" placeholder="请输入">
-								<template #prefix>
-									<el-popover
-										:ref="setRefs('modulePopover')"
-										:teleported="false"
-										:popper-style="{
-											padding: '5px',
-											borderRadius: '6px'
-										}"
-										placement="left"
-									>
-										<template #reference>
-											<el-icon class="add">
-												<circle-plus-filled />
-											</el-icon>
-										</template>
-
-										<div class="module-list">
-											<div
-												class="item"
-												v-for="(item, index) in module.dirs"
-												:key="index"
-												@click="
-													() => {
-														form.module = item;
-														refs.modulePopover?.hide();
-													}
-												"
-											>
-												{{ item }}
-											</div>
-										</div>
-									</el-popover>
+							<el-input v-model="form.module" maxlength="20" placeholder="请输入" />
+
+							<el-popover
+								:ref="setRefs('modulePopover')"
+								:teleported="false"
+								:popper-style="{
+									padding: '5px',
+									borderRadius: '6px',
+									zIndex: 99
+								}"
+								placement="left"
+							>
+								<template #reference>
+									<cl-svg class="add" name="arrow-down" />
 								</template>
-							</el-input>
+
+								<div class="module-list">
+									<div
+										class="item"
+										v-for="(item, index) in module.dirs"
+										:key="index"
+										@click="
+											() => {
+												form.module = item;
+												refs.modulePopover?.hide();
+											}
+										"
+									>
+										{{ item }}
+									</div>
+								</div>
+							</el-popover>
 						</div>
 
 						<div class="row">
@@ -152,13 +143,7 @@
 								</el-tooltip>
 							</div>
 
-							<el-input v-model="form.column" maxlength="200" placeholder="请输入">
-								<template #prefix>
-									<el-icon class="icon">
-										<arrow-right-bold />
-									</el-icon>
-								</template>
-							</el-input>
+							<el-input v-model="form.column" maxlength="200" placeholder="请输入" />
 						</div>
 
 						<div class="row">
@@ -175,13 +160,7 @@
 								</el-tooltip>
 							</div>
 
-							<el-input v-model="form.other" maxlength="200" placeholder="请输入">
-								<template #prefix>
-									<el-icon>
-										<arrow-right-bold />
-									</el-icon>
-								</template>
-							</el-input>
+							<el-input v-model="form.other" maxlength="200" placeholder="请输入" />
 						</div>
 					</div>
 				</div>
@@ -304,6 +283,7 @@ import * as monaco from "monaco-editor";
 import { sleep } from "/@/cool/utils";
 import dayjs from "dayjs";
 import { nextTick } from "vue";
+import type { CodeItem } from "../types";
 
 const { service, refs, setRefs, router } = useCool();
 const menu = useMenu();
@@ -323,7 +303,7 @@ monaco.editor.defineTheme("ai-code--dark", {
 
 // 表单
 const form = reactive({
-	entity: "",
+	entity: "收货地址",
 	module: "user",
 	other: "",
 	column: "用户ID、用户名、收货人、手机号、收货地址、是否默认"
@@ -383,13 +363,6 @@ const step = reactive({
 	}
 });
 
-interface CodeItem {
-	label: string;
-	value: string;
-	content: string;
-	[key: string]: any;
-}
-
 // 代码
 const code = reactive({
 	active: "",
@@ -1177,14 +1150,13 @@ $color: #41d1ff;
 			margin: 0 auto;
 
 			.editor {
-				box-shadow: 0 0 1px 1px rgba($color, 0.7);
 				border-radius: 8px;
 
 				.content {
 					color: #fff;
 					box-sizing: border-box;
 					border-radius: 0 0 8px 8px;
-					padding: 10px 0;
+					padding: 5px 0 10px 0;
 
 					.row {
 						font-size: 12px;
@@ -1198,6 +1170,9 @@ $color: #41d1ff;
 							display: flex;
 							align-items: center;
 							padding: 5px 15px;
+							font-size: 12px;
+							margin-bottom: 5px;
+							color: #999;
 
 							.el-icon {
 								margin-left: 4px;
@@ -1206,8 +1181,9 @@ $color: #41d1ff;
 						}
 
 						:deep(.el-input__wrapper) {
-							background-color: transparent;
+							background-color: #2f344722;
 							box-shadow: none;
+							padding: 0 15px;
 
 							.el-input__inner {
 								color: #fff;
@@ -1219,9 +1195,18 @@ $color: #41d1ff;
 						}
 
 						&.module {
+							position: relative;
+
+							:deep(.el-input__wrapper) {
+								padding-left: 35px;
+							}
+
 							.add {
 								cursor: pointer;
 								margin-right: 8px;
+								position: absolute;
+								left: 15px;
+								top: 40px;
 							}
 						}
 					}