mirror of
https://github.com/cool-team-official/cool-admin-vue.git
synced 2025-12-12 13:42:50 +00:00
1
This commit is contained in:
parent
e439a723c8
commit
b1981630a7
1880
build/cool/eps.d.ts
vendored
1880
build/cool/eps.d.ts
vendored
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -1,7 +1,7 @@
|
|||||||
export const proxy = {
|
export const proxy = {
|
||||||
"/dev/": {
|
"/dev/": {
|
||||||
target: "http://127.0.0.1:9009",
|
// target: "http://127.0.0.1:9009",
|
||||||
// target: "http://192.168.0.112:9009",
|
target: "http://192.168.0.112:8001",
|
||||||
// target: "https://dev-admin.cool-js.cloud",
|
// target: "https://dev-admin.cool-js.cloud",
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
rewrite: (path: string) => path.replace(/^\/dev/, "")
|
rewrite: (path: string) => path.replace(/^\/dev/, "")
|
||||||
|
|||||||
4
src/modules/helper/types/index.d.ts
vendored
4
src/modules/helper/types/index.d.ts
vendored
@ -30,11 +30,9 @@ export declare interface EpsData {
|
|||||||
[key: string]: EpsModule[];
|
[key: string]: EpsModule[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export declare type CodeType = "node-entity" | "node-controller" | "node-service" | "vue";
|
|
||||||
|
|
||||||
export interface CodeItem {
|
export interface CodeItem {
|
||||||
label: string;
|
label: string;
|
||||||
value: CodeType;
|
value: string;
|
||||||
content: string;
|
content: string;
|
||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -217,6 +217,12 @@
|
|||||||
<download />
|
<download />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
|
|
||||||
|
<el-tooltip content="复制代码">
|
||||||
|
<el-icon @click="code.copy()">
|
||||||
|
<copy-document />
|
||||||
|
</el-icon>
|
||||||
|
</el-tooltip>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -271,7 +277,7 @@ import {
|
|||||||
Back,
|
Back,
|
||||||
ArrowRightBold,
|
ArrowRightBold,
|
||||||
Loading,
|
Loading,
|
||||||
CirclePlusFilled,
|
CopyDocument,
|
||||||
QuestionFilled
|
QuestionFilled
|
||||||
} from "@element-plus/icons-vue";
|
} from "@element-plus/icons-vue";
|
||||||
import { ElMessage, ElMessageBox } from "element-plus";
|
import { ElMessage, ElMessageBox } from "element-plus";
|
||||||
@ -280,15 +286,17 @@ import { useMenu, useAi } from "../hooks";
|
|||||||
import { isDev } from "/@/config";
|
import { isDev } from "/@/config";
|
||||||
import { useForm } from "@cool-vue/crud";
|
import { useForm } from "@cool-vue/crud";
|
||||||
import * as monaco from "monaco-editor";
|
import * as monaco from "monaco-editor";
|
||||||
import { sleep } from "/@/cool/utils";
|
import { sleep, storage } from "/@/cool/utils";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import { nextTick } from "vue";
|
import { nextTick } from "vue";
|
||||||
import type { CodeItem } from "../types";
|
import type { CodeItem } from "../types";
|
||||||
|
import { useClipboard } from "@vueuse/core";
|
||||||
|
|
||||||
const { service, refs, setRefs, router } = useCool();
|
const { service, refs, setRefs, router } = useCool();
|
||||||
const menu = useMenu();
|
const menu = useMenu();
|
||||||
const ai = useAi();
|
const ai = useAi();
|
||||||
const Form = useForm();
|
const Form = useForm();
|
||||||
|
const { copy } = useClipboard();
|
||||||
|
|
||||||
// 编辑器样式
|
// 编辑器样式
|
||||||
monaco.editor.defineTheme("ai-code--dark", {
|
monaco.editor.defineTheme("ai-code--dark", {
|
||||||
@ -312,7 +320,7 @@ const form = reactive({
|
|||||||
// 执行步骤
|
// 执行步骤
|
||||||
const step = reactive({
|
const step = reactive({
|
||||||
loading: false,
|
loading: false,
|
||||||
value: "start",
|
value: "coding",
|
||||||
list: ["start", "enter", "form", "coding"],
|
list: ["start", "enter", "form", "coding"],
|
||||||
|
|
||||||
async next() {
|
async next() {
|
||||||
@ -368,10 +376,10 @@ const code = reactive({
|
|||||||
active: "",
|
active: "",
|
||||||
|
|
||||||
// 代码列表
|
// 代码列表
|
||||||
list: [] as CodeItem[],
|
list: (storage.get("ai-code.list") || []) as CodeItem[],
|
||||||
|
|
||||||
// 其他数据
|
// 其他数据
|
||||||
data: {} as any,
|
data: (storage.get("ai-code.data") || {}) as any,
|
||||||
|
|
||||||
// 日志
|
// 日志
|
||||||
logs: [] as any[],
|
logs: [] as any[],
|
||||||
@ -488,14 +496,11 @@ const code = reactive({
|
|||||||
const item = code.add("Vue 页面", "vue");
|
const item = code.add("Vue 页面", "vue");
|
||||||
|
|
||||||
code.data = {
|
code.data = {
|
||||||
...form,
|
|
||||||
router: "",
|
router: "",
|
||||||
prefix: "",
|
prefix: "",
|
||||||
path: "",
|
path: "",
|
||||||
module: "",
|
|
||||||
fileName: "",
|
fileName: "",
|
||||||
className: "",
|
className: "",
|
||||||
other: "",
|
|
||||||
columns: [],
|
columns: [],
|
||||||
api: [
|
api: [
|
||||||
{
|
{
|
||||||
@ -522,7 +527,9 @@ const code = reactive({
|
|||||||
path: "/list",
|
path: "/list",
|
||||||
summary: "列表查询"
|
summary: "列表查询"
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
...form,
|
||||||
|
name: form.entity
|
||||||
};
|
};
|
||||||
|
|
||||||
code.tips("Vue 代码生成中");
|
code.tips("Vue 代码生成中");
|
||||||
@ -625,6 +632,17 @@ const code = reactive({
|
|||||||
}
|
}
|
||||||
}, 10);
|
}, 10);
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
copy() {
|
||||||
|
copy(code.getContent(code.active)!);
|
||||||
|
code.save();
|
||||||
|
ElMessage.success("复制成功");
|
||||||
|
},
|
||||||
|
|
||||||
|
save() {
|
||||||
|
storage.set("ai-code.list", code.list);
|
||||||
|
storage.set("ai-code.data", code.data);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -781,9 +799,11 @@ function createFile() {
|
|||||||
saveButtonText: "开始创建"
|
saveButtonText: "开始创建"
|
||||||
},
|
},
|
||||||
on: {
|
on: {
|
||||||
submit(data, { close, done }) {
|
submit(data, { close }) {
|
||||||
code.tips("创建 Vue 文件中,过程可能会发生页面及服务重启");
|
code.tips("创建 Vue 文件中,过程可能会发生页面及服务重启");
|
||||||
|
|
||||||
|
close();
|
||||||
|
|
||||||
// 添加菜单、权限
|
// 添加菜单、权限
|
||||||
menu.create({
|
menu.create({
|
||||||
code: code.getContent("vue"),
|
code: code.getContent("vue"),
|
||||||
@ -791,8 +811,6 @@ function createFile() {
|
|||||||
...data
|
...data
|
||||||
})
|
})
|
||||||
.then((create) => {
|
.then((create) => {
|
||||||
code.tips("创建后端文件中");
|
|
||||||
|
|
||||||
// 创建后端文件
|
// 创建后端文件
|
||||||
service.base.sys.menu.create({
|
service.base.sys.menu.create({
|
||||||
...form,
|
...form,
|
||||||
@ -804,23 +822,21 @@ function createFile() {
|
|||||||
|
|
||||||
// 每3s检测服务状态
|
// 每3s检测服务状态
|
||||||
const timer = setInterval(() => {
|
const timer = setInterval(() => {
|
||||||
code.tips("检测服务中");
|
code.tips("检测后端服务是否启动");
|
||||||
|
|
||||||
service
|
service
|
||||||
.request({
|
.request({
|
||||||
url: "/"
|
url: "/"
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
code.tips("文件创建成功");
|
||||||
ElMessage.success("文件创建成功");
|
ElMessage.success("文件创建成功");
|
||||||
clearInterval(timer);
|
clearInterval(timer);
|
||||||
close();
|
|
||||||
create();
|
create();
|
||||||
});
|
});
|
||||||
}, 3000);
|
}, 3000);
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => null);
|
||||||
done();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
138
src/modules/user/views/address.vue
Normal file
138
src/modules/user/views/address.vue
Normal file
@ -0,0 +1,138 @@
|
|||||||
|
<template>
|
||||||
|
<cl-crud ref="Crud">
|
||||||
|
<cl-row>
|
||||||
|
<!-- 刷新按钮 -->
|
||||||
|
<cl-refresh-btn />
|
||||||
|
<!-- 新增按钮 -->
|
||||||
|
<cl-add-btn />
|
||||||
|
<!-- 删除按钮 -->
|
||||||
|
<cl-multi-delete-btn />
|
||||||
|
<cl-flex1 />
|
||||||
|
<!-- 关键字搜索 -->
|
||||||
|
<cl-search-key />
|
||||||
|
</cl-row>
|
||||||
|
|
||||||
|
<cl-row>
|
||||||
|
<!-- 数据表格 -->
|
||||||
|
<cl-table ref="Table" />
|
||||||
|
</cl-row>
|
||||||
|
|
||||||
|
<cl-row>
|
||||||
|
<cl-flex1 />
|
||||||
|
<!-- 分页控件 -->
|
||||||
|
<cl-pagination />
|
||||||
|
</cl-row>
|
||||||
|
|
||||||
|
<!-- 新增、编辑 -->
|
||||||
|
<cl-upsert ref="Upsert" />
|
||||||
|
</cl-crud>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" name="user-address" setup>
|
||||||
|
import { useCrud, useTable, useUpsert } from "@cool-vue/crud";
|
||||||
|
import { useCool } from "/@/cool";
|
||||||
|
|
||||||
|
const { service } = useCool();
|
||||||
|
|
||||||
|
// cl-upsert
|
||||||
|
const Upsert = useUpsert({
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
label: "用户ID",
|
||||||
|
prop: "userId",
|
||||||
|
hook: "number",
|
||||||
|
component: { name: "el-input-number" },
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "用户名",
|
||||||
|
prop: "username",
|
||||||
|
component: { name: "el-input", props: { clearable: true } },
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "收货人",
|
||||||
|
prop: "receiver",
|
||||||
|
component: { name: "el-input", props: { clearable: true } },
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "手机号",
|
||||||
|
prop: "phone",
|
||||||
|
component: { name: "el-input", props: { clearable: true } },
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "省市区",
|
||||||
|
prop: "pca",
|
||||||
|
hook: "pca",
|
||||||
|
component: { name: "cl-distpicker" },
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "收货地址",
|
||||||
|
prop: "address",
|
||||||
|
component: { name: "el-input", props: { type: "textarea", rows: 4 } },
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "是否默认",
|
||||||
|
prop: "isDefault",
|
||||||
|
flex: false,
|
||||||
|
component: { name: "cl-switch" },
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
// cl-table
|
||||||
|
const Table = useTable({
|
||||||
|
columns: [
|
||||||
|
{ type: "selection" },
|
||||||
|
{ label: "用户ID", prop: "userId", minWidth: 140 },
|
||||||
|
{ label: "用户名", prop: "username", minWidth: 140 },
|
||||||
|
{ label: "收货人", prop: "receiver", minWidth: 140 },
|
||||||
|
{ label: "手机号", prop: "phone", minWidth: 140 },
|
||||||
|
{
|
||||||
|
label: "省市区",
|
||||||
|
prop: "province",
|
||||||
|
minWidth: 160,
|
||||||
|
formatter(row) {
|
||||||
|
return row.province + "-" + row.city + "-" + row.district;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ label: "收货地址", prop: "address", showOverflowTooltip: true, minWidth: 200 },
|
||||||
|
{
|
||||||
|
label: "是否默认",
|
||||||
|
prop: "isDefault",
|
||||||
|
minWidth: 100,
|
||||||
|
component: { name: "cl-switch" }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "创建时间",
|
||||||
|
prop: "createTime",
|
||||||
|
minWidth: 170,
|
||||||
|
sortable: "custom",
|
||||||
|
component: { name: "cl-date-text" }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "更新时间",
|
||||||
|
prop: "updateTime",
|
||||||
|
minWidth: 170,
|
||||||
|
sortable: "custom",
|
||||||
|
component: { name: "cl-date-text" }
|
||||||
|
},
|
||||||
|
{ type: "op", buttons: ["edit", "delete"] }
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
// cl-crud
|
||||||
|
const Crud = useCrud(
|
||||||
|
{
|
||||||
|
service: service.user.address
|
||||||
|
},
|
||||||
|
(app) => {
|
||||||
|
app.refresh();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
</script>
|
||||||
Loading…
x
Reference in New Issue
Block a user