|
|
@@ -0,0 +1,97 @@
|
|
|
+<template>
|
|
|
+ <div class="p-2">
|
|
|
+ <el-card shadow="hover">
|
|
|
+ <!-- 页面标题 -->
|
|
|
+ <div class="mb-[10px] text-sm font-medium">牌局测试工具</div>
|
|
|
+
|
|
|
+ <!-- 表单区域 -->
|
|
|
+ <el-form ref="cardToolsFormRef" :model="form" label-width="80px">
|
|
|
+ <el-form-item label="整牌设置">
|
|
|
+ <el-input v-model="form.content" type="textarea" :rows="3" placeholder="请按输入" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+
|
|
|
+ <!-- 操作按钮 -->
|
|
|
+ <div class="flex justify-center items-center space-x-4 mb-4">
|
|
|
+ <el-button type="primary" @click="submitForm">生 效</el-button>
|
|
|
+ <!-- <el-button @click="resetForm">取消生效</el-button>-->
|
|
|
+ </div>
|
|
|
+ </el-card>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup name="CardTools" lang="ts">
|
|
|
+import { ref, reactive } from 'vue';
|
|
|
+import { addCardTools, selectBusinessCardToolsMaxNew } from '@/api/system/business/cardTools';
|
|
|
+import { CardToolsForm } from '@/api/system/business/cardTools/types';
|
|
|
+
|
|
|
+// 设置默认值
|
|
|
+const defaultContent = 'AS,AH,KS,KH,QS,QH,JSJH,TS,TH,9S,9H,8S,8H,7S,7H,6S,6H,5S,5H,5D,5C,4H';
|
|
|
+
|
|
|
+const form = reactive<CardToolsForm>({
|
|
|
+ content: defaultContent // 设置默认值
|
|
|
+});
|
|
|
+
|
|
|
+/** 提交表单 */
|
|
|
+const submitForm = () => {
|
|
|
+ // 调用 addCardTools 接口
|
|
|
+ addCardTools({
|
|
|
+ content: form.content
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ proxy?.$modal.msgSuccess('生效成功');
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ let proxy;
|
|
|
+ proxy?.$modal.msgError('生效失败');
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+/** 重置表单 */
|
|
|
+const resetForm = () => {
|
|
|
+ form.content = defaultContent; // 重置为默认值
|
|
|
+};
|
|
|
+
|
|
|
+/** 获取上一次写入的数据 */
|
|
|
+const loadLastContent = async () => {
|
|
|
+ try {
|
|
|
+ const res = await selectBusinessCardToolsMaxNew();
|
|
|
+ if (res.data && res.data.content) {
|
|
|
+ form.content = res.data.content;
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error('获取上一次数据失败:', error);
|
|
|
+ // 如果获取失败,使用默认值
|
|
|
+ form.content = defaultContent;
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+// 页面加载时获取上一次的数据
|
|
|
+onMounted(() => {
|
|
|
+ loadLastContent();
|
|
|
+});
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+.flex {
|
|
|
+ display: flex;
|
|
|
+}
|
|
|
+.justify-center {
|
|
|
+ justify-content: center;
|
|
|
+}
|
|
|
+.items-center {
|
|
|
+ align-items: center;
|
|
|
+}
|
|
|
+.space-x-4 {
|
|
|
+ gap: 1rem;
|
|
|
+}
|
|
|
+.mb-4 {
|
|
|
+ margin-bottom: 1rem;
|
|
|
+}
|
|
|
+.text-center {
|
|
|
+ text-align: center;
|
|
|
+}
|
|
|
+.font-bold {
|
|
|
+ font-weight: bold;
|
|
|
+}
|
|
|
+</style>
|