Przeglądaj źródła

fix(bugs): 修改密码

tangning 3 lat temu
rodzic
commit
e4eea05483

+ 1 - 1
src/api/sys/model/userModel.ts

@@ -27,7 +27,7 @@ export interface LoginParams {
 export interface updateUserInfoPasswordParam {
   id: string | number;
   password: string;
-  newPassword: string;
+  newPassword?: string;
 }
 
 export interface RoleInfo {

BIN
src/assets/images/header.jpg


+ 1 - 1
src/locales/lang/ja/routes/corporation.ts

@@ -2,7 +2,7 @@ export default {
   recharge: '充電する',
   device: '装置',
   deviceId: '装置ID',
-  sub_account: 'サブアカウント',
+  sub_account: '従業員アカウント',
   stateName: {
     0: 'レビュー中',
     1: '合格しました',

+ 1 - 0
src/locales/lang/ja/routes/devices.ts

@@ -1,4 +1,5 @@
 export default {
+  add: '新規作成',
   title: '员工账号',
   listTile: '従業員アカウントリスト',
   deviceList: 'ステータス',

+ 1 - 0
src/locales/lang/ja/routes/personalSetting.ts

@@ -5,4 +5,5 @@ export default {
   updateBtn: 'パスワードの変更',
   oldPassword: '以前のパスワード',
   newPassword: '新しいパスワード',
+  password: 'パスワード',
 };

+ 1 - 0
src/locales/lang/ja/routes/staff.ts

@@ -1,5 +1,6 @@
 export default {
   deptName: '関係会社',
+  setpaswd: 'パスワードの変更',
   userName: '従業員メールボックス',
   nickName: '従業員名',
   mobile: '携帯電話',

+ 1 - 1
src/locales/lang/zh-CN/routes/corporation.ts

@@ -2,7 +2,7 @@ export default {
   recharge: '充值',
   device: '设备',
   deviceId: '设备ID',
-  sub_account: '子账号',
+  sub_account: '员工账户',
   stateName: {
     0: '审核中',
     1: '已通过',

+ 1 - 0
src/locales/lang/zh-CN/routes/devices.ts

@@ -1,4 +1,5 @@
 export default {
+  add: '新增',
   title: '员工账号',
   addBut: '新增员工账号',
   listTile: '员工账号列表',

+ 1 - 0
src/locales/lang/zh-CN/routes/personalSetting.ts

@@ -5,4 +5,5 @@ export default {
   updateBtn: '修改密码',
   oldPassword: '旧密码',
   newPassword: '新密码',
+  password: '密码',
 };

+ 1 - 0
src/locales/lang/zh-CN/routes/staff.ts

@@ -1,6 +1,7 @@
 export default {
   deptName: '所属公司',
   userName: '员工邮箱',
+  setpaswd: '修改密码',
   nickName: '员工姓名',
   mobile: '手机',
   createTime: '创建时间',

+ 6 - 1
src/views/corporation/SubaccountModal.vue

@@ -23,7 +23,7 @@
             type="primary"
             preIcon="ic:outline-person-add"
           >
-            {{ t('routes.devices.title') }}
+            {{ t('routes.devices.add') }}{{ t('routes.devices.title') }}
           </a-button>
         </template>
       </BasicForm>
@@ -151,6 +151,7 @@
         {
           setFieldsValue,
           resetFields,
+          getFieldsValue,
           // setProps,
         },
       ] = useForm({
@@ -264,7 +265,11 @@
         console.log('addTabledata', val);
       }
       function getTableList(callback) {
+        let data = getFieldsValue();
         let tableList = unref(getDataSource());
+        setFieldsValue({
+          subNum: Number(data.subNum) - 1,
+        });
         callback(tableList);
       }
       function handleAddUser(newUser) {

+ 1 - 0
src/views/devices/AddModal.vue

@@ -221,6 +221,7 @@
           } else {
             emit('update');
             closeModal();
+            resetFields();
           }
         } catch (error) {
           console.log('not passing', error);

+ 5 - 5
src/views/devices/list.vue

@@ -92,11 +92,11 @@
           dataIndex: 'wifiName',
           width: 180,
         },
-        // {
-        //   title: t('routes.devices.activationTime'),
-        //   dataIndex: 'activatedTime',
-        //   width: 150,
-        // },
+        {
+          title: t('routes.devices.activationTime'),
+          dataIndex: 'activatedTime',
+          width: 150,
+        },
         {
           title: t('routes.devices.shipmentType'),
           dataIndex: 'own',

+ 26 - 21
src/views/staff/list.vue

@@ -10,29 +10,27 @@
       </template>
       <!-- <template #createTime="{ record }">
         <Time v-if="record.createTime" :value="record.createTime" mode="datetime" />
-      </template> -->
-      <template #action="{ record }">
-        <TableAction
-          :actions="[
-            {
-              icon: 'mdi:information-outline',
-              label: t('common.details'),
-              onClick: () => {
-                go(`/order/list/detail/${record.orderNo}`);
-              },
-            },
-            {
+      </template>             {
               icon: 'mdi:printer-outline',
               label: t('common.print'),
               color: 'error',
               onClick: () => {
                 createMessage.info(t('common.notConnect'));
               },
+            },-->
+      <template #action="{ record }">
+        <TableAction
+          :actions="[
+            {
+              icon: 'mdi:information-outline',
+              label: t('routes.staff.setpaswd'),
+              onClick: handleOpenModal.bind(null, record),
             },
           ]"
         />
       </template>
     </BasicTable>
+    <SetpaswordModal @register="register" />
   </div>
 </template>
 <script lang="ts">
@@ -40,8 +38,10 @@
   import { BasicTable, useTable, BasicColumn, FormProps, TableAction } from '/@/components/Table';
   import { useMessage } from '/@/hooks/web/useMessage';
   import { uploadApi } from '/@/api/sys/upload';
+  import { useModal } from '/@/components/Modal';
   // import { Switch } from 'ant-design-vue';
   // import { h } from 'vue';
+  import SetpaswordModal from './setpaswordModal.vue';
   import { ListApi } from '/@/api/staff/list';
   import { useI18n } from '/@/hooks/web/useI18n';
   // import { useCopyToClipboard } from '/@/hooks/web/useCopyToClipboard';
@@ -73,8 +73,9 @@
   // userPassword: "2a22bac40f44af4d3b5fdc20ea706fc5"
 
   export default defineComponent({
-    components: { BasicTable, TableAction },
+    components: { BasicTable, TableAction, SetpaswordModal },
     setup() {
+      const [register, { openModal }] = useModal();
       const { createMessage } = useMessage();
       const go = useGo();
       const { t } = useI18n();
@@ -121,13 +122,13 @@
           // slots: { customRender: 'createTime' },
           width: 130,
         },
-        // {
-        //   title: '操作',
-        //   dataIndex: '',
-        //   slots: { customRender: 'action' },
-        //   fixed: 'right',
-        //   width: 140,
-        // },
+        {
+          title: '操作',
+          dataIndex: '',
+          slots: { customRender: 'action' },
+          fixed: 'right',
+          width: 80,
+        },
       ];
 
       const searchForm: Partial<FormProps> = {
@@ -180,7 +181,9 @@
             return '';
         }
       }
-
+      function handleOpenModal(record: Recordable) {
+        openModal(true, record);
+      }
       return {
         registerTable,
         createMessage,
@@ -189,6 +192,8 @@
         renderRoleType,
         renderStatus,
         uploadApi: uploadApi as any,
+        handleOpenModal,
+        register,
       };
     },
   });

+ 91 - 0
src/views/staff/setpaswordModal.vue

@@ -0,0 +1,91 @@
+<template>
+  <BasicModal
+    v-bind="$attrs"
+    @register="register"
+    @ok="handSubmit"
+    :title="t('routes.personalSetting.updateBtn')"
+    @visible-change="handleVisibleChange"
+  >
+    <div class="pt-3px pr-3px">
+      <BasicForm @register="registerForm" :model="model" />
+    </div>
+  </BasicModal>
+</template>
+<script lang="ts">
+  import { useI18n } from '/@/hooks/web/useI18n';
+  import { encodeStr } from '/@/utils/encodeUtil';
+  import { defineComponent, ref, nextTick } from 'vue';
+  import { BasicModal, useModalInner } from '/@/components/Modal';
+  import { BasicForm, FormSchema, useForm } from '/@/components/Form/index';
+  import { updatePasswordApi } from '/@/api/sys/user';
+  export default defineComponent({
+    components: { BasicModal, BasicForm },
+    props: {
+      userData: { type: Object },
+    },
+    setup(props) {
+      const { t } = useI18n();
+      const schemas: FormSchema[] = [
+        {
+          field: 'id',
+          component: 'Input',
+          label: 'id',
+          show: false,
+        },
+        {
+          field: 'password',
+          component: 'StrengthMeter',
+          label: t('routes.personalSetting.password'),
+          labelWidth: 120,
+          required: true,
+          colProps: { span: 18 },
+        },
+      ];
+      const modelRef = ref({});
+      const [
+        registerForm,
+        {
+          setFieldsValue,
+          validate,
+          resetFields,
+          // setProps
+        },
+      ] = useForm({
+        labelWidth: 120,
+        schemas,
+        showActionButtonGroup: false,
+        actionColOptions: {
+          span: 24,
+        },
+      });
+
+      const [register] = useModalInner((data) => {
+        data && onDataReceive(data);
+      });
+
+      function onDataReceive(data) {
+        setFieldsValue({
+          id: data.id,
+        });
+      }
+      async function handSubmit() {
+        const { id, password } = await validate();
+        updatePasswordApi({ id, password: encodeStr(window.btoa(password)) });
+      }
+      function handleVisibleChange(v) {
+        v && props.userData && nextTick(() => onDataReceive(props.userData));
+        resetFields();
+      }
+
+      return {
+        handSubmit,
+        register,
+        t,
+        schemas,
+        registerForm,
+        model: modelRef,
+        handleVisibleChange,
+      };
+    },
+  });
+</script>