| | |
| | | * @Author: 小明丶 |
| | | * @Date: 2020-05-11 17:38:01 |
| | | * @LastEditors: zhaoxiaoqiang 287285524@qq.com |
| | | * @LastEditTime: 2023-09-05 17:01:35 |
| | | * @LastEditTime: 2023-09-05 17:46:59 |
| | | * @Description: 账户管理 |
| | | --> |
| | | <template> |
| | |
| | | <el-form-item label="用户名称:" prop="name"> |
| | | <el-input |
| | | v-model.trim="creatForm.name" |
| | | maxlength="20" |
| | | maxlength="30" |
| | | autocomplete="off" |
| | | placeholder="请输入用户名称" |
| | | ></el-input> |
| | |
| | | :value="item.roleId"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="密码:" v-show="title !== '编辑账户'" prop="password"> |
| | | <el-input |
| | | type = "password" |
| | | v-if="isCreat" |
| | | v-model.trim="creatForm.password" |
| | | maxlength="20" |
| | | autocomplete="off" |
| | | placeholder="请输入密码" |
| | | ></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="密码确认:" v-show="title !== '编辑账户'" prop="resPassword"> |
| | | <el-input |
| | | type = "password" |
| | | v-if="isCreat" |
| | | v-model.trim="creatForm.resPassword" |
| | | maxlength="20" |
| | | autocomplete="off" |
| | | placeholder="再次输入密码" |
| | | ></el-input> |
| | | <span v-else>{{creatForm.resPassword}}</span> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | |
| | | }; |
| | | }, |
| | | watch: { |
| | | // dialogFormVisible: function(newVal) { |
| | | // if (!newVal) { |
| | | // this.creatForm.name = "" |
| | | // this.creatForm.phone = "" |
| | | // this.creatForm.password = '' |
| | | // this.creatForm.resPassword = '' |
| | | // this.creatForm.role = '' |
| | | // } |
| | | // } |
| | | dialogFormVisible: function(newVal) { |
| | | if (!newVal) { |
| | | this.creatForm.name = ""; |
| | | this.creatForm.phone = ""; |
| | | this.creatForm.role = ''; |
| | | } |
| | | } |
| | | }, |
| | | created(){ |
| | | roleGetRoleList().then(res => { |
| | |
| | | this.$message.error('请输入用户名称'); |
| | | return |
| | | } |
| | | if(!v.checkName(this.creatForm.name)){ |
| | | this.$message.error('请输入正确用户名称'); |
| | | return |
| | | } |
| | | if(v.checkValEmpty(this.creatForm.phone)){ |
| | | this.$message.error('请输入用户手机号'); |
| | | return |
| | |
| | | this.$message.error('请选择角色'); |
| | | return |
| | | } |
| | | if(v.checkValEmpty(this.creatForm.password) && this.isCreat){ |
| | | this.$message.error('请输入密码'); |
| | | return |
| | | } |
| | | if(!v.checkPassword(this.creatForm.password) && this.isCreat){ |
| | | this.$message.error('密码格式错误,请输入6~20位包含字母及数字'); |
| | | return |
| | | } |
| | | if(v.checkValEmpty(this.creatForm.resPassword) && this.isCreat){ |
| | | this.$message.error('请输入密码确认'); |
| | | return |
| | | } |
| | | if(this.creatForm.password!=this.creatForm.resPassword && this.isCreat){ |
| | | this.$message.error('密码输入不一致,请确认'); |
| | | return |
| | | } |
| | | |
| | | if(this.title === '新建账户') { |
| | | let temPassWord = md5(this.creatForm.phone+this.creatForm.password) |
| | | let temconfirmPwd = md5(this.creatForm.phone+this.creatForm.resPassword) |
| | |
| | | } else if (this.title === '编辑账户') { |
| | | let data = {userName: this.creatForm.name, userId: this.rowsInfo.userId, roleId:this.creatForm.role} |
| | | userUpdate(data).then(res => { |
| | | console.log(res) |
| | | if(res) { |
| | | this.$notify({ |
| | | title: '提示', |