<template>
  <el-card class="box-card" style="width:800px;" size="small">
    <!-- <div slot="header" class="clearfix">
      <span>Security</span>
    </div> -->
    <div>
      <el-button type="danger" @click="handleReset">{{$t('system:userlist:button:ResetPassword')}}</el-button>
    </div>
  </el-card>
</template>
<script>
import { resetPassword } from '@/api/admin'
export default {
  name: 'Account',
  props: {
    userId: { type: String, default: '' },
  },
  methods: {
    handleReset() {
      this.$confirm(this.$t('system:userlist:message:ResetPassword'), {
        type: 'warning',
        distinguishCancelAndClose: true,
      })
        .then(() => {
          resetPassword(this.userId).then(res => {
            if (res.IsSuccess) {
              let msg = this.$t('system:userlist:message:ResetPassword2')
              msg = msg.replace('xxx', this.$route.query.userName)
              this.$alert(msg)
            }
          })
        })
    }
  }
}
</script>
