<template> <div> <el-dialog v-loading="loading" :show-close="false" :close-on-click-modal="false" :visible.sync="isShow" :title="'修改密码'" :fullscreen="false" width="400px" custom-class="xl-dialog" center > <base-form ref="ruleForm" class="lib-edit" :data="formData" :is-inline="false" label-width="110px"> <div slot="footer" style="padding-top: 20px;"> <el-button class="xl-form-btn t2" @click="close">关 闭</el-button> <el-button class="xl-form-btn t1" @click="close('confirm')">确定</el-button> </div> </base-form> </el-dialog> </div> </template> <script> export default { components: { }, props: { isShow: Boolean, }, data() { return { formData: [], loading: true, cObj: {}, isShowMap: false } }, watch: { isShow: function(val) { if (val) { this.formData = [ { label: '旧密码', key: 'old_pwd'}, { label: '新密码', key: 'new_pwd'}, { label: '确认新密码', key: 'repeat_new_pwd'}, ] } }, }, methods: { close(str) { if (str === 'confirm') { this.$refs['ruleForm'].$refs['baseForm'].validate((valid) => { if (valid) { const oldform = this.$refs.ruleForm.baseForm let newForm = { ...oldform } this.$api.base.admchangepwd(newForm).then(res => { this.$msg('修改成功~') }) this.$emit('close', newForm) } }) } else { this.$emit('close') } } } } </script> <style lang="scss" scoped> </style>