update
This commit is contained in:
parent
97dd13a2d1
commit
967554f284
@ -2,8 +2,14 @@
|
|||||||
<el-dialog
|
<el-dialog
|
||||||
:title="!dataForm.uid ? '新增' : '修改'"
|
:title="!dataForm.uid ? '新增' : '修改'"
|
||||||
:close-on-click-modal="false"
|
:close-on-click-modal="false"
|
||||||
:visible.sync="visible">
|
:visible.sync="visible"
|
||||||
<el-form :model="dataForm" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
|
>
|
||||||
|
<el-form
|
||||||
|
:model="dataForm"
|
||||||
|
ref="dataForm"
|
||||||
|
@keyup.enter.native="dataFormSubmit()"
|
||||||
|
label-width="80px"
|
||||||
|
>
|
||||||
<el-form-item label="状态" prop="status">
|
<el-form-item label="状态" prop="status">
|
||||||
<el-radio-group v-model="dataForm.status">
|
<el-radio-group v-model="dataForm.status">
|
||||||
<el-radio :label="1">禁用</el-radio>
|
<el-radio :label="1">禁用</el-radio>
|
||||||
@ -25,119 +31,120 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
data () {
|
data() {
|
||||||
return {
|
return {
|
||||||
visible: false,
|
visible: false,
|
||||||
dataForm: {
|
dataForm: {
|
||||||
uid: 0,
|
uid: 0,
|
||||||
mobile: '',
|
mobile: "",
|
||||||
username: '',
|
username: "",
|
||||||
password: '',
|
password: "",
|
||||||
groupId: '',
|
groupId: "",
|
||||||
avatar: '',
|
avatar: "",
|
||||||
gender: '',
|
gender: "",
|
||||||
province: '',
|
province: "",
|
||||||
city: '',
|
city: "",
|
||||||
openid: '',
|
openid: "",
|
||||||
mpOpenid: '',
|
mpOpenid: "",
|
||||||
unionid: '',
|
unionid: "",
|
||||||
status: '',
|
status: "",
|
||||||
intro: '',
|
intro: "",
|
||||||
integral: '',
|
integral: "",
|
||||||
lastLoginIp: '',
|
lastLoginIp: "",
|
||||||
tagStr: '',
|
tagStr: "",
|
||||||
type: '',
|
type: "",
|
||||||
updateTime: '',
|
updateTime: "",
|
||||||
createTime: ''
|
createTime: "",
|
||||||
}
|
},
|
||||||
|
};
|
||||||
}
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
init (id) {
|
init(id) {
|
||||||
this.dataForm.uid = id || 0
|
this.dataForm.uid = id || 0;
|
||||||
this.visible = true
|
this.visible = true;
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs['dataForm'].resetFields()
|
this.$refs["dataForm"].resetFields();
|
||||||
if (this.dataForm.uid) {
|
if (this.dataForm.uid) {
|
||||||
this.$http({
|
this.$http({
|
||||||
url: this.$http.adornUrl(`/admin/user/info/${this.dataForm.uid}`),
|
url: this.$http.adornUrl(`/admin/user/info/${this.dataForm.uid}`),
|
||||||
method: 'get',
|
method: "get",
|
||||||
params: this.$http.adornParams()
|
params: this.$http.adornParams(),
|
||||||
}).then(({data}) => {
|
}).then(({ data }) => {
|
||||||
if (data && data.code === 0) {
|
if (data && data.code === 0) {
|
||||||
this.dataForm.mobile = data.user.mobile
|
this.dataForm.mobile = data.user.mobile;
|
||||||
this.dataForm.username = data.user.username
|
this.dataForm.username = data.user.username;
|
||||||
this.dataForm.password = data.user.password
|
this.dataForm.password = data.user.password;
|
||||||
this.dataForm.groupId = data.user.groupId
|
this.dataForm.groupId = data.user.groupId;
|
||||||
this.dataForm.avatar = data.user.avatar
|
this.dataForm.avatar = data.user.avatar;
|
||||||
this.dataForm.gender = data.user.gender
|
this.dataForm.gender = data.user.gender;
|
||||||
this.dataForm.province = data.user.province
|
this.dataForm.province = data.user.province;
|
||||||
this.dataForm.city = data.user.city
|
this.dataForm.city = data.user.city;
|
||||||
this.dataForm.openid = data.user.openid
|
this.dataForm.openid = data.user.openid;
|
||||||
this.dataForm.mpOpenid = data.user.mpOpenid
|
this.dataForm.mpOpenid = data.user.mpOpenid;
|
||||||
this.dataForm.unionid = data.user.unionid
|
this.dataForm.unionid = data.user.unionid;
|
||||||
this.dataForm.status = data.user.status
|
this.dataForm.status = data.user.status;
|
||||||
this.dataForm.intro = data.user.intro
|
this.dataForm.intro = data.user.intro;
|
||||||
this.dataForm.integral = data.user.integral
|
this.dataForm.integral = data.user.integral;
|
||||||
this.dataForm.lastLoginIp = data.user.lastLoginIp
|
this.dataForm.lastLoginIp = data.user.lastLoginIp;
|
||||||
this.dataForm.tagStr = data.user.tagStr
|
this.dataForm.tagStr = data.user.tagStr;
|
||||||
this.dataForm.type = data.user.type
|
this.dataForm.type = data.user.type;
|
||||||
this.dataForm.updateTime = data.user.updateTime
|
this.dataForm.updateTime = data.user.updateTime;
|
||||||
this.dataForm.createTime = data.user.createTime
|
this.dataForm.createTime = data.user.createTime;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
// 表单提交
|
// 表单提交
|
||||||
dataFormSubmit () {
|
dataFormSubmit() {
|
||||||
this.$refs['dataForm'].validate((valid) => {
|
this.$refs["dataForm"].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.$http({
|
this.$http({
|
||||||
url: this.$http.adornUrl(`/admin/user/${!this.dataForm.uid ? 'save' : 'update'}`),
|
url: this.$http.adornUrl(
|
||||||
method: 'post',
|
`/admin/user/${!this.dataForm.uid ? "save" : "update"}`
|
||||||
|
),
|
||||||
|
method: "post",
|
||||||
data: this.$http.adornData({
|
data: this.$http.adornData({
|
||||||
'uid': this.dataForm.uid || undefined,
|
uid: this.dataForm.uid || undefined,
|
||||||
'mobile': this.dataForm.mobile,
|
mobile: this.dataForm.mobile,
|
||||||
'username': this.dataForm.username,
|
username: this.dataForm.username,
|
||||||
'password': this.dataForm.password,
|
password: this.dataForm.password,
|
||||||
'groupId': this.dataForm.groupId,
|
groupId: this.dataForm.groupId,
|
||||||
'avatar': this.dataForm.avatar,
|
avatar: this.dataForm.avatar,
|
||||||
'gender': this.dataForm.gender,
|
gender: this.dataForm.gender,
|
||||||
'province': this.dataForm.province,
|
province: this.dataForm.province,
|
||||||
'city': this.dataForm.city,
|
city: this.dataForm.city,
|
||||||
'openid': this.dataForm.openid,
|
openid: this.dataForm.openid,
|
||||||
'mpOpenid': this.dataForm.mpOpenid,
|
mpOpenid: this.dataForm.mpOpenid,
|
||||||
'unionid': this.dataForm.unionid,
|
unionid: this.dataForm.unionid,
|
||||||
'status': this.dataForm.status,
|
status: this.dataForm.status,
|
||||||
'intro': this.dataForm.intro,
|
intro: this.dataForm.intro,
|
||||||
'integral': this.dataForm.integral,
|
integral: this.dataForm.integral,
|
||||||
'lastLoginIp': this.dataForm.lastLoginIp,
|
lastLoginIp: this.dataForm.lastLoginIp,
|
||||||
'tagStr': this.dataForm.tagStr,
|
tagStr: this.dataForm.tagStr,
|
||||||
'type': this.dataForm.type,
|
type: this.dataForm.type,
|
||||||
'updateTime': this.dataForm.updateTime,
|
updateTime: this.dataForm.updateTime,
|
||||||
'createTime': this.dataForm.createTime
|
createTime: this.dataForm.createTime,
|
||||||
})
|
}),
|
||||||
}).then(({data}) => {
|
}).then(({ data }) => {
|
||||||
if (data && data.code === 0) {
|
if (data && data.code === 0) {
|
||||||
this.$message({
|
this.$message({
|
||||||
message: '操作成功',
|
message: "操作成功",
|
||||||
type: 'success',
|
type: "success",
|
||||||
duration: 1500,
|
duration: 1500,
|
||||||
onClose: () => {
|
onClose: () => {
|
||||||
this.visible = false
|
this.visible = false;
|
||||||
this.$emit('refreshDataList')
|
this.$emit("refreshDataList");
|
||||||
}
|
},
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
this.$message.error(data.msg)
|
this.$message.error(data.msg);
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user