|
@@ -0,0 +1,136 @@
|
|
|
+<template>
|
|
|
+ <div id="">
|
|
|
+ <el-dialog
|
|
|
+ title="完善信息"
|
|
|
+ :visible.sync="isShow"
|
|
|
+ width="600px"
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ :close-on-press-escape="false"
|
|
|
+ :show-close="false"
|
|
|
+ >
|
|
|
+ <el-form
|
|
|
+ :model="ruleForm"
|
|
|
+ :rules="rules"
|
|
|
+ ref="ruleForm"
|
|
|
+ label-width="100px"
|
|
|
+ class="demo-ruleForm"
|
|
|
+ >
|
|
|
+ <el-form-item label="姓名" prop="realname">
|
|
|
+ <el-input
|
|
|
+ :readonly="formData.realname ? true : false"
|
|
|
+ v-model.trim="ruleForm.realname"
|
|
|
+ placeholder="请输入姓名"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="身份证" prop="idCard">
|
|
|
+ <el-input
|
|
|
+ :readonly="formData.idCard ? true : false"
|
|
|
+ v-model.trim="ruleForm.idCard"
|
|
|
+ placeholder="请输入身份证"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="性别" prop="sex" v-if="type == 2">
|
|
|
+ <el-radio-group
|
|
|
+ v-model="ruleForm.sex"
|
|
|
+ :disabled="formData.sex ? true : false"
|
|
|
+ >
|
|
|
+ <el-radio :label="1">男</el-radio>
|
|
|
+ <el-radio :label="2">女</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="公司名称" prop="companyName" v-if="type == 2">
|
|
|
+ <el-input
|
|
|
+ :readonly="formData.companyName ? true : false"
|
|
|
+ v-model.trim="ruleForm.companyName"
|
|
|
+ placeholder="请输入公司名称"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="教育层次" prop="eduLevel" v-if="type == 2">
|
|
|
+ <el-select
|
|
|
+ v-model="ruleForm.eduLevel"
|
|
|
+ placeholder="请选择教育层次"
|
|
|
+ :disabled="formData.eduLevel ? true : false"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="(items, indexs) in $store.state.dictList['edu_level']"
|
|
|
+ :key="indexs"
|
|
|
+ :label="items"
|
|
|
+ :value="items"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="close">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="submitForm" :loading="uploading"
|
|
|
+ >确 定</el-button
|
|
|
+ >
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+export default {
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ isShow: false,
|
|
|
+ uploading: false,
|
|
|
+ ruleForm: {},
|
|
|
+ formData: {}, //备份
|
|
|
+ type: null, //1-学员姓名、身份证 2-学员姓名、身份证、性别、公司名称、教育层次
|
|
|
+ rules: {
|
|
|
+ realname: [{ required: true, message: "请输入姓名", trigger: "blur" }],
|
|
|
+ idCard: [{ required: true, message: "请输入身份证", trigger: "blur" }],
|
|
|
+ companyName: [
|
|
|
+ { required: true, message: "请输入公司名称", trigger: "blur" }
|
|
|
+ ],
|
|
|
+ eduLevel: [
|
|
|
+ { required: true, message: "请选择教育层次", trigger: "change" }
|
|
|
+ ],
|
|
|
+ sex: [{ required: true, message: "请选择性别", trigger: "change" }]
|
|
|
+ }
|
|
|
+ };
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ //type:1-学员姓名、身份证 2-学员姓名、身份证、性别、公司名称、教育层次
|
|
|
+ openBox(type) {
|
|
|
+ this.type = type;
|
|
|
+ this.isShow = true;
|
|
|
+ this.ruleForm = Object.assign({}, this.$store.state.userInfo);
|
|
|
+ this.formData = Object.assign({}, this.$store.state.userInfo);
|
|
|
+ },
|
|
|
+ close() {
|
|
|
+ this.isShow = false;
|
|
|
+ this.$refs.ruleForm.resetFields();
|
|
|
+ },
|
|
|
+ submitForm() {
|
|
|
+ this.$refs["ruleForm"].validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ let data = {
|
|
|
+ userId: this.ruleForm.userId,
|
|
|
+ realname: this.ruleForm.realname,
|
|
|
+ idCard: this.ruleForm.idCard,
|
|
|
+ sex: this.ruleForm.sex,
|
|
|
+ companyName: this.ruleForm.companyName,
|
|
|
+ eduLevel: this.ruleForm.eduLevel
|
|
|
+ };
|
|
|
+ this.$request.editAppUser(data).then(res => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.$store.dispatch("getUserInfo");
|
|
|
+ this.$message.success("保存成功");
|
|
|
+ this.close();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ console.log("error submit!!");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped></style>
|