Bläddra i källkod

fix(api): 更新API

gemercheung 3 år sedan
förälder
incheckning
4c019c16c4
2 ändrade filer med 13 tillägg och 7 borttagningar
  1. 1 1
      src/views/staff/list.vue
  2. 12 6
      src/views/staff/setpaswordModal.vue

+ 1 - 1
src/views/staff/list.vue

@@ -107,7 +107,7 @@
           dataIndex: '',
           slots: { customRender: 'action' },
           fixed: 'right',
-          width: isJA.value ? 170 : 120,
+          width: isJA.value ? 160 : 120,
         },
       ];
 

+ 12 - 6
src/views/staff/setpaswordModal.vue

@@ -5,19 +5,24 @@
     @ok="handSubmit"
     :title="t('routes.personalSetting.updateBtn')"
     @visible-change="handleVisibleChange"
+    @cancel="resetFields"
   >
     <div class="pt-3px pr-3px">
-      <BasicForm @register="registerForm" :model="model" />
+      <BasicForm @register="registerForm" />
     </div>
   </BasicModal>
 </template>
 <script lang="ts">
   import { useI18n } from '/@/hooks/web/useI18n';
   import { encodeStr } from '/@/utils/encodeUtil';
-  import { defineComponent, ref, nextTick } from 'vue';
+  import { defineComponent, nextTick } from 'vue';
   import { BasicModal, useModalInner } from '/@/components/Modal';
   import { BasicForm, FormSchema, useForm } from '/@/components/Form/index';
   import { updatePasswordApi } from '/@/api/sys/user';
+  import { useMessage } from '/@/hooks/web/useMessage';
+
+  const { createMessage } = useMessage();
+
   export default defineComponent({
     components: { BasicModal, BasicForm },
     props: {
@@ -41,7 +46,7 @@
           colProps: { span: 18 },
         },
       ];
-      const modelRef = ref({});
+
       const [
         registerForm,
         {
@@ -70,11 +75,12 @@
       }
       async function handSubmit() {
         const { id, password } = await validate();
-        updatePasswordApi({ id, password: encodeStr(window.btoa(password)) });
+        await updatePasswordApi({ id, password: encodeStr(window.btoa(password)) });
+        createMessage.success(t('common.optSuccess'));
+        resetFields();
       }
       function handleVisibleChange(v) {
         v && props.userData && nextTick(() => onDataReceive(props.userData));
-        resetFields();
       }
 
       return {
@@ -83,8 +89,8 @@
         t,
         schemas,
         registerForm,
-        model: modelRef,
         handleVisibleChange,
+        resetFields,
       };
     },
   });