<template>
	<div style="width: 100%">
		<el-breadcrumb separator-class="el-icon-arrow-right">
			<el-breadcrumb-item>首页</el-breadcrumb-item>
			<el-breadcrumb-item>个人中心</el-breadcrumb-item>
            <el-breadcrumb-item>修改信息</el-breadcrumb-item>
		</el-breadcrumb>
		<div class="title">
			信息修改
		</div>

		<el-form :model="form" label-width="100px">
			<el-form-item label="登录账号" prop="form.rybh" required>
				<el-input v-model="form.rybh" ></el-input>
			</el-form-item>
			<el-form-item label="密码" prop="form.kl" required>
				<el-input v-model="form.kl" :disabled="true"></el-input>
			</el-form-item>
			<el-form-item label="新密码" prop="form.new_password" >
				<el-input v-model="form.new_password" ></el-input>
			</el-form-item>
			<el-form-item label="用户名称" prop="form.rymc" required>
				<el-input v-model="form.rymc" :disabled="true"></el-input>
			</el-form-item>
            <!-- <el-form-item label="别名" prop="form.name_other" required>
				<el-input v-model="form.name_other"></el-input>
			</el-form-item> -->
            <el-form-item label="组别" prop="form.groupname" required>
				<el-input v-model="form.groupname" :disabled="true"></el-input>
			</el-form-item>
			 <!-- <el-form-item label="机构属性" prop="form.properties" required>
				<el-input v-model="form.properties" :disabled="true"></el-input>
			</el-form-item> -->
            <el-form-item label="联系人姓名" prop="form.contact_name" required>
				<el-input v-model="form.contact_name" ></el-input>
			</el-form-item>
            <el-form-item label="联系人电话" prop="form.contact_phone" required>
				<el-input v-model="form.contact_phone"></el-input>
			</el-form-item>
			 <el-form-item label="联系人邮箱" prop="form.contact_mail" required>
				<el-input v-model="form.contact_mail"></el-input>
			</el-form-item>
			 <el-form-item label="联系人QQ" prop="form.contact_qq" required>
				<el-input v-model="form.contact_qq"></el-input>
			</el-form-item>
            <!-- <el-form-item label="创建时间" prop="form.create_time" required>
				<el-input v-model="form.create_time" ></el-input>
			</el-form-item>
            <el-form-item label="修改时间" prop="form.update_time" required>
				<el-input v-model="form.update_time" ></el-input>
			</el-form-item> -->



			<el-form-item>
				<el-button type="success" @click="preServe()">保存修改</el-button>
				<el-button @click="reBack()">返回</el-button>
			</el-form-item>
		</el-form>
	</div>
</template>
<script>
	const rymc = window.sessionStorage.getItem('rymc')
	const token = window.sessionStorage.getItem('token')
	export default {
		data() {
			return {
				form: {
                    username:'',
                    rybh:'', 
					rymc:'',
                    name_other:'', 
                    groupname: '', 
                    properties: '', 
                    contact_name: '', 
                    contact_phone: '',
                    create_time:'' ,
                    update_time:'',
					kl:'',
					new_password:''
				},
            }
		},
		created() {	
            this.getJgAccount()
		},
		mounted() {
            this.getJgAccount()
		},
		methods: {
            //保存修改
            async preServe(){
				const result = await this.$http.post('putJgAccount',this.form)
				// 判断业务逻辑
				if (result.code == 0) {
						this.$message({
						type: 'success',
						message: '修改成功'
					})
				} else {
					this.$message({
						type: 'error',
						message:  result.data.message
					})
				}
                // this.putJgAccount()
            },
            //返回
            reBack(){
                 this.$router.push('userAccount')
                },
         //获取用户信息
            async getJgAccount() {
				const result = await this.$http.post('getJgAccount')
				console.log(result.data.data)
					this.form = result.data.data
					if (this.form.properties == 1){
                      this.form.properties ='政府部门';
                }else if(this.form.properties == 2){
                    this.form.properties ='事业单位';
                }else{
                     this.form.properties ='企业';
                }
              
        },
       
        }
	}

</script>
<style lang="less" scoped>
	.title {
		margin-left: 50%;
		margin-bottom: 20px;
	}

	.el-form {
		width: 800px;
		margin: 0 auto;
	}

	.footer {
		margin-top: 5px;
		display: flex;
		flex-direction: row;
		justify-content: space-between;
	}
</style>
