PwdEdit.vue 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <template>
  2. <div>
  3. <el-dialog
  4. v-loading="loading"
  5. :show-close="false"
  6. :close-on-click-modal="false"
  7. :visible.sync="isShow"
  8. :title="'修改密码'"
  9. :fullscreen="false"
  10. width="400px"
  11. custom-class="xl-dialog"
  12. center
  13. >
  14. <base-form ref="ruleForm" class="lib-edit" :data="formData" :is-inline="false" label-width="110px">
  15. <div slot="footer" style="padding-top: 20px;">
  16. <el-button class="xl-form-btn t2" @click="close">关 闭</el-button>
  17. <el-button class="xl-form-btn t1" @click="close('confirm')">确定</el-button>
  18. </div>
  19. </base-form>
  20. </el-dialog>
  21. </div>
  22. </template>
  23. <script>
  24. export default {
  25. components: { },
  26. props: {
  27. isShow: Boolean,
  28. },
  29. data() {
  30. return {
  31. formData: [],
  32. loading: true,
  33. cObj: {},
  34. isShowMap: false
  35. }
  36. },
  37. watch: {
  38. isShow: function(val) {
  39. if (val) {
  40. this.formData = [
  41. { label: '旧密码', key: 'old_pwd'},
  42. { label: '新密码', key: 'new_pwd'},
  43. { label: '确认新密码', key: 'repeat_new_pwd'},
  44. ]
  45. }
  46. },
  47. },
  48. methods: {
  49. close(str) {
  50. if (str === 'confirm') {
  51. this.$refs['ruleForm'].$refs['baseForm'].validate((valid) => {
  52. if (valid) {
  53. const oldform = this.$refs.ruleForm.baseForm
  54. let newForm = { ...oldform }
  55. this.$api.base.admchangepwd(newForm).then(res => {
  56. this.$msg('修改成功~')
  57. })
  58. this.$emit('close', newForm)
  59. }
  60. })
  61. } else {
  62. this.$emit('close')
  63. }
  64. }
  65. }
  66. }
  67. </script>
  68. <style lang="scss" scoped>
  69. </style>