5 changed files with 143 additions and 16 deletions
-
17src/services/liquid/liquidManage.ts
-
2src/services/txn.ts
-
2src/views/debug/debug.vue
-
35src/views/liquidConfig/components/AddLiquid.vue
-
103src/views/liquidConfig/index.vue
@ -0,0 +1,17 @@ |
|||
import type { BaseResponse } from "../httpRequest"; |
|||
import httpRequest from "../httpRequest"; |
|||
|
|||
export type Liquid = { |
|||
id: number; |
|||
name: string; |
|||
} |
|||
|
|||
export function getLiquidList(params: { pageNum: number; pageSize: number }) { |
|||
return httpRequest<BaseResponse<{ list: Liquid[]; total: number }>>({ url: "/api/sols/list", params }); |
|||
} |
|||
export function createLiquid(params: { name: string; }) { |
|||
return httpRequest<BaseResponse>({ url: "/api/sols/", method: "POST", params }); |
|||
} |
|||
export function deleteLiquid(ids: string) { |
|||
return httpRequest<BaseResponse>({ url: `/api/sols/${ids}`, method: "DELETE" }); |
|||
} |
@ -0,0 +1,35 @@ |
|||
<template> |
|||
<div class="bg-white text-xl text-text px-5 py-7 rounded"> |
|||
<h1 class="font-medium">新增溶液</h1> |
|||
<section> |
|||
<div class="grid grid-cols-[5rem_1fr] gap-x-8 gap-y-4 min-w-[30rem] mt-4 mb-7 px-4"> |
|||
<span class="text-right">溶液名称</span> |
|||
<input type="text" class="border border-[#eee] rounded-sm px-2" v-model="name" /> |
|||
</div> |
|||
</section> |
|||
<footer class="flex justify-center gap-x-6"> |
|||
<button class="btn-dark px-6 py-1" @click="onConfirm">确定</button> |
|||
<button class="btn-light px-6 py-1" @click="$emit('cancel')">取消</button> |
|||
</footer> |
|||
</div> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import { showToast } from "vant"; |
|||
import { ref } from "vue"; |
|||
|
|||
const emit = defineEmits<{ |
|||
(e: "confirm", name: string): void; |
|||
(e: "cancel"): void; |
|||
}>(); |
|||
|
|||
const name = ref<string>(''); |
|||
|
|||
function onConfirm() { |
|||
if (name.value === "") { |
|||
showToast("名称不能为空") |
|||
return |
|||
} |
|||
emit("confirm", name.value); |
|||
} |
|||
</script> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue