Browse Source

fix: 修改签到输入关闭后无法输入的问题

曾坤森 3 tháng trước cách đây
mục cha
commit
548414b696
1 tập tin đã thay đổi với 10 bổ sung6 xóa
  1. 10 6
      src/components/business/CheckIn/index.vue

+ 10 - 6
src/components/business/CheckIn/index.vue

@@ -8,7 +8,7 @@
     >
       <a-form :model="form">
         <a-form-item field="name" label="ID">
-          <a-input v-model="form.id" />
+          <a-input v-model="form.id" placeholder="ID" />
         </a-form-item>
       </a-form>
     </a-modal>
@@ -19,6 +19,10 @@ import { reactive, ref, shallowRef, watch, getCurrentInstance } from 'vue';
 import { fetchCheckIn } from '@/api/record';
 import dayjs from 'dayjs';
 const this_ = getCurrentInstance()?.appContext.config.globalProperties;
+interface CheckIn {
+  id: string;
+  time: string;
+}
 interface CheckInPageProps {
   modelValue: boolean;
 }
@@ -37,16 +41,16 @@ watch(
     visible.value = value;
   }
 );
-let form = reactive({
+const form = ref<CheckIn>({
   id: '',
   time: '',
 });
 
 const handleBeforeOk = (done: (closed: boolean) => void) => {
-  form.time = dayjs().format('YYYY-MM-DD HH:mm:ss');
-  fetchCheckIn(form)
+  form.value.time = dayjs().format('YYYY-MM-DD HH:mm:ss');
+  fetchCheckIn(form.value)
     .then(res => {
-      this_?.$message?.success('签到成功');
+      this_?.$message.success('签到成功');
       done(true); // 关闭模态框
       handleCancel();
     })
@@ -55,7 +59,7 @@ const handleBeforeOk = (done: (closed: boolean) => void) => {
     });
 };
 const handleCancel = () => {
-  form = {
+  form.value = {
     id: '',
     time: '',
   };