Browse Source

保存和新增

master
zhanglei 1 week ago
parent
commit
1c9091c128
  1. 8
      config.yml
  2. 6
      db.py
  3. 1
      frontend_vue.py
  4. 8
      templates/vue/api.ts.j2
  5. 5
      vue-vben-admin/.changeset/README.md
  6. 18
      vue-vben-admin/.changeset/config.json
  7. 2
      vue-vben-admin/apps/web-antd/.env.development
  8. 2
      vue-vben-admin/apps/web-antd/.env.production
  9. 13
      vue-vben-admin/apps/web-antd/src/api/user.ts

8
config.yml

@ -31,11 +31,11 @@ package:
# 数据库配置
# ===============================
db:
host: 192.168.1.80
port: 3728
host: 192.168.1.87
port: 3306
user: root
password: Khq#P9hZ4L@EwCZw
database: health_ai_b
password: 5ea47c0bdd7146ebbd53020eca@672307
database: health_ai_manage
# ===============================
# 应用级配置

6
db.py

@ -1,5 +1,9 @@
import pymysql
from config import DB
import yaml
with open("./config.yml", "r", encoding="utf-8") as f:
cfg = yaml.safe_load(f)
DB = cfg["db"]
def get_conn():
return pymysql.connect(

1
frontend_vue.py

@ -55,7 +55,6 @@ def generate(table):
"fields":build_fields(table)
}
print(ctx)
render(
"api.ts.j2",
f"{API_DIR}/{entity}.ts",

8
templates/vue/api.ts.j2

@ -16,7 +16,7 @@ export namespace {{entity}}Api {
*/
export function page(params: any) {
return requestClient.post(applicationConfig.javaURL+'/{{old_table}}/page', params,
{ headers: {'Content-Type': 'application/json', Token: 'ded93460-0cf5-45db-81ae-7608dbd3f51e', version: '1.0.1', familyId: 0}});
{ headers: {'Content-Type': 'application/json', Token: '917e9898-8a0a-4079-a16a-e456457e070c', version: '1.0.1', familyId: 0}});
}
/**
@ -31,7 +31,7 @@ export namespace {{entity}}Api {
*/
export function add(data: any) {
return requestClient.post(applicationConfig.javaURL+'/{{old_table}}/add', data,
{ headers: {'Content-Type': 'application/json', Token: 'ded93460-0cf5-45db-81ae-7608dbd3f51e', version: '1.0.1', familyId: 0}});
{ headers: {'Content-Type': 'application/json', Token: '917e9898-8a0a-4079-a16a-e456457e070c', version: '1.0.1', familyId: 0}});
}
/**
@ -39,7 +39,7 @@ export namespace {{entity}}Api {
*/
export function save(data: any) {
return requestClient.post(applicationConfig.javaURL+'/{{old_table}}/modify', data,
{ headers: {'Content-Type': 'application/json', Token: 'ded93460-0cf5-45db-81ae-7608dbd3f51e', version: '1.0.1', familyId: 0}});
{ headers: {'Content-Type': 'application/json', Token: '917e9898-8a0a-4079-a16a-e456457e070c', version: '1.0.1', familyId: 0}});
}
/**
@ -53,7 +53,7 @@ export namespace {{entity}}Api {
* 枚举列表
*/
export function enumList(params: any) {
return requestClient.post(applicationConfig.javaURL+'/health-enums/optionList', params,{ headers: {'Content-Type': 'application/json', Token: 'ded93460-0cf5-45db-81ae-7608dbd3f51e', version: '1.0.1'}});
return requestClient.post(applicationConfig.javaURL+'/health-enums/optionList', params,{ headers: {'Content-Type': 'application/json', Token: '917e9898-8a0a-4079-a16a-e456457e070c', version: '1.0.1'}});
}
}

5
vue-vben-admin/.changeset/README.md

@ -0,0 +1,5 @@
# Changesets
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works with multi-package repos, or single-package repos to help you version and publish your code. You can find the full documentation for it [in our repository](https://github.com/changesets/changesets)
We have a quick list of common questions to get you started engaging with this project in [our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)

18
vue-vben-admin/.changeset/config.json

@ -0,0 +1,18 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.0.0/schema.json",
"changelog": [
"@changesets/changelog-github",
{ "repo": "vbenjs/vue-vben-admin" }
],
"commit": false,
"fixed": [["@vben-core/*", "@vben/*"]],
"snapshot": {
"prereleaseTemplate": "{tag}-{datetime}"
},
"privatePackages": { "version": true, "tag": true },
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}

2
vue-vben-admin/apps/web-antd/.env.development

@ -6,7 +6,7 @@ VITE_BASE=/
# 接口地址
VITE_GLOB_API_URL=/api
# VITE_GLOB_API_URL=http://localhost:8083/api/models
VITE_GLOB_JAVA_API_URL=http://192.168.1.47:8083/api/models
VITE_GLOB_JAVA_API_URL=http://192.168.1.87:8084/mg/models
# 是否开启 Nitro Mock服务,true 为开启,false 为关闭
VITE_NITRO_MOCK=true

2
vue-vben-admin/apps/web-antd/.env.production

@ -4,7 +4,7 @@ VITE_BASE=/
VITE_GLOB_API_URL=https://mock-napi.vben.pro/api
# VITE_GLOB_API_URL=http://localhost:8083/api/models
VITE_GLOB_JAVA_API_URL=http://192.168.1.47:8083/api/models
VITE_GLOB_JAVA_API_URL=http://192.168.1.87:8084/mg/models
# 是否开启压缩,可以设置为 none, brotli, gzip
VITE_COMPRESS=none

13
vue-vben-admin/apps/web-antd/src/api/user.ts

@ -27,10 +27,19 @@ export namespace userApi {
}
/**
* /
*
*/
export function add(data: any) {
return requestClient.post(applicationConfig.javaURL+'/health-user/add', data,
{ headers: {'Content-Type': 'application/json', Token: 'ded93460-0cf5-45db-81ae-7608dbd3f51e', version: '1.0.1', familyId: 0}});
}
/**
*
*/
export function save(data: any) {
return requestClient.post(applicationConfig.javaURL+'/health-user', data);
return requestClient.post(applicationConfig.javaURL+'/health-user/modify', data,
{ headers: {'Content-Type': 'application/json', Token: 'ded93460-0cf5-45db-81ae-7608dbd3f51e', version: '1.0.1', familyId: 0}});
}
/**

Loading…
Cancel
Save