From 8632c1c6069915df1c57c9940ac4891bf4cf7524 Mon Sep 17 00:00:00 2001 From: callmeyan Date: Sun, 20 Jul 2025 14:56:11 +0800 Subject: [PATCH] =?UTF-8?q?feat(data-input):=20=E6=96=B0=E5=A2=9E=E8=BE=93?= =?UTF-8?q?=E5=85=A5=E6=8C=87=E6=A0=87=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 输入指标改为数据库管理并绑定到药品数据 --- package.json | 2 +- src/components/calc/index.vue | 293 +++++++++--------- src/components/editor/tiptap.vue | 2 +- src/pages/Layout.vue | 2 +- src/pages/input/index.vue | 13 + src/pages/product/index.vue | 12 +- src/pages/product/input/index.vue | 161 ++++++++++ src/pages/result/components/input-setting.vue | 251 +++++++-------- src/pages/user/index.vue | 26 +- src/pages/user/modal.vue | 2 +- src/router.ts | 10 +- src/service/api/product.ts | 17 + src/service/use-result-vars.ts | 52 ---- src/style.scss | 23 +- src/types/product.d.ts | 25 +- tailwind.config.js | 2 +- vite.config.ts | 2 +- 17 files changed, 545 insertions(+), 350 deletions(-) create mode 100644 src/pages/input/index.vue create mode 100644 src/pages/product/input/index.vue diff --git a/package.json b/package.json index 28acb5c..a8a4af5 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "@tiptap/vue-3": "^2.10.4", "ant-design-vue": "^4.2.6", "autoprefixer": "^10.4.20", - "axios": "^1.7.9", + "axios": "^1.8.2", "dayjs": "^1.11.13", "js-md5": "^0.8.3", "pinia": "^2.3.0", diff --git a/src/components/calc/index.vue b/src/components/calc/index.vue index 3b7ec7f..ff62835 100644 --- a/src/components/calc/index.vue +++ b/src/components/calc/index.vue @@ -1,179 +1,194 @@ \ No newline at end of file diff --git a/src/components/editor/tiptap.vue b/src/components/editor/tiptap.vue index ddee012..acc99d7 100644 --- a/src/components/editor/tiptap.vue +++ b/src/components/editor/tiptap.vue @@ -65,7 +65,7 @@ onUnmounted(() => { editor.destroy() }) - \ No newline at end of file diff --git a/src/pages/product/index.vue b/src/pages/product/index.vue index e73e5df..7a6c32f 100644 --- a/src/pages/product/index.vue +++ b/src/pages/product/index.vue @@ -13,9 +13,11 @@ import { ProductCols } from "@/service/api/product"; import { getList, deleteProduct } from "@/service/api/product"; import useRequest from "@/service/useRequest"; import EditModal from "./edit-modal.vue" +import ProductInputModal from "./input/index.vue" const editProduct = ref>(); +const productInput = ref>(); // const formState = ref<{name?:string;category?:string}>({ // }) const searchParams = ref({ @@ -90,14 +92,16 @@ function handleSearch(){ 制剂别名 类型 {{ th.name }} - 计量单位 - 操作 + 计量单位 + 操作 {{ tr.name }} - {{ tr.alias }} + + {{ tr.alias }} + {{ tr.category == 'gut'?'肠内制剂':'静脉制剂' }} {{ (tr as any)[th.alias] || 'NULL' }} @@ -105,6 +109,7 @@ function handleSearch(){ 编辑 + 输入指标 删除 @@ -122,6 +127,7 @@ function handleSearch(){ + diff --git a/src/pages/product/input/index.vue b/src/pages/product/input/index.vue new file mode 100644 index 0000000..ed435fd --- /dev/null +++ b/src/pages/product/input/index.vue @@ -0,0 +1,161 @@ + + + \ No newline at end of file diff --git a/src/pages/result/components/input-setting.vue b/src/pages/result/components/input-setting.vue index 488381b..9d5f52a 100644 --- a/src/pages/result/components/input-setting.vue +++ b/src/pages/result/components/input-setting.vue @@ -1,157 +1,164 @@ \ No newline at end of file diff --git a/src/pages/user/index.vue b/src/pages/user/index.vue index baf65f4..6b23f5c 100644 --- a/src/pages/user/index.vue +++ b/src/pages/user/index.vue @@ -59,28 +59,28 @@ function handleSearch() {
- - +
+
姓名 - - - + +
+
账号 - - - + +
+
类型 - {{ it.label }} - - +
+
- - +
+
diff --git a/src/pages/user/modal.vue b/src/pages/user/modal.vue index d1c9942..7f790bd 100644 --- a/src/pages/user/modal.vue +++ b/src/pages/user/modal.vue @@ -70,7 +70,7 @@ function onValuesChange() { diff --git a/src/router.ts b/src/router.ts index 58c46cb..6896fa6 100644 --- a/src/router.ts +++ b/src/router.ts @@ -32,13 +32,13 @@ export const routes:RouteRecordRaw[] = [ component: () => import('./pages/result/index.vue') }, // { - // path: 'ttt', - // name: 'ttt', + // path: 'input', + // name: 'input', // meta: { - // title: '输出计算', - // icon:'icon-calculator' + // title: '输入指标', + // icon:'icon-add' // }, - // component: () => import('./pages/T.vue') + // component: () => import('./pages/input/index.vue') // }, { path: 'product-data', diff --git a/src/service/api/product.ts b/src/service/api/product.ts index 84d2be0..4ba6507 100644 --- a/src/service/api/product.ts +++ b/src/service/api/product.ts @@ -18,6 +18,17 @@ export async function getList(param: ProductSearchParam) { await sleep(200); return await post>(`/product/all`, param); } +export async function getProductDataInput(product_id: number) { + await sleep(200); + return await post>(`/input/all`, { product_id }); +} +export async function saveProductDataInput(data: Partial) { + await sleep(200); + return await post>(`/input/save`, data); +} +export async function deleteProductDataInput(id: number) { + return await post>(`/input/delete`, { id }); +} export function deleteProduct(id: number) { return post(`/product/delete`, { id }) @@ -26,3 +37,9 @@ export async function saveProduct(params: Partial) { await sleep(200); return await post(`/product/save`, params); } + + +export async function getAllProductInput(){ + const result = await post>(`/input/all`) + return result.list; +} \ No newline at end of file diff --git a/src/service/use-result-vars.ts b/src/service/use-result-vars.ts index 39ac2e7..3dc8cbf 100644 --- a/src/service/use-result-vars.ts +++ b/src/service/use-result-vars.ts @@ -14,58 +14,6 @@ type InputValue = { } } -/* -{ - "weight": 50, - "niaosu": 12, - "ruineng": 10, - "ruidai": 0, - "ruixian": 0, - "ruigao": 0, - "ruisu": 0, - "nengquanli": 0, - "kangquanli": 0, - "kangquangan": 0, - "baipuli": 0, - "ailunduo": 0, - "weiwo": 0, - "jiaweiti": 0, - "yilijia": 0, - "ruiyixi": 0, - "nengquansu": 0, - "ansu": 0, - "quanansu": 0, - "yilijia100": 0, - "shui": 0, - "anjisuan_ruye": 0, - "yilijia100_ruye": 0, - "quanansu_ruye": 0, - "ansu_ruye": 0, - "nengquansu_ruye": 0, - "ruqingdanbailiang": 0, - "ruianji": 0, - "quanyingda": 0, - "likawen": 0, - "lefanming85": 0, - "lefanming114": 0, - "anjisuan": 0, - "litai": 0, - "lineng": 0, - "liwen": 0, - "youwen": 0, - "yingtuolipite20": 0, - "yingtuolipite30": 0, - "putaotangluhuana5": 0, - "putaotang5": 0, - "putaotang10": 0, - "putaotang50": 0, - "luhuana09": 0, - "luhuana10": 0, - "geliefusi": 0, - "luhuajia": 0, - "baidanbai": 0 -} - */ const inputList: InputValue[] = [ {name: '体重', key: 'weight',}, {name: '24h尿素', key: 'niaosu',}, diff --git a/src/style.scss b/src/style.scss index 3a7712e..fcc5bf2 100644 --- a/src/style.scss +++ b/src/style.scss @@ -54,7 +54,12 @@ .overflow-auto{ scrollbar-gutter: stable; } - +th,td{ + text-align: left; +} +.text-center{ + text-align: center; +} [type=reset], [type=submit], button, @@ -210,12 +215,12 @@ img { } .menu-text{ display: block; - @include media-breakpoint-down(lg) { - font-size: 12px;; - } - @include media-breakpoint-down(md) { - display: none; - } + //@include media-breakpoint-down(lg) { + // font-size: 12px;; + //} + //@include media-breakpoint-down(md) { + // display: none; + //} } .search-form { @@ -261,11 +266,11 @@ img { min-width: 0; -webkit-box-sizing: border-box; box-sizing: border-box; - text-align: left; + overflow: hidden; text-overflow: ellipsis; vertical-align: middle; border-bottom: 1px solid #e8e8ec; - padding: 15px 16px; + padding: 15px 10px; } th { diff --git a/src/types/product.d.ts b/src/types/product.d.ts index 7f3171a..d7378d0 100644 --- a/src/types/product.d.ts +++ b/src/types/product.d.ts @@ -25,6 +25,28 @@ declare type ProductInfoModel = { updated_at: Date | string; status: number; } +interface ProductDataInputModel { + id: number; + /** + * 产品ID(ProductInfoModel.id) + */ + product_id: number; + /** + * 输入名称 + */ + name: string; + /** + * 输入项对应变量名 + */ + key: string; + type?: string; + placeholder: string; + unit: string; + + created_at: Date | string; + updated_at: Date | string; + status: number; +} declare type ResultExpression = { id: number; @@ -63,4 +85,5 @@ interface ResultItem { title:string; key:string; value:number; -} \ No newline at end of file +} + diff --git a/tailwind.config.js b/tailwind.config.js index c1172d6..f257d03 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -16,7 +16,7 @@ const themeConfig = { export default { content: [ './index.html', - './src/**/*.{mjs,js,ts,jsx,tsx,html,vue}' + './src/**/*.{mjs,js,ts,jsx,tsx,html,vue,scss}' ], theme: { extend: { diff --git a/vite.config.ts b/vite.config.ts index 378c201..c22a2ec 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -6,7 +6,7 @@ console.log( ['NODE', 'NODE_ENV', 'npm_execpath', 'OS'].map(key => (process.env[key])) ) const devServer = { - default: 'http://localhost:3001', + default: 'http://localhost:23002', test: 'http://43.136.175.109:50001' }