From 7cf58a4d2fff6b9cba9029d4d43ba9744dbef864 Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期四, 18 七月 2024 15:49:03 +0800
Subject: [PATCH] 工单更新

---
 src/views/demo/page/form/step/Step2.vue |  117 +++++++++++++++++++++++++---------------------------------
 1 files changed, 50 insertions(+), 67 deletions(-)

diff --git a/src/views/demo/page/form/step/Step2.vue b/src/views/demo/page/form/step/Step2.vue
index 75ae50c..193f3fa 100644
--- a/src/views/demo/page/form/step/Step2.vue
+++ b/src/views/demo/page/form/step/Step2.vue
@@ -1,78 +1,61 @@
 <template>
-  <div class="step2">
-    <a-alert message="纭杞处鍚庯紝璧勯噾灏嗙洿鎺ユ墦鍏ュ鏂硅处鎴凤紝鏃犳硶閫�鍥炪��" show-icon />
-    <a-descriptions :column="1" class="mt-5">
-      <a-descriptions-item label="浠樻璐︽埛"> ant-design@alipay.com </a-descriptions-item>
-      <a-descriptions-item label="鏀舵璐︽埛"> test@example.com </a-descriptions-item>
-      <a-descriptions-item label="鏀舵浜哄鍚�"> Vben </a-descriptions-item>
-      <a-descriptions-item label="杞处閲戦"> 500鍏� </a-descriptions-item>
-    </a-descriptions>
-    <a-divider />
+  <div class="w-120 m-auto">
+    <Alert message="纭杞处鍚庯紝璧勯噾灏嗙洿鎺ユ墦鍏ュ鏂硅处鎴凤紝鏃犳硶閫�鍥炪��" show-icon />
+    <Descriptions :column="1" class="mt-5">
+      <Descriptions.Item label="浠樻璐︽埛"> ant-design@alipay.com </Descriptions.Item>
+      <Descriptions.Item label="鏀舵璐︽埛"> test@example.com </Descriptions.Item>
+      <Descriptions.Item label="鏀舵浜哄鍚�"> Vben </Descriptions.Item>
+      <Descriptions.Item label="杞处閲戦"> 500鍏� </Descriptions.Item>
+    </Descriptions>
+    <Divider />
     <BasicForm @register="register" />
   </div>
 </template>
-<script lang="ts">
-  import { defineComponent } from 'vue';
-  import { BasicForm, useForm } from '/@/components/Form';
+<script lang="ts" setup>
+  import { BasicForm, useForm } from '@/components/Form';
   import { step2Schemas } from './data';
   import { Alert, Divider, Descriptions } from 'ant-design-vue';
 
-  export default defineComponent({
-    components: {
-      BasicForm,
-      [Alert.name]: Alert,
-      [Divider.name]: Divider,
-      [Descriptions.name]: Descriptions,
-      [Descriptions.Item.name]: Descriptions.Item,
+  const emit = defineEmits(['next', 'prev']);
+
+  const [register, { validate, setProps }] = useForm({
+    labelWidth: 80,
+    schemas: step2Schemas,
+    actionColOptions: {
+      span: 14,
     },
-    emits: ['next', 'prev'],
-    setup(_, { emit }) {
-      const [register, { validate, setProps }] = useForm({
-        labelWidth: 80,
-        schemas: step2Schemas,
-        actionColOptions: {
-          span: 14,
-        },
-        resetButtonOptions: {
-          text: '涓婁竴姝�',
-        },
-        submitButtonOptions: {
-          text: '鎻愪氦',
-        },
-        resetFunc: customResetFunc,
-        submitFunc: customSubmitFunc,
-      });
-
-      async function customResetFunc() {
-        emit('prev');
-      }
-
-      async function customSubmitFunc() {
-        try {
-          const values = await validate();
-          setProps({
-            submitButtonOptions: {
-              loading: true,
-            },
-          });
-          setTimeout(() => {
-            setProps({
-              submitButtonOptions: {
-                loading: false,
-              },
-            });
-            emit('next', values);
-          }, 1500);
-        } catch (error) {}
-      }
-
-      return { register };
+    resetButtonOptions: {
+      text: '涓婁竴姝�',
     },
+    submitButtonOptions: {
+      text: '鎻愪氦',
+    },
+    resetFunc: customResetFunc,
+    submitFunc: customSubmitFunc,
   });
-</script>
-<style lang="less" scoped>
-  .step2 {
-    width: 450px;
-    margin: 0 auto;
+
+  async function customResetFunc() {
+    emit('prev');
   }
-</style>
+
+  async function customSubmitFunc() {
+    try {
+      const values = await validate();
+      setProps({
+        submitButtonOptions: {
+          loading: true,
+        },
+      });
+      setTimeout(() => {
+        setProps({
+          submitButtonOptions: {
+            loading: false,
+          },
+        });
+        emit('next', values);
+      }, 1500);
+    } catch (error) {
+      console.error(error);
+    }
+  }
+</script>

--
Gitblit v1.9.3