Explorar o código

机构人员修改信息

natasha hai 1 ano
pai
achega
87fa245471

+ 153 - 70
src/components/Setting.vue

@@ -4,7 +4,7 @@
         <div class="setting-top">
             <div class="avator-box">
             <el-image
-                :src="info.sys_user.image_url?info.sys_user.image_url:require('../assets/avatar.png')"
+                :src="info.sys_user&&info.sys_user.image_url?info.sys_user.image_url:info.image_url?info.image_url:require('../assets/avatar.png')"
                 fit="contain">
             </el-image>
             <a class="img-crop">
@@ -14,23 +14,27 @@
             <div class="center">
                 <div class="info-items">
                     <label>用户名:</label>
-                    <span>{{info.sys_user.user_name}}</span>
+                    <span>{{page==='editPerson'?info.sys_user.user_name:info.user_name}}</span>
                 </div>
                 <div class="info-items">
                     <label>手机号码:</label>
-                    <span>{{info.sys_user.phone.substring(0,3)+'******'+info.sys_user.phone.substring(9,11)}}</span>
+                    <span>{{page==='editPerson'&&info.sys_user.phone?info.sys_user.phone.substring(0,3)+'******'+info.sys_user.phone.substring(9,11):info.phone?info.phone.substring(0,3)+'******'+info.phone.substring(9,11):'-'}}</span>
                 </div>
                 <div class="info-items">
                     <label>账号ID:</label>
-                    <span>{{info.sys_user.id}}</span>
+                    <span>{{page==='editPerson'?info.sys_user.id:info.id}}</span>
                 </div>
                 <div class="info-items">
                     <label>邮箱:</label>
-                    <span>{{info.sys_user.email}}</span>
+                    <span>{{page==='editPerson'&&info.sys_user.email?info.sys_user.email:info.email?info.email:'-'}}</span>
                 </div>
                 <div class="info-items">
                     <label>{{page==='editPerson'?'创建时间:':'注册时间:'}}</label>
-                    <span>{{info.sys_user.create_time}}</span>
+                    <span>{{page==='editPerson'?info.sys_user.create_time:info.register_time}}</span>
+                </div>
+                <div class="info-items" v-if="page==='editOrgPerson'">
+                    <label>机构:</label>
+                    <span>{{info.org_name}}</span>
                 </div>
             </div>
         </div>
@@ -71,7 +75,7 @@
                     </el-form-item>
                 </el-form>
             </template>
-            <template v-if="tabsIndex===1&&page==='editPerson'">
+            <template v-if="tabsIndex===1">
                 <div class="safe-items">
                     <label>登录密码</label>
                     <div class="safe-items-right">
@@ -87,29 +91,29 @@
                 <div class="safe-items">
                     <label>绑定手机</label>
                     <div class="safe-items-right">
-                        <p v-if="info.sys_user.phone" class="hasContent">
-                            已绑定: {{info.sys_user.phone.substring(0,3)+'******'+info.sys_user.phone.substring(9,11)}}
+                        <p v-if="info.phone||info.sys_user&&info.sys_user.phone" class="hasContent">
+                            已绑定: {{page==='editPerson'&&info.sys_user.phone?info.sys_user.phone.substring(0,3)+'******'+info.sys_user.phone.substring(9,11):info.phone?info.phone.substring(0,3)+'******'+info.phone.substring(9,11):'-'}}
                         </p>
                         <p v-else class="noContent">
                         您暂未绑定手机,绑定手机可以有效的保护账号的安全。 
                         </p>
-                        <a @click="handleSetting('phoneFlag')">{{info.sys_user.phone?'修改':'设置'}}</a>
+                        <a @click="handleSetting('phoneFlag')">{{info.phone||info.sys_user&&info.sys_user.phone?'修改':'设置'}}</a>
                     </div>
                 </div>
                 <div class="safe-items">
                     <label>绑定邮箱</label>
                     <div class="safe-items-right">
-                        <p v-if="info.sys_user.email" class="hasContent">
-                            已绑定: {{info.sys_user.email}}
+                        <p v-if="info.email||info.sys_user&&info.sys_user.email" class="hasContent">
+                            已绑定: {{info.email||info.sys_user.email}}
                         </p>
                         <p v-else class="noContent">
                         您暂未设置邮箱,绑定邮箱可以用来找回密码、接收通知等。
                         </p>
-                        <a @click="handleSetting('emailFlag')">{{info.sys_user.email?'修改':'设置'}}</a>
+                        <a @click="handleSetting('emailFlag')">{{info.email||info.sys_user&&info.sys_user.email?'修改':'设置'}}</a>
                     </div>
                 </div>
             </template>
-            <template v-if="tabsIndex===2">
+            <template v-if="tabsIndex===2&&page==='editPerson'">
                 <table class="step-table">
                         <tr>
                             <td rowspan="2" class="step-table-header">管理权限</td>
@@ -185,6 +189,20 @@
                     <el-button type="primary" @click="onSubmitAuth()" size="small" :loading="loading">保存</el-button>
                     <el-button @click="onCancelAuth()" size="small">取消</el-button>
             </template>
+            <template v-if="tabsIndex===2&&page==='editOrgPerson'">
+                <el-form :model="managerForm" ref="managerForm" label-width="150px" class="setting-form">
+                    <el-form-item label="机构管理员" prop="is_manager">
+                        <el-radio-group v-model="managerForm.is_manager">
+                            <el-radio label="true">是</el-radio>
+                            <el-radio label="false">否</el-radio>
+                        </el-radio-group>
+                    </el-form-item>
+                    <el-form-item>
+                        <el-button type="primary" @click="onSubmitManager('managerForm')" size="small" :loading="loading">保存</el-button>
+                        <el-button @click="onCancel('managerForm')" size="small">取消</el-button>
+                    </el-form-item>
+                </el-form>
+            </template>
         </div>
     </template>
     <div class="setting-iframe" v-if="settingFlag&&passwordFlag">
@@ -230,8 +248,8 @@
             修改绑定手机
         </p>
         <el-form :model="phoneForm" :rules="rulesPhone" ref="phoneForm" label-width="100px" class="phoneForm">
-            <el-form-item label="原手机号" prop="oldPhone">
-                <el-input v-model="phoneForm.oldPhone" autocomplete="off" disabled placeholder="请输入完整手机号" @blur="handleTrim('phoneForm','oldPhone')" >
+            <el-form-item label="原手机号" prop="oldPhone" v-if="phoneForm.oldPhone">
+                <el-input v-model="phoneForm.oldPhone" autocomplete="off" :disabled="phoneForm.oldPhone?true:false" placeholder="请输入完整手机号" @blur="handleTrim('phoneForm','oldPhone')">
                     <template slot="prepend">+86</template>
                 </el-input>
             </el-form-item>
@@ -252,8 +270,8 @@
             修改安全邮箱
         </p>
         <el-form :model="emailForm" :rules="rulesEmail" ref="emailForm" label-width="100px" class="emailForm">
-            <el-form-item label="原邮箱" prop="email">
-                <el-input v-model="emailForm.email" autocomplete="off" disabled placeholder="请输入邮箱地址" @blur="handleTrim('emailForm','email')" >
+            <el-form-item label="原邮箱" prop="email" v-if="emailForm.email">
+                <el-input v-model="emailForm.email" autocomplete="off" :disabled="emailForm.email?true:false" placeholder="请输入邮箱地址" @blur="handleTrim('emailForm','email')">
                 </el-input>
             </el-form-item>
             <el-form-item label="新邮箱" prop="newEmail">
@@ -340,11 +358,11 @@ export default {
             cover_image_url: '',
             cover_image_list: [],
             cover_image_id: null,
-            name:JSON.parse(JSON.stringify(this.info.sys_user.user_name)),
-            realName:JSON.parse(JSON.stringify(this.info.sys_user.real_name)),
-            sex:JSON.parse(JSON.stringify(this.info.sys_user.sex)),
+            name:this.page==='editPerson'?JSON.parse(JSON.stringify(this.info.sys_user.user_name)):JSON.parse(JSON.stringify(this.info.user_name)),
+            realName:this.page==='editPerson'?JSON.parse(JSON.stringify(this.info.sys_user.real_name)):JSON.parse(JSON.stringify(this.info.real_name)),
+            sex:this.page==='editPerson'?JSON.parse(JSON.stringify(this.info.sys_user.sex)):JSON.parse(JSON.stringify(this.info.sex)),
             // selectedOptions: JSON.parse(JSON.stringify(this.info.sys_user.city_id)),
-            desc:JSON.parse(JSON.stringify(this.info.sys_user.memo)),
+            desc:this.page==='editPerson'?JSON.parse(JSON.stringify(this.info.sys_user.memo)):JSON.parse(JSON.stringify(this.info.memo)),
             selectedOptions: '0302',
         },
         rules: {
@@ -382,7 +400,7 @@ export default {
         newPwdFlag: false, // 查看新密码
         comfirmPwdFlag: false, // 查看确认密码
         phoneForm:{
-            oldPhone:JSON.parse(JSON.stringify(this.info.sys_user.phone)), // 旧手机
+            oldPhone:this.page==='editPerson'?JSON.parse(JSON.stringify(this.info.sys_user.phone)):JSON.parse(JSON.stringify(this.info.phone)), // 旧手机
             newPhone:'', // 新手机
         },
         rulesPhone:{
@@ -400,7 +418,7 @@ export default {
         timee: 60, //获取验证码的时间
         verificationCodeeShow: false, //是否已经获取了验证码
         emailForm:{
-            email:JSON.parse(JSON.stringify(this.info.sys_user.email)),
+            email:this.page==='editPerson'?JSON.parse(JSON.stringify(this.info.sys_user.email)):JSON.parse(JSON.stringify(this.info.email)),
             newEmail:''
         },
         rulesEmail:{
@@ -411,18 +429,21 @@ export default {
                 { required: true, validator: validateEmail, trigger: 'blur' }
             ]
         },
-        manageAuth:JSON.parse(JSON.stringify(this.info.popedom_code_list)), // 管理权限
+        manageAuth:this.page==='editPerson'?JSON.parse(JSON.stringify(this.info.popedom_code_list)):[], // 管理权限
         codeAuth:{
             auth:[],
-            viewCode:JSON.parse(JSON.stringify(this.info.data_scope.discount_code_view_scope))
+            viewCode:this.page==='editPerson'?JSON.parse(JSON.stringify(this.info.data_scope.discount_code_view_scope)):0
         }, // 兑换码权限
         financeAuth:{
             auth: [],
-            selectedOptions:JSON.parse(JSON.stringify(this.info.data_scope.finance_popedom_data_scope))
+            selectedOptions:this.page==='editPerson'?JSON.parse(JSON.stringify(this.info.data_scope.finance_popedom_data_scope)):[]
         }, // 财务权限
         props: { multiple: true },
         loading: false,
         id:this.$route.query.id?this.$route.query.id:'',
+        managerForm:{
+            is_manager: this.page==='editOrgPerson'?JSON.parse(JSON.stringify(this.info.is_manager)):"false"
+        }
     }
   },
   //计算属性 类似于data概念
@@ -435,6 +456,9 @@ export default {
   methods: {
     handleAvatarSuccess(fileList,name) {
         let MethodName = "/OrgServer/Manager/SysUserManager/UpdateSysUser_Image";
+        if(this.page==='editOrgPerson'){
+            MethodName = "/OrgServer/Manager/PersonManager/UpdatePerson_Image";
+        }
         let data = {
             id: this.id,
             image_id: fileList[0]&&fileList[0].response&&fileList[0].response.file_info_list&&fileList[0].response.file_info_list[0]?fileList[0].response.file_info_list[0].file_id:''
@@ -450,6 +474,33 @@ export default {
     // 切换tabs
     handleChangeTabs(value){
         this.tabsIndex = value
+        let breadcrumb = []
+        if(this.page==='editOrgPerson'){
+            breadcrumb = [
+                {
+                    icon:'school-line',
+                    url:'',
+                    text:''
+                },
+                {
+                    icon:'',
+                    url:'',
+                    text:'机构管理'
+                },
+                {
+                    icon:'',
+                    url:'',
+                    text:this.info.org_name
+                },
+                {
+                    icon:'',
+                    url:'',
+                    notLink: true,
+                    text:value===0?'人员信息':value===1?'安全设置':'权限设置'
+                }
+            ]
+            this.$emit("changeBread",breadcrumb)
+        }
     },
     // 级联选择器
     handleCity(value){
@@ -461,6 +512,9 @@ export default {
           if (valid) {
             this.loading = true
             let MethodName = "/OrgServer/Manager/SysUserManager/UpdateSysUser_BaseInfo";
+            if(this.page==='editOrgPerson'){
+                MethodName = "/OrgServer/Manager/PersonManager/UpdatePerson_BaseInfo";
+            }
             let data = {
                 id: this.id,
                 user_name: this.infoForm.name,
@@ -492,50 +546,52 @@ export default {
         this.settingFlag = !this.settingFlag
         this[flag] = !this[flag]
         let breadcrumb = []
-        if(this[flag]){
-            breadcrumb = [
-                {
-                    icon:'contacts-line',
-                    url:'',
-                    text:''
-                },
-                {
-                    icon:'',
-                    url:'',
-                    text:'系统用户'
-                },
-                {
-                    icon:'',
-                    url:'',
-                    notLink: true,
-                    text:'安全设置'
-                },
-                {
-                    icon:'',
-                    url:'',
-                    text:flag==='passwordFlag'?'修改密码':flag==='phoneFlag'?'绑定手机':'安全邮箱'
-                }
-            ]
-        }else{
-            breadcrumb = [
-                {
-                    icon:'contacts-line',
-                    url:'',
-                    text:''
-                },
-                {
-                    icon:'',
-                    url:'',
-                    text:'系统用户'
-                },
-                {
-                    icon:'',
-                    url:'',
-                    text:'编辑'
-                }
-            ]
+        if(this.page==='editPerson'){
+            if(this[flag]){
+                breadcrumb = [
+                    {
+                        icon:'contacts-line',
+                        url:'',
+                        text:''
+                    },
+                    {
+                        icon:'',
+                        url:'',
+                        text:'系统用户'
+                    },
+                    {
+                        icon:'',
+                        url:'',
+                        notLink: true,
+                        text:'安全设置'
+                    },
+                    {
+                        icon:'',
+                        url:'',
+                        text:flag==='passwordFlag'?'修改密码':flag==='phoneFlag'?'绑定手机':'安全邮箱'
+                    }
+                ]
+            }else{
+                breadcrumb = [
+                    {
+                        icon:'contacts-line',
+                        url:'',
+                        text:''
+                    },
+                    {
+                        icon:'',
+                        url:'',
+                        text:'系统用户'
+                    },
+                    {
+                        icon:'',
+                        url:'',
+                        text:'编辑'
+                    }
+                ]
+            }
+            this.$emit("changeBread",breadcrumb)
         }
-        this.$emit("changeBread",breadcrumb)
     },
     changeIcon(flag){
         this[flag] = !this[flag]
@@ -546,6 +602,9 @@ export default {
           if (valid) {
             this.loading = true
             let MethodName = "/OrgServer/Manager/SysUserManager/UpdateSysUser_Password";
+            if(this.page==='editOrgPerson'){
+                MethodName = "/OrgServer/Manager/PersonManager/UpdatePerson_Password";
+            }
             let data = {
                 id: this.id,
                 password: this.passwordForm.newPwd
@@ -572,6 +631,9 @@ export default {
           if (valid) {
             this.loading = true
             let MethodName = "/OrgServer/Manager/SysUserManager/UpdateSysUser_Phone";
+            if(this.page==='editOrgPerson'){
+                MethodName = "/OrgServer/Manager/PersonManager/UpdatePerson_Phone";
+            }
             let data = {
                 id: this.id,
                 phone: this.phoneForm.newPhone
@@ -600,6 +662,9 @@ export default {
           if (valid) {
             this.loading = true
             let MethodName = "/OrgServer/Manager/SysUserManager/UpdateSysUser_Email";
+            if(this.page==='editOrgPerson'){
+                MethodName = "/OrgServer/Manager/PersonManager/UpdatePerson_Email";
+            }
             let data = {
                 id: this.id,
                 email: this.emailForm.newEmail
@@ -656,6 +721,24 @@ export default {
         this.manageAuth = []
         this.codeAuth.viewCode = 0
         this.financeAuth.selectedOptions = []
+    },
+    // 修改管理员权限
+    onSubmitManager(){
+        this.loading = true
+        let MethodName = "/OrgServer/Manager/PersonManager/UpdatePerson_Popedom";
+        let data = {
+            id: this.id,
+            is_manager: this.managerForm.is_manager,
+        }
+        getLogin(MethodName, data)
+        .then((res) => {
+            this.loading = false
+            if(res.status===1){
+                this.$message.success("修改成功")
+            }
+        }).catch((res) =>{
+            this.loading = false
+        })
     }
   },
   //生命周期 - 创建完成(可以访问当前this实例)

+ 5 - 0
src/router/index.js

@@ -109,6 +109,11 @@ export const constantRoutes = [{
         component: () =>
             import ('@/views/people_manage/EditPerson.vue')
     },
+    {
+        path: '/editOrgPerson',
+        component: () =>
+            import ('@/views/organize_manage/EditPerson.vue')
+    },
     // 404 page must be placed at the end !!!
     { path: '*', redirect: '/', hidden: true }
 ]

+ 134 - 0
src/views/organize_manage/EditPerson.vue

@@ -0,0 +1,134 @@
+<template>
+  <div class="manage-root edit-person" v-if="info">
+    <Header />
+    <div class="manage-root-contain">
+        <nav-menu class="manage-root-contain-left" :activeMenuIndex="activeMenuIndex"></nav-menu>
+        <div class="manage-root-contain-right personnel-manage-right">
+            <breadcrumb :breadcrumbList="breadcrumbList" class="breadcrumb-box"></breadcrumb>
+            <setting page="editOrgPerson" :info="info" @getInfo="getInfo" @changeBread="changeBread"></setting>
+        </div>
+    </div>
+  </div>
+</template>
+
+<script>
+//这里可以导入其它文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
+//例如:import 《组件名称》from ‘《组件路径》';
+import Header from "../../components/Header.vue";
+import NavMenu from "../../components/NavMenu.vue"
+import Breadcrumb from '../../components/Breadcrumb.vue';
+import Setting from "../../components/Setting.vue"
+import {
+  provinceAndCityData
+} from "element-china-area-data";
+import { getLogin } from "@/api/ajax";
+
+export default {
+  //import引入的组件需要注入到对象中才能使用
+  components: { Header, NavMenu, Breadcrumb, Setting },
+  props: {},
+  data() {
+    //这里存放数据
+    return {
+        provinceAndCityData,
+        activeMenuIndex: "organize_manage",
+        breadcrumbList:[],
+        tableHeight: "", // 表格高度
+        id:this.$route.query.id?this.$route.query.id:'',
+        info: null
+    }
+  },
+  //计算属性 类似于data概念
+  computed: {
+    
+  },
+  //监控data中数据变化
+  watch: {},
+  //方法集合
+  methods: {
+    //计算table高度(动态设置table高度)
+    getTableHeight() {
+      let tableH = 434; //距离页面下方的高度
+      let tableHeightDetil = window.innerHeight - tableH;
+      if (tableHeightDetil <= 300) {
+        this.tableHeight = 300;
+      } else {
+        this.tableHeight = window.innerHeight - tableH;
+      }
+    },
+    // 获取机构信息
+    getInfo(){
+        let MethodName = "/OrgServer/Manager/PersonManager/GetPersonInfo";
+        let data = {
+            id: this.id,
+        }
+        getLogin(MethodName, data)
+        .then((res) => {
+            if(res.status===1){
+                let breadcrumb = [
+                    {
+                        icon:'school-line',
+                        url:'',
+                        text:''
+                    },
+                    {
+                        icon:'',
+                        url:'',
+                        text:'机构管理'
+                    },
+                    {
+                        icon:'',
+                        url:'',
+                        text:res.person.org_name
+                    },
+                    {
+                        icon:'',
+                        url:'',
+                        text:'人员信息'
+                    }
+                ]
+                this.breadcrumbList = breadcrumb
+                this.info = res.person
+            }
+        })
+        .catch(() => {
+            
+        });
+    },
+    // 修改面包屑
+    changeBread(list){
+        this.breadcrumbList = list
+    }
+  },
+  //生命周期 - 创建完成(可以访问当前this实例)
+  created() {
+    this.getTableHeight();
+    if(this.id){
+        this.getInfo()
+    }
+    
+  },
+  //生命周期 - 挂载完成(可以访问DOM元素)
+  mounted() {
+
+  },
+  //生命周期-创建之前
+  beforeCreated() { },
+  //生命周期-挂载之前
+  beforeMount() { },
+  //生命周期-更新之前
+  beforUpdate() { },
+  //生命周期-更新之后
+  updated() { },
+  //生命周期-销毁之前
+  beforeDestory() { },
+  //生命周期-销毁完成
+  destoryed() { },
+  //如果页面有keep-alive缓存功能,这个函数会触发
+  activated() { }
+}
+</script>
+<style lang="scss" scoped>
+/* @import url(); 引入css类 */
+
+</style>

+ 1 - 1
src/views/organize_manage/PersonList.vue

@@ -475,7 +475,7 @@ export default {
         window.localStorage.setItem('pageSize',this.pageSize)
         window.localStorage.setItem('pageNumber',this.pageNumber)
         this.$router.push({
-            path: "/createOrganize",
+            path: "/editOrgPerson",
             query: {
                 id: row?row.id:''
             },