1. Go backstage to get the data, you can get it.
2. After submitting the data (updating the form), confirm that the form data has been submitted. In the acquisition of data, can not get the modified data, this is why?
this is the form:
<el-dialog title="" :visible.sync="personalDetailVisible">
<el-form :model="personalForm" :rules="personalFormRules" ref="ruleForm2">
<el-form-item label="" prop="personUserName">
<el-input v-model="personalForm.personUserName" :disabled="true"></el-input>
</el-form-item>
<el-form-item label="QQ" prop="qq">
<el-input placeholder="QQ" v-model="personalForm.qq"></el-input>
</el-form-item>
<el-form-item label="" prop="weixin">
<el-input placeholder="" v-model="personalForm.weixin"></el-input>
</el-form-item>
<el-form-item label="" prop="cellphone">
<el-input placeholder="" v-model="personalForm.cellphone"></el-input>
</el-form-item>
<el-form-item label="" prop="email">
<el-input placeholder="" v-model="personalForm.email"></el-input>
</el-form-item>
<el-form-item label="" prop="phone">
<el-input placeholder="" v-model="personalForm.phone"></el-input>
</el-form-item>
<el-form-item label="" prop="department">
<el-input placeholder="" v-model="personalForm.department"></el-input>
</el-form-item>
<el-form-item label="" prop="role">
<el-input v-model="personalForm.role" :disabled="true"></el-input>
</el-form-item>
<el-button type="primary" @click="savePerDetail("ruleForm2")"></el-button>
<el-button type="primary" @click="changePerDetGoBack"></el-button>
</el-form>
</el-dialog>
this is the JS: for getting data
getuserdata() {
let _this = this;
this.$axios({
method: "post",
url: "/api/authController/getMenus",
data: qs.stringify({
token: this.token
})
}).then((response) => {
console.log(response)
let res = response.data.message.user;
_this.username = res.username;
_this.gender = res.gender;
_this.qq = res.qq;
_this.dianhua = res.phone;
_this.wechat = res.wechat;
_this.phone = res.mobile;
_this.email = res.email;
_this.realname = res.realname;
_this.position = res.position;
_this.department = res.department;
if (res.roleCode === "user") {
_this.roleCode = ""
}
if (res.roleCode === "administartor") {
_this.roleCode = ""
}
})
},
JS:
//
savePerDetail(formName) {
let _this = this;
this.$refs[formName].validate((valid)=>{
if (valid) {
this.$axios({
method: "post",
url:"/api/userController/update",
data: qs.stringify({
token: this.token,
id: this.userId,
username: this.username,
qq: this.personalForm.qq,
wechat: this.personalForm.wexin,
mobile: this.personalForm.cellphone,
email: this.personalForm.email,
phone: this.personalForm.phone,
department: this.personalForm.department,
})
}).then((res)=>{
console.log(res)
if (res.data.code === 200) {
// this.getuserdata();
}
})
}
})
},