Sfoglia il codice sorgente

系统用户修改权限

natasha 1 anno fa
parent
commit
c46548214d
3 ha cambiato i file con 180 aggiunte e 109 eliminazioni
  1. BIN
      src/assets/camera.png
  2. 175 108
      src/components/Setting.vue
  3. 5 1
      src/views/people_manage/EditPerson.vue

BIN
src/assets/camera.png


+ 175 - 108
src/components/Setting.vue

@@ -7,8 +7,8 @@
                 :src="info.sys_user.image_url?info.sys_user.image_url:require('../assets/avatar.png')"
                 fit="contain">
             </el-image>
-            <a @click="toggleShow" class="img-crop">
-                <svg-icon icon-class="camera"></svg-icon>
+            <a class="img-crop">
+                <upload :datafileList="infoForm.cover_image_list" :changeFillId="handleAvatarSuccess" :fileName="'cover'" :showList="true" uploadType="image" />
             </a>
             </div>
             <div class="center">
@@ -182,6 +182,8 @@
                             </td>
                         </tr>
                     </table>
+                    <el-button type="primary" @click="onSubmitAuth()" size="small" :loading="loading">保存</el-button>
+                    <el-button @click="onCancelAuth()" size="small">取消</el-button>
             </template>
         </div>
     </template>
@@ -229,7 +231,7 @@
         </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" placeholder="请输入完整手机号" @blur="handleTrim('phoneForm','oldPhone')" >
+                <el-input v-model="phoneForm.oldPhone" autocomplete="off" disabled placeholder="请输入完整手机号" @blur="handleTrim('phoneForm','oldPhone')" >
                     <template slot="prepend">+86</template>
                 </el-input>
             </el-form-item>
@@ -251,7 +253,7 @@
         </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" placeholder="请输入邮箱地址" @blur="handleTrim('emailForm','email')" >
+                <el-input v-model="emailForm.email" autocomplete="off" disabled placeholder="请输入邮箱地址" @blur="handleTrim('emailForm','email')" >
                 </el-input>
             </el-form-item>
             <el-form-item label="新邮箱" prop="newEmail">
@@ -259,7 +261,7 @@
                 </el-input>
             </el-form-item>
             <el-form-item>
-                <el-button type="primary" @click="onSubmitPhone('emailForm')" size="small" :loading="loading">保存</el-button>
+                <el-button type="primary" @click="onSubmitEmail('emailForm')" size="small" :loading="loading">保存</el-button>
                 <el-button @click="onCancel('emailForm')" size="small">取消</el-button>
             </el-form-item>
         </el-form>
@@ -270,13 +272,14 @@
 <script>
 //这里可以导入其它文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
 //例如:import 《组件名称》from ‘《组件路径》';
+import Upload from "./Upload.vue"
 import {
   provinceAndCityData
 } from "element-china-area-data";
 import { getLogin } from "@/api/ajax";
 export default {
   //import引入的组件需要注入到对象中才能使用
-  components: { },
+  components: { Upload },
   props: ["page","info"],
   data() {
     //这里存放数据
@@ -334,6 +337,9 @@ export default {
         show: false, // 编辑头像flag
         tabsIndex: 0,
         infoForm:{
+            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)),
@@ -360,14 +366,10 @@ export default {
         phoneFlag: false, // 修改手机
         emailFlag: false, // 修改邮箱
         passwordForm:{
-            oldPwd:'', // 旧密码
             newPwd:'', // 新密码
             confirmPwd:'' // 确认密码
         },
         rulesPassword:{
-            oldPwd:[
-                { required: true, message: '请输入原始密码', trigger: 'blur' }
-            ],
             newPwd:[
                 { required: true, validator: validatePass, trigger: 'blur' },
                 { min: 6, max: 16, message: '请输入 6-16 位密码,且必须同时包含数字和大小写字母', trigger:'change' },
@@ -380,23 +382,15 @@ export default {
         newPwdFlag: false, // 查看新密码
         comfirmPwdFlag: false, // 查看确认密码
         phoneForm:{
-            oldPhone:'', // 旧手机
-            oldCode:'',  // 旧手机验证码
+            oldPhone:JSON.parse(JSON.stringify(this.info.sys_user.phone)), // 旧手机
             newPhone:'', // 新手机
-            newCode:'', // 新手机验证码
         },
         rulesPhone:{
             oldPhone:[
                 { required: true, validator: validatePhone, trigger: 'blur' },
             ],
-            oldCode:[
-                { required: true, message: '请输入验证码', trigger: 'blur' }
-            ],
             newPhone:[
                 { required: true, validator: validatePhone, trigger: 'blur' },
-            ],
-            newCode:[
-                { required: true, message: '请输入验证码', trigger: 'blur' }
             ]
         },
         time: 60, //获取验证码的时间
@@ -406,7 +400,7 @@ export default {
         timee: 60, //获取验证码的时间
         verificationCodeeShow: false, //是否已经获取了验证码
         emailForm:{
-            email:'',
+            email:JSON.parse(JSON.stringify(this.info.sys_user.email)),
             newEmail:''
         },
         rulesEmail:{
@@ -439,9 +433,19 @@ export default {
   },
   //方法集合
   methods: {
-    // 编辑头像
-    toggleShow() {
-      this.show = !this.show;
+    handleAvatarSuccess(fileList,name) {
+        let MethodName = "/OrgServer/Manager/SysUserManager/UpdateSysUser_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:''
+        }
+        getLogin(MethodName, data)
+        .then((res) => {
+            if(res.status===1){
+                this.$emit("getInfo")
+            }
+        }).catch((res) =>{
+        })
     },
     // 切换tabs
     handleChangeTabs(value){
@@ -487,6 +491,51 @@ export default {
     handleSetting(flag){
         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:'编辑'
+                }
+            ]
+        }
+        this.$emit("changeBread",breadcrumb)
     },
     changeIcon(flag){
         this[flag] = !this[flag]
@@ -495,9 +544,24 @@ export default {
     onSubmitPassword(formName){
         this.$refs[formName].validate((valid) => {
           if (valid) {
-            alert('submit!');
+            this.loading = true
+            let MethodName = "/OrgServer/Manager/SysUserManager/UpdateSysUser_Password";
+            let data = {
+                id: this.id,
+                password: this.passwordForm.newPwd
+            }
+            getLogin(MethodName, data)
+            .then((res) => {
+                this.loading = false
+                if(res.status===1){
+                    this.$message.success("修改成功")
+                    this.$emit("getInfo")
+                    this.handleSetting('passwordFlag')
+                }
+            }).catch((res) =>{
+                this.loading = false
+            })
           } else {
-            console.log('error submit!!');
             return false;
           }
         });
@@ -506,94 +570,93 @@ export default {
     onSubmitPhone(formName){
         this.$refs[formName].validate((valid) => {
           if (valid) {
-            alert('submit!');
+            this.loading = true
+            let MethodName = "/OrgServer/Manager/SysUserManager/UpdateSysUser_Phone";
+            let data = {
+                id: this.id,
+                phone: this.phoneForm.newPhone
+            }
+            getLogin(MethodName, data)
+            .then((res) => {
+                this.loading = false
+                if(res.status===1){
+                    this.$message.success("修改成功")
+                    this.$emit("getInfo")
+                    this.handleSetting('phoneFlag')
+                    this.phoneForm.oldPhone = JSON.parse(JSON.stringify(this.phoneForm.newPhone))
+                    this.phoneForm.newPhone = ''
+                }
+            }).catch((res) =>{
+                this.loading = false
+            })
           } else {
-            console.log('error submit!!');
             return false;
           }
         });
     },
-    // 发送验证码
-    sendCode(time,phone,flag,obj){
-        let this_ = this;
-        if(this_[time] != 60){
-            return
-        }
-        let timer;
-        // 修改手机号
-        if(!obj){
-            if (this_.phoneForm[phone]) {
-                let reg = /^1[3-9]\d{9}$/;
-                let result = reg.test(this_.phoneForm[phone]);
-                if (!result) {
-                    this_.$message.warning('请输入正确的手机号');
-                    return
-                }
-                this_[flag] = true;
-                timer = setInterval(() => {
-                    this_[time]--;
-                    if (this_[time] == 0) {
-                        this_[flag] = false;
-                        clearInterval(timer);
-                        timer = null;
-                        this_[time] = 60;
-                    }
-                }, 1000);
-                // let MethodName = "user_manager-SendVerificationCode";
-                // let data = {
-                // verification_type: 'EMAIL',
-                // phone_or_email: this_.loginForm.username,
-                // };
-                // getLogin(MethodName, data).then((res) => {
-                // }).catch(()=>{
-                //     this_[flag] = false;
-                //     clearInterval(timer);
-                //     timer = null;
-                //     this_[time] = 60;
-                // });
-            } else {
-                this_.$message.warning('请先输入手机号');
+    // 修改邮箱
+    onSubmitEmail(formName){
+        this.$refs[formName].validate((valid) => {
+          if (valid) {
+            this.loading = true
+            let MethodName = "/OrgServer/Manager/SysUserManager/UpdateSysUser_Email";
+            let data = {
+                id: this.id,
+                email: this.emailForm.newEmail
             }
-        }else{
-            // 修改邮箱
-            if (this_.emailForm[phone]) {
-                let reg = /^[a-zA-Z0-9_\.-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/;
-                let result = reg.test(this_.emailForm[phone]);
-                if (!result) {
-                    this_.$message.warning('请输入正确的邮箱地址');
-                    return
+            getLogin(MethodName, data)
+            .then((res) => {
+                this.loading = false
+                if(res.status===1){
+                    this.$message.success("修改成功")
+                    this.$emit("getInfo")
+                    this.handleSetting('emailFlag')
+                    this.emailForm.email = JSON.parse(JSON.stringify(this.emailForm.newEmail))
+                    this.emailForm.newEmail = ''
                 }
-                this_[flag] = true;
-                timer = setInterval(() => {
-                    this_[time]--;
-                    if (this_[time] == 0) {
-                        this_[flag] = false;
-                        clearInterval(timer);
-                        timer = null;
-                        this_[time] = 60;
-                    }
-                }, 1000);
-                // let MethodName = "user_manager-SendVerificationCode";
-                // let data = {
-                // verification_type: 'EMAIL',
-                // phone_or_email: this_.loginForm.username,
-                // };
-                // getLogin(MethodName, data).then((res) => {
-                // }).catch(()=>{
-                //     this_[flag] = false;
-                //     clearInterval(timer);
-                //     timer = null;
-                //     this_[time] = 60;
-                // });
-            } else {
-                this_.$message.warning('请先输入邮箱');
-            }
-        }
+            }).catch((res) =>{
+                this.loading = false
+            })
+          } else {
+            return false;
+          }
+        });
     },
     // 去掉前后空格
     handleTrim(form,fild){
         this[form][fild] = this[form][fild].trim()
     },
+    // 修改权限
+    onSubmitAuth(){
+        this.loading = true
+        let MethodName = "/OrgServer/Manager/SysUserManager/UpdateSysUser_Popedom";
+        let data = {
+            id: this.id,
+            popedom_code_list: this.manageAuth,
+            data_scope:{
+                discount_code_view_scope:this.codeAuth.viewCode,
+                finance_popedom_data_scope:{
+                    province_id_list:['03'],
+                    city_id_list:['02'],
+                }
+            }
+        }
+        getLogin(MethodName, data)
+        .then((res) => {
+            this.loading = false
+            if(res.status===1){
+                this.$message.success("修改成功")
+            }
+        }).catch((res) =>{
+            this.loading = false
+        })
+    },
+    // 取消权限
+    onCancelAuth(){
+        this.manageAuth = []
+        this.codeAuth.viewCode = 0
+        this.financeAuth.selectedOptions = []
+    }
   },
   //生命周期 - 创建完成(可以访问当前this实例)
   created() {
@@ -640,18 +703,13 @@ export default {
                 height: 30px;
                 right: -4px;
                 bottom: -4px;
-                background: #F2F3F5;
                 border-radius: 50%;
                 display: block;
                 text-align: center;
-                padding: 7px;
                 font-size: 0;
                 border: 2px solid #FFFFFF;
-                .svg-icon{
-                    width: 12px;
-                    height: 12px;
-                    color: #165DFF;
-                }
+                background: #F2F3F5 url("../assets/camera.png") center no-repeat;
+                background-size: 12px;
             }
             .el-image{
                 border-radius: 50%;
@@ -920,5 +978,14 @@ export default {
             width: 100% !important;
         }
     }
+    .upload{
+        width: 30px;
+        height: 30px;
+        overflow: hidden;
+        .upload-demo{
+            opacity: 0;
+            width: 100% !important;
+        }
+    }
 }
 </style>

+ 5 - 1
src/views/people_manage/EditPerson.vue

@@ -5,7 +5,7 @@
         <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="editPerson" :info="info" @getInfo="getInfo"></setting>
+            <setting page="editPerson" :info="info" @getInfo="getInfo" @changeBread="changeBread"></setting>
         </div>
     </div>
   </div>
@@ -88,6 +88,10 @@ export default {
             
         });
     },
+    // 修改面包屑
+    changeBread(list){
+        this.breadcrumbList = list
+    }
   },
   //生命周期 - 创建完成(可以访问当前this实例)
   created() {